maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From micha...@apache.org
Subject [maven-archiver] 01/01: Use FastDateFormat
Date Sun, 06 Oct 2019 19:10:38 GMT
This is an automated email from the ASF dual-hosted git repository.

michaelo pushed a commit to branch MSHARED-837_FDF
in repository https://gitbox.apache.org/repos/asf/maven-archiver.git

commit 9e7cc4daf109b8970ae6517ac6d4c132ec942b14
Author: Michael Osipov <michaelo@apache.org>
AuthorDate: Sun Oct 6 21:10:29 2019 +0200

    Use FastDateFormat
---
 pom.xml                                                    |  9 +++++++--
 src/main/java/org/apache/maven/archiver/MavenArchiver.java | 11 +++++------
 2 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/pom.xml b/pom.xml
index 616797d..35cf76a 100644
--- a/pom.xml
+++ b/pom.xml
@@ -6,9 +6,9 @@
   regarding copyright ownership.  The ASF licenses this file
   to you under the Apache License, Version 2.0 (the
   "License"); you may not use this file except in compliance
-  with the License.  You may obtain a copy of the License at 
+  with the License.  You may obtain a copy of the License at
   http://www.apache.org/licenses/LICENSE-2.0
-  
+
   Unless required by applicable law or agreed to in writing,
   software distributed under the License is distributed on an
   "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -89,6 +89,11 @@
       <artifactId>commons-io</artifactId>
       <version>2.5</version>
     </dependency>
+    <dependency>
+      <groupId>org.apache.commons</groupId>
+      <artifactId>commons-lang3</artifactId>
+      <version>3.8.1</version>
+    </dependency>
 
     <dependency>
       <groupId>org.codehaus.plexus</groupId>
diff --git a/src/main/java/org/apache/maven/archiver/MavenArchiver.java b/src/main/java/org/apache/maven/archiver/MavenArchiver.java
index 82cd3a9..fc62d6c 100644
--- a/src/main/java/org/apache/maven/archiver/MavenArchiver.java
+++ b/src/main/java/org/apache/maven/archiver/MavenArchiver.java
@@ -1,5 +1,7 @@
 package org.apache.maven.archiver;
 
+import org.apache.commons.lang3.time.DateFormatUtils;
+
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
@@ -42,9 +44,7 @@ import org.apache.maven.shared.utils.StringUtils;
 import javax.lang.model.SourceVersion;
 import java.io.File;
 import java.io.IOException;
-import java.text.DateFormat;
 import java.text.ParseException;
-import java.text.SimpleDateFormat;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.Date;
@@ -728,7 +728,7 @@ public class MavenArchiver
 
     /**
      * Define a value for "Created By" entry.
-     * 
+     *
      * @param description description of the plugin, like "Maven Source Plugin"
      * @param groupId groupId where to get version in pom.properties
      * @param artifactId artifactId where to get version in pom.properties
@@ -753,7 +753,7 @@ public class MavenArchiver
     /**
      * Add "Build-Jdk-Spec" entry as part of default manifest entries (true by default).
      * For plugins whose output is not impacted by JDK release (like maven-source-plugin),
adding
-     * Jdk spec adds unnecessary requirement on JDK version used at build to get reproducible
result. 
+     * Jdk spec adds unnecessary requirement on JDK version used at build to get reproducible
result.
      *
      * @since 3.4.1
      */
@@ -780,10 +780,9 @@ public class MavenArchiver
             return null;
         }
 
-        DateFormat df = new SimpleDateFormat( "yyyy-MM-dd'T'HH:mm:ssX" ); 
         try
         {
-            return df.parse( outputTimestamp );
+            return DateFormatUtils.ISO_8601_EXTENDED_DATETIME_TIME_ZONE_FORMAT.parse( outputTimestamp
);
         }
         catch ( ParseException pe )
         {


Mime
View raw message