commons-user mailing list archives

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

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  
"file:///Users/marc/somedir/"
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,  
MODULE_CONTEXT_XML_FILE);
         log.debug("Lastmodified date of module.xml is : " +
		moduleContextURL.openConnection().getLastModified());
}

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 
().getLastModified());

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 (marc@anyware.co.uk)
Consultant/Analyst
AnyWare Ltd.
http://www.anyware.co.uk/


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message