diff options
Diffstat (limited to 'mso-api-handlers')
8 files changed, 15 insertions, 17 deletions
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/ApiExceptionMapper.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/ApiExceptionMapper.java index e0bcc71736..0e581cb48a 100644 --- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/ApiExceptionMapper.java +++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/ApiExceptionMapper.java @@ -63,7 +63,7 @@ public class ApiExceptionMapper implements ExceptionMapper<ApiException> { errorText = errorText.substring(0, 1999); } - writeErrorLog(errorText, errorLoggerInfo, alarmLoggerInfo); + writeErrorLog(exception, errorText, errorLoggerInfo, alarmLoggerInfo); return buildServiceErrorResponse(errorText,messageId,variables); @@ -96,8 +96,9 @@ public class ApiExceptionMapper implements ExceptionMapper<ApiException> { return requestErrorStr; } - protected void writeErrorLog(String errorText, ErrorLoggerInfo errorLogInfo, AlarmLoggerInfo alarmLogInfo) { - + protected void writeErrorLog(Exception e, String errorText, ErrorLoggerInfo errorLogInfo, AlarmLoggerInfo alarmLogInfo) { + if( e!= null) + logger.error(e); if(errorLogInfo != null) logger.error(errorLogInfo.getLoggerMessageType().toString(), errorLogInfo.getErrorSource(), errorLogInfo.getTargetEntity(), errorLogInfo.getTargetServiceName(), errorLogInfo.getErrorCode(), errorText); if(alarmLogInfo != null){ diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/OrchestrationRequests.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/OrchestrationRequests.java index 3a944473d9..014739d581 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/OrchestrationRequests.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/OrchestrationRequests.java @@ -102,7 +102,7 @@ public class OrchestrationRequests { requestDB = requestsDbClient.getInfraActiveRequestbyRequestId(requestId); } catch (Exception e) { - + msoLogger.error(e); ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_DB_ACCESS_EXC, MsoLogger.ErrorCode.AvailabilityError).build(); AlarmLoggerInfo alarmLoggerInfo = new AlarmLoggerInfo.Builder("MsoDatabaseAccessError", MsoAlarmLogger.CRITICAL, Messages.errors.get(ErrorNumbers.NO_COMMUNICATION_TO_REQUESTS_DB)).build(); @@ -156,12 +156,10 @@ public class OrchestrationRequests { throw new ValidationException("At least one filter query param must be specified"); } }catch(ValidationException ex){ + msoLogger.error(ex); ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, MsoLogger.ErrorCode.DataError).build(); - - ValidateException validateException = new ValidateException.Builder(ex.getMessage(), HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_GENERAL_SERVICE_ERROR).cause(ex).errorInfo(errorLoggerInfo).build(); - throw validateException; } @@ -202,10 +200,8 @@ public class OrchestrationRequests { ObjectMapper mapper = new ObjectMapper(); sir = mapper.readValue(requestJSON, ServiceInstancesRequest.class); } catch(IOException e){ - + msoLogger.error(e); ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, MsoLogger.ErrorCode.SchemaError).build(); - - ValidateException validateException = new ValidateException.Builder("Mapping of request to JSON object failed : " + e.getMessage(), HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_BAD_PARAMETER).cause(e).errorInfo(errorLoggerInfo).build(); @@ -215,6 +211,7 @@ public class OrchestrationRequests { try{ msoRequest.parseOrchestration(sir); } catch (Exception e) { + msoLogger.error(e); ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, MsoLogger.ErrorCode.SchemaError).build(); ValidateException validateException = new ValidateException.Builder("Error parsing request: " + e.getMessage(), HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_BAD_PARAMETER).cause(e) .errorInfo(errorLoggerInfo).build(); @@ -301,7 +298,7 @@ public class OrchestrationRequests { requestDetails = mapper.readValue(requestBody, RequestDetails.class); } } catch (IOException e) { - + msoLogger.error(e); ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, MsoLogger.ErrorCode.SchemaError).build(); ValidateException validateException = new ValidateException.Builder("Mapping of request to JSON object failed : ", HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_BAD_PARAMETER).cause(e).errorInfo(errorLoggerInfo).build(); diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/CloudConfiguration/InPlaceSoftwareUpdateCloudConfiguration.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/CloudConfiguration/InPlaceSoftwareUpdateCloudConfiguration.json index 18b785cae5..57aea4d2bb 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/CloudConfiguration/InPlaceSoftwareUpdateCloudConfiguration.json +++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/CloudConfiguration/InPlaceSoftwareUpdateCloudConfiguration.json @@ -32,7 +32,7 @@ ], "requestParameters": { "autoBuildVfModules": false, - "payload": "{\"existing-software-version\": \"3.1\",\"new-software-version\": \"3.2\", \"operations-timeout\": \"3600\"}" + "payload": "{\"existing_software_version\": \"3.1\",\"new_software_version\": \"3.2\", \"operations_timeout\": \"3600\"}" } } }
\ No newline at end of file diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/CloudConfiguration/InPlaceSoftwareUpdateCloudRegionId.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/CloudConfiguration/InPlaceSoftwareUpdateCloudRegionId.json index bd114f7ad8..e876711c66 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/CloudConfiguration/InPlaceSoftwareUpdateCloudRegionId.json +++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/CloudConfiguration/InPlaceSoftwareUpdateCloudRegionId.json @@ -35,7 +35,7 @@ ], "requestParameters": { "autoBuildVfModules": false, - "payload": "{\"existing-software-version\": \"3.1\",\"new-software-version\": \"3.2\", \"operations-timeout\": \"3600\"}" + "payload": "{\"existing_software_version\": \"3.1\",\"new_software_version\": \"3.2\", \"operations_timeout\": \"3600\"}" } } }
\ No newline at end of file diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RelatedInstances/v6VnfDeleteInstance.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RelatedInstances/v6VnfDeleteInstance.json index b1c9e65bba..c917a9504e 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RelatedInstances/v6VnfDeleteInstance.json +++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RelatedInstances/v6VnfDeleteInstance.json @@ -36,7 +36,7 @@ ], "requestParameters": { "autoBuildVfModules": false, - "payload": "{\"existing-software-version\": \"3.1\",\"new-software-version\": \"3.2\", \"operations-timeout\": \"3600\"}" + "payload": "{\"existing_software_version\": \"3.1\",\"new_software_version\": \"3.2\", \"operations_timeout\": \"3600\"}" } } }
\ No newline at end of file diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RequestInfo/RequestInfo.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RequestInfo/RequestInfo.json index 484f7bfc97..39cba3cfc8 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RequestInfo/RequestInfo.json +++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RequestInfo/RequestInfo.json @@ -29,7 +29,7 @@ ], "requestParameters": { "autoBuildVfModules": false, - "payload": "{\"existing-software-version\": \"3.1\",\"new-software-version\": \"3.2\", \"operations-timeout\": \"3600\"}" + "payload": "{\"existing_software_version\": \"3.1\",\"new_software_version\": \"3.2\", \"operations_timeout\": \"3600\"}" } } } diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RequestInfo/RequestorId.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RequestInfo/RequestorId.json index 8562be02b8..dbf47112f3 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RequestInfo/RequestorId.json +++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RequestInfo/RequestorId.json @@ -35,7 +35,7 @@ ], "requestParameters": { "autoBuildVfModules": false, - "payload": "{\"existing-software-version\": \"3.1\",\"new-software-version\": \"3.2\", \"operations-timeout\": \"3600\"}" + "payload": "{\"existing_software_version\": \"3.1\",\"new_software_version\": \"3.2\", \"operations_timeout\": \"3600\"}" } } } diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/SuccessfulValidation/ServiceInPlaceSoftwareUpdate.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/SuccessfulValidation/ServiceInPlaceSoftwareUpdate.json index 476b9367c1..9a21a23ca0 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/SuccessfulValidation/ServiceInPlaceSoftwareUpdate.json +++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/SuccessfulValidation/ServiceInPlaceSoftwareUpdate.json @@ -36,7 +36,7 @@ ], "requestParameters": { "autoBuildVfModules": false, - "payload": "{\"existing-software-version\": \"3.1\",\"new-software-version\": \"3.2\", \"operations-timeout\": \"3600\"}" + "payload": "{\"existing_software_version\": \"3.1\",\"new_software_version\": \"3.2\", \"operations_timeout\": \"3600\"}" } } }
\ No newline at end of file |