Author: markt
Date: Wed Aug 10 18:00:24 2011
New Revision: 1156280

URL: http://svn.apache.org/viewvc?rev=1156280&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/tc7.0.x/trunk/   (props changed)
    
tomcat/tc7.0.x/trunk/java/org/apache/naming/resources/DirContextURLConnection.java
    tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml

Propchange: tomcat/tc7.0.x/trunk/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Aug 10 18:00:24 2011
@@ -1 +1 @@
-/tomcat/trunk:1156171
+/tomcat/trunk:1156171,1156276

Modified: 
tomcat/tc7.0.x/trunk/java/org/apache/naming/resources/DirContextURLConnection.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/naming/resources/DirContextURLConnection.java?rev=1156280&r1=1156279&r2=1156280&view=diff
==============================================================================
--- 
tomcat/tc7.0.x/trunk/java/org/apache/naming/resources/DirContextURLConnection.java
 (original)
+++ 
tomcat/tc7.0.x/trunk/java/org/apache/naming/resources/DirContextURLConnection.java
 Wed Aug 10 18:00:24 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));

Modified: tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml
URL: 
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml?rev=1156280&r1=1156279&r2=1156280&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml Wed Aug 10 18:00:24 2011
@@ -60,6 +60,10 @@
         <bug>51640</bug>: Improve the memory leak prevention for leaks 
triggered
         by java.sql.DriverManager. (markt)
       </add>
+      <fix>
+        <bug>51644</bug>: Fix annotation scanning for contexts with a
+        multi-level context path such as /a/b. (markt)
+      </fix>
     </changelog>
   </subsection>
   <subsection name="Coyote">



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to