Skip to content

Commit

Permalink
Correctly handle file closes.
Browse files Browse the repository at this point in the history
  • Loading branch information
Fohlen committed Jan 27, 2021
1 parent 8d33dde commit 00e10b5
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.yworks.util.abstractjar.Archive;
import com.yworks.util.abstractjar.Entry;

import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
Expand Down Expand Up @@ -59,10 +60,9 @@ public Enumeration<Entry> getEntries() {
public Manifest getManifest() throws IOException {
File manifestFile = new File(directory, JarFile.MANIFEST_NAME);
if (manifestFile.exists()) {
FileInputStream manifestStream = new FileInputStream(manifestFile);
Manifest manifest = new Manifest(manifestStream);
manifestStream.close();
return manifest;
try (BufferedInputStream is = new BufferedInputStream(new FileInputStream(manifestFile))) {
return new Manifest(is);
}
}
return null;
}
Expand Down

0 comments on commit 00e10b5

Please sign in to comment.