Connection.java (unquote): New method.

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.

From-SVN: r102029
This commit is contained in:
Andrew Haley 2005-07-14 18:20:10 +00:00 committed by Andrew Haley
parent b11e14262e
commit 3fefd0193c
5 changed files with 91 additions and 17 deletions

View file

@ -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)