X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Forg%2Fonap%2Faai%2Fmodelloader%2Fservice%2FModelController.java;fp=src%2Fmain%2Fjava%2Forg%2Fonap%2Faai%2Fmodelloader%2Fservice%2FModelController.java;h=4e883aa8d1d8d22e597062a176ea1450546209c5;hb=e63280ff44773d68d4c542187864415fbf6b0547;hp=343fdcacbf2d7bf6714424e2afd7cb4e4b0b33d7;hpb=8ac4d430c6e5eb6f7a468cf7c8a83a4905bff4ba;p=aai%2Fmodel-loader.git diff --git a/src/main/java/org/onap/aai/modelloader/service/ModelController.java b/src/main/java/org/onap/aai/modelloader/service/ModelController.java index 343fdca..4e883aa 100644 --- a/src/main/java/org/onap/aai/modelloader/service/ModelController.java +++ b/src/main/java/org/onap/aai/modelloader/service/ModelController.java @@ -34,6 +34,7 @@ import org.onap.aai.modelloader.notification.NotificationDataImpl; import org.onap.aai.modelloader.notification.NotificationPublisher; import org.onap.sdc.api.IDistributionClient; import org.onap.sdc.api.notification.IArtifactInfo; +import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; @@ -83,7 +84,7 @@ public class ModelController { response = processTestArtifact(modelName, modelVersion, payload); } else { logger.debug("Simulation interface disabled"); - response = ResponseEntity.internalServerError().build(); + response = ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).build(); } return response; @@ -116,7 +117,7 @@ public class ModelController { boolean success = artifactDeploymentManager.deploy(notificationData, modelArtifacts, catalogArtifacts); logger.info(ModelLoaderMsgs.DISTRIBUTION_EVENT, "Deployment success was " + success); - response = success ? ResponseEntity.ok().build() : ResponseEntity.internalServerError().build(); + response = success ? ResponseEntity.ok().build() : ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).build(); } catch (Exception e) { String responseMessage = e.getMessage(); logger.info(ModelLoaderMsgs.DISTRIBUTION_EVENT, "Exception handled: " + responseMessage); @@ -126,7 +127,7 @@ public class ModelController { } else { responseMessage += "\nSDC publishing is enabled but has been bypassed"; } - response = ResponseEntity.internalServerError().body(responseMessage); + response = ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(responseMessage); } return response; }