Niek Knijnenburg

Evaluation error: unexpected value: null

Discussion created by Niek Knijnenburg on May 1, 2012
Latest reply on May 3, 2012 by Guest

We are using a Java-BOM with quite complex objects.

When the objects are filled not necessarilly all properties are filled and these properties can themselves be complex classes as well.

So for example we have:

A damagedItem of type DamagedItem

which could contain a vehicle property of type Vehicle

which contains a make property of type String

 

A condition on the make would look like:

if (damagedItem.vehicle.make = "Ford") then ...

 

But if vehicle is not filled i.e. is null you get an "Evaluation error: unexpected value: null" on the vehicle.

 

So some posts suggest to add guard clauses like:

if (damagedItem is not null

and damagedItem.vehicle is not null

and damagedItem.vehicle.make = "Ford") then ...

 

But these conditions are build through an RMA and I don't want the business analist to have to enter these guard clauses.

 

So we build the following template:

if truethen { print("in rule"); try {  print("in try");  validConditions = true;  <Loop over conditionListVH>  if(validConditions)  then {   validConditions = (<conditionListVH>);  }  <End Loop>   } catch an Exception with {  print("in catch");   validConditions = false; } if (validConditions) then {  print ("it fired"); }};

 which generates the following code:

if truethen { print("in rule"); try {  print("in try");  validConditions = true;  if(validConditions)  then {   validConditions = (claimRTBundle.claimRT.valueObject.causeType.type is equal to "200");  }  if(validConditions)  then {   validConditions = (claimRTBundle.damagedItemRT.valueObject.vehicle.make is equal to "Ford");  }   } catch an Exception with {  print("in catch");   validConditions = false; } if (validConditions) then {  print ("it fired"); }};

 

- How is the rest of you coping with these kind of issues?

- Is there another/easier way to prevent these Evaluation errors?

- Are there any downsides to the solution I have now, like Blaze optimalization not working anymore at some point, because we are screwing up the Rete algoritm or something?

 

Niek


Outcomes