-
Bug
-
Resolution: Fixed
-
P4
-
8, 9
-
b21
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8176002 | 9.0.4 | Shafi Ahmad | P4 | Closed | Won't Fix | |
JDK-8176001 | 8 | Shafi Ahmad | P4 | Closed | Not an Issue |
707 void JDK_Version::to_string(char* buffer, size_t buflen) const {
708 assert(buffer && buflen > 0, "call with useful buffer");
709 size_t index = 0;
710
711 if (!is_valid()) {
712 jio_snprintf(buffer, buflen, "%s", "(uninitialized)");
713 } else {
714 int rc = jio_snprintf(
715 &buffer[index], buflen - index, "%d.%d", _major, _minor);
716 if (rc == -1) return;
717 index += rc;
718 if (_security > 0) {
719 rc = jio_snprintf(&buffer[index], buflen - index, ".%d", _security);
720 }
721 if (_patch > 0) {
722 rc = jio_snprintf(&buffer[index], buflen - index, ".%d", _patch);
723 if (rc == -1) return;
724 index += rc;
725 }
726 if (_build > 0) {
727 rc = jio_snprintf(&buffer[index], buflen - index, "+%d", _build);
728 if (rc == -1) return;
729 index += rc;
730 }
731 }
732 }
Not sure about the different set of values of different flags [_security, _patch and _build]. Let us consider two scenario:
1. Not sure about the possibility but if flags _security > 0 and _patch or _build > 0 then in that case the effect of code at line# 719 will be null and void by code at line# 722 or line# 727 depending on the values of flag _patch and _build.
2. If _security is non zero and other flag can not be non zero then in that case it is better to put return statement after line# 719 to avoid confusion.
708 assert(buffer && buflen > 0, "call with useful buffer");
709 size_t index = 0;
710
711 if (!is_valid()) {
712 jio_snprintf(buffer, buflen, "%s", "(uninitialized)");
713 } else {
714 int rc = jio_snprintf(
715 &buffer[index], buflen - index, "%d.%d", _major, _minor);
716 if (rc == -1) return;
717 index += rc;
718 if (_security > 0) {
719 rc = jio_snprintf(&buffer[index], buflen - index, ".%d", _security);
720 }
721 if (_patch > 0) {
722 rc = jio_snprintf(&buffer[index], buflen - index, ".%d", _patch);
723 if (rc == -1) return;
724 index += rc;
725 }
726 if (_build > 0) {
727 rc = jio_snprintf(&buffer[index], buflen - index, "+%d", _build);
728 if (rc == -1) return;
729 index += rc;
730 }
731 }
732 }
Not sure about the different set of values of different flags [_security, _patch and _build]. Let us consider two scenario:
1. Not sure about the possibility but if flags _security > 0 and _patch or _build > 0 then in that case the effect of code at line# 719 will be null and void by code at line# 722 or line# 727 depending on the values of flag _patch and _build.
2. If _security is non zero and other flag can not be non zero then in that case it is better to put return statement after line# 719 to avoid confusion.
- backported by
-
JDK-8176001 Incorrect implementation of JDK_Version::to_string OR proper return statement is missing
-
- Closed
-
-
JDK-8176002 Incorrect implementation of JDK_Version::to_string OR proper return statement is missing
-
- Closed
-