RFR: 8321156: Improve the handling of invalid UTF-8 byte sequences for ZipInputStream::getNextEntry and ZipFile::getComment [v2]
Jaikiran Pai
jpai at openjdk.org
Sun Feb 25 12:22:53 UTC 2024
On Sat, 24 Feb 2024 18:54:07 GMT, Lance Andersen <lancea at openjdk.org> wrote:
>> Please review this PR which addresses the handling of invalid UTF-8 byte sequences in the entry name of a LOC file header and a Zip file comment which is returned via ZipFile::getComment.
>>
>> As part of the change, `ZipFile::getComment` will now return `null` if an invalid UTF-8 byte sequence is encountered while converting the byte array to a String. The CSR for this change has also been approved.
>>
>> Mach5 tiers 1-3 are clean with this change.
>
> Lance Andersen has updated the pull request incrementally with one additional commit since the last revision:
>
> Updates based on 1st round of feedback
Hello Lance, the changes look fine to me. `ZipFile.java` file will need a copyright year update.
test/jdk/java/util/zip/ZipFile/InvalidBytesInEntryNameOrComment.java line 189:
> 187: try (ZipFile zf = new ZipFile(ZIP_FILE.toFile())) {
> 188: var comment = zf.getComment();
> 189: System.out.printf("Comment= %s%n", comment);
Should we assert for the valid expected `comment` here?
-------------
Marked as reviewed by jpai (Reviewer).
PR Review: https://git.openjdk.org/jdk/pull/17995#pullrequestreview-1899665517
PR Review Comment: https://git.openjdk.org/jdk/pull/17995#discussion_r1501808997
More information about the core-libs-dev
mailing list