When ResilientFileOutputStream's base class (ResilientOutputStream ) attempts recovery it calls method openNewOutputStream() which returns an output stream instance.
The overriden openNewOutputStream() method in ResilientFileOutputStream only creates a FileOutputStream .
There are two problems with this:
1. ResilientFileOutputStream's fos is not re-created and so getChannel() is referencing a closed fos value.
2. ResilientFileOutputStream output stream is no longer buffered.
Perhaps the body of openNewOutputStream probably should read as:
fos = new FileOutputStream(file, true);
return new BufferedOutputStream(fos);