diff --git a/prism/src/parser/ast/Property.java b/prism/src/parser/ast/Property.java index 4fec06c1..3c8275ba 100644 --- a/prism/src/parser/ast/Property.java +++ b/prism/src/parser/ast/Property.java @@ -205,17 +205,28 @@ public class Property extends ASTElement } else { constValToMatch = constValues.getValueOf(constName); } - if (constValToMatch == null) + if (constValToMatch == null) { match = false; // Check doubles numerically - else if (constValToMatch instanceof Double) - match = PrismUtils.doublesAreEqual(((Double) constValToMatch).doubleValue(), DefinedConstant.parseDouble(constVal)); + } else if (constValToMatch instanceof Double) { + try { + match = PrismUtils.doublesAreEqual(((Double) constValToMatch).doubleValue(), DefinedConstant.parseDouble(constVal)); + } catch (NumberFormatException e) { + // we currently ignore malformed constants + match = false; + } // if constant is exact rational number, compare exactly - else if (constValToMatch instanceof BigRational) - match = BigRational.from(constVal).equals(constValToMatch); + } else if (constValToMatch instanceof BigRational) { + try { + match = BigRational.from(constVal).equals(constValToMatch); + } catch (NumberFormatException e) { + // we currently ignore malformed constants + match = false; + } // Otherwise just check for exact string match for now - else + } else { match = constValToMatch.toString().equals(constVal); + } // We need all constants to match allMatch &= match;