RFR: 7904113: Logging flags cause malformed \uxxxx encoding

Jaikiran Pai jpai at openjdk.org
Fri Dec 12 06:41:20 UTC 2025


Can I please get a review of this change which proposes to address the issue noted in https://bugs.openjdk.org/browse/CODETOOLS-7904113?

jtreg when running tests against a target JDK, launches a jtreg internal main application - the `com.sun.javatest.regtest.agent.GetJDKProperties` which is expected to return back properties of the target JDK. These properties are expected to be loadable using the `java.util.Properties` class. jtreg launches `GetJDKProperties` as a separate `Process` and then waits for it to complete and expects that `GetJDKProperties` writes out the properties to the standard output of that process. Once that process completes (with an exit code of 0), jtreg then reads the standard output of that process and starts loading each line as a key/value pair property, using the `Properties` class.

It can happen that jtreg launches this `GetJDKProperties` process using additional user specified JVM arguments. So of these JVM arguments may generate additional messages on the process' standard output and those messages don't represent any properties of the target JDK. Furthermore, it's possible that such log messages may not even be loaded using `Properties` class thus leading to exceptions like the ones noted in the linked issue.

The commit in this PR changes the `GetJDKProperties` to write out the properties (and only the properties) to an output file instead of writing it out to standard output of the process. That way, there won't be any interference in the generated output and any unexpected log messages in the launched process. The jtreg side then reads the properties from this output file instead of reading from the standard output of the process. This interaction between jtreg and the launched `GetJDKProperties` is all internal to jtreg and an internal implementation detail, so this change doesn't/shouldn't cause any compatibility concerns.

Given the nature of this change, I haven't added a self test for this. However, I have verified that the original reported issue no longer reproduces with this change (and continues to reproduce without this change). I have also run tier1, tier2, tier3 testing of the current JDK mainline with this change to jtreg and those tests completed without any related issues.

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

Commit messages:
 - 7904113: Logging flags cause malformed \uxxxx encoding

Changes: https://git.openjdk.org/jtreg/pull/302/files
  Webrev: https://webrevs.openjdk.org/?repo=jtreg&pr=302&range=00
  Issue: https://bugs.openjdk.org/browse/CODETOOLS-7904113
  Stats: 75 lines in 2 files changed: 47 ins; 21 del; 7 mod
  Patch: https://git.openjdk.org/jtreg/pull/302.diff
  Fetch: git fetch https://git.openjdk.org/jtreg.git pull/302/head:pull/302

PR: https://git.openjdk.org/jtreg/pull/302


More information about the jtreg-dev mailing list