Skip to content

Commit

Permalink
Add dex2jar exception handler
Browse files Browse the repository at this point in the history
  • Loading branch information
ThexXTURBOXx committed Jul 20, 2023
1 parent 555d68a commit ebdf389
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/main/java/the/bytecode/club/bytecodeviewer/util/Dex2Jar.java
Original file line number Diff line number Diff line change
@@ -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;

Expand Down Expand Up @@ -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();
Expand Down

0 comments on commit ebdf389

Please sign in to comment.