Clean up DexInputCommand a bit

This commit is contained in:
Ben Gruver 2016-09-18 11:16:58 -07:00
parent 12a3fd2712
commit 7e8afc4d8a

View File

@ -112,10 +112,9 @@ public abstract class DexInputCommand extends Command {
System.exit(1); System.exit(1);
} }
File dexFile = file;
String dexEntry = null; String dexEntry = null;
if (dexFile.getPath().length() < input.length()) { if (file.getPath().length() < input.length()) {
dexEntry = input.substring(dexFile.getPath().length() + 1); dexEntry = input.substring(file.getPath().length() + 1);
} }
if (!Strings.isNullOrEmpty(dexEntry)) { if (!Strings.isNullOrEmpty(dexEntry)) {
@ -126,14 +125,13 @@ public abstract class DexInputCommand extends Command {
} }
try { try {
return DexFileFactory.loadDexEntry(dexFile, dexEntry, exactMatch, return DexFileFactory.loadDexEntry(file, dexEntry, exactMatch, Opcodes.forApi(apiLevel));
Opcodes.forApi(apiLevel));
} catch (IOException ex) { } catch (IOException ex) {
throw new RuntimeException(ex); throw new RuntimeException(ex);
} }
} else { } else {
try { try {
return DexFileFactory.loadDexFile(dexFile, Opcodes.forApi(apiLevel)); return DexFileFactory.loadDexFile(file, Opcodes.forApi(apiLevel));
} catch (IOException ex) { } catch (IOException ex) {
throw new RuntimeException(ex); throw new RuntimeException(ex);
} }