URLStreamHandler.toExternalForm() patch

Mark Wielaard mark@klomp.org
Tue Dec 24 11:00:00 GMT 2002


Hi,

The following patch makes sure that the port is ignored if it is zero or
smaller. Eclipse creates file URLs with an null host and zero as port
number, converts them to external form and then gets confused about the
":0" in the resulting String.
According to the comment in URLStreamHandler some implementations ignore
the port number completely if host is null or the empty String. We could
do the same, but that would not be according to spec.

2002-12-24  Mark Wielaard  <mark@klomp.org>

	* java/net/URLStreamHandler.java (toExternalForm): Ignore port
	if zero or smaller.

OK to commit to branch and mainline?

Note to Jeroen: I will commit the same patch to Classpath but that might
not help you since Classpath has a gnu.java.net.protocol.file.Handler
class that overrides toExternalForm(). Maybe just commenting out that
method will help in your case. Please let me know.

Cheers,

Mark
-------------- next part --------------
A non-text attachment was scrubbed...
Name: URLStreamHandler.patch
Type: text/x-patch
Size: 802 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/java-patches/attachments/20021224/079c2e93/attachment.bin>


More information about the Java-patches mailing list