String receivedDate = tokens.peek();
if (Parsing.isValid(receivedDate)) {
receivedDate = Parsing.normalizeDateToken(Parsing.match(tokens, String.class));
try {
MailDateFormat dateFormat = new MailDateFormat();
dateFormat.setTimeZone(TimeZone.getTimeZone("Australia/Sydney"));
status.setReceivedDate(dateFormat.parse(receivedDate));
} catch (ParseException e) {
log.error("Malformed received date format {}. Unable to parse.", receivedDate, e);
}
} else if (receivedDate != null) {
Parsing.eat(tokens, "NIL");