@Override public Date unmarshall(StaxUnmarshallerContext unmarshallerContext) throws Exception { String dateString = unmarshallerContext.readText(); if (dateString == null) return null; try { if (TimestampFormat.RFC_822.getFormat().equals(dateFormatType)) { return DateUtils.parseRFC822Date(dateString); } if (TimestampFormat.UNIX_TIMESTAMP.getFormat().equals(dateFormatType)) { return DateUtils.parseServiceSpecificDate(dateString); } return DateUtils.parseISO8601Date(dateString); } catch (Exception e) { log.warn("Unable to parse date '" + dateString + "': " + e.getMessage(), e); return null; } }
public Date unmarshall(JsonUnmarshallerContext unmarshallerContext) throws Exception { // If value is string, assume ISO8601. Otherwise parse as epoch seconds. if (unmarshallerContext.getCurrentToken() == JsonToken.VALUE_STRING) { return DateUtils.parseISO8601Date(unmarshallerContext.readText()); } else { return DateUtils.parseServiceSpecificDate(unmarshallerContext.readText()); } }
@Override public Date unmarshall(JsonUnmarshallerContext unmarshallerContext) throws Exception { String dateString = unmarshallerContext.readText(); if (dateString == null) { return null; } try { if (TimestampFormat.RFC_822.getFormat().equals(dateFormatType)) { return DateUtils.parseRFC822Date(dateString); } if (TimestampFormat.UNIX_TIMESTAMP.getFormat().equals(dateFormatType)) { return DateUtils.parseServiceSpecificDate(dateString); } if (TimestampFormat.UNIX_TIMESTAMP_IN_MILLIS.getFormat().equals(dateFormatType)) { return DateUtils.parseUnixTimestampInMillis(dateString); } return DateUtils.parseISO8601Date(dateString); } catch (Exception exception) { // fallback to the original behavior. return DateJsonUnmarshaller.getInstance().unmarshall(unmarshallerContext); } }
@Override public Date unmarshall(StaxUnmarshallerContext unmarshallerContext) throws Exception { String dateString = unmarshallerContext.readText(); if (dateString == null) return null; try { if (TimestampFormat.RFC_822.getFormat().equals(dateFormatType)) { return DateUtils.parseRFC822Date(dateString); } if (TimestampFormat.UNIX_TIMESTAMP.getFormat().equals(dateFormatType)) { return DateUtils.parseServiceSpecificDate(dateString); } return DateUtils.parseISO8601Date(dateString); } catch (Exception e) { log.warn("Unable to parse date '" + dateString + "': " + e.getMessage(), e); return null; } }
public Date unmarshall(JsonUnmarshallerContext unmarshallerContext) throws Exception { // If value is string, assume ISO8601. Otherwise parse as epoch seconds. if (unmarshallerContext.getCurrentToken() == JsonToken.VALUE_STRING) { return DateUtils.parseISO8601Date(unmarshallerContext.readText()); } else { return DateUtils.parseServiceSpecificDate(unmarshallerContext.readText()); } }
@Override public Date unmarshall(JsonUnmarshallerContext unmarshallerContext) throws Exception { String dateString = unmarshallerContext.readText(); if (dateString == null) { return null; } try { if (TimestampFormat.RFC_822.getFormat().equals(dateFormatType)) { return DateUtils.parseRFC822Date(dateString); } if (TimestampFormat.UNIX_TIMESTAMP.getFormat().equals(dateFormatType)) { return DateUtils.parseServiceSpecificDate(dateString); } if (TimestampFormat.UNIX_TIMESTAMP_IN_MILLIS.getFormat().equals(dateFormatType)) { return DateUtils.parseUnixTimestampInMillis(dateString); } return DateUtils.parseISO8601Date(dateString); } catch (Exception exception) { // fallback to the original behavior. return DateJsonUnmarshaller.getInstance().unmarshall(unmarshallerContext); } }
public Date unmarshall(JsonUnmarshallerContext unmarshallerContext) throws Exception { // If value is string, assume ISO8601. Otherwise parse as epoch seconds. if (unmarshallerContext.getCurrentToken() == JsonToken.VALUE_STRING) { return DateUtils.parseISO8601Date(unmarshallerContext.readText()); } else { return DateUtils.parseServiceSpecificDate(unmarshallerContext.readText()); } }