[jboss-jira] [JBoss JIRA] (DROOLS-4967) decision table rules are not loaded into kiebase
Volodymyr Shymkiv (Jira)
issues at jboss.org
Mon Feb 10 03:24:27 EST 2020
[ https://issues.redhat.com/browse/DROOLS-4967?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Volodymyr Shymkiv reopened DROOLS-4967:
---------------------------------------
Please see attached image to understand.
The problem of your code is that you do assume that if you see "RuleSet" in the cell right before cell with package name ("org.drools.simple.candring") then you will get in bytecode with "RuleSet" with "org.drools.simple.candring" (package name) followed (ignoring several chars).
This is completely wrong projection.
You can try or see on the image attached excel files and its "source" so you can see it is different. Excel writes the content based on history not on the display order. So you can see while it is displayed the same way in excel it has completely different "source" byte stream. Of course you can see it not only on the picture but in the files previously attached itself.
> decision table rules are not loaded into kiebase
> ------------------------------------------------
>
> Key: DROOLS-4967
> URL: https://issues.redhat.com/browse/DROOLS-4967
> Project: Drools
> Issue Type: Bug
> Components: decision tables
> Affects Versions: 7.21.0.Final, 7.22.0.Final, 7.23.0.Final, 7.24.0.Final, 7.25.0.Final, 7.26.0.Final, 7.27.0.Final, 7.28.0.Final, 7.29.0.Final, 7.30.0.Final, 7.31.0.Final
> Reporter: Volodymyr Shymkiv
> Assignee: Mario Fusco
> Priority: Blocker
> Attachments: CanDrink2.xls, CanNotDrink2.xls, DROOLS-4967_package_highlight.png
>
>
> When compiling xls decision table, wrong ruleset name is parsed from the xls file. This can lead to multiple issues, like rules being filtered out by kmodule.xml configuration.
> According to documentation, decision table begins with a cell at second or third column, having value RuleSet. The cell on the right of this one contains the name of the rule set, which we want to use as a package name.
> The problem lies in naive approach to parsing the package name from the xls file. As you can see in project drools-compiler, class org.drools.compiler.kie.builder.impl.KieBuilderImpl method packageNameFromDtable, it execute as follows:
> # find "RuleSet" string in the binary data
> # find and return the nearest string which can act as a valid java package name
> The problem is, the string returned from packageNameFromDtable is NOT the value of the cell next to the RuleSet. It is actually a value of a random cell.
> To understand the problem, we need to understand the binary content of the actual xls file. Every cell is presented as a few bytes, containing cell's value, position, and other information. The "problematic" thing here is, the _order_ of the cells in the binary data is NOT constant. BUT the code really just reads the cell _binary_ next to the "RuleSet" cell.
> Problem is present since version 7.21 as it is caused by a fix for DROOLS-3888 - commit 9a179b6e6b955889200b0258ccd18cd1a5f14b46
> In our case, this results in rules not being loaded, as they are filtered out by kmodule.xml configuration. We have a lot of decision tables we want to migrate from an older drools version, and most of them are now ignored due to this bug.
--
This message was sent by Atlassian Jira
(v7.13.8#713008)
More information about the jboss-jira
mailing list