From 88928e8b898b200b641c55c436692bb2c455e16b Mon Sep 17 00:00:00 2001 From: Dave Parker Date: Thu, 11 Jun 2015 14:59:40 +0000 Subject: [PATCH] New PrismNotSupportedException, to be throw when a model/prop/engine combination is not supported. Displays as UNSUPPORTED, not FAIL, in test mode. [from Joachim Klein] git-svn-id: https://www.prismmodelchecker.org/svn/prism/prism/trunk@9998 bbc10eb1-c90d-0410-af57-cb519fbb1720 --- prism/src/parser/ast/Property.java | 5 +++ prism/src/prism/PrismCL.java | 2 + .../src/prism/PrismNotSupportedException.java | 39 +++++++++++++++++++ 3 files changed, 46 insertions(+) create mode 100644 prism/src/prism/PrismNotSupportedException.java diff --git a/prism/src/parser/ast/Property.java b/prism/src/parser/ast/Property.java index aebe5340..3cccdc81 100644 --- a/prism/src/parser/ast/Property.java +++ b/prism/src/parser/ast/Property.java @@ -35,6 +35,7 @@ import parser.type.*; import parser.visitor.*; import prism.PrismException; import prism.PrismLangException; +import prism.PrismNotSupportedException; import prism.PrismUtils; /** @@ -254,6 +255,10 @@ public class Property extends ASTElement } // Check for exceptions + if (result instanceof PrismNotSupportedException) { + // not supported -> handle in caller + throw (PrismNotSupportedException)result; + } if (result instanceof Exception) { String errMsg = ((Exception) result).getMessage(); if (strExpected.startsWith("Error")) { diff --git a/prism/src/prism/PrismCL.java b/prism/src/prism/PrismCL.java index d577218b..22130228 100644 --- a/prism/src/prism/PrismCL.java +++ b/prism/src/prism/PrismCL.java @@ -401,6 +401,8 @@ public class PrismCL implements PrismModelListener } else { mainLog.println("Testing result: NOT TESTED"); } + } catch (PrismNotSupportedException e) { + mainLog.println("Testing result: UNSUPPORTED: " + e.getMessage()); } catch (PrismException e) { mainLog.println("Testing result: FAIL: " + e.getMessage()); if (testExitsOnFail) diff --git a/prism/src/prism/PrismNotSupportedException.java b/prism/src/prism/PrismNotSupportedException.java new file mode 100644 index 00000000..beda2ce1 --- /dev/null +++ b/prism/src/prism/PrismNotSupportedException.java @@ -0,0 +1,39 @@ +//============================================================================== +// +// Copyright (c) 2002- +// Authors: +// * Joachim Klein (TU Dresden) +// +//------------------------------------------------------------------------------ +// +// This file is part of PRISM. +// +// PRISM is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// PRISM is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with PRISM; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +//============================================================================== + +package prism; + +/** + * An exception indicating that a given feature is (currently) not supported, + * e.g., a given combination of model type, engine and property. + */ +public class PrismNotSupportedException extends PrismException +{ + public PrismNotSupportedException(String s) + { + super(s); + } +}