Author: davsclaus
Date: Sun Apr  6 21:42:37 2008
New Revision: 645371

URL: http://svn.apache.org/viewvc?rev=645371&view=rev
Log:
CAMEL-410 Added exact match check to let the code apply as the javadoc states

Modified:
    
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/exceptionpolicy/DefaultExceptionPolicyStrategy.java

Modified: 
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/exceptionpolicy/DefaultExceptionPolicyStrategy.java
URL: 
http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/exceptionpolicy/DefaultExceptionPolicyStrategy.java?rev=645371&r1=645370&r2=645371&view=diff
==============================================================================
--- 
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/exceptionpolicy/DefaultExceptionPolicyStrategy.java
 (original)
+++ 
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/exceptionpolicy/DefaultExceptionPolicyStrategy.java
 Sun Apr  6 21:42:37 2008
@@ -44,7 +44,7 @@
                                             Throwable exception) {
         // the goal is to find the exception with the same/closet inheritance 
level as the target exception being thrown
         int targetLevel = getInheritanceLevel(exception.getClass());
-        // candidate is the best candidate found so far
+        // candidate is the best candidate found so far to return
         ExceptionType candidate = null;
         // difference in inheritance level between the current candidate and 
the thrown exception (target level)
         int candidateDiff = Integer.MAX_VALUE;
@@ -57,6 +57,14 @@
 
             // must be instance of check to ensure that the clazz is one type 
of the thrown exception
             if (clazz.isInstance(exception)) {
+
+                // exact match
+                if (clazz.equals(exception.getClass())) {
+                    candidate = type;
+                    break;
+                }
+
+                // not an exact match so find the best candidate
                 int level = getInheritanceLevel(clazz);
                 int diff = targetLevel - level;
 


Reply via email to