RFR(S) 8020675: Trying to print to a pdf file with PDFill PDF&Image Writer 10.0 Build 4

Calvin Cheung calvin.cheung at oracle.com
Wed Aug 7 17:25:57 PDT 2013


Please review this small fix for fixing a fatal error in 
~ExceptionMark() triggered by ClassNotFoundException in 
ClassLoader::create_class_path_entry(). I could reproduce similar crash 
by trying to load a class from an empty jar which is in the 
bootclasspath. The following program can trigger the crash if the 
jce.jar is invalid (e.g. 0-byte):

public class TestForName {
     public static void main(String[] args) {
         try {
             Class cls = Class.forName("javax.crypto.KeyGenerator");
             System.out.println("Class = " + cls.getName());
         } catch (ClassNotFoundException cnfe) {
             cnfe.printStackTrace();
         }
     }
}

The fix also changes the assert() in LazyClassPathEntry::resolve_entry() 
to a NULL check. Otherwise, the assert() will fail under the above test 
scenario.

With the fix, the following ClassNotFoundException will be thrown 
instead of a crash:
java.lang.ClassNotFoundException: javax.crypto.KeyGenerator
         at java.net.URLClassLoader$1.run(URLClassLoader.java:365)
         at java.net.URLClassLoader$1.run(URLClassLoader.java:354)
         at java.security.AccessController.doPrivileged(Native Method)
         at java.net.URLClassLoader.findClass(URLClassLoader.java:353)
         at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
         at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
         at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
         at java.lang.Class.forName0(Native Method)
         at java.lang.Class.forName(Class.java:258)
         at TestForName.main(TestForName.java:6)

webrev: http://cr.openjdk.java.net/~ccheung/8020675/webrev/

JBS: https://jbs.oracle.com/bugs/browse/JDK-8020675
bug: http://bugs.sun.com/view_bug.do?bug_id=8020675

Tests:
     jprt, vm.quick.testlist

thanks,
Calvin




More information about the hotspot-runtime-dev mailing list