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 of over 48,000 articles and solutions.

Current Customers and Partners

Log in for full access

Log In
Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.