[kaffe] CVS kaffe (dalibor): Resynced with GNU Classpath

Kaffe CVS Kaffe Mailing List <kaffe@kaffe.org>
Mon Feb 2 10:24:02 2004


PatchSet 4391 
Date: 2004/02/02 18:13:52
Author: dalibor
Branch: HEAD
Tag: (none) 
Log:
Resynced with GNU Classpath

2004-02-02  Dalibor Topic <robilad@kaffe.org>

        Resynced with GNU Classpath.

        2004-01-25  Michael Koch  <konqueror@gmx.de>

        * java/net/URLConnection.java
        (fileNameMap): Don't initialize. Initialization should be lazy.
        (guessContentTypeFromName): Get filename map from getFileNameMap().
        (getFileNameMap): Made it synchronized. Initialize fileNameMapa if
        needed.

Members: 
	ChangeLog:1.1975->1.1976 
	libraries/javalib/java/net/URLConnection.java:1.15->1.16 

Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.1975 kaffe/ChangeLog:1.1976
--- kaffe/ChangeLog:1.1975	Mon Feb  2 18:01:04 2004
+++ kaffe/ChangeLog	Mon Feb  2 18:13:52 2004
@@ -2,6 +2,18 @@
 
         Resynced with GNU Classpath.
 
+	2004-01-25  Michael Koch  <konqueror@gmx.de>
+
+        * java/net/URLConnection.java
+        (fileNameMap): Don't initialize. Initialization should be lazy.
+        (guessContentTypeFromName): Get filename map from getFileNameMap().
+        (getFileNameMap): Made it synchronized. Initialize fileNameMapa if
+        needed.
+
+2004-02-02  Dalibor Topic <robilad@kaffe.org>
+
+        Resynced with GNU Classpath.
+
 	2004-02-02  Jeroen Frijters  <jeroen@frijters.net>
 
         * java/io/ObjectInputStream.java: Made all calls
Index: kaffe/libraries/javalib/java/net/URLConnection.java
diff -u kaffe/libraries/javalib/java/net/URLConnection.java:1.15 kaffe/libraries/javalib/java/net/URLConnection.java:1.16
--- kaffe/libraries/javalib/java/net/URLConnection.java:1.15	Fri Jan  9 17:56:35 2004
+++ kaffe/libraries/javalib/java/net/URLConnection.java	Mon Feb  2 18:13:53 2004
@@ -1,5 +1,5 @@
 /* URLConnection.java -- Abstract superclass for reading from URL's
-   Copyright (C) 1998, 2002, 2003 Free Software Foundation, Inc.
+   Copyright (C) 1998, 2002, 2003, 2004 Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -94,7 +94,7 @@
    * to do this is implemented by this class, so just create an empty
    * instance and store it here.
    */
-  private static FileNameMap fileNameMap = new MimeTypeMapper();
+  private static FileNameMap fileNameMap;
  
   /**
    * This is the ContentHandlerFactory set by the caller, if any
@@ -888,7 +888,7 @@
    */
   public static String guessContentTypeFromName(String filename)
   {
-    return(fileNameMap.getContentTypeFor(filename.toLowerCase()));
+    return getFileNameMap().getContentTypeFor(filename.toLowerCase());
   }
 
   /**
@@ -921,8 +921,14 @@
    *
    * @since 1.2
    */
-  public static FileNameMap getFileNameMap()
+  public static synchronized FileNameMap getFileNameMap()
   {
+    // Delayed initialization.
+    if (fileNameMap == null)
+      {
+	fileNameMap = new MimeTypeMapper();
+      }
+
     return fileNameMap;
   }
 
@@ -947,5 +953,4 @@
 
     fileNameMap = map;
   }
-} // class URLConnection
-
+}