diff options
author | mkoch <mkoch@138bc75d-0d04-0410-961f-82ee72b054a4> | 2003-12-20 12:28:25 +0000 |
---|---|---|
committer | mkoch <mkoch@138bc75d-0d04-0410-961f-82ee72b054a4> | 2003-12-20 12:28:25 +0000 |
commit | 40860710dd1f703a6553793690ffe56c040e55a4 (patch) | |
tree | 022c21e00d55eed907ff37587379b378acb0e2f4 /libjava/java/net | |
parent | 0a2326d6d6ed56c12e2cf1f458a40d8d43e0c9db (diff) | |
download | ppe42-gcc-40860710dd1f703a6553793690ffe56c040e55a4.tar.gz ppe42-gcc-40860710dd1f703a6553793690ffe56c040e55a4.zip |
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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@74877 138bc75d-0d04-0410-961f-82ee72b054a4
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 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); |