DatePickerFormatter extends
        JFormattedTextField.AbstractFormatter { @Override public Object stringToValue(String text) throws ParseException { Object result = null; ParseException pex = null; if (text == null || text.trim().length() == 0) { return null; } for (DateFormat _format : _formats) { try { result = (_format).parse(text); pex = null; break; } catch (ParseException ex) { pex = ex; } } if (pex != null) { throw pex; } return result; } DatePickerFormatter();  DatePickerFormatter(DateFormat formats[]);  DatePickerFormatter(Locale locale);  DatePickerFormatter(DateFormat formats[], Locale locale); DateFormat[] getFormats(); @Override Object stringToValue(String text); @Override String valueToString(Object value);  }
@Test public void testPickerFormatterEmptyStringToValue() { DatePickerFormatter picker = new DatePickerFormatter(new DateFormat[0]); try { picker.stringToValue("unparseble"); } catch (ParseException e) { } }