Is this Calender bug or not ?

Below show my calendar code


        txtdateOfBirth = new DateField();
        txtdateOfBirth.setResolution(DateField.RESOLUTION_DAY);
        txtdateOfBirth.setImmediate(true);
        txtdateOfBirth.setHeight("-1px");
        txtdateOfBirth.setWidth("-1px");
        txtdateOfBirth.setCaption("Date Of Birth");
        txtdateOfBirth.setDateFormat("yyyy-MM-dd");
        txtdateOfBirth.setTabIndex(5);

If I select date from calender and click out side calender that value display in textbox. If type 2010-01-01 it also work properly, problem is if I type 2010(only type year) and click out side textbox below exception happen how can stop and validate that exception. I used try catch block but failed.


com.vaadin.data.Property$ConversionException
        at com.vaadin.ui.DateField.handleUnparsableDateString(DateField.java:382)
        at com.vaadin.ui.DateField.changeVariables(DateField.java:356)
        at com.vaadin.terminal.gwt.server.CommunicationManager.handleVariables(CommunicationManager.java:751)
        at com.vaadin.terminal.gwt.server.CommunicationManager.handleUidlRequest(CommunicationManager.java:300)
        at com.vaadin.terminal.gwt.server.AbstractApplicationServlet.service(AbstractApplicationServlet.java:432)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
        at org.apache.catalina.core.ApplicationFilterChain.servletService(ApplicationFilterChain.java:427)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:315)
        at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:287)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:218)
        at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:648)
        at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:593)
        at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:94)
        at com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:98)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:222)
        at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:648)
        at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:593)
        at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:587)
        at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1096)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:166)
        at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:648)
        at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:593)
        at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:587)
        at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1096)
        at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:288)
        at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.invokeAdapter(DefaultProcessorTask.java:647)
        at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.doProcess(DefaultProcessorTask.java:579)
        at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.process(DefaultProcessorTask.java:831)
        at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.executeProcessorTask(DefaultReadTask.java:341)
        at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:263)
        at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:214)
        at com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:265)
        at com.sun.enterprise.web.connector.grizzly.ssl.SSLWorkerThread.run(SSLWorkerThread.java:106)


You can override
handleUnparsableDateString()
of DateField to handle invalid date input yourself.

Thank You Reply I did it this way


    txtdateOfBirth = new DateField() {
            @Override
            public Date handleUnparsableDateString(String txtdateOfBirth) {
                getWin().getWindow().showNotification(ErrorMessage.EM_DOB, Notification.TYPE_WARNING_MESSAGE);
                return null;
            }
        };
        txtdateOfBirth.setResolution(DateField.RESOLUTION_DAY);
        txtdateOfBirth.setImmediate(true);
        txtdateOfBirth.setHeight("-1px");
        txtdateOfBirth.setWidth("-1px");
        txtdateOfBirth.setCaption("Date Of Birth");
        txtdateOfBirth.setDateFormat("yyyy-MM-dd");
        txtdateOfBirth.setTabIndex(5);

Is this write or Wrong ?