You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Georg Juttner (JIRA)" <ji...@apache.org> on 2011/03/04 14:46:36 UTC

[jira] Commented: (WICKET-3500) Method AbstractMarkupParser.removeComment() causes an endless loop

    [ https://issues.apache.org/jira/browse/WICKET-3500?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13002606#comment-13002606 ] 

Georg Juttner commented on WICKET-3500:
---------------------------------------

The causing html snippet is

      <!--[if IE 6]>
        <link rel="stylesheet" type="text/css" href="ie-buggy.css" />
      <![endif]--> 

The closing comment tag is in a separate line. I don't know why the pull parser splits this to separate chunks. This happens even in case of

<!--[if IE 6]><link rel="stylesheet" type="text/css" href="ie-buggy.css" /><![endif]--> 

The first "rawMarkup" remains "<!--[if IE 6]>" leading to the endless loop.




> 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
>         Attachments: WICKET-3500.patch
>
>
> 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