diff options
Diffstat (limited to 'main/src/main/java/org/onap/policy/pap/main/rest/depundep/ProviderBase.java')
-rw-r--r-- | main/src/main/java/org/onap/policy/pap/main/rest/depundep/ProviderBase.java | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/main/src/main/java/org/onap/policy/pap/main/rest/depundep/ProviderBase.java b/main/src/main/java/org/onap/policy/pap/main/rest/depundep/ProviderBase.java index a66b03d2..d3f0d13e 100644 --- a/main/src/main/java/org/onap/policy/pap/main/rest/depundep/ProviderBase.java +++ b/main/src/main/java/org/onap/policy/pap/main/rest/depundep/ProviderBase.java @@ -248,7 +248,13 @@ public abstract class ProviderBase { */ private ToscaPolicy getPolicy(SessionData data, ToscaPolicyIdentifierOptVersion ident) { try { - return data.getPolicy(ident); + ToscaPolicy policy = data.getPolicy(ident); + if (policy == null) { + throw new PfModelRuntimeException(Status.NOT_FOUND, + "cannot find policy: " + ident.getName() + " " + ident.getVersion()); + } + + return policy; } catch (PfModelException e) { throw new PfModelRuntimeException(e.getErrorResponse().getResponseCode(), |