mirror of
https://github.com/spring-projects/spring-framework.git
synced 2026-09-28 18:19:05 +00:00
tidying string to char conversion
This commit is contained in:
+3
@@ -30,6 +30,9 @@ class StringToCharacterConverter implements Converter<String, Character> {
|
||||
if ("".equals(source)) {
|
||||
return null;
|
||||
}
|
||||
if (source.length() > 1) {
|
||||
throw new IllegalArgumentException("Can only convert a [String] with length of 1 to a [Character]; string value '" + source + "' has length of " + source.length());
|
||||
}
|
||||
return source.charAt(0);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user