Uploaded image for project: 'Yetus'
  1. Yetus
  2. YETUS-1197

NPE in DocletEnvironmentProcessor

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 0.14.1
    • Audience Annotations
    • None

    Description

      In HBASE-25983 we tried to build javadoc with JDK11 and finally we end with a NPE.

      [ERROR] java.lang.NullPointerException
      [ERROR] 	at org.apache.yetus.audience.tools.DocletEnvironmentProcessor$DocEnvImpl.excluded(DocletEnvironmentProcessor.java:60)
      [ERROR] 	at org.apache.yetus.audience.tools.DocletEnvironmentProcessor$DocEnvImpl.isIncluded(DocletEnvironmentProcessor.java:50)
      [ERROR] 	at jdk.javadoc/jdk.javadoc.internal.doclets.toolkit.util.Utils.isIncluded(Utils.java:2685)
      [ERROR] 	at jdk.javadoc/jdk.javadoc.internal.doclets.formats.html.HtmlDocletWriter.getModuleLink(HtmlDocletWriter.java:629)
      [ERROR] 	at jdk.javadoc/jdk.javadoc.internal.doclets.formats.html.ClassWriterImpl.getHeader(ClassWriterImpl.java:104)
      [ERROR] 	at jdk.javadoc/jdk.javadoc.internal.doclets.toolkit.builders.ClassBuilder.buildClassDoc(ClassBuilder.java:138)
      [ERROR] 	at jdk.javadoc/jdk.javadoc.internal.doclets.toolkit.builders.ClassBuilder.build(ClassBuilder.java:120)
      [ERROR] 	at jdk.javadoc/jdk.javadoc.internal.doclets.formats.html.HtmlDoclet.generateClassFiles(HtmlDoclet.java:263)
      [ERROR] 	at jdk.javadoc/jdk.javadoc.internal.doclets.toolkit.AbstractDoclet.generateClassFiles(AbstractDoclet.java:273)
      [ERROR] 	at jdk.javadoc/jdk.javadoc.internal.doclets.toolkit.AbstractDoclet.startGeneration(AbstractDoclet.java:207)
      [ERROR] 	at jdk.javadoc/jdk.javadoc.internal.doclets.toolkit.AbstractDoclet.run(AbstractDoclet.java:114)
      [ERROR] 	at jdk.javadoc/jdk.javadoc.doclet.StandardDoclet.run(StandardDoclet.java:72)
      [ERROR] 	at org.apache.yetus.audience.tools.ExcludePrivateAnnotationsStandardDoclet.run(ExcludePrivateAnnotationsStandardDoclet.java:58)
      [ERROR] 	at jdk.javadoc/jdk.javadoc.internal.tool.Start.parseAndExecute(Start.java:588)
      [ERROR] 	at jdk.javadoc/jdk.javadoc.internal.tool.Start.begin(Start.java:432)
      [ERROR] 	at jdk.javadoc/jdk.javadoc.internal.tool.Start.begin(Start.java:345)
      [ERROR] 	at jdk.javadoc/jdk.javadoc.internal.tool.Main.execute(Main.java:63)
      [ERROR] 	at jdk.javadoc/jdk.javadoc.internal.tool.Main.main(Main.java:52)
      

      It is this line

      https://github.com/apache/yetus/blob/bfc2193567614ca3818dc37705eae09cac281ee9/audience-annotations-component/audience-annotations/src/main/java/org/apache/yetus/audience/tools/DocletEnvironmentProcessor.java#L60

          private boolean excluded(final Element e) {
            // Exclude private and limited private types
            if (e.getAnnotation(InterfaceAudience.Private.class) != null) { // <==== this line
              return true;
            }
            ...
          }
      

      Seems the Element is null. I checked the code in OpenJDK

      https://github.com/adoptium/jdk11u/blob/faf1f86f95117a5e2a0d52b67647dee893311545/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/ElementsTable.java#L328

      It does check whether the Element passed in is null, so I think we should also add null check here.

      Attachments

        Issue Links

          Activity

            People

              zhangduo Duo Zhang
              zhangduo Duo Zhang
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 0.5h
                  0.5h