You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by im...@apache.org on 2006/10/03 21:10:38 UTC
svn commit: r452596 -
/jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/impl/DefaultFileMonitor.java
Author: imario
Date: Tue Oct 3 12:10:37 2006
New Revision: 452596
URL: http://svn.apache.org/viewvc?view=rev&rev=452596
Log:
VFS-78: fixed (hopefully) detection of deleted children if they already existed before the DefaultFileMonitor has been started
Modified:
jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/impl/DefaultFileMonitor.java
Modified: jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/impl/DefaultFileMonitor.java
URL: http://svn.apache.org/viewvc/jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/impl/DefaultFileMonitor.java?view=diff&rev=452596&r1=452595&r2=452596
==============================================================================
--- jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/impl/DefaultFileMonitor.java (original)
+++ jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/impl/DefaultFileMonitor.java Tue Oct 3 12:10:37 2006
@@ -165,12 +165,37 @@
*/
public void addFile(final FileObject file)
{
+ _addFile(file);
+ try
+ {
+ // add all direct children too
+ if (file.getType().hasChildren())
+ {
+ // Traverse the children
+ final FileObject[] children = file.getChildren();
+ for (int i = 0; i < children.length; i++)
+ {
+ _addFile(children[i]);
+ }
+ }
+ }
+ catch (FileSystemException fse)
+ {
+ log.error(fse.getLocalizedMessage(), fse);
+ }
+ }
+
+ /**
+ * Adds a file to be monitored.
+ */
+ private void _addFile(final FileObject file)
+ {
synchronized (this.monitorMap)
{
if (this.monitorMap.get(file.getName()) == null)
{
this.monitorMap.put(file.getName(), new FileMonitorAgent(this,
- file));
+ file));
try
{
@@ -276,7 +301,7 @@
/**
* set the number of files to check per run.
* a additional delay will be added if there are more files to check
- *
+ *
* @param checksPerRun a value less than 1 will disable this feature
*/
public void setChecksPerRun(int checksPerRun)
@@ -537,7 +562,7 @@
Object()); // null ?
// If the child's not there
if
- (!this.children.containsKey(newChildren[i].getName()))
+ (!this.children.containsKey(newChildren[i].getName()))
{
missingChildren.push(newChildren[i]);
}
@@ -612,7 +637,7 @@
// Check the timestamp to see if it has been modified
if (this.timestamp !=
- this.file.getContent().getLastModifiedTime())
+ this.file.getContent().getLastModifiedTime())
{
this.timestamp =
this.file.getContent().getLastModifiedTime();
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org