From ba6c74270f8a525e155fe4ae90b17ac5bf9ddb94 Mon Sep 17 00:00:00 2001 From: Joachim Klein Date: Wed, 10 Aug 2016 16:31:48 +0000 Subject: [PATCH] Property: handle missing constant in search for right // RESULT line constValues.getValueOf() throws an Exception if the constant value does not exist. This may happen, e.g., for parametric model checking, where the parametric constants will have no values. So, we first check if the constant value exists. If this is not the case then the RESULT line is clearly no match. In the future, it might make sense to handle parametric constants differently than non-existent constants, e.g., to provide a warning for a nonsensical RESULT line in the latter case. git-svn-id: https://www.prismmodelchecker.org/svn/prism/prism/trunk@11601 bbc10eb1-c90d-0410-af57-cb519fbb1720 --- prism/src/parser/ast/Property.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/prism/src/parser/ast/Property.java b/prism/src/parser/ast/Property.java index 3e32ef4f..54c8e986 100644 --- a/prism/src/parser/ast/Property.java +++ b/prism/src/parser/ast/Property.java @@ -176,7 +176,14 @@ public class Property extends ASTElement // Make sure constant/value is in constValues list and matches String constName = pair[0].trim(); String constVal = pair[1].trim(); - Object constValToMatch = constValues.getValueOf(constName); + + Object constValToMatch; + if (constValues.getIndexOf(constName) == -1) { + // there is no constant of that name, might be a parametric constant + constValToMatch = null; + } else { + constValToMatch = constValues.getValueOf(constName); + } if (constValToMatch == null) match = false; // Check doubles numerically @@ -185,6 +192,7 @@ public class Property extends ASTElement // Otherwise just check for exact string match for now else match = constValToMatch.toString().equals(constVal); + // We need all constants to match allMatch &= match; }