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;
|
||||||
compressedStream, compressor, 0);
|
|
||||||
|
|
||||||
compressingStream.write(inputBuffer, offset, length);
|
try {
|
||||||
compressingStream.flush();
|
compressingStream = algo.createCompressionStream(
|
||||||
compressingStream.close();
|
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