]> source.dussan.org Git - aspectj.git/commitdiff
includes refactoring that is in real Version.java
authoraclement <aclement>
Fri, 25 Aug 2006 13:05:32 +0000 (13:05 +0000)
committeraclement <aclement>
Fri, 25 Aug 2006 13:05:32 +0000 (13:05 +0000)
build/lib/BridgeVersion.java.txt

index 132e027ae0a91fb9d050ef8f0c81b486cb6bf8c9..36c1e0df426c98d2f086dbc09c67d1f574514fe6 100644 (file)
@@ -43,22 +43,25 @@ public class Version {
       * time in seconds-since-... format, used by programmatic clients.
       * (if DEVELOPMENT version, NOTIME)
       */
-    public static final long time;
+    private static long time = -1; // -1 == uninitialized
     
        /** format used by build script to set time_text */
     public static final String SIMPLE_DATE_FORMAT = "@build.time.format@";
     
-    // if not DEVELOPMENT version, read time text using format used to set time 
-    static {
-        long foundTime = NOTIME;
-           try {
-               SimpleDateFormat format = new SimpleDateFormat(SIMPLE_DATE_FORMAT);
-               ParsePosition pos = new ParsePosition(0);
-               Date date = format.parse(time_text, pos);
-               foundTime = date.getTime();
-           } catch (Throwable t) {            
-           }
-        time = foundTime;
+    public static long getTime() {
+       if (time==-1) {
+               long foundTime = NOTIME;
+           // if not DEVELOPMENT version, read time text using format used to set time 
+            try {
+                SimpleDateFormat format = new SimpleDateFormat(SIMPLE_DATE_FORMAT);
+                ParsePosition pos = new ParsePosition(0);
+                Date date = format.parse(time_text, pos);
+                if (date!=null) foundTime = date.getTime();
+            } catch (Throwable t) {            
+            }
+            time = foundTime;
+       }
+       return time;
     }
 
     /**