[jboss-jira] [JBoss JIRA] (DROOLS-1461) In operator doesn't work with variable
Matteo Mortari (JIRA)
issues at jboss.org
Fri Mar 3 07:01:00 EST 2017
[ https://issues.jboss.org/browse/DROOLS-1461?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13372204#comment-13372204 ]
Matteo Mortari commented on DROOLS-1461:
----------------------------------------
I'm also voting for close/reject this issue, as the second rule in the description has a different semantic than what intended by the reporter, I think.
The second rule semantic means, check {{message}} is contained {{in}} the elements within the round parenthesis. Now the message property (String) is NOT contained in the set of elements contaning 1 element, the global {{$myGlobal}} which is in itself a list.
In other words and pseudocode it's checking if:
{code:java}
"anton" ⊆ { ["anton", "giertli"] }
{code}
which is false. Please notice the set on the right (marked by the { } parenthesis) contains 1 element, the list represented by the [ ] parenthesis
----
This can be demonstrated also by changing the test for message to contain an arbitrary Object, as:
!screenshot-1.png|thumbnail!
which would realize the check
{code:java}
["anton", "giertli"] ⊆ { ["anton", "giertli"] }
{code}
which is then true, and making {{testInOperator()}} pass.
----
Please notice only the *_first_* rule in the description is doing semantically what I expect is actually desired by the reporter which is:
{code:java}
"anton" ⊆ { "anton", "giertli" }
{code}
(you can notice now the set on the right marked by the { } parenthesis contains 2 elements)
> In operator doesn't work with variable
> --------------------------------------
>
> Key: DROOLS-1461
> URL: https://issues.jboss.org/browse/DROOLS-1461
> Project: Drools
> Issue Type: Bug
> Components: core engine
> Reporter: Anton Giertli
> Assignee: Mario Fusco
> Attachments: operators.zip, screenshot-1.png
>
>
> This works just fine:
> {code:java}
> rule "checkFirstName"
> dialect "mvel"
> when
> Message( message in ( "anton","giertli") )
> then
> System.out.println("LHS OK");
> end
> {code}
> But rule like this, won't fire:
> {code:java}
> global java.util.List $myGlobal;
> rule "checkFirstName"
> dialect "mvel"
> when
> Message( message in ( $myGlobal) )
> then
> System.out.println("LHS OK");
> end
> {code}
--
This message was sent by Atlassian JIRA
(v7.2.3#72005)
More information about the jboss-jira
mailing list