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/12/09 08:42:06 UTC
svn commit: r484943 - in
/jakarta/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs:
impl/DefaultFileMonitor.java provider/ftp/FtpFileObject.java
Author: imario
Date: Fri Dec 8 23:42:06 2006
New Revision: 484943
URL: http://svn.apache.org/viewvc?view=rev&rev=484943
Log:
VFS-69: ftp file system: refetch parents children in case of a refresh to get actual file informations
Modified:
jakarta/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/impl/DefaultFileMonitor.java
jakarta/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/ftp/FtpFileObject.java
Modified: jakarta/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/impl/DefaultFileMonitor.java
URL: http://svn.apache.org/viewvc/jakarta/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/impl/DefaultFileMonitor.java?view=diff&rev=484943&r1=484942&r2=484943
==============================================================================
--- jakarta/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/impl/DefaultFileMonitor.java (original)
+++ jakarta/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/impl/DefaultFileMonitor.java Fri Dec 8 23:42:06 2006
@@ -481,12 +481,8 @@
{
try
{
- // this.file = ((AbstractFileSystem) this.file.getFileSystem()).resolveFile(this.file.getName(), false);
-
- // close the file - this will detach and reattach its resources (for this thread) on the
- // next access
- this.file.close();
- }
+ this.file.refresh();
+ }
catch (FileSystemException fse)
{
log.error(fse.getLocalizedMessage(), fse);
Modified: jakarta/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/ftp/FtpFileObject.java
URL: http://svn.apache.org/viewvc/jakarta/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/ftp/FtpFileObject.java?view=diff&rev=484943&r1=484942&r2=484943
==============================================================================
--- jakarta/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/ftp/FtpFileObject.java (original)
+++ jakarta/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/ftp/FtpFileObject.java Fri Dec 8 23:42:06 2006
@@ -62,7 +62,9 @@
private Map children;
private FileObject linkDestination;
- protected FtpFileObject(final FileName name,
+ private boolean inRefresh=false;
+
+ protected FtpFileObject(final FileName name,
final FtpFileSystem fileSystem,
final FileName rootName)
throws FileSystemException
@@ -94,7 +96,7 @@
{
if (flush)
{
- children = null;
+ children = null;
}
// List the children of this file
@@ -188,7 +190,36 @@
this.fileInfo = newFileInfo;
}
- /**
+ /**
+ *
+ * @throws FileSystemException
+ */
+ public void refresh() throws FileSystemException
+ {
+ if (!inRefresh)
+ {
+ try
+ {
+ inRefresh = true;
+ super.refresh();
+ try
+ {
+ // this will tell the parent to recreate its children collection
+ getInfo(true);
+ }
+ catch (IOException e)
+ {
+ throw new FileSystemException(e);
+ }
+ }
+ finally
+ {
+ inRefresh = false;
+ }
+ }
+ }
+
+ /**
* Detaches this file object from its file resource.
*/
protected void doDetach()
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org