Author: davsclaus
Date: Thu Dec 4 11:52:59 2008
New Revision: 723411
URL: http://svn.apache.org/viewvc?rev=723411&view=rev
Log:
Merged revisions 723409 via svnmerge from
https://svn.apache.org/repos/asf/activemq/camel/trunk
........
r723409 | davsclaus | 2008-12-04 20:50:07 +0100 (to, 04 dec 2008) | 1 line
CAMEL-1144: Polished code. Strategy method for the iterator and having the
inner class as private
........
Modified:
activemq/camel/branches/camel-1.x/ (props changed)
activemq/camel/branches/camel-1.x/camel-core/src/main/java/org/apache/camel/processor/exceptionpolicy/DefaultExceptionPolicyStrategy.java
activemq/camel/branches/camel-1.x/components/camel-mina/src/test/java/org/apache/camel/component/mina/MinaInOutRouteTextLineDelimiterTest.java
(props changed)
activemq/camel/branches/camel-1.x/components/camel-mina/src/test/java/org/apache/camel/component/mina/MinaNoResponseFromServerTest.java
(props changed)
activemq/camel/branches/camel-1.x/components/camel-mina/src/test/java/org/apache/camel/component/mina/MinaTcpLineDelimiterUsingPlainSocketTest.java
(props changed)
activemq/camel/branches/camel-1.x/components/camel-mina/src/test/java/org/apache/camel/component/mina/MinaTcpTextlineDelimiterTest.java
(props changed)
Propchange: activemq/camel/branches/camel-1.x/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Dec 4 11:52:59 2008
@@ -1 +1 @@
-/activemq/camel/trunk:709850,711200,711206,711219-711220,711523,711531,711756,711784,711859,711874,711962,711971,712064,712119,712148,712662,712692,712925,713013,713107,713136,713273,713290,713292,713295,713314,713475,713625,713932,713944,714032,717965,717989,718242,718273,718312-718515,719163-719184,719334,719339,719524,719662,719848,719851,719855,719864,719978-719979,720207,720435-720437,720806,721272,721331,721333-721334,721360,721669,721764,721813,721985,722005,722070,722110,722415,722438,722726,722845,722878,723264,723314,723325-723327
+/activemq/camel/trunk:709850,711200,711206,711219-711220,711523,711531,711756,711784,711859,711874,711962,711971,712064,712119,712148,712662,712692,712925,713013,713107,713136,713273,713290,713292,713295,713314,713475,713625,713932,713944,714032,717965,717989,718242,718273,718312-718515,719163-719184,719334,719339,719524,719662,719848,719851,719855,719864,719978-719979,720207,720435-720437,720806,721272,721331,721333-721334,721360,721669,721764,721813,721985,722005,722070,722110,722415,722438,722726,722845,722878,723264,723314,723325-723327,723409
Propchange: activemq/camel/branches/camel-1.x/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.
Modified:
activemq/camel/branches/camel-1.x/camel-core/src/main/java/org/apache/camel/processor/exceptionpolicy/DefaultExceptionPolicyStrategy.java
URL:
http://svn.apache.org/viewvc/activemq/camel/branches/camel-1.x/camel-core/src/main/java/org/apache/camel/processor/exceptionpolicy/DefaultExceptionPolicyStrategy.java?rev=723411&r1=723410&r2=723411&view=diff
==============================================================================
---
activemq/camel/branches/camel-1.x/camel-core/src/main/java/org/apache/camel/processor/exceptionpolicy/DefaultExceptionPolicyStrategy.java
(original)
+++
activemq/camel/branches/camel-1.x/camel-core/src/main/java/org/apache/camel/processor/exceptionpolicy/DefaultExceptionPolicyStrategy.java
Thu Dec 4 11:52:59 2008
@@ -58,9 +58,9 @@
Throwable exception) {
// recursive up the tree using the iterator
- Iterator<Throwable> it = new ExceptionIterator(exception);
+ Iterator<Throwable> it = createExceptionIterator(exception);
while (it.hasNext()) {
- ExceptionType type = doGetExceptionPolicy(exceptionPolicices,
exchange, it.next());
+ ExceptionType type =
findMatchedExceptionPolicy(exceptionPolicices, exchange, it.next());
if (type != null) {
return type;
}
@@ -70,7 +70,8 @@
return null;
}
- private ExceptionType doGetExceptionPolicy(Map<ExceptionPolicyKey,
ExceptionType> exceptionPolicices, Exchange exchange,
+
+ private ExceptionType findMatchedExceptionPolicy(Map<ExceptionPolicyKey,
ExceptionType> exceptionPolicices, Exchange exchange,
Throwable exception) {
if (LOG.isDebugEnabled()) {
LOG.debug("Finding best suited exception policy for thrown
exception " + exception.getClass().getName());
@@ -162,6 +163,20 @@
return type.getOnWhen().getExpression().matches(exchange);
}
+ /**
+ * Strategy method creating the iterator to walk the exception in the
order Camel should use
+ * for find the [EMAIL PROTECTED] ExceptionType} should be used.
+ * <p/>
+ * The default iterator will walk from the bottom upwards
+ * (the last caused by going upwards to the exception)
+ *
+ * @param exception the exception
+ * @return the iterator
+ */
+ protected Iterator<Throwable> createExceptionIterator(Throwable exception)
{
+ return new ExceptionIterator(exception);
+ }
+
private static int getInheritanceLevel(Class clazz) {
if (clazz == null || "java.lang.Object".equals(clazz.getName())) {
return 0;
@@ -169,12 +184,7 @@
return 1 + getInheritanceLevel(clazz.getSuperclass());
}
- /**
- * Iterator that walks the exception hieracy in the order we should match.
- * <p/>
- * Will default walk from bottom upwards to the root exception
- */
- protected class ExceptionIterator implements Iterator<Throwable> {
+ private class ExceptionIterator implements Iterator<Throwable> {
private List<Throwable> tree = new ArrayList<Throwable>();
private Iterator<Throwable> it;
@@ -204,5 +214,4 @@
}
}
-
}
Propchange:
activemq/camel/branches/camel-1.x/components/camel-mina/src/test/java/org/apache/camel/component/mina/MinaInOutRouteTextLineDelimiterTest.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Dec 4 11:52:59 2008
@@ -1 +1 @@
-/activemq/camel/trunk/components/camel-mina/src/test/java/org/apache/camel/component/mina/MinaInOutRouteTextLineDelimiterTest.java:722878,723264,723314,723325-723327
+/activemq/camel/trunk/components/camel-mina/src/test/java/org/apache/camel/component/mina/MinaInOutRouteTextLineDelimiterTest.java:722878,723264,723314,723325-723327,723409
Propchange:
activemq/camel/branches/camel-1.x/components/camel-mina/src/test/java/org/apache/camel/component/mina/MinaNoResponseFromServerTest.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Dec 4 11:52:59 2008
@@ -1 +1 @@
-/activemq/camel/trunk/components/camel-mina/src/test/java/org/apache/camel/component/mina/MinaNoResponseFromServerTest.java:723264,723314,723325-723327
+/activemq/camel/trunk/components/camel-mina/src/test/java/org/apache/camel/component/mina/MinaNoResponseFromServerTest.java:723264,723314,723325-723327,723409
Propchange:
activemq/camel/branches/camel-1.x/components/camel-mina/src/test/java/org/apache/camel/component/mina/MinaTcpLineDelimiterUsingPlainSocketTest.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Dec 4 11:52:59 2008
@@ -1 +1 @@
-/activemq/camel/trunk/components/camel-mina/src/test/java/org/apache/camel/component/mina/MinaTcpLineDelimiterUsingPlainSocketTest.java:722878,723264,723314,723325-723327
+/activemq/camel/trunk/components/camel-mina/src/test/java/org/apache/camel/component/mina/MinaTcpLineDelimiterUsingPlainSocketTest.java:722878,723264,723314,723325-723327,723409
Propchange:
activemq/camel/branches/camel-1.x/components/camel-mina/src/test/java/org/apache/camel/component/mina/MinaTcpTextlineDelimiterTest.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Dec 4 11:52:59 2008
@@ -1 +1 @@
-/activemq/camel/trunk/components/camel-mina/src/test/java/org/apache/camel/component/mina/MinaTcpTextlineDelimiterTest.java:722878,723264,723314,723325-723327
+/activemq/camel/trunk/components/camel-mina/src/test/java/org/apache/camel/component/mina/MinaTcpTextlineDelimiterTest.java:722878,723264,723314,723325-723327,723409