[jboss-jira] [JBoss JIRA] Created: (JBRULES-1516) Useful error needed when, in a condition, that a method cannot be found.

William McDonald (JIRA) jira-events at lists.jboss.org
Wed Mar 19 10:52:50 EDT 2008


Useful error needed when, in a condition, that a method cannot be found.
------------------------------------------------------------------------

                 Key: JBRULES-1516
                 URL: http://jira.jboss.com/jira/browse/JBRULES-1516
             Project: JBoss Drools
          Issue Type: Bug
      Security Level: Public (Everyone can see)
          Components: Drl Parser/Builder
         Environment: Java 1.5, Drools 4.0.4 (Maybe earlier, discovered on 4.0.4)
            Reporter: William McDonald
         Assigned To: Mark Proctor
            Priority: Minor


A problem occurred when a class and the corresponding rules did not properly follow the bean pattern. While the problem originated in improper use of the bean pattern, a more descriptive error message would be very useful. For example. 

A condition:
AReallyWonderfulAndCrappyTest( BasicMountFridayTest.mountType == "T" )
produced an error (java.lang.IllegalArgumentException: object is not an instance of declaring class) ; changing it to:
AReallyWonderfulAndCrappyTest( basicMountFridayTest.mountType == "T" )
resolved it.

Ultimately, it couldn't find the method that was needed to execute, but the class itself was the proper one, so a better error method might be in order.

This is ultimately an end-user error, but a better error message would be immensely helpful.

Error trace:

org.drools.RuntimeDroolsException: Exception executing predicate org.drools.base.mvel.MVELPredicateExpression at 1220c1b
	at org.drools.rule.PredicateConstraint.isAllowed(PredicateConstraint.java:216)
	at org.drools.reteoo.AlphaNode.assertObject(AlphaNode.java:132)
	at org.drools.reteoo.SingleObjectSinkAdapter.propagateAssertObject(SingleObjectSinkAdapter.java:22)
	at org.drools.reteoo.ObjectTypeNode.assertObject(ObjectTypeNode.java:153)
	at org.drools.reteoo.Rete.assertObject(Rete.java:175)
	at org.drools.reteoo.ReteooRuleBase.assertObject(ReteooRuleBase.java:192)
	at org.drools.reteoo.ReteooWorkingMemory.doInsert(ReteooWorkingMemory.java:71)
	at org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:909)
	at org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:881)
	at org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:682)
	at com.hightower.drools.executablerules.Rules.setTemplate(Rules.java:114)
	at com.hightower.eddiez.shopathome.main.behavior.QuoteBuilderLineEntryModel.<init>(QuoteBuilderLineEntryModel.java:146)
	at com.hightower.eddiez.shopathome.main.behavior.QuoteBuilderLinesModel.addLineData(QuoteBuilderLinesModel.java:152)
	at com.hightower.eddiez.shopathome.main.behavior.QuoteBuilderGUI.addNewLine(QuoteBuilderGUI.java:650)
	at com.hightower.eddiez.shopathome.main.behavior.QuoteBuilderGUI.access$4(QuoteBuilderGUI.java:611)
	at com.hightower.eddiez.shopathome.main.behavior.QuoteBuilderGUI$3.actionPerformed(QuoteBuilderGUI.java:275)
	at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
	at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
	at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
	at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
	at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
	at java.awt.Component.processMouseEvent(Unknown Source)
	at javax.swing.JComponent.processMouseEvent(Unknown Source)
	at java.awt.Component.processEvent(Unknown Source)
	at java.awt.Container.processEvent(Unknown Source)
	at java.awt.Component.dispatchEventImpl(Unknown Source)
	at java.awt.Container.dispatchEventImpl(Unknown Source)
	at java.awt.Component.dispatchEvent(Unknown Source)
	at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
	at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
	at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
	at java.awt.Container.dispatchEventImpl(Unknown Source)
	at java.awt.Window.dispatchEventImpl(Unknown Source)
	at java.awt.Component.dispatchEvent(Unknown Source)
	at java.awt.EventQueue.dispatchEvent(Unknown Source)
	at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
	at java.awt.EventDispatchThread.run(Unknown Source)
Caused by: org.mvel.CompileException: object is not an instance of declaring class

	at org.mvel.optimizers.impl.asm.ASMAccessorOptimizer.compileAccessor(ASMAccessorOptimizer.java:290)
	at org.mvel.optimizers.impl.asm.ASMAccessorOptimizer.optimizeAccessor(ASMAccessorOptimizer.java:163)
	at org.mvel.ast.LiteralDeepPropertyNode.getReducedValueAccelerated(LiteralDeepPropertyNode.java:28)
	at org.mvel.ast.BinaryOperation.getReducedValueAccelerated(BinaryOperation.java:21)
	at org.mvel.MVELRuntime.execute(MVELRuntime.java:88)
	at org.mvel.CompiledExpression.getValue(CompiledExpression.java:111)
	at org.mvel.MVEL.executeExpression(MVEL.java:235)
	at org.drools.base.mvel.MVELPredicateExpression.evaluate(MVELPredicateExpression.java:36)
	at org.drools.rule.PredicateConstraint.isAllowed(PredicateConstraint.java:210)
	... 39 more
Caused by: java.lang.IllegalArgumentException: object is not an instance of declaring class

	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at org.mvel.optimizers.impl.asm.ASMAccessorOptimizer.getBeanProperty(ASMAccessorOptimizer.java:373)
	at org.mvel.optimizers.impl.asm.ASMAccessorOptimizer.compileAccessor(ASMAccessorOptimizer.java:247)
	... 47 more

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