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) {
|
||||
compressor.reset();
|
||||
}
|
||||
OutputStream compressingStream = algo.createCompressionStream(
|
||||
compressedStream, compressor, 0);
|
||||
OutputStream compressingStream = null;
|
||||
|
||||
compressingStream.write(inputBuffer, offset, length);
|
||||
compressingStream.flush();
|
||||
compressingStream.close();
|
||||
try {
|
||||
compressingStream = algo.createCompressionStream(
|
||||
compressedStream, compressor, 0);
|
||||
|
||||
return compressedStream.size();
|
||||
compressingStream.write(inputBuffer, offset, length);
|
||||
compressingStream.flush();
|
||||
|
||||
return compressedStream.size();
|
||||
} finally {
|
||||
if (compressingStream != null) compressingStream.close();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue