BZ #114: ClassNotFoundException is thrown instead of NoClassDefFoundError for invokes

Status fields:

creation_ts:2008-10-28 15:26
component:vm
version:default branch
rep_platform:All
op_sys:All
bug_status:RESOLVED
resolution:FIXED
reporter:twisti@complang.tuwien.ac.at
The current output for an invoke on a missing class is:

$ cacao test
Exception in thread "main" java.lang.ClassNotFoundException: A not found in
java.lang.ClassLoader$1{urls=[file:/home/cthalinger/projects/cacao/./], parent=null}
   at java.net.URLClassLoader.findClass(URLClassLoader.java:531)
   at java.lang.ClassLoader.loadClass(ClassLoader.java:341)
   at java.lang.ClassLoader$1.loadClass(ClassLoader.java:1112)
   at java.lang.ClassLoader.loadClass(ClassLoader.java:293)
   at test.main(test.java:5)

but should be:

$ cacao test
Exception in thread "main" java.lang.NoClassDefFoundError: A not found in
java.lang.ClassLoader$1{urls=[file:/home/cthalinger/projects/cacao/./], parent=null}
   at test.main(test.java:5)
Caused by: java.lang.ClassNotFoundException: A not found in
java.lang.ClassLoader$1{urls=[file:/home/cthalinger/projects/cacao/./], parent=null}
   at java.net.URLClassLoader.findClass(URLClassLoader.java:531)
   at java.lang.ClassLoader.loadClass(ClassLoader.java:341)
   at java.lang.ClassLoader$1.loadClass(ClassLoader.java:1112)
   at java.lang.ClassLoader.loadClass(ClassLoader.java:293)
   at test.main(test.java:5)

Comment #1 by twisti@complang.tuwien.ac.at on 2008-10-28 15:35:34

Here is the fix and a JUnit test:

http://mips.complang.tuwien.ac.at/hg/cacao/rev/7eef6bc7910f
http://mips.complang.tuwien.ac.at/hg/cacao/rev/e961d5e1aafc