diff --git a/classpath/java/net/URL.java b/classpath/java/net/URL.java index dd42d75f1b..0e1e731b3a 100644 --- a/classpath/java/net/URL.java +++ b/classpath/java/net/URL.java @@ -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); diff --git a/test/Misc.java b/test/Misc.java index a4361a3bfd..e339b5bf9e 100644 --- a/test/Misc.java +++ b/test/Misc.java @@ -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()));