ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Matt Benson <gudnabr...@yahoo.com>
Subject Re: Purpose of FileUtils.close(...)
Date Tue, 25 Jan 2005 16:18:32 GMT
--- Jesse Glick <jesse.glick@sun.com> wrote:

> Matt Benson wrote:
> > [...] In talking about whether caught Exceptions
> should at least be
> > logged, Jesse mentioned "disk full" as an example.
> [...] I found a
> > blog today [with] a workaround to detect this
> condition when writing
> > with a FOS, using the sync() method of the
> descriptor available from
> > the stream. We could insert this in our own FOS
> deriving from 
> > java.io.FOS; we could write our own FileWriter to
> use an instance of
> > (hypothetically) oata.util.FOS and force the
> Exception on full disk.
> > [...]
> 
> This sounds overly complicated to me. Wouldn't it be
> much easier to use 
> a plain FOS, assume that OutputStream.close() will
> throw an IOException 
> if something is broken, as its Javadoc says, and if
> caught rethrow this 
> as a BuildException in the usual way?

The problem, Jesse, is that the Exception won't be
thrown unless you explicitly sync() the
FileDescriptor; otherwise the write will take place in
cache and the result on disk later will be a zero-byte
file.  That's how I understood the problem, anyway.

-Matt
> 
> -J.
> 
> -- 
> Jesse Glick <mailto:jesse.glick@sun.com> x22801
> NetBeans, Open APIs  <http://www.netbeans.org/>
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> dev-unsubscribe@ant.apache.org
> For additional commands, e-mail:
> dev-help@ant.apache.org
> 
> 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

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


Mime
View raw message