commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Oded Blayer" <>
Subject RE: VFS "caching" problem.
Date Mon, 03 Nov 2003 14:25:36 GMT
Hi Brendan,

I am working with VFS currently and came with the same problem, not only in the local file
system, but in ftp too.
My solution to that involved a little hacking, I added a method to the VFS called getNewManager
that create a new FileSystemManager, every time it is called, after that it went down to getting
and releasing the FSM every time I manipulated files (my system didn't mine the overhead,
which seams to be small anyway, while you clear unwanted providers).

hope that helps.

Oded Blayer
Software Engineer
Invoke Solutions

-----Original Message-----
From: []
Sent: Monday, November 03, 2003 4:07 PM
Subject: VFS "caching" problem.


I'm using VFS in a small homegrown CMS project to copy whole folder trees 
about in a platform independant way. 

Here's some code with "CMSMount", "destDir", and "src" all strings 
containing system paths. 

FileSystemManager fsm = VFS.getManager();
            File destDir = new File(CMSMount+"/"+target);
            if (destDir.exists()) {
                File file = new File(CMSMount+"/"+src);
                if (!file.exists()) {
                    throw new EventHandlerException("source "+src+" not 
                } else {
                    Logger.debugLog("copying "+ file.getAbsolutePath());
                    FileObject srcObj = fsm.toFileObject(file);
                    FileObject targetObj = 
                    Logger.debugLog("src object: 
                    targetObj.copyFrom(srcObj, new AllFileSelector());


This code works fine when the system is started up and after you have 
changed existing files in the source folder.

However, if you add a new file to the filesystem seperately and then run 
the above code it fails with:
org.apache.commons.vfs.FileSystemException: Could not copy 
"file:///path/to/source/filename.html" to 

I assume that this is because the vfs system keeps the filestructure in 
memory and cannot cope with new files being added. 
Is there anyway to refresh the FileSystemManager object?

Brendan Richards
Senior Developer
Draft London
0207 894 5167

LEGAL NOTICE:This e-mail has been sent to you by Draft London. This 
communication, and the information it contains, is intended for the 
person(s) or organisation(s) to whom it is addressed.  Its contents are 
confidential and may be protected in law. Unauthorised use, copying or 
disclosure of any of it may be unlawful.  If you are not the intended 
recipient, please notify the sender by replying with 'Received in error' 
as the subject and then delete it from your mailbox. Any views or opinions 
presented are solely those of the author and do not necessarily represent 
those of Draft London.  Although this e-mail and any attachments are 
believed to be free of any virus or other defects which might affect any 
computer or IT system into which they are received, no responsibility is 
accepted from Draft London or any of its associated companies for any loss 
or damage arising in any way from the receipt or use thereof. We recommend 
that you should carry out your own virus checking procedure before opening 
any attachment.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message