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

Reviewed-by: hannesw
This commit is contained in:
Jonathan Gibbons 2021-06-17 16:37:35 +00:00
parent 2047da7dcc
commit 0011b52ee8
3 changed files with 31 additions and 4 deletions

View File

@ -383,11 +383,11 @@ public class Checker extends DocTreePathScanner<Void, Void> {
}
}
}
}
// check for self closing tags, such as <a id="name"/>
if (tree.isSelfClosing() && !isSelfClosingAllowed(t)) {
env.messages.error(HTML, tree, "dc.tag.self.closing", treeName);
// check for self closing tags, such as <a id="name"/>
if (tree.isSelfClosing() && !isSelfClosingAllowed(t)) {
env.messages.error(HTML, tree, "dc.tag.self.closing", treeName);
}
}
try {

View File

@ -0,0 +1,17 @@
/*
* @test /nodynamiccopyright/
* @bug 8264843
* @summary Javac crashes with NullPointerException when finding unencoded XML in <pre> tag
* @library ..
* @modules jdk.javadoc/jdk.javadoc.internal.doclint
* @build DocLintTester
* @run main DocLintTester -Xmsgs -ref UnknownTagTest.out UnknownTagTest.java
*/
/**
* This is an <unknown> tag.
* This is an <unknown a=b> tag with attributes.
* This is an <unknown/> self-closing tag.
*/
public class UnknownTagTest {
}

View File

@ -0,0 +1,10 @@
UnknownTagTest.java:12: error: unknown tag: unknown
* This is an <unknown> tag.
^
UnknownTagTest.java:13: error: unknown tag: unknown
* This is an <unknown a=b> tag with attributes.
^
UnknownTagTest.java:14: error: unknown tag: unknown
* This is an <unknown/> self-closing tag.
^
3 errors