NPE for the package which don't have any constant value

ShinyaYoshida bitterfoxc at gmail.com
Wed Apr 1 21:08:16 UTC 2015


Hi,
I found NPE for the package which don't have any constant value:

/tmp/test/Test.java
package test;
public class Test
{
    // there is no constant value in test packages
}

$ /PATH_TO_JAVADOC_NEXT_JDK_IMAGE/bin/javadoc -html5 -sourcepath /tmp test

Loading source files for package test...
Constructing Javadoc information...
Standard Doclet version 1.8.0
Building tree for all the packages and classes...
Generating /tmp/javadoc/test/Test.html...
Generating /tmp/javadoc/test/package-frame.html...
Generating /tmp/javadoc/test/package-summary.html...
Generating /tmp/javadoc/test/package-tree.html...
Generating /tmp/javadoc/constant-values.html...
javadoc: error - java.lang.NullPointerException
1 error

Here is the possible fix:
diff -r 228f66693293
src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/ConstantsSummaryWriterImpl.java
---
a/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/ConstantsSummaryWriterImpl.java
 Tue Feb 24 16:13:47 2015 -0800
+++
b/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/ConstantsSummaryWriterImpl.java
 Thu Apr 02 06:00:24 2015 +0900
@@ -347,7 +347,7 @@
      * {@inheritDoc}
      */
     public void addConstantSummaries(Content contentTree, Content
summariesTree) {
-        if (configuration.allowTag(HtmlTag.SECTION))
+        if (configuration.allowTag(HtmlTag.SECTION) && summaryTree != null)
             summariesTree.addContent(summaryTree);
         if (configuration.allowTag(HtmlTag.MAIN)) {
             mainTree.addContent(summariesTree);

Regards,
shinyafox(Shinya Yoshida)


More information about the javadoc-next-dev mailing list