diff options
author | Eddy Hautot <eh552t@intl.att.com> | 2019-04-09 11:48:33 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2019-04-09 11:48:33 +0000 |
commit | 7228bbeecdd0e3efa4181198c5c319e1248e2225 (patch) | |
tree | 99f35a79bb7de88c402baa723786068b23001694 /src/main/java/org | |
parent | b3539f11b0c3adeb7b64dfd6337eb25a535a6608 (diff) | |
parent | fb35c3e3c80bd17308abfd34964e854ad9975342 (diff) |
Merge changes I6f714a87,If69e3ebb,Iad23cd23
* changes:
Fix guard payload
Add logs
Remove the license issue
Diffstat (limited to 'src/main/java/org')
-rw-r--r-- | src/main/java/org/onap/clamp/policy/operational/OperationalPolicy.java | 14 |
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; } |