diff options
author | Olli Tietäväinen <ollit@vaadin.com> | 2018-06-05 15:49:18 +0300 |
---|---|---|
committer | Teemu Suo-Anttila <tsuoanttila@users.noreply.github.com> | 2018-06-05 15:49:18 +0300 |
commit | 8a756b89c2da2de672a81d5c54c51448d589ffbc (patch) | |
tree | 016de65fcdd6a2b622a704cfda7cc11ffcc7b38e /server/src | |
parent | 6dea707429c06a64c6f22df6a361959851d29067 (diff) | |
download | vaadin-framework-8a756b89c2da2de672a81d5c54c51448d589ffbc.tar.gz vaadin-framework-8a756b89c2da2de672a81d5c54c51448d589ffbc.zip |
Fix NPE check in BindingValidationStatus (#10964)
Diffstat (limited to 'server/src')
-rw-r--r-- | server/src/main/java/com/vaadin/data/BinderValidationStatus.java | 2 | ||||
-rw-r--r-- | server/src/test/java/com/vaadin/data/BinderValidationStatusTest.java | 13 |
2 files changed, 14 insertions, 1 deletions
diff --git a/server/src/main/java/com/vaadin/data/BinderValidationStatus.java b/server/src/main/java/com/vaadin/data/BinderValidationStatus.java index b9b3f3c19d..a527ac4683 100644 --- a/server/src/main/java/com/vaadin/data/BinderValidationStatus.java +++ b/server/src/main/java/com/vaadin/data/BinderValidationStatus.java @@ -90,7 +90,7 @@ public class BinderValidationStatus<BEAN> implements Serializable { public BinderValidationStatus(Binder<BEAN> source, List<BindingValidationStatus<?>> bindingStatuses, List<ValidationResult> binderStatuses) { - Objects.requireNonNull(binderStatuses, + Objects.requireNonNull(bindingStatuses, "binding statuses cannot be null"); Objects.requireNonNull(binderStatuses, "binder statuses cannot be null"); diff --git a/server/src/test/java/com/vaadin/data/BinderValidationStatusTest.java b/server/src/test/java/com/vaadin/data/BinderValidationStatusTest.java index e8b9f41539..52afdc71a1 100644 --- a/server/src/test/java/com/vaadin/data/BinderValidationStatusTest.java +++ b/server/src/test/java/com/vaadin/data/BinderValidationStatusTest.java @@ -8,9 +8,11 @@ import static org.junit.Assert.assertSame; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; +import java.util.ArrayList; import java.util.List; import java.util.concurrent.atomic.AtomicReference; +import org.junit.Assert; import org.junit.Before; import org.junit.Test; @@ -485,4 +487,15 @@ public class BinderValidationStatusTest assertEquals(1, results.size()); assertFalse(results.get(0).isError()); } + + @Test + public void binderValidationStatus_nullBindingStatuses() { + try { + new BinderValidationStatus<>(new Binder<Person>(), null, + new ArrayList<>()); + Assert.fail("Binder should throw an NPE"); + } catch (NullPointerException npe) { + assertNotNull(npe.getMessage()); + } + } } |