Repository: logging-log4j2 Updated Branches: refs/heads/master 8db773208 -> 877490be9
Do not assign to params for easier debugging. Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/877490be Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/877490be Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/877490be Branch: refs/heads/master Commit: 877490be9df2ddb3b7c4af96676a13c3818fd101 Parents: 8db7732 Author: Gary Gregory <[email protected]> Authored: Tue Sep 2 10:42:29 2014 -0400 Committer: Gary Gregory <[email protected]> Committed: Tue Sep 2 10:42:29 2014 -0400 ---------------------------------------------------------------------- .../logging/log4j/streams/util/ByteStreamLogger.java | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/877490be/log4j-streams/src/main/java/org/apache/logging/log4j/streams/util/ByteStreamLogger.java ---------------------------------------------------------------------- diff --git a/log4j-streams/src/main/java/org/apache/logging/log4j/streams/util/ByteStreamLogger.java b/log4j-streams/src/main/java/org/apache/logging/log4j/streams/util/ByteStreamLogger.java index 27c7319..b7bdf25 100644 --- a/log4j-streams/src/main/java/org/apache/logging/log4j/streams/util/ByteStreamLogger.java +++ b/log4j-streams/src/main/java/org/apache/logging/log4j/streams/util/ByteStreamLogger.java @@ -120,16 +120,18 @@ public class ByteStreamLogger { } public void put(final String fqcn, final byte[] b, int off, int len) throws IOException { - if (len >= 0) { + int curOff = off; + int curLen = len; + if (curLen >= 0) { synchronized (this.msg) { - while (len > this.buf.remaining()) { + while (curLen > this.buf.remaining()) { final int remaining = this.buf.remaining(); - this.buf.put(b, off, remaining); - len -= remaining; - off += remaining; + this.buf.put(b, curOff, remaining); + curLen -= remaining; + curOff += remaining; extractMessages(fqcn); } - this.buf.put(b, off, len); + this.buf.put(b, curOff, curLen); extractMessages(fqcn); } } else {
