Author: mgrigorov Date: Sat Apr 9 07:18:03 2011 New Revision: 1090534 URL: http://svn.apache.org/viewvc?rev=1090534&view=rev Log: WICKET-3601 org/apache/wicket/util/tester/TagTester createTagByAttribute elm isA XmlTag
Don't check for the type - 'elm' is always XmlTag. Modified: wicket/trunk/wicket-core/src/main/java/org/apache/wicket/util/tester/TagTester.java Modified: wicket/trunk/wicket-core/src/main/java/org/apache/wicket/util/tester/TagTester.java URL: http://svn.apache.org/viewvc/wicket/trunk/wicket-core/src/main/java/org/apache/wicket/util/tester/TagTester.java?rev=1090534&r1=1090533&r2=1090534&view=diff ============================================================================== --- wicket/trunk/wicket-core/src/main/java/org/apache/wicket/util/tester/TagTester.java (original) +++ wicket/trunk/wicket-core/src/main/java/org/apache/wicket/util/tester/TagTester.java Sat Apr 9 07:18:03 2011 @@ -371,51 +371,48 @@ public class TagTester int level = 0; while ((elm = parser.nextTag()) != null && closeTag == null) { - if (elm instanceof XmlTag) + XmlTag xmlTag = elm; + + if (openTag == null) { - XmlTag xmlTag = elm; + IValueMap attributeMap = xmlTag.getAttributes(); - if (openTag == null) + for (Map.Entry<String, Object> entry : attributeMap.entrySet()) { - IValueMap attributeMap = xmlTag.getAttributes(); - - for (Map.Entry<String, Object> entry : attributeMap.entrySet()) + String attr = entry.getKey(); + if (attr.equals(attribute) && value.equals(entry.getValue())) { - String attr = entry.getKey(); - if (attr.equals(attribute) && value.equals(entry.getValue())) + if (xmlTag.isOpen()) { - if (xmlTag.isOpen()) - { - openTag = xmlTag; - } - else if (xmlTag.isOpenClose()) - { - openTag = xmlTag; - closeTag = xmlTag; - } + openTag = xmlTag; + } + else if (xmlTag.isOpenClose()) + { + openTag = xmlTag; + closeTag = xmlTag; } } } - else + } + else + { + if (xmlTag.isOpen() && xmlTag.getName().equals(openTag.getName())) { - if (xmlTag.isOpen() && xmlTag.getName().equals(openTag.getName())) - { - level++; - } + level++; + } - if (xmlTag.isClose()) + if (xmlTag.isClose()) + { + if (xmlTag.getName().equals(openTag.getName())) { - if (xmlTag.getName().equals(openTag.getName())) + if (level == 0) { - if (level == 0) - { - closeTag = xmlTag; - closeTag.setOpenTag(openTag); - } - else - { - level--; - } + closeTag = xmlTag; + closeTag.setOpenTag(openTag); + } + else + { + level--; } } }