提交 62235729 编写于 作者: K Keith Donald

assert of length 1

上级 11657b54
......@@ -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));
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册