File tree Expand file tree Collapse file tree 2 files changed +14
-3
lines changed 
modules/core/src/main/java/org/apache/ignite Expand file tree Collapse file tree 2 files changed +14
-3
lines changed Original file line number Diff line number Diff line change @@ -32,7 +32,7 @@ public class IgniteVersionUtils {
3232    public  static  final  IgniteProductVersion  VER ;
3333
3434    /** UTC build date formatter. */ 
35-     public  static  final  SimpleDateFormat  BUILD_TSTAMP_DATE_FORMATTER ;
35+     private  static  final  SimpleDateFormat  BUILD_TSTAMP_DATE_FORMATTER ;
3636
3737    /** Formatted build date. */ 
3838    public  static  final  String  BUILD_TSTAMP_STR ;
@@ -74,7 +74,7 @@ public class IgniteVersionUtils {
7474
7575        BUILD_TSTAMP_DATE_FORMATTER .setTimeZone (TimeZone .getTimeZone ("UTC" ));
7676
77-         BUILD_TSTAMP_STR  = BUILD_TSTAMP_DATE_FORMATTER . format ( new   Date ( BUILD_TSTAMP  * 1000 ) );
77+         BUILD_TSTAMP_STR  = formatBuildTimeStamp ( BUILD_TSTAMP  * 1000 );
7878
7979        COPYRIGHT  = BUILD_TSTAMP_STR .substring (0 , 4 ) + " Copyright(C) Apache Software Foundation" ;
8080
@@ -89,6 +89,17 @@ public class IgniteVersionUtils {
8989        VER  = IgniteProductVersion .fromString (VER_STR  + '-'  + BUILD_TSTAMP  + '-'  + REV_HASH_STR );
9090    }
9191
92+     /** 
93+      * Builds string date representation in "yyyyMMdd" format. 
94+      * "synchronized" because it uses {@link SimpleDateFormat} which is not threadsafe. 
95+      * 
96+      * @param ts Timestamp. 
97+      * @return Timestamp date in UTC timezone. 
98+      */ 
99+     public  static  synchronized  String  formatBuildTimeStamp (long  ts ) {
100+         return  BUILD_TSTAMP_DATE_FORMATTER .format (new  Date (ts ));
101+     }
102+ 
92103    /** 
93104     * Private constructor. 
94105     */ 
Original file line number Diff line number Diff line change @@ -258,7 +258,7 @@ public int compareToIgnoreTimestamp(@NotNull IgniteProductVersion o) {
258258
259259    /** {@inheritDoc} */ 
260260    @ Override  public  String  toString () {
261-         String  revTsStr  = IgniteVersionUtils .BUILD_TSTAMP_DATE_FORMATTER . format ( new   Date ( revTs  * 1000 ) );
261+         String  revTsStr  = IgniteVersionUtils .formatBuildTimeStamp ( revTs  * 1000 );
262262
263263        String  hash  = U .byteArray2HexString (revHash ).toLowerCase ();
264264
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments