diff --git a/cloud-common/src/main/java/com/cm/common/utils/annotation/AnnotationUtil.java b/cloud-common/src/main/java/com/cm/common/utils/annotation/AnnotationUtil.java index 6710fc5..fdc668e 100644 --- a/cloud-common/src/main/java/com/cm/common/utils/annotation/AnnotationUtil.java +++ b/cloud-common/src/main/java/com/cm/common/utils/annotation/AnnotationUtil.java @@ -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());