diff options
author | Guilhem Lavaux <guilhem@kaffe.org> | 2003-12-20 12:28:25 +0000 |
---|---|---|
committer | Michael Koch <mkoch@gcc.gnu.org> | 2003-12-20 12:28:25 +0000 |
commit | 32ab41edd231c7d3872369c4ec6efa0feda6e77a (patch) | |
tree | 022c21e00d55eed907ff37587379b378acb0e2f4 /libjava/java/net | |
parent | 1713a69f0a1af440caa41ab9e60490ecd7247922 (diff) | |
download | gcc-32ab41edd231c7d3872369c4ec6efa0feda6e77a.zip gcc-32ab41edd231c7d3872369c4ec6efa0feda6e77a.tar.gz gcc-32ab41edd231c7d3872369c4ec6efa0feda6e77a.tar.bz2 |
URLParseError.java: New file.
2003-12-20 Guilhem Lavaux <guilhem@kaffe.org>
* 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.
From-SVN: r74877
Diffstat (limited to 'libjava/java/net')
-rw-r--r-- | libjava/java/net/URL.java | 14 |
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); |