@ Override protected Date handleUnparsableDateString ( final String value ) throws ConversionException { try { return durationFormat . parse ( value ) ; } catch ( final ParseException e1 ) { try { return additionalFormat . parse ( "000000" . substring ( value . length ( ) <= 6 ? value . length ( ) : 6 ) + value ) ; } catch ( final ParseException e2 ) { // if Parsing is not possible ConversionException is thrown } } throw new ConversionException ( "input is not in HH:MM:SS format." ) ; }
This method is called to handle a non - empty date string from the client if the client could not parse it as a Date . In the current case two different parsing schemas are tried . If parsing is not possible a ConversionException is thrown which marks the DurationField as invalid .