From 85fb00b9a31ad2695be24f95fd71109f6e59dacb Mon Sep 17 00:00:00 2001 From: Mike Babinski Date: Tue, 29 Aug 2017 18:05:39 +0000 Subject: 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 --- .../vfc/src/main/java/org/onap/policy/vfc/VFCManager.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'controlloop/common/model-impl/vfc') 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) { -- cgit 1.2.3-korg