You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by mg...@apache.org on 2015/11/18 23:29:37 UTC

[1/2] wicket git commit: WICKET-6004 Wicket 8 cleanup - TODOs and deprecated methods

Repository: wicket
Updated Branches:
  refs/heads/master 600c193f3 -> 6970a4dad


WICKET-6004 Wicket 8 cleanup - TODOs and deprecated methods

Remove ConditionalCommentFilter - it does nothing since 2011


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

Branch: refs/heads/master
Commit: 53c982d087437175770e632405a7f87fe0d7111f
Parents: 600c193
Author: Martin Tzvetanov Grigorov <mg...@apache.org>
Authored: Wed Nov 18 23:25:09 2015 +0100
Committer: Martin Tzvetanov Grigorov <mg...@apache.org>
Committed: Wed Nov 18 23:25:09 2015 +0100

----------------------------------------------------------------------
 .../org/apache/wicket/markup/MarkupParser.java  |   2 -
 .../parser/filter/ConditionalCommentFilter.java | 264 -------------------
 2 files changed, 266 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/wicket/blob/53c982d0/wicket-core/src/main/java/org/apache/wicket/markup/MarkupParser.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/markup/MarkupParser.java b/wicket-core/src/main/java/org/apache/wicket/markup/MarkupParser.java
index ddd76b4..62d33f4 100644
--- a/wicket-core/src/main/java/org/apache/wicket/markup/MarkupParser.java
+++ b/wicket-core/src/main/java/org/apache/wicket/markup/MarkupParser.java
@@ -23,7 +23,6 @@ import org.apache.wicket.Page;
 import org.apache.wicket.markup.html.form.AutoLabelTagHandler;
 import org.apache.wicket.markup.parser.IMarkupFilter;
 import org.apache.wicket.markup.parser.IXmlPullParser;
-import org.apache.wicket.markup.parser.filter.ConditionalCommentFilter;
 import org.apache.wicket.markup.parser.filter.EnclosureHandler;
 import org.apache.wicket.markup.parser.filter.HeadForceTagIdHandler;
 import org.apache.wicket.markup.parser.filter.HtmlHandler;
@@ -177,7 +176,6 @@ public class MarkupParser extends AbstractMarkupParser
 
 		// Append it. See WICKET-4390
 		filters.add(new StyleAndScriptIdentifier(), StyleAndScriptIdentifier.class);
-		filters.add(new ConditionalCommentFilter());
 		filters.add(new WicketContainerTagHandler(markupResourceStream, Application.get().usesDevelopmentConfig()));
 
 		return filters;

http://git-wip-us.apache.org/repos/asf/wicket/blob/53c982d0/wicket-core/src/main/java/org/apache/wicket/markup/parser/filter/ConditionalCommentFilter.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/markup/parser/filter/ConditionalCommentFilter.java b/wicket-core/src/main/java/org/apache/wicket/markup/parser/filter/ConditionalCommentFilter.java
deleted file mode 100644
index 0fc289a..0000000
--- a/wicket-core/src/main/java/org/apache/wicket/markup/parser/filter/ConditionalCommentFilter.java
+++ /dev/null
@@ -1,264 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.wicket.markup.parser.filter;
-
-import java.text.ParseException;
-import java.util.LinkedList;
-import java.util.Map;
-import java.util.Queue;
-import java.util.Set;
-
-import org.apache.wicket.markup.ComponentTag;
-import org.apache.wicket.markup.HtmlSpecialTag;
-import org.apache.wicket.markup.Markup;
-import org.apache.wicket.markup.MarkupElement;
-import org.apache.wicket.markup.parser.AbstractMarkupFilter;
-import org.apache.wicket.markup.parser.IXmlPullParser.HttpTagType;
-import org.apache.wicket.util.lang.Generics;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Skip duplicated mismatched markup inside conditional comments
- * 
- * @author Pedro Santos
- * @author Juergen Donnerstag
- */
-public class ConditionalCommentFilter extends AbstractMarkupFilter
-{
-	private static final Logger log = LoggerFactory.getLogger(ConditionalCommentFilter.class);
-
-	private Queue<ComponentTag> queue = new LinkedList<ComponentTag>();
-	private Map<Integer, Set<String>> skipByLevelMap = Generics.newHashMap();
-	private int level;
-
-	@Override
-	protected MarkupElement onSpecialTag(final HtmlSpecialTag tag) throws ParseException
-	{
-		if (tag.getHttpTagType() == HttpTagType.CONDITIONAL_COMMENT)
-		{
-
-		}
-		return tag;
-	}
-
-// public MarkupElement nextTag() throws ParseException
-// {
-// MarkupElement next = null;
-// if (queue.size() > 0)
-// {
-// next = queue.poll();
-// }
-// else
-// {
-// next = getNextFilter().nextTag();
-// }
-// if (next == null)
-// {
-// return null;
-// }
-// else if (next instanceof ConditionalComment)
-// {
-// ConditionalComment conditionalComment = (ConditionalComment)next;
-// if (conditionalComment.isStartIf())
-// {
-// ConditionalTags conditionalTags = new ConditionalTags();
-// conditionalTags.iterate(getNextFilter());
-// ComponentTag mismatch = conditionalTags.getMismatch();
-// if (mismatch != null)
-// {
-//
-// if (mismatch.isOpen())
-// {
-// // start skipping it at this level
-// log.debug("Start to skip: " + mismatch.getName());
-// startSkip(mismatch.getName());
-// }
-// else
-// {
-// if (shouldSkip(mismatch.getName()))
-// {
-// log.debug("Skipping: " + mismatch.getName());
-// // just skipping the close tag
-// }
-// else
-// {
-// throw new ParseException("Not opened tag: " + mismatch,
-// conditionalTags.mismatchTag.getPos());
-// }
-// }
-// }
-// queue.addAll(conditionalTags.getValidTags());
-// // start the recursion
-// return nextTag();
-// }
-// else
-// {
-// // ConditionalTags should have iterated over the close tag already
-// throw new ParseException("Not opened conditional comment close tag",
-// conditionalComment.getPos());
-// }
-// }
-// else
-// {
-// ComponentTag componentTag = (ComponentTag)next;
-// if (componentTag.isOpen())
-// {
-// level++;
-// }
-// else if (componentTag.isClose())
-// {
-// if (shouldSkip(componentTag.getName()))
-// {
-// log.debug("Skipping close tag outside conditional comment: " +
-// componentTag.getName());
-// // tag outside conditional comment are skipped once
-// stopSkipping(componentTag.getName());
-// // skipping
-// return nextTag();
-// }
-// level--;
-// }
-// return next;
-// }
-// }
-//
-// private void startSkip(String tagName)
-// {
-// Set<String> toSkipSet = skipByLevelMap.get(level);
-// if (toSkipSet == null)
-// {
-// skipByLevelMap.put(level, toSkipSet = new HashSet<String>());
-//
-// }
-// toSkipSet.add(tagName);
-// }
-//
-// private void stopSkipping(String tagName)
-// {
-// skipByLevelMap.get(level).remove(tagName);
-// }
-//
-// private boolean shouldSkip(String tagName)
-// {
-// Set<String> skipList = skipByLevelMap.get(level);
-// return skipList != null && skipList.contains(tagName);
-// }
-//
-// /**
-// * Track the markup inside an conditional tag
-// *
-// * @author Pedro Santos
-// */
-// private static class ConditionalTags
-// {
-// private TagStack tagStack = new TagStack();
-// private ArrayList<ComponentTag> tagSequence = new ArrayList<ComponentTag>();
-// private ComponentTag mismatchTag;
-//
-// public void iterate(IMarkupFilter nextFilter) throws ParseException
-// {
-// MarkupElement markupElement = null;
-// do
-// {
-// markupElement = nextFilter.nextTag();
-// if (markupElement instanceof ConditionalComment)
-// {
-// ConditionalComment conditionalComment = (ConditionalComment)markupElement;
-// if (conditionalComment.isStartIf())
-// {
-// throw new ParseException("nested conditional comments are not suported",
-// conditionalComment.getPos());
-// }
-// }
-// else
-// {
-// ComponentTag componentTag = (ComponentTag)markupElement;
-// try
-// {
-// tagStack.assertValidInStack(componentTag);
-// tagSequence.add(componentTag);
-// }
-// catch (ParseException e)
-// {
-// mismatchTag = componentTag;
-// }
-// }
-// }
-// while (markupElement != null && !(markupElement instanceof ConditionalComment));
-// }
-//
-// private List<ComponentTag> getValidTags()
-// {
-// ComponentTag notClosed = tagStack.getNotClosedTag();
-// @SuppressWarnings("unchecked")
-// List<ComponentTag> validTags = (List<ComponentTag>)tagSequence.clone();
-// if (notClosed != null)
-// {
-// validTags.remove(notClosed);
-// }
-// return validTags;
-// }
-//
-// private boolean hasMismatch()
-// {
-// return mismatchTag != null || tagStack.getNotClosedTag() != null;
-// }
-//
-// private ComponentTag getMismatch()
-// {
-// return mismatchTag != null ? mismatchTag : tagStack.getNotClosedTag();
-// }
-//
-// private boolean equalsTo(ConditionalTags other)
-// {
-// if (tagSequence.size() != other.tagSequence.size())
-// {
-// return false;
-// }
-// else
-// {
-// for (int i = 0; i < tagSequence.size(); i++)
-// {
-// if (!tagSequence.get(i).getName().equals(other.tagSequence.get(i).getName()) ||
-// !tagSequence.get(i).getType().equals(other.tagSequence.get(i).getType()))
-// {
-// return false;
-// }
-// }
-// }
-// return true;
-// }
-// }
-
-	/**
-	 * Post-process the markup if necessary
-	 */
-	@Override
-	public void postProcess(final Markup markup)
-	{
-	}
-
-	/**
-	 * Noop
-	 */
-	@Override
-	protected MarkupElement onComponentTag(final ComponentTag tag) throws ParseException
-	{
-		return tag;
-	}
-}


[2/2] wicket git commit: WICKET-6036 Failure to process markup with nested tags inside a Label

Posted by mg...@apache.org.
WICKET-6036 Failure to process markup with nested tags inside a Label

Move the new test from ComponentQueueingCompatibilityTest to ComponentQueueingTest.
Fix the exception message.
Remove some trailing spaces.


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

Branch: refs/heads/master
Commit: 6970a4dadb5d1b3b73b8be63d1f321e61967ff13
Parents: 53c982d
Author: Martin Tzvetanov Grigorov <mg...@apache.org>
Authored: Wed Nov 18 23:28:41 2015 +0100
Committer: Martin Tzvetanov Grigorov <mg...@apache.org>
Committed: Wed Nov 18 23:28:41 2015 +0100

----------------------------------------------------------------------
 .../java/org/apache/wicket/MarkupContainer.java |  5 ++-
 .../markup/parser/filter/HtmlHandler.java       |  2 +-
 .../ComponentQueueingCompatibilityTest.java     | 33 --------------------
 .../wicket/queueing/ComponentQueueingTest.java  | 11 ++++++-
 4 files changed, 13 insertions(+), 38 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/wicket/blob/6970a4da/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 b3c4300..8d08b77 100644
--- a/wicket-core/src/main/java/org/apache/wicket/MarkupContainer.java
+++ b/wicket-core/src/main/java/org/apache/wicket/MarkupContainer.java
@@ -2005,7 +2005,7 @@ public abstract class MarkupContainer extends Component implements Iterable<Comp
 
 				if (child != null)
 				{
-					addDequeuedComponent(child, tag);					
+					addDequeuedComponent(child, tag);
 				}
 			}
 
@@ -2059,8 +2059,7 @@ public abstract class MarkupContainer extends Component implements Iterable<Comp
 			}
 		} while ((close = dequeue.takeTag()) != null);
 
-		throw new IllegalStateException(String.format(
-				"Could not find the closing for '%s'", tag));
+		throw new IllegalStateException(String.format("Could not find the closing tag for '%s'", tag));
 	}
 
     /** @see IQueueRegion#newDequeueContext() */

http://git-wip-us.apache.org/repos/asf/wicket/blob/6970a4da/wicket-core/src/main/java/org/apache/wicket/markup/parser/filter/HtmlHandler.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/markup/parser/filter/HtmlHandler.java b/wicket-core/src/main/java/org/apache/wicket/markup/parser/filter/HtmlHandler.java
index 9288409..c5c6f89 100644
--- a/wicket-core/src/main/java/org/apache/wicket/markup/parser/filter/HtmlHandler.java
+++ b/wicket-core/src/main/java/org/apache/wicket/markup/parser/filter/HtmlHandler.java
@@ -110,7 +110,7 @@ public final class HtmlHandler extends AbstractMarkupFilter
 		    setContainsWicketIdFlag(tag);
 		    
 			// Push onto stack
-			stack.push(tag);			
+			stack.push(tag);
 		}
 		else if (tag.isClose())
 		{

http://git-wip-us.apache.org/repos/asf/wicket/blob/6970a4da/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
deleted file mode 100644
index 7cc703b..0000000
--- a/wicket-core/src/test/java/org/apache/wicket/queueing/ComponentQueueingCompatibilityTest.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.wicket.queueing;
-
-import org.apache.wicket.util.tester.WicketTestCase;
-import org.junit.Test;
-
-public class ComponentQueueingCompatibilityTest extends WicketTestCase
-{
-	/**
-	 * https://issues.apache.org/jira/browse/WICKET-6036
-	 */
-	@Test
-	public void nestedTags()
-	{
-		IncorrectCloseTagPanel p = new IncorrectCloseTagPanel("test");
-		tester.startComponentInPage(p);
-	}
-}

http://git-wip-us.apache.org/repos/asf/wicket/blob/6970a4da/wicket-core/src/test/java/org/apache/wicket/queueing/ComponentQueueingTest.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/test/java/org/apache/wicket/queueing/ComponentQueueingTest.java b/wicket-core/src/test/java/org/apache/wicket/queueing/ComponentQueueingTest.java
index 463999d..3039a27 100644
--- a/wicket-core/src/test/java/org/apache/wicket/queueing/ComponentQueueingTest.java
+++ b/wicket-core/src/test/java/org/apache/wicket/queueing/ComponentQueueingTest.java
@@ -19,7 +19,6 @@ package org.apache.wicket.queueing;
 import static org.apache.wicket.queueing.WicketMatchers.hasPath;
 import static org.hamcrest.Matchers.is;
 import static org.hamcrest.Matchers.nullValue;
-import static org.junit.Assert.*;
 
 import java.util.ArrayList;
 
@@ -723,6 +722,16 @@ public class ComponentQueueingTest extends WicketTestCase
 		tester.assertContains("title");
 	}
 
+	/**
+	 * https://issues.apache.org/jira/browse/WICKET-6036
+	 */
+	@Test
+	public void nestedTags()
+	{
+		IncorrectCloseTagPanel p = new IncorrectCloseTagPanel("test");
+		tester.startComponentInPage(p);
+	}
+
 	private static class A extends WebMarkupContainer
 	{
 		public A()