[
http://jira.jboss.com/jira/browse/JBRULES-1001?page=all ]
Edgardo Carena updated JBRULES-1001:
------------------------------------
Summary: NullPointerException when a function is used inside a predicate value
constraint (was: NullPointerException when a function is used inside a predicate
expression )
Description:
if you change the FibonacciExample like this:
(...)
import java.lang.Math;
function boolean approxEqual(double val1, double val2) {
return (Math.abs(val1-val2)<0.01);
}
(....)
rule Calculate
when
f1 : Fibonacci( s1 : sequence, value != -1 )
f2 : Fibonacci( s2 : sequence -> (approxEqual(sequence,(s1 + 1))),
value != -1 )
f3 : Fibonacci( sequence == (s2 + 1 ), value == -1 )
then
f3.setValue( f1.getValue() + f2.getValue() );
update( f3 );
retract( f1 );
System.out.println( f3.getSequence() + " == " + f3.getValue()
);
end
thus introducing a function inside a predicate value constraint, the example works well,
however a NullPointerException is printed out during the call of the addPackageFromDrl
method.
I tried in many examples, also calling directly the java.lang.Math.abs function, and the
message is always printed with no apparent side effect.
was:
if you change the FibonacciExample like this:
(...)
import java.lang.Math;
function boolean approxEqual(double val1, double val2) {
return (Math.abs(val1-val2)<0.01);
}
(....)
rule Calculate
when
f1 : Fibonacci( s1 : sequence, value != -1 )
f2 : Fibonacci( s2 : sequence -> (approxEqual(sequence,(s1 + 1))),
value != -1 )
f3 : Fibonacci( sequence == (s2 + 1 ), value == -1 )
then
f3.setValue( f1.getValue() + f2.getValue() );
update( f3 );
retract( f1 );
System.out.println( f3.getSequence() + " == " + f3.getValue()
);
end
thus introducing a function inside a predicate expression, the example works well, however
a NullPointerException is printed out during the call of the addPackageFromDrl method.
I tried in many examples, also calling directly the java.lang.Math.abs function, and the
message is always printed with no apparent side effect.
NullPointerException when a function is used inside a predicate value
constraint
--------------------------------------------------------------------------------
Key: JBRULES-1001
URL:
http://jira.jboss.com/jira/browse/JBRULES-1001
Project: JBoss Rules
Issue Type: Bug
Security Level: Public(Everyone can see)
Affects Versions: 4.0.0.MR3
Reporter: Edgardo Carena
Assigned To: Mark Proctor
Priority: Minor
if you change the FibonacciExample like this:
(...)
import java.lang.Math;
function boolean approxEqual(double val1, double val2) {
return (Math.abs(val1-val2)<0.01);
}
(....)
rule Calculate
when
f1 : Fibonacci( s1 : sequence, value != -1 )
f2 : Fibonacci( s2 : sequence -> (approxEqual(sequence,(s1 + 1))),
value != -1 )
f3 : Fibonacci( sequence == (s2 + 1 ), value == -1 )
then
f3.setValue( f1.getValue() + f2.getValue() );
update( f3 );
retract( f1 );
System.out.println( f3.getSequence() + " == " + f3.getValue()
);
end
thus introducing a function inside a predicate value constraint, the example works well,
however a NullPointerException is printed out during the call of the addPackageFromDrl
method.
I tried in many examples, also calling directly the java.lang.Math.abs function, and the
message is always printed with no apparent side effect.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira