RFR: JDK-8261237: isClassPathAttributePresent use try with resources with JarFile [v2]

Matthias Baesken mbaesken at openjdk.java.net
Tue Feb 9 08:30:54 UTC 2021


> Hello,
> Currently in jdk/internal/vm/VMSupport.java , we create a JarFile without a related finally clause or try with resources. That should better be changed.
> See also the Sonar check result :
> 
> https://sonarcloud.io/project/issues?id=shipilev_jdk&languages=java&open=AXcqM8zf8sPJZZzON5qG&resolved=false&severities=BLOCKER&types=BUG
> 
>     public static boolean isClassPathAttributePresent(String path) {
>         try {
>             Manifest man = (new JarFile(path)).getManifest();
> Use try-with-resources or close this "JarFile" in a "finally" clause.

Matthias Baesken has updated the pull request incrementally with one additional commit since the last revision:

  Remove isClassPathAttributePresent

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

Changes:
  - all: https://git.openjdk.java.net/jdk/pull/2429/files
  - new: https://git.openjdk.java.net/jdk/pull/2429/files/f90aa961..1fc9b8c7

Webrevs:
 - full: https://webrevs.openjdk.java.net/?repo=jdk&pr=2429&range=01
 - incr: https://webrevs.openjdk.java.net/?repo=jdk&pr=2429&range=00-01

  Stats: 19 lines in 1 file changed: 0 ins; 19 del; 0 mod
  Patch: https://git.openjdk.java.net/jdk/pull/2429.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/2429/head:pull/2429

PR: https://git.openjdk.java.net/jdk/pull/2429


More information about the core-libs-dev mailing list