public void endElement(String uri, String name, String qName) { if (qName.equals("instanceId")) { builder.instanceId(currentText.toString().trim()); } else if (qName.equals("timestamp")) { builder.timestamp(dateCodec.toDate(currentText.toString().trim())); } else if (qName.equals("passwordData")) { builder.passwordData(currentText.toString().trim()); } currentText = new StringBuilder(); }
public void endElement(String uri, String name, String qName) { if (qName.equals("instanceId")) { builder.instanceId(currentText.toString().trim()); } else if (qName.equals("timestamp")) { builder.timestamp(dateCodec.toDate(currentText.toString().trim())); } else if (qName.equals("passwordData")) { builder.passwordData(currentText.toString().trim()); } currentText = new StringBuilder(); }
public Date parseExpires(String expires) { try { return (expires != null) ? getExpiresDateCodec().toDate(expires) : null; } catch (IllegalArgumentException e) { logger.debug("Invalid Expires header (%s); should be in RFC-1123 format; treating as already expired: %s", expires, e.getMessage()); return new Date(0); } } }
public Date parseExpires(String expires) { try { return (expires != null) ? getExpiresDateCodec().toDate(expires) : null; } catch (IllegalArgumentException e) { logger.debug("Invalid Expires header (%s); should be in RFC-1123 format; treating as already expired: %s", expires, e.getMessage()); return new Date(0); } } }
public Date parseExpires(String expires) { try { return (expires != null) ? getExpiresDateCodec().toDate(expires) : null; } catch (IllegalArgumentException e) { logger.debug("Invalid Expires header (%s); should be in RFC-1123 format; treating as already expired: %s", expires, e.getMessage()); return new Date(0); } } }
public Date parseExpires(String expires) { try { return (expires != null) ? getExpiresDateCodec().toDate(expires) : null; } catch (IllegalArgumentException e) { logger.debug("Invalid Expires header (%s); should be in RFC-1123 format; treating as already expired: %s", expires, e.getMessage()); return new Date(0); } } }
@Test public void testCodecForRfc822ThrowsParseExceptionWhenMalformed() { try { rfc822Codec.toDate("wrong"); fail(); } catch (IllegalArgumentException e) { } }
@Test public void testCodecForRfc1123ThrowsParseExceptionWhenMalformed() { try { rfc1123Codec.toDate("wrong"); fail(); } catch (IllegalArgumentException e) { } }
@Test public void testCodecForIso8601ThrowsParseExceptionWhenMalformed() { try { iso8601Codec.toDate("-"); fail(); } catch (IllegalArgumentException e) { } }
@Override public long read() { return MILLISECONDS.toNanos(rfc822.toDate("Sat, 1 Jan 2000 00:00:00 GMT").getTime()); }
@Test public void testCodecForIso8601SecondsThrowsParseExceptionWhenMalformed() { try { iso8601SecondsCodec.toDate("-"); fail(); } catch (IllegalArgumentException e) { } } }
@Override public long read() { return TimeUnit.MILLISECONDS.toNanos(iso8601Seconds.toDate("2012-11-14T20:51:28UTC").getTime()); }
@Test public void testCodecForRfc822ThrowsParseExceptionWhenMalformed() { try { rfc822Codec.toDate("wrong"); fail(); } catch (IllegalArgumentException e) { } }
@Test public void testCodecForRfc1123ThrowsParseExceptionWhenMalformed() { try { rfc1123Codec.toDate("wrong"); fail(); } catch (IllegalArgumentException e) { } }
@Test public void testCodecForIso8601SecondsThrowsParseExceptionWhenMalformed() { try { iso8601SecondsCodec.toDate("-"); fail(); } catch (IllegalArgumentException e) { } }