Skip to content

Commit

Permalink
include leading slash in path when parsing URLs in URLStreamHandler
Browse files Browse the repository at this point in the history
This matches the behavior of OpenJDK's version.
  • Loading branch information
dicej committed Feb 18, 2012
1 parent 999e90c commit 750e5f9
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
2 changes: 1 addition & 1 deletion classpath/java/net/URLStreamHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ protected void parseURL(URL url, String s, int start, int end)
host = s.substring(0, colon);
port = Integer.parseInt(s.substring(colon + 1), slash);
}
s = s.substring(slash + 1);
s = s.substring(slash);
}
}

Expand Down
3 changes: 1 addition & 2 deletions test/UrlTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

public class UrlTest {
private static String query="var1=val1&var2=val2";
private static String path="testpath";
private static String path="/testpath";
private static String domain="file://www.readytalk.com";
private static String file=path + "?" + query;
private static URL url;
Expand All @@ -15,7 +15,6 @@ private static void expect(boolean v) {
private static void setupURL() throws MalformedURLException {
StringBuilder builder = new StringBuilder();
builder.append(domain);
builder.append("/");
builder.append(file);
url = new URL(builder.toString());
}
Expand Down

0 comments on commit 750e5f9

Please sign in to comment.