classpath-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [cp-patches] RFC: prevent URL degeneration


From: Chris Burdess
Subject: Re: [cp-patches] RFC: prevent URL degeneration
Date: Mon, 10 Oct 2005 08:53:28 +0100

Robert Schuster wrote:
as chris supposed I tried to find another (and better) way of fixing the URL
class' toString problem which affects our XML parser.

To make a long story short. Consider the following code fragment:

u = new URL("file:////home/baz");

u2 = new URL(u.toString());

print(u2.toString());

print(u2.getHome());

On the JDK this will print

file://home/baz
home

(This happens on the JDK as well as with Classpath.)

Which is obviously not what file:////home/baz meant. The problem exists because URL.toString() does not care about superfluous leading slashes. With the attached patch Classpath will not have this problem anymore because superfluous
leading slashes are carefully removed. The output will be:

file:/home/baz
<empty string>

Robert, this is still wrong. The output should be

file:///home/baz
<empty string>
--
Chris Burdess





reply via email to

[Prev in Thread] Current Thread [Next in Thread]