Need to strip /hostname/contextpath before trying to list resources
authormarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Fri, 4 Dec 2009 13:50:36 +0000 (13:50 +0000)
committermarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Fri, 4 Dec 2009 13:50:36 +0000 (13:50 +0000)
git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@887195 13f79535-47bb-0310-9956-ffa450edef68

java/org/apache/naming/resources/DirContextURLConnection.java

index cc92b29..fdea589 100644 (file)
@@ -421,8 +421,13 @@ public class DirContextURLConnection
         
         if (collection != null) {
             try {
+                String file = getURL().getFile();
+                // This will be of the form /<hostname>/<contextpath/file name
+                // Strip off the hostname and the contextpath
+                int start = file.indexOf('/', file.indexOf('/', 1) + 1);
+                
                 NamingEnumeration<NameClassPair> enumeration =
-                    context.list(getURL().getFile());
+                    context.list(file.substring(start));
                 while (enumeration.hasMoreElements()) {
                     NameClassPair ncp = enumeration.nextElement();
                     result.addElement(ncp.getName());