aboutsummaryrefslogtreecommitdiff
path: root/libjava/java/net
diff options
context:
space:
mode:
authorMichael Koch <konqueror@gmx.de>2004-01-06 08:54:20 +0000
committerMichael Koch <mkoch@gcc.gnu.org>2004-01-06 08:54:20 +0000
commita67e295f56b5ff1e981af1b2581dec3a55c827b9 (patch)
tree1cfd998d0656b2ae8840635867e1bd1c0fe4cd22 /libjava/java/net
parent907cdc7fad039a88c619a92107186ef03b9a816f (diff)
downloadgcc-a67e295f56b5ff1e981af1b2581dec3a55c827b9.zip
gcc-a67e295f56b5ff1e981af1b2581dec3a55c827b9.tar.gz
gcc-a67e295f56b5ff1e981af1b2581dec3a55c827b9.tar.bz2
2004-01-06 Michael Koch <konqueror@gmx.de>
* java/net/URLConnection.java (contentHandler): Removed. (locale): Removed. (getHeaderFields): Return an empty map instead of null. (getContent): Connect if needed, renamed "cType" to "type" and "contentHandler" to "ch" and made it a local variable. (getPermission): Don't use package in class name. (setDefaultRequestProperty): Fixed typo in documentation. (initializeDateFormats): Made locale a local variable. From-SVN: r75466
Diffstat (limited to 'libjava/java/net')
-rw-r--r--libjava/java/net/URLConnection.java25
1 files changed, 14 insertions, 11 deletions
diff --git a/libjava/java/net/URLConnection.java b/libjava/java/net/URLConnection.java
index 370765f..4707d9c 100644
--- a/libjava/java/net/URLConnection.java
+++ b/libjava/java/net/URLConnection.java
@@ -41,8 +41,8 @@ package java.net;
import java.io.InputStream;
import java.io.IOException;
import java.io.OutputStream;
-import java.security.Permission;
import java.security.AllPermission;
+import java.security.Permission;
import java.text.ParsePosition;
import java.text.SimpleDateFormat;
import java.util.Collections;
@@ -165,9 +165,7 @@ public abstract class URLConnection
*/
protected URL url;
- private static ContentHandler contentHandler;
private static Hashtable handlers = new Hashtable();
- private static Locale locale;
private static SimpleDateFormat dateFormat1, dateFormat2, dateFormat3;
private static boolean dateformats_initialized = false;
@@ -315,7 +313,7 @@ public abstract class URLConnection
public Map getHeaderFields()
{
// Subclasses for specific protocols override this.
- return null;
+ return Collections.EMPTY_MAP;
}
/**
@@ -419,16 +417,20 @@ public abstract class URLConnection
*/
public Object getContent() throws IOException
{
+ if (!connected)
+ connect();
+
// FIXME: Doc indicates that other criteria should be applied as
// heuristics to determine the true content type, e.g. see
// guessContentTypeFromName() and guessContentTypeFromStream methods
// as well as FileNameMap class & fileNameMap field & get/set methods.
- String cType = getContentType();
- contentHandler = setContentHandler(cType);
- if (contentHandler == null)
+ String type = getContentType();
+ ContentHandler ch = setContentHandler(type);
+
+ if (ch == null)
return getInputStream();
- return contentHandler.getContent(this);
+ return ch.getContent(this);
}
/**
@@ -463,7 +465,7 @@ public abstract class URLConnection
public Permission getPermission() throws IOException
{
// Subclasses may override this.
- return new java.security.AllPermission();
+ return new AllPermission();
}
/**
@@ -803,7 +805,7 @@ public abstract class URLConnection
* @deprecated 1.3 The method setRequestProperty should be used instead.
* This method does nothing now.
*
- * @see URLConnectionr#setRequestProperty(String key, String value)
+ * @see URLConnection#setRequestProperty(String key, String value)
*/
public static void setDefaultRequestProperty (String key, String value)
{
@@ -1036,7 +1038,8 @@ public abstract class URLConnection
{
if (dateformats_initialized)
return;
- locale = new Locale("En", "Us", "Unix");
+
+ Locale locale = new Locale("En", "Us", "Unix");
dateFormat1 = new SimpleDateFormat("EEE, dd MMM yyyy hh:mm:ss 'GMT'",
locale);
dateFormat2 = new SimpleDateFormat("EEEE, dd-MMM-yy hh:mm:ss 'GMT'",