Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShawn O. Pearce2011-12-01 01:17:59 +0000
committerShawn O. Pearce2011-12-01 01:45:41 +0000
commit0d61707f12b5b1a94b325fc8c2975a9e60a14dac (patch)
tree38616634067dda94e08944faca52753268d5ac4f /org.eclipse.jgit.http.server
parentcea935ab1b6caf52b31dfd4eae9696dfcc0593a2 (diff)
downloadjgit-0d61707f12b5b1a94b325fc8c2975a9e60a14dac.tar.gz
jgit-0d61707f12b5b1a94b325fc8c2975a9e60a14dac.tar.xz
jgit-0d61707f12b5b1a94b325fc8c2975a9e60a14dac.zip
Always close the GZIPOutputStream to release Deflater
The stream must be closed to ensure the native resources associated with its internal Deflater instance are cleaned up early, instead of waiting for GC to identify the dead object and finialize it. Change-Id: Ic31b5df563f19404ed4682556999f4332aa61562
Diffstat (limited to 'org.eclipse.jgit.http.server')
-rw-r--r--org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/SmartOutputStream.java7
1 files changed, 5 insertions, 2 deletions
diff --git a/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/SmartOutputStream.java b/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/SmartOutputStream.java
index 00cb67ca95..c39b78900d 100644
--- a/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/SmartOutputStream.java
+++ b/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/SmartOutputStream.java
@@ -101,8 +101,11 @@ class SmartOutputStream extends TemporaryBuffer {
TemporaryBuffer gzbuf = new TemporaryBuffer.Heap(LIMIT);
try {
GZIPOutputStream gzip = new GZIPOutputStream(gzbuf);
- out.writeTo(gzip, null);
- gzip.close();
+ try {
+ out.writeTo(gzip, null);
+ } finally {
+ gzip.close();
+ }
if (gzbuf.length() < out.length()) {
out = gzbuf;
rsp.setHeader(HDR_CONTENT_ENCODING, ENCODING_GZIP);

Back to the top