[jboss-jira] [JBoss JIRA] Issue Comment Edited: (JBRULES-2326) request to improve upon error message received from invalid rule syntax (currently getting NPE)
Jeremy Ary (JIRA)
jira-events at lists.jboss.org
Fri Oct 1 15:16:40 EDT 2010
[ https://jira.jboss.org/browse/JBRULES-2326?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12554735#action_12554735 ]
Jeremy Ary edited comment on JBRULES-2326 at 10/1/10 3:15 PM:
--------------------------------------------------------------
I recommend closing the issue. I re-ran my scenario given Mark's comment and the issue has been fixed two-fold. The DRL now shows the error within the file, and the runtime exception is much clearer:
{panel}
Exception in thread "main" java.lang.RuntimeException: Rule Compilation error : [Rule name='rule1']
com/famc/rules/Rule_rule1_0.java (7:366) : car cannot be resolved
com/famc/rules/Rule_rule1_0.java (7:416) : The method setInteriorColor(String) is undefined for the type Object
at com.famc.runner.Runner.createKnowledgeBase(Runner.java:48)
at com.famc.runner.Runner.main(Runner.java:24)
{panel}
was (Author: jary):
I recommend closing the issue. I re-ran my scenario given Mark's comment and the issue has been fixed two-fold. The DRL now shows the error within the file, and the runtime exception is much clearer:
Exception in thread "main" java.lang.RuntimeException: Rule Compilation error : [Rule name='rule1']
com/famc/rules/Rule_rule1_0.java (7:366) : car cannot be resolved
com/famc/rules/Rule_rule1_0.java (7:416) : The method setInteriorColor(String) is undefined for the type Object
at com.famc.runner.Runner.createKnowledgeBase(Runner.java:48)
at com.famc.runner.Runner.main(Runner.java:24)
> request to improve upon error message received from invalid rule syntax (currently getting NPE)
> -----------------------------------------------------------------------------------------------
>
> Key: JBRULES-2326
> URL: https://jira.jboss.org/browse/JBRULES-2326
> Project: Drools
> Issue Type: Bug
> Security Level: Public(Everyone can see)
> Affects Versions: 5.1.0.M1
> Reporter: Jeremy Ary
> Assignee: Edson Tirelli
> Fix For: 5.2.0.M1
>
>
> My (albeit improper) rule syntax that caused the NPE error:
> when
> QueueList ( queueIds contains 1 )
> ( not EventList ( events contains 1 )
> || ( $eventList : EventList ( events contains 1 )
> && RfEvent ( eventTypeId == 1, lastActivationLong after[-1h] sessionTime ) from $eventList.events ) )
> then
> modify (eventList) { add(1) }
> Stack Trace:
> org.drools.runtime.rule.ConsequenceException: java.lang.NullPointerException
> at org.drools.runtime.rule.impl.DefaultConsequenceExceptionHandler.handleException(DefaultConsequenceExceptionHandler.java:23)
> at org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:943)
> at org.drools.common.DefaultAgenda.fireNextItem(DefaultAgenda.java:885)
> at org.drools.common.DefaultAgenda.fireAllRules(DefaultAgenda.java:1086)
> at org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:660)
> at org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:627)
> at org.drools.impl.StatefulKnowledgeSessionImpl.fireAllRules(StatefulKnowledgeSessionImpl.java:183)
> at com.famc.service.RuleFlowRunner.main(RuleFlowRunner.java:118)
> Caused by: java.lang.NullPointerException
> at org.drools.base.mvel.DroolsMVELFactory.getTupleObjectFor(DroolsMVELFactory.java:182)
> at org.drools.base.mvel.DroolsMVELFactory.setContext(DroolsMVELFactory.java:176)
> at org.drools.base.mvel.MVELConsequence.evaluate(MVELConsequence.java:57)
> at org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:934)
> ... 6 more
> Request for ticket:
> [10:19] <etirelli> jary: raising a NPE is clearly a bug, but the reason is that you have modify(eventList) instead of modify($eventList)... in any case, the way you authored the rule is not ideal
> [10:19] <etirelli> jary: could you please open a JIRA so that we can provide an appropriate error message, please?
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the jboss-jira
mailing list