An exception is thrown

Symptoms

In Decision Designer, when you run a decision model or a task model, an exception is thrown.

The following error message shows an example of a NullPointerException:

Run error
java.lang.NullPointerException

Exception java.lang.NullPointerException
    in action of rule 'corporate score"
        Bindings: [-200.0, decisions.techpreview_samples.loan_validation.loanvalidationdata.newtype1@d5a71066,200.01
    in node 'Corporate Score'
    in decision model 'LoanValidationDecisionModel-loanValidationDecisionModel'
    in decision operation with execution id "'

Other types of exception can be thrown, such as ArithmeticException.

Causes

An exception occurred in the rule action. This kind of exception can occur, for instance, when the attribute of an object cannot be retrieved.

If you take the error example shown in the Symptoms section, it is thrown when you run the corporate score rule from the Loan Approval sample and the credit score cannot be found:
set decision to 'Bankruptcy Score' + 'Salary Score' + the credit score of Borrower ;

Depending on the type of model that you are running, exceptions can either be thrown in the action part of the rule or the condition part of the rule:

Table 1. Where can an exception be thrown?
Rule part Decision model Task model
Rule condition
Rule action

In decision models, exceptions in rule conditions are automatically processed through automatic exception handling. For more information, see A rule is not executed.

Resolving the problem

To avoid running into an exception, you can add a condition to your rule.

For example, if you take the corporate score rule, you can add a condition stating that the value of the decision is only set if the credit score is not null:
if the credit score of Borrower is not null
then set decision to 'Bankruptcy Score' + 'Salary Score' + the credit score of Borrower ;