Solve 500 error for deleting service 83/35183/1
authorHuabingZhao <zhao.huabing@zte.com.cn>
Mon, 12 Mar 2018 11:23:23 +0000 (19:23 +0800)
committerHuabingZhao <zhao.huabing@zte.com.cn>
Mon, 12 Mar 2018 11:28:50 +0000 (19:28 +0800)
Change-Id: Iae4c56fe6cbe2009d36dfd451029413b9227c8f7
Issue-ID: MSB-99 MSB-92
Signed-off-by: HuabingZhao <zhao.huabing@zte.com.cn>
apiroute/apiroute-service/src/main/java/org/onap/msb/apiroute/resources/MicroServiceResource.java

index 7ade6fa..5a582d6 100644 (file)
@@ -326,8 +326,13 @@ public class MicroServiceResource {
      * @throws IOException
      */
     private Response cloneHttpResponse(CloseableHttpResponse httpResponse) throws IOException {
-        String jsonString = EntityUtils.toString(httpResponse.getEntity());
-        Response response = Response.status(httpResponse.getStatusLine().getStatusCode()).entity(jsonString).build();
+        Response response;
+        if (httpResponse.getEntity() != null) {
+            String jsonString = EntityUtils.toString(httpResponse.getEntity());
+            response = Response.status(httpResponse.getStatusLine().getStatusCode()).entity(jsonString).build();
+        } else {
+            response = Response.status(httpResponse.getStatusLine().getStatusCode()).build();
+        }
         return response;
     }