Hi People, I originally posted the following patch (repeated in this email):
http://gcc.gnu.org/ml/java-patches/2004-q2/msg00843.html ...to java-patches, but Tom Tromey told me that this list was more appropriate. The class in question is against the libgcj version of URLStreamHandler - I haven't DIFFed the class against the Classpath sources to see if the two are in sync. Be sure to CC me directly because I'm not subscribed to this list. Thanks for looking at this. ------------------------------------------------------ The change to URLStreamHandler.parseURL of this patch: 2004-04-22 Jeroen Frijters <[EMAIL PROTECTED]> * java/net/URLStreamHandler.java (parseURL): Convert the file path to using '/' instead of native file separator. ...causes a StringIndexOutOfBoundsException for the attached testcase on MinGW on the mainline because of this block of code: int lastSlash = file.lastIndexOf('/'); file = file.substring(0, lastSlash) + '/' + spec.substring(start, end); ...because file = ".\" on Win32. The solution seems to be to canonicalize both the file portion of the URL and not just the spec if the file: protocol is used. Tested with the attached testcase on i686-pc-mingw32 and i686-pc-linux-gnu. Additionally tested against the libjava testsuite and Mauve for i686-pc-linux-gnu. (Is this the right list or do I need to send these sort of things to the Classpath folks too?) -- Mohan http://www.thisiscool.com/ http://www.animalsong.org/ ChangeLog 2004-06-26 Mohan Embar <[EMAIL PROTECTED]> * java/net/URLStreamHandler.java (parseURL): Canonicalize file portion of URL in addition to spec for file: protocol. Index: java/net/URLStreamHandler.java =================================================================== RCS file: /cvs/gcc/gcc/libjava/java/net/URLStreamHandler.java,v retrieving revision 1.29 diff -u -2 -r1.29 URLStreamHandler.java --- java/net/URLStreamHandler.java 5 May 2004 08:51:04 -0000 1.29 +++ java/net/URLStreamHandler.java 27 Jun 2004 19:17:14 -0000 @@ -132,6 +132,10 @@ // On Windows we need to change \ to / for file URLs - if (url.getProtocol().equals("file")) - spec = spec.replace(File.separatorChar, '/'); + char separator = File.separatorChar; + if (url.getProtocol().equals("file") && separator != '/') + { + file = file.replace(separator, '/'); + spec = spec.replace(separator, '/'); + } if (spec.regionMatches(start, "//", 0, 2)) @@ -217,5 +221,5 @@ boolean endsWithSlash = file.charAt(file.length() - 1) == '/'; file = new File(file).getCanonicalPath(); - file = file.replace(File.separatorChar, '/'); + file = file.replace(separator, '/'); if (endsWithSlash && file.charAt(file.length() - 1) != '/') file += '/';
ResourceAsStream.tar.bz2
Description: application/bzip2
_______________________________________________ Classpath mailing list [EMAIL PROTECTED] http://lists.gnu.org/mailman/listinfo/classpath

