Skip to content

Commit 0011b52

Browse files
8264843: Javac crashes with NullPointerException when finding unencoded XML in <pre> tag
Reviewed-by: hannesw
1 parent 2047da7 commit 0011b52

3 files changed

Lines changed: 31 additions & 4 deletions

File tree

src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclint/Checker.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -383,11 +383,11 @@ public Void visitStartElement(StartElementTree tree, Void ignore) {
383383
}
384384
}
385385
}
386-
}
387386

388-
// check for self closing tags, such as <a id="name"/>
389-
if (tree.isSelfClosing() && !isSelfClosingAllowed(t)) {
390-
env.messages.error(HTML, tree, "dc.tag.self.closing", treeName);
387+
// check for self closing tags, such as <a id="name"/>
388+
if (tree.isSelfClosing() && !isSelfClosingAllowed(t)) {
389+
env.messages.error(HTML, tree, "dc.tag.self.closing", treeName);
390+
}
391391
}
392392

393393
try {
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
/*
2+
* @test /nodynamiccopyright/
3+
* @bug 8264843
4+
* @summary Javac crashes with NullPointerException when finding unencoded XML in <pre> tag
5+
* @library ..
6+
* @modules jdk.javadoc/jdk.javadoc.internal.doclint
7+
* @build DocLintTester
8+
* @run main DocLintTester -Xmsgs -ref UnknownTagTest.out UnknownTagTest.java
9+
*/
10+
11+
/**
12+
* This is an <unknown> tag.
13+
* This is an <unknown a=b> tag with attributes.
14+
* This is an <unknown/> self-closing tag.
15+
*/
16+
public class UnknownTagTest {
17+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
UnknownTagTest.java:12: error: unknown tag: unknown
2+
* This is an <unknown> tag.
3+
^
4+
UnknownTagTest.java:13: error: unknown tag: unknown
5+
* This is an <unknown a=b> tag with attributes.
6+
^
7+
UnknownTagTest.java:14: error: unknown tag: unknown
8+
* This is an <unknown/> self-closing tag.
9+
^
10+
3 errors

0 commit comments

Comments
 (0)