Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 1074672

Summary: knowledge-api: cannot build Decision Table from CSV
Product: [Retired] JBoss BRMS Platform 6 Reporter: Marek Winkler <mwinkler>
Component: BREAssignee: Edson Tirelli <etirelli>
Status: CLOSED CURRENTRELEASE QA Contact: Marek Winkler <mwinkler>
Severity: high Docs Contact:
Priority: high    
Version: 6.0.1CC: mbiarnes, rrajasek
Target Milestone: CR1   
Target Release: 6.0.1   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-08-06 19:56:42 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Maven project with reproducer none

Description Marek Winkler 2014-03-10 19:37:17 UTC
Created attachment 872834 [details]
Maven project with reproducer

Description of problem:

When using Drools legacy knowledge-api, it is not possible to build a Decision Table from a CSV resource, because the builder thinks that its type is XLS, even if the type is set in the DecisionTableConfiguration as follows:

DecisionTableConfiguration dtconf = KnowledgeBuilderFactory.newDecisionTableConfiguration();
        dtconf.setInputType(DecisionTableInputType.CSV);

        KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
        kbuilder.add(ResourceFactory.newClassPathResource("sample.csv", getClass()), ResourceType.DTABLE, dtconf);

The stacktrace I get indicates that Drools try to parse the file as a XLS:

java.lang.IllegalArgumentException: Your InputStream was neither an OLE2 stream, nor an OOXML stream
	at org.apache.poi.ss.usermodel.WorkbookFactory.create(WorkbookFactory.java:75)
	at org.drools.decisiontable.parser.xls.ExcelParser.parseFile(ExcelParser.java:81)
...

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

BRMS 6.0.1 ER2

How reproducible:

Please run mvn clean test in the attached maven project.

Actual results:

Compilation fails with error saying "Your InputStream was neither an OLE2 stream, nor an OOXML stream".

Expected results:

The test passes (compilation succeeds).

Comment 1 Edson Tirelli 2014-03-11 04:01:03 UTC
We will fix this. Just not sure it is a blocker for 6.0.1 because it affects the legacy API. Engineering is ok either way.

Comment 2 Rajesh Rajasekaran 2014-03-11 13:12:00 UTC
Low risk, isolated change, we have a chance for customers to depend on this, will cherry pick

Comment 4 Michael 2014-03-17 15:11:21 UTC
Ticket cherry-picked into 6.0.1.CR1. 
Commit: 378e199cd2b481e078c907bf468d12ae750574de

Comment 5 Marek Winkler 2014-03-24 08:49:31 UTC
Verified on BRMS 6.0.1 CR1.