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

doclet crashes with an empty package.html

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 10
    • 9
    • tools
    • None
    • 9
    • b15
    • generic
    • generic

      The doclet when it encounters a package.html with an empty body crashes in HtmlDocletWriter.java with the following stack trace:

      % javadoc -d /tmp/some.dir -sourcepath . pkg2
      .......
      javadoc: error - An internal exception has occurred.
      (java.util.NoSuchElementException)
      Please file a bug against the javadoc tool via the Java bug reporting page
      (http://bugreport.java.com) after checking the Bug Database (http://bugs.java.com)
      for duplicates. Include error messages and the following diagnostic in your report. Thank you.
      java.util.NoSuchElementException
      at java.base/java.util.ArrayList$Itr.next(ArrayList.java:894)
      at
      jdk.javadoc/jdk.javadoc.internal.doclets.formats.html.HtmlDocletWriter$2.visitComment(HtmlDocletWriter.java:1875)
      at jdk.javadoc/jdk.javadoc.internal.doclets.formats.html.HtmlDocletWriter$2.visitComment(HtmlDocletWriter.java:1797)
      at jdk.compiler/com.sun.tools.javac.tree.DCTree$DCComment.accept(DCTree.java:246)
      at jdk.compiler/com.sun.source.util.SimpleDocTreeVisitor.visit(SimpleDocTreeVisitor.java:79)
      at jdk.javadoc/jdk.javadoc.internal.doclets.formats.html.HtmlDocletWriter.commentTagsToContent(HtmlDocletWriter.java:2017)
      at jdk.javadoc/jdk.javadoc.internal.doclets.formats.html.HtmlDocletWriter.addCommentTags(HtmlDocletWriter.java:1719)
      at jdk.javadoc/jdk.javadoc.internal.doclets.formats.html.HtmlDocletWriter.addCommentTags(HtmlDocletWriter.java:1700)
      at jdk.javadoc/jdk.javadoc.internal.doclets.formats.html.HtmlDocletWriter.addSummaryComment(HtmlDocletWriter.java:1670)
      at jdk.javadoc/jdk.javadoc.internal.doclets.formats.html.HtmlDocletWriter.addSummaryComment(HtmlDocletWriter.java:1659)
      at jdk.javadoc/jdk.javadoc.internal.doclets.formats.html.AbstractIndexWriter.addDescription(AbstractIndexWriter.java:259)
      at jdk.javadoc/jdk.javadoc.internal.doclets.formats.html.AbstractIndexWriter$1.visitPackage(AbstractIndexWriter.java:196)
      at jdk.javadoc/jdk.javadoc.internal.doclets.formats.html.AbstractIndexWriter$1.visitPackage(AbstractIndexWriter.java:183)
      at jdk.compiler/com.sun.tools.javac.code.Symbol$PackageSymbol.accept(Symbol.java:1155)
      at java.compiler/javax.lang.model.util.AbstractElementVisitor6.visit(AbstractElementVisitor6.java:106)
      at jdk.javadoc/jdk.javadoc.internal.doclets.formats.html.AbstractIndexWriter.addDescription(AbstractIndexWriter.java:215)
      at jdk.javadoc/jdk.javadoc.internal.doclets.formats.html.AbstractIndexWriter.addContents(AbstractIndexWriter.java:115)
      at jdk.javadoc/jdk.javadoc.internal.doclets.formats.html.SingleIndexWriter.generateIndexFile(SingleIndexWriter.java:111)
      at jdk.javadoc/jdk.javadoc.internal.doclets.formats.html.SingleIndexWriter.generate(SingleIndexWriter.java:85)
      at jdk.javadoc/jdk.javadoc.internal.doclets.formats.html.HtmlDoclet.generateOtherFiles(HtmlDoclet.java:143)
      at jdk.javadoc/jdk.javadoc.internal.doclets.toolkit.AbstractDoclet.startGeneration(AbstractDoclet.java:213)
      at jdk.javadoc/jdk.javadoc.internal.doclets.toolkit.AbstractDoclet.run(AbstractDoclet.java:117)
      at jdk.javadoc/jdk.javadoc.doclet.StandardDoclet.run(StandardDoclet.java:68)
      at jdk.javadoc/jdk.javadoc.internal.tool.Start.parseAndExecute(Start.java:574)
      at jdk.javadoc/jdk.javadoc.internal.tool.Start.begin(Start.java:423)
      at jdk.javadoc/jdk.javadoc.internal.tool.Start.begin(Start.java:340)
      at jdk.javadoc/jdk.javadoc.internal.tool.Main.execute(Main.java:63)
      at jdk.javadoc/jdk.javadoc.internal.tool.Main.main(Main.java:52)
      1 error

      Test case:
      ----
      pkg2/package.html
      ----
      <HTML>
          <BODY>
              <!-- an empyt package.html -->
          </BODY>
      </HTML>

      ----
      pkg2/X.java
      ----
      package pkg2;

      /**
       * An empty class.
       */
      public class X {}

            ksrini Kumar Srinivasan
            ksrini Kumar Srinivasan
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: