| Index: lucene/core/src/java/org/apache/lucene/index/IndexWriter.java |
| =================================================================== |
| --- lucene/core/src/java/org/apache/lucene/index/IndexWriter.java (revision 1684477) |
| +++ lucene/core/src/java/org/apache/lucene/index/IndexWriter.java (working copy) |
| @@ -3769,6 +3769,15 @@ |
| setDiagnostics(info, source, null); |
| } |
| |
| + private static void addSysPropIfNotNull(Map<String,String> diagnostics, String key) { |
| + String s = System.getProperty(key); |
| + if (s != null) { |
| + diagnostics.put(key, s); |
| + } else { |
| + diagnostics.put(key, "undefined"); |
| + } |
| + } |
| + |
| private static void setDiagnostics(SegmentInfo info, String source, Map<String,String> details) { |
| Map<String,String> diagnostics = new HashMap<>(); |
| diagnostics.put("source", source); |
| @@ -3778,6 +3787,10 @@ |
| diagnostics.put("os.version", Constants.OS_VERSION); |
| diagnostics.put("java.version", Constants.JAVA_VERSION); |
| 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): |
| + addSysPropIfNotNull(diagnostics, "java.runtime.version"); |
| + // Hotspot version, e.g. 2.8 for J9: |
| + addSysPropIfNotNull(diagnostics, "java.vm.version"); |
| diagnostics.put("timestamp", Long.toString(new Date().getTime())); |
| if (details != null) { |
| diagnostics.putAll(details); |
| Index: lucene/core/src/test/org/apache/lucene/index/TestCheckIndex.java |
| =================================================================== |
| --- lucene/core/src/test/org/apache/lucene/index/TestCheckIndex.java (revision 1684477) |
| +++ lucene/core/src/test/org/apache/lucene/index/TestCheckIndex.java (working copy) |
| @@ -93,6 +93,9 @@ |
| assertEquals(18, seg.termVectorStatus.docCount); |
| assertEquals(18, seg.termVectorStatus.totVectors); |
| |
| + assertNotNull(seg.diagnostics.get("java.vm.version")); |
| + assertNotNull(seg.diagnostics.get("java.runtime.version")); |
| + |
| assertTrue(seg.diagnostics.size() > 0); |
| final List<String> onlySegments = new ArrayList<>(); |
| onlySegments.add("_0"); |