Author: mgrigorov
Date: Wed Apr 27 13:15:50 2011
New Revision: 1097104
URL: http://svn.apache.org/viewvc?rev=1097104&view=rev
Log:
WICKET-3648 AbstractMarkupParser.removeComment() goes in endless loop when the
comment is multi line
Add a unit test demonstrating the problem.
Modified:
wicket/trunk/wicket-core/src/test/java/org/apache/wicket/markup/MarkupParserTest.java
Modified:
wicket/trunk/wicket-core/src/test/java/org/apache/wicket/markup/MarkupParserTest.java
URL:
http://svn.apache.org/viewvc/wicket/trunk/wicket-core/src/test/java/org/apache/wicket/markup/MarkupParserTest.java?rev=1097104&r1=1097103&r2=1097104&view=diff
==============================================================================
---
wicket/trunk/wicket-core/src/test/java/org/apache/wicket/markup/MarkupParserTest.java
(original)
+++
wicket/trunk/wicket-core/src/test/java/org/apache/wicket/markup/MarkupParserTest.java
Wed Apr 27 13:15:50 2011
@@ -16,12 +16,6 @@
*/
package org.apache.wicket.markup;
-import java.io.IOException;
-import java.text.ParseException;
-import java.util.Locale;
-
-import junit.framework.Assert;
-
import org.apache.wicket.WicketTestCase;
import org.apache.wicket.markup.html.border.Border;
import org.apache.wicket.markup.html.pages.PageExpiredErrorPage;
@@ -35,6 +29,12 @@ import org.apache.wicket.util.string.Str
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import java.io.IOException;
+import java.text.ParseException;
+import java.util.Locale;
+
+import junit.framework.Assert;
+
/**
* Test cases for markup parser.
@@ -432,6 +432,29 @@ public final class MarkupParserTest exte
}
/**
+ * <a
href="https://issues.apache.org/jira/browse/WICKET-3648">WICKET-3648</a>
+ *
+ * @throws IOException
+ * @throws ResourceStreamNotFoundException
+ */
+ public final void wicket3648testCommentsWithNestedElements() throws
IOException,
+ ResourceStreamNotFoundException
+ {
+
tester.getApplication().getMarkupSettings().setStripComments(true);
+ final MarkupParser parser = new MarkupParser(
+// @formatter:off
+ "<span><!--[if lt IE 8 ]>\n"
+ + "<script src='js/ie7.js'></script>\n" +
+ "<![endif]--></span>"
+ // @formatter:on
+ );
+ IMarkupFragment markup = parser.parse();
+
+ RawMarkup raw = (RawMarkup)markup.get(0);
+ assertEquals("<span></span>", raw.toString());
+ }
+
+ /**
*
* @throws IOException
* @throws ResourceStreamNotFoundException