Ensure the stream is closed in DexFileFactory.loadDexFile

This commit is contained in:
Ben Gruver 2015-04-05 12:17:15 -07:00 committed by Connor Tumbleson
parent f803a08711
commit 91a47123bf

View File

@ -102,7 +102,7 @@ public final class DexFileFactory {
}
InputStream inputStream = new BufferedInputStream(new FileInputStream(dexFile));
try {
try {
return DexBackedDexFile.fromInputStream(opcodes, inputStream);
} catch (DexBackedDexFile.NotADexFile ex) {
@ -116,6 +116,9 @@ public final class DexFileFactory {
} catch (DexBackedOdexFile.NotAnOdexFile ex) {
// just eat it
}
} finally {
inputStream.close();
}
throw new ExceptionWithContext("%s is not an apk, dex file or odex file.", dexFile.getPath());
}