[jboss-jira] [JBoss JIRA] (DROOLS-4967) decision table rules are not loaded into kiebase

Volodymyr Shymkiv (Jira) issues at jboss.org
Wed Jan 22 13:10:33 EST 2020


Volodymyr Shymkiv created DROOLS-4967:
-----------------------------------------

             Summary: 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.31.0.Final, 7.30.0.Final, 7.29.0.Final, 7.28.0.Final, 7.27.0.Final, 7.26.0.Final, 7.25.0.Final, 7.24.0.Final, 7.23.0.Final, 7.22.0.Final, 7.21.0.Final
            Reporter: Volodymyr Shymkiv
            Assignee: Mario Fusco


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