Method AbstractMarkupParser.removeComment() causes an endless loop
------------------------------------------------------------------

                 Key: WICKET-3500
                 URL: https://issues.apache.org/jira/browse/WICKET-3500
             Project: Wicket
          Issue Type: Bug
          Components: wicket-core
    Affects Versions: 1.4.16
            Reporter: Georg Juttner


The last change (see WICKET-3277) of method 
AbstractMarkupParser.removeComment() in Wicket 1.4.16 causes an endless loop if 
the markup contains conditional comments for IE. 

For example, the following string causes a loop in method removeComment()

rawMarkup = "\r\n      <!--[if IE 6]>\r\n        "

According to the following code snippet 

        private String removeComment(String rawMarkup)
        {
                int pos1 = rawMarkup.indexOf("<!--");
                while (pos1 != -1)
                {
                        int pos2 = rawMarkup.indexOf("-->", pos1 + 4);
                        final StringBuilder buf = new 
StringBuilder(rawMarkup.length());
                        if (pos2 != -1)
                        {
                        ...
                        }
                        pos1 = rawMarkup.indexOf("<!--", pos1);
                }
                return rawMarkup;
        }

one can see that pos1 remains unchanged if pos2 == -1.

The previous version in Wicket 1.4.15 doesn't have this defect. As a workaround 
set StripComments to false.



-- 
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to