You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2009/11/27 16:26:36 UTC

svn commit: r884894 - in /camel/trunk/camel-core/src/main/java/org/apache/camel/impl: DoCatchRouteNode.java OnExceptionRouteNode.java

Author: davsclaus
Date: Fri Nov 27 15:26:36 2009
New Revision: 884894

URL: http://svn.apache.org/viewvc?rev=884894&view=rev
Log:
Fixed potential NPE in tracer

Modified:
    camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DoCatchRouteNode.java
    camel/trunk/camel-core/src/main/java/org/apache/camel/impl/OnExceptionRouteNode.java

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DoCatchRouteNode.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DoCatchRouteNode.java?rev=884894&r1=884893&r2=884894&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DoCatchRouteNode.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DoCatchRouteNode.java Fri Nov 27 15:26:36 2009
@@ -38,7 +38,13 @@
     }
 
     public String getLabel(Exchange exchange) {
-        return "doCatch[" + exchange.getProperty(Exchange.EXCEPTION_CAUGHT, Exception.class).getClass().getSimpleName() + "]";
+        if (exchange.getProperty(Exchange.EXCEPTION_CAUGHT) != null) {
+            return "doCatch[" + exchange.getProperty(Exchange.EXCEPTION_CAUGHT, Exception.class).getClass().getSimpleName() + "]";
+        } else if (exchange.getException() != null) {
+            return "doCatch[" + exchange.getException().getClass().getSimpleName() + "]";
+        } else {
+            return "doCatch[]";
+        }
     }
 
     public boolean isAbstract() {

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/impl/OnExceptionRouteNode.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/OnExceptionRouteNode.java?rev=884894&r1=884893&r2=884894&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/impl/OnExceptionRouteNode.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/impl/OnExceptionRouteNode.java Fri Nov 27 15:26:36 2009
@@ -38,7 +38,13 @@
     }
 
     public String getLabel(Exchange exchange) {
-        return "OnException[" + exchange.getProperty(Exchange.EXCEPTION_CAUGHT, Exception.class).getClass().getSimpleName() + "]";
+        if (exchange.getProperty(Exchange.EXCEPTION_CAUGHT) != null) {
+            return "OnException[" + exchange.getProperty(Exchange.EXCEPTION_CAUGHT, Exception.class).getClass().getSimpleName() + "]";
+        } else if (exchange.getException() != null) {
+            return "OnException[" + exchange.getException().getClass().getSimpleName() + "]";
+        } else {
+            return "OnException[]";
+        }
     }
 
     public boolean isAbstract() {