You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2009/12/30 10:24:18 UTC

svn commit: r894572 - /tomcat/trunk/java/org/apache/naming/resources/DirContextURLConnection.java

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-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org