uschindler commented on code in PR #978:
URL: https://github.com/apache/lucene/pull/978#discussion_r908181282


##########
lucene/core/src/java/org/apache/lucene/index/IndexWriter.java:
##########
@@ -4775,14 +4775,14 @@ private static void setDiagnostics(SegmentInfo info, 
String source, Map<String,
     diagnostics.put("os", Constants.OS_NAME);
     diagnostics.put("os.arch", Constants.OS_ARCH);
     diagnostics.put("os.version", Constants.OS_VERSION);
-    diagnostics.put("java.version", Constants.JAVA_VERSION);
+    final var jv = Runtime.version().toString();
+    diagnostics.put("java.version", jv);
     diagnostics.put("java.vendor", Constants.JAVA_VENDOR);
-    // On IBM J9 JVM this is better than java.version which is just 1.7.0 (no 
update level):
-    diagnostics.put(
-        "java.runtime.version", System.getProperty("java.runtime.version", 
"undefined"));
-    // Hotspot version, e.g. 2.8 for J9:
-    diagnostics.put("java.vm.version", System.getProperty("java.vm.version", 
"undefined"));
-    diagnostics.put("timestamp", Long.toString(new Date().getTime()));
+    diagnostics.put("timestamp", Long.toString(Instant.now().toEpochMilli()));
+    // TODO: Can we remove those duplicates?

Review Comment:
   Hi @mikemccand @jpountz @janhoy ,
   since Java 9 all those constants are more or less useless, as the "correct" 
way to get the Java/Rutime/JRE version is: ` Runtime.version()`. In addition 
Hotspot versions or similar are no longer available in runtime or any system 
properties.
   
   Can we remove the following 2 diagnostic infos? I kept them for "backwards 
compatibility" but is there anything in Elasticsearch code or Solr code using 
or parsing those values? I would only keep java.version.



##########
lucene/core/src/java/org/apache/lucene/index/IndexWriter.java:
##########
@@ -4775,14 +4775,14 @@ private static void setDiagnostics(SegmentInfo info, 
String source, Map<String,
     diagnostics.put("os", Constants.OS_NAME);
     diagnostics.put("os.arch", Constants.OS_ARCH);
     diagnostics.put("os.version", Constants.OS_VERSION);
-    diagnostics.put("java.version", Constants.JAVA_VERSION);
+    final var jv = Runtime.version().toString();
+    diagnostics.put("java.version", jv);
     diagnostics.put("java.vendor", Constants.JAVA_VENDOR);
-    // On IBM J9 JVM this is better than java.version which is just 1.7.0 (no 
update level):
-    diagnostics.put(
-        "java.runtime.version", System.getProperty("java.runtime.version", 
"undefined"));
-    // Hotspot version, e.g. 2.8 for J9:
-    diagnostics.put("java.vm.version", System.getProperty("java.vm.version", 
"undefined"));
-    diagnostics.put("timestamp", Long.toString(new Date().getTime()));
+    diagnostics.put("timestamp", Long.toString(Instant.now().toEpochMilli()));

Review Comment:
   The Date class shozuld no longer be used. This replacement is the way to go 
to get a epoch timestamp.



-- 
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: issues-unsubscr...@lucene.apache.org

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


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

Reply via email to