[exo-jcr-commits] exo-jcr SVN: r4865 - in kernel/branches/2.2.x/patch: 2.2.11-GA and 1 other directories.

do-not-reply at jboss.org do-not-reply at jboss.org
Tue Sep 6 04:32:45 EDT 2011


Author: dkuleshov
Date: 2011-09-06 04:32:44 -0400 (Tue, 06 Sep 2011)
New Revision: 4865

Added:
   kernel/branches/2.2.x/patch/2.2.11-GA/
   kernel/branches/2.2.x/patch/2.2.11-GA/KER-178/
   kernel/branches/2.2.x/patch/2.2.11-GA/KER-178/KER-178.patch
Log:
KER-178: patch added

Added: kernel/branches/2.2.x/patch/2.2.11-GA/KER-178/KER-178.patch
===================================================================
--- kernel/branches/2.2.x/patch/2.2.11-GA/KER-178/KER-178.patch	                        (rev 0)
+++ kernel/branches/2.2.x/patch/2.2.11-GA/KER-178/KER-178.patch	2011-09-06 08:32:44 UTC (rev 4865)
@@ -0,0 +1,74 @@
+Index: exo.kernel.commons/src/main/java/org/exoplatform/commons/utils/Tools.java
+===================================================================
+--- exo.kernel.commons/src/main/java/org/exoplatform/commons/utils/Tools.java	(revision 4792)
++++ exo.kernel.commons/src/main/java/org/exoplatform/commons/utils/Tools.java	(working copy)
+@@ -23,6 +23,7 @@
+ import java.util.Map;
+ import java.util.Properties;
+ import java.util.Set;
++import java.util.TimeZone;
+ 
+ /**
+  * @author <a href="mailto:julien.viet at exoplatform.com">Julien Viet</a>
+@@ -30,8 +31,12 @@
+  */
+ public class Tools
+ {
+-
+    /**
++    * All the time zones already registered
++    */
++   private static volatile Map<String, TimeZone> TIME_ZONES = new HashMap<String, TimeZone>();
++   
++   /**
+     * Instantiates a {@link HashSet} object and fills it with the provided element array.
+     *
+     * @param elements the list of elements to add
+@@ -155,4 +160,34 @@
+       String suffix = s.substring(s.length() - end.length());
+       return suffix.equalsIgnoreCase(end); 
+    }
++   
++   /**
++    * This method is similar to {@link TimeZone#getTimeZone(String)} with less contention
++    */
++   public static TimeZone getTimeZone(String ID)
++   {
++      if (ID == null)
++      {
++         throw new NullPointerException("ID of the timezone cannot be null");
++      }
++      if (ID.length() == 0)
++      {
++         throw new IllegalArgumentException("ID of the timezone cannot be empty");
++      }
++      TimeZone tz = TIME_ZONES.get(ID);
++      if (tz == null)
++      {
++         synchronized (TimeZone.class)
++         {
++            if (tz == null)
++            {
++               tz = TimeZone.getTimeZone(ID);
++               Map<String, TimeZone> tzs = new HashMap<String, TimeZone>(TIME_ZONES);
++               tzs.put(ID, tz);
++               TIME_ZONES = tzs;
++            }
++         }
++      }
++      return tz;
++   }
+ }
+Index: exo.kernel.commons/src/main/java/org/exoplatform/commons/utils/ISO8601ASF.java
+===================================================================
+--- exo.kernel.commons/src/main/java/org/exoplatform/commons/utils/ISO8601ASF.java	(revision 4792)
++++ exo.kernel.commons/src/main/java/org/exoplatform/commons/utils/ISO8601ASF.java	(working copy)
+@@ -187,7 +187,7 @@
+          return null;
+       }
+ 
+-      TimeZone tz = TimeZone.getTimeZone(tzID);
++      TimeZone tz = Tools.getTimeZone(tzID);
+       // verify id of returned time zone (getTimeZone defaults to "GMT")
+       if (!tz.getID().equals(tzID))
+       {



More information about the exo-jcr-commits mailing list