Merge pull request #212 from KpChuck/master

Don't throw a DecodeException if dex files aren't found but --no-src used
This commit is contained in:
skylot
2018-01-21 11:30:42 +03:00
committed by GitHub
2 changed files with 6 additions and 4 deletions
@@ -146,7 +146,7 @@ public final class JadxDecompiler {
inputFiles.clear();
for (File file : files) {
try {
InputFile.addFilesFrom(file, inputFiles);
InputFile.addFilesFrom(file, inputFiles, args.isSkipSources());
} catch (IOException e) {
throw new JadxException("Error load file: " + file, e);
}
@@ -32,9 +32,9 @@ public class InputFile {
private final File file;
private final List<DexFile> dexFiles = new ArrayList<DexFile>();
public static void addFilesFrom(File file, List<InputFile> list) throws IOException, DecodeException {
public static void addFilesFrom(File file, List<InputFile> list, boolean... skipSources) throws IOException, DecodeException {
InputFile inputFile = new InputFile(file);
inputFile.searchDexFiles();
inputFile.searchDexFiles(skipSources[0]);
list.add(inputFile);
}
@@ -45,7 +45,7 @@ public class InputFile {
this.file = file;
}
private void searchDexFiles() throws IOException, DecodeException {
private void searchDexFiles(boolean skipSources) throws IOException, DecodeException {
String fileName = file.getName();
if (fileName.endsWith(".dex")) {
@@ -75,6 +75,8 @@ public class InputFile {
}
return;
}
if (skipSources) return;
throw new DecodeException("Unsupported input file format: " + file);
}