I report this bug because of corelibs-dev email from "Andrey Turbanov"
ProcessHandleImpl.Info.toString code:
StringBuilder sb = new StringBuilder(60);
sb.append('[');
if (user != null) {
sb.append("user: ");
sb.append(user());
}
if (command != null) {
if (sb.length() != 0) sb.append(", ");
sb.append("cmd: ");
sb.append(command);
}
Opening bracket '[' is added unconditionally to the StringBuilder. But later the code checks "if (sb.length() != 0)". This condition will always be true.
See also:
https://mail.openjdk.java.net/pipermail/core-libs-dev/2021-September/081774.html
ProcessHandleImpl.Info.toString code:
StringBuilder sb = new StringBuilder(60);
sb.append('[');
if (user != null) {
sb.append("user: ");
sb.append(user());
}
if (command != null) {
if (sb.length() != 0) sb.append(", ");
sb.append("cmd: ");
sb.append(command);
}
Opening bracket '[' is added unconditionally to the StringBuilder. But later the code checks "if (sb.length() != 0)". This condition will always be true.
See also:
https://mail.openjdk.java.net/pipermail/core-libs-dev/2021-September/081774.html