diff options
author | Edoardo Vacchi <uncommonnonsense@gmail.com> | 2013-09-13 10:25:29 +0200 |
---|---|---|
committer | Vaadin Code Review <review@vaadin.com> | 2013-09-13 13:00:11 +0000 |
commit | 3cafce30057055d1731313c8d2833cb4c513ccd3 (patch) | |
tree | ecfd91135a532fa38fa7e3fafc7b2dfc0f03201a /server/src/com/vaadin/data | |
parent | 9b052579ebb6df508fe4195e6562fced7fdf5698 (diff) | |
download | vaadin-framework-3cafce30057055d1731313c8d2833cb4c513ccd3.tar.gz vaadin-framework-3cafce30057055d1731313c8d2833cb4c513ccd3.zip |
NullPointerException in DateToSqlDateConverter (#12284)
DateToSqlDateConverter throws a NullPointerException when the provided
value is null, thus violating the interface contract. If the provided
value is null, then the methods should return null.
Missing test case included
Change-Id: If08225c2a6ae7c3103e47d3817a5d45469c7bf4f
Diffstat (limited to 'server/src/com/vaadin/data')
-rw-r--r-- | server/src/com/vaadin/data/util/converter/DateToSqlDateConverter.java | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/server/src/com/vaadin/data/util/converter/DateToSqlDateConverter.java b/server/src/com/vaadin/data/util/converter/DateToSqlDateConverter.java index cddf2d8a42..7c252d78f2 100644 --- a/server/src/com/vaadin/data/util/converter/DateToSqlDateConverter.java +++ b/server/src/com/vaadin/data/util/converter/DateToSqlDateConverter.java @@ -44,6 +44,10 @@ public class DateToSqlDateConverter implements Converter<Date, java.sql.Date> { + targetType.getName() + ")"); } + if (value == null) { + return null; + } + return new java.sql.Date(value.getTime()); } @@ -56,6 +60,11 @@ public class DateToSqlDateConverter implements Converter<Date, java.sql.Date> { + getPresentationType().getName() + " (targetType was " + targetType.getName() + ")"); } + + if (value == null) { + return null; + } + return new Date(value.getTime()); } |