knox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lmc...@apache.org
Subject knox git commit: KNOX-1430 - Potential output stream handle leak when copyLarge files in streamResponse (Guang Yang via lmccay)
Date Thu, 30 Aug 2018 23:12:49 GMT
Repository: knox
Updated Branches:
  refs/heads/master bc0cca6e5 -> 18bd3b8e2


KNOX-1430 - Potential output stream handle leak when copyLarge files in streamResponse (Guang
Yang via lmccay)

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

Branch: refs/heads/master
Commit: 18bd3b8e279bd4a7c93a1808feee34e5f9a13900
Parents: bc0cca6
Author: Larry McCay <larry.mccay@oracle.com>
Authored: Thu Aug 30 18:45:20 2018 -0400
Committer: Larry McCay <larry.mccay@oracle.com>
Committed: Thu Aug 30 18:45:20 2018 -0400

----------------------------------------------------------------------
 .../gateway/filter/rewrite/impl/UrlRewriteResponse.java     | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/knox/blob/18bd3b8e/gateway-provider-rewrite/src/main/java/org/apache/knox/gateway/filter/rewrite/impl/UrlRewriteResponse.java
----------------------------------------------------------------------
diff --git a/gateway-provider-rewrite/src/main/java/org/apache/knox/gateway/filter/rewrite/impl/UrlRewriteResponse.java
b/gateway-provider-rewrite/src/main/java/org/apache/knox/gateway/filter/rewrite/impl/UrlRewriteResponse.java
index d451c26..d623079 100644
--- a/gateway-provider-rewrite/src/main/java/org/apache/knox/gateway/filter/rewrite/impl/UrlRewriteResponse.java
+++ b/gateway-provider-rewrite/src/main/java/org/apache/knox/gateway/filter/rewrite/impl/UrlRewriteResponse.java
@@ -181,9 +181,12 @@ public class UrlRewriteResponse extends GatewayResponseWrapper implements
Params
     InputStream filteredInput = UrlRewriteStreamFilterFactory.create(
         mimeType, null, inStream, rewriter, this, UrlRewriter.Direction.OUT, filterContentConfig
);
     outStream = (isGzip) ? new GZIPOutputStream(output) : output;
-    IOUtils.copyLarge( filteredInput, outStream, new byte[STREAM_BUFFER_SIZE] );
-    //KNOX-685: outStream.flush();
-    outStream.close();
+    try {
+        IOUtils.copyLarge( filteredInput, outStream, new byte[STREAM_BUFFER_SIZE] );
+    } finally {
+        //KNOX-685: outStream.flush();
+        outStream.close();
+    }
   }
 
   //TODO: Need to buffer the output here and when it is closed, rewrite it and then write
the result to the stream.


Mime
View raw message