David Daney wrote:
With this test case (just added to mauve):import java.net.URL; public class URLTest { public static void main(String []args) { try { URL url = new URL("http://www.foo.bar.com"); url = new URL(url, "_urn:testing/"); System.out.println("url: " + url); } catch (Exception e) { e.printStackTrace(); } } }Classpath is currently treating the "_urn:" as a protocol and discarding the context even though "_urn:" is not a valid protocol. Sun's runtime will append the spec to the context in this case instead of replacing the context.
There is no way to determine whether a URL scheme is "valid" or not, assuming that is even meaningful.
If we append the spec to the context in this case we should also do so in the case of
url = new URL("http://www.foo.bar.com");
url = new URL(url, "http://www.foo.bar.com");
this should produce "http://www.foo.bar.com/http://www.foo.bar.com".
--
犬 Chris Burdess
"They that can give up essential liberty to obtain a little safety
deserve neither liberty nor safety." - Benjamin Franklin
PGP.sig
Description: This is a digitally signed message part
