camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject svn commit: r749312 - in /camel/trunk: camel-core/src/main/java/org/apache/camel/ camel-core/src/main/java/org/apache/camel/component/bean/ components/camel-rmi/src/main/java/org/apache/camel/component/rmi/
Date Mon, 02 Mar 2009 14:12:03 GMT
Author: davsclaus
Date: Mon Mar  2 14:12:02 2009
New Revision: 749312

URL: http://svn.apache.org/viewvc?rev=749312&view=rev
Log:
CAMEL-588: Removed exception not needed.

Removed:
    camel/trunk/camel-core/src/main/java/org/apache/camel/component/bean/NoBeanAvailableException.java
Modified:
    camel/trunk/camel-core/src/main/java/org/apache/camel/NoSuchBeanException.java
    camel/trunk/camel-core/src/main/java/org/apache/camel/component/bean/BeanHolder.java
    camel/trunk/camel-core/src/main/java/org/apache/camel/component/bean/RegistryBean.java
    camel/trunk/components/camel-rmi/src/main/java/org/apache/camel/component/rmi/RmiRegistryBean.java

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/NoSuchBeanException.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/NoSuchBeanException.java?rev=749312&r1=749311&r2=749312&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/NoSuchBeanException.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/NoSuchBeanException.java Mon Mar
 2 14:12:02 2009
@@ -32,6 +32,11 @@
         this.name = name;
     }
 
+    public NoSuchBeanException(String name, Throwable cause) {
+        super("No bean could be found in the registry for: " + name + ". Cause: " + cause.getMessage(),
cause);
+        this.name = name;
+    }
+
     public String getName() {
         return name;
     }

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/component/bean/BeanHolder.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/component/bean/BeanHolder.java?rev=749312&r1=749311&r2=749312&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/component/bean/BeanHolder.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/component/bean/BeanHolder.java Mon
Mar  2 14:12:02 2009
@@ -16,6 +16,7 @@
  */
 package org.apache.camel.component.bean;
 
+import org.apache.camel.NoSuchBeanException;
 import org.apache.camel.Processor;
 
 /**
@@ -25,7 +26,7 @@
  */
 public interface BeanHolder {
 
-    Object getBean() throws NoBeanAvailableException;
+    Object getBean() throws NoSuchBeanException;
 
     Processor getProcessor();
 

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/component/bean/RegistryBean.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/component/bean/RegistryBean.java?rev=749312&r1=749311&r2=749312&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/component/bean/RegistryBean.java
(original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/component/bean/RegistryBean.java
Mon Mar  2 14:12:02 2009
@@ -19,6 +19,7 @@
 import org.apache.camel.CamelContext;
 import org.apache.camel.NoTypeConversionAvailableException;
 import org.apache.camel.Processor;
+import org.apache.camel.NoSuchBeanException;
 import org.apache.camel.spi.Registry;
 import org.apache.camel.util.CamelContextHelper;
 import org.apache.camel.util.ObjectHelper;
@@ -53,15 +54,14 @@
         return "bean: " + name;
     }
 
-
     public ConstantBeanHolder createCacheHolder() throws Exception {
         return new ConstantBeanHolder(getBean(), getBeanInfo());
     }
 
-    public Object getBean() throws NoBeanAvailableException {
+    public Object getBean() throws NoSuchBeanException {
         Object value = lookupBean();
         if (value == null) {
-            throw new NoBeanAvailableException(name);
+            throw new NoSuchBeanException(name);
         }
         if (value != bean) {
             bean = value;

Modified: camel/trunk/components/camel-rmi/src/main/java/org/apache/camel/component/rmi/RmiRegistryBean.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-rmi/src/main/java/org/apache/camel/component/rmi/RmiRegistryBean.java?rev=749312&r1=749311&r2=749312&view=diff
==============================================================================
--- camel/trunk/components/camel-rmi/src/main/java/org/apache/camel/component/rmi/RmiRegistryBean.java
(original)
+++ camel/trunk/components/camel-rmi/src/main/java/org/apache/camel/component/rmi/RmiRegistryBean.java
Mon Mar  2 14:12:02 2009
@@ -17,8 +17,13 @@
 package org.apache.camel.component.rmi;
 
 import java.rmi.registry.Registry;
+import java.rmi.NotBoundException;
+import java.rmi.AccessException;
+import java.rmi.RemoteException;
 
 import org.apache.camel.CamelContext;
+import org.apache.camel.NoSuchBeanException;
+import org.apache.camel.RuntimeCamelException;
 import org.apache.camel.component.bean.ParameterMappingStrategy;
 import org.apache.camel.component.bean.RegistryBean;
 
@@ -40,7 +45,15 @@
     }
 
     @Override
-    protected Object lookupBean() throws Exception {
-        return registry.lookup(getName());
+    protected Object lookupBean() throws NoSuchBeanException {
+        try {
+            return registry.lookup(getName());
+        } catch (NotBoundException e) {
+            throw new NoSuchBeanException(getName(), e);
+        } catch (AccessException e) {
+            throw new RuntimeCamelException(e);
+        } catch (RemoteException e) {
+            throw new RuntimeCamelException(e);
+        }
     }
 }



Mime
View raw message