geronimo-xbean-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rickmcgu...@apache.org
Subject svn commit: r1026122 - /geronimo/xbean/trunk/xbean-naming/src/main/java/org/apache/xbean/naming/context/ContextFederation.java
Date Thu, 21 Oct 2010 19:59:22 GMT
Author: rickmcguire
Date: Thu Oct 21 19:59:22 2010
New Revision: 1026122

URL: http://svn.apache.org/viewvc?rev=1026122&view=rev
Log:
Ensure RuntimeExceptions from Bindings get propagated as NamingExceptions

Modified:
    geronimo/xbean/trunk/xbean-naming/src/main/java/org/apache/xbean/naming/context/ContextFederation.java

Modified: geronimo/xbean/trunk/xbean-naming/src/main/java/org/apache/xbean/naming/context/ContextFederation.java
URL: http://svn.apache.org/viewvc/geronimo/xbean/trunk/xbean-naming/src/main/java/org/apache/xbean/naming/context/ContextFederation.java?rev=1026122&r1=1026121&r2=1026122&view=diff
==============================================================================
--- geronimo/xbean/trunk/xbean-naming/src/main/java/org/apache/xbean/naming/context/ContextFederation.java
(original)
+++ geronimo/xbean/trunk/xbean-naming/src/main/java/org/apache/xbean/naming/context/ContextFederation.java
Thu Oct 21 19:59:22 2010
@@ -115,7 +115,17 @@ public class ContextFederation {
 
                     // don't overwrite existing bindings
                     if (!bindings.containsKey(bindingName)) {
-                        bindings.put(bindingName, binding.getObject());
+                        try {
+                            bindings.put(bindingName, binding.getObject());
+                        } catch (RuntimeException e) {
+                            // if this is a wrapped NamingException, unwrap and throw the
original 
+                            Throwable cause = e.getCause(); 
+                            if (cause != null && cause instanceof NamingException
) {
+                                throw (NamingException)cause; 
+                            }
+                            // Wrap this into a RuntimeException.  
+                            throw (NamingException)new NamingException("Could retrieve bound
instance " + name).initCause(e);
+                        }
                     }
                 }
             } catch (NotContextException e) {



Mime
View raw message