From 514e435b6ad37525d781b383081cd10c12c2ce46 Mon Sep 17 00:00:00 2001 From: Ram Krishna Verma Date: Fri, 15 Jan 2021 15:10:33 -0500 Subject: Add exception to logs Fixing the comments from previous review - https://gerrit.onap.org/r/c/policy/apex-pdp/+/116833 Issue-ID: POLICY-2885 Change-Id: I85474b365d92771e6e1b56bba95bde6e319d4ec2 Signed-off-by: Ram Krishna Verma --- .../plugins/event/protocol/jms/Apex2JmsObjectEventConverter.java | 8 ++++---- .../plugins/event/protocol/jms/Apex2JmsTextEventConverter.java | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) (limited to 'plugins/plugins-event/plugins-event-protocol/plugins-event-protocol-jms/src/main') diff --git a/plugins/plugins-event/plugins-event-protocol/plugins-event-protocol-jms/src/main/java/org/onap/policy/apex/plugins/event/protocol/jms/Apex2JmsObjectEventConverter.java b/plugins/plugins-event/plugins-event-protocol/plugins-event-protocol-jms/src/main/java/org/onap/policy/apex/plugins/event/protocol/jms/Apex2JmsObjectEventConverter.java index 0f3a21bdc..89e2e8110 100644 --- a/plugins/plugins-event/plugins-event-protocol/plugins-event-protocol-jms/src/main/java/org/onap/policy/apex/plugins/event/protocol/jms/Apex2JmsObjectEventConverter.java +++ b/plugins/plugins-event/plugins-event-protocol/plugins-event-protocol-jms/src/main/java/org/onap/policy/apex/plugins/event/protocol/jms/Apex2JmsObjectEventConverter.java @@ -80,19 +80,19 @@ public final class Apex2JmsObjectEventConverter implements ApexEventProtocolConv Method getObjectMethod; try { getObjectMethod = eventObject.getClass().getMethod("getObject", (Class[]) null); - } catch (Exception e) { + } catch (Exception exp) { final String errorMessage = "message \"" + eventObject + "\" received from JMS does not have a \"getObject()\" method"; - throw new ApexEventRuntimeException(errorMessage); + throw new ApexEventRuntimeException(errorMessage, exp); } Object jmsIncomingObject; try { jmsIncomingObject = getObjectMethod.invoke(eventObject, (Object[]) null); - } catch (final Exception e) { + } catch (final Exception exp) { final String errorMessage = "object contained in message \"" + eventObject + "\" received from JMS could not be retrieved as a Java object"; - throw new ApexEventRuntimeException(errorMessage, e); + throw new ApexEventRuntimeException(errorMessage, exp); } // Check that the consumer parameters for JMS->Apex messaging have been set diff --git a/plugins/plugins-event/plugins-event-protocol/plugins-event-protocol-jms/src/main/java/org/onap/policy/apex/plugins/event/protocol/jms/Apex2JmsTextEventConverter.java b/plugins/plugins-event/plugins-event-protocol/plugins-event-protocol-jms/src/main/java/org/onap/policy/apex/plugins/event/protocol/jms/Apex2JmsTextEventConverter.java index e9f9109c0..701d61ef9 100644 --- a/plugins/plugins-event/plugins-event-protocol/plugins-event-protocol-jms/src/main/java/org/onap/policy/apex/plugins/event/protocol/jms/Apex2JmsTextEventConverter.java +++ b/plugins/plugins-event/plugins-event-protocol/plugins-event-protocol-jms/src/main/java/org/onap/policy/apex/plugins/event/protocol/jms/Apex2JmsTextEventConverter.java @@ -47,20 +47,20 @@ public final class Apex2JmsTextEventConverter extends Apex2JsonEventConverter { Method getTextMethod; try { getTextMethod = eventObject.getClass().getMethod("getText", (Class[]) null); - } catch (Exception e) { + } catch (Exception exp) { final String errorMessage = "message \"" + eventObject + "\" received from JMS does not have a \"getText()\" method"; - throw new ApexEventRuntimeException(errorMessage); + throw new ApexEventRuntimeException(errorMessage, exp); } String jmsString; try { jmsString = (String) getTextMethod.invoke(eventObject, (Object[]) null); - } catch (final Exception e) { + } catch (final Exception exp) { final String errorMessage = "object contained in message \"" + eventObject + "\" received from JMS could not be retrieved as a Java String"; - throw new ApexEventRuntimeException(errorMessage, e); + throw new ApexEventRuntimeException(errorMessage, exp); } // Use the generic JSON plugin from here -- cgit 1.2.3-korg