From 3cc407a7d1aa3bd425cf0bcbd109db40fb509ab1 Mon Sep 17 00:00:00 2001 From: "Determe, Sebastien (sd378r)" Date: Fri, 25 May 2018 16:37:10 +0200 Subject: Fix potential NPE Fix policyversion that can be null in getConfig method Issue-ID: CLAMP-153 Change-Id: Idd26a2b1a33cd0ae82b45e6070746ff4f8b5e7ea Signed-off-by: Determe, Sebastien (sd378r) --- .../java/org/onap/clamp/clds/client/req/policy/PolicyClient.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/main') diff --git a/src/main/java/org/onap/clamp/clds/client/req/policy/PolicyClient.java b/src/main/java/org/onap/clamp/clds/client/req/policy/PolicyClient.java index 9fff4efc5..1e423ffe7 100644 --- a/src/main/java/org/onap/clamp/clds/client/req/policy/PolicyClient.java +++ b/src/main/java/org/onap/clamp/clds/client/req/policy/PolicyClient.java @@ -336,8 +336,12 @@ public class PolicyClient { try { Collection response = getPolicyEngine().getConfig(configRequestParameters); for (PolicyConfig policyConfig : response) { - Integer version = Integer.valueOf(policyConfig.getPolicyVersion()); - versions.add(version); + if (policyConfig.getPolicyVersion() != null) { + Integer version = Integer.valueOf(policyConfig.getPolicyVersion()); + versions.add(version); + } else { + logger.warn("Policy version was null, unable to convert it to Integer"); + } } Collections.sort(versions); logger.info("Policy versions.size()=" + versions.size()); -- cgit 1.2.3-korg