summaryrefslogtreecommitdiffstats
path: root/libjava/java/net
diff options
context:
space:
mode:
authoraph <aph@138bc75d-0d04-0410-961f-82ee72b054a4>2005-07-14 18:20:10 +0000
committeraph <aph@138bc75d-0d04-0410-961f-82ee72b054a4>2005-07-14 18:20:10 +0000
commit0e59a0d6f813468682be0fae5b44251a54624143 (patch)
tree8de981c27b99e5f3550c9d6ebf969b8edaec99fa /libjava/java/net
parent28fbd488c4291a334e87d6e31485bea947fc628a (diff)
downloadppe42-gcc-0e59a0d6f813468682be0fae5b44251a54624143.tar.gz
ppe42-gcc-0e59a0d6f813468682be0fae5b44251a54624143.zip
2005-07-13 Andrew Haley <aph@redhat.com>
* gnu/java/net/protocol/file/Connection.java (unquote): New method. (connect): Unquote filename. gnu/java/net/protocol/jar/Connection.java (getInputStream): Likewise. (getJarFile): Likewise. * java/net/URLConnection.java (getContentHandler): Guard cast with instaceof. * java/net/URL.java (URL): If the file part of a spec is absolute, ignore the file part of its context. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@102029 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava/java/net')
-rw-r--r--libjava/java/net/URL.java12
-rw-r--r--libjava/java/net/URLConnection.java17
2 files changed, 17 insertions, 12 deletions
diff --git a/libjava/java/net/URL.java b/libjava/java/net/URL.java
index a136556fbcf..0ae7c1cfb96 100644
--- a/libjava/java/net/URL.java
+++ b/libjava/java/net/URL.java
@@ -408,10 +408,7 @@ public final class URL implements Serializable
// The 1.2 doc specifically says these are copied to the new URL.
host = context.host;
port = context.port;
- file = context.file;
userInfo = context.userInfo;
- if (file == null || file.length() == 0)
- file = "/";
authority = context.authority;
}
}
@@ -423,10 +420,13 @@ public final class URL implements Serializable
protocol = context.protocol;
host = context.host;
port = context.port;
- file = context.file;
userInfo = context.userInfo;
- if (file == null || file.length() == 0)
- file = "/";
+ if (spec.indexOf(":/", 1) < 0)
+ {
+ file = context.file;
+ if (file == null || file.length() == 0)
+ file = "/";
+ }
authority = context.authority;
}
else // Protocol NOT specified in spec. and no context available.
diff --git a/libjava/java/net/URLConnection.java b/libjava/java/net/URLConnection.java
index 5233a56fd59..55b9d664dc7 100644
--- a/libjava/java/net/URLConnection.java
+++ b/libjava/java/net/URLConnection.java
@@ -983,17 +983,22 @@ public abstract class URLConnection
if (contentType == null || contentType.equals(""))
return null;
- ContentHandler handler;
+ ContentHandler handler = null;
// See if a handler has been cached for this content type.
// For efficiency, if a content type has been searched for but not
// found, it will be in the hash table but as the contentType String
// instead of a ContentHandler.
- if ((handler = (ContentHandler) handlers.get(contentType)) != null)
- if (handler instanceof ContentHandler)
- return handler;
- else
- return null;
+ {
+ Object cachedHandler;
+ if ((cachedHandler = handlers.get(contentType)) != null)
+ {
+ if (cachedHandler instanceof ContentHandler)
+ return (ContentHandler)cachedHandler;
+ else
+ return null;
+ }
+ }
// If a non-default factory has been set, use it.
if (factory != null)
OpenPOWER on IntegriCloud