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/lambdas Commit: 53c982d087437175770e632405a7f87fe0d7111f Parents: 600c193 Author: Martin Tzvetanov Grigorov <[email protected]> Authored: Wed Nov 18 23:25:09 2015 +0100 Committer: Martin Tzvetanov Grigorov <[email protected]> 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; - } -}
