camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject [3/3] git commit: Improve Exception handling in SJMS: Changed Logger calls to include the caught exception as well, so that stacktraces are no longer swallowed. Same for wrapping exceptions.
Date Fri, 26 Sep 2014 15:54:40 GMT
Improve Exception handling in SJMS:
Changed Logger calls to include the caught exception as well, so that
stacktraces are no longer swallowed. Same for wrapping exceptions.


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/96f9ab89
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/96f9ab89
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/96f9ab89

Branch: refs/heads/camel-2.14.x
Commit: 96f9ab895f4d53290ae591756f2182fe451cc69d
Parents: 720d8e4
Author: Steffen Ryll <sryll@users.noreply.github.com>
Authored: Thu Sep 25 10:49:22 2014 +0200
Committer: Claus Ibsen <davsclaus@apache.org>
Committed: Fri Sep 26 17:54:25 2014 +0200

----------------------------------------------------------------------
 .../apache/camel/component/sjms/jms/JmsMessageHelper.java | 10 +++-------
 .../camel/component/sjms/producer/InOnlyProducer.java     |  4 ++--
 2 files changed, 5 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/96f9ab89/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/jms/JmsMessageHelper.java
----------------------------------------------------------------------
diff --git a/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/jms/JmsMessageHelper.java
b/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/jms/JmsMessageHelper.java
index 35b7382..3c83585 100644
--- a/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/jms/JmsMessageHelper.java
+++ b/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/jms/JmsMessageHelper.java
@@ -139,7 +139,7 @@ public final class JmsMessageHelper {
                 break;
             }
         } catch (Exception e) {
-            LOGGER.error("Error creating a message of type: " + messageType.toString());
+            LOGGER.error("Error creating a message of type: {}", messageType, e);
             throw e;
         }
         if (messageHeaders != null && !messageHeaders.isEmpty()) {
@@ -317,9 +317,7 @@ public final class JmsMessageHelper {
         try {
             message.setJMSType(type);
         } catch (JMSException e) {
-            if (LOGGER.isDebugEnabled()) {
-                LOGGER.debug("Error setting the message type: {}", type);
-            }
+            LOGGER.debug("Error setting the message type: {}", type, e);
         }
     }
 
@@ -335,9 +333,7 @@ public final class JmsMessageHelper {
         try {
             message.setJMSCorrelationID(correlationId);
         } catch (JMSException e) {
-            if (LOGGER.isDebugEnabled()) {
-                LOGGER.debug("Error setting the correlationId: {}", correlationId);
-            }
+            LOGGER.debug("Error setting the correlationId: {}", correlationId, e);
         }
     }
 

http://git-wip-us.apache.org/repos/asf/camel/blob/96f9ab89/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/producer/InOnlyProducer.java
----------------------------------------------------------------------
diff --git a/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/producer/InOnlyProducer.java
b/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/producer/InOnlyProducer.java
index 3dac038..35ef352 100644
--- a/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/producer/InOnlyProducer.java
+++ b/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/producer/InOnlyProducer.java
@@ -74,7 +74,7 @@ public class InOnlyProducer extends SjmsProducer {
 
             answer = new MessageProducerResources(session, messageProducer, commitStrategy);
         } catch (Exception e) {
-            log.error("Unable to create the MessageProducer: " + e.getLocalizedMessage());
+            log.error("Unable to create the MessageProducer", e);
         } finally {
             if (conn != null) {
                 getConnectionResource().returnConnection(conn);
@@ -123,7 +123,7 @@ public class InOnlyProducer extends SjmsProducer {
                 producer.getMessageProducer().send(message);
             }
         } catch (Exception e) {
-            exchange.setException(new Exception("Unable to complete sending the message:
" + e.getLocalizedMessage()));
+            exchange.setException(new Exception("Unable to complete sending the message:
", e));
         } finally {
             if (producer != null) {
                 getProducers().returnObject(producer);


Mime
View raw message