ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@apache.org
Subject svn commit: r1407856 - in /ant/core/trunk/src/main/org/apache/tools: ant/listener/ zip/
Date Sat, 10 Nov 2012 17:32:04 GMT
Author: bodewig
Date: Sat Nov 10 17:32:03 2012
New Revision: 1407856

URL: http://svn.apache.org/viewvc?rev=1407856&view=rev
Log:
Inspired by PR 54056 I looked for thread-safety issues with HashMap in our code - nothing
major found

Modified:
    ant/core/trunk/src/main/org/apache/tools/ant/listener/ProfileLogger.java
    ant/core/trunk/src/main/org/apache/tools/zip/   (props changed)
    ant/core/trunk/src/main/org/apache/tools/zip/AbstractUnicodeExtraField.java   (props changed)
    ant/core/trunk/src/main/org/apache/tools/zip/ExtraFieldUtils.java   (contents, props changed)
    ant/core/trunk/src/main/org/apache/tools/zip/FallbackZipEncoding.java   (props changed)
    ant/core/trunk/src/main/org/apache/tools/zip/NioZipEncoding.java   (props changed)
    ant/core/trunk/src/main/org/apache/tools/zip/Simple8BitZipEncoding.java   (props changed)
    ant/core/trunk/src/main/org/apache/tools/zip/UnicodeCommentExtraField.java   (props changed)
    ant/core/trunk/src/main/org/apache/tools/zip/UnicodePathExtraField.java   (props changed)
    ant/core/trunk/src/main/org/apache/tools/zip/UnparseableExtraFieldData.java   (props changed)
    ant/core/trunk/src/main/org/apache/tools/zip/UnrecognizedExtraField.java   (props changed)
    ant/core/trunk/src/main/org/apache/tools/zip/ZipEncoding.java   (props changed)
    ant/core/trunk/src/main/org/apache/tools/zip/ZipEncodingHelper.java   (contents, props
changed)
    ant/core/trunk/src/main/org/apache/tools/zip/ZipEntry.java   (props changed)
    ant/core/trunk/src/main/org/apache/tools/zip/ZipFile.java   (props changed)
    ant/core/trunk/src/main/org/apache/tools/zip/ZipOutputStream.java   (props changed)
    ant/core/trunk/src/main/org/apache/tools/zip/ZipUtil.java   (props changed)

Modified: ant/core/trunk/src/main/org/apache/tools/ant/listener/ProfileLogger.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/listener/ProfileLogger.java?rev=1407856&r1=1407855&r2=1407856&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/listener/ProfileLogger.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/listener/ProfileLogger.java Sat Nov 10 17:32:03
2012
@@ -18,8 +18,8 @@
 package org.apache.tools.ant.listener;
 
 import java.util.Date;
-import java.util.HashMap;
 import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
 
 import org.apache.tools.ant.BuildEvent;
 import org.apache.tools.ant.DefaultLogger;
@@ -32,7 +32,7 @@ import org.apache.tools.ant.util.StringU
  */
 public class ProfileLogger extends DefaultLogger {
 
-    private Map<Object, Date> profileData = new HashMap<Object, Date>();
+    private Map<Object, Date> profileData = new ConcurrentHashMap<Object, Date>();
 
     /**
      * Logs a message to say that the target has started.

Propchange: ant/core/trunk/src/main/org/apache/tools/zip/
------------------------------------------------------------------------------
  Merged /commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip:r1407854

Propchange: ant/core/trunk/src/main/org/apache/tools/zip/AbstractUnicodeExtraField.java
------------------------------------------------------------------------------
  Merged /commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/AbstractUnicodeExtraField.java:r1407854

Modified: ant/core/trunk/src/main/org/apache/tools/zip/ExtraFieldUtils.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/zip/ExtraFieldUtils.java?rev=1407856&r1=1407855&r2=1407856&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/zip/ExtraFieldUtils.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/zip/ExtraFieldUtils.java Sat Nov 10 17:32:03
2012
@@ -19,9 +19,9 @@
 package org.apache.tools.zip;
 
 import java.util.ArrayList;
-import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
 import java.util.zip.ZipException;
 
 /**
@@ -41,7 +41,7 @@ public class ExtraFieldUtils {
     private static final Map<ZipShort, Class<?>> implementations;
 
     static {
-        implementations = new HashMap<ZipShort, Class<?>>();
+        implementations = new ConcurrentHashMap<ZipShort, Class<?>>();
         register(AsiExtraField.class);
         register(JarMarker.class);
         register(UnicodePathExtraField.class);

Propchange: ant/core/trunk/src/main/org/apache/tools/zip/ExtraFieldUtils.java
------------------------------------------------------------------------------
  Merged /commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/ExtraFieldUtils.java:r1407854

Propchange: ant/core/trunk/src/main/org/apache/tools/zip/FallbackZipEncoding.java
------------------------------------------------------------------------------
  Merged /commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/FallbackZipEncoding.java:r1407854

Propchange: ant/core/trunk/src/main/org/apache/tools/zip/NioZipEncoding.java
------------------------------------------------------------------------------
  Merged /commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/NioZipEncoding.java:r1407854

Propchange: ant/core/trunk/src/main/org/apache/tools/zip/Simple8BitZipEncoding.java
------------------------------------------------------------------------------
  Merged /commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/Simple8BitZipEncoding.java:r1407854

Propchange: ant/core/trunk/src/main/org/apache/tools/zip/UnicodeCommentExtraField.java
------------------------------------------------------------------------------
  Merged /commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/UnicodeCommentExtraField.java:r1407854

Propchange: ant/core/trunk/src/main/org/apache/tools/zip/UnicodePathExtraField.java
------------------------------------------------------------------------------
  Merged /commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/UnicodePathExtraField.java:r1407854

Propchange: ant/core/trunk/src/main/org/apache/tools/zip/UnparseableExtraFieldData.java
------------------------------------------------------------------------------
  Merged /commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/UnparseableExtraFieldData.java:r1407854

Propchange: ant/core/trunk/src/main/org/apache/tools/zip/UnrecognizedExtraField.java
------------------------------------------------------------------------------
  Merged /commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/UnrecognizedExtraField.java:r1407854

Propchange: ant/core/trunk/src/main/org/apache/tools/zip/ZipEncoding.java
------------------------------------------------------------------------------
  Merged /commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/ZipEncoding.java:r1407854

Modified: ant/core/trunk/src/main/org/apache/tools/zip/ZipEncodingHelper.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/zip/ZipEncodingHelper.java?rev=1407856&r1=1407855&r2=1407856&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/zip/ZipEncodingHelper.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/zip/ZipEncodingHelper.java Sat Nov 10 17:32:03
2012
@@ -21,6 +21,7 @@ package org.apache.tools.zip;
 import java.nio.ByteBuffer;
 import java.nio.charset.Charset;
 import java.nio.charset.UnsupportedCharsetException;
+import java.util.Collections;
 import java.util.HashMap;
 import java.util.Map;
 
@@ -65,7 +66,8 @@ public abstract class ZipEncodingHelper 
     private static final Map<String, SimpleEncodingHolder> simpleEncodings;
 
     static {
-        simpleEncodings = new HashMap<String, SimpleEncodingHolder>();
+        Map<String, SimpleEncodingHolder> se =
+            new HashMap<String, SimpleEncodingHolder>();
 
         char[] cp437_high_chars =
             new char[] { 0x00c7, 0x00fc, 0x00e9, 0x00e2, 0x00e4, 0x00e0,
@@ -93,11 +95,11 @@ public abstract class ZipEncodingHelper 
 
         SimpleEncodingHolder cp437 = new SimpleEncodingHolder(cp437_high_chars);
 
-        simpleEncodings.put("CP437",cp437);
-        simpleEncodings.put("Cp437",cp437);
-        simpleEncodings.put("cp437",cp437);
-        simpleEncodings.put("IBM437",cp437);
-        simpleEncodings.put("ibm437",cp437);
+        se.put("CP437", cp437);
+        se.put("Cp437", cp437);
+        se.put("cp437", cp437);
+        se.put("IBM437", cp437);
+        se.put("ibm437", cp437);
 
         char[] cp850_high_chars =
             new char[] { 0x00c7, 0x00fc, 0x00e9, 0x00e2, 0x00e4, 0x00e0,
@@ -125,11 +127,12 @@ public abstract class ZipEncodingHelper 
 
         SimpleEncodingHolder cp850 = new SimpleEncodingHolder(cp850_high_chars);
 
-        simpleEncodings.put("CP850",cp850);
-        simpleEncodings.put("Cp850",cp850);
-        simpleEncodings.put("cp850",cp850);
-        simpleEncodings.put("IBM850",cp850);
-        simpleEncodings.put("ibm850",cp850);
+        se.put("CP850", cp850);
+        se.put("Cp850", cp850);
+        se.put("cp850", cp850);
+        se.put("IBM850", cp850);
+        se.put("ibm850", cp850);
+        simpleEncodings = Collections.unmodifiableMap(se);
     }
 
     /**

Propchange: ant/core/trunk/src/main/org/apache/tools/zip/ZipEncodingHelper.java
------------------------------------------------------------------------------
  Merged /commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/ZipEncodingHelper.java:r1407854

Propchange: ant/core/trunk/src/main/org/apache/tools/zip/ZipEntry.java
------------------------------------------------------------------------------
  Merged /commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/ZipEntry.java:r1407854

Propchange: ant/core/trunk/src/main/org/apache/tools/zip/ZipFile.java
------------------------------------------------------------------------------
  Merged /commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/ZipFile.java:r1407854

Propchange: ant/core/trunk/src/main/org/apache/tools/zip/ZipOutputStream.java
------------------------------------------------------------------------------
  Merged /commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/ZipOutputStream.java:r1407854

Propchange: ant/core/trunk/src/main/org/apache/tools/zip/ZipUtil.java
------------------------------------------------------------------------------
  Merged /commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/ZipUtil.java:r1407854



Mime
View raw message