Author: imario
Date: Fri Aug 10 11:34:26 2007
New Revision: 564714

URL: http://svn.apache.org/viewvc?view=rev&rev=564714
Log:
VFS-172: allow to refresh the internal state data. Thanks to Jörg Schaible for 
the patch!

Modified:
    
commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/sftp/SftpFileObject.java

Modified: 
commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/sftp/SftpFileObject.java
URL: 
http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/sftp/SftpFileObject.java?view=diff&rev=564714&r1=564713&r2=564714
==============================================================================
--- 
commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/sftp/SftpFileObject.java
 (original)
+++ 
commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/sftp/SftpFileObject.java
 Fri Aug 10 11:34:26 2007
@@ -56,6 +56,8 @@
        private SftpATTRS attrs;
        private final String relPath;
 
+       private boolean inRefresh;
+
        protected SftpFileObject(final FileName name,
                        final SftpFileSystem fileSystem) throws 
FileSystemException
        {
@@ -63,6 +65,36 @@
                this.fileSystem = fileSystem;
                relPath = 
UriParser.decode(fileSystem.getRootName().getRelativeName(
                                name));
+       }
+
+       protected void doDetach() throws Exception
+       {
+               attrs = null;
+       }
+
+       public void refresh() throws FileSystemException
+       {
+               if (!inRefresh)
+               {
+                       try
+                       {
+                               inRefresh = true;
+                               super.refresh();
+                               try
+                               {
+                                       attrs = null;
+                                       getType();
+                               }
+                               catch (IOException e)
+                               {
+                                       throw new FileSystemException(e);
+                               }
+                       }
+                       finally
+                       {
+                               inRefresh = false;
+                       }
+               }
        }
 
        /**


Reply via email to