aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDeterme, Sebastien (sd378r) <sd378r@intl.att.com>2018-05-25 16:37:10 +0200
committerDeterme, Sebastien (sd378r) <sd378r@intl.att.com>2018-05-25 16:37:10 +0200
commit3cc407a7d1aa3bd425cf0bcbd109db40fb509ab1 (patch)
treeb36c792eadd2b40d94ae394501ab6a8248bd223a
parente0d94f6978322805cbffbbb1d2d23a8fd843b8bc (diff)
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) <sd378r@intl.att.com>
-rw-r--r--src/main/java/org/onap/clamp/clds/client/req/policy/PolicyClient.java8
1 files changed, 6 insertions, 2 deletions
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 9fff4efc..1e423ffe 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<PolicyConfig> 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());