Skip to content

Commit

Permalink
fix: don't stop loading classes in case of an error (PR #764)
Browse files Browse the repository at this point in the history
* fix: don't stop loading classes in case of an error
* style: reformat code
  • Loading branch information
jpstotz authored and skylot committed Oct 15, 2019
1 parent bd9e109 commit 902247f
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion jadx-core/src/main/java/jadx/core/dex/nodes/DexNode.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@

import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.android.dex.ClassData;
import com.android.dex.ClassData.Method;
Expand All @@ -25,9 +27,11 @@
import jadx.core.dex.info.FieldInfo;
import jadx.core.dex.info.MethodInfo;
import jadx.core.dex.instructions.args.ArgType;
import jadx.core.utils.exceptions.JadxRuntimeException;
import jadx.core.utils.files.DexFile;

public class DexNode implements IDexNode {
private static final Logger LOG = LoggerFactory.getLogger(DexNode.class);

public static final int NO_INDEX = -1;

Expand All @@ -50,7 +54,12 @@ public DexNode(RootNode root, DexFile input, int dexId) {

public void loadClasses() {
for (ClassDef cls : dexBuf.classDefs()) {
addClassNode(new ClassNode(this, cls));
try {
addClassNode(new ClassNode(this, cls));
} catch (JadxRuntimeException e) {
// TODO: Add dummy class node displaying the error message
LOG.error("Class loading failed - {}", e.getMessage(), e);
}
}
// sort classes by name, expect top classes before inner
classes.sort(Comparator.comparing(ClassNode::getFullName));
Expand Down

0 comments on commit 902247f

Please sign in to comment.