Unable to transfer list of dates to client side widget


I have a custom widget with a shared state as follows:

public Date month; public List<Date> monthDays I am setting the state for “monthDays” in the setValue method of my server side component (AbstractField):

@Override public void setValue(List<Date> monthDays) throws ReadOnlyException, ConversionException { super.setValue(monthDays); getState().monthDays = monthDays; } Here, the list of dates is still correct as logging output confirms.

However, in the connector class, I get a list with 2 dates, but both dates are 0 (respectively some day in 1970):

@OnStateChange("monthDays") void updateMonthDays() { getWidget().setMonthDays(getState().monthDays); } The single month field (called “month”) is transferred correctly. Only the values in the list are changed.
Only other difference I can see between the two fields is that I set the shared state for the month in the constructor of the server-side component (AbstractField), while I set the list of dates in the overridden setValue() method.

I am using Vaadin 7.7.0.

Any ideas?

OKay I debugged into this and this seems to be a bug in Vaadin. This is part of the JSON received on client side:

"48": { "month": 1.4726808E12, "monthDays": [{ "date": 23, "hours": 15, "minutes": 2, "month": 8, "seconds": 57, "time": 1.474635777926E12, "year": 116 }, { "date": 18, "hours": 0, "minutes": 0, "month": 8, "seconds": 0, "time": 1.4741496E12, "year": 116 }] }, Now the JSONDezerializer find an entry for “month” of type java.util.Date. The Date_Serializer is able to dezerialize the time correctly: new Date((long) jsonValue.asNumber()); For the monthDays, the Deserializer finds a list of java.util.Date objects. It will loop through the list and try to dezerialize the entries with the Date_Serializer. However, this time it is not a number, but a JSONObject.
will return NaN, casting this to long will return 0. Which explains why my date is 1970.

I guess I should open a ticket at the bug tracker.

EDIT: For reference, here is the ticket: