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

yuqi4733 pushed a commit to branch branch-1.2
in repository https://gitbox.apache.org/repos/asf/gravitino.git


The following commit(s) were added to refs/heads/branch-1.2 by this push:
     new 028fdcaf40 [Cherry-pick to branch-1.2] [#10762] fix(common): 
Lazy-initialize Version to fix TestVersion without jar task (#10779) (#10784)
028fdcaf40 is described below

commit 028fdcaf400250a6b50bde798ab0c1979c20646d
Author: github-actions[bot] 
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Wed Apr 15 09:07:29 2026 +0800

    [Cherry-pick to branch-1.2] [#10762] fix(common): Lazy-initialize Version 
to fix TestVersion without jar task (#10779) (#10784)
    
    **Cherry-pick Information:**
    - Original commit: 7c1eb871ee79e12dda458030c6b699eb3a413cc8
    - Target branch: `branch-1.2`
    - Status: ✅ Clean cherry-pick (no conflicts)
    
    Co-authored-by: Sachin Ranjalkar 
<[email protected]>
---
 common/src/main/java/org/apache/gravitino/Version.java | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/common/src/main/java/org/apache/gravitino/Version.java 
b/common/src/main/java/org/apache/gravitino/Version.java
index f62252f552..9201ac6f8f 100644
--- a/common/src/main/java/org/apache/gravitino/Version.java
+++ b/common/src/main/java/org/apache/gravitino/Version.java
@@ -38,7 +38,9 @@ public class Version {
   private static final Pattern PATTERN =
       
Pattern.compile("^(\\d+)\\.(\\d+)\\.(\\d+)(?:rc(0|[1-9]\\d*)|-.*|\\.([a-zA-Z].*))?$");
 
-  private static final Version INSTANCE = new Version();
+  private static class InstanceHolder {
+    private static final Version INSTANCE = new Version();
+  }
 
   private final VersionInfo versionInfo;
   private final VersionDTO versionDTO;
@@ -74,14 +76,14 @@ public class Version {
    * @return the current versionInfo
    */
   public static VersionInfo getCurrentVersion() {
-    return INSTANCE.versionInfo;
+    return InstanceHolder.INSTANCE.versionInfo;
   }
 
   /**
    * @return the current version DTO
    */
   public static VersionDTO getCurrentVersionDTO() {
-    return INSTANCE.versionDTO;
+    return InstanceHolder.INSTANCE.versionDTO;
   }
 
   /**

Reply via email to