You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hc.apache.org by ol...@apache.org on 2020/11/05 21:06:39 UTC

[httpcomponents-core] 03/06: HTTPCORE-632: version.properties contains non-interpolated value

This is an automated email from the ASF dual-hosted git repository.

olegk pushed a commit to branch 5.0.x
in repository https://gitbox.apache.org/repos/asf/httpcomponents-core.git

commit ec5bc155e13c521abd479556429574b052b6dab3
Author: Michael Osipov <mi...@apache.org>
AuthorDate: Sat Sep 26 21:09:24 2020 +0200

    HTTPCORE-632: version.properties contains non-interpolated value
    
    Remove the non-reproducible timestamp as well as deprecate the field and
    getter for this property.
---
 .../java/org/apache/hc/core5/util/VersionInfo.java | 22 ++++++++--------------
 .../org/apache/hc/core5/version.properties         |  6 ++----
 2 files changed, 10 insertions(+), 18 deletions(-)

diff --git a/httpcore5/src/main/java/org/apache/hc/core5/util/VersionInfo.java b/httpcore5/src/main/java/org/apache/hc/core5/util/VersionInfo.java
index 1080bc3..bf7636f 100644
--- a/httpcore5/src/main/java/org/apache/hc/core5/util/VersionInfo.java
+++ b/httpcore5/src/main/java/org/apache/hc/core5/util/VersionInfo.java
@@ -58,6 +58,10 @@ public class VersionInfo {
     // the property names
     public final static String PROPERTY_MODULE    = "info.module";
     public final static String PROPERTY_RELEASE   = "info.release";
+    /**
+     * @deprecated This will be removed in 6.0.
+     */
+    @Deprecated
     public final static String PROPERTY_TIMESTAMP = "info.timestamp";
 
 
@@ -132,7 +136,9 @@ public class VersionInfo {
      * This data is read from the version information for the package.
      *
      * @return  the timestamp, never {@code null}
+     * @deprecated This will be removed in 6.0.
      */
+    @Deprecated
     public final String getTimestamp() {
         return infoTimestamp;
     }
@@ -170,9 +176,6 @@ public class VersionInfo {
         if (!UNAVAILABLE.equals(infoRelease)) {
             sb.append(':').append(infoRelease);
         }
-        if (!UNAVAILABLE.equals(infoTimestamp)) {
-            sb.append(':').append(infoTimestamp);
-        }
 
         sb.append(')');
 
@@ -263,7 +266,6 @@ public class VersionInfo {
         Args.notNull(pckg, "Package identifier");
         String module = null;
         String release = null;
-        String timestamp = null;
 
         if (info != null) {
             module = (String) info.get(PROPERTY_MODULE);
@@ -273,17 +275,9 @@ public class VersionInfo {
 
             release = (String) info.get(PROPERTY_RELEASE);
             if ((release != null) && ((release.length() < 1) ||
-                                      (release.equals("${pom.version}")))) {
+                                      (release.equals("${project.version}")))) {
                 release = null;
             }
-
-            timestamp = (String) info.get(PROPERTY_TIMESTAMP);
-            if ((timestamp != null) &&
-                ((timestamp.length() < 1) ||
-                 (timestamp.equals("${mvn.timestamp}")))
-                ) {
-                timestamp = null;
-            }
         } // if info
 
         String clsldrstr = null;
@@ -291,7 +285,7 @@ public class VersionInfo {
             clsldrstr = clsldr.toString();
         }
 
-        return new VersionInfo(pckg, module, release, timestamp, clsldrstr);
+        return new VersionInfo(pckg, module, release, null, clsldrstr);
     }
 
     /**
diff --git a/httpcore5/src/main/resources/org/apache/hc/core5/version.properties b/httpcore5/src/main/resources/org/apache/hc/core5/version.properties
index 96f4212..29e63b1 100644
--- a/httpcore5/src/main/resources/org/apache/hc/core5/version.properties
+++ b/httpcore5/src/main/resources/org/apache/hc/core5/version.properties
@@ -16,7 +16,5 @@
 # specific language governing permissions and limitations
 # under the License.
 #
-info.module    = httpcore5
-info.release   = ${pom.version}
-info.timestamp = ${mvn.timestamp}
-# timestamp requires Maven 2.1
+info.module    = ${project.artifactId}
+info.release   = ${project.version}