mirror of https://github.com/apache/druid.git
Changed branching logic for LZFCompressor to return null only on error, and avoid checking in most circumstances
This commit is contained in:
parent
9f945c2216
commit
6943db5251
|
@ -211,15 +211,16 @@ public class CompressedObjectStrategy<T extends Buffer> implements ObjectStrateg
|
||||||
@Override
|
@Override
|
||||||
public byte[] compress(byte[] bytes)
|
public byte[] compress(byte[] bytes)
|
||||||
{
|
{
|
||||||
LZFChunk chunk = null;
|
|
||||||
try (final ResourceHolder<ChunkEncoder> encoder = CompressedPools.getChunkEncoder()) {
|
try (final ResourceHolder<ChunkEncoder> encoder = CompressedPools.getChunkEncoder()) {
|
||||||
chunk = encoder.get().encodeChunk(bytes, 0, bytes.length);
|
final LZFChunk chunk = encoder.get().encodeChunk(bytes, 0, bytes.length);
|
||||||
|
return chunk.getData();
|
||||||
}
|
}
|
||||||
catch (IOException e) {
|
catch (IOException e) {
|
||||||
log.error(e, "IOException thrown while closing ChunkEncoder.");
|
log.error(e, "IOException thrown while closing ChunkEncoder.");
|
||||||
}
|
}
|
||||||
// IOException should be on ResourceHolder.close(), not encodeChunk, so this *should* never be null
|
// IOException should be on ResourceHolder.close(), not encodeChunk, so this *should* never happen
|
||||||
return null == chunk ? null : chunk.getData();
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue