mirror of
https://github.com/revanced/Apktool.git
synced 2025-02-14 12:56:46 +01:00
Ensure the stream is closed in DexFileFactory.loadDexFile
This commit is contained in:
parent
f803a08711
commit
91a47123bf
@ -102,19 +102,22 @@ public final class DexFileFactory {
|
||||
}
|
||||
|
||||
InputStream inputStream = new BufferedInputStream(new FileInputStream(dexFile));
|
||||
|
||||
try {
|
||||
return DexBackedDexFile.fromInputStream(opcodes, inputStream);
|
||||
} catch (DexBackedDexFile.NotADexFile ex) {
|
||||
// just eat it
|
||||
}
|
||||
try {
|
||||
return DexBackedDexFile.fromInputStream(opcodes, inputStream);
|
||||
} catch (DexBackedDexFile.NotADexFile ex) {
|
||||
// just eat it
|
||||
}
|
||||
|
||||
// Note: DexBackedDexFile.fromInputStream will reset inputStream back to the same position, if it fails
|
||||
// Note: DexBackedDexFile.fromInputStream will reset inputStream back to the same position, if it fails
|
||||
|
||||
try {
|
||||
return DexBackedOdexFile.fromInputStream(opcodes, inputStream);
|
||||
} catch (DexBackedOdexFile.NotAnOdexFile ex) {
|
||||
// just eat it
|
||||
try {
|
||||
return DexBackedOdexFile.fromInputStream(opcodes, inputStream);
|
||||
} 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());
|
||||
|
Loading…
x
Reference in New Issue
Block a user