HBASE-10037 Fix potential Resource Leak in EncodedDataBlock
git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1545873 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
fc67c8a8b8
commit
3874bc7f09
|
@ -165,14 +165,19 @@ public class EncodedDataBlock {
|
||||||
if (compressor != null) {
|
if (compressor != null) {
|
||||||
compressor.reset();
|
compressor.reset();
|
||||||
}
|
}
|
||||||
OutputStream compressingStream = algo.createCompressionStream(
|
OutputStream compressingStream = null;
|
||||||
|
|
||||||
|
try {
|
||||||
|
compressingStream = algo.createCompressionStream(
|
||||||
compressedStream, compressor, 0);
|
compressedStream, compressor, 0);
|
||||||
|
|
||||||
compressingStream.write(inputBuffer, offset, length);
|
compressingStream.write(inputBuffer, offset, length);
|
||||||
compressingStream.flush();
|
compressingStream.flush();
|
||||||
compressingStream.close();
|
|
||||||
|
|
||||||
return compressedStream.size();
|
return compressedStream.size();
|
||||||
|
} finally {
|
||||||
|
if (compressingStream != null) compressingStream.close();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue