Bug 808084 - Loading template and CSV since 5.2.0 causes NullPointerException
Loading template and CSV since 5.2.0 causes NullPointerException
Product: JBoss Enterprise BRMS Platform 5
Classification: JBoss
Component: SOA-P (Show other bugs)
BRMS 5.2.0.GA
Unspecified Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: manstis
Lukáš Petrovický
Depends On:
Blocks: 813425
  Show dependency treegraph
Reported: 2012-03-29 10:27 EDT by Adam Kovari
Modified: 2015-08-31 23:04 EDT (History)
6 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 813425 (view as bug list)
Last Closed:
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---
manstis: needinfo+

Attachments (Terms of Use)
CSV (49 bytes, text/csv)
2012-03-29 10:28 EDT, Adam Kovari
no flags Details
template (470 bytes, application/octet-stream)
2012-03-29 10:29 EDT, Adam Kovari
no flags Details
XLS (9.50 KB, application/vnd.ms-excel)
2012-03-29 10:29 EDT, Adam Kovari
no flags Details
testing project (8.73 KB, application/zip)
2012-04-12 03:14 EDT, Adam Kovari
no flags Details
Mavenized version of the reproducer that is easier to use (but it suceeds) (33.51 KB, application/zip)
2012-04-19 11:32 EDT, Geoffrey De Smet
no flags Details

  None (edit)
Description Adam Kovari 2012-03-29 10:27:48 EDT
Description of problem:
        ExternalSpreadsheetCompiler converter = new ExternalSpreadsheetCompiler();
        String drl = null;
        	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:

Steps to Reproduce:
1. run attached example
Actual results:
      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 10:28:29 EDT
Created attachment 573684 [details]

Adding CSV used in example
Comment 2 Adam Kovari 2012-03-29 10:29:10 EDT
Created attachment 573685 [details]

Adding DROOLS template
Comment 3 Adam Kovari 2012-03-29 10:29:45 EDT
Created attachment 573686 [details]

Adding XLS used in exmaple
Comment 4 manstis 2012-04-05 15:33:43 EDT
The provided test passes in master (Community 5.4.0.CR1).
Comment 5 manstis 2012-04-05 16:17:49 EDT
Confirmed to work as expected in 5.3.x too. Setting to MODIFIED so QA are aware.
Comment 6 manstis 2012-04-11 06:26:48 EDT
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 03:14:42 EDT
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 09:28:02 EDT
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 09:48:11 EDT
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 11:25:00 EDT
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 11:32:54 EDT
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 11:33:13 EDT
I've attached the mavenized version that I use.

Note You need to log in before you can comment on or make changes to this bug.