Menu

#162 Possible bad cleanup of parser after unbalanced "form" tags

1.9.15
open
nobody
5
2015-12-05
2015-12-05
No

This was reported to the Thymeleaf project which uses nekoHTML in "LEGACYHTML5" template mode up to Thymeleaf version 2.1: https://github.com/thymeleaf/thymeleaf/issues/362

This has been confirmed using nekoHTML 1.9.22

Apparently, there is some kind of issue with parser cleanup (using "reset()") when the parsed template leaves an open "form" tag. See the test case linked from that GitHub ticket for more detail. The issue does not appear if the tag that is left open is for example a "div", a "body"... so it seems something specific to (at least) "form" tags.

See the relevant Thymeleaf code using nekoHTML through the xerces APIs: https://github.com/thymeleaf/thymeleaf/blob/cfeaf07b17de4fcf1ebfb99553244d9df991e75f/src/main/java/org/thymeleaf/templateparser/html/AbstractHtmlTemplateParser.java#L151-L175

Note the "canResetParsers" is set to true by default so that parser objects are reused, and "reset()" is called on the DOMParser object after each execution. If "canResetParser" is set to false and therefore parser objects are created each time they are needed instead of reused, the issue cannot be reproduced.

Discussion


Log in to post a comment.