/*
 * 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.html.form;

import java.text.ParseException;

import org.apache.wicket.markup.ComponentTag;
import org.apache.wicket.markup.MarkupElement;
import org.apache.wicket.markup.parser.AbstractMarkupFilter;

/**
 * Markup filter that identifies tags with the {@code wicket:for} attribute. See
 * {@link AutoLabelResolver} for details.
 * 
 * @author igor
 */
public class AutoLabelTagHandler extends AbstractMarkupFilter
{
	public MarkupElement nextTag() throws ParseException
	{
		final ComponentTag tag = nextComponentTag();
		if (tag == null || tag.isClose())
		{
			return tag;
		}

		String related = tag.getAttribute("wicket:for");
		if (related == null)
		{
			return tag;
		}

		related = related.trim();
		if (related.isEmpty())
		{
			throw new ParseException("Tag contains an empty wicket:for attribute", tag.getPos());
		}
		if (!"label".equalsIgnoreCase(tag.getName()))
		{
			throw new ParseException("Attribute wicket:for can only be attached to <label> tag",
				tag.getPos());
		}
		if (tag.getId() != null)
		{
			throw new ParseException(
				"Attribute wicket:for cannot be used in conjunction with wicket:id", tag.getPos());
		}

		tag.setId(getClass().getName());
		tag.setModified(true);
		return tag;
	}

}

@@ -1051,16 +1051,63 @@
 Filter;%0D
+%0Aimport org.apache.wicket.util.string.Strings;%0D
 %0A%0D%0A/**%0D%0A
@@ -1635,23 +1635,23 @@
 %0D%0A%09%09if (
-related
+Strings
 .isEmpty
@@ -1651,16 +1651,23 @@
 isEmpty(
+related
 ))%0D%0A%09%09%7B%0D

remove usage of jdk 1.6 string.isempty()