Hi, small patch for the following bug: URL context= new URL("http://localhost/cocoon/"); URL relative= new URL(context, "index.xml"); relative is set to "http://localhost/index.xml" and NOT "http://localhost/cocoon/index.xml" as returned by java.net.URL. the patch in attachment consist of a small correction to URL.java and 2 more tests in URLTestCase. Thanks for your work, Bernard D'Havé
Index: catalina/src/share/org/apache/catalina/util/URL.java =================================================================== RCS file: /home/cvspublic/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/util/URL.java,v retrieving revision 1.1 diff -u -r1.1 URL.java --- catalina/src/share/org/apache/catalina/util/URL.java 2001/08/24 23:06:08 1.1 +++ catalina/src/share/org/apache/catalina/util/URL.java 2001/09/05 15:09:45 @@ -736,8 +736,8 @@ throw new MalformedURLException ("Base path does not start with '/'"); if (!path.endsWith("/")) - path += '/'; - path += "../" + spec.substring(start, limit); + path += "/../"; + path += spec.substring(start, limit); if (query != null) file = path + "?" + query; else Index: catalina/src/test/org/apache/catalina/util/URLTestCase.java =================================================================== RCS file: /home/cvspublic/jakarta-tomcat-4.0/catalina/src/test/org/apache/catalina/util/URLTestCase.java,v retrieving revision 1.1 diff -u -r1.1 URLTestCase.java --- catalina/src/test/org/apache/catalina/util/URLTestCase.java 2001/08/24 23:06:08 1.1 +++ catalina/src/test/org/apache/catalina/util/URLTestCase.java 2001/09/05 15:09:47 @@ -457,6 +457,8 @@ positive("http://a/b/c/d;p?q", "g?y/../x"); positive("http://a/b/c/d;p?q", "g#s/./x"); positive("http://a/b/c/d;p?q", "g#s/../x"); + positive("http://a/b", "c"); + positive("http://a/b/", "c"); }