From b5d49958eb8a20250e774e872d037abee64972da Mon Sep 17 00:00:00 2001 From: Liu Chuang Date: Fri, 25 Sep 2020 15:12:35 +0800 Subject: [PATCH 1/3] Update MaxSizeConstraintValidator.java --- .../constraint/MaxSizeConstraintValidator.java | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/spring-mvc-basics-3/src/main/java/com/baeldung/validation/listvalidation/constraint/MaxSizeConstraintValidator.java b/spring-mvc-basics-3/src/main/java/com/baeldung/validation/listvalidation/constraint/MaxSizeConstraintValidator.java index 0154fb636a..7e725a3981 100644 --- a/spring-mvc-basics-3/src/main/java/com/baeldung/validation/listvalidation/constraint/MaxSizeConstraintValidator.java +++ b/spring-mvc-basics-3/src/main/java/com/baeldung/validation/listvalidation/constraint/MaxSizeConstraintValidator.java @@ -11,11 +11,7 @@ public class MaxSizeConstraintValidator implements ConstraintValidator values, ConstraintValidatorContext context) { - boolean isValid = true; - if (values.size() > 4) { - isValid = false; - } - return isValid; + return value.size()<=4 } } From c245528f3d78c400c0ccd9f91551af0d45455863 Mon Sep 17 00:00:00 2001 From: Liu Chuang Date: Fri, 25 Sep 2020 15:14:41 +0800 Subject: [PATCH 2/3] Update MaxSizeConstraintValidator.java --- .../listvalidation/constraint/MaxSizeConstraintValidator.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-mvc-basics-3/src/main/java/com/baeldung/validation/listvalidation/constraint/MaxSizeConstraintValidator.java b/spring-mvc-basics-3/src/main/java/com/baeldung/validation/listvalidation/constraint/MaxSizeConstraintValidator.java index 7e725a3981..524e98a39e 100644 --- a/spring-mvc-basics-3/src/main/java/com/baeldung/validation/listvalidation/constraint/MaxSizeConstraintValidator.java +++ b/spring-mvc-basics-3/src/main/java/com/baeldung/validation/listvalidation/constraint/MaxSizeConstraintValidator.java @@ -11,7 +11,7 @@ public class MaxSizeConstraintValidator implements ConstraintValidator values, ConstraintValidatorContext context) { - return value.size()<=4 + return values.size()<=4 } } From 1c21d3ed2769d0c54709c38ebeba4c74d4901879 Mon Sep 17 00:00:00 2001 From: Loredana Crusoveanu Date: Fri, 16 Oct 2020 19:14:29 +0300 Subject: [PATCH 3/3] Update MaxSizeConstraintValidator.java --- .../listvalidation/constraint/MaxSizeConstraintValidator.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-mvc-basics-3/src/main/java/com/baeldung/validation/listvalidation/constraint/MaxSizeConstraintValidator.java b/spring-mvc-basics-3/src/main/java/com/baeldung/validation/listvalidation/constraint/MaxSizeConstraintValidator.java index 524e98a39e..409b6e1ab5 100644 --- a/spring-mvc-basics-3/src/main/java/com/baeldung/validation/listvalidation/constraint/MaxSizeConstraintValidator.java +++ b/spring-mvc-basics-3/src/main/java/com/baeldung/validation/listvalidation/constraint/MaxSizeConstraintValidator.java @@ -11,7 +11,7 @@ public class MaxSizeConstraintValidator implements ConstraintValidator values, ConstraintValidatorContext context) { - return values.size()<=4 + return values.size() <= 4; } }