RFR: 8259867: Move encoding checks into ZipCoder
ZipFile.Source.initCEN verifies that entry names are encoding into bytes valid in the entry's encoding. It does so by calling encoding-specific checking methods, so it also needs to determine which check method to call for each entry. By moving the encoding-variant checks into ZipCoder, initCEN can instead simply call ZipCoder.checkEncoding. This makes the code easier to follow and also removes a duplication of flag checking logic found in zipCoderForPos. ------------- Commit messages: - 8242959: Move name encoding checks to ZipCoder (cleanup) Changes: https://git.openjdk.java.net/jdk/pull/2110/files Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=2110&range=00 Issue: https://bugs.openjdk.java.net/browse/JDK-8259867 Stats: 58 lines in 2 files changed: 27 ins; 28 del; 3 mod Patch: https://git.openjdk.java.net/jdk/pull/2110.diff Fetch: git fetch https://git.openjdk.java.net/jdk pull/2110/head:pull/2110 PR: https://git.openjdk.java.net/jdk/pull/2110
On Sat, 16 Jan 2021 17:49:38 GMT, eirbjo <github.com+300291+eirbjo@openjdk.org> wrote:
ZipFile.Source.initCEN verifies that entry names are encoding into bytes valid in the entry's encoding. It does so by calling encoding-specific checking methods, so it also needs to determine which check method to call for each entry.
By moving the encoding-variant checks into ZipCoder, initCEN can instead simply call ZipCoder.checkEncoding. This makes the code easier to follow and also removes a duplication of flag checking logic found in zipCoderForPos.
Welcome back! Patch looks good to me. I'll sponsor it after allowing some time for other reviewers to have a look. ------------- Marked as reviewed by redestad (Reviewer). PR: https://git.openjdk.java.net/jdk/pull/2110
On Sat, 16 Jan 2021 17:49:38 GMT, eirbjo <github.com+300291+eirbjo@openjdk.org> wrote:
ZipFile.Source.initCEN verifies that entry names are encoding into bytes valid in the entry's encoding. It does so by calling encoding-specific checking methods, so it also needs to determine which check method to call for each entry.
By moving the encoding-variant checks into ZipCoder, initCEN can instead simply call ZipCoder.checkEncoding. This makes the code easier to follow and also removes a duplication of flag checking logic found in zipCoderForPos.
The change looks good to me as well ------------- Marked as reviewed by lancea (Reviewer). PR: https://git.openjdk.java.net/jdk/pull/2110
On Sat, 16 Jan 2021 17:49:38 GMT, eirbjo <github.com+300291+eirbjo@openjdk.org> wrote:
ZipFile.Source.initCEN verifies that entry names are encoding into bytes valid in the entry's encoding. It does so by calling encoding-specific checking methods, so it also needs to determine which check method to call for each entry.
By moving the encoding-variant checks into ZipCoder, initCEN can instead simply call ZipCoder.checkEncoding. This makes the code easier to follow and also removes a duplication of flag checking logic found in zipCoderForPos.
This pull request has now been integrated. Changeset: 05294802 Author: Eirik Bjorsnos <eirbjo@gmail.com> Committer: Claes Redestad <redestad@openjdk.org> URL: https://git.openjdk.java.net/jdk/commit/05294802 Stats: 58 lines in 2 files changed: 27 ins; 28 del; 3 mod 8259867: Move encoding checks into ZipCoder Reviewed-by: redestad, lancea ------------- PR: https://git.openjdk.java.net/jdk/pull/2110
participants (3)
-
Claes Redestad
-
eirbjo
-
Lance Andersen