On Fri, 21 Aug 2026 15:37:12 GMT, ExE Boss <[email protected]> wrote: >> Naoto Sato has updated the pull request incrementally with four additional >> commits since the last revision: >> >> - Merge remote-tracking branch 'jdk-sandbox/json' into >> JDK-8381976-Implementation-for-Simple-JSON-API >> - Use %04X format for invalid hex digit error message >> - Update outdated comment in toPath >> - Renamed `JsonValueImpl` to `JsonValueSupport` > > src/jdk.incubator.json/share/classes/jdk/incubator/json/impl/JsonParser.java > line 397: > >> 395: case 'A', 'B', 'C', 'D', 'E', 'F' -> c - 'A' + >> 10; >> 396: default -> throw failure( >> 397: "Invalid Unicode escape sequence. >> '\\u%04X' is not a hex digit".formatted((int)c), > > Maybe retain `%c` for ASCII printable characters? > > Something like: > > private static String formatChar(char c) { > if (c > 0x20 && c < 0x7F) { > return Character.toString(c); > } > > return String.format(Locale.ROOT, "\\u%04X", (int) c); > } > > > Which would then be used as: > > "Invalid Unicode escape sequence. '" + formatChar(c) + "' is not a hex digit" > > or > > "Invalid Unicode escape sequence. '%s' is not a hex > digit".formatted(formatChar(c))
Good point. Will modify the message. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/32282#discussion_r3832925297
