处理string为空

This commit is contained in:
wenc000 2020-05-11 17:24:36 +08:00
parent 8c0685e5d2
commit 8b1a9c920f

View File

@ -52,7 +52,7 @@ public class AnnotationUtil {
checkTypes(checkNullAnnotation.name(), fieldValue.toString(), checkNullAnnotation.types());
} else if (field.isAnnotationPresent(CheckEmptyAnnotation.class)) {
CheckEmptyAnnotation checkEmptyAnnotation = field.getAnnotation(CheckEmptyAnnotation.class);
if (StringUtils.isBlank(fieldValue.toString())) {
if (fieldValue == null || StringUtils.isBlank(fieldValue.toString())) {
throw new ParamsException(String.format("%s不能为空或空串", checkEmptyAnnotation.name()));
}
checkRegular(checkEmptyAnnotation.name(), fieldValue.toString(), checkEmptyAnnotation.verifyType(), checkEmptyAnnotation.regex());