@Test public void testParseHttpDateRfc1123() { try { Date date = Utils.parseHttpDate("Sun, 06 Nov 1994 08:49:37 GMT"); assertNotNull("Date cannot be null", date); } catch (ParseException e) { fail("Cannot parse valid date"); } }
public static Date parseHttpDate(String stringValue) throws ParseException { SimpleDateFormat formatRfc1123 = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss zzz", Locale.ENGLISH); try { return formatRfc1123.parse(stringValue); } catch (ParseException e) { SimpleDateFormat formatRfc1036 = new SimpleDateFormat("EEE, dd-MMM-yy HH:mm:ss zzz", Locale.ENGLISH); try { return formatRfc1036.parse(stringValue); } catch (ParseException e1) { SimpleDateFormat formatAnsiCAsc = new SimpleDateFormat("EEE MMM d HH:mm:ss yyyy", Locale.ENGLISH); return formatAnsiCAsc.parse(stringValue); } } }
Utils { public static Date parseHttpDate(String stringValue) throws ParseException { SimpleDateFormat formatRfc1123 = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss zzz", Locale.ENGLISH); try { return formatRfc1123.parse(stringValue); } catch (ParseException e) { SimpleDateFormat formatRfc1036 = new SimpleDateFormat("EEE, dd-MMM-yy HH:mm:ss zzz", Locale.ENGLISH); try { return formatRfc1036.parse(stringValue); } catch (ParseException e1) { SimpleDateFormat formatAnsiCAsc = new SimpleDateFormat("EEE MMM d HH:mm:ss yyyy", Locale.ENGLISH); return formatAnsiCAsc.parse(stringValue); } } } }
Utils { public static Date parseHttpDate(String stringValue) throws ParseException { SimpleDateFormat formatRfc1123 = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss zzz", Locale.ENGLISH); try { return formatRfc1123.parse(stringValue); } catch (ParseException e) { SimpleDateFormat formatRfc1036 = new SimpleDateFormat("EEE, dd-MMM-yy HH:mm:ss zzz", Locale.ENGLISH); try { return formatRfc1036.parse(stringValue); } catch (ParseException e1) { SimpleDateFormat formatAnsiCAsc = new SimpleDateFormat("EEE MMM d HH:mm:ss yyyy", Locale.ENGLISH); return formatAnsiCAsc.parse(stringValue); } } }  }
Utils { public static Date parseHttpDate(String stringValue) throws ParseException { SimpleDateFormat formatRfc1123 = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss zzz", Locale.ENGLISH); try { return formatRfc1123.parse(stringValue); } catch (ParseException e) { SimpleDateFormat formatRfc1036 = new SimpleDateFormat("EEE, dd-MMM-yy HH:mm:ss zzz", Locale.ENGLISH); try { return formatRfc1036.parse(stringValue); } catch (ParseException e1) { SimpleDateFormat formatAnsiCAsc = new SimpleDateFormat("EEE MMM d HH:mm:ss yyyy", Locale.ENGLISH); return formatAnsiCAsc.parse(stringValue); } } }  static List<String> parseHeaderValue(String headerValue); static byte[] getRemainingArray(ByteBuffer buffer); static String getHeaderFromList(List<T> list); static List<String> getStringList(List<T> list, Stringifier<T> stringifier); static String getHeaderFromList(List<T> list, Stringifier<T> stringifier); static void checkNotNull(T reference, String parameterName); static byte[] toArray(long value); static long toLong(byte[] bytes, int start, int end); static List<String> toString(byte[] bytes); static List<String> toString(byte[] bytes, int start, int end); static ByteBuffer appendBuffers(ByteBuffer buffer, ByteBuffer buffer1, int incomingBufferSize,
                                           int BUFFER_STEP_SIZE); static T getProperty(Map<String, Object> properties, String key, Class<T> type); @SuppressWarnings("unchecked") static T getProperty(final Map<String, Object> properties, final String key, final Class<T> type,
                                    final T defaultValue); static int getWsPort(URI uri); static int getWsPort(URI uri, String scheme); static Date parseHttpDate(String stringValue); static String stringifyUpgradeRequest(UpgradeRequest upgradeRequest); static String stringifyUpgradeResponse(UpgradeResponse upgradeResponse); }
Utils { public static Date parseHttpDate(String stringValue) throws ParseException { SimpleDateFormat formatRfc1123 = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss zzz", Locale.ENGLISH); try { return formatRfc1123.parse(stringValue); } catch (ParseException e) { SimpleDateFormat formatRfc1036 = new SimpleDateFormat("EEE, dd-MMM-yy HH:mm:ss zzz", Locale.ENGLISH); try { return formatRfc1036.parse(stringValue); } catch (ParseException e1) { SimpleDateFormat formatAnsiCAsc = new SimpleDateFormat("EEE MMM d HH:mm:ss yyyy", Locale.ENGLISH); return formatAnsiCAsc.parse(stringValue); } } }  static List<String> parseHeaderValue(String headerValue); static byte[] getRemainingArray(ByteBuffer buffer); static String getHeaderFromList(List<T> list); static List<String> getStringList(List<T> list, Stringifier<T> stringifier); static String getHeaderFromList(List<T> list, Stringifier<T> stringifier); static void checkNotNull(T reference, String parameterName); static byte[] toArray(long value); static long toLong(byte[] bytes, int start, int end); static List<String> toString(byte[] bytes); static List<String> toString(byte[] bytes, int start, int end); static ByteBuffer appendBuffers(ByteBuffer buffer, ByteBuffer buffer1, int incomingBufferSize,
                                           int BUFFER_STEP_SIZE); static T getProperty(Map<String, Object> properties, String key, Class<T> type); @SuppressWarnings("unchecked") static T getProperty(final Map<String, Object> properties, final String key, final Class<T> type,
                                    final T defaultValue); static int getWsPort(URI uri); static int getWsPort(URI uri, String scheme); static Date parseHttpDate(String stringValue); static String stringifyUpgradeRequest(UpgradeRequest upgradeRequest); static String stringifyUpgradeResponse(UpgradeResponse upgradeResponse);  }