if (typeString.equals("-")) {
ret[i].setType(FTPFile.TYPE_FILE);
} else if (typeString.equals("d")) {
ret[i].setType(FTPFile.TYPE_DIRECTORY);
} else {
throw new FTPListParseException();
}
long fileSize;
try {
fileSize = Long.parseLong(sizeString);
} catch (Throwable t) {
throw new FTPListParseException();
}
ret[i].setSize(fileSize);
if (dayString.length() == 1) {
dayString = "0" + dayString;
}
StringBuffer mdString = new StringBuffer();
mdString.append(monthString);
mdString.append(' ');
mdString.append(dayString);
mdString.append(' ');
boolean checkYear = false;
if (yearString == null) {
mdString.append(currentYear);
checkYear = true;
} else {
mdString.append(yearString);
checkYear = false;
}
mdString.append(' ');
if (hourString != null && minuteString != null) {
if (hourString.length() == 1) {
hourString = "0" + hourString;
}
if (minuteString.length() == 1) {
minuteString = "0" + minuteString;
}
mdString.append(hourString);
mdString.append(':');
mdString.append(minuteString);
} else {
mdString.append("00:00");
}
Date md;
try {
md = DATE_FORMAT.parse(mdString.toString());
} catch (ParseException e) {
throw new FTPListParseException();
}
if (checkYear) {
Calendar mc = Calendar.getInstance();
mc.setTime(md);
if (mc.after(now)) {
mc.set(Calendar.YEAR, currentYear - 1);
md = mc.getTime();
}
}
ret[i].setModifiedDate(md);
ret[i].setName(nameString);
} else {
throw new FTPListParseException();
}
}
return ret;
}