@Test(enabled = false) public void testCorrectHandlingOfMillis() { Date date = new SimpleDateFormatDateService().iso8601DateParse("2011-11-07T11:19:13.38225Z"); assertEquals("Mon Nov 07 11:19:13 GMT 2011", date.toString()); }
@Override public final Date iso8601DateParse(String toParse) { if (toParse.length() < 10) throw new IllegalArgumentException("incorrect date format " + toParse); String tz = findTZ(toParse); toParse = trimToMillis(toParse); toParse = trimTZ(toParse); toParse += tz; if (toParse.charAt(10) == ' ') toParse = new StringBuilder(toParse).replace(10, 11, "T").toString(); synchronized (iso8601SimpleDateFormat) { try { return iso8601SimpleDateFormat.parse(toParse); } catch (ParseException pe) { throw new IllegalArgumentException("Error parsing data at " + pe.getErrorOffset(), pe); } } }
SimpleDateFormatDateService implements DateService { @Override public final Date iso8601DateParse(String toParse) { if (toParse.length() < 10) throw new IllegalArgumentException("incorrect date format " + toParse); String tz = findTZ(toParse); toParse = trimToMillis(toParse); toParse = trimTZ(toParse); toParse += tz; if (toParse.charAt(10) == ' ') toParse = new StringBuilder(toParse).replace(10, 11, "T").toString(); synchronized (iso8601SimpleDateFormat) { try { return iso8601SimpleDateFormat.parse(toParse); } catch (ParseException pe) { throw new IllegalArgumentException("Error parsing data at " + pe.getErrorOffset(), pe); } } } }
SimpleDateFormatDateService implements DateService { @Override public final Date iso8601DateParse(String toParse) { if (toParse.length() < 10) throw new IllegalArgumentException("incorrect date format " + toParse); String tz = findTZ(toParse); toParse = trimToMillis(toParse); toParse = trimTZ(toParse); toParse += tz; if (toParse.charAt(10) == ' ') toParse = new StringBuilder(toParse).replace(10, 11, "T").toString(); synchronized (iso8601SimpleDateFormat) { try { return iso8601SimpleDateFormat.parse(toParse); } catch (ParseException pe) { throw new IllegalArgumentException("Error parsing data at " + pe.getErrorOffset(), pe); } } }  }
SimpleDateFormatDateService implements DateService { @Override public final Date iso8601DateParse(String toParse) { if (toParse.length() < 10) throw new IllegalArgumentException("incorrect date format " + toParse); String tz = findTZ(toParse); toParse = trimToMillis(toParse); toParse = trimTZ(toParse); toParse += tz; if (toParse.charAt(10) == ' ') toParse = new StringBuilder(toParse).replace(10, 11, "T").toString(); synchronized (iso8601SimpleDateFormat) { try { return iso8601SimpleDateFormat.parse(toParse); } catch (ParseException pe) { throw new IllegalArgumentException("Error parsing data at " + pe.getErrorOffset(), pe); } } }  @Override final String cDateFormat(Date date); @Override final String cDateFormat(); @Override final Date cDateParse(String toParse); @Override final String rfc822DateFormat(Date date); @Override final String rfc822DateFormat(); @Override final Date rfc822DateParse(String toParse); @Override final String iso8601SecondsDateFormat(); @Override final String iso8601DateFormat(Date date); @Override final String iso8601DateFormat(); @Override final Date iso8601DateParse(String toParse); @Override final Date iso8601SecondsDateParse(String toParse); @Override @SuppressWarnings("UnusedException") Date iso8601DateOrSecondsDateParse(String toParse); @Override String iso8601SecondsDateFormat(Date date); @Override final String rfc1123DateFormat(Date date); @Override final String rfc1123DateFormat(); @Override final Date rfc1123DateParse(String toParse); }
SimpleDateFormatDateService implements DateService { @Override public final Date iso8601DateParse(String toParse) { if (toParse.length() < 10) throw new IllegalArgumentException("incorrect date format " + toParse); String tz = findTZ(toParse); toParse = trimToMillis(toParse); toParse = trimTZ(toParse); toParse += tz; if (toParse.charAt(10) == ' ') toParse = new StringBuilder(toParse).replace(10, 11, "T").toString(); synchronized (iso8601SimpleDateFormat) { try { return iso8601SimpleDateFormat.parse(toParse); } catch (ParseException pe) { throw new IllegalArgumentException("Error parsing data at " + pe.getErrorOffset(), pe); } } }  @Override final String cDateFormat(Date date); @Override final String cDateFormat(); @Override final Date cDateParse(String toParse); @Override final String rfc822DateFormat(Date date); @Override final String rfc822DateFormat(); @Override final Date rfc822DateParse(String toParse); @Override final String iso8601SecondsDateFormat(); @Override final String iso8601DateFormat(Date date); @Override final String iso8601DateFormat(); @Override final Date iso8601DateParse(String toParse); @Override final Date iso8601SecondsDateParse(String toParse); @Override @SuppressWarnings("UnusedException") Date iso8601DateOrSecondsDateParse(String toParse); @Override String iso8601SecondsDateFormat(Date date); @Override final String rfc1123DateFormat(Date date); @Override final String rfc1123DateFormat(); @Override final Date rfc1123DateParse(String toParse);  }