aboutsummaryrefslogtreecommitdiffstats
path: root/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/org/onap/clamp/policy/operational/OperationalPolicy.java14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/main/java/org/onap/clamp/policy/operational/OperationalPolicy.java b/src/main/java/org/onap/clamp/policy/operational/OperationalPolicy.java
index 1859a4d6e..1e35ad6c4 100644
--- a/src/main/java/org/onap/clamp/policy/operational/OperationalPolicy.java
+++ b/src/main/java/org/onap/clamp/policy/operational/OperationalPolicy.java
@@ -183,18 +183,20 @@ public class OperationalPolicy implements Serializable, Policy {
/**
* Return a map containing all Guard policies indexed by Guard policy Name.
- *
+ *
* @return The Guards map
*/
public Map<String, String> createGuardPolicyPayloads() {
Map<String, String> result = new HashMap<>();
- JsonObject guard = new JsonObject();
JsonElement guardsList = this.getConfigurationsJson().get("guard_policies");
- for (Entry<String, JsonElement> guardElem : guardsList.getAsJsonObject().entrySet()) {
- guard.addProperty("policy-id", guardElem.getKey());
- guard.add("contents", guardElem.getValue());
- result.put(guardElem.getKey(), new GsonBuilder().create().toJson(guard));
+ if (guardsList != null) {
+ for (Entry<String, JsonElement> guardElem : guardsList.getAsJsonObject().entrySet()) {
+ JsonObject guard = new JsonObject();
+ guard.addProperty("policy-id", guardElem.getKey());
+ guard.add("contents", guardElem.getValue());
+ result.put(guardElem.getKey(), new GsonBuilder().create().toJson(guard));
+ }
}
return result;
}