Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6203483

apt fails to catch errors thrown by a ClassLoader when loading a factory

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 6
    • 6
    • tools
    • apt
    • b25
    • generic
    • generic

        The following results in a uncaught error from apt:

        mkdir foo
        touch foo/bar.class
        apt -factory foo/bar

        An exception has occurred in apt (1.5.0_01). Please file a bug at the Java Developer Connection (http://java.sun.com/webapps/bugreport) after checking the Bug Parade for duplicates. Include your program and the following diagnostic in your report. Thank you.
        java.lang.NoClassDefFoundError: IllegalName: foo/bar
                at java.lang.ClassLoader.preDefineClass(ClassLoader.java:476)
                at java.lang.ClassLoader.defineClass(ClassLoader.java:614)
                at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
                at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
                at java.net.URLClassLoader.access$100(URLClassLoader.java:56)
                at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
                at java.security.AccessController.doPrivileged(Native Method)
                at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
                at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
                at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
                at com.sun.tools.apt.comp.Apt.main(Apt.java:287)
                at com.sun.tools.apt.main.JavaCompiler.compile(JavaCompiler.java:458)
                at com.sun.tools.apt.main.Main.compile(Main.java:1075)
                at com.sun.tools.apt.main.Main.compile(Main.java:938)
                at com.sun.tools.apt.Main.processing(Main.java:95)
                at com.sun.tools.apt.Main.process(Main.java:43)
                at com.sun.tools.apt.Main.main(Main.java:34)

        The cause is the catch blocks for

        AnnotationProcessorFactory factory =
        (AnnotationProcessorFactory) (aptCL.loadClass(factoryName).newInstance());
        list.add(factory);

        do not check for the NoClassDefFoundError that can be thrown by the classloader.


              darcy Joe Darcy
              darcy Joe Darcy
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: