NIFI-1073 fixed possible, but not realistic, resource leak in 
DistributedMapCacheClientService


Project: http://git-wip-us.apache.org/repos/asf/nifi/repo
Commit: http://git-wip-us.apache.org/repos/asf/nifi/commit/e44e89cf
Tree: http://git-wip-us.apache.org/repos/asf/nifi/tree/e44e89cf
Diff: http://git-wip-us.apache.org/repos/asf/nifi/diff/e44e89cf

Branch: refs/heads/NIFI-1073
Commit: e44e89cf7b49cb236416b14455ecb71dcf5d2793
Parents: 35723d9
Author: Tony Kurc <trk...@gmail.com>
Authored: Mon Oct 26 21:35:45 2015 -0400
Committer: Tony Kurc <trk...@gmail.com>
Committed: Sun Nov 8 21:11:34 2015 -0500

----------------------------------------------------------------------
 .../nifi/controller/repository/VolatileContentRepository.java   | 5 +++++
 1 file changed, 5 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/nifi/blob/e44e89cf/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/repository/VolatileContentRepository.java
----------------------------------------------------------------------
diff --git 
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/repository/VolatileContentRepository.java
 
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/repository/VolatileContentRepository.java
index 7c7cade..0451812 100644
--- 
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/repository/VolatileContentRepository.java
+++ 
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/repository/VolatileContentRepository.java
@@ -50,6 +50,7 @@ import org.apache.nifi.processor.DataUnit;
 import org.apache.nifi.stream.io.ByteArrayInputStream;
 import org.apache.nifi.stream.io.StreamUtils;
 import org.apache.nifi.util.NiFiProperties;
+import org.apache.nifi.util.file.FileUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -407,8 +408,12 @@ public class VolatileContentRepository implements 
ContentRepository {
     @Override
     public long exportTo(ContentClaim claim, OutputStream destination, long 
offset, long length) throws IOException {
         final InputStream in = read(claim);
+        try {
         StreamUtils.skip(in, offset);
         StreamUtils.copy(in, destination, length);
+        } finally {
+            FileUtils.closeQuietly(in);
+        }
         return length;
     }
 

Reply via email to