new URI("http://example.com/foo#bar").resolve("")

Jack Bates jack.bates at gmail.com
Sat Jan 23 10:14:59 PST 2010


new URI("http://example.com/foo#bar").resolve("")

^ I expect this to return "http://example.com/foo", but when I run,

import java.net.URI;

public class Test
{
  public static void main(String[] args) throws Exception
  {
    System.out.println(new URI("http://example.com/foo#bar").resolve(""));
  }
}

- it outputs,

$ java Test
http://example.com/
$ 

Do you think this is a bug?

I'm running OpenJDK 6, but I can find only cosmetic differences between
URI.java in the version I'm running and URI.java in,
http://www.java.net/download/openjdk/jdk7/promoted/b80/openjdk-7-ea-src-b80-21_jan_2010.zip

- so I assume the issue (if it is an issue) still exists?



More information about the net-dev mailing list