RFR: 8375013: J2DdemoTest.java - Platform default encoding used for process output

ANUPAM DEV duke at openjdk.org
Tue Jan 13 13:23:56 UTC 2026


Hi,

new String(b, 0, n) looks at the operating system's default locale. If these differ between the build machine and the test runner, tests can fail.
StandardCharsets.UTF_8 is guaranteed to be available on all Java platforms.

Since "ERROR" and "Exception" are ASCII characters, and ASCII is a subset of UTF-8, this will correctly match the tokens regardless of the underlying platform's obscure defaults.

Kindly review.

Regards,
Anupam

-------------

Commit messages:
 - 8375013: J2DdemoTest.java - Platform default encoding used for process output

Changes: https://git.openjdk.org/jdk/pull/29190/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=29190&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8375013
  Stats: 2 lines in 1 file changed: 1 ins; 0 del; 1 mod
  Patch: https://git.openjdk.org/jdk/pull/29190.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/29190/head:pull/29190

PR: https://git.openjdk.org/jdk/pull/29190


More information about the client-libs-dev mailing list