summaryrefslogtreecommitdiffstats
path: root/applications/guard/src/main
diff options
context:
space:
mode:
authorliamfallon <liam.fallon@est.tech>2020-12-17 16:57:10 +0000
committerliamfallon <liam.fallon@est.tech>2020-12-21 16:30:57 +0000
commit30ead499d80c3c6cf6433c6a1e9fb4693d109ab1 (patch)
treeb0d48259a5ca139080be351ca64d69bc00b591c0 /applications/guard/src/main
parent0bd8066788769079f098f6f831919b2c639520a0 (diff)
XACML to accept properties as null
xacml-pdp expects the property map to exist in all policies, even if it is sometimes empty. Now, the propperty map can be null. The code is updated to cope with a null property map. Issue-ID: POLICY-2900 Change-Id: Ie31a2770aff1435a1d1064512d0c2fa2088d3183 Signed-off-by: liamfallon <liam.fallon@est.tech>
Diffstat (limited to 'applications/guard/src/main')
-rw-r--r--applications/guard/src/main/java/org/onap/policy/xacml/pdp/application/guard/GuardTranslator.java9
1 files changed, 8 insertions, 1 deletions
diff --git a/applications/guard/src/main/java/org/onap/policy/xacml/pdp/application/guard/GuardTranslator.java b/applications/guard/src/main/java/org/onap/policy/xacml/pdp/application/guard/GuardTranslator.java
index b3ee36bc..2b713740 100644
--- a/applications/guard/src/main/java/org/onap/policy/xacml/pdp/application/guard/GuardTranslator.java
+++ b/applications/guard/src/main/java/org/onap/policy/xacml/pdp/application/guard/GuardTranslator.java
@@ -3,6 +3,7 @@
* ONAP
* ================================================================================
* Copyright (C) 2020 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2020 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -129,6 +130,12 @@ public class GuardTranslator implements ToscaPolicyTranslator {
//
this.fillMetadataSection(newPolicyType, toscaPolicy.getMetadata());
//
+ // There should be properties metadata section
+ //
+ if (toscaPolicy.getProperties() == null) {
+ throw new ToscaPolicyConversionException("no properties specified on guard policy: " + policyName);
+ }
+ //
// Generate the TargetType - add true if not blacklist
//
newPolicyType.setTarget(this.generateTargetType(toscaPolicy.getProperties(),
@@ -694,4 +701,4 @@ public class GuardTranslator implements ToscaPolicyTranslator {
return rule;
}
-} \ No newline at end of file
+}