Date date = null;
if (StringUtils.isNotEmpty(dateFormatted)) {
try {
date = dateFormat.parse(dateFormatted);
} catch (ParseException e) {
throw new UnexpectedException("Error parsing the date: '" + dateFormatted + "' with pattern: "
+ dateFormat.toPattern(), e);
}
}
return date;
}