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


##########
hugegraph-commons/hugegraph-common/pom.xml:
##########
@@ -238,6 +238,12 @@
     </dependencyManagement>
 
     <build>
+        <resources>
+            <resource>
+                <directory>src/main/resources</directory>

Review Comment:
   [nitpick] Enabling filtering on the entire `src/main/resources` could 
inadvertently alter other files. Consider restricting filtering to only 
`version.properties` or excluding other resource patterns.
   ```suggestion
                   <directory>src/main/resources</directory>
                   <includes>
                       <include>version.properties</include>
                   </includes>
   ```



##########
hugegraph-commons/hugegraph-common/src/main/java/org/apache/hugegraph/util/VersionUtil.java:
##########
@@ -102,6 +104,46 @@ public static String getImplementationVersion(String 
manifestPath) {
                        .getValue(Attributes.Name.IMPLEMENTATION_VERSION);
     }
 
+    public static Properties loadProperties() {
+        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;
+    }
+
+    /**
+     * Get version from properties
+     * @return      The common version
+     */
+    public static String getVersionFromProperties() {

Review Comment:
   [nitpick] Each call reloads the properties file from disk. Consider caching 
the loaded `Properties` in a static field to avoid repeated I/O.



-- 
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