Repository: camel
Updated Branches:
  refs/heads/master ea6d2fcc1 -> c03876bcf


CAMEL-6406 Add support to ObjectHelper.getException() for Java 1.7 
Throwable.getSuppressed()


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

Branch: refs/heads/master
Commit: c03876bcfa3be88be49ad3ffa618f71ba65e2d04
Parents: bff1ec7
Author: Willem Jiang <willem.ji...@gmail.com>
Authored: Wed Apr 22 22:10:43 2015 +0800
Committer: Willem Jiang <willem.ji...@gmail.com>
Committed: Wed Apr 22 22:10:55 2015 +0800

----------------------------------------------------------------------
 .../src/main/java/org/apache/camel/util/ObjectHelper.java     | 7 +++++++
 1 file changed, 7 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/c03876bc/camel-core/src/main/java/org/apache/camel/util/ObjectHelper.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/util/ObjectHelper.java 
b/camel-core/src/main/java/org/apache/camel/util/ObjectHelper.java
index 3aba156..4290a88 100644
--- a/camel-core/src/main/java/org/apache/camel/util/ObjectHelper.java
+++ b/camel-core/src/main/java/org/apache/camel/util/ObjectHelper.java
@@ -1707,6 +1707,13 @@ public final class ObjectHelper {
         if (exception == null) {
             return null;
         }
+        
+        //check the suppressed exception first
+        for (Throwable throwable: exception.getSuppressed()) {
+            if (type.isInstance(throwable)) {
+                return type.cast(throwable);
+            }
+        }
 
         // walk the hierarchy and look for it
         for (final Throwable throwable : createExceptionIterable(exception)) {

Reply via email to