@Test public void testParse() throws ParseException { HttpHeaderDateFormat format = HttpHeaderDateFormat.get(); final Date parsedDateWithSingleDigitDay = format.parse("Sun, 6 Nov 1994 08:49:37 GMT"); assertNotNull(parsedDateWithSingleDigitDay); assertEquals(DATE, parsedDateWithSingleDigitDay); final Date parsedDateWithDoubleDigitDay = format.parse("Sun, 06 Nov 1994 08:49:37 GMT"); assertNotNull(parsedDateWithDoubleDigitDay); assertEquals(DATE, parsedDateWithDoubleDigitDay); final Date parsedDateWithDashSeparatorSingleDigitDay = format.parse("Sunday, 06-Nov-94 08:49:37 GMT"); assertNotNull(parsedDateWithDashSeparatorSingleDigitDay); assertEquals(DATE, parsedDateWithDashSeparatorSingleDigitDay); final Date parsedDateWithSingleDoubleDigitDay = format.parse("Sunday, 6-Nov-94 08:49:37 GMT"); assertNotNull(parsedDateWithSingleDoubleDigitDay); assertEquals(DATE, parsedDateWithSingleDoubleDigitDay); final Date parsedDateWithoutGMT = format.parse("Sun Nov 6 08:49:37 1994"); assertNotNull(parsedDateWithoutGMT); assertEquals(DATE, parsedDateWithoutGMT); }
@Override public Date parse(String text, ParsePosition pos) { Date date = super.parse(text, pos); if (date == null) { date = format1.parse(text, pos); } if (date == null) { date = format2.parse(text, pos); } return date; }
HttpHeaderDateFormat extends SimpleDateFormat { @Override public Date parse(String text, ParsePosition pos) { Date date = super.parse(text, pos); if (date == null) { date = format1.parse(text, pos); } if (date == null) { date = format2.parse(text, pos); } return date; } }
HttpHeaderDateFormat extends SimpleDateFormat { @Override public Date parse(String text, ParsePosition pos) { Date date = super.parse(text, pos); if (date == null) { date = format1.parse(text, pos); } if (date == null) { date = format2.parse(text, pos); } return date; } private  HttpHeaderDateFormat(); }
HttpHeaderDateFormat extends SimpleDateFormat { @Override public Date parse(String text, ParsePosition pos) { Date date = super.parse(text, pos); if (date == null) { date = format1.parse(text, pos); } if (date == null) { date = format2.parse(text, pos); } return date; } private  HttpHeaderDateFormat(); @Override Date parse(String text, ParsePosition pos); }
HttpHeaderDateFormat extends SimpleDateFormat { @Override public Date parse(String text, ParsePosition pos) { Date date = super.parse(text, pos); if (date == null) { date = format1.parse(text, pos); } if (date == null) { date = format2.parse(text, pos); } return date; } private  HttpHeaderDateFormat(); @Override Date parse(String text, ParsePosition pos);  }