Bug 1300699 - [GSS] (6.2.z) Parsing of a complex constraint with an || causes a RuntimeException
[GSS] (6.2.z) Parsing of a complex constraint with an || causes a RuntimeExce...
Status: VERIFIED
Product: JBoss BRMS Platform 6
Classification: JBoss
Component: BRE (Show other bugs)
6.2.0
Unspecified Unspecified
medium Severity medium
: CR1
: 6.2.2
Assigned To: Mario Fusco
Tibor Zimanyi
:
Depends On: 1300692
Blocks: 1309326 1309327
  Show dependency treegraph
 
Reported: 2016-01-21 08:44 EST by Martin Weiler
Modified: 2016-03-08 00:40 EST (History)
5 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 1300692
Environment:
Last Closed:
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Martin Weiler 2016-01-21 08:44:48 EST
+++ 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 18:50:32 EST
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 02:25:49 EST
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 08:52:54 EST
Cherry-picked to 6.3.x branch with https://github.com/droolsjbpm/drools/commit/014f29c15
Comment 7 Tibor Zimanyi 2016-03-07 10:43:03 EST
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.