camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject [1/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:38 GMT
Repository: camel
Updated Branches:
  refs/heads/camel-2.14.x 720d8e4ff -> 96f9ab895
  refs/heads/master 6a8cd4160 -> 61f9e83b4


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/14199722
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/14199722
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/14199722

Branch: refs/heads/master
Commit: 14199722e1626d383c4b8ea671d08c63d0582e14
Parents: 40bd0d6
Author: Steffen Ryll <sryll@users.noreply.github.com>
Authored: Thu Sep 25 10:49:22 2014 +0200
Committer: Steffen Ryll <sryll@users.noreply.github.com>
Committed: Thu Sep 25 10:57:15 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/14199722/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/14199722/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