Does Drools imply null checks before trying to read a value in JBoss BRMS 5.3.1

Solution Verified - Updated -

Issue

  • In rules we have often the following condition statement:
fact.subfact.attribute = ''MyValue''
  • As subfact and attribute are objects they potentially could be NULL, a check is required to avoid NullPointerExceptions.
  • Are these conditions added during generation by default or do we have to add them in the rule definition, like
fact.subfact != null, fact.subfact.attribute != null, fact.subfact.attribute = ''MyValue''

Environment

  • JBoss Business Rules Management System (BRMS) 5.3.1

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.