Commit b55975a3 authored by Skylot's avatar Skylot

core: reformat code and fix small issues in BinaryXMLParser

parent 4cb34394
......@@ -41,7 +41,6 @@ subprojects {
}
dependencies {
compile 'com.google.android:android:4.1.1.4'
compile 'org.slf4j:slf4j-api:1.7.7'
testCompile 'ch.qos.logback:logback-classic:1.1.2'
......
......@@ -8,17 +8,10 @@ import java.io.File;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
//import jadx.core.xmlgen.BinaryXMLParser;
public class JadxCLI {
private static final Logger LOG = LoggerFactory.getLogger(JadxCLI.class);
public static void main(String[] args) throws JadxException {
/*
BinaryXMLParser bxp = new BinaryXMLParser(args[0],args[1]);
bxp.parse();
System.exit(4);
*/
try {
JadxCLIArgs jadxArgs = new JadxCLIArgs();
if (processArgs(jadxArgs, args)) {
......
......@@ -47,7 +47,7 @@ public final class JadxCLIArgs implements IJadxArgs {
@Parameter(names = {"-h", "--help"}, description = "print this help", help = true)
protected boolean printHelp = false;
@Parameter(names = {"-x", "--xml"}, description = "try to decode the AndroidManifest.xml, save at current dir")
@Parameter(names = {"-x", "--xml"}, description = "try to decode the AndroidManifest.xml")
protected boolean xmlTest = false;
private final List<File> input = new ArrayList<File>(1);
......
......@@ -203,14 +203,17 @@ public final class JadxDecompiler {
reset();
root = new RootNode();
LOG.info("loading ...");
if(this.args.isXMLTest()) {
if (this.args.isXMLTest()) {
InputFile inf = inputFiles.get(0);
try {
BinaryXMLParser bxp = new BinaryXMLParser(InputFile.loadXMLBuffer(inf.getFile()), "./AndroidManifest.xml");
//BinaryXMLParser bxp = new BinaryXMLParser(InputFile.loadXMLBuffer(inf.getFile()), "AndroidManifest.xml");
bxp.parse();
} catch(IOException ioe) {
LOG.info("Decompiling AndroidManifest.xml failed!");
byte[] buffer = InputFile.loadXMLBuffer(inf.getFile());
if (buffer != null) {
File out = new File(args.getOutDir(), "AndroidManifest.xml");
BinaryXMLParser bxp = new BinaryXMLParser();
bxp.parse(buffer, out);
}
} catch (Exception e) {
LOG.info("Decompiling AndroidManifest.xml failed!", e);
}
}
root.load(inputFiles);
......
......@@ -77,7 +77,7 @@ public class InputFile {
public static byte[] loadXMLBuffer(File file) throws IOException { // FIXME: Public.. Please fix
ZipFile zf = new ZipFile(file);
ZipEntry xml = zf.getEntry("AndroidManifest.xml");
if(null == xml) {
if (xml == null) {
zf.close();
return null;
}
......@@ -91,7 +91,9 @@ public class InputFile {
bytesOut.write(buffer, 0, count);
}
} finally {
if(null != in) in.close();
if (null != in) {
in.close();
}
zf.close();
}
return bytesOut.toByteArray();
......
This source diff could not be displayed because it is too large. You can view the blob instead.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment