From e15661a3a24779c7c30b879eaea175f3248daff4 Mon Sep 17 00:00:00 2001 From: markt Date: Wed, 30 Dec 2009 09:24:17 +0000 Subject: [PATCH] Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=48443 Correct FileNotFoundException on ROOT context start when annotation scanning is enabled Patch provided by wujunchen git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@894572 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/naming/resources/DirContextURLConnection.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/java/org/apache/naming/resources/DirContextURLConnection.java b/java/org/apache/naming/resources/DirContextURLConnection.java index c76978e60..33d3774b1 100644 --- a/java/org/apache/naming/resources/DirContextURLConnection.java +++ b/java/org/apache/naming/resources/DirContextURLConnection.java @@ -426,9 +426,17 @@ public class DirContextURLConnection if (collection != null) { try { String file = getURL().getFile(); - // 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 - int start = file.indexOf('/', file.indexOf('/', 1) + 1); + int start; + if(context instanceof ProxyDirContext && + "".equals(((ProxyDirContext)context).getContextName())){ + start = file.indexOf('/',1); + } + else + start = file.indexOf('/', file.indexOf('/', 1) + 1); NamingEnumeration enumeration = context.list(file.substring(start)); -- 2.11.0