On Fri, 2 Dec 2022 16:40:51 GMT, Magnus Ihse Bursie <i...@openjdk.org> wrote:

> According to [the 
> specification](https://docs.oracle.com/en/java/javase/19/docs/api/java.base/java/util/Properties.html#load(java.io.Reader))
>  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](https://bugs.openjdk.org/browse/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 core-libs team.

src/java.sql.rowset/share/classes/com/sun/rowset/RowSetResourceBundle_zh_TW.properties
 line 160:

> 158: xmlrch.errupdate = 
> \u5EFA\u69CB\u66F4\u65B0\u5217\u6642\u767C\u751F\u932F\u8AA4: {0}
> 159: xmlrch.errupdrow = \u66F4\u65B0\u5217\u6642\u767C\u751F\u932F\u8AA4: {0}
> 160: xmlrch.chars = \u5B57\u5143:\u0020

Likely not needed, since the original and all other l10n versions of 
RowSetResourceBundle.properties do not have a trailing space for `xmlrch.chars`

src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/msg/XMLMessages.properties
 line 24:

> 22: 
> 23:         BadMessageKey = The error message corresponding to the message 
> key can not be found.
> 24:         FormatFailed = An internal error occurred while formatting the 
> following message:\n\u0020\u0020

Likely a mistake, since as you stated, it is not in the format “foo:\u0020” as 
there is a newline before the trailing spaces.

However if intentional it should probably be `FormatFailed = An internal error 
occurred while formatting the following message:\n\u0020`

src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/msg/XMLMessages.properties
 line 139:

> 137:         EncodingByteOrderUnsupported = Given byte order for encoding 
> \"{0}\" is not supported.
> 138:         InvalidByte = Invalid byte {0} of {1}-byte UTF-8 sequence.
> 139:         ExpectedByte = Expected byte {0} of {1}-byte UTF-8 
> sequence.\u0020\u0020

Same here as well, either a mistake or should be ` ExpectedByte = Expected byte 
{0} of {1}-byte UTF-8 sequence.\u0020`

src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/msg/XMLMessages.properties
 line 219:

> 217:         MSG_NOTATION_NAME_REQUIRED_FOR_UNPARSED_ENTITYDECL = The 
> notation name is required after \"NDATA\" in the declaration for the entity 
> \"{0}\".
> 218:         EntityDeclUnterminated = The declaration for the entity \"{0}\" 
> must end with ''>''.
> 219:  MSG_DUPLICATE_ENTITY_DEFINITION = Entity \"{0}\" is declared more than 
> once.\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020

Likely not intentional, but if it is then perhaps 
`MSG_DUPLICATE_ENTITY_DEFINITION = Entity "{0}" is declared more than 
once.\u0009` instead.

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

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

Reply via email to