commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Darren Hartford" <>
Subject [VFS] FileContentInputStream
Date Tue, 12 Apr 2005 14:00:30 GMT
Hey all,
Interesting...concern.  I'm not sure if it is an issue as it seems
designed this way, but at least give a scenario where it breaks.

Under the DefaultFileContent class and related subclasses is an
innerclass called 'FileContentInputStream'.  Now for the example:

public InputStream returnStream(FileObject myfile) throws Exception{
FileContent fc = FileObject.getFileContent();
InputStream result = fc.getInputStream();
Return result;

Public void doSomething(FileObject myfile){
InputStream is = returnStream(myfile);
//do something with is

This method results in non-working code because as soon as you leave the
method (or you call fc.close()) the FileContent object and related
FileContentInputStream innerclass disappears and the InputStream becomes
nothing.  Before reporting this as a bug, wondering if anyone else has
any thoughts on this?


  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message