[jboss-jira] [JBoss JIRA] (JBRULES-3083) DecisionTable incorrectly parsed with 5.2.0.CR1
Christophe Denis (JIRA)
jira-events at lists.jboss.org
Fri Oct 12 02:28:03 EDT 2012
[ https://issues.jboss.org/browse/JBRULES-3083?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12725810#comment-12725810 ]
Christophe Denis commented on JBRULES-3083:
-------------------------------------------
Dear Drools developers,
I would like to share a fix for the bug described above. Because I'm not experienced with Git (until now), I'll post the fix right here. I hope you can fix this in the next release.
The problem is the Pattern block in class org.drools.decisiontable.parser.LhsBuilder:
To assert that only the last condition in a column matches the pattern, replace (Sources from 5.4.0.Final)
{code}private static final Pattern patParFrm = Pattern.compile( "\\(\\s*\\)\\s*from\\b" );
private static final Pattern patFrm = Pattern.compile( "\\s+from\\s+" );
private static final Pattern patPar = Pattern.compile( "\\(\\s*\\)" );
private static final Pattern patEval = Pattern.compile( "\\beval\\s*(?:\\(\\s*\\)\\s*)?$" );{code}
by this
{code}private static final Pattern patParFrm = Pattern.compile ("\\(\\s*\\)\\s*from\\b\\s*\\Z");
private static final Pattern patFrm = Pattern.compile ("\\s+from\\s+\\Z");
private static final Pattern patPar = Pattern.compile ("\\(\\s*\\)\\s*\\Z");
private static final Pattern patEval = Pattern.compile ("\\beval\\s*(?:\\(\\s*\\)\\s*)?$\\s*\\Z");{code}
Hope this helps!
Greetz,
Christophe
> DecisionTable incorrectly parsed with 5.2.0.CR1
> -----------------------------------------------
>
> Key: JBRULES-3083
> URL: https://issues.jboss.org/browse/JBRULES-3083
> Project: Drools
> Issue Type: Bug
> Security Level: Public(Everyone can see)
> Affects Versions: 5.2.0.CR1, 5.4.0.Beta2
> Reporter: Kara Melba
> Assignee: Mark Proctor
> Fix For: 5.5.0.CR1
>
> Attachments: decisiontable.jpg
>
>
> 5.2.0.CR1 creates incorrect drl from decision table. With 5.1.0.M1 the drl for the same decision table is correct.
> Wrong DRL from 5.2.0.CR1:
> rule "ProcessState"
> salience 65522
> ruleflow-group "CompleteSubOrder"
> activation-group "ProcessState"
> when
> $m:ModifiedMarker(processState==null, state ==null)
> $s:SubOrder
> then
> $m.setIsModified(true);
> $s.setProcessState(ProcessState.CREATED);
>
> end
> Correct DRL with 5.1.0.M1:
> rule "ProcessState"
> salience 65522
> ruleflow-group "CompleteSubOrder"
> activation-group "ProcessState"
> when
> $m:ModifiedMarker()
> $s:SubOrder(processState==null, state ==null)
> then
> $m.setIsModified(true);
> $s.setProcessState(ProcessState.CREATED);
>
> end
> The difference is that the constraints are put to $m instead of putting them to $s.
> The attached jpg contains the decision table snippet.
> The behaviour in 5.2.0.CR1 is the same for all decision tables in my project and prevents me from upgrading to newer drools versions.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the jboss-jira
mailing list