Buggy code:
} finally { dataFactory . writeFinished ( ) ; } canUpdate = true ; writeRAFHeader ( actionIdentity , fileData , true , ( ( actionIdentity . getSegmentId ( ) ) != ( ContainerHandle . TEMPORARY_SEGMENT ) ) ) ; } catch ( IOException ioe ) { canUpdate = false ; boolean fileDeleted ; try { fileDeleted = privRemoveFile ( file ) ; } catch ( SecurityException se ) { throw StandardException . newException ( FILE_CREATE_NO_CLEANUP , ioe , file , se . toString ( ) ) ; } if ( ! fileDeleted ) { throw StandardException . newException ( FILE_CREATE_NO_CLEANUP , ioe , file , ioe . toString ( ) ) ; } throw StandardException . newException ( FILE_CREATE , ioe , file ) ; } return null ; } case RAFContainer . REMOVE_FILE_ACTION : return privRemoveFile ( actionFile ) ? this : null ; case RAFContainer . OPEN_CONTAINER_ACTION : { boolean isStub = false ; StorageFile file = privGetFileName ( actionIdentity , false , true , true ) ; if ( file == null ) return null ; try { if ( ! ( file . exists ( ) ) ) { file = privGetFileName ( actionIdentity , true , true , true ) ; if ( ! ( file . exists ( ) ) ) return null ; isStub = true ; } } catch ( SecurityException se ) { throw StandardException . newException ( DATA_UNEXPECTED_EXCEPTION , se ) ; } canUpdate = false ; try { if ( ( ! ( dataFactory . isReadOnly ( ) ) ) && ( file . canWrite ( ) ) ) canUpdate = true ; } catch ( SecurityException se ) { } fileName = file . toString ( ) ; try { fileData = file . getRandomAccessFile ( ( canUpdate ? "rw" : "r" ) ) ; readHeader ( getEmbryonicPage ( fileData , FIRST_ALLOC_PAGE_OFFSET ) ) ; if ( SanityManager . DEBUG ) { if ( isStub ) SanityManager . ASSERT ( ( ( getDroppedState ( ) ) && ( getCommittedDropState ( ) ) ) , "a<seq2seq4repair_space>stub<seq2seq4repair_space>failed<seq2seq4repair_space>to<seq2seq4repair_space>set<seq2seq4repair_space>drop<seq2seq4repair_space>state" ) ; } } catch ( IOException ioe ) { if ( isStub ) { throw dataFactory . markCorrupt ( StandardException . newException ( FILE_CONTAINER_EXCEPTION , ioe , ( ( getIdentity ( ) ) != null ? getIdentity ( ) . toString ( ) : "unknown" ) , "read" , fileName ) ) ; } StorageFile stub = privGetFileName ( actionIdentity , true , true , true ) ; if ( stub . exists ( ) ) { try { boolean delete_status = privRemoveFile ( file ) ; if ( SanityManager . DEBUG ) { if ( ! delete_status ) { SanityManager . THROWASSERT ( ( ( "delete<seq2seq4repair_space>of<seq2seq4repair_space>file<seq2seq4repair_space>(" + file ) + ")<seq2seq4repair_space>failed." ) ) ; } } fileData = stub . getRandomAccessFile ( ( canUpdate ? "rw" : "r" ) ) ; readHeader ( getEmbryonicPage ( fileData , FIRST_ALLOC_PAGE_OFFSET ) ) ; } catch ( IOException ioe2 ) { throw dataFactory . markCorrupt ( StandardException . newException ( FILE_CONTAINER_EXCEPTION , ioe2 , ( ( getIdentity ( ) ) != null ? getIdentity ( ) . toString ( ) : "unknown" ) , "delete-stub" , fileName ) ) ; } } else throw dataFactory . markCorrupt ( StandardException . newException ( FILE_CONTAINER_EXCEPTION , ioe , ( ( getIdentity ( ) ) != null ? getIdentity ( ) . toString ( ) : "unknown" ) , "read" , fileName ) ) ; } return this ; } case RAFContainer . REOPEN_CONTAINER_ACTION : { StorageFile file = privGetFileName ( actionIdentity , false , true , true ) ; synchronized ( this ) { try { fileData = file . getRandomAccessFile ( ( canUpdate ? "rw" : "r" ) ) ; } catch ( FileNotFoundException ioe ) { throw dataFactory . markCorrupt ( StandardException . newException ( FILE_CONTAINER_EXCEPTION , ioe , ( ( getIdentity ( ) ) != null ? getIdentity ( ) . toString ( ) : "unknown" ) , "read" , fileName ) ) ; } } return this ; } case RAFContainer . STUBBIFY_ACTION : { StorageFile file = privGetFileName ( actionIdentity , false , false , true ) ; StorageFile stub = privGetFileName ( actionIdentity , true , false , false ) ; StorageRandomAccessFile stubData = null ; try { if ( ! ( stub . exists ( ) ) ) { stubData = stub . getRandomAccessFile ( "rw" ) ; stub . limitAccessToOwner ( ) ; writeRAFHeader ( actionIdentity , stubData , true , true ) ; stubData . close ( ) ; stubData = null ; } dataFactory . flush ( actionInstant ) ; privRemoveFile ( file ) ; } catch ( SecurityException se ) { throw StandardException . newException ( FILE_CANNOT_REMOVE_FILE , se , file , se . toString ( ) ) ; } catch ( IOException ioe ) { try { if ( stubData != null ) { stubData . close ( ) ; stub . delete ( ) ; stubData = null ; } if ( ( fileData ) != null ) { fileData . close ( ) ; fileData = null ; } } catch ( IOException ioe2 ) { throw StandardException . newException ( FILE_CANNOT_REMOVE_FILE , ioe2 , file , ioe . toString ( ) ) ; } catch ( SecurityException se ) { <START_BUG> throw StandardException . newException ( FILE_CANNOT_REMOVE_FILE , se , file , stub ) ; <END_BUG> } } dataFactory . stubFileToRemoveAfterCheckPoint ( stub , actionInstant , getIdentity ( ) ) ; return null ; } case RAFContainer . GET_RANDOM_ACCESS_FILE_ACTION : { try { boolean exists = actionFile . exists ( ) ; Object result = actionFile . getRandomAccessFile ( "rw" ) ; if ( ! exists ) { actionFile . limitAccessToOwner ( ) ; } return result ; } catch ( FileNotFoundException fnfe ) { throw StandardException . newException ( FILE_CREATE , fnfe , actionFile . getPath ( ) ) ; } } } return null ; } }

Fix:
throw StandardException . newException ( FILE_CANNOT_REMOVE_FILE , se , file , se . toString ( ) ) ;