RFR: 8049347: HTMLDocument throws NPE for Block Tag
Alexey Ivanov
aivanov at openjdk.org
Wed Jun 14 21:33:59 UTC 2023
On Wed, 14 Jun 2023 12:43:18 GMT, Prasanta Sadhukhan <psadhukhan at openjdk.org> wrote:
> Trying to iterate for HEAD HTML tag or for any other "Block" Tag results in NPE due to some spurious unhandled code which just return NULL.
> Removing the code solves this problem and also does not cause any regression in clientlibs test.
src/java.desktop/share/classes/javax/swing/text/html/HTMLDocument.java line 550:
> 548: if (t.isBlock()) {
> 549: // TBD
> 550: return null;
This doesn't look right to me. The comment suggests the implementation of something like `BlockIterator` is missing.
I would expect that iterator for `HTML.Tag.HEAD` returns all elements inside `<head>` element. Yet the comment for the `next` method
https://github.com/openjdk/jdk/blob/931625a9304ec2761ca9035d69fd33f6beadb124/src/java.desktop/share/classes/javax/swing/text/html/HTMLDocument.java#L1993-L1997
suggests, the iterator goes over all instances of the specified tag in the document.
What does the iterator return if you pass it `HTML.Tag.HEAD` or `HTML.Tag.P`?
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/14466#discussion_r1230191266
More information about the client-libs-dev
mailing list