瀏覽代碼

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
tags/v1.3.0.201202121842-rc4
Shawn O. Pearce 12 年之前
父節點
當前提交
0d61707f12
共有 1 個文件被更改,包括 5 次插入2 次删除
  1. 5
    2
      org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/SmartOutputStream.java

+ 5
- 2
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);

Loading…
取消
儲存