On Mon, 2004-06-14 at 17:58, Guilhem Lavaux wrote: > Roman Kennke wrote: > > Original Submission: I found, that java.net.URLStreamHandler does not > > correctly > > parse filenames such as "mapping.xml" as URLs. Some applications do such > > things, > > like Castor (here I found the error). The problem is, that > > URLStreamHandler.parseURL > > looks for "/" and does not check, if a "/" is found. In the case that > > there is no > > "/" invalid values are passed to java.lang.String.substring. > > > > The patch should solve this problem. At least it does for me :-) > > > > http://savannah.gnu.org/bugs/download.php?item_id=9331&item_file_id=1403 > > > > any comments on this? > > > > It seems good to me.
Agreed. I reformatted the patch a bit (see the source code style guide http://www.gnu.org/software/classpath/docs/hacking.html#SEC7) and committed it with the following ChangeLog entry: 2004-07-01 Mark Wielaard <[EMAIL PROTECTED]> Reported by Roman Kennke <[EMAIL PROTECTED]> (bug #9331) * java/net/URLStreamHandler.java (parseURL): When url file part doesn't contain a '/' just ignore context. Thanks, Mark
Index: java/net/URLStreamHandler.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/net/URLStreamHandler.java,v
retrieving revision 1.28
diff -u -r1.28 URLStreamHandler.java
--- java/net/URLStreamHandler.java 23 Apr 2004 21:13:20 -0000 1.28
+++ java/net/URLStreamHandler.java 1 Jul 2004 23:33:17 -0000
@@ -1,5 +1,5 @@
/* URLStreamHandler.java -- Abstract superclass for all protocol handlers
- Copyright (C) 1998, 1999, 2002, 2003 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2002, 2003, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -204,9 +204,11 @@
{
// Context is available, but only override it if there is a new file.
int lastSlash = file.lastIndexOf('/');
-
- file =
- file.substring(0, lastSlash) + '/' + spec.substring(start, end);
+ if (lastSlash < 0)
+ file = spec.substring(start, end);
+ else
+ file = (file.substring(0, lastSlash)
+ + '/' + spec.substring(start, end));
if (url.getProtocol().equals("file"))
{
signature.asc
Description: This is a digitally signed message part
_______________________________________________ Classpath mailing list [EMAIL PROTECTED] http://lists.gnu.org/mailman/listinfo/classpath

