Added null check for httpResponse to prevent crash 95/93695/1
authorOleksandr Moliavko <o.moliavko@samsung.com>
Fri, 16 Aug 2019 12:21:20 +0000 (15:21 +0300)
committerOleksandr Moliavko <o.moliavko@samsung.com>
Fri, 16 Aug 2019 12:21:20 +0000 (15:21 +0300)
at throwing exception

Issue-ID: SO-1841
Signed-off-by: Oleksandr Moliavko <o.moliavko@samsung.com>
Change-Id: Iffbaaddea9c9bb1609ce2e0755f6f3ca49e0ad31

cloudify-client/src/main/java/org/onap/so/cloudify/connector/http/HttpClientConnector.java

index e1992d9..ba6a591 100644 (file)
@@ -232,8 +232,12 @@ public class HttpClientConnector implements CloudifyClientConnector {
         }
 
         // Get here on an error response (4XX-5XX)
-        throw new CloudifyResponseException(httpResponse.getStatusLine().getReasonPhrase(),
-                httpResponse.getStatusLine().getStatusCode(), httpClientResponse);
+        if (httpResponse != null) {
+            throw new CloudifyResponseException(httpResponse.getStatusLine().getReasonPhrase(),
+                    httpResponse.getStatusLine().getStatusCode(), httpClientResponse);
+        } else {
+            throw new CloudifyResponseException("Null httpResponse", 0, httpClientResponse);
+        }
     }
 
 }