Support Article
NumberFormatException, Strategy component failed in DSM
SA-14432
Summary
In Expression Builder, during conversion from Double to BigDecimal, you receive a NumberFormatException after performing a division by zero using a property stored as a Double and then placing the result into a Decimal property.
Error Messages
Java Decimal default exception of "NumberFormatException"
Strategy component Relevancy failed to execute
Strategy component Eligibility failed to execute
Strategy component Validity failed to execute
Strategy component SetCommonProperties failed to execute
Expression in Strategy Set failed to execute for property <property_name>
Steps to Reproduce
- In an activity, add a step having “Property-Set” method.
- In first text box, enter <.DecimalProperty>.
- In the second text box, enter <.DoubleProperty/.DoubleProperty>.
- Run the activity, bypassing <.DoubleProperty> value as zero.
Root Cause
While the Java Double data type specification has an internal representation for NaN (Not a Number), the Java Decimal data type does not.When NaN is attempted to be converted into a Java Decimal, it throws a Java NumberFormatException, which is the exception received.
Resolution
Perform the following local-change:
Wrap your DoubleProperty in logic that handles the possibility of an Infinity or NAN value.
Choose logic that assigns a value that is meaningful to the business.
For example, use an if-then-else expression:
@if((.DoubleProperty == 0), 0, (.SomeProperty/.DoubleProperty)) to assign the value of 0 to the expression as opposed to NAN or Infinity. Choose a result appropriate to your business.
Published September 25, 2015 - Updated October 8, 2020
Have a question? Get answers now.
Visit the Collaboration Center to ask questions, engage in discussions, share ideas, and help others.