RFR: 8339810: Cleanup the code in sun.tools.jar.Main to properly close resources and use ZipFile during extract [v2]

Jaikiran Pai jpai at openjdk.org
Tue Sep 10 06:17:39 UTC 2024


> Can I please get a review of this change which proposes to address https://bugs.openjdk.org/browse/JDK-8339810?
> 
> As noted in the issue we have a few places in the jar's tool `Main` class where we currently don't close the resources in a try/finally block. The commit in this PR updates the relevant places to use a try-with-resources. Additionally, in the extract() implementation of the `Main` class, we use the `ZipFile` when a JAR file is being extracted. This matches with what we do in the rest of the code in that `Main` class where a jar tool operation is a being run against a file.
> 
> No new test has been added given the nature of this change and existing tests in `test/jdk/tools/jar` continue to pass with this change. tier1, tier2 and tier3 testing is currently in progress.

Jaikiran Pai has updated the pull request incrementally with one additional commit since the last revision:

  Christian's review - array declaration style

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/20928/files
  - new: https://git.openjdk.org/jdk/pull/20928/files/a210cffd..adc68550

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=20928&range=01
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=20928&range=00-01

  Stats: 4 lines in 1 file changed: 0 ins; 0 del; 4 mod
  Patch: https://git.openjdk.org/jdk/pull/20928.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/20928/head:pull/20928

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


More information about the core-libs-dev mailing list