Author: markt Date: Wed Dec 30 09:24:17 2009 New Revision: 894572 URL: http://svn.apache.org/viewvc?rev=894572&view=rev Log: 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
Modified: tomcat/trunk/java/org/apache/naming/resources/DirContextURLConnection.java Modified: tomcat/trunk/java/org/apache/naming/resources/DirContextURLConnection.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/naming/resources/DirContextURLConnection.java?rev=894572&r1=894571&r2=894572&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/naming/resources/DirContextURLConnection.java (original) +++ tomcat/trunk/java/org/apache/naming/resources/DirContextURLConnection.java Wed Dec 30 09:24:17 2009 @@ -426,9 +426,17 @@ if (collection != null) { try { String file = getURL().getFile(); - // This will be of the form /<hostname>/<contextpath/file name + // This will be of the form /<hostname>/<contextpath>/file name + // if <contextpath> is not empty otherwise this will be of the + // form /<hostname>/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<NameClassPair> enumeration = context.list(file.substring(start)); --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org