RFR: 4890732: GZIPOutputStream doesn't support, in fact thwarts, use of optional GZIP fields [v3]
Lin Zang
lzang at openjdk.java.net
Fri Mar 26 02:54:28 UTC 2021
On Mon, 22 Mar 2021 20:18:37 GMT, Lance Andersen <lancea at openjdk.org> wrote:
>> Lin Zang has updated the pull request incrementally with two additional commits since the last revision:
>>
>> - update copyright
>> - reuse arguments constructor for non-argument one.
>
> src/java.base/share/classes/java/util/zip/GZIPOutputStream.java line 357:
>
>> 355: */
>> 356: out.write(fileComment);
>> 357: out.write(0);
>
> The RFC states:
>
> If FCOMMENT is set, a zero-terminated file comment is
> present. This comment is not interpreted; it is only
> intended for human consumption. The comment must consist of
> ISO 8859-1 (LATIN-1) characters. Line breaks should be
> denoted by a single line feed character (10 decimal).
>
>
> So should the characters be validates as well as line breaks?
Same as file name , I think it is the users responsibility to pass the right encoded String as an argument. if constructor is designed to accept a String here, I think it can decode to byte array with ISO 8859-1, and then write to the header.
Moreover,I can't figure out a way to testing the encoding information of the String, do you have any clue about validate it?
-------------
PR: https://git.openjdk.java.net/jdk/pull/3072
More information about the core-libs-dev
mailing list