You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by se...@apache.org on 2011/04/10 13:26:56 UTC

svn commit: r1090779 - in /commons/proper/io/trunk/src: changes/changes.xml main/java/org/apache/commons/io/FileSystemUtils.java test/java/org/apache/commons/io/FileSystemUtilsTestCase.java

Author: sebb
Date: Sun Apr 10 11:26:55 2011
New Revision: 1090779

URL: http://svn.apache.org/viewvc?rev=1090779&view=rev
Log:
IO-263 FileSystemUtils.freeSpaceKb throws exception for Windows volumes with no visible files.
Improve coverage by also looking for hidden files.

Modified:
    commons/proper/io/trunk/src/changes/changes.xml
    commons/proper/io/trunk/src/main/java/org/apache/commons/io/FileSystemUtils.java
    commons/proper/io/trunk/src/test/java/org/apache/commons/io/FileSystemUtilsTestCase.java

Modified: commons/proper/io/trunk/src/changes/changes.xml
URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/changes/changes.xml?rev=1090779&r1=1090778&r2=1090779&view=diff
==============================================================================
--- commons/proper/io/trunk/src/changes/changes.xml (original)
+++ commons/proper/io/trunk/src/changes/changes.xml Sun Apr 10 11:26:55 2011
@@ -40,6 +40,10 @@ The <action> type attribute can be add,u
 
   <body>
     <release version="1.4" date="Not yet released">
+      <action dev="sebb" type="fix" issue="IO-263" due-to="Gil Adam">
+        FileSystemUtils.freeSpaceKb throws exception for Windows volumes with no visible files.
+        Improve coverage by also looking for hidden files.
+      </action>
     </release>
 
     <release version="1.3.2" date="2007-Jul-02">

Modified: commons/proper/io/trunk/src/main/java/org/apache/commons/io/FileSystemUtils.java
URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/main/java/org/apache/commons/io/FileSystemUtils.java?rev=1090779&r1=1090778&r2=1090779&view=diff
==============================================================================
--- commons/proper/io/trunk/src/main/java/org/apache/commons/io/FileSystemUtils.java (original)
+++ commons/proper/io/trunk/src/main/java/org/apache/commons/io/FileSystemUtils.java Sun Apr 10 11:26:55 2011
@@ -297,7 +297,7 @@ public class FileSystemUtils {
         }
         
         // build and run the 'dir' command
-        String[] cmdAttribs = new String[] {"cmd.exe", "/C", "dir /-c " + path};
+        String[] cmdAttribs = new String[] {"cmd.exe", "/C", "dir /a /-c " + path};
         
         // read in the output of the command to an ArrayList
         List<String> lines = performCommand(cmdAttribs, Integer.MAX_VALUE, timeout);

Modified: commons/proper/io/trunk/src/test/java/org/apache/commons/io/FileSystemUtilsTestCase.java
URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/test/java/org/apache/commons/io/FileSystemUtilsTestCase.java?rev=1090779&r1=1090778&r2=1090779&view=diff
==============================================================================
--- commons/proper/io/trunk/src/test/java/org/apache/commons/io/FileSystemUtilsTestCase.java (original)
+++ commons/proper/io/trunk/src/test/java/org/apache/commons/io/FileSystemUtilsTestCase.java Sun Apr 10 11:26:55 2011
@@ -186,7 +186,7 @@ public class FileSystemUtilsTestCase ext
             "17/08/2005  21:44    <DIR>          Desktop\n" +
             "               7 File(s)         180260 bytes\n" +
             "              10 Dir(s)     41411551232 bytes free";
-        FileSystemUtils fsu = new MockFileSystemUtils(0, lines, "dir /-c ");
+        FileSystemUtils fsu = new MockFileSystemUtils(0, lines, "dir /a /-c ");
         assertEquals(41411551232L, fsu.freeSpaceWindows("", -1));
     }
 
@@ -203,7 +203,7 @@ public class FileSystemUtilsTestCase ext
             "17/08/2005  21:44    <DIR>          Desktop\n" +
             "               7 File(s)         180260 bytes\n" +
             "              10 Dir(s)     41411551232 bytes free";
-        FileSystemUtils fsu = new MockFileSystemUtils(0, lines, "dir /-c \"C:\"");
+        FileSystemUtils fsu = new MockFileSystemUtils(0, lines, "dir /a /-c \"C:\"");
         assertEquals(41411551232L, fsu.freeSpaceWindows("C:", -1));
     }
 
@@ -220,7 +220,7 @@ public class FileSystemUtilsTestCase ext
             "17/08/2005  21:44    <DIR>          Desktop\n" +
             "               7 File(s)         180260 bytes\n" +
             "              10 Dir(s)     41411551232 bytes free";
-        FileSystemUtils fsu = new MockFileSystemUtils(0, lines, "dir /-c \"C:\\somedir\"");
+        FileSystemUtils fsu = new MockFileSystemUtils(0, lines, "dir /a /-c \"C:\\somedir\"");
         assertEquals(41411551232L, fsu.freeSpaceWindows("C:\\somedir", -1));
     }
 
@@ -237,7 +237,7 @@ public class FileSystemUtilsTestCase ext
             "17/08/2005  21:44    <DIR>          Desktop\n" +
             "               7 File(s)         180260 bytes\n" +
             "              10 Dir(s)     41411551232 bytes free";
-        FileSystemUtils fsu = new MockFileSystemUtils(0, lines, "dir /-c \"C:\\somedir\"");
+        FileSystemUtils fsu = new MockFileSystemUtils(0, lines, "dir /a /-c \"C:\\somedir\"");
         assertEquals(41411551232L, fsu.freeSpaceWindows("\"C:\\somedir\"", -1));
     }