From 74eeca35f71abe4c722abac02a654f42a85d538d Mon Sep 17 00:00:00 2001 From: "JesusFreke@JesusFreke.com" Date: Thu, 4 Mar 2010 07:44:08 +0000 Subject: [PATCH] Add additional error context for errors that occur while loading the boot class path files git-svn-id: https://smali.googlecode.com/svn/trunk@668 55b6fa8a-2a1e-11de-a435-ffa8d773f76a --- .../jf/dexlib/Code/Analysis/ClassPath.java | 22 ++++++++++++++----- 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/dexlib/src/main/java/org/jf/dexlib/Code/Analysis/ClassPath.java b/dexlib/src/main/java/org/jf/dexlib/Code/Analysis/ClassPath.java index 24d2cd46..e77b610e 100644 --- a/dexlib/src/main/java/org/jf/dexlib/Code/Analysis/ClassPath.java +++ b/dexlib/src/main/java/org/jf/dexlib/Code/Analysis/ClassPath.java @@ -115,7 +115,12 @@ public class ClassPath { bootClassPathEntry + "\"."); } - loadDexFile(dexFile); + try { + loadDexFile(dexFile); + } catch (Exception ex) { + throw ExceptionWithContext.withContext(ex, + String.format("Error while loading boot classpath entry %s", bootClassPathEntry)); + } return; } throw new ExceptionWithContext(String.format("Cannot locate boot class path file %s", bootClassPathEntry)); @@ -123,12 +128,17 @@ public class ClassPath { private void loadDexFile(DexFile dexFile) { for (ClassDefItem classDefItem: dexFile.ClassDefsSection.getItems()) { - //TODO: need to check if the class already exists. (and if so, what to do about it?) - ClassDef classDef = new ClassDef(classDefItem); - classDefs.put(classDef.getClassType(), classDef); + try { + //TODO: need to check if the class already exists. (and if so, what to do about it?) + ClassDef classDef = new ClassDef(classDefItem); + classDefs.put(classDef.getClassType(), classDef); - if (classDefItem.getClassType().getTypeDescriptor().equals("Ljava/lang/Object;")) { - theClassPath.javaLangObjectClassDef = classDef; + if (classDefItem.getClassType().getTypeDescriptor().equals("Ljava/lang/Object;")) { + theClassPath.javaLangObjectClassDef = classDef; + } + } catch (Exception ex) { + throw ExceptionWithContext.withContext(ex, String.format("Error while loading class %s", + classDefItem.getClassType().getTypeDescriptor())); } } }