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
This commit is contained in:
JesusFreke@JesusFreke.com 2010-03-04 07:44:08 +00:00
parent 6786055f35
commit 74eeca35f7

View File

@ -115,7 +115,12 @@ public class ClassPath {
bootClassPathEntry + "\"."); bootClassPathEntry + "\".");
} }
loadDexFile(dexFile); try {
loadDexFile(dexFile);
} catch (Exception ex) {
throw ExceptionWithContext.withContext(ex,
String.format("Error while loading boot classpath entry %s", bootClassPathEntry));
}
return; return;
} }
throw new ExceptionWithContext(String.format("Cannot locate boot class path file %s", bootClassPathEntry)); 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) { private void loadDexFile(DexFile dexFile) {
for (ClassDefItem classDefItem: dexFile.ClassDefsSection.getItems()) { for (ClassDefItem classDefItem: dexFile.ClassDefsSection.getItems()) {
//TODO: need to check if the class already exists. (and if so, what to do about it?) try {
ClassDef classDef = new ClassDef(classDefItem); //TODO: need to check if the class already exists. (and if so, what to do about it?)
classDefs.put(classDef.getClassType(), classDef); ClassDef classDef = new ClassDef(classDefItem);
classDefs.put(classDef.getClassType(), classDef);
if (classDefItem.getClassType().getTypeDescriptor().equals("Ljava/lang/Object;")) { if (classDefItem.getClassType().getTypeDescriptor().equals("Ljava/lang/Object;")) {
theClassPath.javaLangObjectClassDef = classDef; theClassPath.javaLangObjectClassDef = classDef;
}
} catch (Exception ex) {
throw ExceptionWithContext.withContext(ex, String.format("Error while loading class %s",
classDefItem.getClassType().getTypeDescriptor()));
} }
} }
} }