mirror of
https://github.com/iBotPeaches/Apktool.git
synced 2024-11-23 04:30:04 +00:00
Resolve a resource leak where the ZipFile is not closed (#3618)
If th zip entry for resources.arsc is not found an exception is thrown, but the ZipFile is not closed. Using try-with-resources means that the ZipFile will always be closed irrespective of how the code block exits.
This commit is contained in:
parent
4d857dbff4
commit
c294e014e0
@ -52,8 +52,7 @@ public class Framework {
|
||||
public void installFramework(File frameFile, String tag) throws AndrolibException {
|
||||
InputStream in = null;
|
||||
ZipOutputStream out = null;
|
||||
try {
|
||||
ZipFile zip = new ZipFile(frameFile);
|
||||
try(ZipFile zip = new ZipFile(frameFile)) {
|
||||
ZipEntry entry = zip.getEntry("resources.arsc");
|
||||
|
||||
if (entry == null) {
|
||||
@ -98,7 +97,6 @@ public class Framework {
|
||||
out.closeEntry();
|
||||
}
|
||||
|
||||
zip.close();
|
||||
LOGGER.info("Framework installed to: " + outFile);
|
||||
} catch (IOException ex) {
|
||||
throw new AndrolibException(ex);
|
||||
|
Loading…
Reference in New Issue
Block a user