You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by jg...@apache.org on 2017/09/13 12:26:48 UTC

tomee git commit: TOMEE-2124 potential fix for test breakages

Repository: tomee
Updated Branches:
  refs/heads/tomee-1.7.x e156cf389 -> 248ef7fd7


TOMEE-2124 potential fix for test breakages


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

Branch: refs/heads/tomee-1.7.x
Commit: 248ef7fd73e52a3253a9288daada960c52a23996
Parents: e156cf3
Author: Jonathan Gallimore <jo...@jrg.me.uk>
Authored: Tue Sep 12 20:52:45 2017 +0100
Committer: Jonathan Gallimore <jo...@jrg.me.uk>
Committed: Tue Sep 12 20:52:45 2017 +0100

----------------------------------------------------------------------
 .../tomee/catalina/OpenEJBContextConfig.java    | 23 ++++++++++++++------
 1 file changed, 16 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tomee/blob/248ef7fd/tomee/tomee-catalina/src/main/java/org/apache/tomee/catalina/OpenEJBContextConfig.java
----------------------------------------------------------------------
diff --git a/tomee/tomee-catalina/src/main/java/org/apache/tomee/catalina/OpenEJBContextConfig.java b/tomee/tomee-catalina/src/main/java/org/apache/tomee/catalina/OpenEJBContextConfig.java
index df375a1..75e49c9 100644
--- a/tomee/tomee-catalina/src/main/java/org/apache/tomee/catalina/OpenEJBContextConfig.java
+++ b/tomee/tomee-catalina/src/main/java/org/apache/tomee/catalina/OpenEJBContextConfig.java
@@ -554,14 +554,9 @@ public class OpenEJBContextConfig extends ContextConfig {
                         final ProxyDirContext dirContext = ProxyDirContext.class.cast(Reflections.get(handler, "context"));
                         final String host = String.class.cast(Reflections.get(dirContext, "hostName"));
                         final String contextPath = String.class.cast(Reflections.get(dirContext, "contextPath"));
-                        final Object context = Reflections.get(dirContext, "dirContext");
-
-                        if (BaseDirContext.class.isInstance(context)) {
-                            file = file.replace("/" + host + contextPath, BaseDirContext.class.cast(context).getDocBase());
-                        } else {
-                            throw new OpenEJBRuntimeException("Context not supported: " + context);
-                        }
+                        final BaseDirContext context = getBaseDirContext(dirContext);
 
+                        file = file.replace("/" + host + contextPath, BaseDirContext.class.cast(context).getDocBase());
                         currentUrlAsFile = new File(file);
                     } else {
                         throw new OpenEJBRuntimeException("can't find webapp [" + webAppInfo.contextRoot + "], connection is not a DirContextURLConnection " + connection);
@@ -577,6 +572,20 @@ public class OpenEJBContextConfig extends ContextConfig {
         internalProcessAnnotations(currentUrlAsFile, webAppInfo, fragment);
     }
 
+    private BaseDirContext getBaseDirContext(final ProxyDirContext dirContext) {
+        final Object context = Reflections.get(dirContext, "dirContext");
+
+        if (BaseDirContext.class.isInstance(context)) {
+            return BaseDirContext.class.cast(context);
+        }
+
+        if (ProxyDirContext.class.isInstance(context)) {
+            return getBaseDirContext(ProxyDirContext.class.cast(context));
+        }
+
+        throw new OpenEJBRuntimeException("Context not supported: " + context.toString());
+    }
+
     private void internalProcessAnnotations(final File currentUrlAsFile, final WebAppInfo webAppInfo, final WebXml fragment) {
         for (final ClassListInfo webAnnotated : webAppInfo.webAnnotatedClasses) {
             try {