diff options
author | Witold Ficio Kopel <w.kopel@samsung.com> | 2019-03-26 09:17:02 +0100 |
---|---|---|
committer | Witold Ficio Kopel <w.kopel@samsung.com> | 2019-03-26 13:12:09 +0100 |
commit | 59700d14ff998413dada0cb2e0864e643edbb77e (patch) | |
tree | d066adaedc28efce511d5fc66750f34e91eedb22 /bpmn/so-bpmn-infrastructure-common/src/main | |
parent | af46c0d4b30ecb5c8f36992e74adb86d7d5bbe06 (diff) |
Eliminated printStackTrace() calls
Eliminated calls to printStackTrace() on Throwable as they go to stdout
and are not handled by logger.
Occurences has been replaced by calls to logger or modifications to
nearby logger calls (Throwable passed as last parameter).
Occurences in unit test classes left without modification.
Change-Id: I6a771d60a3ea69ceecc29bb21358e565aa5ce101
Issue-ID: LOG-631
Signed-off-by: Witold Ficio Kopel <w.kopel@samsung.com>
Diffstat (limited to 'bpmn/so-bpmn-infrastructure-common/src/main')
9 files changed, 23 insertions, 33 deletions
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateNetworkInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateNetworkInstance.groovy index 19fe018e13..d588da38b0 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateNetworkInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateNetworkInstance.groovy @@ -416,7 +416,7 @@ public class CreateNetworkInstance extends AbstractServiceTaskProcessor { } catch (Exception ex) { String errorException = " Bpmn error encountered in CreateNetworkInstance flow. FalloutHandlerRequest, buildErrorResponse()" - logger.debug("Exception error in CreateNetworkInstance flow, buildErrorResponse(): " + ex.getMessage()) + logger.debug("Exception error in CreateNetworkInstance flow, buildErrorResponse(): {}", ex.getMessage(), ex) falloutHandlerRequest = """<aetgt:FalloutHandlerRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1" xmlns:ns="http://org.onap/so/request/types/v1" diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModule.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModule.groovy index 7a606d515c..eface7b847 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModule.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModule.groovy @@ -668,8 +668,7 @@ public class DoCreateVfModule extends VfModuleBase { rollbackData.put("VFMODULE", "rollbackPrepareUpdateVfModule", "true") execution.setVariable("rollbackData", rollbackData) } catch (Exception ex) { - ex.printStackTrace() - logger.debug('Exception occurred while postProcessing CreateAAIVfModule request:' + ex.getMessage()) + logger.debug('Exception occurred while postProcessing CreateAAIVfModule request: {}', ex.getMessage(), ex) exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Bad response from CreateAAIVfModule' + ex.getMessage()) } logger.trace('Exited ' + method) @@ -741,8 +740,7 @@ public class DoCreateVfModule extends VfModuleBase { } } } catch (Exception ex) { - ex.printStackTrace() - logger.debug('Exception occurred while executing AAI GET:' + ex.getMessage()) + logger.debug('Exception occurred while executing AAI GET: {}', ex.getMessage(), ex) exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'AAI GET Failed:' + ex.getMessage()) } logger.trace('Exited ' + method) @@ -822,17 +820,16 @@ public class DoCreateVfModule extends VfModuleBase { } } } catch (Exception ex) { - ex.printStackTrace() - logger.debug('Exception occurred while executing AAI GET:' + ex.getMessage()) + logger.debug('Exception occurred while executing AAI GET: {}', ex.getMessage(), ex) exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'AAI GET Failed:' + ex.getMessage()) } logger.trace('Exited ' + method) } catch (BpmnError e) { throw e; } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", - ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); + ErrorCode.UnknownError.getValue(), "Exception is:\n" + e, e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in queryAAIVfModuleForStatus(): ' + e.getMessage()) } } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnf.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnf.groovy index 5f160bb068..e1b0776d3b 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnf.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnf.groovy @@ -362,7 +362,7 @@ class DoCreateVnf extends AbstractServiceTaskProcessor { resourceClient.connect(uri, siUri) }catch(Exception ex) { - logger.debug("Error Occured in DoCreateVnf CreateGenericVnf Process ", ex) + logger.debug("Error Occured in DoCreateVnf CreateGenericVnf Process: {}", ex.getMessage(), ex) exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in DoCreateVnf CreateGenericVnf Process") } logger.trace("COMPLETED DoCreateVnf CreateGenericVnf Process") diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModule.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModule.groovy index 05ccfa02ba..26233811ae 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModule.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModule.groovy @@ -621,8 +621,7 @@ public class DoDeleteVfModule extends AbstractServiceTaskProcessor{ logger.debug("Received orchestration status from A&AI: " + orchestrationStatus) } } catch (Exception ex) { - ex.printStackTrace() - logger.debug('Exception occurred while executing AAI GET:' + ex.getMessage()) + logger.debug('Exception occurred while executing AAI GET: {}', ex.getMessage(), ex) exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'AAI GET Failed:' + ex.getMessage()) } logger.trace('Exited ' + method) diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleFromVnf.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleFromVnf.groovy index 47aec46277..f0182e5614 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleFromVnf.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleFromVnf.groovy @@ -50,7 +50,7 @@ import org.slf4j.LoggerFactory public class DoDeleteVfModuleFromVnf extends VfModuleBase { private static final Logger logger = LoggerFactory.getLogger( DoDeleteVfModuleFromVnf.class); - + def Prefix="DDVFMV_" ExceptionUtil exceptionUtil = new ExceptionUtil() JsonUtils jsonUtil = new JsonUtils() @@ -66,7 +66,7 @@ public class DoDeleteVfModuleFromVnf extends VfModuleBase { initProcessVariables(execution) try { - + // Building Block-type request // Set mso-request-id to request-id for VNF Adapter interface @@ -75,7 +75,7 @@ public class DoDeleteVfModuleFromVnf extends VfModuleBase { execution.setVariable("requestId", requestId) logger.debug("msoRequestId: " + requestId) String tenantId = execution.getVariable("tenantId") - logger.debug("tenantId: " + tenantId) + logger.debug("tenantId: " + tenantId) String cloudSiteId = execution.getVariable("lcpCloudRegionId") execution.setVariable("cloudSiteId", cloudSiteId) logger.debug("cloudSiteId: " + cloudSiteId) @@ -102,15 +102,15 @@ public class DoDeleteVfModuleFromVnf extends VfModuleBase { } else { execution.setVariable(Prefix + "serviceInstanceIdToSdnc", serviceInstanceId) - } + } String sdncVersion = execution.getVariable("sdncVersion") if (sdncVersion == null) { sdncVersion = "1707" } execution.setVariable(Prefix + "sdncVersion", sdncVersion) - logger.debug("Incoming Sdnc Version is: " + sdncVersion) - + logger.debug("Incoming Sdnc Version is: " + sdncVersion) + String sdncCallbackUrl = (String) UrnPropertiesReader.getVariable("mso.workflow.sdncadapter.callback",execution) if (sdncCallbackUrl == null || sdncCallbackUrl.trim().isEmpty()) { def msg = 'Required variable \'mso.workflow.sdncadapter.callback\' is missing' @@ -122,8 +122,6 @@ public class DoDeleteVfModuleFromVnf extends VfModuleBase { logger.debug("SDNC Callback URL: " + sdncCallbackUrl) logger.debug("SDNC Callback URL is: " + sdncCallbackUrl) - - }catch(BpmnError b){ throw b }catch(Exception e){ @@ -131,7 +129,7 @@ public class DoDeleteVfModuleFromVnf extends VfModuleBase { exceptionUtil.buildAndThrowWorkflowException(execution, 2000, "Internal Error encountered in PreProcess method!") } } - + public void queryAAIForVfModule(DelegateExecution execution) { def method = getClass().getSimpleName() + '.queryAAIForVfModule(' + 'execution=' + execution.getId() + @@ -154,8 +152,7 @@ public class DoDeleteVfModuleFromVnf extends VfModuleBase { execution.setVariable('DDVMFV_getVnfResponse', "Generic Vnf not found!") } } catch (Exception ex) { - ex.printStackTrace() - logger.debug('Exception occurred while executing AAI GET:' + ex.getMessage()) + logger.debug('Exception occurred while executing AAI GET: {}', ex.getMessage(), ex) execution.setVariable('DDVMFV_getVnfResponseCode', 500) execution.setVariable('DDVFMV_getVnfResponse', 'AAI GET Failed:' + ex.getMessage()) } @@ -169,7 +166,7 @@ public class DoDeleteVfModuleFromVnf extends VfModuleBase { exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in queryAAIForVfModule(): ' + e.getMessage()) } } - + /** * Validate the VF Module. That is, confirm that a VF Module with the input VF Module ID * exists in the retrieved Generic VNF. Then, check to make sure that if that VF Module diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVnfAndModules.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVnfAndModules.groovy index fb62babae9..ca367d0045 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVnfAndModules.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVnfAndModules.groovy @@ -322,7 +322,7 @@ class DoDeleteVnfAndModules extends AbstractServiceTaskProcessor { } if (vfModuleBaseEntry != null) { vfModulesList.add(vfModuleBaseEntry) - } + } } }else{ execution.setVariable('DCVFM_queryAAIVfModuleResponseCode', 404) @@ -331,8 +331,7 @@ class DoDeleteVnfAndModules extends AbstractServiceTaskProcessor { } execution.setVariable("DDVAM_vfModules", vfModulesList) } catch (Exception ex) { - ex.printStackTrace() - logger.debug('Exception occurred while executing AAI GET:' + ex.getMessage()) + logger.debug('Exception occurred while executing AAI GET: {}', ex.getMessage(), ex) exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'AAI GET Failed:' + ex.getMessage()) } logger.trace('Exited ' + method) diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVfModule.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVfModule.groovy index 013f66b008..a05d2527b0 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVfModule.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVfModule.groovy @@ -1041,8 +1041,7 @@ public class DoUpdateVfModule extends VfModuleBase { } } } catch (Exception ex) { - ex.printStackTrace() - logger.debug('Exception occurred while executing AAI GET:' + ex.getMessage()) + logger.debug('Exception occurred while executing AAI GET: {}', ex.getMessage(), ex) exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'AAI GET Failed:' + ex.getMessage()) } logger.trace('Exited ' + method) @@ -1051,7 +1050,7 @@ public class DoUpdateVfModule extends VfModuleBase { } catch (Exception e) { logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", - ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); + ErrorCode.UnknownError.getValue(), "Exception is:\n" + e, e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in queryAAIVfModule(): ' + e.getMessage()) } } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVnfAndModules.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVnfAndModules.groovy index 3dd5e61246..eb788a85b7 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVnfAndModules.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVnfAndModules.groovy @@ -265,8 +265,7 @@ class DoUpdateVnfAndModules extends AbstractServiceTaskProcessor { } execution.setVariable("DUVAM_vfModules", vfModulesList) } catch (Exception ex) { - ex.printStackTrace() - logger.debug('Exception occurred while executing AAI GET:' + ex.getMessage()) + logger.debug('Exception occurred while executing AAI GET: {}', ex.getMessage(), ex) exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'AAI GET Failed:' + ex.getMessage()) } logger.trace('Exited ' + method) diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateNetworkInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateNetworkInstance.groovy index 0b46a5a849..b12da9f959 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateNetworkInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateNetworkInstance.groovy @@ -362,7 +362,7 @@ public class UpdateNetworkInstance extends AbstractServiceTaskProcessor { } catch (Exception ex) { String errorException = " Bpmn error encountered in UpdateNetworkInstance flow. FalloutHandlerRequest, buildErrorResponse() - " - logger.debug("Exception error in UpdateNetworkInstance flow, buildErrorResponse(): " + ex.getMessage()) + logger.debug("Exception error in UpdateNetworkInstance flow, buildErrorResponse(): {}", ex.getMessage(), ex) falloutHandlerRequest = """<aetgt:FalloutHandlerRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1" xmlns:ns="http://org.onap/so/request/types/v1" |