xmlgraphics-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jerem...@apache.org
Subject svn commit: r652284 - in /xmlgraphics/commons/trunk: src/java/org/apache/xmlgraphics/xmp/XMPSchemaAdapter.java status.xml
Date Wed, 30 Apr 2008 06:17:13 GMT
Author: jeremias
Date: Tue Apr 29 23:17:12 2008
New Revision: 652284

URL: http://svn.apache.org/viewvc?rev=652284&view=rev
Log:
Bugfix for a potential multi-threading issue concerning the use of the java.text package.

Modified:
    xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/xmp/XMPSchemaAdapter.java
    xmlgraphics/commons/trunk/status.xml

Modified: xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/xmp/XMPSchemaAdapter.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/xmp/XMPSchemaAdapter.java?rev=652284&r1=652283&r2=652284&view=diff
==============================================================================
--- xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/xmp/XMPSchemaAdapter.java (original)
+++ xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/xmp/XMPSchemaAdapter.java Tue
Apr 29 23:17:12 2008
@@ -34,14 +34,6 @@
  */
 public class XMPSchemaAdapter {
 
-    private static DateFormat pseudoISO8601DateFormat;
-
-    static {
-        pseudoISO8601DateFormat = new SimpleDateFormat(
-                "yyyy'-'MM'-'dd'T'HH':'mm':'ss", Locale.ENGLISH);
-        pseudoISO8601DateFormat.setTimeZone(TimeZone.getTimeZone("GMT"));
-    }
-    
     /** the Metadata object this schema instance operates on */
     protected Metadata meta;
     private XMPSchema schema;
@@ -123,6 +115,13 @@
     public static String formatISO8601Date(Date dt) {
         return formatISO8601Date(dt, TimeZone.getDefault());
     }
+
+    private static DateFormat createPseudoISO8601DateFormat() {
+        DateFormat df = new SimpleDateFormat(
+                "yyyy'-'MM'-'dd'T'HH':'mm':'ss", Locale.ENGLISH);
+        df.setTimeZone(TimeZone.getTimeZone("GMT"));
+        return df;
+    }
     
     /**
      * Formats a Date using ISO 8601 format in the given time zone.
@@ -139,7 +138,7 @@
         
         //DateFormat is operating on GMT so adjust for time zone offset
         Date dt1 = new Date(dt.getTime() + offset);
-        StringBuffer sb = new StringBuffer(pseudoISO8601DateFormat.format(dt1));
+        StringBuffer sb = new StringBuffer(createPseudoISO8601DateFormat().format(dt1));
 
         offset /= (1000 * 60); //Convert to minutes
         
@@ -198,7 +197,7 @@
         }
         Date d;
         try {
-            d = pseudoISO8601DateFormat.parse(parsablePart);
+            d = createPseudoISO8601DateFormat().parse(parsablePart);
         } catch (ParseException e) {
             throw new IllegalArgumentException("Invalid ISO 8601 date format: " + dt);
         }

Modified: xmlgraphics/commons/trunk/status.xml
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/trunk/status.xml?rev=652284&r1=652283&r2=652284&view=diff
==============================================================================
--- xmlgraphics/commons/trunk/status.xml (original)
+++ xmlgraphics/commons/trunk/status.xml Tue Apr 29 23:17:12 2008
@@ -40,6 +40,9 @@
   </contexts>
   <changes>
     <release version="Trunk" date="n/a">
+      <action context="Code" dev="JM" type="fix">
+        Bugfix for a potential multi-threading issue concerning the use of the java.text
package.
+      </action>
       <action context="Code" dev="JM" type="add">
         Added fallbacks for Type 1 fonts which don't have the normal "one", "two" etc. glyphs,
         but actually only provide "oneoldstyle", "twooldstyle" etc.



---------------------------------------------------------------------
Apache XML Graphics Project URL: http://xmlgraphics.apache.org/
To unsubscribe, e-mail: commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: commits-help@xmlgraphics.apache.org


Mime
View raw message