diff options
| author | bothner <bothner@138bc75d-0d04-0410-961f-82ee72b054a4> | 2002-02-23 00:15:49 +0000 |
|---|---|---|
| committer | bothner <bothner@138bc75d-0d04-0410-961f-82ee72b054a4> | 2002-02-23 00:15:49 +0000 |
| commit | 0adf119d837133d429298738c4f748391a0fd4f7 (patch) | |
| tree | 81ce5a31be0e237c815380e8e7563a5b5edde010 /libjava/java/net/URL.java | |
| parent | e0d9f0c0b1f53e5478d546c4ec76ba6b11cced54 (diff) | |
| download | gcc-0adf119d837133d429298738c4f748391a0fd4f7.tar.gz | |
* java/net/URL.java (getPath): New JDK 1.3 method.
* java/net/URLStreamHandler.java (parseURL):
It is wrong to prepend '/' to the file part of a relative url.
* java/net/URLStreamHandler.java (parseURL):
Minor optizations - append '/' rather than "/".
* java/net/URLStreamHandler.java (parseURL):
Don't canonicalize "xx/.." or "./" URLs - JDK doesn't.
We probably should canonicalize for a context-relative url, though.
* java/net/URL.java (sameFile): Delegate to URLStreamHandler.
* java/net/URLStreamHandler.java (canonicalizeFilename): New helper.
(sameFile): New method. Uses canonicalizeFilename.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@49980 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava/java/net/URL.java')
| -rw-r--r-- | libjava/java/net/URL.java | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/libjava/java/net/URL.java b/libjava/java/net/URL.java index 636e6efc3d8..a3e9d784cef 100644 --- a/libjava/java/net/URL.java +++ b/libjava/java/net/URL.java @@ -1,6 +1,6 @@ // URL.java - A Uniform Resource Locator. -/* Copyright (C) 1999, 2000 Free Software Foundation +/* Copyright (C) 1999, 2000, 2002 Free Software Foundation This file is part of libgcj. @@ -219,6 +219,12 @@ public final class URL implements Serializable return file; } + public String getPath() + { + int quest = file.indexOf('?'); + return quest < 0 ? file : file.substring(0, quest); + } + public String getHost() { return host; @@ -274,16 +280,7 @@ public final class URL implements Serializable public boolean sameFile(URL other) { - // This comparison is very conservative. It assumes that any - // field can be null. - return (other != null - && port == other.port - && ((protocol == null && other.protocol == null) - || (protocol != null && protocol.equals(other.protocol))) - && ((host == null && other.host == null) - || (host != null && host.equals(other.host))) - && ((file == null && other.file == null) - || (file != null && file.equals(other.file)))); + return handler.sameFile(this, other); } protected void set(String protocol, String host, int port, String file, |
