Re: URL context constructor broken?
On Thu, 30 Dec 2010 20:53:12 +0530, Abu Yahya <abu_yahya@invalid.com>
wrote, quoted or indirectly quoted someone who said :
Which version of the JDK are you using? (I tried this with Sun's 1.5,
and IBM's 1.6)
You can see this with
try
{
URL originalURL = new URL( "xxxx" );
String newLocation = "yyyy";
String merged = new URL( originalURL, newLocation ).toString();
out.println( originalURL + " " + newLocation + " " + merged );
}
catch ( MalformedURLException e )
I am using 1.6.0_23 from Oracle.
It does lots of them correctly. If you are interested I could collect
a set of real world examples it does properly. I suspect one pattern
it does not handle correctly is:
http://domain.com/ + /xxxx
It may also get inhibited if there is a ?xxx on either piece.
I read the RFC, looked the code, and studied the JavaDoc. Since there
are no examples, the matter of what SHOULD it do, still seems
ambiguous.
For now, The best approach is to write a replacement that is quite
forgiving. Sometimes the goofs even forget the lead / on the
newlocation string. It makes no sense unless you presume one. Browsers
seem to sort this out.
Then I need to write a SSCCE that demonstrates each of the
non-functioning patterns in simplest form. I will leave it up to
Oracle to decide if they intended it to be broken for the purpose I am
trying to use it. It is the sort of bug that fixing might break
existing code.
--
Roedy Green Canadian Mind Products
http://mindprod.com
A short order cook is a master of multitasking. Every movement is
optimised from years of practice. Yet when a computer executes a
multitasking program, it approaches the task as if for the first time.