[jboss-jira] [JBoss JIRA] Commented: (JBRULES-2734) NPE loading changeset

Esteban Aliverti (JIRA) jira-events at lists.jboss.org
Tue May 17 08:23:01 EDT 2011


    [ https://issues.jboss.org/browse/JBRULES-2734?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12602557#comment-12602557 ] 

Esteban Aliverti commented on JBRULES-2734:
-------------------------------------------

I tried to reproduce the error using the following rule:

{code:none}
package org.drools

global Integer salesChannelId;
global Boolean includeFinishing;
global java.util.List list;

rule "Rule A"
  dialect "java"
  ruleflow-group "finishing-price"
  when
      $s : String()
      eval(salesChannelId @operator@ 4 && includeFinishing)
  then
      list.add("@message@");
  end

{code}

In the code above, I'm using @operator@ and @message@ as placeholders that helps me to modify the rule so the agent can process it. 
What I do first is to replace @operator@ with "!=" and let the agent to compile the rule.
After that, I replace @operator@ with "==" and notify the agent about this change. The change is applied correctly. If I debug the test, I can see how EvalCondition.equals() is invoked and how it returns the correct value.

@Tommy, do you see any significant difference between your rule and the one I'm using? Can you test your code using Drools 5.2?

BTW, I will implement the missing comparison for WorkFlowProcess.    

> NPE loading changeset
> ---------------------
>
>                 Key: JBRULES-2734
>                 URL: https://issues.jboss.org/browse/JBRULES-2734
>             Project: Drools
>          Issue Type: Bug
>      Security Level: Public(Everyone can see) 
>          Components: drools-core  (expert)
>    Affects Versions: 5.1.1.FINAL
>            Reporter: Tommy Odom
>            Assignee: Esteban Aliverti
>             Fix For: 5.2.0.CR1
>
>
> We are receiving a NPE when drools is attempting to load the deltas from guvnor in our webapp.  This used to work fine in 5.0 but we recently upgraded to 5.1 and started receiving this error after we create a new snapshot in guvnor.
> The output from our application server log is:
> KnowledgeAgent applying ChangeSet
> KnowledgeAgent performing an incremental build of the ChangeSet
> no visitor implementation for : class org.drools.ruleflow.core.RuleFlowProcess : org.drools.ruleflow.core.RuleFlowProcess at 30012e
> Exception in thread "Thread-36" 
> org.drools.RuntimeDroolsException: java.lang.reflect.InvocationTargetException : [R
> ule name=Project Part Custom Finishing Cost, agendaGroup=MAIN, salience=0, no-loop=false]        at org.drools.core.util.ReflectiveVisitor.visit(ReflectiveVisitor.java:56)
>         at org.drools.agent.impl.BinaryResourceDiffProducerImpl.diff(BinaryResourceDiffProducerImpl.java:63)
>         at org.drools.agent.impl.KnowledgeAgentImpl.incrementalBuildResources(KnowledgeAgentImpl.java:785)        at org.drools.agent.impl.KnowledgeAgentImpl.buildKnowledgeBase(KnowledgeAgentImpl.java:586)
>         at org.drools.agent.impl.KnowledgeAgentImpl.applyChangeSet(KnowledgeAgentImpl.java:185)
>         at org.drools.agent.impl.KnowledgeAgentImpl$ChangeSetNotificationDetector.run(KnowledgeAgentImpl.java:1106)        at java.lang.Thread.run(Thread.java:619)
> Caused by: java.lang.reflect.InvocationTargetException
>         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:597)        at org.drools.core.util.ReflectiveVisitor.visit(ReflectiveVisitor.java:47)
>         ... 6 more
> Caused by: java.lang.NullPointerException        at org.drools.rule.EvalCondition.equals(EvalCondition.java:169)
>         at org.drools.rule.GroupElement.equals(GroupElement.java:273)
>         at org.drools.agent.impl.BinaryResourceDiffProducerImpl.compareRules(BinaryResourceDiffProducerImpl.java:258)
>         at org.drools.agent.impl.BinaryResourceDiffProducerImpl.visitRule(BinaryResourceDiffProducerImpl.java:117)
>         ... 11 more
> The rule that it mentions in the error is:
> dialect "java"
> ruleflow-group "finishing-price"
> when
>   $pp : ProjectPart(finishTime > 0)
>   eval(salesChannelId != 4 && includeFinishing)
> then
>   double finishingRate = 1;
>   double customFinishingCost = $pp.getQuantity() * $pp.getFinishTime() * finishingRate;
>   addToProjectFinishingCost($pp.getProject(), customFinishingCost);

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