From 074027b6660fe5865ef8f360663abd03359ec21e Mon Sep 17 00:00:00 2001 From: Elena Kuleshov Date: Tue, 10 Sep 2019 23:04:51 -0400 Subject: Set payload to empty when it is not specified Handle a case of non-existent payload and improve error reporting on APPC request construction Issue-ID: SO-2300 Signed-off-by: Kuleshov, Elena Change-Id: I93a1ac8ebfcaa0e39b26130e601d3b657cbed503 --- .../org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasks.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasks.java index 3bf9720036..9c72d229b2 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasks.java @@ -61,6 +61,7 @@ public class AppcRunTasks { public static final String ROLLBACK_VNF_LOCK = "rollbackVnfLock"; public static final String ROLLBACK_QUIESCE_TRAFFIC = "rollbackQuiesceTraffic"; public static final String CONTROLLER_TYPE_DEFAULT = "APPC"; + public static final String GENERIC_APPC_ERROR_CODE = "1002"; @Autowired private ExceptionBuilder exceptionUtil; @Autowired @@ -159,7 +160,7 @@ public class AppcRunTasks { HashMap payloadInfo = buildPayloadInfo(vnfName, aicIdentity, vnfHostIpAddress, vmIdList, vserverIdList, identityUrl, vfModuleId); - Optional payload = null; + Optional payload = Optional.empty(); RequestParameters requestParameters = gBBInput.getRequestContext().getRequestParameters(); if (requestParameters != null) { String pay = requestParameters.getPayload(); @@ -175,7 +176,9 @@ public class AppcRunTasks { mapRollbackVariables(execution, action, appcCode); } catch (Exception e) { logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), - "Caught exception in runAppcCommand", "BPMN", ErrorCode.UnknownError.getValue(), "APPC Error", e); + "Caught exception in runAppcCommand", "BPMN", ErrorCode.UnknownError.getValue(), + "Error on request to APPC", e); + appcCode = GENERIC_APPC_ERROR_CODE; appcMessage = e.getMessage(); } -- cgit 1.2.3-korg