mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-05-09 23:51:34 +08:00
add StrPool.SPACE
This commit is contained in:
parent
d268d41568
commit
9bcb866a60
@ -24,6 +24,11 @@ package org.dromara.hutool.core.text;
|
|||||||
* @since 5.6.3
|
* @since 5.6.3
|
||||||
*/
|
*/
|
||||||
public interface StrPool {
|
public interface StrPool {
|
||||||
|
/**
|
||||||
|
* 字符串常量:空格符 {@code " "}
|
||||||
|
*/
|
||||||
|
String SPACE = " ";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 字符串常量:制表符 {@code "\t"}
|
* 字符串常量:制表符 {@code "\t"}
|
||||||
*/
|
*/
|
||||||
|
@ -16,9 +16,9 @@
|
|||||||
|
|
||||||
package org.dromara.hutool.extra.validation;
|
package org.dromara.hutool.extra.validation;
|
||||||
|
|
||||||
import org.dromara.hutool.core.collection.CollUtil;
|
|
||||||
|
|
||||||
import jakarta.validation.*;
|
import jakarta.validation.*;
|
||||||
|
import org.dromara.hutool.core.collection.CollUtil;
|
||||||
|
import org.dromara.hutool.core.text.StrPool;
|
||||||
import org.dromara.hutool.core.text.StrUtil;
|
import org.dromara.hutool.core.text.StrUtil;
|
||||||
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
@ -80,7 +80,7 @@ public class ValidationUtil {
|
|||||||
if (CollUtil.isNotEmpty(constraintViolations)) {
|
if (CollUtil.isNotEmpty(constraintViolations)) {
|
||||||
final ConstraintViolation<Object> constraint = constraintViolations.iterator().next();
|
final ConstraintViolation<Object> constraint = constraintViolations.iterator().next();
|
||||||
if (StrUtil.contains(constraint.getMessageTemplate(), "jakarta.validation.constraints")) {
|
if (StrUtil.contains(constraint.getMessageTemplate(), "jakarta.validation.constraints")) {
|
||||||
throw new ValidationException(constraint.getPropertyPath() + " " + constraint.getMessage());
|
throw new ValidationException(constraint.getPropertyPath() + StrPool.SPACE + constraint.getMessage());
|
||||||
} else {
|
} else {
|
||||||
throw new ValidationException(constraint.getMessage());
|
throw new ValidationException(constraint.getMessage());
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user