Add dex2jar exception handler
This commit is contained in:
parent
555d68ab42
commit
ebdf389724
1 changed files with 14 additions and 1 deletions
|
@ -1,6 +1,10 @@
|
|||
package the.bytecode.club.bytecodeviewer.util;
|
||||
|
||||
import com.googlecode.d2j.dex.Dex2jar;
|
||||
import com.googlecode.d2j.dex.DexExceptionHandler;
|
||||
import com.googlecode.d2j.Method;
|
||||
import com.googlecode.d2j.node.DexMethodNode;
|
||||
import org.objectweb.asm.MethodVisitor;
|
||||
import java.io.File;
|
||||
import the.bytecode.club.bytecodeviewer.BytecodeViewer;
|
||||
|
||||
|
@ -38,7 +42,16 @@ public class Dex2Jar {
|
|||
*/
|
||||
public static synchronized void dex2Jar(File input, File output) {
|
||||
try {
|
||||
Dex2jar d2Jar = Dex2jar.from(input);
|
||||
Dex2jar d2Jar = Dex2jar.from(input)
|
||||
.withExceptionHandler(new DexExceptionHandler() {
|
||||
public void handleFileException(Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
public void handleMethodTranslateException(Method method, DexMethodNode methodNode, MethodVisitor mv, Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
});
|
||||
d2Jar.to(output.toPath());
|
||||
} catch (com.googlecode.d2j.DexException e) {
|
||||
e.printStackTrace();
|
||||
|
|
Loading…
Reference in a new issue