You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by rm...@apache.org on 2012/03/28 14:13:12 UTC

svn commit: r1306284 - /openejb/trunk/openejb/server/openejb-cxf-rs/src/main/java/org/apache/openejb/server/cxf/rs/OpenEJBPerRequestPojoResourceProvider.java

Author: rmannibucau
Date: Wed Mar 28 12:13:12 2012
New Revision: 1306284

URL: http://svn.apache.org/viewvc?rev=1306284&view=rev
Log:
the context used in OpenEJBPerRequestResourceProvider can be the app context so if lookups in this context fails we can try using the current context (new InitialContext))

Modified:
    openejb/trunk/openejb/server/openejb-cxf-rs/src/main/java/org/apache/openejb/server/cxf/rs/OpenEJBPerRequestPojoResourceProvider.java

Modified: openejb/trunk/openejb/server/openejb-cxf-rs/src/main/java/org/apache/openejb/server/cxf/rs/OpenEJBPerRequestPojoResourceProvider.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/server/openejb-cxf-rs/src/main/java/org/apache/openejb/server/cxf/rs/OpenEJBPerRequestPojoResourceProvider.java?rev=1306284&r1=1306283&r2=1306284&view=diff
==============================================================================
--- openejb/trunk/openejb/server/openejb-cxf-rs/src/main/java/org/apache/openejb/server/cxf/rs/OpenEJBPerRequestPojoResourceProvider.java (original)
+++ openejb/trunk/openejb/server/openejb-cxf-rs/src/main/java/org/apache/openejb/server/cxf/rs/OpenEJBPerRequestPojoResourceProvider.java Wed Mar 28 12:13:12 2012
@@ -75,7 +75,7 @@ public class OpenEJBPerRequestPojoResour
                 if (args[0].getClass().equals(String.class)) {
                     // Note: we catch exception instead of namingexception
                     // because in environment with proxies on Context
-                    // InvocationtargetException can be throuwn instead of NamingException
+                    // InvocationtargetException can be thrown instead of NamingException
                     if (ctx != null) {
                         try {
                             return ctx.lookup(name);
@@ -86,16 +86,15 @@ public class OpenEJBPerRequestPojoResour
                                 // no-op
                             }
                         }
-                    } else {
-                        final Context initialContext = new InitialContext();
+                    }
+                    final Context initialContext = new InitialContext();
+                    try {
+                        return initialContext.lookup(name);
+                    } catch (Exception swallowed) {
                         try {
-                            return initialContext.lookup(name);
-                        } catch (Exception swallowed) {
-                            try {
-                                return initialContext.lookup(String.class.cast(args[0]));
-                            } catch (Exception ignored) {
-                                // no-op
-                            }
+                            return initialContext.lookup(String.class.cast(args[0]));
+                        } catch (Exception ignored) {
+                            // no-op
                         }
                     }
                 }