Drools NullPointerException causes RuntimeDroolsException

Solution Verified - Updated -

Issue

  • A user-supplied method caused a RuntimeDroolsException.

    Exception:
    
    (Stack trace exceprt):
    org.drools.RuntimeDroolsException: Exception executing  ReturnValue constraint org.drools.rule.ReturnValueRestriction@9cf19fa6 :  java.lang.NullPointerException
     at org.drools.rule.ReturnValueConstraint.isAllowed(ReturnValueConstraint.java:138)
    .....
    Caused by: java.lang.NullPointerException
     at java.util.Date.getMillisOf(Date.java:939)
    
  • The user believed this error was caused by a simple "empty" check, because this was one of the conditions checked in the rule.  In fact, it was a secondardy condition on the rule.  The rule reads as follows:

    mybean : MyBean( someDateField1 != ( empty ) , someDateField2 < ( mybean.convertStringToDate(someTextFieldHoldingADate) ) )
    

Environment

  • JBoss Enterprise BRMS 5.0.2

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In