Fix bug reported by SONAR. 07/64407/2
authorPrabhu Balan <prabhu.balan1@vodafone.com>
Tue, 4 Sep 2018 10:38:41 +0000 (16:08 +0530)
committerPrabhu201713 <prabhu.balan1@vodafone.com>
Tue, 4 Sep 2018 13:00:42 +0000 (18:30 +0530)
Issue-ID: EXTAPI-132

Change-Id: I57ea6dbcb618079a77cdb2c327bba795edd5f358
Signed-off-by: Prabhu Balan <prabhu.balan1@vodafone.com>
src/main/java/org/onap/nbi/apis/serviceorder/SoClient.java
src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/CreateE2EServiceInstanceResponse.java
src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/CreateServiceInstanceResponse.java
src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/GetE2ERequestStatusResponse.java
src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/OperationStatus.java

index 57cb6b5..67421ba 100644 (file)
@@ -76,10 +76,10 @@ public class SoClient {
             return response;
 
         } catch (BackendFunctionalException e) {
-            LOGGER.error("error on calling " + url + " ," + e);
+            LOGGER.error(ERROR_ON_CALLING + url + " ," + e);
             return new ResponseEntity(e.getBodyResponse(),e.getHttpStatus());
         } catch (ResourceAccessException e) {
-            LOGGER.error("error on calling " + url + " ," + e);
+            LOGGER.error(ERROR_ON_CALLING + url + " ," + e);
             return new ResponseEntity<>(HttpStatus.INTERNAL_SERVER_ERROR);
         }
     }
@@ -100,10 +100,10 @@ public class SoClient {
             return response;
 
         } catch (BackendFunctionalException e) {
-            LOGGER.error("error on calling " + url + " ," + e);
+            LOGGER.error(ERROR_ON_CALLING + url + " ," + e);
             return new ResponseEntity(e.getBodyResponse(),e.getHttpStatus());
         } catch (ResourceAccessException e) {
-            LOGGER.error("error on calling " + url + " ," + e);
+            LOGGER.error(ERROR_ON_CALLING + url + " ," + e);
             return new ResponseEntity<>(HttpStatus.INTERNAL_SERVER_ERROR);
         }
     }
@@ -124,10 +124,10 @@ public class SoClient {
             return response;
 
         } catch (BackendFunctionalException e) {
-            LOGGER.error("error on calling " + url + " ," + e);
+            LOGGER.error(ERROR_ON_CALLING + url + " ," + e);
             return new ResponseEntity<>(e.getHttpStatus());
         } catch (ResourceAccessException e) {
-            LOGGER.error("error on calling " + url + " ," + e);
+            LOGGER.error(ERROR_ON_CALLING + url + " ," + e);
             return new ResponseEntity<>(HttpStatus.INTERNAL_SERVER_ERROR);
         }
 
@@ -162,10 +162,10 @@ public class SoClient {
                 return response;
 
             } catch (BackendFunctionalException e) {
-                LOGGER.error("error on calling " + url + " ," + e);
+                LOGGER.error(ERROR_ON_CALLING + url + " ," + e);
                 return new ResponseEntity<>(e.getHttpStatus());
             } catch (ResourceAccessException e) {
-                LOGGER.error("error on calling " + url + " ," + e);
+                LOGGER.error(ERROR_ON_CALLING + url + " ," + e);
                 return new ResponseEntity<>(HttpStatus.INTERNAL_SERVER_ERROR);
             }
        }
@@ -202,7 +202,10 @@ public class SoClient {
             ResponseEntity<GetRequestStatusResponse> response = restTemplate.exchange(url, HttpMethod.GET,
                 new HttpEntity<>(buildRequestHeader()), GetRequestStatusResponse.class);
             logResponseGet(url, response);
-            return response.getBody();
+            if (null == response)
+                return null;
+            else
+                return response.getBody();
 
         } catch (BackendFunctionalException | ResourceAccessException e) {
             LOGGER.error(ERROR_ON_CALLING + url + " ," + e);
@@ -226,7 +229,10 @@ public GetE2ERequestStatusResponse callE2EGetRequestStatus(String operationId, S
             ResponseEntity<GetE2ERequestStatusResponse> response = restTemplate.exchange(callUrlFormated, HttpMethod.GET,
                 new HttpEntity<>(buildRequestHeader()), GetE2ERequestStatusResponse.class);
             logE2EResponseGet(callUrlFormated, response);
-            return response.getBody();
+            if (null == response)
+                return null;
+            else
+                return response.getBody();
 
         } catch (BackendFunctionalException|ResourceAccessException e) {
             LOGGER.error(ERROR_ON_CALLING + callUrlFormated + " ," + e);
index 5c41166..7c75eca 100644 (file)
@@ -17,6 +17,8 @@ package org.onap.nbi.apis.serviceorder.model.consumer;
 
 public class CreateE2EServiceInstanceResponse {
 
+       private ServiceResponse service;
+
        public ServiceResponse getService() {
                return service;
        }
@@ -25,6 +27,10 @@ public class CreateE2EServiceInstanceResponse {
                this.service = service;
        }
 
-    private ServiceResponse service;
-
-}
+       @Override
+       public String toString() {
+               return "CreateE2EServiceInstanceResponse{" +
+                       "service=" + service +
+                       '}';
+       }
+}
\ No newline at end of file
index 590bace..3389e32 100644 (file)
@@ -17,6 +17,8 @@ package org.onap.nbi.apis.serviceorder.model.consumer;
 
 public class CreateServiceInstanceResponse {
 
+    private RequestReferences requestReferences;
+
     public RequestReferences getRequestReferences() {
         return requestReferences;
     }
@@ -25,5 +27,10 @@ public class CreateServiceInstanceResponse {
         this.requestReferences = requestReferences;
     }
 
-    private RequestReferences requestReferences;
-}
+    @Override
+    public String toString() {
+        return "CreateServiceInstanceResponse{" +
+            "requestReferences=" + requestReferences +
+            '}';
+    }
+}
\ No newline at end of file
index 42a6170..9e16181 100644 (file)
@@ -27,4 +27,10 @@ public class GetE2ERequestStatusResponse {
         this.operation = operation;
     }
 
-}
+    @Override
+    public String toString() {
+        return "GetE2ERequestStatusResponse{" +
+            "operation=" + operation +
+            '}';
+    }
+}
\ No newline at end of file
index 2cd7393..4d00e41 100644 (file)
@@ -209,5 +209,20 @@ public class OperationStatus implements Serializable {
         return true;
     }
 
-
-}
+    @Override
+    public String toString() {
+        return "OperationStatus{" +
+            "serviceId='" + serviceId + '\'' +
+            ", operationId='" + operationId + '\'' +
+            ", serviceName='" + serviceName + '\'' +
+            ", operation='" + operation + '\'' +
+            ", userId='" + userId + '\'' +
+            ", result='" + result + '\'' +
+            ", operationContent='" + operationContent + '\'' +
+            ", progress='" + progress + '\'' +
+            ", reason='" + reason + '\'' +
+            ", operateAt=" + operateAt +
+            ", finishedAt=" + finishedAt +
+            '}';
+    }
+}
\ No newline at end of file