aboutsummaryrefslogtreecommitdiff
path: root/libjava/java/net/URL.java
diff options
context:
space:
mode:
Diffstat (limited to 'libjava/java/net/URL.java')
-rw-r--r--libjava/java/net/URL.java14
1 files changed, 12 insertions, 2 deletions
diff --git a/libjava/java/net/URL.java b/libjava/java/net/URL.java
index 35b3c79..79771d9 100644
--- a/libjava/java/net/URL.java
+++ b/libjava/java/net/URL.java
@@ -38,6 +38,7 @@ exception statement from your version. */
package java.net;
+import gnu.java.net.URLParseError;
import java.io.InputStream;
import java.io.IOException;
import java.io.Serializable;
@@ -432,8 +433,17 @@ public final class URL implements Serializable
// is to be excluded by passing the 'limit' as the indexOf the '#'
// if one exists, otherwise pass the end of the string.
int hashAt = spec.indexOf('#', colon + 1);
- this.ph.parseURL(this, spec, colon + 1,
- hashAt < 0 ? spec.length() : hashAt);
+
+ try
+ {
+ this.ph.parseURL(this, spec, colon + 1,
+ hashAt < 0 ? spec.length() : hashAt);
+ }
+ catch (URLParseError e)
+ {
+ throw new MalformedURLException(e.getMessage());
+ }
+
if (hashAt >= 0)
ref = spec.substring(hashAt + 1);