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 - v2b


From: Mark Wielaard
Subject: Re: [cp-patches] RFC: prevent URL degeneration - v2b
Date: Mon, 10 Oct 2005 13:12:40 +0200

Hi Robert,

On Mon, 2005-10-10 at 02:55 +0200, Robert Schuster wrote:
> 2005-10-07  Robert Schuster  <address@hidden>
> 
>    * java/net/URLStreamHandler.java:
>      (toExternalForm): Remove superfluous leading slashes from URL
>      paths.

I think this is the wrong approach. You are trying to change the URL by
removing slashes, which might change the semantics. The real bug seems
to be that the leading // for the authority (host) part is not added
when there is no or an empty authority and URL.getFile() does return the
separator '/' between URL-authority and URL-path if constructed through
new URL(String), but not when constructed by giving the separate
components to the constructor. But if getFile() returns a file part that
starts with a slash then whether the leading // for the authority part
are given or not is significant.

So maybe the solution is to change the test for when to include the
authority part (plus "//") to:

    if (authority.length() != 0 || file.startsWith("/"))
      {
        sb.append("//").append(authority);
      }

Not tested.

Cheers,

Mark

Attachment: signature.asc
Description: This is a digitally signed message part


reply via email to

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