Skip to content

Commit

Permalink
6714834: JarFile.getManifest() leaves an open InputStream as an undoc…
Browse files Browse the repository at this point in the history
…umented side effect

Reviewed-by: lancea, alanb
  • Loading branch information
jaikiran authored and Lance Andersen committed Sep 16, 2020
1 parent e5866aa commit 671dfba
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/java.base/share/classes/java/util/jar/JarFile.java
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,9 @@ private Manifest getManifestFromReference() throws IOException {
}
man = new Manifest(jv, new ByteArrayInputStream(b), getName());
} else {
man = new Manifest(super.getInputStream(manEntry), getName());
try (InputStream is = super.getInputStream(manEntry)) {
man = new Manifest(is, getName());
}
}
manRef = new SoftReference<>(man);
}
Expand Down

1 comment on commit 671dfba

@bridgekeeper
Copy link

@bridgekeeper bridgekeeper bot commented on 671dfba Sep 16, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.