RFR: 8231640: (prop) Canonical property storage [v14]
Daniel Fuchs
dfuchs at openjdk.java.net
Tue Sep 14 13:31:13 UTC 2021
On Tue, 14 Sep 2021 13:24:55 GMT, Jaikiran Pai <jpai at openjdk.org> wrote:
>> src/java.base/share/classes/java/util/Properties.java line 822:
>>
>>> 820: * {@link System#lineSeparator() line separator} and if the next
>>> 821: * character in comments is not character {@code #} or character {@code !} then
>>> 822: * an ASCII {@code #} is written out after that line separator.
>>
>> Should something be done for comments ending with \ (backslash) ? It might otherwise suppress the first property assignment that follows.
>
> There has been no change in how we deal with this aspect. The existing specification (stated in the `load` method) says:
>
>
>> * Properties are processed in terms of lines. There are two
>> * kinds of line, <i>natural lines</i> and <i>logical lines</i>.
>> * A natural line is defined as a line of
>> * characters that is terminated either by a set of line terminator
>> * characters ({@code \n} or {@code \r} or {@code \r\n})
>> * or by the end of the stream. A natural line may be either a blank line,
>> * a comment line, or hold all or some of a key-element pair. A logical
>> * line holds all the data of a key-element pair, which may be spread
>> * out across several adjacent natural lines by escaping
>> * the line terminator sequence with a backslash character
>> * {@code }. **Note that a comment line cannot be extended
>> * in this manner;**
> (emphasis on that last sentence).
> I'll anyway go ahead and add new tests around this to be sure that this works as advertised.
Oh - great - thanks - verifying by a test that it also applies to the comment specified by `java.util.Properties.storeDate` would be good.
-------------
PR: https://git.openjdk.java.net/jdk/pull/5372
More information about the core-libs-dev
mailing list