Merge pull request #244 from dicej/url-set

avoid NPE in URL.set when file is null
This commit is contained in:
Joshua Warner 2014-04-24 18:45:01 -06:00
commit 3586481c8e
2 changed files with 4 additions and 1 deletions

View File

@ -103,7 +103,7 @@ public final class URL {
this.file = file;
this.ref = ref;
int q = file.lastIndexOf('?');
int q = file == null ? -1 : file.lastIndexOf('?');
if (q != -1) {
this.query = file.substring(q + 1);
this.path = file.substring(0, q);

View File

@ -298,6 +298,9 @@ public class Misc {
throw new RuntimeException(e);
}
expect(new URL("http://oss.readytalk.com")
.getHost().equals("oss.readytalk.com"));
expect(java.util.Arrays.equals
(new byte[] { 0, 0, 0, 0 },
java.net.InetAddress.getByName("0.0.0.0").getAddress()));