tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r1156276 - /tomcat/trunk/java/org/apache/naming/resources/DirContextURLConnection.java
Date Wed, 10 Aug 2011 17:57:26 GMT
Author: markt
Date: Wed Aug 10 17:57:25 2011
New Revision: 1156276

URL: http://svn.apache.org/viewvc?rev=1156276&view=rev
Log:
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

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=1156276&r1=1156275&r2=1156276&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/naming/resources/DirContextURLConnection.java (original)
+++ tomcat/trunk/java/org/apache/naming/resources/DirContextURLConnection.java Wed Aug 10
17:57:25 2011
@@ -436,14 +436,20 @@ public class DirContextURLConnection 
                 // 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
+                // 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<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


Mime
View raw message