From 40860710dd1f703a6553793690ffe56c040e55a4 Mon Sep 17 00:00:00 2001 From: mkoch Date: Sat, 20 Dec 2003 12:28:25 +0000 Subject: 2003-12-20 Guilhem Lavaux * gnu/java/net/URLParseError.java: New file. * gnu/java/net/protocol/jar/Handler.java (parseURL): Throw URLParseError if needed, fix '/' handling. * java/net/URL.java (URL): Catch URLParseError and transform it into a MalformedURLException. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@74877 138bc75d-0d04-0410-961f-82ee72b054a4 --- libjava/java/net/URL.java | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'libjava/java/net') diff --git a/libjava/java/net/URL.java b/libjava/java/net/URL.java index 35b3c797c7f..79771d916de 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); -- cgit v1.2.3