[jdk17] RFR: JDK-8269722: NPE in HtmlDocletWriter

Hannes Wallnöfer hannesw at openjdk.java.net
Thu Jul 8 14:43:52 UTC 2021


On Thu, 1 Jul 2021 01:53:51 GMT, Jonathan Gibbons <jjg at openjdk.org> wrote:

> Please review a workaround/fix for an NPE in HtmlDocletWriter.
> 
> The underlying problem is triggered by having a method with no comment override a method with bad/malformed comments. That is then handled poorly in `HtmlDocletWriter.commentTagsToContent` which uses an incorrect `CommentHelper`.
> 
> The workaround fix is to check for a null `DocTreePath` from `CommentHelper.getDocTreePath`, and to suppress prin ting the error message in that case.  The error message will typically have been generated for the bad comments in the super type, so dropping the message is not such a bad thing anyway.
> 
> The diagnostic is improved by using a new/different message when the node does not seem to be tag-related.  In addition, the erroneous text is presented "as text" and not "as raw HTML".   These changes affect a couple of otherwise unrelated tests.
> 
> A new test is added, that exercises the conditions that gave rise to the NPE.

Looks good!

-------------

Marked as reviewed by hannesw (Reviewer).

PR: https://git.openjdk.java.net/jdk17/pull/190


More information about the javadoc-dev mailing list