Null value handling

ILOG® JRules connector has a mechanism to handle null values in the fields of the records on the input and output links and the Java™ null values in the ruleset parameter values.

Input links

When a field of an input record used to produce the value of the IN or IN_OUT ruleset parameter is a null value, the null value is mapped to the Java null value in the ruleset parameter if that mapping is possible. If the mapping is not possible, the job fails with an error if a reject link is not configured. If a reject link is configured for the input link and the Null input error option is enabled, the record is rejected.

It is not possible to map the null input value to the Java null value in the ruleset parameter in the following scenarios:
  • The ruleset is based on Dynamic XOM. In this case, the field that represents the XML document value of the ruleset parameter cannot be set to null.
  • The field maps to the ruleset parameter of a primitive Java type such as byte, short, int, long, float, double, boolean or char. The null value cannot be specified for a primitive Java type.
  • The field maps to an argument of a method in the Java class of the ruleset parameters, and that argument is of a primitive Java type. Again the null value cannot be specified for a primitive Java type.

Output links

When a Java null value is encountered while inspecting the value of the OUT or IN_OUT ruleset parameter associated with the output link, then the Java null value is mapped to the null value in the corresponding output record field, if the mapping is possible. If the mapping is not possible, the job fails with an error.

It is not possible to map the Java null value to the null value in the corresponding output record field in the following scenarios:
  • The ruleset parameter value is null and it maps to a single column on the output link which is not nullable. A column is not nullable if it has the Nullable attribute set to No.
  • The ruleset parameter value is null and it maps to multiple columns on the output link, of which some are nullable and some are not. In this case, the connector is unable to invoke methods on the output parameter to initialize field values based on the method return values.
  • The ruleset parameter value is not null but a method invoked on the Java object of the output parameter returns null, and the column to which the return value is mapped is not nullable.