geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jdil...@apache.org
Subject svn commit: r700410 - /geronimo/gshell/trunk/gshell-commands/gshell-vfs/src/main/java/org/apache/geronimo/gshell/commands/vfs/
Date Tue, 30 Sep 2008 10:37:57 GMT
Author: jdillon
Date: Tue Sep 30 03:37:57 2008
New Revision: 700410

URL: http://svn.apache.org/viewvc?rev=700410&view=rev
Log:
Close files

Modified:
    geronimo/gshell/trunk/gshell-commands/gshell-vfs/src/main/java/org/apache/geronimo/gshell/commands/vfs/CatAction.java
    geronimo/gshell/trunk/gshell-commands/gshell-vfs/src/main/java/org/apache/geronimo/gshell/commands/vfs/ChangeDirectoryAction.java
    geronimo/gshell/trunk/gshell-commands/gshell-vfs/src/main/java/org/apache/geronimo/gshell/commands/vfs/CopyAction.java
    geronimo/gshell/trunk/gshell-commands/gshell-vfs/src/main/java/org/apache/geronimo/gshell/commands/vfs/CurrentDirectoryAction.java
    geronimo/gshell/trunk/gshell-commands/gshell-vfs/src/main/java/org/apache/geronimo/gshell/commands/vfs/EditAction.java
    geronimo/gshell/trunk/gshell-commands/gshell-vfs/src/main/java/org/apache/geronimo/gshell/commands/vfs/FileInfoAction.java
    geronimo/gshell/trunk/gshell-commands/gshell-vfs/src/main/java/org/apache/geronimo/gshell/commands/vfs/FindAction.java
    geronimo/gshell/trunk/gshell-commands/gshell-vfs/src/main/java/org/apache/geronimo/gshell/commands/vfs/ListDirectoryAction.java
    geronimo/gshell/trunk/gshell-commands/gshell-vfs/src/main/java/org/apache/geronimo/gshell/commands/vfs/RemoveAction.java
    geronimo/gshell/trunk/gshell-commands/gshell-vfs/src/main/java/org/apache/geronimo/gshell/commands/vfs/TouchAction.java
    geronimo/gshell/trunk/gshell-commands/gshell-vfs/src/main/java/org/apache/geronimo/gshell/commands/vfs/VfsActionSupport.java

Modified: geronimo/gshell/trunk/gshell-commands/gshell-vfs/src/main/java/org/apache/geronimo/gshell/commands/vfs/CatAction.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-commands/gshell-vfs/src/main/java/org/apache/geronimo/gshell/commands/vfs/CatAction.java?rev=700410&r1=700409&r2=700410&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-commands/gshell-vfs/src/main/java/org/apache/geronimo/gshell/commands/vfs/CatAction.java
(original)
+++ geronimo/gshell/trunk/gshell-commands/gshell-vfs/src/main/java/org/apache/geronimo/gshell/commands/vfs/CatAction.java
Tue Sep 30 03:37:57 2008
@@ -86,6 +86,8 @@
             IOUtil.close(reader);
         }
 
+        closeFile(file);
+        
         io.out.println();
 
         return Result.SUCCESS;

Modified: geronimo/gshell/trunk/gshell-commands/gshell-vfs/src/main/java/org/apache/geronimo/gshell/commands/vfs/ChangeDirectoryAction.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-commands/gshell-vfs/src/main/java/org/apache/geronimo/gshell/commands/vfs/ChangeDirectoryAction.java?rev=700410&r1=700409&r2=700410&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-commands/gshell-vfs/src/main/java/org/apache/geronimo/gshell/commands/vfs/ChangeDirectoryAction.java
(original)
+++ geronimo/gshell/trunk/gshell-commands/gshell-vfs/src/main/java/org/apache/geronimo/gshell/commands/vfs/ChangeDirectoryAction.java
Tue Sep 30 03:37:57 2008
@@ -57,6 +57,8 @@
         }
 
         setCurrentDirectory(context, file);
+
+        closeFile(file);
         
         return Result.SUCCESS;
     }

Modified: geronimo/gshell/trunk/gshell-commands/gshell-vfs/src/main/java/org/apache/geronimo/gshell/commands/vfs/CopyAction.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-commands/gshell-vfs/src/main/java/org/apache/geronimo/gshell/commands/vfs/CopyAction.java?rev=700410&r1=700409&r2=700410&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-commands/gshell-vfs/src/main/java/org/apache/geronimo/gshell/commands/vfs/CopyAction.java
(original)
+++ geronimo/gshell/trunk/gshell-commands/gshell-vfs/src/main/java/org/apache/geronimo/gshell/commands/vfs/CopyAction.java
Tue Sep 30 03:37:57 2008
@@ -66,6 +66,9 @@
 
         target.copyFrom(source, Selectors.SELECT_ALL);
 
+        closeFile(source);
+        closeFile(target);
+        
         return Result.SUCCESS;
     }
 }
\ No newline at end of file

Modified: geronimo/gshell/trunk/gshell-commands/gshell-vfs/src/main/java/org/apache/geronimo/gshell/commands/vfs/CurrentDirectoryAction.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-commands/gshell-vfs/src/main/java/org/apache/geronimo/gshell/commands/vfs/CurrentDirectoryAction.java?rev=700410&r1=700409&r2=700410&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-commands/gshell-vfs/src/main/java/org/apache/geronimo/gshell/commands/vfs/CurrentDirectoryAction.java
(original)
+++ geronimo/gshell/trunk/gshell-commands/gshell-vfs/src/main/java/org/apache/geronimo/gshell/commands/vfs/CurrentDirectoryAction.java
Tue Sep 30 03:37:57 2008
@@ -35,8 +35,10 @@
         assert context != null;
         IO io = context.getIo();
 
-        FileObject cwd = getCurrentDirectory(context);
-        io.info("{}", cwd.getName());
+        FileObject dir = getCurrentDirectory(context);
+        io.info("{}", dir.getName());
+
+        closeFile(dir);
 
         return Result.SUCCESS;
     }

Modified: geronimo/gshell/trunk/gshell-commands/gshell-vfs/src/main/java/org/apache/geronimo/gshell/commands/vfs/EditAction.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-commands/gshell-vfs/src/main/java/org/apache/geronimo/gshell/commands/vfs/EditAction.java?rev=700410&r1=700409&r2=700410&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-commands/gshell-vfs/src/main/java/org/apache/geronimo/gshell/commands/vfs/EditAction.java
(original)
+++ geronimo/gshell/trunk/gshell-commands/gshell-vfs/src/main/java/org/apache/geronimo/gshell/commands/vfs/EditAction.java
Tue Sep 30 03:37:57 2008
@@ -98,8 +98,11 @@
             log.debug("Updating original file with edited content");
             file.copyFrom(tmp, Selectors.SELECT_SELF);
             tmp.delete();
+            closeFile(tmp);
         }
 
+        closeFile(file);
+        
         return result;
     }
 

Modified: geronimo/gshell/trunk/gshell-commands/gshell-vfs/src/main/java/org/apache/geronimo/gshell/commands/vfs/FileInfoAction.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-commands/gshell-vfs/src/main/java/org/apache/geronimo/gshell/commands/vfs/FileInfoAction.java?rev=700410&r1=700409&r2=700410&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-commands/gshell-vfs/src/main/java/org/apache/geronimo/gshell/commands/vfs/FileInfoAction.java
(original)
+++ geronimo/gshell/trunk/gshell-commands/gshell-vfs/src/main/java/org/apache/geronimo/gshell/commands/vfs/FileInfoAction.java
Tue Sep 30 03:37:57 2008
@@ -80,9 +80,9 @@
         else {
             io.info("The file does not exist");
         }
-        
-        file.close();
 
+        closeFile(file);
+        
         return Result.SUCCESS;
     }
 }

Modified: geronimo/gshell/trunk/gshell-commands/gshell-vfs/src/main/java/org/apache/geronimo/gshell/commands/vfs/FindAction.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-commands/gshell-vfs/src/main/java/org/apache/geronimo/gshell/commands/vfs/FindAction.java?rev=700410&r1=700409&r2=700410&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-commands/gshell-vfs/src/main/java/org/apache/geronimo/gshell/commands/vfs/FindAction.java
(original)
+++ geronimo/gshell/trunk/gshell-commands/gshell-vfs/src/main/java/org/apache/geronimo/gshell/commands/vfs/FindAction.java
Tue Sep 30 03:37:57 2008
@@ -80,6 +80,8 @@
 
         find(context, root, selector);
 
+        closeFile(root);
+        
         return Result.SUCCESS;
     }
 

Modified: geronimo/gshell/trunk/gshell-commands/gshell-vfs/src/main/java/org/apache/geronimo/gshell/commands/vfs/ListDirectoryAction.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-commands/gshell-vfs/src/main/java/org/apache/geronimo/gshell/commands/vfs/ListDirectoryAction.java?rev=700410&r1=700409&r2=700410&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-commands/gshell-vfs/src/main/java/org/apache/geronimo/gshell/commands/vfs/ListDirectoryAction.java
(original)
+++ geronimo/gshell/trunk/gshell-commands/gshell-vfs/src/main/java/org/apache/geronimo/gshell/commands/vfs/ListDirectoryAction.java
Tue Sep 30 03:37:57 2008
@@ -87,6 +87,8 @@
             io.verbose("Last modified: {}", lastMod);
         }
 
+        closeFile(file);
+        
         return Result.SUCCESS;
     }
 

Modified: geronimo/gshell/trunk/gshell-commands/gshell-vfs/src/main/java/org/apache/geronimo/gshell/commands/vfs/RemoveAction.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-commands/gshell-vfs/src/main/java/org/apache/geronimo/gshell/commands/vfs/RemoveAction.java?rev=700410&r1=700409&r2=700410&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-commands/gshell-vfs/src/main/java/org/apache/geronimo/gshell/commands/vfs/RemoveAction.java
(original)
+++ geronimo/gshell/trunk/gshell-commands/gshell-vfs/src/main/java/org/apache/geronimo/gshell/commands/vfs/RemoveAction.java
Tue Sep 30 03:37:57 2008
@@ -21,7 +21,6 @@
 
 import org.apache.commons.vfs.FileObject;
 import org.apache.commons.vfs.Selectors;
-import org.apache.commons.vfs.FileType;
 import org.apache.geronimo.gshell.clp.Argument;
 import org.apache.geronimo.gshell.command.CommandContext;
 import org.apache.geronimo.gshell.io.IO;
@@ -54,6 +53,8 @@
 
         file.delete(Selectors.SELECT_SELF);
 
+        closeFile(file);
+        
         return Result.SUCCESS;
     }
 }
\ No newline at end of file

Modified: geronimo/gshell/trunk/gshell-commands/gshell-vfs/src/main/java/org/apache/geronimo/gshell/commands/vfs/TouchAction.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-commands/gshell-vfs/src/main/java/org/apache/geronimo/gshell/commands/vfs/TouchAction.java?rev=700410&r1=700409&r2=700410&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-commands/gshell-vfs/src/main/java/org/apache/geronimo/gshell/commands/vfs/TouchAction.java
(original)
+++ geronimo/gshell/trunk/gshell-commands/gshell-vfs/src/main/java/org/apache/geronimo/gshell/commands/vfs/TouchAction.java
Tue Sep 30 03:37:57 2008
@@ -47,6 +47,8 @@
 
         file.getContent().setLastModifiedTime(System.currentTimeMillis());
 
+        closeFile(file);
+        
         return Result.SUCCESS;
     }
 }
\ No newline at end of file

Modified: geronimo/gshell/trunk/gshell-commands/gshell-vfs/src/main/java/org/apache/geronimo/gshell/commands/vfs/VfsActionSupport.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-commands/gshell-vfs/src/main/java/org/apache/geronimo/gshell/commands/vfs/VfsActionSupport.java?rev=700410&r1=700409&r2=700410&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-commands/gshell-vfs/src/main/java/org/apache/geronimo/gshell/commands/vfs/VfsActionSupport.java
(original)
+++ geronimo/gshell/trunk/gshell-commands/gshell-vfs/src/main/java/org/apache/geronimo/gshell/commands/vfs/VfsActionSupport.java
Tue Sep 30 03:37:57 2008
@@ -64,7 +64,22 @@
         assert context != null;
         assert path != null;
 
+        log.trace("Resolving path: {}", path);
+        
         FileObject cwd = getCurrentDirectory(context);
         return getFileSystemAccess().resolveFile(cwd, path);
     }
+
+    protected void closeFile(final FileObject file) {
+        if (file != null) {
+            log.trace("Closing file: {}", file);
+            
+            try {
+                file.close();
+            }
+            catch (FileSystemException e) {
+                log.debug("Failed to close file: " + file, e);
+            }
+        }
+    }
 }
\ No newline at end of file



Mime
View raw message