Regression in GCJ 3.3 in parsing property files

Ranjit Mathew rmathew@hotmail.com
Thu Feb 20 09:59:00 GMT 2003


> > Or, I could be mistaken about all this and we would have to fix the
> > URL parsing code.  Can you find out?
>
>The following patch to the parseURL( ) method fixes the problem for me:

Is this patch acceptable? If yes, here it is in a more
palatable format:

Index: ChangeLog
from  Ranjit Mathew  <rmathew@hotmail.com>

	* java/net/URLStreamHandler.java (parseURL): Use
	File.separatorChar, if needed, in addition to '/' to
	parse the path component of a URL.

Index: java/net/URLStreamHandler.java
===================================================================
--- java/net/URLStreamHandler.java	2003-02-19 00:33:08.000000000 +0530
+++ java/net/URLStreamHandler.java	2003-02-19 00:51:32.000000000 +0530
@@ -40,4 +40,5 @@

import java.io.IOException;
+import java.io.File;

/*
@@ -177,6 +178,14 @@
       {
	// Context is available, but only override it if there is a new file.
-	file = file.substring(0, file.lastIndexOf('/'))
-		+ '/' + spec.substring(start, end);
+        char sepChar = '/';
+        int lastSlash = file.lastIndexOf (sepChar);
+        if ((lastSlash < 0) && (File.separatorChar != sepChar))
+          {
+            sepChar = File.separatorChar;
+            lastSlash = file.lastIndexOf (sepChar);
+          }
+
+	file = file.substring(0, lastSlash)
+		+ sepChar + spec.substring(start, end);
	ref = null;
       }


_________________________________________________________________
MSN 8 helps eliminate e-mail viruses. Get 2 months FREE*. 
http://join.msn.com/?page=features/virus



More information about the Java-patches mailing list