8233785: Incorrect JDK version is reported in hs_err log
Reviewed-by: dholmes, stuefe
--- 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;
}