Search code examples
javavaadinvaadin7

Vaadin DateField showing "null" instead of Days and Month


I have a vaadin application with a DateField. Sometimes randomly the days and the month are displayed as null. The locale is set to German.
Any idea on how to prevent this?

enter image description here

instead of:

enter image description here

EDIT: I did some more testing, in the UI.init() method I set the locale of the session. If I remove this line it works:

protected void init(VaadinRequest request) {
    getSession().setLocale(Locale.getDefault());
    ....
}    

Solution

  • I figured it out I have to set the locale of the UI first:

    protected void init(VaadinRequest request) {
        setLocale(Locale.getDefault());
        getSession().setLocale(Locale.getDefault());
        ....
    }