aboutsummaryrefslogtreecommitdiffstats
path: root/main/src/main/java/org/onap/policy/pap/main/rest/depundep/ProviderBase.java
diff options
context:
space:
mode:
authorJim Hahn <jrh3@att.com>2019-04-23 13:27:55 -0400
committerJim Hahn <jrh3@att.com>2019-04-24 13:07:50 -0400
commitcccfb11b59becaaf86adc4c88600bd70f2519b0d (patch)
treefbab9aabd089f0943a5bdbfd5a97e1fa80e674c4 /main/src/main/java/org/onap/policy/pap/main/rest/depundep/ProviderBase.java
parenta6cb1f27c8fe26b02abbd6a3fcf876ec306e6a5a (diff)
Validate supported types3.0.2-ONAP
When a group is created, PAP should verify that the "supported types" exist in the DB. Address potential sonar issue. Address potential sonar issue in similar block of code. Change-Id: Ib830550bc37d4ebe42c8782f3f874e463f3f51c2 Issue-ID: POLICY-1688 Signed-off-by: Jim Hahn <jrh3@att.com>
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.java8
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(),