vlsi commented on code in PR #133:
URL: https://github.com/apache/xalan-java/pull/133#discussion_r1412301383


##########
xalan/src/main/java/org/apache/xalan/Version.java:
##########
@@ -51,12 +49,24 @@ public class Version
   private static boolean snapshot;
 
   static {
-    readProperties();
-    parseVersionNumber();
+    parseVersionNumber(readVersionNumber());
+  }
+
+  static String readVersionNumber() {
+    try (InputStream fromResource = getPropertiesStream()) {
+      Properties properties = new Properties();
+      if (fromResource != null) {
+        properties.load(fromResource);
+        return properties.getProperty("version", NO_VERSION);
+      }
+    } catch (Exception e) {
+      new RuntimeException("Cannot read properties file to extract Xalan 
version number information: ", e)
+        .printStackTrace();
+    }

Review Comment:
   Technically, Java calls them "exceptions", not "throwables": 
https://docs.oracle.com/javase/specs/jls/se21/html/jls-11.html
   
   > **Every exception** is represented by an instance of the class 
**`Throwable`** or one of its subclasses 
([§11.1](https://docs.oracle.com/javase/specs/jls/se21/html/jls-11.html#jls-11.1))
   
   



##########
xalan/src/main/java/org/apache/xalan/Version.java:
##########
@@ -51,12 +49,24 @@ public class Version
   private static boolean snapshot;
 
   static {
-    readProperties();
-    parseVersionNumber();
+    parseVersionNumber(readVersionNumber());
+  }
+
+  static String readVersionNumber() {
+    try (InputStream fromResource = getPropertiesStream()) {
+      Properties properties = new Properties();
+      if (fromResource != null) {
+        properties.load(fromResource);
+        return properties.getProperty("version", NO_VERSION);
+      }
+    } catch (Exception e) {
+      new RuntimeException("Cannot read properties file to extract Xalan 
version number information: ", e)
+        .printStackTrace();
+    }

Review Comment:
   Technically, Java calls them "exceptions", not "throwables": 
https://docs.oracle.com/javase/specs/jls/se21/html/jls-11.html
   
   > **Every exception** is represented by an instance of the class 
**`Throwable`** or one of its subclasses 
([§11.1](https://docs.oracle.com/javase/specs/jls/se21/html/jls-11.html#jls-11.1))
   
   



-- 
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: dev-unsubscr...@xalan.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@xalan.apache.org
For additional commands, e-mail: dev-h...@xalan.apache.org

Reply via email to