From: Havaldar Girish Date: Mon, 18 Dec 2017 05:42:25 +0000 (+0530) Subject: Null check for ClientResponse in PolicyUril.java X-Git-Tag: v2.2.0~52 X-Git-Url: https://gerrit.onap.org/r/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F31%2F26431%2F1;p=portal.git 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 --- 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); }