Skip to content

Commit

Permalink
Issue #5121 - always use isDebugEnabled() check before logging in Com…
Browse files Browse the repository at this point in the history
…pressExtension

Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
  • Loading branch information
lachlan-roberts committed Aug 6, 2020
1 parent f416d87 commit e3cdebb
Showing 1 changed file with 6 additions and 18 deletions.
Expand Up @@ -193,7 +193,8 @@ protected void decompress(ByteAccumulator accumulator, ByteBuffer buf) throws Da
{
if (!supplyInput(inflater, buf))
{
LOG.debug("Needed input, but no buffer could supply input");
if (LOG.isDebugEnabled())
LOG.debug("Needed input, but no buffer could supply input");
return;
}

Expand All @@ -202,26 +203,22 @@ protected void decompress(ByteAccumulator accumulator, ByteBuffer buf) throws Da
{
if (read == 0)
{
LOG.debug("Decompress: read 0 {}", toDetail(inflater));
if (LOG.isDebugEnabled())
LOG.debug("Decompress: read 0 {}", toDetail(inflater));
break;
}
else
{
// do something with output
if (LOG.isDebugEnabled())
{
LOG.debug("Decompressed {} bytes: {}", read, toDetail(inflater));
}

accumulator.copyChunk(output, 0, read);
}
}
}

if (LOG.isDebugEnabled())
{
LOG.debug("Decompress: exiting {}", toDetail(inflater));
}
}

@Override
Expand Down Expand Up @@ -293,9 +290,7 @@ private static boolean supplyInput(Inflater inflater, ByteBuffer buf)
if (buf == null || buf.remaining() <= 0)
{
if (LOG.isDebugEnabled())
{
LOG.debug("No data left left to supply to Inflater");
}
return false;
}

Expand All @@ -322,9 +317,7 @@ private static boolean supplyInput(Inflater inflater, ByteBuffer buf)

inflater.setInput(input, inputOffset, len);
if (LOG.isDebugEnabled())
{
LOG.debug("Supplied {} input bytes: {}", input.length, toDetail(inflater));
}
return true;
}

Expand All @@ -333,9 +326,7 @@ private static boolean supplyInput(Deflater deflater, ByteBuffer buf)
if (buf == null || buf.remaining() <= 0)
{
if (LOG.isDebugEnabled())
{
LOG.debug("No data left left to supply to Deflater");
}
return false;
}

Expand All @@ -362,9 +353,7 @@ private static boolean supplyInput(Deflater deflater, ByteBuffer buf)

deflater.setInput(input, inputOffset, len);
if (LOG.isDebugEnabled())
{
LOG.debug("Supplied {} input bytes: {}", input.length, toDetail(deflater));
}
return true;
}

Expand Down Expand Up @@ -462,7 +451,8 @@ protected Action process() throws Exception
if (finished)
{
current = pollEntry();
LOG.debug("Processing {}", current);
if (LOG.isDebugEnabled())
LOG.debug("Processing {}", current);
if (current == null)
return Action.IDLE;
deflate(current);
Expand Down Expand Up @@ -570,9 +560,7 @@ else if (fin)
}

if (LOG.isDebugEnabled())
{
LOG.debug("Compressed {}: input:{} -> payload:{}", entry, outputLength, payload.remaining());
}

boolean continuation = frame.getType().isContinuation() || !first;
DataFrame chunk = new DataFrame(frame, continuation);
Expand Down

0 comments on commit e3cdebb

Please sign in to comment.