incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fmesc...@apache.org
Subject svn commit: r575754 - /incubator/sling/trunk/obr/src/main/java/org/apache/sling/obr/Repository.java
Date Fri, 14 Sep 2007 16:43:36 GMT
Author: fmeschbe
Date: Fri Sep 14 09:43:35 2007
New Revision: 575754

URL: http://svn.apache.org/viewvc?rev=575754&view=rev
Log:
Synchronize use of DateFormat instances

Modified:
    incubator/sling/trunk/obr/src/main/java/org/apache/sling/obr/Repository.java

Modified: incubator/sling/trunk/obr/src/main/java/org/apache/sling/obr/Repository.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/obr/src/main/java/org/apache/sling/obr/Repository.java?rev=575754&r1=575753&r2=575754&view=diff
==============================================================================
--- incubator/sling/trunk/obr/src/main/java/org/apache/sling/obr/Repository.java (original)
+++ incubator/sling/trunk/obr/src/main/java/org/apache/sling/obr/Repository.java Fri Sep 14
09:43:35 2007
@@ -129,7 +129,9 @@
     }
 
     public String getLastModifiedFormatted() {
-        return REPO_DATE_FORMAT.format(new Date(this.getLastModified()));
+        synchronized (REPO_DATE_FORMAT) {
+            return REPO_DATE_FORMAT.format(new Date(this.getLastModified()));
+        }
     }
 
     public void addResource(InputStream bundleStream) throws IOException {
@@ -364,14 +366,12 @@
         String version = manifest.getMainAttributes().getValue("Bundle-Version");
         Version v = Version.parseVersion(version);
         if (v.getQualifier().indexOf("SNAPSHOT") >= 0) {
-            version = v.getMajor()
-                + "."
-                + v.getMinor()
-                + "."
-                + v.getMicro()
-                + "."
-                + v.getQualifier().replaceAll("SNAPSHOT",
-                    DATE_FORMAT.format(new Date()));
+            String tStamp;
+            synchronized (DATE_FORMAT) {
+                tStamp = DATE_FORMAT.format(new Date());
+            }
+            version = v.getMajor() + "." + v.getMinor() + "." + v.getMicro()
+                + "." + v.getQualifier().replaceAll("SNAPSHOT", tStamp);
             manifest.getMainAttributes().putValue("Bundle-Version", version);
         }
 



Mime
View raw message