diff options
author | Havaldar Girish <hg0071052@techmahindra.com> | 2017-12-18 11:12:25 +0530 |
---|---|---|
committer | Havaldar Girish <hg0071052@techmahindra.com> | 2017-12-18 11:20:25 +0530 |
commit | 3af8af1310d5a27cb58be29505573f0bbdc1717c (patch) | |
tree | 792bb90e87a6d4bddb3b57ab1398323e90cefa0a | |
parent | 3b0029e2d987eede8af0a678bec44a33bbc7bec4 (diff) |
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 <hg0071052@techmahindra.com>
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/policy/PolicyUtil.java | 5 |
1 files changed, 4 insertions, 1 deletions
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); } |