diff options
author | Ben Gruver <bgruv@google.com> | 2015-04-05 12:17:15 -0700 |
---|---|---|
committer | Ben Gruver <bgruv@google.com> | 2015-04-09 21:33:33 -0700 |
commit | abd113eb3b0c564745c423b3c6460154ea0cda62 (patch) | |
tree | 514cb4b9e29f39fcf59895150b2abe9aa46b3313 /dexlib2/src | |
parent | 0a26ac2e5bb0e8eea515da6ccb18980b5a3c51c5 (diff) | |
download | smali-abd113eb3b0c564745c423b3c6460154ea0cda62.tar.gz |
Ensure the stream is closed in DexFileFactory.loadDexFile
Diffstat (limited to 'dexlib2/src')
-rw-r--r-- | dexlib2/src/main/java/org/jf/dexlib2/DexFileFactory.java | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/dexlib2/src/main/java/org/jf/dexlib2/DexFileFactory.java b/dexlib2/src/main/java/org/jf/dexlib2/DexFileFactory.java index 85f8a426..a1ddee2e 100644 --- a/dexlib2/src/main/java/org/jf/dexlib2/DexFileFactory.java +++ b/dexlib2/src/main/java/org/jf/dexlib2/DexFileFactory.java @@ -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()); |