commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christian Möller <dcmoel...@gmx.de>
Subject [VFS] Closed OutputStream from FileContent does not throw IOException if further written to
Date Thu, 15 Feb 2007 11:02:40 GMT
Hi,

I've a question regarding the behaviour of OutputStreams received from
org.apache.commons.vfs.FileContent.getOutputStream(): If I call close()
on them and further write some bytes to the stream, these writes take
place silently without throwing an IOException (as it is done by "usual"
Java streams like java.io.FileOutputStream).
As an example:

byte[] SOME_BYTES = new byte[]{70, 71, 72};
FileObject tmpFile = VFS.getManager().resolveFile("tmp:test.txt");
OutputStream os = tmpFile.getContent().getOutputStream();
os.write(SOME_BYTES);
os.close();
os.write(SOME_BYTES); // Neither IOE is thrown nor bytes are written

Why?

It brakes my code which gives the OutputStream to some clients expecting
that they are receiving an IOE if the stream has been closed.

Greetings

Christian

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


Mime
View raw message