Skip to content

Commit

Permalink
Use try-with-resources
Browse files Browse the repository at this point in the history
  • Loading branch information
Marcono1234 committed Sep 7, 2024
1 parent c8606b9 commit 8654107
Showing 1 changed file with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -160,11 +160,12 @@ private ManifestData findManifest(String bundleName) throws IOException {
Collections.list(getClass().getClassLoader().getResources("META-INF/MANIFEST.MF"));

for (URL manifestResource : manifestResources) {
InputStream is = manifestResource.openStream();
Manifest mf = new Manifest(is);
is.close();
if (bundleName.equals(mf.getMainAttributes().getValue("Bundle-SymbolicName"))) {
return new ManifestData(manifestResource, mf);
Manifest manifest;
try (InputStream is = manifestResource.openStream()) {
manifest = new Manifest(is);
}
if (bundleName.equals(manifest.getMainAttributes().getValue("Bundle-SymbolicName"))) {
return new ManifestData(manifestResource, manifest);
}
}

Expand Down

0 comments on commit 8654107

Please sign in to comment.