} else {
log.debug("children are present: " + kids.size());
children = new TreeMap<String, GridFtpMlsxFileObject>();
for (int i = 0; i < kids.size(); i++) {
final MlsxEntry child = kids.get(i);
if (child == null) {
continue;
}
String childname = child.getFileName();
if (childname != null && //!".".equals(childname) && !"..".equals(childname) &&
!"./".equals(childname) && !"../".equals(childname)) {
// update the child FileObjects MslxEntry
FileName fn = null;
try {
// Resolves a name, relative to the "root" file name.
// Refer to NameScope for a description of how names are resolved.
//
// Parameters:
// root - the base filename (which is'this' GridFtpMlsxFileObject which is the parent)
// name - The name to resolve.
// scope - The NameScope to use when resolving the name.
fn = getFileSystem().getFileSystemManager().
resolveName(getName(), UriParser.encode(childname), NameScope.CHILD);
}catch(Exception ex){
// VFS didn't like the child name for whatever reason,
// (prob an illegal file name char?).
// Therefore, don't bother adding it as a child as
// VFS will trip over if trying to resolve the child FileObject.
log.warn("Skipping unresolvable child FileObject: childname = " + childname);
}
// Need to check that childname == fn.getBaseName()
// otherwise, will not be able to resolveFile correctly which causes ex.
if (fn != null && childname != null && childname.equals(fn.getBaseName())) {
GridFtpMlsxFileObject fo = (GridFtpMlsxFileObject) getFileSystem().resolveFile(fn);
//fo.file = client.mlst(childname);
fo.file = child;
// set this FileObjects FileType by injection
// ignore pdir and cdir
if (MlsxEntry.TYPE_DIR.equals(child.get(MlsxEntry.TYPE))) {
fo.injectType(FileType.FOLDER);
children.put(childname, fo);
} else if (MlsxEntry.TYPE_FILE.equals(child.get(MlsxEntry.TYPE))) {
fo.injectType(FileType.FILE);
children.put(childname, fo);
}
}