} else { // it'll be null if pwdFile did not indicate a directory, if it didn't exist, or if there was some I/O Error
int currentYear = Calendar.getInstance().get(Calendar.YEAR);
lines = new LinkedList<>();
Calendar c = Calendar.getInstance();
String dateline;
Directory metadataDirectory = ServiceManager.getServices().getMetadataHandler().getDirectory(pwdFile);
String group;
String owner;
for (File file : files) {
if (!ServiceManager.getServices().getPermissions().isVisible(user, file.getName(), pwd, file.isDirectory())) {
// this file or directory was hidden from this user, so we don't display it
continue;
}
c.setTimeInMillis(file.lastModified());
if (c.get(Calendar.YEAR) == currentYear) {
// do the listing with time instead of year
dateline = time.format(c.getTime());
} else {
// do the listing with year instead of time
dateline = year.format(c.getTime());
}
// default: (actually, section can never be null, since we always have a default section)
owner = "cuftpd";
group = "cuftpd";
// next highest default is the parent group metadata
if (section != null) {
owner = section.getOwner();
group = section.getGroup();
}
// next highest default is to check if there is any metadata information registered to the entity.
if (metadataDirectory != null) {
Metadata metadata = metadataDirectory.getMetadata(file.getName());
if (metadata != null) { // this shouldn't return some default object, because if it does, it overrides the section owner/group
owner = metadata.getUsername();
// we can have users without groups, handle this
if (!"".equals(metadata.getGroupname()) && metadata.getGroupname() != null) {
group = metadata.getGroupname();