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: CAMEL-7182: Do not throw checked exception in camel-guice as not allowed for pre/post constructs.
Date Sat, 08 Feb 2014 08:06:28 GMT
Updated Branches:
  refs/heads/camel-2.11.x 0e5304ca4 -> c8e8e92dc
  refs/heads/camel-2.12.x 60011b979 -> bbd3d8d4f


CAMEL-7182: Do not throw checked exception in camel-guice as not allowed for pre/post constructs.


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

Branch: refs/heads/camel-2.11.x
Commit: c8e8e92dca255743a9dce382501a3a846b680014
Parents: 0e5304c
Author: Claus Ibsen <davsclaus@apache.org>
Authored: Sat Feb 8 09:05:45 2014 +0100
Committer: Claus Ibsen <davsclaus@apache.org>
Committed: Sat Feb 8 09:07:23 2014 +0100

----------------------------------------------------------------------
 .../apache/camel/guice/GuiceCamelContext.java   | 28 ++++++++++++++------
 1 file changed, 20 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/c8e8e92d/components/camel-guice/src/main/java/org/apache/camel/guice/GuiceCamelContext.java
----------------------------------------------------------------------
diff --git a/components/camel-guice/src/main/java/org/apache/camel/guice/GuiceCamelContext.java
b/components/camel-guice/src/main/java/org/apache/camel/guice/GuiceCamelContext.java
index bb2bf59..7059f0f 100644
--- a/components/camel-guice/src/main/java/org/apache/camel/guice/GuiceCamelContext.java
+++ b/components/camel-guice/src/main/java/org/apache/camel/guice/GuiceCamelContext.java
@@ -29,7 +29,6 @@ import com.google.inject.Inject;
 
 import org.apache.camel.ErrorHandlerFactory;
 import org.apache.camel.RoutesBuilder;
-import org.apache.camel.RuntimeCamelException;
 import org.apache.camel.TypeConverter;
 import org.apache.camel.guice.impl.GuiceInjector;
 import org.apache.camel.guice.inject.Injectors;
@@ -41,6 +40,7 @@ import org.apache.camel.spi.InterceptStrategy;
 import org.apache.camel.spi.LanguageResolver;
 import org.apache.camel.spi.LifecycleStrategy;
 import org.apache.camel.spi.Registry;
+import org.apache.camel.util.ObjectHelper;
 
 /**
  * The default CamelContext implementation for working with Guice.
@@ -60,20 +60,32 @@ public class GuiceCamelContext extends DefaultCamelContext {
 
     @PostConstruct
     @Override
-    public void start() throws Exception {
-        super.start();
+    public void start() {
+        try {
+            super.start();
+        } catch (Exception e) {
+            throw ObjectHelper.wrapRuntimeCamelException(e);
+        }
     }
 
     @PreDestroy
     @Override
-    public void stop() throws Exception {
-        super.stop();
+    public void stop() {
+        try {
+            super.stop();
+        } catch (Exception e) {
+            throw ObjectHelper.wrapRuntimeCamelException(e);
+        }
     }
 
     @Inject
-    public void setRouteBuilders(Set<RoutesBuilder> routeBuilders) throws Exception
{
+    public void setRouteBuilders(Set<RoutesBuilder> routeBuilders) {
         for (RoutesBuilder builder : routeBuilders) {
-            addRoutes(builder);
+            try {
+                addRoutes(builder);
+            } catch (Exception e) {
+                throw ObjectHelper.wrapRuntimeCamelException(e);
+            }
         }
     }
 
@@ -157,7 +169,7 @@ public class GuiceCamelContext extends DefaultCamelContext {
                 return injector.getInstance(Context.class);
             }
         } catch (Exception e) {
-            throw new RuntimeCamelException(e);
+            throw ObjectHelper.wrapRuntimeCamelException(e);
         }
     }
 


Mime
View raw message