On Wed, 14 Jun 2023 21:30:43 GMT, Alexey Ivanov <[email protected]> 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`?
It returns a LeafIterator object with HEAD or P tag respectively
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/14466#discussion_r1230390783