commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 32982] New: - Addition of FileSystemUtils class
Date Fri, 07 Jan 2005 03:26:05 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=32982>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=32982

           Summary: Addition of FileSystemUtils class
           Product: Commons
           Version: unspecified
          Platform: All
               URL: http://www.omnytex.com/FileSystemUtils.java
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P4
         Component: IO
        AssignedTo: commons-dev@jakarta.apache.org
        ReportedBy: fzammetti@omnytex.com


First, let me say that this is my first Bugzilla submission of any kind 
anywhere, so if I did something wrong I apologize in advance, and I'd 
appreciate a kind nudge in the right direction :)

That aside, this is a follow-up to a submission I made on the Commons 
Developer list.  I submitted a function called getFreeSpace() that allows for 
getting the free space on a drive or volume in a cross-platform nature, 
something that is missing from Java at this point.  There seemed to be at 
least some support for this (IIRC, one +1 and one conditional +1), but Stephen 
Colebourne suggested it be part of a new FileSystemUtils class.  I have 
created this class and it is available for download at the referenced URL.

As Stephen suggested, I cleaned up the code and tried to make it adhere to the 
other Commons IO code (although it's not my own preferred coding style, so I 
could be off a bit in spots).

I did not attempt to make a unit test for it for two reasons... (1) I have no 
experience creating JUnit tests, although I would have tried except for (2) I 
didn't really see a way to test this.  My original post on the mailing list 
included a test harness app that just took in a drive or volume name on the 
command line and displayed the free space.  Someone would have to manually 
compare that result to what their OS reported, but aside from that I'm not 
sure how a test could be written for this.

Stephen also had a question regarding use cases for this.  I gave him two or 
three, but only one seemed convincing, so let me state it here as well...

If an application has to copy files to a volume, or create a file or series of 
files, it is very helpful to know before hand if that operation will fail or 
not, especially if it has to be an all-or-nothing operation.  This code will 
allow for that.  The alternative is to have exceptions thrown when the copy or 
create operations fail, and then clean up whatever did manage to get copied or 
created.  That's an obviously ugly solution.  In some cases it could even be a 
rather drastic problem: imagine creating a file on a server and running the 
volume out of space.  We all know what can happen in that case: all sorts of 
general nastiness!  Better to be able to tell before hand if you have enough 
space or not.  This code allows you to do that.

Please feel free to contact me at fzammetti@omnytex.com if I can be of any 
further help getting this added to Commons IO, assuming enough committers 
agree it's a good addition.  Thanks!

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

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


Mime
View raw message