From f74dee6f97be62364a9866144e39a565092e1acc Mon Sep 17 00:00:00 2001 From: Norbert Kalmar Date: Tue, 7 Apr 2020 15:40:39 +0200 Subject: [PATCH] ZOOKEEPER-3780: restore Version.getRevision() to be bacward compatible Added a warning in https://cwiki.apache.org/confluence/display/ZOOKEEPER/Upgrade+FAQ Author: Norbert Kalmar Reviewers: Enrico Olivelli Closes #1304 from nkalmar/branch-3.6 (cherry picked from commit 5062c39cb028115a9b79f9b28d6837065e70bf40) Signed-off-by: Enrico Olivelli --- .../src/main/java/org/apache/zookeeper/Version.java | 12 ++++++++++++ .../org/apache/zookeeper/version/util/VerGen.java | 1 + 2 files changed, 13 insertions(+) diff --git a/zookeeper-server/src/main/java/org/apache/zookeeper/Version.java b/zookeeper-server/src/main/java/org/apache/zookeeper/Version.java index 4029c60ede3..4fc0507a2fc 100644 --- a/zookeeper-server/src/main/java/org/apache/zookeeper/Version.java +++ b/zookeeper-server/src/main/java/org/apache/zookeeper/Version.java @@ -24,6 +24,18 @@ public class Version implements org.apache.zookeeper.version.Info { + /* + * Since the SVN to Git port this field doesn't return the revision anymore + * In version 3.5.6, 3.5.7 and 3.6.0 this function is removed by accident. + * From version 3.5.8+ and 3.6.1+ it is restored for backward compatibility, but will be removed later + * @deprecated deprecated in 3.5.5, use @see {@link #getRevisionHash()} instead + * @return the default value -1 + */ + @Deprecated + public static int getRevision() { + return REVISION; + } + public static String getRevisionHash() { return REVISION_HASH; } diff --git a/zookeeper-server/src/main/java/org/apache/zookeeper/version/util/VerGen.java b/zookeeper-server/src/main/java/org/apache/zookeeper/version/util/VerGen.java index 25bffd72866..9bb699f090d 100644 --- a/zookeeper-server/src/main/java/org/apache/zookeeper/version/util/VerGen.java +++ b/zookeeper-server/src/main/java/org/apache/zookeeper/version/util/VerGen.java @@ -84,6 +84,7 @@ public static void generateFile(File outputDir, Version version, String rev, Str if (rev.equals("-1")) { System.out.println("Unknown REVISION number, using " + rev); } + w.write(" int REVISION=-1; //@deprecated, please use REVISION_HASH\n"); w.write(" String REVISION_HASH=\"" + rev + "\";\n"); w.write(" String BUILD_DATE=\"" + buildDate + "\";\n"); w.write("}\n");