[jboss-jira] [JBoss JIRA] Created: (JBRULES-3113) MVEL accepts funny comparison and evaluates without apparent semantics

Wolfgang Laun (JIRA) jira-events at lists.jboss.org
Thu Jun 30 02:00:23 EDT 2011


MVEL accepts funny comparison and evaluates without apparent semantics
----------------------------------------------------------------------

                 Key: JBRULES-3113
                 URL: https://issues.jboss.org/browse/JBRULES-3113
             Project: Drools
          Issue Type: Bug
      Security Level: Public (Everyone can see)
          Components: drools-compiler (expert)
    Affects Versions: 5.2.0.Final
            Reporter: Wolfgang Laun
            Assignee: Mark Proctor
             Fix For: 5.3.0.Beta1


Without "dialect 'mvel'", the funny expression in eval() is (correctly) refused by the compiler (" The operator == is undefined for the argument type(s) boolean, int"). Using MVEL, the rule compiles and fires, apparently with random values for $int3 and $long4:
test5 1 1 65536 4294967296
test5 1 1 65568 4294967296
test5 1 1 65552 4294967296
test5 1 1 65536 65536
test5 1 1 65568 65536
test5 1 1 65552 65536
test5 1 1 65536 65568
test5 1 1 65536 65552
test5 1 1 65568 65568
test5 1 1 65552 65568
test5 1 1 65568 65552
test5 1 1 65552 65552

=== DRL ===
dialect "mvel"

rule kickOff
when
then
    insert( Integer.valueOf( 1 ) );
    insert( Long.valueOf( 1 ) );
    insert( Integer.valueOf( 65552 ) );   // 0x10010
    insert( Long.valueOf( 65552 ) );
    insert( Integer.valueOf( 65568 ) );   // 0x10020
    insert( Long.valueOf( 65568 ) );
    insert( Integer.valueOf( 65536  ) );  // 0x10000
    insert( Long.valueOf( 65536L ) );
    insert( Long.valueOf( 4294967296L ) );  // 0x100000000L
end

rule test5
salience 100
when
    $n1: Integer( $int1: intValue == 1 )
    $n2: Long   ( $long2: longValue )
    $n3: Integer( this != $n1, $int3: intValue )
    $n4: Long   ( this != $n2, $long4: longValue )
    eval( $int1 == $long2 == $int3 == $long4 )
then
    System.out.println( "test5 " + $int1  + " "
                                 + $long2 + " "
                                 + $int3  + " "
                                 + $long4  );
end



--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the jboss-jira mailing list