diff options
author | Ram Krishna Verma <ram_krishna.verma@bell.ca> | 2021-01-15 15:10:33 -0500 |
---|---|---|
committer | Ram Krishna Verma <ram_krishna.verma@bell.ca> | 2021-01-15 15:10:44 -0500 |
commit | 514e435b6ad37525d781b383081cd10c12c2ce46 (patch) | |
tree | 721b4786eb3c2003148f4d4ec8c0bcdc71b2a1f5 | |
parent | 5f233e2e307e5202bfe1f319185f0880d354cb67 (diff) |
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 <ram_krishna.verma@bell.ca>
2 files changed, 8 insertions, 8 deletions
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 |