8233785: Incorrect JDK version is reported in hs_err log
authorysuenaga
Wed, 13 Nov 2019 10:27:06 +0900
changeset 59045 846fee5ea75e
parent 59044 8c9d0451433b
child 59046 a8104278b4d0
8233785: Incorrect JDK version is reported in hs_err log Reviewed-by: dholmes, stuefe
src/hotspot/share/runtime/java.cpp
--- a/src/hotspot/share/runtime/java.cpp	Wed Nov 13 09:09:04 2019 +0800
+++ b/src/hotspot/share/runtime/java.cpp	Wed Nov 13 10:27:06 2019 +0900
@@ -733,6 +733,7 @@
   return (e > o) ? 1 : ((e == o) ? 0 : -1);
 }
 
+/* See JEP 223 */
 void JDK_Version::to_string(char* buffer, size_t buflen) const {
   assert(buffer && buflen > 0, "call with useful buffer");
   size_t index = 0;
@@ -744,13 +745,12 @@
         &buffer[index], buflen - index, "%d.%d", _major, _minor);
     if (rc == -1) return;
     index += rc;
-    if (_security > 0) {
-      rc = jio_snprintf(&buffer[index], buflen - index, ".%d", _security);
+    if (_patch > 0) {
+      rc = jio_snprintf(&buffer[index], buflen - index, ".%d.%d", _security, _patch);
       if (rc == -1) return;
       index += rc;
-    }
-    if (_patch > 0) {
-      rc = jio_snprintf(&buffer[index], buflen - index, ".%d", _patch);
+    } else if (_security > 0) {
+      rc = jio_snprintf(&buffer[index], buflen - index, ".%d", _security);
       if (rc == -1) return;
       index += rc;
     }