6714834: JarFile.getManifest() leaves an open InputStream as an undocumented side effect

Reviewed-by: lancea, alanb
This commit is contained in:
Jaikiran Pai 2020-09-16 15:13:32 +00:00 committed by Lance Andersen
parent e5866aa756
commit 671dfba802

View File

@ -423,7 +423,9 @@ public class JarFile extends ZipFile {
}
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);
}