[jboss-jira] [JBoss JIRA] Commented: (JBRULES-459) Literal constraint using 'null' triggers a NPE.

Serge Brisson (JIRA) jira-events at jboss.com
Wed Aug 30 11:19:44 EDT 2006


    [ http://jira.jboss.com/jira/browse/JBRULES-459?page=comments#action_12342353 ] 
            
Serge Brisson commented on JBRULES-459:
---------------------------------------

Result.getValue() returns a Serializable.

In fact, Result is an Interface. The actual instance is a BasicResult which inherits from a BasicValue.

You can browse all this at: http://svn.sourceforge.net/viewvc/rvpf/trunk/rules/src/java/org/rvpf/rules/

I will verify what is the actual class of the instance returned by Result.getValue() when the NPE occurs and report here later.

> Literal constraint using 'null' triggers a NPE.
> -----------------------------------------------
>
>                 Key: JBRULES-459
>                 URL: http://jira.jboss.com/jira/browse/JBRULES-459
>             Project: JBoss Rules
>          Issue Type: Bug
>      Security Level: Public(Everyone can see) 
>    Affects Versions: 3.0.4
>         Environment: Windows XP SP2.
>            Reporter: Serge Brisson
>         Assigned To: Edson Tirelli
>             Fix For: 3.0.5
>
>
> The following triggers the problem:
> rule "Drops null results"
>     when
>         $result: Result(value == null)
>     then
>         retract($result);
> end
> Stack trace:
> java.lang.NullPointerException
> 	at org.drools.base.evaluators.ArrayFactory$ArrayEqualEvaluator.evaluate(Unknown Source)
> 	at org.drools.rule.LiteralConstraint.isAllowed(Unknown Source)
> 	at org.drools.reteoo.AlphaNode.assertObject(Unknown Source)
> 	at org.drools.reteoo.ObjectSource.propagateAssertObject(Unknown Source)
> 	at org.drools.reteoo.ObjectTypeNode.assertObject(Unknown Source)
> 	at org.drools.reteoo.Rete.assertObject(Unknown Source)
> 	at org.drools.reteoo.ReteooRuleBase.assertObject(Unknown Source)
> 	at org.drools.reteoo.ReteooWorkingMemory.doAssertObject(Unknown Source)
> 	at org.drools.common.AbstractWorkingMemory.assertObject(Unknown Source)
> 	at org.drools.common.AbstractWorkingMemory.assertObject(Unknown Source)
> 	at org.drools.jsr94.rules.StatelessRuleSessionImpl.executeRules(Unknown Source)
> 	at org.drools.jsr94.rules.StatelessRuleSessionImpl.executeRules(Unknown Source)
> 	at org.rvpf.rules.ServiceProviderTests.testStatelessSession(ServiceProviderTests.java:130)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> 	at java.lang.reflect.Method.invoke(Method.java:585)
> 	at org.testng.internal.MethodHelper.invokeMethod(MethodHelper.java:552)
> 	at org.testng.internal.Invoker.invokeMethod(Invoker.java:411)
> 	at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:785)
> 	at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:114)
> 	at org.testng.TestRunner.privateRun(TestRunner.java:695)
> 	at org.testng.TestRunner.run(TestRunner.java:574)
> 	at org.testng.SuiteRunner.privateRun(SuiteRunner.java:241)
> 	at org.testng.SuiteRunner.run(SuiteRunner.java:145)
> 	at org.testng.TestNG.createAndRunSuiteRunners(TestNG.java:901)
> 	at org.testng.TestNG.runSuitesLocally(TestNG.java:863)
> 	at org.testng.TestNG.run(TestNG.java:613)
> 	at org.rvpf.tests.FrameworkTests.main(FrameworkTests.java:132)
> The following is a successful work-around:
> rule "Drops null results"
>     when
>         $result: Result()
>         eval($result.getValue() == null)
>     then
>         retract($result);
> end

-- 
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

        



More information about the jboss-jira mailing list