harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ndbe...@apache.org
Subject svn commit: r824014 - /harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/URLConnection.java
Date Sun, 11 Oct 2009 03:57:21 GMT
Author: ndbeyer
Date: Sun Oct 11 03:57:21 2009
New Revision: 824014

URL: http://svn.apache.org/viewvc?rev=824014&view=rev
Log:
remove unnecessary instanceof check, add synchronized blocks to protect class field

Modified:
    harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/URLConnection.java

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/URLConnection.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/URLConnection.java?rev=824014&r1=824013&r2=824014&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/URLConnection.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/URLConnection.java
Sun Oct 11 03:57:21 2009
@@ -232,9 +232,6 @@
 
         if (contentHandlerFactory != null) {
             cHandler = contentHandlerFactory.createContentHandler(type);
-            if (!(cHandler instanceof ContentHandler)) {
-                throw new UnknownServiceException();
-            }
             contentHandlers.put(type, cHandler);
             return (ContentHandler) cHandler;
         }
@@ -399,10 +396,12 @@
         // Must use lazy initialization or there is a bootstrap problem
         // trying to load the MimeTable resource from a .jar before
         // JarURLConnection has finished initialization.
-        if (fileNameMap == null) {
-            fileNameMap = new MimeTable();
+        synchronized (URLConnection.class) {
+            if (fileNameMap == null) {
+                fileNameMap = new MimeTable();
+            }
+            return fileNameMap;
         }
-        return fileNameMap;
     }
 
     /**
@@ -905,7 +904,9 @@
         if (manager != null) {
             manager.checkSetFactory();
         }
-        fileNameMap = map;
+        synchronized (URLConnection.class) {
+            fileNameMap = map;
+        }
     }
 
     /**



Mime
View raw message