FTPFileObject monitor doesn't retrieve lastModifiedTime
-------------------------------------------------------

         Key: VFS-69
         URL: http://issues.apache.org/jira/browse/VFS-69
     Project: Commons VFS
        Type: Bug

 Environment: Windows XP, Java version 1.4.2 (this is the version of Java that 
WebSphere Portal 5.1 runs on), WebSphere Portal
    Reporter: Tony Cooke


Monitoring of files on a ftp server using DefaultFileMonitor doesn't seem to 
register changes in the last modified time.

>From the email correspondance with Mario:

1.
This is how I've set up my DefaultFileMonitor:

  DefaultFileMonitor fm = new DefaultFileMonitor(new FileListener() {
    public void fileCreated(FileChangeEvent arg0) throws Exception {
        System.out.println("File created. " + arg0.getFile().getName());
    }
    public void fileDeleted(FileChangeEvent arg0) throws Exception {
        System.out.println("File deleted. " + arg0.getFile().getName());
    }
    public void fileChanged(FileChangeEvent arg0) throws Exception {
        System.out.println("File changed. " + arg0.getFile().getName());
  }
  });

  fm.setDelay(60000);
  fm.addFile(file);
  fm.start();


2.
Thanks for the code snipped. I tried it with the default
VFS.getManager() (without setting the CacheStrategy) and it works here with my 
ftp server as expected.
I am pretty sure for your tests you do not use a delay of 60000, do you?
I tried it with 5000 (5 seconds) and get the events promptly.
But ...... I pointed the monitor to a directory ....

> And this is how I run my checks:
>
>   try {
>     for (int i = 0; 1 < 100; i++) {
>       Thread.sleep(60000); //  1 minute
>       System.out.println(file.getContent().getLastModifiedTime() + "  "
> + file.getName());
>     }
>   } catch (InterruptedException ie) {
>     ie.printStackTrace();
>   }
>   
.... ok - got it. Its a bug in the FTPFileObject, unhappily I have no 
workaround yet.

Thank you for your help and sorry again for the extra work.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to