markap14 commented on a change in pull request #3594: NIFI-3833 Support for 
Encrypted Flow File Repositories
URL: https://github.com/apache/nifi/pull/3594#discussion_r314024179
 
 

 ##########
 File path: 
nifi-commons/nifi-write-ahead-log/src/main/java/org/apache/nifi/wali/HashMapSnapshot.java
 ##########
 @@ -264,10 +267,11 @@ public synchronized void writeSnapshot(final 
SnapshotCapture<T> snapshot) throws
         }
 
         // Write to the partial file.
-        try (final FileOutputStream fileOut = new 
FileOutputStream(getPartialFile());
 
 Review comment:
   Is there a reason to avoid the creation of the Output Streams here from 
within the try-with-resources? With this change, if a Throwable were to be 
thrown after the FileOutputStream (for example OOME thrown by `new 
BufferedOutputStream(...)` then we should never close the `FileOutputStream` 
and leak the file handle

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to