Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 271F4200CF3 for ; Wed, 13 Sep 2017 14:26:51 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 25D091609CA; Wed, 13 Sep 2017 12:26:51 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 6ABE01609C9 for ; Wed, 13 Sep 2017 14:26:50 +0200 (CEST) Received: (qmail 92203 invoked by uid 500); 13 Sep 2017 12:26:48 -0000 Mailing-List: contact commits-help@tomee.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@tomee.apache.org Delivered-To: mailing list commits@tomee.apache.org Received: (qmail 92194 invoked by uid 99); 13 Sep 2017 12:26:48 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 13 Sep 2017 12:26:48 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 1BEA0F55C8; Wed, 13 Sep 2017 12:26:48 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: jgallimore@apache.org To: commits@tomee.apache.org Message-Id: X-Mailer: ASF-Git Admin Mailer Subject: tomee git commit: TOMEE-2124 potential fix for test breakages Date: Wed, 13 Sep 2017 12:26:48 +0000 (UTC) archived-at: Wed, 13 Sep 2017 12:26:51 -0000 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 Authored: Tue Sep 12 20:52:45 2017 +0100 Committer: Jonathan Gallimore 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 {