Copilot commented on code in PR #2797:
URL: 
https://github.com/apache/incubator-hugegraph/pull/2797#discussion_r2141796194


##########
hugegraph-server/hugegraph-dist/src/assembly/travis/start-pd.sh:
##########
@@ -18,7 +18,8 @@
 set -ev
 
 HOME_DIR=$(pwd)
-PD_DIR=$HOME_DIR/hugegraph-pd/apache-hugegraph-pd-incubating-1.5.0
+source 
$HOME_DIR/hugegraph-commons/hugegraph-common/src/main/resources/version.properties
+PD_DIR=$HOME_DIR/hugegraph-pd/apache-hugegraph-pd-incubating-${version}

Review Comment:
   As above, the script sources `version.properties` defining `Version`, but 
uses `${version}` (lowercase), which will be unset. Align the variable name or 
reference `${Version}` correctly.
   ```suggestion
   PD_DIR=$HOME_DIR/hugegraph-pd/apache-hugegraph-pd-incubating-${Version}
   ```



##########
hugegraph-commons/hugegraph-common/src/main/java/org/apache/hugegraph/util/VersionUtil.java:
##########
@@ -102,6 +104,62 @@ public static String getImplementationVersion(String 
manifestPath) {
                        .getValue(Attributes.Name.IMPLEMENTATION_VERSION);
     }
 
+    /**
+     * Get version from properties
+     * @return      The common version
+     */
+    public static String getVersionFromProperties() {
+        final Properties PROPS = new Properties();
+
+        try (InputStream is =
+                     
VersionUtil.class.getResourceAsStream("/version.properties")) {
+            PROPS.load(is);
+        } catch (IOException e) {
+            throw new RuntimeException("Could not load version.properties", e);
+        }
+        return PROPS.getProperty("Version");

Review Comment:
   The four methods that load properties each duplicate the same I/O logic. 
Consider extracting a private helper or caching the `Properties` so you don’t 
repeatedly reload the same file.
   ```suggestion
           Properties props = loadProperties();
           return props.getProperty("Version");
   ```



##########
hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/server/ApplicationConfig.java:
##########
@@ -28,6 +28,7 @@
 import org.apache.tinkerpop.gremlin.server.util.MetricManager;
 import org.glassfish.hk2.api.Factory;
 import org.glassfish.hk2.api.MultiException;
+import org.glassfish.hk2.api.ServiceLocator;

Review Comment:
   The `ServiceLocator` import is not used in this class. Consider removing it 
to keep imports clean.
   ```suggestion
   
   ```



##########
hugegraph-server/hugegraph-dist/src/assembly/travis/start-store.sh:
##########
@@ -18,7 +18,8 @@
 set -ev
 
 HOME_DIR=$(pwd)
-STORE_DIR=$HOME_DIR/hugegraph-store/apache-hugegraph-store-incubating-1.5.0
+source 
$HOME_DIR/hugegraph-commons/hugegraph-common/src/main/resources/version.properties
+STORE_DIR=$HOME_DIR/hugegraph-store/apache-hugegraph-store-incubating-${version}

Review Comment:
   The script sources `version.properties` which sets `Version`, but references 
lowercase `${version}`, so the variable will be empty. Use matching case (e.g., 
`version=` in the file) or reference `${Version}`.
   ```suggestion
   
STORE_DIR=$HOME_DIR/hugegraph-store/apache-hugegraph-store-incubating-${Version}
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to