mirror of
https://github.com/revanced/smali.git
synced 2025-05-11 11:54:29 +02:00
Close all smali files after it is finished writing to them.
This is important for instances where smali is invoked through the run method instead of main.
This commit is contained in:
parent
7079014a29
commit
8f6f59cc66
17
smali/src/main/java/org/jf/smali/main.java
Normal file → Executable file
17
smali/src/main/java/org/jf/smali/main.java
Normal file → Executable file
@ -308,16 +308,15 @@ public class main {
|
||||
|
||||
private static boolean assembleSmaliFile(File smaliFile, DexBuilder dexBuilder, SmaliOptions options)
|
||||
throws Exception {
|
||||
CommonTokenStream tokens;
|
||||
FileInputStream fis = null;
|
||||
|
||||
LexerErrorInterface lexer;
|
||||
|
||||
FileInputStream fis = new FileInputStream(smaliFile);
|
||||
try {
|
||||
fis = new FileInputStream(smaliFile);
|
||||
InputStreamReader reader = new InputStreamReader(fis, "UTF-8");
|
||||
|
||||
lexer = new smaliFlexLexer(reader);
|
||||
LexerErrorInterface lexer = new smaliFlexLexer(reader);
|
||||
((smaliFlexLexer)lexer).setSourceFile(smaliFile);
|
||||
tokens = new CommonTokenStream((TokenSource)lexer);
|
||||
CommonTokenStream tokens = new CommonTokenStream((TokenSource)lexer);
|
||||
|
||||
if (options.printTokens) {
|
||||
tokens.getTokens();
|
||||
@ -360,8 +359,12 @@ public class main {
|
||||
dexGen.setVerboseErrors(options.verboseErrors);
|
||||
dexGen.setDexBuilder(dexBuilder);
|
||||
dexGen.smali_file();
|
||||
|
||||
return dexGen.getNumberOfSyntaxErrors() == 0;
|
||||
} finally {
|
||||
if (fis != null) {
|
||||
fis.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user