[ http://issues.apache.org/jira/browse/MYFACES-768?page=all ]
Simon Kitching updated MYFACES-768:
-----------------------------------
Attachment: ReducedHTMLParser.java.patch-2.txt
ReducedHTMLparserTest.java.patch-2.txt
Ok, here are patches to the current SVN TRUNK. These incorporate the changes in
the patches I previously attached to this issue (which were lost when the issue
was closed and reopened).
This adds:
* sanity check for infinite loop; if there are any inputs that trigger an
infinite loop, at least a log message is emitted and the parsing returns.
* fix for the infinite loop problem which was being triggered by a
non-alphanumeric occurring when an xml attr name was expected
[the text "(1<2)" was treated as an element with name "2", then a ")" was
found where an attrname was expected].
* proper support for <script> and <style>, skipping all content until ETAGO
("</") is found.
> ReducedHTMLParser issues
> ------------------------
>
> Key: MYFACES-768
> URL: http://issues.apache.org/jira/browse/MYFACES-768
> Project: MyFaces
> Type: Bug
> Reporter: Simon Kitching
> Assignee: Martin Marinschek
> Fix For: Nightly
> Attachments: ReducedHTMLParser.java.patch-2.txt,
> ReducedHTMLParser.java.patch.txt, ReducedHTMLParserTest.java.patch.txt,
> ReducedHTMLparserTest.java.patch-2.txt
>
> ReducedHTMLParser (used by AddResource class) currently fails to handle the
> string "//-->".
> I found that my script references were getting inserted right into the
> middle of the body of my html page. After inserting some debug code, I
> have found that
> closedStartTag
> is being called every time that "//-->" is encountered in the page. And
> that's a lot, as that sequence is generated whenever an inline script is
> inserted into the page.
> This problem breaks every page containing a component that inserts
> javascript into the page header (jscookmenu, HtmlTree, etc).
> I've had a look at the code, and while the current implementation is very
> small I think it's quite hard to read/debug/maintain and may not handle a
> number of cases (such as the one described here).
> Attached is a proposed alternative implementation of this class. The code is
> larger but is hopefully easier to read. And also attached is a unit test case
> class which the current implementation lacks. This class isn't *quite*
> finished; the unit tests indicate there are a few off-by-one errors but
> that's just a matter of tweaking. I hope that this may form the basis of a
> replacement for the current ReducedHTMLParser.
> The implementation is a hybrid state-machine/adhoc parser.
> Regards,
> Simon
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira