commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marc Palmer <>
Subject VFS local filesystem lastModified problem
Date Mon, 19 Dec 2005 10:09:04 GMT

I'm having a problem with Commons VFS. When any code gets the  
lastModified property from an open URLConnection to a URL provided by  
VFS, which points to the local file system, lastModified is always  
returned as zero.

The code is like this:

FileSystemManager man = VFS.getManager();
FileObject fileSys = man.resolveFile(URI); // The URI is of the form  
URL moduleURL = fileSys.getURL(); // Gets the VFS-generated URL
FileObject xmlFile = fileSys.getChild(MODULE_CONTEXT_XML_FILE);
if ((xmlFile != null) && xmlFile.exists())
	final URL moduleContextURL = new URL(moduleURL,  
         log.debug("Lastmodified date of module.xml is : " +

The file exists however, and VFS can access it (and does), but if in  
the same application I get the lastModified value from a standard non- 
VFS URL using "file://" as the protocol, it works:

final URL contextURL = new URL(new URL(URI), MODULE_CONTEXT_XML_FILE);
log.debug("Lastmodified date: " + contextURL.openConnection 

So the problem is somewhere in VFS or my usage of it, but I can't  
work it out. Can anybody offer any insights? I'm running on Mac OSX  
10.4.3 (under JDK 1.5 rel 3) if that's an issue.

For what it's worth, I tried to find a searchable list archive but no  
joy, and no hits on google.

~ ~ ~
Marc Palmer (
AnyWare Ltd.

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

View raw message