mirror of
https://github.com/spring-projects/spring-framework.git
synced 2026-09-21 05:09:13 +00:00
assert of length 1
git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@739 50f2f4bb-b051-0410-bef5-90022cba6387
This commit is contained in:
+1
-1
@@ -23,7 +23,7 @@ package org.springframework.core.convert.converter;
|
||||
public class StringToCharacter implements Converter<String, Character> {
|
||||
|
||||
public Character convert(String source) throws Exception {
|
||||
if (source.length() > 1) {
|
||||
if (source.length() != 1) {
|
||||
throw new IllegalArgumentException("To be a Character the String '" + source + "' must have a length of 1");
|
||||
}
|
||||
return new Character(source.charAt(0));
|
||||
|
||||
Reference in New Issue
Block a user