final String[] firstLineInFile = fileContent.get(0);
// data is in first cell
final String dateLine = firstLineInFile[0];
if (StringUtils.isBlank(dateLine)) {
throw new ImportException(ResourceLoader.getMessage(MessageId.E005.getMessageKey()));
} else {
int dateStartPosition = 0;
for (int i = 0; i < dateLine.length(); i++) {
if (Character.isDigit(dateLine.charAt(i))) {
dateStartPosition = i;
break;
}
}
// TODO this date format is valid in some countries only - maybe we have to try other formats as well
final SimpleDateFormat df = new SimpleDateFormat(DATE_FORMAT);
final Date date = df.parse(dateLine, new ParsePosition(dateStartPosition));
if (date == null) {
final String message = ResourceLoader.getMessage(MessageId.E006.getMessageKey(), dateLine.substring(dateStartPosition, dateLine.length() + 1));
throw new ImportException(message);
}
// set import date for later use
importDate = date;
}
}