WICKET-6036 Failure to process markup with nested tags inside a Label

Take tags from the 'dequeue' until the closing one is found.
Throw an exception iff it cannot be found


Project: http://git-wip-us.apache.org/repos/asf/wicket/repo
Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/497a5d62
Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/497a5d62
Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/497a5d62

Branch: refs/heads/lambdas
Commit: 497a5d629b609d2e6039b2df6c35bc1035077984
Parents: 8442272
Author: Martin Tzvetanov Grigorov <[email protected]>
Authored: Tue Nov 17 22:39:18 2015 +0100
Committer: Martin Tzvetanov Grigorov <[email protected]>
Committed: Tue Nov 17 22:39:18 2015 +0100

----------------------------------------------------------------------
 .../main/java/org/apache/wicket/MarkupContainer.java   | 13 ++++++++-----
 .../queueing/ComponentQueueingCompatibilityTest.java   |  5 +++--
 2 files changed, 11 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/wicket/blob/497a5d62/wicket-core/src/main/java/org/apache/wicket/MarkupContainer.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/MarkupContainer.java 
b/wicket-core/src/main/java/org/apache/wicket/MarkupContainer.java
index 26fe0f9..b3c4300 100644
--- a/wicket-core/src/main/java/org/apache/wicket/MarkupContainer.java
+++ b/wicket-core/src/main/java/org/apache/wicket/MarkupContainer.java
@@ -2051,13 +2051,16 @@ public abstract class MarkupContainer extends Component 
implements Iterable<Comp
 
                // pull the close tag off
                ComponentTag close = dequeue.takeTag();
-               if (!close.closes(tag))
+               do
                {
-                       // sanity check
-                       throw new IllegalStateException(String.format(
-                               "Tag '%s' should be the closing one for '%s'", 
close, tag));
-               }
+                       if (close != null && close.closes(tag))
+                       {
+                               return;
+                       }
+               } while ((close = dequeue.takeTag()) != null);
 
+               throw new IllegalStateException(String.format(
+                               "Could not find the closing for '%s'", tag));
        }
 
     /** @see IQueueRegion#newDequeueContext() */

http://git-wip-us.apache.org/repos/asf/wicket/blob/497a5d62/wicket-core/src/test/java/org/apache/wicket/queueing/ComponentQueueingCompatibilityTest.java
----------------------------------------------------------------------
diff --git 
a/wicket-core/src/test/java/org/apache/wicket/queueing/ComponentQueueingCompatibilityTest.java
 
b/wicket-core/src/test/java/org/apache/wicket/queueing/ComponentQueueingCompatibilityTest.java
index 254e951..7cc703b 100644
--- 
a/wicket-core/src/test/java/org/apache/wicket/queueing/ComponentQueueingCompatibilityTest.java
+++ 
b/wicket-core/src/test/java/org/apache/wicket/queueing/ComponentQueueingCompatibilityTest.java
@@ -17,13 +17,14 @@
 package org.apache.wicket.queueing;
 
 import org.apache.wicket.util.tester.WicketTestCase;
-import org.junit.Ignore;
 import org.junit.Test;
 
 public class ComponentQueueingCompatibilityTest extends WicketTestCase
 {
+       /**
+        * https://issues.apache.org/jira/browse/WICKET-6036
+        */
        @Test
-       @Ignore("WICKET-6036")
        public void nestedTags()
        {
                IncorrectCloseTagPanel p = new IncorrectCloseTagPanel("test");

Reply via email to