Bug 1300699 - [GSS] (6.2.z) Parsing of a complex constraint with an || causes a RuntimeException
Summary: [GSS] (6.2.z) Parsing of a complex constraint with an || causes a RuntimeExce...
Keywords:
Status: CLOSED EOL
Alias: None
Product: JBoss BRMS Platform 6
Classification: Retired
Component: BRE
Version: 6.2.0
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: CR1
: 6.2.2
Assignee: Mario Fusco
QA Contact: Tibor Zimanyi
URL:
Whiteboard:
Depends On: 1300692
Blocks: 1309326 1309327
TreeView+ depends on / blocked
 
Reported: 2016-01-21 13:44 UTC by Martin Weiler
Modified: 2020-03-27 19:07 UTC (History)
5 users (show)

Fixed In Version:
Clone Of: 1300692
Environment:
Last Closed: 2020-03-27 19:07:58 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Martin Weiler 2016-01-21 13:44:48 UTC
+++ This bug was initially created as a clone of Bug #1300692 +++

Description of problem:
Platform issue for DROOLS-1037 to fix the following RuntimeException during compilation:

java.lang.RuntimeException

	at org.drools.compiler.rule.builder.PatternBuilder.rewriteCompositeExpressions(PatternBuilder.java:924)

	at org.drools.compiler.rule.builder.PatternBuilder.rewriteCompositeExpressions(PatternBuilder.java:919)

	at org.drools.compiler.rule.builder.PatternBuilder.rewriteOrExpressions(PatternBuilder.java:893)

	at org.drools.compiler.rule.builder.PatternBuilder.buildExpression(PatternBuilder.java:889)

	at org.drools.compiler.rule.builder.PatternBuilder.buildCcdDescr(PatternBuilder.java:860)

	at org.drools.compiler.rule.builder.PatternBuilder.build(PatternBuilder.java:715)

	at org.drools.compiler.rule.builder.PatternBuilder.processConstraintsAndBinds(PatternBuilder.java:580)


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


How reproducible:


Steps to Reproduce:
1. Build a rule with the following LHS: 
$p : Person( name == null || (name in (\"Alice\", \"Charlie\", \"David\"))==false )
2. Try to compile the package


Actual results:
Build fails with RuntimeException

Expected results:
Build is successful

Additional info:
Changing the constraint to the following works as well:
$p : Person( name == null || (name not in (\"Alice\", \"Charlie\", \"David\")) )

--- Additional comment from JBoss Product and Program Management on 2016-01-21 14:20:19 CET ---

Since this issue was entered in Red Hat Bugzilla, the release flag has been
set to ? to ensure that it is properly evaluated for this release.

Comment 3 Edson Tirelli 2016-01-25 23:50:32 UTC
Martin, we will fix the runtime exception, but the reported syntax is not a valid DRL syntax:

(name in (\"Alice\", \"Charlie\", \"David\"))==false

The only accepted syntaxes are 

x in ("foo", "bar") 
x not in ("foo", "bar")

Mario, can you please add error handling for this scenario?

Comment 5 Martin Weiler 2016-01-26 07:25:49 UTC
This syntax is working in BRMS 6.1. In BRMS 6.2, the compiler should emit a WARN message when such an invalid syntax is used, to make users aware that their rules need to be fixed. We could then reject this syntax in BRMS 6.3 or 7, and make sure this is documented in the migration guide. 

WDYT?

Comment 6 Mario Fusco 2016-02-24 13:52:54 UTC
Cherry-picked to 6.3.x branch with https://github.com/droolsjbpm/drools/commit/014f29c15

Comment 7 Tibor Zimanyi 2016-03-07 15:43:03 UTC
Verified by running reproducer attached in the Mario's commit.


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