Bug 808084

Summary: Loading template and CSV since 5.2.0 causes NullPointerException
Product: [JBoss] JBoss Enterprise BRMS Platform 5 Reporter: Adam Kovari <akovari>
Component: SOA-PAssignee: manstis
Status: MODIFIED --- QA Contact: Lukáš Petrovický <lpetrovi>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: BRMS 5.2.0.GACC: mproctor, nobody, rwagner
Target Milestone: ---Flags: manstis: needinfo+
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 813425 (view as bug list) Environment:
Last Closed: Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Bug Depends On:    
Bug Blocks: 813425    
Attachments:
Description Flags
CSV
none
template
none
XLS
none
testing project
none
Mavenized version of the reproducer that is easier to use (but it suceeds) none

Description Adam Kovari 2012-03-29 14:27:48 UTC
Description of problem:
        ExternalSpreadsheetCompiler converter = new ExternalSpreadsheetCompiler();
        
        String drl = null;
        try{   
        	InputStream csv = ResourceFactory.newClassPathResource("TableAnticipation.csv").getInputStream();
        	InputStream tpl = ResourceFactory.newClassPathResource("Anticipation.drt").getInputStream();
        	
        	//Version csv 
        	drl = converter.compile(csv, tpl,InputType.CSV ,1, 1);
        		
        	//Version XLS	
        	//drl = converter.compile(csv, tpl,InputType.XLS, 2, 2);
        	  
        } catch (IOException e) {
        	throw new IllegalArgumentException("Could not read spreadsheet or rules stream.", e);
        }

works fine in BRMS 5.1.0, in 5.2.0 the NPE is thrown, see below

Version-Release number of selected component (if applicable):
JBoss BRMS 5.2.0

How reproducible:
always

Steps to Reproduce:
1. run attached example
2.
3.
  
Actual results:
java.lang.NullPointerException
      at org.jbpm.process.instance.ProcessRuntimeImpl.dispose(ProcessRuntimeImpl.java:384)
      at org.drools.common.AbstractWorkingMemory.dispose(AbstractWorkingMemory.java:1256)
      at org.drools.reteoo.ReteooStatefulSession.dispose(ReteooStatefulSession.java:179)
      at org.drools.template.parser.TemplateDataListener.finishSheet(TemplateDataListener.java:121)
      at org.drools.decisiontable.parser.csv.CsvParser.finishSheet(CsvParser.java:79)
      at org.drools.decisiontable.parser.csv.CsvParser.parseFile(CsvParser.java:64)
      at org.drools.decisiontable.ExternalSpreadsheetCompiler.compile(ExternalSpreadsheetCompiler.java:136)
      at org.drools.decisiontable.ExternalSpreadsheetCompiler.compile(ExternalSpreadsheetCompiler.java:164)
      at org.drools.decisiontable.ExternalSpreadsheetCompiler.compile(ExternalSpreadsheetCompiler.java:95)
      at com.sample.DroolsTest.readKnowledgeBase(DroolsTest.java:63)
      at com.sample.DroolsTest.main(DroolsTest.java:29)


Expected results:
processed file without exceptions being thrown like in 5.1.0

Additional info:

Comment 1 Adam Kovari 2012-03-29 14:28:29 UTC
Created attachment 573684 [details]
CSV

Adding CSV used in example

Comment 2 Adam Kovari 2012-03-29 14:29:10 UTC
Created attachment 573685 [details]
template

Adding DROOLS template

Comment 3 Adam Kovari 2012-03-29 14:29:45 UTC
Created attachment 573686 [details]
XLS

Adding XLS used in exmaple

Comment 4 manstis 2012-04-05 19:33:43 UTC
The provided test passes in master (Community 5.4.0.CR1).

Comment 5 manstis 2012-04-05 20:17:49 UTC
Confirmed to work as expected in 5.3.x too. Setting to MODIFIED so QA are aware.

Comment 6 manstis 2012-04-11 10:26:48 UTC
Hi, I tested with 5.2.0.Final (community) and the test with CSV and XLS works OK.

Is there a particular version I need to try this with?

Comment 7 Adam Kovari 2012-04-12 07:14:42 UTC
Created attachment 576973 [details]
testing project

Hi, I uploaded project that I used for testing. Run com.sample.DroolsTest2 class as Java Application. On Classpath I have SOA-P 5.2.0 which contains:
Drools Exper (business rules engine)	5.2.0.BRMS

Comment 8 Adam Kovari 2012-04-12 13:28:02 UTC
Confirming that community version 5.2.0.Final works as expected - no exception thrown
BRMS-P 5.2.0.GA throws the exception as in the #1 comment


I'd say it has been fixed somewhere between BRMS-P and 5.2.0.Final community version

This should also be fixed in SOA-P 5.2.0 which has the same bug

Comment 9 Rick Wagner 2012-04-12 13:48:11 UTC
Thanks much to Michael and Adam for the version validations.  This issue is currently under discussion with SOA-PM to see if we can pull newer community bits for a BRMS 5.2 Roll up patch.  

If so, we will hopefully have a fix for 5.2.

If not, we'll be sure to validate this use case against BRMS 5.3, which is currently in development.

I'll update as we learn more.

Comment 10 Geoffrey De Smet 2012-04-19 15:25:00 UTC
Doug Palmer asked me to verify if this issue runs with the head of 5.2.x (because micheal is on PTO). There was suspicion that it is a regression from 5.2.0.Final to 5.2.2-SNAPSHOT.

I did and this issue is not reproducible with 5.2.2-SNAPSHOT. I 've updated and build all of 5.2.x to make sure I got the latest 5.2.2.-SNAPSHOT. Both java main classes in the "testing project" run and neither produces a stacktrace.

This does not explain why it fails on BRMS 5.2.x, but I presume the BRMS 5.2.x branch in not in sync with the 5.2.x branch (which is unlikely, as all changes have to go in project first).

Comment 11 Geoffrey De Smet 2012-04-19 15:32:54 UTC
Created attachment 578676 [details]
Mavenized version of the reproducer that is easier to use (but it suceeds)

Comment 12 Geoffrey De Smet 2012-04-19 15:33:13 UTC
I've attached the mavenized version that I use.