diff options
author | Mike Babinski <mb1915@att.com> | 2017-08-29 18:05:39 +0000 |
---|---|---|
committer | Mike Babinski <mb1915@att.com> | 2017-08-29 18:07:34 +0000 |
commit | 85fb00b9a31ad2695be24f95fd71109f6e59dacb (patch) | |
tree | 495e8ba3a71a8b956121d58c156d5679066eaa8a /controlloop/common/model-impl/vfc/src/main | |
parent | 25e55b9885494fab97654bb7f4820fdecb57bbb8 (diff) |
Fix New Sonar Blocker for Drools-Applications
Add null checks to stop possible null pointer exceptions.
Issue-ID: POLICY-111
Change-Id: Idafb078edf984712e5d5a4d54763f2723e17c09f
Signed-off-by: Mike Babinski <mb1915@att.com>
Diffstat (limited to 'controlloop/common/model-impl/vfc/src/main')
-rw-r--r-- | controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VFCManager.java | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VFCManager.java b/controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VFCManager.java index 0aade0744..6777353a8 100644 --- a/controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VFCManager.java +++ b/controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VFCManager.java @@ -96,8 +96,13 @@ public final class VFCManager implements Runnable { } Thread.sleep(20000); } - if (attemptsLeft <= 0) - logger.debug("VFC timeout. Status: ({})", responseGet.responseDescriptor.status); + if ((attemptsLeft <= 0) + && (responseGet != null) + && (responseGet.responseDescriptor != null) + && (responseGet.responseDescriptor.status != null) + && (!responseGet.responseDescriptor.status.isEmpty())) { + logger.debug("VFC timeout. Status: ({})", responseGet.responseDescriptor.status); + } } catch (JsonSyntaxException e) { logger.error("Failed to deserialize into VFCResponse {}",e.getLocalizedMessage(),e); } catch (InterruptedException e) { |