Skip to content

Commit ebdf389

Browse files
committed
Add dex2jar exception handler
1 parent 555d68a commit ebdf389

1 file changed

Lines changed: 14 additions & 1 deletion

File tree

  • src/main/java/the/bytecode/club/bytecodeviewer/util

src/main/java/the/bytecode/club/bytecodeviewer/util/Dex2Jar.java

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
package the.bytecode.club.bytecodeviewer.util;
22

33
import com.googlecode.d2j.dex.Dex2jar;
4+
import com.googlecode.d2j.dex.DexExceptionHandler;
5+
import com.googlecode.d2j.Method;
6+
import com.googlecode.d2j.node.DexMethodNode;
7+
import org.objectweb.asm.MethodVisitor;
48
import java.io.File;
59
import the.bytecode.club.bytecodeviewer.BytecodeViewer;
610

@@ -38,7 +42,16 @@ public class Dex2Jar {
3842
*/
3943
public static synchronized void dex2Jar(File input, File output) {
4044
try {
41-
Dex2jar d2Jar = Dex2jar.from(input);
45+
Dex2jar d2Jar = Dex2jar.from(input)
46+
.withExceptionHandler(new DexExceptionHandler() {
47+
public void handleFileException(Exception e) {
48+
e.printStackTrace();
49+
}
50+
51+
public void handleMethodTranslateException(Method method, DexMethodNode methodNode, MethodVisitor mv, Exception e) {
52+
e.printStackTrace();
53+
}
54+
});
4255
d2Jar.to(output.toPath());
4356
} catch (com.googlecode.d2j.DexException e) {
4457
e.printStackTrace();

0 commit comments

Comments
 (0)