From 3af8af1310d5a27cb58be29505573f0bbdc1717c Mon Sep 17 00:00:00 2001 From: Havaldar Girish Date: Mon, 18 Dec 2017 11:12:25 +0530 Subject: Null check for ClientResponse in PolicyUril.java NullPointerException might be thrown as cres is nullable here Sonar Link: https://sonar.onap.org/component_issues/index?id=org.onap.portal%3Aonap-portal-parent#resolved=false|severities=BLOCKER Location: /src/main/java/org/openecomp/portalapp/portal/scheduler/policy/PolicyUtil.java Line No-72 Change-Id: I14dc792fb67198ebcbabfe80d90c48389af6cc91 Issue-ID: PORTAL-153 Signed-off-by: Havaldar Girish --- .../org/openecomp/portalapp/portal/scheduler/policy/PolicyUtil.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp') diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/policy/PolicyUtil.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/policy/PolicyUtil.java index aa4216bf..3e1c9415 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/policy/PolicyUtil.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/policy/PolicyUtil.java @@ -66,10 +66,13 @@ public class PolicyUtil { public static PolicyResponseWrapper wrapResponse (ClientResponse cres) { String resp_str = ""; + int statuscode = 0; if ( cres != null ) { resp_str = cres.readEntity(String.class); + statuscode = cres.getStatus(); } - int statuscode = cres.getStatus(); + + PolicyResponseWrapper w = PolicyUtil.wrapResponse ( resp_str, statuscode ); return (w); } -- cgit 1.2.3-korg