From b8e98c3f66b42cf2b154ae283335b92e022e58af Mon Sep 17 00:00:00 2001 From: markt Date: Wed, 10 Aug 2011 17:57:25 +0000 Subject: [PATCH] Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=51644 Annotation scanning was broken for contexts with a multi-level context path such as /a/b git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@1156276 13f79535-47bb-0310-9956-ffa450edef68 --- .../naming/resources/DirContextURLConnection.java | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/java/org/apache/naming/resources/DirContextURLConnection.java b/java/org/apache/naming/resources/DirContextURLConnection.java index 80d834330..3bbff1c45 100644 --- a/java/org/apache/naming/resources/DirContextURLConnection.java +++ b/java/org/apache/naming/resources/DirContextURLConnection.java @@ -436,14 +436,20 @@ public class DirContextURLConnection // This will be of the form ///file name // if is not empty otherwise this will be of the // form //file name - // Strip off the hostname and the contextpath + // Strip off the hostname and the contextpath (note that context + // path may contain '/' int start; - if(context instanceof ProxyDirContext && - "".equals(((ProxyDirContext)context).getContextPath())){ - start = file.indexOf('/',1); - } - else + if (context instanceof ProxyDirContext) { + String cp = ((ProxyDirContext)context).getContextPath(); + String h = ((ProxyDirContext)context).getHostName(); + if ("".equals(cp)) { + start = h.length() + 2; + } else { + start = h.length() + cp.length() + 2; + } + } else { start = file.indexOf('/', file.indexOf('/', 1) + 1); + } NamingEnumeration enumeration = context.list(file.substring(start)); -- 2.11.0