tomee-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From andygumbre...@apache.org
Subject [58/77] [abbrv] tomee git commit: using web jndi entries if global lookup fails in embedded mode
Date Tue, 01 Dec 2015 22:04:10 GMT
using web jndi entries if global lookup fails in embedded mode


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

Branch: refs/heads/tomee-7.0.0-M1
Commit: ede8b7471c1c667b013a812e6ab740b92563d496
Parents: 5f0adff
Author: Romain Manni-Bucau <rmannibu@gmail.com>
Authored: Tue Nov 24 23:26:44 2015 +0100
Committer: Romain Manni-Bucau <rmannibu@gmail.com>
Committed: Tue Nov 24 23:26:44 2015 +0100

----------------------------------------------------------------------
 .../org/apache/openejb/web/WebInitialContext.java   | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tomee/blob/ede8b747/container/openejb-core/src/main/java/org/apache/openejb/web/WebInitialContext.java
----------------------------------------------------------------------
diff --git a/container/openejb-core/src/main/java/org/apache/openejb/web/WebInitialContext.java
b/container/openejb-core/src/main/java/org/apache/openejb/web/WebInitialContext.java
index f2dff36..4041e2e 100644
--- a/container/openejb-core/src/main/java/org/apache/openejb/web/WebInitialContext.java
+++ b/container/openejb-core/src/main/java/org/apache/openejb/web/WebInitialContext.java
@@ -21,7 +21,9 @@ import org.apache.openejb.core.ivm.naming.Reference;
 
 import javax.naming.Context;
 import javax.naming.LinkRef;
+import javax.naming.NameNotFoundException;
 import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
 import java.lang.reflect.Proxy;
 import java.util.Map;
@@ -47,9 +49,21 @@ public class WebInitialContext implements InvocationHandler {
                 } else if (lookedUp instanceof LinkRef) {
                     return ((Context) proxy).lookup(((LinkRef) lookedUp).getLinkName());
                 }
+                try {
+                    return method.invoke(delegate, args);
+                } catch (final InvocationTargetException nnfe) {
+                    if (NameNotFoundException.class.isInstance(nnfe.getTargetException()))
{
+                        return lookedUp;
+                    }
+                    throw nnfe.getTargetException();
+                }
             }
         }
-        return method.invoke(delegate, args);
+        try {
+            return method.invoke(delegate, args);
+        } catch (final InvocationTargetException nnfe) {
+            throw nnfe.getTargetException();
+        }
     }
 
     private static String normalize(final String arg) {


Mime
View raw message