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
This commit is contained in:
parent
1713a69f0a
commit
32ab41edd2
4 changed files with 99 additions and 8 deletions
|
@ -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);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue