From a2df406852f02374c81afc8231639c7cb482f10e Mon Sep 17 00:00:00 2001 From: "rob.bog" Date: Tue, 28 May 2019 13:18:24 +0200 Subject: Cleaned up duplicated literals Cleaned up Sonar code smells related to the duplicated literals in loggers. Issue-ID: SO-1932 Signed-off-by: Robert Bogacki Change-Id: I58c48cec0012c42b7b892ae76c24c6a087c60c7e --- .../org/onap/so/bpmn/common/scripts/AaiUtil.groovy | 5 +-- .../common/scripts/AllottedResourceUtils.groovy | 3 +- .../onap/so/bpmn/common/scripts/AppCClient.groovy | 3 +- .../so/bpmn/common/scripts/CatalogDbUtils.groovy | 19 +++++----- .../bpmn/common/scripts/CompleteMsoProcess.groovy | 9 ++--- .../common/scripts/ConfirmVolumeGroupName.groovy | 4 +-- .../common/scripts/ConfirmVolumeGroupTenant.groovy | 7 ++-- .../bpmn/common/scripts/CreateAAIVfModule.groovy | 5 +-- .../bpmn/common/scripts/DeleteAAIVfModule.groovy | 8 +++-- .../so/bpmn/common/scripts/ExceptionUtil.groovy | 5 +-- .../so/bpmn/common/scripts/FalloutHandler.groovy | 17 ++++----- .../common/scripts/GenerateVfModuleName.groovy | 3 +- .../so/bpmn/common/scripts/ManualHandling.groovy | 7 ++-- .../onap/so/bpmn/common/scripts/MsoUtils.groovy | 5 +-- .../common/scripts/ReceiveWorkflowMessage.groovy | 11 +++--- .../onap/so/bpmn/common/scripts/SDNCAdapter.groovy | 6 ++-- .../bpmn/common/scripts/SDNCAdapterRestV1.groovy | 23 ++++++------ .../bpmn/common/scripts/SDNCAdapterRestV2.groovy | 15 ++++---- .../so/bpmn/common/scripts/SDNCAdapterUtils.groovy | 15 ++++---- .../common/scripts/TrinityExceptionUtil.groovy | 5 +-- .../bpmn/common/scripts/UpdateAAIGenericVnf.groovy | 3 +- .../so/bpmn/common/scripts/VfModuleBase.groovy | 7 ++-- .../so/bpmn/common/scripts/VnfAdapterRestV1.groovy | 41 +++++++++++----------- .../so/bpmn/common/scripts/VnfAdapterUtils.groovy | 3 +- .../onap/so/bpmn/common/recipe/BpmnRestClient.java | 5 +-- .../workflow/context/WorkflowContextHolder.java | 3 +- .../onap/so/client/exception/ExceptionBuilder.java | 5 +-- 27 files changed, 135 insertions(+), 107 deletions(-) (limited to 'bpmn/MSOCommonBPMN/src') diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AaiUtil.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AaiUtil.groovy index b98e395228..81d0e678ac 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AaiUtil.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AaiUtil.groovy @@ -22,6 +22,7 @@ package org.onap.so.bpmn.common.scripts +import com.google.common.base.Strings import org.onap.so.client.HttpClientFactory import org.onap.so.logger.ErrorCode @@ -134,13 +135,13 @@ class AaiUtil { } logger.debug("Cloud Region value for code='404' of " + backend + " is: " + regionId) }else{ - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Call AAI Cloud Region is NOT Successful.", "BPMN", ErrorCode.UnknownError.getValue()); throw new BpmnError("MSOWorkflowException") } }catch(Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception occured while getting the Cloud Reqion.", "BPMN", ErrorCode.UnknownError.getValue(), e.getMessage()); (new ExceptionUtil()).buildAndThrowWorkflowException(execution, 9999, e.getMessage()) diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AllottedResourceUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AllottedResourceUtils.groovy index e0e85e9629..37b7aa6d60 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AllottedResourceUtils.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AllottedResourceUtils.groovy @@ -22,6 +22,7 @@ package org.onap.so.bpmn.common.scripts +import com.google.common.base.Strings import org.onap.so.client.aai.entities.AAIResultWrapper import org.onap.so.logger.ErrorCode @@ -195,7 +196,7 @@ class AllottedResourceUtils { AAIResourceUri uri = AAIUriFactory.createResourceFromExistingURI(AAIObjectType.ALLOTTED_RESOURCE, UriBuilder.fromPath(aaiARPath).build()) getAAIClient().update(uri,allottedResource) }catch(Exception e){ - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception in updateAR.", "BPMN", ErrorCode.UnknownError.getValue(), e.getMessage()); exceptionUtil.buildAndThrowWorkflowException(execution, 500, 'Internal Error in updateAROrchStatus.' + e.getMessage()) } diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AppCClient.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AppCClient.groovy index 4a59b9789a..03598060d7 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AppCClient.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AppCClient.groovy @@ -22,6 +22,7 @@ package org.onap.so.bpmn.common.scripts +import com.google.common.base.Strings import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution import org.onap.so.bpmn.core.json.JsonUtils @@ -120,7 +121,7 @@ public class AppCClient extends AbstractServiceTaskProcessor{ appcMessage = client.getErrorMessage() } catch (BpmnError e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); appcMessage = e.getMessage() diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtils.groovy index d5b0b31a39..d7bf357dbb 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtils.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtils.groovy @@ -22,6 +22,7 @@ package org.onap.so.bpmn.common.scripts +import com.google.common.base.Strings import org.apache.commons.lang3.StringUtils import org.camunda.bpm.engine.delegate.DelegateExecution import org.json.JSONArray @@ -80,7 +81,7 @@ class CatalogDbUtils { } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception in Querying Catalog DB", "BPMN", ErrorCode.UnknownError.getValue(), e.message); throw e @@ -118,7 +119,7 @@ class CatalogDbUtils { return getResponseFromCatalogDb(execution, endPoint) } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception in Querying Catalog DB", "BPMN", ErrorCode.UnknownError.getValue(), e.message); throw e @@ -142,7 +143,7 @@ class CatalogDbUtils { } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception in Querying Catalog DB", "BPMN", ErrorCode.UnknownError.getValue(), e.message); throw e @@ -168,7 +169,7 @@ class CatalogDbUtils { } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception in Querying Catalog DB", "BPMN", ErrorCode.UnknownError.getValue(), e.message); throw e @@ -218,7 +219,7 @@ class CatalogDbUtils { logger.debug("Returning networks JSON: " + modelInfosString) } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception in parsing Catalog DB Response", "BPMN", ErrorCode.UnknownError.getValue(), e.message); } @@ -297,7 +298,7 @@ class CatalogDbUtils { logger.debug("Returning vnfs JSON: " + modelInfosString) } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception in parsing Catalog DB Response", "BPMN", ErrorCode.UnknownError.getValue(), e.message); } @@ -351,7 +352,7 @@ class CatalogDbUtils { logger.debug("Returning allottedResources JSON: " + modelInfosString) } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception in parsing Catalog DB Response", "BPMN", ErrorCode.UnknownError.getValue(), e.message); } @@ -380,7 +381,7 @@ class CatalogDbUtils { logger.debug("Returning serviceResources JSON: " + serviceResourcesObject.toString()) } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception in parsing Catalog DB Response", "BPMN", ErrorCode.UnknownError.getValue(), e.message); } @@ -428,7 +429,7 @@ class CatalogDbUtils { modelJson.put("modelInfo", modelInfo) } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception while parsing model information", "BPMN", ErrorCode.UnknownError.getValue(), e.message); } diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CompleteMsoProcess.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CompleteMsoProcess.groovy index a9e01c7191..c7de756789 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CompleteMsoProcess.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CompleteMsoProcess.groovy @@ -22,6 +22,7 @@ package org.onap.so.bpmn.common.scripts +import com.google.common.base.Strings import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution import org.onap.so.logger.ErrorCode @@ -74,7 +75,7 @@ public class CompleteMsoProcess extends AbstractServiceTaskProcessor { } catch (BpmnError e) { throw e; } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in' + + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in' + ' ' + method, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, "Internal Error - Occured in" + method) } @@ -236,7 +237,7 @@ public class CompleteMsoProcess extends AbstractServiceTaskProcessor { } catch (BpmnError e) { throw e; } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, "Internal Error - Occured in" + method) @@ -269,7 +270,7 @@ public class CompleteMsoProcess extends AbstractServiceTaskProcessor { logger.debug("Rethrowing MSOWorkflowException") throw e; } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, "Internal Error - Occured in" + method) @@ -307,7 +308,7 @@ public class CompleteMsoProcess extends AbstractServiceTaskProcessor { } catch (BpmnError e) { throw e; } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, "Internal Error - Occured in" + method) diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupName.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupName.groovy index 6a82512d88..da952ce6d7 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupName.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupName.groovy @@ -130,7 +130,7 @@ public class ConfirmVolumeGroupName extends AbstractServiceTaskProcessor{ // generates a WorkflowException if the A&AI query returns a response code other than 200/404 public void handleAAIQueryFailure(DelegateExecution execution) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(com.google.common.base.Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Error occurred attempting to query AAI, Response Code " + execution.getVariable("CVGN_queryVolumeGroupResponseCode"), "BPMN", ErrorCode.UnknownError.getValue(), "ErrorResponse is:\n" + execution.getVariable("CVGN_queryVolumeGroupResponse")); @@ -140,7 +140,7 @@ public class ConfirmVolumeGroupName extends AbstractServiceTaskProcessor{ public void handleVolumeGroupNameNoMatch(DelegateExecution execution) { def errorNotAssociated = "Error occurred - volume group id ${execution.getVariable('CVGN_volumeGroupId')} " + "is not associated with ${execution.getVariable('CVGN_volumeGroupName')}" - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), errorNotAssociated, "BPMN", + logger.error(com.google.common.base.Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), errorNotAssociated, "BPMN", ErrorCode.UnknownError.getValue()); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, errorNotAssociated) } diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupTenant.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupTenant.groovy index 7c1c0a0490..011fcb68e6 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupTenant.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupTenant.groovy @@ -22,6 +22,7 @@ package org.onap.so.bpmn.common.scripts +import com.google.common.base.Strings import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution import org.onap.aai.domain.yang.VolumeGroup @@ -105,7 +106,7 @@ class ConfirmVolumeGroupTenant extends AbstractServiceTaskProcessor{ }catch(BpmnError b){ throw b }catch(Exception e){ - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Occured Processing queryAAIForVolumeGroup.", "BPMN", ErrorCode.UnknownError.getValue(), e.getMessage()); exceptionUtil.buildAndThrowWorkflowException(execution, 5000, "Internal Error - Occured in preProcessRequest.") @@ -127,7 +128,7 @@ class ConfirmVolumeGroupTenant extends AbstractServiceTaskProcessor{ logger.debug("Volume Heat Stack Id is: " + heatStackId) }catch(Exception e){ - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Occured Processing assignVolumeHeatId.", "BPMN", ErrorCode.UnknownError.getValue(), e); exceptionUtil.buildAndThrowWorkflowException(execution, 5000, "Internal Error - Occured in assignVolumeHeatId.") @@ -147,7 +148,7 @@ class ConfirmVolumeGroupTenant extends AbstractServiceTaskProcessor{ exceptionUtil.buildWorkflowException(execution, errorCode, errorMessage) }catch(Exception e){ - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Occured Processing assignWorkflowException.", "BPMN", ErrorCode.UnknownError.getValue(), e); } diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CreateAAIVfModule.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CreateAAIVfModule.groovy index e9e7d1ed7c..c496adfe83 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CreateAAIVfModule.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CreateAAIVfModule.groovy @@ -22,6 +22,7 @@ package org.onap.so.bpmn.common.scripts +import com.google.common.base.Strings import org.apache.commons.lang.StringUtils import org.camunda.bpm.engine.delegate.DelegateExecution import org.onap.aai.domain.yang.GenericVnf @@ -423,7 +424,7 @@ public class CreateAAIVfModule extends AbstractServiceTaskProcessor{ // generates a WorkflowException when the A&AI query returns a response code other than 200 or 404 public void handleAAIQueryFailure(DelegateExecution execution) { - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Error occurred attempting to query AAI, Response Code " + execution.getVariable("CAAIVfMod_queryGenericVnfResponseCode") + ", Error Response " + execution.getVariable("CAAIVfMod_queryGenericVnfResponse"), "BPMN", ErrorCode.UnknownError.getValue()); int code = execution.getVariable("CAAIVfMod_queryGenericVnfResponseCode") @@ -475,7 +476,7 @@ public class CreateAAIVfModule extends AbstractServiceTaskProcessor{ errorCode = 2000 } - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Error occurred during CreateAAIVfModule flow", "BPMN", ErrorCode.UnknownError.getValue(), errorResponse); exceptionUtil.buildAndThrowWorkflowException(execution, errorCode, errorResponse) diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/DeleteAAIVfModule.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/DeleteAAIVfModule.groovy index 4bce23eff7..93307867a0 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/DeleteAAIVfModule.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/DeleteAAIVfModule.groovy @@ -21,6 +21,8 @@ */ package org.onap.so.bpmn.common.scripts + +import com.google.common.base.Strings import org.camunda.bpm.engine.delegate.DelegateExecution import org.onap.aai.domain.yang.GenericVnf import org.onap.so.client.aai.AAIObjectType @@ -204,7 +206,7 @@ public class DeleteAAIVfModule extends AbstractServiceTaskProcessor{ // generates a WorkflowException if the A&AI query returns a response code other than 200 public void handleAAIQueryFailure(DelegateExecution execution) { - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Error occurred attempting to query AAI, Response Code " + execution.getVariable("DAAIVfMod_queryGenericVnfResponseCode") + ", Error Response " + execution.getVariable("DAAIVfMod_queryGenericVnfResponse"), "BPMN", ErrorCode.UnknownError.getValue()); def errorCode = 5000 @@ -251,7 +253,7 @@ public class DeleteAAIVfModule extends AbstractServiceTaskProcessor{ } } - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Error occurred during DeleteAAIVfModule flow", "BPMN", ErrorCode.UnknownError.getValue(), errorResponse); exceptionUtil.buildAndThrowWorkflowException(execution, errorCode, errorResponse) @@ -261,7 +263,7 @@ public class DeleteAAIVfModule extends AbstractServiceTaskProcessor{ // generates a WorkflowException if // - the A&AI Generic Vnf DELETE returns a response code other than 200 public void handleDeleteGenericVnfFailure(DelegateExecution execution) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "AAI error occurred deleting the Generic Vnf", "BPMN", ErrorCode.UnknownError.getValue(), execution.getVariable("DAAIVfMod_deleteGenericVnfResponse")); diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExceptionUtil.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExceptionUtil.groovy index 30dbeb09d5..b4f6f36876 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExceptionUtil.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExceptionUtil.groovy @@ -22,6 +22,7 @@ package org.onap.so.bpmn.common.scripts +import com.google.common.base.Strings import org.onap.so.logger.ErrorCode import static org.apache.commons.lang3.StringUtils.* @@ -91,7 +92,7 @@ class ExceptionUtil extends AbstractServiceTaskProcessor { buildWorkflowException(execution, 5000, modifiedErrorMessage) wfex = execution.getVariable("WorkflowException") - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Fault", "BPMN", + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Fault", "BPMN", ErrorCode.UnknownError.getValue(), wfex.errorMessage); return wfex } else { @@ -104,7 +105,7 @@ class ExceptionUtil extends AbstractServiceTaskProcessor { logger.debug("mappedErrorMessage " + mappedErrorMessage) wfex = execution.getVariable("WorkflowException") - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Fault", "BPMN", + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Fault", "BPMN", ErrorCode.UnknownError.getValue(), wfex.errorMessage); return wfex } catch(Exception ex) { diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/FalloutHandler.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/FalloutHandler.groovy index 2ceec3cb44..a979ceab31 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/FalloutHandler.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/FalloutHandler.groovy @@ -22,6 +22,7 @@ package org.onap.so.bpmn.common.scripts +import com.google.common.base.Strings import org.onap.so.bpmn.core.UrnPropertiesReader import org.onap.so.logger.ErrorCode @@ -97,7 +98,7 @@ public class FalloutHandler extends AbstractServiceTaskProcessor { execution.setVariable("FH_ResponseCode", "") } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); // exceptionUtil.buildWorkflowException(execution, 2000, "Internal Error - Occured in " + method) @@ -210,7 +211,7 @@ public class FalloutHandler extends AbstractServiceTaskProcessor { execution.setVariable("FH_content_type", "text/xml") } } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); // exceptionUtil.buildWorkflowException(execution, 2000, "Internal Error - Occured in" + method) @@ -244,7 +245,7 @@ public class FalloutHandler extends AbstractServiceTaskProcessor { execution.setVariable("FH_updateRequestPayload", payload) return execution.getVariable("FH_updateRequestPayload") } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); // exceptionUtil.buildWorkflowException(execution, 2000, "Internal Error - Occured in " + method) @@ -275,7 +276,7 @@ public class FalloutHandler extends AbstractServiceTaskProcessor { logger.debug("updateRequestInfraPayload: " + payload) return execution.getVariable("FH_updateRequestInfraPayload") } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); // exceptionUtil.buildWorkflowException(execution, 2000, "Internal Error - Occured in " + method) @@ -306,7 +307,7 @@ public class FalloutHandler extends AbstractServiceTaskProcessor { logger.debug("updateRequestGammaPayload: " + payload) return execution.getVariable("FH_updateRequestGammaPayload") } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); // exceptionUtil.buildWorkflowException(execution, 2000, "Internal Error - Occured in " + method) @@ -335,7 +336,7 @@ public class FalloutHandler extends AbstractServiceTaskProcessor { logger.debug("updateResponseStatusPayload: " + payload) return execution.getVariable("FH_updateResponseStatusPayload") } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); // exceptionUtil.buildWorkflowException(execution, 2000, "Internal Error - Occured in " + method) @@ -355,7 +356,7 @@ public class FalloutHandler extends AbstractServiceTaskProcessor { def errorCode = responseCode == null ? 7000 : 7020 // exceptionUtil.buildWorkflowException(execution, errorCode, errorMessage) } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); // exceptionUtil.buildWorkflowException(execution, 2000, "Internal Error - Occured in " + method) @@ -390,7 +391,7 @@ public class FalloutHandler extends AbstractServiceTaskProcessor { logger.debug("FalloutHandlerResponse =\n" + falloutHandlerResponse) } catch (Exception e) { // Do NOT throw WorkflowException! - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); } diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/GenerateVfModuleName.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/GenerateVfModuleName.groovy index f008130c32..cee1e2ab0c 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/GenerateVfModuleName.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/GenerateVfModuleName.groovy @@ -22,6 +22,7 @@ package org.onap.so.bpmn.common.scripts +import com.google.common.base.Strings import org.onap.so.bpmn.core.UrnPropertiesReader import org.onap.so.client.HttpClientFactory import org.onap.so.logger.ErrorCode @@ -158,7 +159,7 @@ public class GenerateVfModuleName extends AbstractServiceTaskProcessor{ } catch (BpmnError e) { throw e; } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in queryAAI(): ' + e.getMessage()) diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ManualHandling.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ManualHandling.groovy index 27fe33f5ea..78fa1de861 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ManualHandling.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ManualHandling.groovy @@ -22,6 +22,7 @@ package org.onap.so.bpmn.common.scripts +import com.google.common.base.Strings import org.onap.so.logger.ErrorCode; import static org.apache.commons.lang3.StringUtils.*; @@ -289,7 +290,7 @@ public class ManualHandling extends AbstractServiceTaskProcessor { } catch (BpmnError e) { throw e; } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, "Internal Error - Occured in" + method) @@ -341,11 +342,11 @@ public class ManualHandling extends AbstractServiceTaskProcessor { } catch (BpmnError e) { msg = "BPMN error in createAOTSTicket " + ex.getMessage() - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue()); } catch (Exception ex){ msg = "Exception in createAOTSTicket " + ex.getMessage() - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue()); } logger.trace("Exit createAOTSTicket of ManualHandling ") diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/MsoUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/MsoUtils.groovy index f371ccef4d..5a328a5c72 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/MsoUtils.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/MsoUtils.groovy @@ -22,6 +22,7 @@ package org.onap.so.bpmn.common.scripts +import com.google.common.base.Strings import org.onap.so.logger.ErrorCode import java.text.SimpleDateFormat @@ -294,10 +295,10 @@ class MsoUtils { if ("INFO"==logmode) { logger.info(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), logtxt, "BPMN"); } else if ("WARN"==logmode) { - logger.warn ("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_WARNING.toString(), logtxt, "BPMN", + logger.warn (Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_WARNING.toString(), logtxt, "BPMN", ErrorCode.UnknownError.getValue(), logtxt); } else if ("ERROR"==logmode) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), logtxt, "BPMN", + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), logtxt, "BPMN", ErrorCode.UnknownError.getValue(), logtxt); } else { logger.debug(logtxt); diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ReceiveWorkflowMessage.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ReceiveWorkflowMessage.groovy index a0da6870ae..84ab8fbb5d 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ReceiveWorkflowMessage.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ReceiveWorkflowMessage.groovy @@ -20,8 +20,9 @@ * ============LICENSE_END========================================================= */ -package org.onap.so.bpmn.common.scripts; +package org.onap.so.bpmn.common.scripts +import com.google.common.base.Strings; import groovy.json.* import org.apache.commons.lang3.* @@ -66,7 +67,7 @@ public void preProcessRequest (DelegateExecution execution) { if ((timeout == null) || (timeout.isEmpty())) { String msg = getProcessKey(execution) + ': Missing or empty input variable \'RCVWFMSG_timeout\'' logger.debug(msg) - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue()); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } @@ -77,7 +78,7 @@ public void preProcessRequest (DelegateExecution execution) { if ((messageType == null) || (messageType.isEmpty())) { String msg = getProcessKey(execution) + ': Missing or empty input variable \'RCVWFMSG_messageType\'' logger.debug(msg) - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue()); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } @@ -88,7 +89,7 @@ public void preProcessRequest (DelegateExecution execution) { if ((correlator == null) || (correlator.isEmpty())) { String msg = getProcessKey(execution) + ': Missing or empty input variable \'RCVWFMSG_correlator\'' logger.debug(msg) - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue()); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } @@ -100,7 +101,7 @@ public void preProcessRequest (DelegateExecution execution) { } catch (Exception e) { String msg = 'Caught exception in ' + method + ": " + e logger.debug(msg) - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue()); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapter.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapter.groovy index a7bb707dff..abd43289ad 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapter.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapter.groovy @@ -20,7 +20,9 @@ * ============LICENSE_END========================================================= */ -package org.onap.so.bpmn.common.scripts; +package org.onap.so.bpmn.common.scripts + +import com.google.common.base.Strings; import org.onap.so.bpmn.core.UrnPropertiesReader import org.onap.so.logger.ErrorCode; @@ -73,7 +75,7 @@ public class SDNCAdapter extends AbstractServiceTaskProcessor { def encodedString = utils.getBasicAuth(basicAuthValue, UrnPropertiesReader.getVariable("mso.msoKey", execution)) execution.setVariable("BasicAuthHeaderValue",encodedString) } catch (IOException ex) { - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Unable to encode username password string", "BPMN", ErrorCode.UnknownError.getValue()); } diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV1.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV1.groovy index fdd53b2f05..9bda572d58 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV1.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV1.groovy @@ -22,6 +22,7 @@ package org.onap.so.bpmn.common.scripts +import com.google.common.base.Strings import org.onap.so.client.HttpClientFactory import org.onap.so.logger.ErrorCode @@ -86,7 +87,7 @@ class SDNCAdapterRestV1 extends AbstractServiceTaskProcessor { if (sdncAdapterEndpoint == null || sdncAdapterEndpoint.isEmpty()) { String msg = getProcessKey(execution) + ': mso:adapters:sdnc:rest:endpoint URN mapping is not defined' logger.debug(msg) - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue()); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } @@ -107,7 +108,7 @@ class SDNCAdapterRestV1 extends AbstractServiceTaskProcessor { if (sdncRequestId == null || sdncRequestId.isEmpty()) { String msg = getProcessKey(execution) + ': no sdncRequestId in ' + requestType logger.debug(msg) - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue()); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } @@ -122,7 +123,7 @@ class SDNCAdapterRestV1 extends AbstractServiceTaskProcessor { if (bpNotificationUrl == null || bpNotificationUrl.isEmpty()) { String msg = getProcessKey(execution) + ': no bpNotificationUrl in ' + requestType logger.debug(msg) - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue()); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } @@ -139,7 +140,7 @@ class SDNCAdapterRestV1 extends AbstractServiceTaskProcessor { } else { String msg = getProcessKey(execution) + ': Unsupported request type: ' + requestType logger.debug(msg) - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue()); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } @@ -154,7 +155,7 @@ class SDNCAdapterRestV1 extends AbstractServiceTaskProcessor { if (basicAuthValue == null || basicAuthValue.isEmpty()) { logger.debug(getProcessKey(execution) + ": mso:adapters:po:auth URN mapping is not defined") - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), getProcessKey(execution) + ": mso:adapters:po:auth URN mapping is not defined", "BPMN", ErrorCode.UnknownError.getValue()); } else { @@ -163,7 +164,7 @@ class SDNCAdapterRestV1 extends AbstractServiceTaskProcessor { execution.setVariable(prefix + 'basicAuthHeaderValue', encodedString) } catch (IOException ex) { logger.debug(getProcessKey(execution) + ": Unable to encode BasicAuth credentials for SDNCAdapter") - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), getProcessKey(execution) + ": Unable to encode BasicAuth credentials for SDNCAdapter", "BPMN", ErrorCode.UnknownError.getValue(), ex); } @@ -195,7 +196,7 @@ class SDNCAdapterRestV1 extends AbstractServiceTaskProcessor { } catch (Exception e) { String msg = 'Caught exception in ' + method + ": " + e logger.debug(msg) - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue()); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } @@ -243,7 +244,7 @@ class SDNCAdapterRestV1 extends AbstractServiceTaskProcessor { } else { String msg = 'Unsupported HTTP method "' + sdncAdapterMethod + '" in ' + method + ": " + e logger.debug(msg) - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue()); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } @@ -257,7 +258,7 @@ class SDNCAdapterRestV1 extends AbstractServiceTaskProcessor { } catch (Exception e) { String msg = 'Caught exception in ' + method + ": " + e logger.debug(msg, e) - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue()); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } @@ -368,7 +369,7 @@ class SDNCAdapterRestV1 extends AbstractServiceTaskProcessor { } catch (Exception e) { String msg = 'Caught exception in ' + method + ": " + e logger.debug(msg) - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue()); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } @@ -394,7 +395,7 @@ class SDNCAdapterRestV1 extends AbstractServiceTaskProcessor { } catch (Exception e) { String msg = 'Caught exception in ' + method + ": " + e logger.debug(msg) - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue()); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV2.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV2.groovy index e56091ad65..1c1c1f82b9 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV2.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV2.groovy @@ -22,6 +22,7 @@ package org.onap.so.bpmn.common.scripts +import com.google.common.base.Strings import org.onap.so.logger.ErrorCode import java.text.SimpleDateFormat @@ -85,7 +86,7 @@ class SDNCAdapterRestV2 extends SDNCAdapterRestV1 { if (sdncAdapterEndpoint == null || sdncAdapterEndpoint.isEmpty()) { String msg = getProcessKey(execution) + ': mso:adapters:sdnc:rest:endpoint URN mapping is not defined' logger.debug(msg) - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue()); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } @@ -106,7 +107,7 @@ class SDNCAdapterRestV2 extends SDNCAdapterRestV1 { if (sdncRequestId == null || sdncRequestId.isEmpty()) { String msg = getProcessKey(execution) + ': no sdncRequestId in ' + requestType logger.debug(msg) - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue()); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } @@ -121,7 +122,7 @@ class SDNCAdapterRestV2 extends SDNCAdapterRestV1 { if (bpNotificationUrl == null || bpNotificationUrl.isEmpty()) { String msg = getProcessKey(execution) + ': no bpNotificationUrl in ' + requestType logger.debug(msg) - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue()); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } @@ -132,7 +133,7 @@ class SDNCAdapterRestV2 extends SDNCAdapterRestV1 { } else { String msg = getProcessKey(execution) + ': Unsupported request type: ' + requestType logger.debug(msg) - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue()); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } @@ -150,7 +151,7 @@ class SDNCAdapterRestV2 extends SDNCAdapterRestV1 { if (basicAuthValue == null || basicAuthValue.isEmpty()) { logger.debug(getProcessKey(execution) + ": mso:adapters:po:auth URN mapping is not defined") - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), getProcessKey(execution) + ": mso:adapters:po:auth URN mapping is not defined", "BPMN", ErrorCode.UnknownError.getValue()); } else { @@ -159,7 +160,7 @@ class SDNCAdapterRestV2 extends SDNCAdapterRestV1 { execution.setVariable(prefix + 'basicAuthHeaderValue', encodedString) } catch (IOException ex) { logger.debug(getProcessKey(execution) + ": Unable to encode BasicAuth credentials for SDNCAdapter") - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), getProcessKey(execution) + ": Unable to encode BasicAuth credentials for SDNCAdapter", "BPMN", ErrorCode.UnknownError.getValue(), ex); } @@ -191,7 +192,7 @@ class SDNCAdapterRestV2 extends SDNCAdapterRestV1 { } catch (Exception e) { String msg = 'Caught exception in ' + method + ": " + e logger.debug(msg) - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue()); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterUtils.groovy index eb832224db..bcf53344e1 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterUtils.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterUtils.groovy @@ -20,8 +20,9 @@ * ============LICENSE_END========================================================= */ -package org.onap.so.bpmn.common.scripts; +package org.onap.so.bpmn.common.scripts +import com.google.common.base.Strings; import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution import org.onap.aai.domain.yang.L3Network @@ -257,7 +258,7 @@ class SDNCAdapterUtils { def callbackUrl = (String)UrnPropertiesReader.getVariable('mso.workflow.sdncadapter.callback',execution) if (callbackUrl == null || callbackUrl.trim() == "") { - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'mso:workflow:sdncadapter:callback URN is not set', "BPMN", ErrorCode.UnknownError.getValue()); workflowException(execution, 'Internal Error', 9999) // TODO: what message and error code? @@ -395,7 +396,7 @@ class SDNCAdapterUtils { def callbackUrl = (String)UrnPropertiesReader.getVariable('mso.workflow.sdncadapter.callback',execution) if (callbackUrl == null || callbackUrl.trim() == "") { - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'mso:workflow:sdncadapter:callback URN is not set', "BPMN", ErrorCode.UnknownError.getValue()); exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Internal Error - During PreProcess Request") @@ -468,7 +469,7 @@ class SDNCAdapterUtils { } catch (BpmnError e) { throw e; } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 5000, "Internal Error") @@ -973,7 +974,7 @@ class SDNCAdapterUtils { } }else { - logger.warn("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_WARNING, + logger.warn(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_WARNING, 'sdncAdapter did not complete successfully, sdncAdapter Success Indicator was false ', "BPMN", ErrorCode.UnknownError, 'sdncAdapter did not complete successfully, sdncAdapter Success Indicator was false ') @@ -983,7 +984,7 @@ class SDNCAdapterUtils { } if (response == null || response.trim().equals("")) { - logger.warn("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_WARNING, + logger.warn(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_WARNING, 'sdncAdapter workflow response is empty', "BPMN", ErrorCode.UnknownError, 'sdncAdapter workflow response is empty') execution.setVariable("L3HLAB_rollback", true) @@ -996,7 +997,7 @@ class SDNCAdapterUtils { } catch (BpmnError e) { throw e; } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught ' + + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught ' + 'exception in ' + method, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); execution.setVariable(prefix+"ResponseCode",400) execution.setVariable("L3HLAB_rollback", true) diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/TrinityExceptionUtil.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/TrinityExceptionUtil.groovy index 615c977a1e..ed222d9ac6 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/TrinityExceptionUtil.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/TrinityExceptionUtil.groovy @@ -22,6 +22,7 @@ package org.onap.so.bpmn.common.scripts +import com.google.common.base.Strings import org.camunda.bpm.engine.delegate.DelegateExecution import org.apache.commons.lang3.* import org.onap.so.logger.ErrorCode @@ -215,7 +216,7 @@ class TrinityExceptionUtil { if(message != null) { execution.setVariable(prefix+"ErrorResponse",message) - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Fault", "BPMN", + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Fault", "BPMN", ErrorCode.UnknownError.getValue(), execution.getVariable(prefix+"ErrorResponse")); return message @@ -311,7 +312,7 @@ class TrinityExceptionUtil { execution.setVariable(prefix+"err", myErr) execution.setVariable(prefix+"errTxt", messageTxt) execution.setVariable(prefix+"errVariables", msgVars) - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Fault", "BPMN", + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Fault", "BPMN", ErrorCode.UnknownError.getValue(), execution.getVariable(prefix+"ErrorResponse")); return message diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIGenericVnf.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIGenericVnf.groovy index a40bf59097..82c1e4fa6e 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIGenericVnf.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIGenericVnf.groovy @@ -22,6 +22,7 @@ package org.onap.so.bpmn.common.scripts +import com.google.common.base.Strings import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution import org.onap.aai.domain.yang.GenericVnf @@ -182,7 +183,7 @@ public class UpdateAAIGenericVnf extends AbstractServiceTaskProcessor { if (newPersonaModelId != null || newPersonaModelVersion != null) { if (newPersonaModelId != genericVnf.getModelInvariantId()) { def msg = 'Can\'t update Generic VNF ' + vnfId + ' since there is \'persona-model-id\' mismatch between the current and new values' - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue()) throw new Exception(msg) } diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VfModuleBase.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VfModuleBase.groovy index c4ef165f63..0e8631e7b4 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VfModuleBase.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VfModuleBase.groovy @@ -22,6 +22,7 @@ package org.onap.so.bpmn.common.scripts +import com.google.common.base.Strings import org.onap.so.logger.ErrorCode; import javax.xml.parsers.DocumentBuilder @@ -110,7 +111,7 @@ public abstract class VfModuleBase extends AbstractServiceTaskProcessor { } } } catch (Exception e) { - logger.warn("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_WARNING.toString(), + logger.warn(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_WARNING.toString(), 'Exception transforming network params to vnfNetworks', "BPMN", ErrorCode.UnknownError.getValue(), 'Exception is: \n' + e); } @@ -149,7 +150,7 @@ public abstract class VfModuleBase extends AbstractServiceTaskProcessor { entries = entries + entry } } catch (Exception e) { - logger.warn("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_WARNING.toString(), + logger.warn(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_WARNING.toString(), 'Exception transforming params to entries', "BPMN", ErrorCode.UnknownError.getValue(), 'Exception transforming params to entries' + e); } @@ -190,7 +191,7 @@ public abstract class VfModuleBase extends AbstractServiceTaskProcessor { } } } catch (Exception e) { - logger.warn("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_WARNING.toString(), + logger.warn(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_WARNING.toString(), 'Exception transforming params to entries', "BPMN", ErrorCode.UnknownError.getValue(), 'Exception transforming params to entries' + e); } diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterRestV1.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterRestV1.groovy index 9215eabc57..6cdd3f39db 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterRestV1.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterRestV1.groovy @@ -22,6 +22,7 @@ package org.onap.so.bpmn.common.scripts +import com.google.common.base.Strings import org.onap.so.client.HttpClientFactory import org.onap.so.logger.ErrorCode @@ -78,7 +79,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor { if (messageId == null || messageId.isEmpty()) { String msg = getProcessKey(execution) + ': no messageId in ' + requestType - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue()); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } @@ -92,7 +93,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor { if (notificationUrl == null || notificationUrl.isEmpty()) { String msg = getProcessKey(execution) + ': no notificationUrl in ' + requestType - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue()); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } @@ -106,7 +107,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor { if (vnfAdapterEndpoint == null || vnfAdapterEndpoint.isEmpty()) { String msg = getProcessKey(execution) + ': mso:adapters:vnf:rest:endpoint URN mapping is not defined' - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue()); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } @@ -124,7 +125,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor { if (vnfId == null || vnfId.isEmpty()) { String msg = getProcessKey(execution) + ': no vnfId in ' + requestType - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue()); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } @@ -137,7 +138,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor { if (vnfId == null || vnfId.isEmpty()) { String msg = getProcessKey(execution) + ': no vnfId in ' + requestType - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue()); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } @@ -146,7 +147,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor { if (vfModuleId == null || vfModuleId.isEmpty()) { String msg = getProcessKey(execution) + ': no vfModuleId in ' + requestType - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue()); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } @@ -160,7 +161,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor { if (vnfId == null || vnfId.isEmpty()) { String msg = getProcessKey(execution) + ': no vnfId in ' + requestType - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue()); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } @@ -169,7 +170,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor { if (vfModuleId == null || vfModuleId.isEmpty()) { String msg = getProcessKey(execution) + ': no vfModuleId in ' + requestType - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue()); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } @@ -183,7 +184,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor { if (vfModuleRollbackNode == null) { String msg = getProcessKey(execution) + ': no vfModuleRollback in ' + requestType - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue()); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } @@ -192,7 +193,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor { if (vnfId == null || vnfId.isEmpty()) { String msg = getProcessKey(execution) + ': no vnfId in ' + requestType - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue()); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } @@ -201,7 +202,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor { if (vfModuleId == null || vfModuleId.isEmpty()) { String msg = getProcessKey(execution) + ': no vfModuleId in ' + requestType - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue()); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } @@ -222,7 +223,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor { if (volumeGroupId == null || volumeGroupId.isEmpty()) { String msg = getProcessKey(execution) + ': no volumeGroupId in ' + requestType - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue()); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } @@ -238,7 +239,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor { if (volumeGroupId == null || volumeGroupId.isEmpty()) { String msg = getProcessKey(execution) + ': no volumeGroupId in ' + requestType - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue()); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } @@ -254,7 +255,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor { if (volumeGroupId == null || volumeGroupId.isEmpty()) { String msg = getProcessKey(execution) + ': no volumeGroupId in ' + requestType - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue()); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } @@ -267,7 +268,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor { } else { String msg = getProcessKey(execution) + ': Unsupported request type: ' + requestType - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue()); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } @@ -284,7 +285,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor { String basicAuthValue = UrnPropertiesReader.getVariable("mso.adapters.po.auth", execution) if (basicAuthValue == null || basicAuthValue.isEmpty()) { - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), getProcessKey(execution) + ": mso:adapters:po:auth URN mapping is not defined", "BPMN", ErrorCode.UnknownError.getValue()); } else { @@ -292,7 +293,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor { def encodedString = utils.getBasicAuth(basicAuthValue, UrnPropertiesReader.getVariable("mso.msoKey", execution)) execution.setVariable(prefix + 'basicAuthHeaderValue', encodedString) } catch (IOException ex) { - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), getProcessKey(execution) + ": Unable to encode BasicAuth credentials for VnfAdapter", "BPMN", ErrorCode.UnknownError.getValue(), ex); } @@ -303,7 +304,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor { throw e } catch (Exception e) { String msg = 'Caught exception in ' + method + ": " + e - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue()); logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) @@ -355,7 +356,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor { response = httpClient.delete(vnfAdapterRequest) } else { String msg = 'Unsupported HTTP method "' + vnfAdapterMethod + '" in ' + method + ": " + e - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue()); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } @@ -368,7 +369,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor { throw e } catch (Exception e) { String msg = 'Caught exception in ' + method + ": " + e - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue()); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterUtils.groovy index c947bf2e65..42f1b6f1ba 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterUtils.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterUtils.groovy @@ -22,6 +22,7 @@ package org.onap.so.bpmn.common.scripts +import com.google.common.base.Strings import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution; import org.onap.so.bpmn.core.WorkflowException @@ -86,7 +87,7 @@ class VnfAdapterUtils { } catch (BpmnError e) { throw e; } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 5000, 'Internal Error- Unable to validate VNF Response ' + e.getMessage()) diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/recipe/BpmnRestClient.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/recipe/BpmnRestClient.java index b9200e0640..b9ee3608c5 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/recipe/BpmnRestClient.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/recipe/BpmnRestClient.java @@ -25,6 +25,7 @@ package org.onap.so.bpmn.common.recipe; import java.io.IOException; import java.security.GeneralSecurityException; import javax.xml.bind.DatatypeConverter; +import com.google.common.base.Strings; import org.apache.http.HttpResponse; import org.apache.http.client.ClientProtocolException; import org.apache.http.client.HttpClient; @@ -181,8 +182,8 @@ public class BpmnRestClient { jsonReq = recipeRequest.toString(); logger.trace("request body is {}", jsonReq); } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.APIH_WARP_REQUEST.toString(), "Camunda", "wrapVIDRequest", - ErrorCode.BusinessProcesssError.getValue(), "Error in APIH Warp request", e); + logger.error(Strings.repeat("{} ", 5), MessageEnum.APIH_WARP_REQUEST.toString(), "Camunda", + "wrapVIDRequest", ErrorCode.BusinessProcesssError.getValue(), "Error in APIH Warp request", e); } return jsonReq; } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/workflow/context/WorkflowContextHolder.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/workflow/context/WorkflowContextHolder.java index 33fb78b306..f4df010b08 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/workflow/context/WorkflowContextHolder.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/workflow/context/WorkflowContextHolder.java @@ -25,6 +25,7 @@ package org.onap.so.bpmn.common.workflow.context; import java.util.concurrent.DelayQueue; import java.util.concurrent.TimeUnit; +import com.google.common.base.Strings; import org.onap.so.logger.ErrorCode; import org.onap.so.logger.MessageEnum; import org.slf4j.Logger; @@ -130,7 +131,7 @@ public class WorkflowContextHolder { Thread.currentThread().interrupt(); } catch (Exception e) { logger.debug("WorkflowContextHolder timeout thread caught exception: ", e); - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN", + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN", ErrorCode.UnknownError.getValue(), "Error in WorkflowContextHolder timeout thread"); } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/ExceptionBuilder.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/ExceptionBuilder.java index 870b936f5c..52bec2e14f 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/ExceptionBuilder.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/ExceptionBuilder.java @@ -26,6 +26,7 @@ import java.io.IOException; import java.util.List; import java.util.stream.Collectors; import java.util.stream.Stream; +import com.google.common.base.Strings; import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.delegate.DelegateExecution; import org.onap.aai.domain.yang.LInterface; @@ -75,7 +76,7 @@ public class ExceptionBuilder { } } - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue(), msg.toString()); execution.setVariable(errorVariable, exception.getMessage()); } catch (Exception ex) { @@ -106,7 +107,7 @@ public class ExceptionBuilder { break; } } - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue(), msg.toString()); execution.setVariable(errorVariable, exception.getMessage()); } catch (Exception ex) { -- cgit 1.2.3-korg