in commons-vfs2/src/main/java/org/apache/commons/vfs2/impl/DefaultFileMonitor.java [168:207]
private void checkForNewChildren() {
try {
if (this.fileObject.getType().hasChildren()) {
final FileObject[] newChildren = this.fileObject.getChildren();
if (this.children != null) {
// See which new children are not listed in the current children map.
final Map<FileName, Object> newChildrenMap = new HashMap<>();
final Stack<FileObject> missingChildren = new Stack<>();
for (final FileObject element : newChildren) {
newChildrenMap.put(element.getName(), new Object()); // null ?
// If the child's not there
if (!this.children.containsKey(element.getName())) {
missingChildren.push(element);
}
}
this.children = newChildrenMap;
// If there were missing children
if (!missingChildren.empty()) {
while (!missingChildren.empty()) {
this.fireAllCreate(missingChildren.pop());
}
}
} else if (newChildren.length > 0) {
// First set of children - Break out the cigars
this.children = new HashMap<>();
for (final FileObject element : newChildren) {
this.children.put(element.getName(), new Object()); // null?
this.fireAllCreate(element);
}
}
}
} catch (final FileSystemException fse) {
LOG.error(fse.getLocalizedMessage(), fse);
}
}