summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2012-01-24 17:15:23 -0800
committerElliott Hughes <enh@google.com>2012-01-24 17:15:23 -0800
commita7679b67ca945194fa2442015e606cd250f0de2b (patch)
tree275b34ff004649c9bc223ae87a92bfe1a46f5068 /test
parent61a699e2ad3913ca76ba8f44c18f1bdf567c1f6f (diff)
downloadart-a7679b67ca945194fa2442015e606cd250f0de2b.zip
art-a7679b67ca945194fa2442015e606cd250f0de2b.tar.gz
art-a7679b67ca945194fa2442015e606cd250f0de2b.tar.bz2
Improve exceptions thrown during class loading.
We've always gone to a lot of trouble to have good detail messages when something goes wrong during class loading, but none of those exceptions would ever make it to the calling code. This adds missing exception chaining, and also adds a test for the case where a subclass is missing its superclass; before we'd have reported that the subclass was missing, but now we make it clear that the real error was an inability to find the superclass. Change-Id: I07ebc011ccdaed16be82bf08b323393e1d790989
Diffstat (limited to 'test')
-rw-r--r--test/003-omnibus-opcodes/expected.txt26
-rw-r--r--test/003-omnibus-opcodes/src/UnresClassSubclass.java4
-rw-r--r--test/003-omnibus-opcodes/src/UnresTest2.java9
3 files changed, 39 insertions, 0 deletions
diff --git a/test/003-omnibus-opcodes/expected.txt b/test/003-omnibus-opcodes/expected.txt
index 28b1813..746e702 100644
--- a/test/003-omnibus-opcodes/expected.txt
+++ b/test/003-omnibus-opcodes/expected.txt
@@ -68,6 +68,32 @@ Throw.rethrow
UnresTest1...
UnresTest1...
UnresTest2...
+java.lang.NoClassDefFoundError: Class "LUnresClass;" not found
+ at UnresTest2.run(UnresTest2.java:33)
+ at Main.run(Main.java:64)
+ at Main.main(Main.java:26)
+Caused by: java.lang.ClassNotFoundException: Didn't find class "UnresClass" on path: /data/art-test/003-omnibus-opcodes.jar
+ at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61)
+ at java.lang.ClassLoader.loadClass(ClassLoader.java:509)
+ at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
+ ... 3 more
+java.lang.NoClassDefFoundError: Class "LUnresClassSubclass;" not found
+ at UnresTest2.run(UnresTest2.java:41)
+ at Main.run(Main.java:64)
+ at Main.main(Main.java:26)
+Caused by: java.lang.NoClassDefFoundError: Class "LUnresClass;" not found
+ at dalvik.system.DexFile.defineClass(Native Method)
+ at dalvik.system.DexFile.loadClassBinaryName(DexFile.java:213)
+ at dalvik.system.DexPathList.findClass(DexPathList.java:315)
+ at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:58)
+ at java.lang.ClassLoader.loadClass(ClassLoader.java:509)
+ at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
+ ... 3 more
+Caused by: java.lang.ClassNotFoundException: Didn't find class "UnresClass" on path: /data/art-test/003-omnibus-opcodes.jar
+ at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61)
+ at java.lang.ClassLoader.loadClass(ClassLoader.java:509)
+ at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
+ ... 9 more
UnresTest2 done
InternedString.run
Done!
diff --git a/test/003-omnibus-opcodes/src/UnresClassSubclass.java b/test/003-omnibus-opcodes/src/UnresClassSubclass.java
new file mode 100644
index 0000000..601f2f5
--- /dev/null
+++ b/test/003-omnibus-opcodes/src/UnresClassSubclass.java
@@ -0,0 +1,4 @@
+public class UnresClassSubclass extends UnresClass {
+ public UnresClassSubclass() {
+ }
+}
diff --git a/test/003-omnibus-opcodes/src/UnresTest2.java b/test/003-omnibus-opcodes/src/UnresTest2.java
index f1e8dd1..c94f226 100644
--- a/test/003-omnibus-opcodes/src/UnresTest2.java
+++ b/test/003-omnibus-opcodes/src/UnresTest2.java
@@ -33,10 +33,19 @@ class UnresTest2 {
un = new UnresClass();
Main.assertTrue(false);
} catch (NoClassDefFoundError ncdfe) {
+ ncdfe.printStackTrace();
// good
}
try {
+ new UnresClassSubclass();
+ Main.assertTrue(false);
+ } catch (NoClassDefFoundError ncdfe) {
+ ncdfe.printStackTrace();
+ // good
+ }
+
+ try {
UnresClass[] uar = new UnresClass[3];
Main.assertTrue(false);
} catch (NoClassDefFoundError ncdfe) {