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

Javac crashes with NullPointerException when finding unencoded XML in <pre> tag

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 17
    • 17
    • tools
    • openjdk version "17-ea" 2021-09-14
      OpenJDK Runtime Environment (build 17-ea+16-1315)
      OpenJDK 64-Bit Server VM (build 17-ea+16-1315, mixed mode, sharing)

    • b16
    • 17
    • b28
    • generic
    • generic

        When testing the Lucene/Solr builds with JDK 17 EA we figured out that javac fails when doclint is enabled. It produces the following error:

        common.compile-test:
            [mkdir] Created dir: C:\Users\Uwe Schindler\Projects\lucene\lusolr\solr\build\contrib\solr-dataimporthandler\classes\test
            [javac] Compiling 48 source files to C:\Users\Uwe Schindler\Projects\lucene\lusolr\solr\build\contrib\solr-dataimporthandler\classes\test
            [javac] Note: Some input files use or override a deprecated API.
            [javac] Note: Recompile with -Xlint:deprecation for details.
            [javac] An exception has occurred in the compiler (17-ea). Please file a bug against the Java compiler via the Java bug reporting page (http://bugreport.java.com) after checking the Bug Database (http://bugs.java.com) for duplicates. Include your program, the following diagnostic, and the parameters passed to the Java compiler in your report. Thank you.
            [javac] com.sun.tools.javac.util.ClientCodeException: java.lang.NullPointerException: Cannot read field "endKind" because "tag" is null
            [javac] at jdk.compiler/com.sun.tools.javac.api.ClientCodeWrapper$WrappedTaskListener.started(ClientCodeWrapper.java:857)
            [javac] at jdk.compiler/com.sun.tools.javac.api.MultiTaskListener.started(MultiTaskListener.java:119)
            [javac] at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.attribute(JavaCompiler.java:1336)
            [javac] at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:973)
            [javac] at jdk.compiler/com.sun.tools.javac.main.Main.compile(Main.java:317)
            [javac] at jdk.compiler/com.sun.tools.javac.main.Main.compile(Main.java:176)
            [javac] at jdk.compiler/com.sun.tools.javac.Main.compile(Main.java:64)
            [javac] at jdk.internal.reflect.GeneratedMethodAccessor217.invoke(Unknown Source)
            [javac] at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
            [javac] at java.base/java.lang.reflect.Method.invoke(Method.java:568)
            [javac] at org.apache.tools.ant.taskdefs.compilers.Javac13.execute(Javac13.java:56)
            [javac] at org.apache.tools.ant.taskdefs.Javac.compile(Javac.java:1153)
            [javac] at org.apache.tools.ant.taskdefs.Javac.execute(Javac.java:930)
            [javac] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
            [javac] at jdk.internal.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
            [javac] at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
            [javac] at java.base/java.lang.reflect.Method.invoke(Method.java:568)
            [javac] at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
            [javac] at org.apache.tools.ant.Task.perform(Task.java:348)
            [javac] at org.apache.tools.ant.taskdefs.Sequential.execute(Sequential.java:68)
            [javac] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
            [javac] at jdk.internal.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
            [javac] at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
            [javac] at java.base/java.lang.reflect.Method.invoke(Method.java:568)
            [javac] at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
            [javac] at org.apache.tools.ant.Task.perform(Task.java:348)
            [javac] at org.apache.tools.ant.taskdefs.MacroInstance.execute(MacroInstance.java:398)
            [javac] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
            [javac] at jdk.internal.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
            [javac] at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
            [javac] at java.base/java.lang.reflect.Method.invoke(Method.java:568)
            [javac] at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
            [javac] at org.apache.tools.ant.Task.perform(Task.java:348)
            [javac] at org.apache.tools.ant.taskdefs.Sequential.execute(Sequential.java:68)
            [javac] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
            [javac] at jdk.internal.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
            [javac] at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
            [javac] at java.base/java.lang.reflect.Method.invoke(Method.java:568)
            [javac] at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
            [javac] at org.apache.tools.ant.Task.perform(Task.java:348)
            [javac] at org.apache.tools.ant.taskdefs.MacroInstance.execute(MacroInstance.java:398)
            [javac] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
            [javac] at jdk.internal.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
            [javac] at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
            [javac] at java.base/java.lang.reflect.Method.invoke(Method.java:568)
            [javac] at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
            [javac] at org.apache.tools.ant.Task.perform(Task.java:348)
            [javac] at org.apache.tools.ant.Target.execute(Target.java:392)
            [javac] at org.apache.tools.ant.Target.performTasks(Target.java:413)
            [javac] at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1399)
            [javac] at org.apache.tools.ant.helper.SingleCheckExecutor.executeTargets(SingleCheckExecutor.java:38)
            [javac] at org.apache.tools.ant.Project.executeTargets(Project.java:1251)
            [javac] at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:442)
            [javac] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
            [javac] at jdk.internal.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
            [javac] at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
            [javac] at java.base/java.lang.reflect.Method.invoke(Method.java:568)
            [javac] at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
            [javac] at org.apache.tools.ant.Task.perform(Task.java:348)
            [javac] at org.apache.tools.ant.Target.execute(Target.java:392)
            [javac] at org.apache.tools.ant.Target.performTasks(Target.java:413)
            [javac] at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1399)
            [javac] at org.apache.tools.ant.helper.SingleCheckExecutor.executeTargets(SingleCheckExecutor.java:38)
            [javac] at org.apache.tools.ant.Project.executeTargets(Project.java:1251)
            [javac] at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:442)
            [javac] at org.apache.tools.ant.taskdefs.SubAnt.execute(SubAnt.java:303)
            [javac] at org.apache.tools.ant.taskdefs.SubAnt.execute(SubAnt.java:221)
            [javac] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
            [javac] at jdk.internal.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
            [javac] at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
            [javac] at java.base/java.lang.reflect.Method.invoke(Method.java:568)
            [javac] at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
            [javac] at org.apache.tools.ant.Task.perform(Task.java:348)
            [javac] at org.apache.tools.ant.taskdefs.Sequential.execute(Sequential.java:68)
            [javac] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
            [javac] at jdk.internal.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
            [javac] at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
            [javac] at java.base/java.lang.reflect.Method.invoke(Method.java:568)
            [javac] at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
            [javac] at org.apache.tools.ant.Task.perform(Task.java:348)
            [javac] at org.apache.tools.ant.taskdefs.MacroInstance.execute(MacroInstance.java:398)
            [javac] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
            [javac] at jdk.internal.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
            [javac] at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
            [javac] at java.base/java.lang.reflect.Method.invoke(Method.java:568)
            [javac] at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
            [javac] at org.apache.tools.ant.Task.perform(Task.java:348)
            [javac] at org.apache.tools.ant.Target.execute(Target.java:392)
            [javac] at org.apache.tools.ant.Target.performTasks(Target.java:413)
            [javac] at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1399)
            [javac] at org.apache.tools.ant.helper.SingleCheckExecutor.executeTargets(SingleCheckExecutor.java:38)
            [javac] at org.apache.tools.ant.Project.executeTargets(Project.java:1251)
            [javac] at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:442)
            [javac] at org.apache.tools.ant.taskdefs.SubAnt.execute(SubAnt.java:303)
            [javac] at org.apache.tools.ant.taskdefs.SubAnt.execute(SubAnt.java:221)
            [javac] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
            [javac] at jdk.internal.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
            [javac] at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
            [javac] at java.base/java.lang.reflect.Method.invoke(Method.java:568)
            [javac] at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
            [javac] at org.apache.tools.ant.Task.perform(Task.java:348)
            [javac] at org.apache.tools.ant.Target.execute(Target.java:392)
            [javac] at org.apache.tools.ant.Target.performTasks(Target.java:413)
            [javac] at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1399)
            [javac] at org.apache.tools.ant.Project.executeTarget(Project.java:1368)
            [javac] at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
            [javac] at org.apache.tools.ant.Project.executeTargets(Project.java:1251)
            [javac] at org.apache.tools.ant.Main.runBuild(Main.java:811)
            [javac] at org.apache.tools.ant.Main.startAnt(Main.java:217)
            [javac] at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280)
            [javac] at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109)
            [javac] Caused by: java.lang.NullPointerException: Cannot read field "endKind" because "tag" is null
            [javac] at jdk.javadoc/jdk.javadoc.internal.doclint.Checker.isSelfClosingAllowed(Checker.java:432)
            [javac] at jdk.javadoc/jdk.javadoc.internal.doclint.Checker.visitStartElement(Checker.java:389)
            [javac] at jdk.javadoc/jdk.javadoc.internal.doclint.Checker.visitStartElement(Checker.java:106)
            [javac] at jdk.compiler/com.sun.tools.javac.tree.DCTree$DCStartElement.accept(DCTree.java:862)
            [javac] at jdk.compiler/com.sun.source.util.DocTreePathScanner.scan(DocTreePathScanner.java:76)
            [javac] at jdk.compiler/com.sun.source.util.DocTreeScanner.scanAndReduce(DocTreeScanner.java:87)
            [javac] at jdk.compiler/com.sun.source.util.DocTreeScanner.scan(DocTreeScanner.java:102)
            [javac] at jdk.javadoc/jdk.javadoc.internal.doclint.Checker.visitDocComment(Checker.java:273)
            [javac] at jdk.javadoc/jdk.javadoc.internal.doclint.Checker.visitDocComment(Checker.java:106)
            [javac] at jdk.compiler/com.sun.tools.javac.tree.DCTree$DCDocComment.accept(DCTree.java:138)
            [javac] at jdk.compiler/com.sun.source.util.DocTreePathScanner.scan(DocTreePathScanner.java:55)
            [javac] at jdk.javadoc/jdk.javadoc.internal.doclint.Checker.scan(Checker.java:234)
            [javac] at jdk.javadoc/jdk.javadoc.internal.doclint.DocLint$2.visitDecl(DocLint.java:291)
            [javac] at jdk.javadoc/jdk.javadoc.internal.doclint.DocLint$DeclScanner.visitMethod(DocLint.java:405)
            [javac] at jdk.javadoc/jdk.javadoc.internal.doclint.DocLint$DeclScanner.visitMethod(DocLint.java:382)
            [javac] at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCMethodDecl.accept(JCTree.java:933)
            [javac] at jdk.compiler/com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:86)
            [javac] at jdk.compiler/com.sun.source.util.TreeScanner.scanAndReduce(TreeScanner.java:94)
            [javac] at jdk.compiler/com.sun.source.util.TreeScanner.scan(TreeScanner.java:109)
            [javac] at jdk.compiler/com.sun.source.util.TreeScanner.scanAndReduce(TreeScanner.java:117)
            [javac] at jdk.compiler/com.sun.source.util.TreeScanner.visitClass(TreeScanner.java:194)
            [javac] at jdk.javadoc/jdk.javadoc.internal.doclint.DocLint$DeclScanner.visitClass(DocLint.java:400)
            [javac] at jdk.javadoc/jdk.javadoc.internal.doclint.DocLint$DeclScanner.visitClass(DocLint.java:382)
            [javac] at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCClassDecl.accept(JCTree.java:840)
            [javac] at jdk.compiler/com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:86)
            [javac] at jdk.compiler/com.sun.source.util.TreeScanner.scan(TreeScanner.java:109)
            [javac] at jdk.compiler/com.sun.source.util.TreeScanner.scanAndReduce(TreeScanner.java:117)
            [javac] at jdk.compiler/com.sun.source.util.TreeScanner.visitCompilationUnit(TreeScanner.java:148)
            [javac] at jdk.javadoc/jdk.javadoc.internal.doclint.DocLint$DeclScanner.visitCompilationUnit(DocLint.java:426)
            [javac] at jdk.javadoc/jdk.javadoc.internal.doclint.DocLint$DeclScanner.visitCompilationUnit(DocLint.java:382)
            [javac] at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCCompilationUnit.accept(JCTree.java:611)
            [javac] at jdk.compiler/com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:86)
            [javac] at jdk.javadoc/jdk.javadoc.internal.doclint.DocLint$3.started(DocLint.java:302)
            [javac] at jdk.compiler/com.sun.tools.javac.api.ClientCodeWrapper$WrappedTaskListener.started(ClientCodeWrapper.java:853)
            [javac] ... 110 more
            [javac] printing javac parameters to: C:\Users\Uwe Schindler\Projects\lucene\lusolr\javac.20210407_134918.args

        The relevant command line args are:
        -Xdoclint:all -Xdoclint:-missing -Xdoclint:-accessibility -Xdoclint:-html

        It happens with the following (invalid) Javadoc comment:

          /**
           * Creates randomized configuration of a specified depth. Simple configuration example:
           *
           * <pre>
           *
           * &lt;dataConfig>
           * <dataSource type="MockDataSource" />
           * &lt;document>
           * &lt;entity name="parent" query="SELECT * FROM parent">
           * &lt;field column="id" />
           * &lt;field column="desc" />
           * &lt;field column="type_s" />
           * &lt;entity child="true" name="parentChild0" query="select * from parentChild0 where parentChild0_parent_id='${parent.id}'">
           * &lt;field column="id" />
           * &lt;field column="desc" />
           * &lt;field column="type_s" />
           * &lt;entity child="true" name="parentChild0Child0" query="select * from parentChild0Child0 where parentChild0Child0_parent_id='${parentChild0.id}'">
           * &lt;field column="id" />
           * &lt;field column="desc" />
           * &lt;field column="type_s" />
           * &lt;/entity>
           * &lt;entity child="true" name="parentChild0Child1" query="select * from parentChild0Child1 where parentChild0Child1_parent_id='${parentChild0.id}'">
           * &lt;field column="id" />
           * &lt;field column="desc" />
           * &lt;field column="type_s" />
           * &lt;/entity>
           * &lt;/entity>
           * &lt;entity child="true" name="parentChild1" query="select * from parentChild1 where parentChild1_parent_id='${parent.id}'">
           * &lt;field column="id" />
           * &lt;field column="desc" />
           * &lt;field column="type_s" />
           * &lt;entity child="true" name="parentChild1Child0" query="select * from parentChild1Child0 where parentChild1Child0_parent_id='${parentChild1.id}'">
           * &lt;field column="id" />
           * &lt;field column="desc" />
           * &lt;field column="type_s" />
           * &lt;/entity>
           * &lt;entity child="true" name="parentChild1Child1" query="select * from parentChild1Child1 where parentChild1Child1_parent_id='${parentChild1.id}'">
           * &lt;field column="id" />
           * &lt;field column="desc" />
           * &lt;field column="type_s" />
           * &lt;/entity>
           * &lt;/entity>
           * &lt;/entity>
           * &lt;/document>
           * &lt;/dataConfig>
           *
           * </pre>
           *
           * Internally configures MockDataSource.
           **/

        Please take special care on the following line:

           * <dataSource type="MockDataSource" />

        If you escape the XML, it does not cause NPE.

              jjg Jonathan Gibbons
              uschindler Uwe Schindler
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Created:
                Updated:
                Resolved: