JDK-8298046 : Fix hidden but significant trailing whitespace in properties files for serviceability code
  • Type: Bug
  • Component: core-svc
  • Affected Version: 20
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2022-12-02
  • Updated: 2025-07-25
  • Resolved: 2024-02-06
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 23
23 b09Fixed
Related Reports
Relates :  
Description
According to the specification [1] trailing whitespaces in the values of properties files are (somewhat surprisingly) actually significant.

We have multiple files in the JDK with trailing whitespaces in the values. For most of this files, this is likely incorrect and due to oversight, but in a few cases it might actually be intended (like "The value is: ").

After a discussion in the PR for JDK-8295729, the consensus was to replace valid trailing spaces with the corresponding unicode sequence, `\u0020`. (And of course remove non-wanted trailing spaces.)

Doing so has a dual benefit:

1) It makes it clear to everyone reading the code that there is a trailing space and it is intended

2) It will allow us to remove all actual trailing space characters, and turn on the corresponding check in jcheck to keep the properties files, just like all other source code files, free of trailing spaces.

Ultimately, the call of whether a trailing space is supposed to be there, or is a bug, lies with the respective component teams owning these files. Thus I have split up the set of properties files with trailing spaces in several groups, to match the JDK teams, and open a JBS issue for each of them. This issue is for code I believe belong with the serviceability team.

[1] https://docs.oracle.com/en/java/javase/19/docs/api/java.base/java/util/Properties.html#load(java.io.Reader)
Comments
Changeset: b02599d2 Author: Magnus Ihse Bursie <ihse@openjdk.org> Date: 2024-02-06 08:04:17 +0000 URL: https://git.openjdk.org/jdk/commit/b02599d22e0f424a08045b32b94549c272fe35a7
06-02-2024

A pull request was submitted for review. URL: https://git.openjdk.org/jdk/pull/11490 Date: 2022-12-02 16:42:57 +0000
02-12-2022