diff --git a/org.springframework.core/src/main/java/org/springframework/core/convert/converter/ConverterInfo.java b/org.springframework.core/src/main/java/org/springframework/core/convert/converter/ConverterInfo.java index c59a563ffe5..ff258de0a66 100644 --- a/org.springframework.core/src/main/java/org/springframework/core/convert/converter/ConverterInfo.java +++ b/org.springframework.core/src/main/java/org/springframework/core/convert/converter/ConverterInfo.java @@ -21,12 +21,10 @@ package org.springframework.core.convert.converter; * * Implementing this interface is required when registering converters that do not declare their * parameterized types S and T with a {@link org.springframework.core.convert.ConversionService}. - * Such Converters are often dynamically created by a {@link ConverterFactory}. * * @author Keith Donald * @since 3.0 * @see Converter - * @see ConverterFactory */ public interface ConverterInfo { diff --git a/org.springframework.core/src/main/java/org/springframework/core/convert/support/StringToCharacterConverter.java b/org.springframework.core/src/main/java/org/springframework/core/convert/support/StringToCharacterConverter.java index b6e84f0beb1..7b710fc6e5d 100644 --- a/org.springframework.core/src/main/java/org/springframework/core/convert/support/StringToCharacterConverter.java +++ b/org.springframework.core/src/main/java/org/springframework/core/convert/support/StringToCharacterConverter.java @@ -27,8 +27,8 @@ import org.springframework.core.convert.converter.Converter; class StringToCharacterConverter implements Converter { public Character convert(String source) { - if (source.length() == 0) { - throw new IllegalArgumentException("Invalid value; to convert to a Character a String must have a length of 1 or greater"); + if ("".equals(source)) { + return null; } return source.charAt(0); } diff --git a/org.springframework.core/src/main/java/org/springframework/core/convert/support/StringToEnumConverterFactory.java b/org.springframework.core/src/main/java/org/springframework/core/convert/support/StringToEnumConverterFactory.java index f0c04ecec85..774d1c5255b 100644 --- a/org.springframework.core/src/main/java/org/springframework/core/convert/support/StringToEnumConverterFactory.java +++ b/org.springframework.core/src/main/java/org/springframework/core/convert/support/StringToEnumConverterFactory.java @@ -18,7 +18,6 @@ package org.springframework.core.convert.support; import org.springframework.core.convert.converter.Converter; import org.springframework.core.convert.converter.ConverterFactory; -import org.springframework.core.convert.converter.ConverterInfo; /** * A factory for String to enum converters. @@ -33,7 +32,7 @@ class StringToEnumConverterFactory implements ConverterFactory { return new StringToEnum(targetType); } - private class StringToEnum implements Converter, ConverterInfo { + private class StringToEnum implements Converter { private final Class enumType; @@ -41,14 +40,6 @@ class StringToEnumConverterFactory implements ConverterFactory { this.enumType = enumType; } - public Class getSourceType() { - return String.class; - } - - public Class getTargetType() { - return this.enumType; - } - public T convert(String source) { if ("".equals(source)) { // It's an empty enum identifier: reset the enum value to null.