Add 'this' qualifier to unqualified field accesses. Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/7f969fa7 Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/7f969fa7 Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/7f969fa7
Branch: refs/heads/LOG4J2-608 Commit: 7f969fa7af0a0bfbc882c379b70fd2f82a3021bd Parents: a15493a Author: Gary Gregory <[email protected]> Authored: Tue Sep 2 10:36:30 2014 -0400 Committer: Gary Gregory <[email protected]> Committed: Tue Sep 2 10:36:30 2014 -0400 ---------------------------------------------------------------------- .../logging/log4j/streams/ByteStreamLogger.java | 60 ++++++++--------- .../logging/log4j/streams/CharStreamLogger.java | 24 +++---- .../streams/LoggerBufferedInputStream.java | 2 +- .../log4j/streams/LoggerInputStream.java | 8 +-- .../log4j/streams/LoggerOutputStream.java | 30 ++++----- .../log4j/streams/LoggerPrintStream.java | 2 +- .../log4j/streams/LoggerPrintWriter.java | 2 +- .../logging/log4j/streams/LoggerReader.java | 8 +-- .../logging/log4j/streams/LoggerStreams.java | 40 +++++------ .../logging/log4j/streams/LoggerWriter.java | 14 ++-- .../log4j/streams/LoggerWriterFilter.java | 28 ++++---- .../log4j/streams/util/ByteStreamLogger.java | 60 ++++++++--------- .../log4j/streams/util/CharStreamLogger.java | 24 +++---- .../log4j/streams/AbstractLoggerWriterTest.java | 58 ++++++++-------- ...LoggerBufferedInputStreamCallerInfoTest.java | 18 ++--- .../streams/LoggerBufferedInputStreamTest.java | 2 +- .../LoggerBufferedReaderCallerInfoTest.java | 26 ++++---- .../log4j/streams/LoggerBufferedReaderTest.java | 6 +- .../LoggerInputStreamCallerInfoTest.java | 14 ++-- .../log4j/streams/LoggerInputStreamTest.java | 60 ++++++++--------- .../LoggerOutputStreamCallerInfoTest.java | 14 ++-- .../log4j/streams/LoggerOutputStreamTest.java | 48 +++++++------- .../LoggerPrintStreamCallerInfoTest.java | 54 +++++++-------- .../log4j/streams/LoggerPrintStreamTest.java | 56 ++++++++-------- .../LoggerPrintWriterCallerInfoTest.java | 54 +++++++-------- .../log4j/streams/LoggerPrintWriterTest.java | 58 ++++++++-------- .../streams/LoggerReaderCallerInfoTest.java | 16 ++--- .../logging/log4j/streams/LoggerReaderTest.java | 70 ++++++++++---------- .../log4j/streams/LoggerWriterFilterTest.java | 2 +- 29 files changed, 429 insertions(+), 429 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/7f969fa7/log4j-streams/src/main/java/org/apache/logging/log4j/streams/ByteStreamLogger.java ---------------------------------------------------------------------- diff --git a/log4j-streams/src/main/java/org/apache/logging/log4j/streams/ByteStreamLogger.java b/log4j-streams/src/main/java/org/apache/logging/log4j/streams/ByteStreamLogger.java index 83e8c3b..bbc9098 100644 --- a/log4j-streams/src/main/java/org/apache/logging/log4j/streams/ByteStreamLogger.java +++ b/log4j-streams/src/main/java/org/apache/logging/log4j/streams/ByteStreamLogger.java @@ -32,24 +32,24 @@ public class ByteStreamLogger { @Override public int read() throws IOException { - buf.flip(); + ByteStreamLogger.this.buf.flip(); int result = -1; - if (buf.limit() > 0) { - result = buf.get() & 0xFF; + if (ByteStreamLogger.this.buf.limit() > 0) { + result = ByteStreamLogger.this.buf.get() & 0xFF; } - buf.compact(); + ByteStreamLogger.this.buf.compact(); return result; } @Override public int read(final byte[] bytes, final int off, final int len) throws IOException { - buf.flip(); + ByteStreamLogger.this.buf.flip(); int result = -1; - if (buf.limit() > 0) { - result = Math.min(len, buf.limit()); - buf.get(bytes, off, result); + if (ByteStreamLogger.this.buf.limit() > 0) { + result = Math.min(len, ByteStreamLogger.this.buf.limit()); + ByteStreamLogger.this.buf.get(bytes, off, result); } - buf.compact(); + ByteStreamLogger.this.buf.compact(); return result; } } @@ -70,66 +70,66 @@ public class ByteStreamLogger { this.logger = logger; this.level = level; this.marker = marker; - in = new ByteBufferInputStream(); - reader = new InputStreamReader(in, charset); + this.in = new ByteBufferInputStream(); + this.reader = new InputStreamReader(this.in, charset); } public void close(final String fqcn) { - synchronized (msg) { - closed = true; + synchronized (this.msg) { + this.closed = true; logEnd(fqcn); // in.close(); } } private void extractMessages(final String fqcn) throws IOException { - if (closed) { + if (this.closed) { return; } - int read = reader.read(msgBuf); + int read = this.reader.read(this.msgBuf); while (read > 0) { int off = 0; for (int pos = 0; pos < read; pos++) { - switch (msgBuf[pos]) { + switch (this.msgBuf[pos]) { case '\r': - msg.append(msgBuf, off, pos - off); + this.msg.append(this.msgBuf, off, pos - off); off = pos + 1; break; case '\n': - msg.append(msgBuf, off, pos - off); + this.msg.append(this.msgBuf, off, pos - off); off = pos + 1; log(fqcn); break; } } - msg.append(msgBuf, off, read - off); - read = reader.read(msgBuf); + this.msg.append(this.msgBuf, off, read - off); + read = this.reader.read(this.msgBuf); } } private void log(final String fqcn) { // convert to string now so async loggers work - logger.logIfEnabled(fqcn, level, marker, msg.toString()); - msg.setLength(0); + this.logger.logIfEnabled(fqcn, this.level, this.marker, this.msg.toString()); + this.msg.setLength(0); } private void logEnd(final String fqcn) { - if (msg.length() > 0) { + if (this.msg.length() > 0) { log(fqcn); } } public void put(final String fqcn, final byte[] b, int off, int len) throws IOException { if (len >= 0) { - synchronized (msg) { - while (len > buf.remaining()) { - final int remaining = buf.remaining(); - buf.put(b, off, remaining); + synchronized (this.msg) { + while (len > this.buf.remaining()) { + final int remaining = this.buf.remaining(); + this.buf.put(b, off, remaining); len -= remaining; off += remaining; extractMessages(fqcn); } - buf.put(b, off, len); + this.buf.put(b, off, len); extractMessages(fqcn); } } else { @@ -139,8 +139,8 @@ public class ByteStreamLogger { public void put(final String fqcn, final int b) throws IOException { if (b >= 0) { - synchronized (msg) { - buf.put((byte) (b & 0xFF)); + synchronized (this.msg) { + this.buf.put((byte) (b & 0xFF)); extractMessages(fqcn); } } else { http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/7f969fa7/log4j-streams/src/main/java/org/apache/logging/log4j/streams/CharStreamLogger.java ---------------------------------------------------------------------- diff --git a/log4j-streams/src/main/java/org/apache/logging/log4j/streams/CharStreamLogger.java b/log4j-streams/src/main/java/org/apache/logging/log4j/streams/CharStreamLogger.java index d141752..b46cf85 100644 --- a/log4j-streams/src/main/java/org/apache/logging/log4j/streams/CharStreamLogger.java +++ b/log4j-streams/src/main/java/org/apache/logging/log4j/streams/CharStreamLogger.java @@ -37,20 +37,20 @@ public class CharStreamLogger { } public void close(final String fqcn) { - synchronized (msg) { - closed = true; + synchronized (this.msg) { + this.closed = true; logEnd(fqcn); } } private void log(final String fqcn) { - logger.logIfEnabled(fqcn, level, marker, msg.toString()); // convert to string now so async loggers + this.logger.logIfEnabled(fqcn, this.level, this.marker, this.msg.toString()); // convert to string now so async loggers // work - msg.setLength(0); + this.msg.setLength(0); } private void logEnd(final String fqcn) { - if (msg.length() > 0) { + if (this.msg.length() > 0) { log(fqcn); } } @@ -61,8 +61,8 @@ public class CharStreamLogger { public void put(final String fqcn, final CharSequence str, final int off, final int len) { if (len >= 0) { - synchronized (msg) { - if (closed) { + synchronized (this.msg) { + if (this.closed) { return; } int start = off; @@ -72,7 +72,7 @@ public class CharStreamLogger { switch (c) { case '\r': case '\n': - msg.append(str, start, pos); + this.msg.append(str, start, pos); start = pos + 1; if (c == '\n') { log(fqcn); @@ -80,7 +80,7 @@ public class CharStreamLogger { break; } } - msg.append(str, start, end); + this.msg.append(str, start, end); } } else { logEnd(fqcn); @@ -89,8 +89,8 @@ public class CharStreamLogger { public void put(final String fqcn, final int c) { if (c >= 0) { - synchronized (msg) { - if (closed) { + synchronized (this.msg) { + if (this.closed) { return; } switch (c) { @@ -100,7 +100,7 @@ public class CharStreamLogger { case '\r': break; default: - msg.append((char) c); + this.msg.append((char) c); } } } else { http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/7f969fa7/log4j-streams/src/main/java/org/apache/logging/log4j/streams/LoggerBufferedInputStream.java ---------------------------------------------------------------------- diff --git a/log4j-streams/src/main/java/org/apache/logging/log4j/streams/LoggerBufferedInputStream.java b/log4j-streams/src/main/java/org/apache/logging/log4j/streams/LoggerBufferedInputStream.java index 26f59ff..74b8918 100644 --- a/log4j-streams/src/main/java/org/apache/logging/log4j/streams/LoggerBufferedInputStream.java +++ b/log4j-streams/src/main/java/org/apache/logging/log4j/streams/LoggerBufferedInputStream.java @@ -100,6 +100,6 @@ public class LoggerBufferedInputStream extends BufferedInputStream { @Override public String toString() { - return LoggerBufferedInputStream.class.getSimpleName() + "{stream=" + in + '}'; + return LoggerBufferedInputStream.class.getSimpleName() + "{stream=" + this.in + '}'; } } http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/7f969fa7/log4j-streams/src/main/java/org/apache/logging/log4j/streams/LoggerInputStream.java ---------------------------------------------------------------------- diff --git a/log4j-streams/src/main/java/org/apache/logging/log4j/streams/LoggerInputStream.java b/log4j-streams/src/main/java/org/apache/logging/log4j/streams/LoggerInputStream.java index 1ac53ae..8fcb567 100644 --- a/log4j-streams/src/main/java/org/apache/logging/log4j/streams/LoggerInputStream.java +++ b/log4j-streams/src/main/java/org/apache/logging/log4j/streams/LoggerInputStream.java @@ -63,14 +63,14 @@ public class LoggerInputStream extends FilterInputStream { @Override public void close() throws IOException { - logger.close(fqcn); + this.logger.close(this.fqcn); super.close(); } @Override public int read() throws IOException { final int b = super.read(); - logger.put(fqcn, b); + this.logger.put(this.fqcn, b); return b; } @@ -82,12 +82,12 @@ public class LoggerInputStream extends FilterInputStream { @Override public int read(final byte[] b, final int off, final int len) throws IOException { final int bytesRead = super.read(b, off, len); - logger.put(fqcn, b, off, bytesRead); + this.logger.put(this.fqcn, b, off, bytesRead); return bytesRead; } @Override public String toString() { - return LoggerInputStream.class.getSimpleName() + "{stream=" + in + '}'; + return LoggerInputStream.class.getSimpleName() + "{stream=" + this.in + '}'; } } http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/7f969fa7/log4j-streams/src/main/java/org/apache/logging/log4j/streams/LoggerOutputStream.java ---------------------------------------------------------------------- diff --git a/log4j-streams/src/main/java/org/apache/logging/log4j/streams/LoggerOutputStream.java b/log4j-streams/src/main/java/org/apache/logging/log4j/streams/LoggerOutputStream.java index b10f805..391fd01 100644 --- a/log4j-streams/src/main/java/org/apache/logging/log4j/streams/LoggerOutputStream.java +++ b/log4j-streams/src/main/java/org/apache/logging/log4j/streams/LoggerOutputStream.java @@ -82,45 +82,45 @@ public class LoggerOutputStream extends OutputStream { @Override public void close() throws IOException { - if (out != null) { - out.close(); + if (this.out != null) { + this.out.close(); } - logger.close(fqcn); + this.logger.close(this.fqcn); } @Override public void flush() throws IOException { - if (out != null) { - out.flush(); + if (this.out != null) { + this.out.flush(); } } @Override public String toString() { - return LoggerOutputStream.class.getSimpleName() + "{stream=" + out + '}'; + return LoggerOutputStream.class.getSimpleName() + "{stream=" + this.out + '}'; } @Override public void write(final byte[] b) throws IOException { - if (out != null) { - out.write(b); + if (this.out != null) { + this.out.write(b); } - logger.put(fqcn, b, 0, b.length); + this.logger.put(this.fqcn, b, 0, b.length); } @Override public void write(final byte[] b, final int off, final int len) throws IOException { - if (out != null) { - out.write(b, off, len); + if (this.out != null) { + this.out.write(b, off, len); } - logger.put(fqcn, b, off, len); + this.logger.put(this.fqcn, b, off, len); } @Override public void write(final int b) throws IOException { - if (out != null) { - out.write(b); + if (this.out != null) { + this.out.write(b); } - logger.put(fqcn, (byte) (b & 0xFF)); + this.logger.put(this.fqcn, (byte) (b & 0xFF)); } } http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/7f969fa7/log4j-streams/src/main/java/org/apache/logging/log4j/streams/LoggerPrintStream.java ---------------------------------------------------------------------- diff --git a/log4j-streams/src/main/java/org/apache/logging/log4j/streams/LoggerPrintStream.java b/log4j-streams/src/main/java/org/apache/logging/log4j/streams/LoggerPrintStream.java index ad7fcb7..6792502 100644 --- a/log4j-streams/src/main/java/org/apache/logging/log4j/streams/LoggerPrintStream.java +++ b/log4j-streams/src/main/java/org/apache/logging/log4j/streams/LoggerPrintStream.java @@ -258,7 +258,7 @@ public class LoggerPrintStream extends PrintStream { @Override public String toString() { - return LoggerPrintStream.class.getSimpleName() + "{stream=" + out + '}'; + return LoggerPrintStream.class.getSimpleName() + "{stream=" + this.out + '}'; } @Override http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/7f969fa7/log4j-streams/src/main/java/org/apache/logging/log4j/streams/LoggerPrintWriter.java ---------------------------------------------------------------------- diff --git a/log4j-streams/src/main/java/org/apache/logging/log4j/streams/LoggerPrintWriter.java b/log4j-streams/src/main/java/org/apache/logging/log4j/streams/LoggerPrintWriter.java index b0861ed..4e014c8 100644 --- a/log4j-streams/src/main/java/org/apache/logging/log4j/streams/LoggerPrintWriter.java +++ b/log4j-streams/src/main/java/org/apache/logging/log4j/streams/LoggerPrintWriter.java @@ -229,7 +229,7 @@ public class LoggerPrintWriter extends PrintWriter { @Override public String toString() { - return LoggerPrintWriter.class.getSimpleName() + "{stream=" + out + '}'; + return LoggerPrintWriter.class.getSimpleName() + "{stream=" + this.out + '}'; } @Override http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/7f969fa7/log4j-streams/src/main/java/org/apache/logging/log4j/streams/LoggerReader.java ---------------------------------------------------------------------- diff --git a/log4j-streams/src/main/java/org/apache/logging/log4j/streams/LoggerReader.java b/log4j-streams/src/main/java/org/apache/logging/log4j/streams/LoggerReader.java index d156f67..f364c46 100644 --- a/log4j-streams/src/main/java/org/apache/logging/log4j/streams/LoggerReader.java +++ b/log4j-streams/src/main/java/org/apache/logging/log4j/streams/LoggerReader.java @@ -56,13 +56,13 @@ public class LoggerReader extends FilterReader { @Override public void close() throws IOException { super.close(); - logger.close(fqcn); + this.logger.close(this.fqcn); } @Override public int read() throws IOException { final int c = super.read(); - logger.put(fqcn, c); + this.logger.put(this.fqcn, c); return c; } @@ -74,7 +74,7 @@ public class LoggerReader extends FilterReader { @Override public int read(final char[] cbuf, final int off, final int len) throws IOException { final int charsRead = super.read(cbuf, off, len); - logger.put(fqcn, cbuf, off, charsRead); + this.logger.put(this.fqcn, cbuf, off, charsRead); return charsRead; } @@ -91,6 +91,6 @@ public class LoggerReader extends FilterReader { @Override public String toString() { - return LoggerReader.class.getSimpleName() + "{stream=" + in + '}'; + return LoggerReader.class.getSimpleName() + "{stream=" + this.in + '}'; } } http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/7f969fa7/log4j-streams/src/main/java/org/apache/logging/log4j/streams/LoggerStreams.java ---------------------------------------------------------------------- diff --git a/log4j-streams/src/main/java/org/apache/logging/log4j/streams/LoggerStreams.java b/log4j-streams/src/main/java/org/apache/logging/log4j/streams/LoggerStreams.java index 82bc946..4aa6483 100644 --- a/log4j-streams/src/main/java/org/apache/logging/log4j/streams/LoggerStreams.java +++ b/log4j-streams/src/main/java/org/apache/logging/log4j/streams/LoggerStreams.java @@ -44,32 +44,32 @@ public class LoggerStreams { } public LoggerBufferedInputStream create(final InputStream in) { - if (size > 0) { - return new LoggerBufferedInputStream(in, size, logger, level, marker); + if (this.size > 0) { + return new LoggerBufferedInputStream(in, this.size, this.logger, this.level, this.marker); } - return new LoggerBufferedInputStream(in, logger, level, marker); + return new LoggerBufferedInputStream(in, this.logger, this.level, this.marker); } public LoggerBufferedInputStream create(final InputStream in, final Charset charset) { - if (size > 0) { - return new LoggerBufferedInputStream(in, charset, size, logger, level, marker); + if (this.size > 0) { + return new LoggerBufferedInputStream(in, charset, this.size, this.logger, this.level, this.marker); } - return new LoggerBufferedInputStream(in, charset, logger, level, marker); + return new LoggerBufferedInputStream(in, charset, this.logger, this.level, this.marker); } public LoggerBufferedReader create(final Reader reader) { - if (size > 0) { - return new LoggerBufferedReader(reader, size, logger, level, marker); + if (this.size > 0) { + return new LoggerBufferedReader(reader, this.size, this.logger, this.level, this.marker); } - return new LoggerBufferedReader(reader, logger, level, marker); + return new LoggerBufferedReader(reader, this.logger, this.level, this.marker); } public BufferedBuilder marker(final Marker marker) { - return new BufferedBuilder(logger, level, marker, size); + return new BufferedBuilder(this.logger, this.level, marker, this.size); } public BufferedBuilder size(final int size) { - return new BufferedBuilder(logger, level, marker, size); + return new BufferedBuilder(this.logger, this.level, this.marker, size); } } @@ -85,19 +85,19 @@ public class LoggerStreams { } public BufferedBuilder buffered() { - return new BufferedBuilder(logger, level, marker, 0); + return new BufferedBuilder(this.logger, this.level, this.marker, 0); } public LoggerWriterFilter create(final Writer writer) { - return new LoggerWriterFilter(writer, logger, level, marker); + return new LoggerWriterFilter(writer, this.logger, this.level, this.marker); } public Builder marker(final Marker marker) { - return new Builder(logger, level, marker); + return new Builder(this.logger, this.level, marker); } public PrintingBuilder printing() { - return new PrintingBuilder(logger, level, marker, false); + return new PrintingBuilder(this.logger, this.level, this.marker, false); } } @@ -119,16 +119,16 @@ public class LoggerStreams { } public PrintingBuilder autoFlush(final boolean autoFlush) { - return new PrintingBuilder(logger, level, marker, autoFlush); + return new PrintingBuilder(this.logger, this.level, this.marker, autoFlush); } public LoggerPrintStream create(final OutputStream out) { - return new LoggerPrintStream(out, autoFlush, logger, level, marker); + return new LoggerPrintStream(out, this.autoFlush, this.logger, this.level, this.marker); } public LoggerPrintStream create(final OutputStream out, final Charset charset) { try { - return new LoggerPrintStream(out, autoFlush, charset, logger, level, marker); + return new LoggerPrintStream(out, this.autoFlush, charset, this.logger, this.level, this.marker); } catch (final UnsupportedEncodingException e) { // Should never occur because the constructor must throw this throw new IllegalArgumentException("Invalid charset", e); @@ -136,11 +136,11 @@ public class LoggerStreams { } public LoggerPrintWriter create(final Writer writer) { - return new LoggerPrintWriter(writer, autoFlush, logger, level, marker); + return new LoggerPrintWriter(writer, this.autoFlush, this.logger, this.level, this.marker); } public PrintingBuilder marker(final Marker marker) { - return new PrintingBuilder(logger, level, marker, autoFlush); + return new PrintingBuilder(this.logger, this.level, marker, this.autoFlush); } } http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/7f969fa7/log4j-streams/src/main/java/org/apache/logging/log4j/streams/LoggerWriter.java ---------------------------------------------------------------------- diff --git a/log4j-streams/src/main/java/org/apache/logging/log4j/streams/LoggerWriter.java b/log4j-streams/src/main/java/org/apache/logging/log4j/streams/LoggerWriter.java index d663fc2..291ee45 100644 --- a/log4j-streams/src/main/java/org/apache/logging/log4j/streams/LoggerWriter.java +++ b/log4j-streams/src/main/java/org/apache/logging/log4j/streams/LoggerWriter.java @@ -51,7 +51,7 @@ public class LoggerWriter extends Writer { @Override public void close() throws IOException { - logger.close(fqcn); + this.logger.close(this.fqcn); } @Override @@ -60,31 +60,31 @@ public class LoggerWriter extends Writer { @Override public String toString() { - return this.getClass().getSimpleName() + "[fqcn=" + fqcn + ", logger=" + logger + "]"; + return this.getClass().getSimpleName() + "[fqcn=" + this.fqcn + ", logger=" + this.logger + "]"; } @Override public void write(final char[] cbuf) throws IOException { - logger.put(fqcn, cbuf, 0, cbuf.length); + this.logger.put(this.fqcn, cbuf, 0, cbuf.length); } @Override public void write(final char[] cbuf, final int off, final int len) throws IOException { - logger.put(fqcn, cbuf, off, len); + this.logger.put(this.fqcn, cbuf, off, len); } @Override public void write(final int c) throws IOException { - logger.put(fqcn, (char) c); + this.logger.put(this.fqcn, (char) c); } @Override public void write(final String str) throws IOException { - logger.put(fqcn, str, 0, str.length()); + this.logger.put(this.fqcn, str, 0, str.length()); } @Override public void write(final String str, final int off, final int len) throws IOException { - logger.put(fqcn, str, off, len); + this.logger.put(this.fqcn, str, off, len); } } http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/7f969fa7/log4j-streams/src/main/java/org/apache/logging/log4j/streams/LoggerWriterFilter.java ---------------------------------------------------------------------- diff --git a/log4j-streams/src/main/java/org/apache/logging/log4j/streams/LoggerWriterFilter.java b/log4j-streams/src/main/java/org/apache/logging/log4j/streams/LoggerWriterFilter.java index 858ac11..a219ba5 100644 --- a/log4j-streams/src/main/java/org/apache/logging/log4j/streams/LoggerWriterFilter.java +++ b/log4j-streams/src/main/java/org/apache/logging/log4j/streams/LoggerWriterFilter.java @@ -54,47 +54,47 @@ public class LoggerWriterFilter extends FilterWriter { @Override public void close() throws IOException { - out.close(); - logger.close(fqcn); + this.out.close(); + this.logger.close(this.fqcn); } @Override public void flush() throws IOException { - out.flush(); + this.out.flush(); } @Override public String toString() { - return LoggerWriterFilter.class.getSimpleName() + "{writer=" + out + '}'; + return LoggerWriterFilter.class.getSimpleName() + "{writer=" + this.out + '}'; } @Override public void write(final char[] cbuf) throws IOException { - out.write(cbuf); - logger.put(fqcn, cbuf, 0, cbuf.length); + this.out.write(cbuf); + this.logger.put(this.fqcn, cbuf, 0, cbuf.length); } @Override public void write(final char[] cbuf, final int off, final int len) throws IOException { - out.write(cbuf, off, len); - logger.put(fqcn, cbuf, off, len); + this.out.write(cbuf, off, len); + this.logger.put(this.fqcn, cbuf, off, len); } @Override public void write(final int c) throws IOException { - out.write(c); - logger.put(fqcn, (char) c); + this.out.write(c); + this.logger.put(this.fqcn, (char) c); } @Override public void write(final String str) throws IOException { - out.write(str); - logger.put(fqcn, str, 0, str.length()); + this.out.write(str); + this.logger.put(this.fqcn, str, 0, str.length()); } @Override public void write(final String str, final int off, final int len) throws IOException { - out.write(str, off, len); - logger.put(fqcn, str, off, len); + this.out.write(str, off, len); + this.logger.put(this.fqcn, str, off, len); } } http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/7f969fa7/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 655497b..27c7319 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 @@ -32,24 +32,24 @@ public class ByteStreamLogger { @Override public int read() throws IOException { - buf.flip(); + ByteStreamLogger.this.buf.flip(); int result = -1; - if (buf.limit() > 0) { - result = buf.get() & 0xFF; + if (ByteStreamLogger.this.buf.limit() > 0) { + result = ByteStreamLogger.this.buf.get() & 0xFF; } - buf.compact(); + ByteStreamLogger.this.buf.compact(); return result; } @Override public int read(final byte[] bytes, final int off, final int len) throws IOException { - buf.flip(); + ByteStreamLogger.this.buf.flip(); int result = -1; - if (buf.limit() > 0) { - result = Math.min(len, buf.limit()); - buf.get(bytes, off, result); + if (ByteStreamLogger.this.buf.limit() > 0) { + result = Math.min(len, ByteStreamLogger.this.buf.limit()); + ByteStreamLogger.this.buf.get(bytes, off, result); } - buf.compact(); + ByteStreamLogger.this.buf.compact(); return result; } } @@ -70,66 +70,66 @@ public class ByteStreamLogger { this.logger = logger; this.level = level; this.marker = marker; - in = new ByteBufferInputStream(); - reader = new InputStreamReader(in, charset); + this.in = new ByteBufferInputStream(); + this.reader = new InputStreamReader(this.in, charset); } public void close(final String fqcn) { - synchronized (msg) { - closed = true; + synchronized (this.msg) { + this.closed = true; logEnd(fqcn); // in.close(); } } private void extractMessages(final String fqcn) throws IOException { - if (closed) { + if (this.closed) { return; } - int read = reader.read(msgBuf); + int read = this.reader.read(this.msgBuf); while (read > 0) { int off = 0; for (int pos = 0; pos < read; pos++) { - switch (msgBuf[pos]) { + switch (this.msgBuf[pos]) { case '\r': - msg.append(msgBuf, off, pos - off); + this.msg.append(this.msgBuf, off, pos - off); off = pos + 1; break; case '\n': - msg.append(msgBuf, off, pos - off); + this.msg.append(this.msgBuf, off, pos - off); off = pos + 1; log(fqcn); break; } } - msg.append(msgBuf, off, read - off); - read = reader.read(msgBuf); + this.msg.append(this.msgBuf, off, read - off); + read = this.reader.read(this.msgBuf); } } private void log(final String fqcn) { // convert to string now so async loggers work - logger.logIfEnabled(fqcn, level, marker, msg.toString()); - msg.setLength(0); + this.logger.logIfEnabled(fqcn, this.level, this.marker, this.msg.toString()); + this.msg.setLength(0); } private void logEnd(final String fqcn) { - if (msg.length() > 0) { + if (this.msg.length() > 0) { log(fqcn); } } public void put(final String fqcn, final byte[] b, int off, int len) throws IOException { if (len >= 0) { - synchronized (msg) { - while (len > buf.remaining()) { - final int remaining = buf.remaining(); - buf.put(b, off, remaining); + synchronized (this.msg) { + while (len > this.buf.remaining()) { + final int remaining = this.buf.remaining(); + this.buf.put(b, off, remaining); len -= remaining; off += remaining; extractMessages(fqcn); } - buf.put(b, off, len); + this.buf.put(b, off, len); extractMessages(fqcn); } } else { @@ -139,8 +139,8 @@ public class ByteStreamLogger { public void put(final String fqcn, final int b) throws IOException { if (b >= 0) { - synchronized (msg) { - buf.put((byte) (b & 0xFF)); + synchronized (this.msg) { + this.buf.put((byte) (b & 0xFF)); extractMessages(fqcn); } } else { http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/7f969fa7/log4j-streams/src/main/java/org/apache/logging/log4j/streams/util/CharStreamLogger.java ---------------------------------------------------------------------- diff --git a/log4j-streams/src/main/java/org/apache/logging/log4j/streams/util/CharStreamLogger.java b/log4j-streams/src/main/java/org/apache/logging/log4j/streams/util/CharStreamLogger.java index 71b63ce..ffe2c17 100644 --- a/log4j-streams/src/main/java/org/apache/logging/log4j/streams/util/CharStreamLogger.java +++ b/log4j-streams/src/main/java/org/apache/logging/log4j/streams/util/CharStreamLogger.java @@ -37,20 +37,20 @@ public class CharStreamLogger { } public void close(final String fqcn) { - synchronized (msg) { - closed = true; + synchronized (this.msg) { + this.closed = true; logEnd(fqcn); } } private void log(final String fqcn) { // convert to string now so async loggers work - logger.logIfEnabled(fqcn, level, marker, msg.toString()); - msg.setLength(0); + this.logger.logIfEnabled(fqcn, this.level, this.marker, this.msg.toString()); + this.msg.setLength(0); } private void logEnd(final String fqcn) { - if (msg.length() > 0) { + if (this.msg.length() > 0) { log(fqcn); } } @@ -61,8 +61,8 @@ public class CharStreamLogger { public void put(final String fqcn, final CharSequence str, final int off, final int len) { if (len >= 0) { - synchronized (msg) { - if (closed) { + synchronized (this.msg) { + if (this.closed) { return; } int start = off; @@ -72,7 +72,7 @@ public class CharStreamLogger { switch (c) { case '\r': case '\n': - msg.append(str, start, pos); + this.msg.append(str, start, pos); start = pos + 1; if (c == '\n') { log(fqcn); @@ -80,7 +80,7 @@ public class CharStreamLogger { break; } } - msg.append(str, start, end); + this.msg.append(str, start, end); } } else { logEnd(fqcn); @@ -89,8 +89,8 @@ public class CharStreamLogger { public void put(final String fqcn, final int c) { if (c >= 0) { - synchronized (msg) { - if (closed) { + synchronized (this.msg) { + if (this.closed) { return; } switch (c) { @@ -100,7 +100,7 @@ public class CharStreamLogger { case '\r': break; default: - msg.append((char) c); + this.msg.append((char) c); } } } else { http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/7f969fa7/log4j-streams/src/test/java/org/apache/logging/log4j/streams/AbstractLoggerWriterTest.java ---------------------------------------------------------------------- diff --git a/log4j-streams/src/test/java/org/apache/logging/log4j/streams/AbstractLoggerWriterTest.java b/log4j-streams/src/test/java/org/apache/logging/log4j/streams/AbstractLoggerWriterTest.java index f62360f..46535ab 100644 --- a/log4j-streams/src/test/java/org/apache/logging/log4j/streams/AbstractLoggerWriterTest.java +++ b/log4j-streams/src/test/java/org/apache/logging/log4j/streams/AbstractLoggerWriterTest.java @@ -35,8 +35,8 @@ public abstract class AbstractLoggerWriterTest extends AbstractStreamTest { @Before public void createStream() { - wrapped = createWriter(); - writer = createWriterWrapper(); + this.wrapped = createWriter(); + this.writer = createWriterWrapper(); } protected abstract StringWriter createWriter(); @@ -45,21 +45,21 @@ public abstract class AbstractLoggerWriterTest extends AbstractStreamTest { @Test public void testClose_HasRemainingData() throws IOException { - writer.write(FIRST); + this.writer.write(FIRST); assertMessages(); - writer.close(); + this.writer.close(); assertMessages(FIRST); - if (wrapped != null) { - assertEquals(FIRST, wrapped.toString()); + if (this.wrapped != null) { + assertEquals(FIRST, this.wrapped.toString()); } } @Test public void testClose_NoRemainingData() throws IOException { - writer.close(); + this.writer.close(); assertMessages(); - if (wrapped != null) { - assertEquals("", wrapped.toString()); + if (this.wrapped != null) { + assertEquals("", this.wrapped.toString()); } } @@ -79,25 +79,25 @@ public abstract class AbstractLoggerWriterTest extends AbstractStreamTest { @Test public void testWrite_Character() throws Exception { for (final char c : FIRST.toCharArray()) { - writer.write(c); + this.writer.write(c); assertMessages(); } - writer.write('\n'); + this.writer.write('\n'); assertMessages(FIRST); - if (wrapped != null) { - assertEquals(FIRST + '\n', wrapped.toString()); + if (this.wrapped != null) { + assertEquals(FIRST + '\n', this.wrapped.toString()); } } @Test public void testWrite_CharArray() throws Exception { final char[] chars = FIRST.toCharArray(); - writer.write(chars); + this.writer.write(chars); assertMessages(); - writer.write('\n'); + this.writer.write('\n'); assertMessages(FIRST); - if (wrapped != null) { - assertEquals(FIRST + '\n', wrapped.toString()); + if (this.wrapped != null) { + assertEquals(FIRST + '\n', this.wrapped.toString()); } } @@ -107,32 +107,32 @@ public abstract class AbstractLoggerWriterTest extends AbstractStreamTest { final int middle = chars.length / 2; final int length = chars.length - middle; final String right = new String(chars, middle, length); - writer.write(chars, middle, length); + this.writer.write(chars, middle, length); assertMessages(); - writer.write('\n'); + this.writer.write('\n'); assertMessages(right); - if (wrapped != null) { - assertEquals(FIRST.substring(middle, FIRST.length()) + '\n', wrapped.toString()); + if (this.wrapped != null) { + assertEquals(FIRST.substring(middle, FIRST.length()) + '\n', this.wrapped.toString()); } } @Test public void testWrite_IgnoresWindowsNewline() throws IOException { - writer.write(FIRST + "\r\n"); - writer.write(LAST); - writer.close(); + this.writer.write(FIRST + "\r\n"); + this.writer.write(LAST); + this.writer.close(); assertMessages(FIRST, LAST); - if (wrapped != null) { - assertEquals(FIRST + "\r\n" + LAST, wrapped.toString()); + if (this.wrapped != null) { + assertEquals(FIRST + "\r\n" + LAST, this.wrapped.toString()); } } @Test public void testWrite_MultipleLines() throws IOException { - writer.write(FIRST + '\n' + LAST + '\n'); + this.writer.write(FIRST + '\n' + LAST + '\n'); assertMessages(FIRST, LAST); - if (wrapped != null) { - assertEquals(FIRST + '\n' + LAST + '\n', wrapped.toString()); + if (this.wrapped != null) { + assertEquals(FIRST + '\n' + LAST + '\n', this.wrapped.toString()); } } } http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/7f969fa7/log4j-streams/src/test/java/org/apache/logging/log4j/streams/LoggerBufferedInputStreamCallerInfoTest.java ---------------------------------------------------------------------- diff --git a/log4j-streams/src/test/java/org/apache/logging/log4j/streams/LoggerBufferedInputStreamCallerInfoTest.java b/log4j-streams/src/test/java/org/apache/logging/log4j/streams/LoggerBufferedInputStreamCallerInfoTest.java index 07df463..079deb1 100644 --- a/log4j-streams/src/test/java/org/apache/logging/log4j/streams/LoggerBufferedInputStreamCallerInfoTest.java +++ b/log4j-streams/src/test/java/org/apache/logging/log4j/streams/LoggerBufferedInputStreamCallerInfoTest.java @@ -28,39 +28,39 @@ public class LoggerBufferedInputStreamCallerInfoTest extends LoggerStreamsCaller @Test public void close() throws Exception { - logIn.read(); + this.logIn.read(); assertMessages("before close", 3, "close"); - logIn.close(); + this.logIn.close(); assertMessages("after close", 4, "close"); } @Test public void read() throws Exception { - logIn.read(); + this.logIn.read(); assertMessages("read", 3, "read"); - logIn.close(); + this.logIn.close(); } @Test public void readBytes() throws Exception { - logIn.read(new byte[2]); + this.logIn.read(new byte[2]); assertMessages("read", 3, "readBytes"); - logIn.close(); + this.logIn.close(); } @Test public void readBytesOffsetLen() throws Exception { - logIn.read(new byte[2], 0, 2); + this.logIn.read(new byte[2], 0, 2); assertMessages("read", 3, "readBytesOffsetLen"); - logIn.close(); + this.logIn.close(); } @Before public void setupStreams() { final InputStream srcInputStream = new ByteArrayInputStream("a\nb\nc\nd".getBytes()); - logIn = new LoggerBufferedInputStream(srcInputStream, getLogger(), LEVEL); + this.logIn = new LoggerBufferedInputStream(srcInputStream, getLogger(), LEVEL); } } http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/7f969fa7/log4j-streams/src/test/java/org/apache/logging/log4j/streams/LoggerBufferedInputStreamTest.java ---------------------------------------------------------------------- diff --git a/log4j-streams/src/test/java/org/apache/logging/log4j/streams/LoggerBufferedInputStreamTest.java b/log4j-streams/src/test/java/org/apache/logging/log4j/streams/LoggerBufferedInputStreamTest.java index e6d60f0..8c18243 100644 --- a/log4j-streams/src/test/java/org/apache/logging/log4j/streams/LoggerBufferedInputStreamTest.java +++ b/log4j-streams/src/test/java/org/apache/logging/log4j/streams/LoggerBufferedInputStreamTest.java @@ -24,6 +24,6 @@ public class LoggerBufferedInputStreamTest extends LoggerInputStreamTest { @Override protected InputStream createInputStream() { - return new LoggerBufferedInputStream(wrapped, getLogger(), Level.ERROR); + return new LoggerBufferedInputStream(this.wrapped, getLogger(), Level.ERROR); } } http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/7f969fa7/log4j-streams/src/test/java/org/apache/logging/log4j/streams/LoggerBufferedReaderCallerInfoTest.java ---------------------------------------------------------------------- diff --git a/log4j-streams/src/test/java/org/apache/logging/log4j/streams/LoggerBufferedReaderCallerInfoTest.java b/log4j-streams/src/test/java/org/apache/logging/log4j/streams/LoggerBufferedReaderCallerInfoTest.java index 44850dd..b723651 100644 --- a/log4j-streams/src/test/java/org/apache/logging/log4j/streams/LoggerBufferedReaderCallerInfoTest.java +++ b/log4j-streams/src/test/java/org/apache/logging/log4j/streams/LoggerBufferedReaderCallerInfoTest.java @@ -30,55 +30,55 @@ public class LoggerBufferedReaderCallerInfoTest extends LoggerStreamsCallerInfoT @Test public void close() throws Exception { - logReader.readLine(); + this.logReader.readLine(); assertMessages("before close", 3, "close"); - logReader.close(); + this.logReader.close(); assertMessages("after close", 4, "close"); } @Test public void read() throws Exception { - logReader.read(); + this.logReader.read(); assertMessages("read", 3, "read"); - logReader.close(); + this.logReader.close(); } @Test public void readCbuf() throws Exception { - logReader.read(new char[2]); + this.logReader.read(new char[2]); assertMessages("read", 3, "readCbuf"); - logReader.close(); + this.logReader.close(); } @Test public void readCbufOffset() throws Exception { - logReader.read(new char[2], 0, 2); + this.logReader.read(new char[2], 0, 2); assertMessages("read", 3, "readCbufOffset"); - logReader.close(); + this.logReader.close(); } @Test public void readCharBuffer() throws Exception { - logReader.read(CharBuffer.allocate(2)); + this.logReader.read(CharBuffer.allocate(2)); assertMessages("read", 3, "readCharBuffer"); - logReader.close(); + this.logReader.close(); } @Test public void readLine() throws Exception { - logReader.readLine(); + this.logReader.readLine(); assertMessages("read", 3, "readLine"); - logReader.close(); + this.logReader.close(); } @Before public void setupReader() { final Reader srcReader = new StringReader("a\nb\nc\nd"); - logReader = new LoggerBufferedReader(srcReader, getLogger(), Level.WARN); + this.logReader = new LoggerBufferedReader(srcReader, getLogger(), Level.WARN); } } http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/7f969fa7/log4j-streams/src/test/java/org/apache/logging/log4j/streams/LoggerBufferedReaderTest.java ---------------------------------------------------------------------- diff --git a/log4j-streams/src/test/java/org/apache/logging/log4j/streams/LoggerBufferedReaderTest.java b/log4j-streams/src/test/java/org/apache/logging/log4j/streams/LoggerBufferedReaderTest.java index a69355b..d6b6782 100644 --- a/log4j-streams/src/test/java/org/apache/logging/log4j/streams/LoggerBufferedReaderTest.java +++ b/log4j-streams/src/test/java/org/apache/logging/log4j/streams/LoggerBufferedReaderTest.java @@ -28,14 +28,14 @@ public class LoggerBufferedReaderTest extends LoggerReaderTest { @Override protected Reader createReader() { - return reader = new LoggerBufferedReader(wrapped, getLogger(), LEVEL); + return this.reader = new LoggerBufferedReader(this.wrapped, getLogger(), LEVEL); } @Test public void testReadLine() throws Exception { - assertEquals("first line", FIRST, reader.readLine()); + assertEquals("first line", FIRST, this.reader.readLine()); assertMessages(FIRST); - assertEquals("second line", LAST, reader.readLine()); + assertEquals("second line", LAST, this.reader.readLine()); assertMessages(FIRST, LAST); } } http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/7f969fa7/log4j-streams/src/test/java/org/apache/logging/log4j/streams/LoggerInputStreamCallerInfoTest.java ---------------------------------------------------------------------- diff --git a/log4j-streams/src/test/java/org/apache/logging/log4j/streams/LoggerInputStreamCallerInfoTest.java b/log4j-streams/src/test/java/org/apache/logging/log4j/streams/LoggerInputStreamCallerInfoTest.java index 1c68548..6037c3e 100644 --- a/log4j-streams/src/test/java/org/apache/logging/log4j/streams/LoggerInputStreamCallerInfoTest.java +++ b/log4j-streams/src/test/java/org/apache/logging/log4j/streams/LoggerInputStreamCallerInfoTest.java @@ -29,26 +29,26 @@ public class LoggerInputStreamCallerInfoTest extends LoggerStreamsCallerInfoTest @Test public void read() throws Exception { - logIn.read(); + this.logIn.read(); assertMessages("before read int size", 0, "read"); - logIn.read(); + this.logIn.read(); assertMessages("after read int size", 1, "read"); - logIn.read(new byte[2]); + this.logIn.read(new byte[2]); assertMessages("after read bytes size", 2, "read"); - logIn.read(new byte[2], 0, 2); + this.logIn.read(new byte[2], 0, 2); assertMessages("after read bytes offset size", 3, "read"); - logIn.read(); + this.logIn.read(); assertMessages("before close size", 3, "read"); - logIn.close(); + this.logIn.close(); assertMessages("after close size", 4, "read"); } @Before public void setupStreams() { final InputStream srcInputStream = new ByteArrayInputStream("a\nb\nc\nd".getBytes()); - logIn = new LoggerInputStream(srcInputStream, getLogger(), Level.WARN); + this.logIn = new LoggerInputStream(srcInputStream, getLogger(), Level.WARN); } } http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/7f969fa7/log4j-streams/src/test/java/org/apache/logging/log4j/streams/LoggerInputStreamTest.java ---------------------------------------------------------------------- diff --git a/log4j-streams/src/test/java/org/apache/logging/log4j/streams/LoggerInputStreamTest.java b/log4j-streams/src/test/java/org/apache/logging/log4j/streams/LoggerInputStreamTest.java index 4c0741d..602601b 100644 --- a/log4j-streams/src/test/java/org/apache/logging/log4j/streams/LoggerInputStreamTest.java +++ b/log4j-streams/src/test/java/org/apache/logging/log4j/streams/LoggerInputStreamTest.java @@ -33,95 +33,95 @@ public class LoggerInputStreamTest extends AbstractStreamTest { protected InputStream in; protected InputStream createInputStream() { - return new LoggerInputStream(wrapped, getLogger(), LEVEL); + return new LoggerInputStream(this.wrapped, getLogger(), LEVEL); } @Before public void createStream() { - wrapped = new ByteArrayInputStream((FIRST + "\r\n" + LAST).getBytes()); - read = new ByteArrayOutputStream(); - in = createInputStream(); + this.wrapped = new ByteArrayInputStream((FIRST + "\r\n" + LAST).getBytes()); + this.read = new ByteArrayOutputStream(); + this.in = createInputStream(); } @Test public void testClose_HasRemainingData() throws IOException { final byte[] bytes = new byte[1024]; - in.read(bytes); + this.in.read(bytes); assertMessages(FIRST); - in.close(); + this.in.close(); assertMessages(FIRST, LAST); } @Test public void testClose_NoRemainingData() throws IOException { - wrapped = new ByteArrayInputStream((FIRST + '\n').getBytes()); - in = new LoggerInputStream(wrapped, getLogger(), LEVEL); + this.wrapped = new ByteArrayInputStream((FIRST + '\n').getBytes()); + this.in = new LoggerInputStream(this.wrapped, getLogger(), LEVEL); final byte[] bytes = new byte[1024]; - in.read(bytes); + this.in.read(bytes); assertMessages(FIRST); - in.close(); + this.in.close(); assertMessages(FIRST); } @Test public void testRead_ByteArray() throws Exception { final byte[] bytes = new byte[FIRST.length()]; - assertEquals("len", bytes.length, in.read(bytes)); - if (!(in instanceof BufferedInputStream)) { + assertEquals("len", bytes.length, this.in.read(bytes)); + if (!(this.in instanceof BufferedInputStream)) { assertMessages(); } - in.read(bytes); + this.in.read(bytes); assertMessages(FIRST); } @Test public void testRead_ByteArray_Offset_Length() throws Exception { final byte[] bytes = new byte[FIRST.length() * 2]; - assertEquals("len", FIRST.length(), in.read(bytes, 0, FIRST.length())); - if (!(in instanceof BufferedInputStream)) { + assertEquals("len", FIRST.length(), this.in.read(bytes, 0, FIRST.length())); + if (!(this.in instanceof BufferedInputStream)) { assertMessages(); } - in.read(bytes); + this.in.read(bytes); assertMessages(FIRST); } @Test public void testRead_IgnoresWindowsNewline() throws IOException { final byte[] bytes = new byte[1024]; - final int len = in.read(bytes); - read.write(bytes, 0, len); + final int len = this.in.read(bytes); + this.read.write(bytes, 0, len); assertMessages(FIRST); - assertEquals(FIRST + "\r\n" + LAST, read.toString()); - in.close(); + assertEquals(FIRST + "\r\n" + LAST, this.read.toString()); + this.in.close(); assertMessages(FIRST, LAST); } @Test public void testRead_int() throws Exception { for (int i = 0; i < FIRST.length(); i++) { - read.write(in.read()); + this.read.write(this.in.read()); } - if (!(in instanceof BufferedInputStream)) { + if (!(this.in instanceof BufferedInputStream)) { assertMessages(); } - assertEquals("carriage return", '\r', in.read()); - if (!(in instanceof BufferedInputStream)) { + assertEquals("carriage return", '\r', this.in.read()); + if (!(this.in instanceof BufferedInputStream)) { assertMessages(); } - assertEquals("newline", '\n', in.read()); + assertEquals("newline", '\n', this.in.read()); assertMessages(FIRST); } @Test public void testRead_MultipleLines() throws IOException { - wrapped = new ByteArrayInputStream((FIRST + "\n" + LAST + '\n').getBytes()); - in = new LoggerInputStream(wrapped, getLogger(), LEVEL); + this.wrapped = new ByteArrayInputStream((FIRST + "\n" + LAST + '\n').getBytes()); + this.in = new LoggerInputStream(this.wrapped, getLogger(), LEVEL); final byte[] bytes = new byte[1024]; - final int len = in.read(bytes); - read.write(bytes, 0, len); + final int len = this.in.read(bytes); + this.read.write(bytes, 0, len); assertMessages(FIRST, LAST); - assertEquals(FIRST + '\n' + LAST + '\n', read.toString()); + assertEquals(FIRST + '\n' + LAST + '\n', this.read.toString()); } } http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/7f969fa7/log4j-streams/src/test/java/org/apache/logging/log4j/streams/LoggerOutputStreamCallerInfoTest.java ---------------------------------------------------------------------- diff --git a/log4j-streams/src/test/java/org/apache/logging/log4j/streams/LoggerOutputStreamCallerInfoTest.java b/log4j-streams/src/test/java/org/apache/logging/log4j/streams/LoggerOutputStreamCallerInfoTest.java index 662aae4..3a38753 100644 --- a/log4j-streams/src/test/java/org/apache/logging/log4j/streams/LoggerOutputStreamCallerInfoTest.java +++ b/log4j-streams/src/test/java/org/apache/logging/log4j/streams/LoggerOutputStreamCallerInfoTest.java @@ -26,25 +26,25 @@ public class LoggerOutputStreamCallerInfoTest extends LoggerStreamsCallerInfoTes @Before public void setupStreams() { - logOut = new LoggerOutputStream(getLogger(), Level.WARN); + this.logOut = new LoggerOutputStream(getLogger(), Level.WARN); } @Test public void write() throws Exception { - logOut.write('a'); + this.logOut.write('a'); assertMessages("before write int", 0, "write"); - logOut.write('\n'); + this.logOut.write('\n'); assertMessages("after write int", 1, "write"); - logOut.write("b\n".getBytes()); + this.logOut.write("b\n".getBytes()); assertMessages("after write byte array", 2, "write"); - logOut.write("c\n".getBytes(), 0, 2); + this.logOut.write("c\n".getBytes(), 0, 2); assertMessages("after write byte array offset size", 3, "write"); - logOut.write('d'); + this.logOut.write('d'); assertMessages("before close size", 3, "write"); - logOut.close(); + this.logOut.close(); assertMessages("after close size", 4, "write"); } } http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/7f969fa7/log4j-streams/src/test/java/org/apache/logging/log4j/streams/LoggerOutputStreamTest.java ---------------------------------------------------------------------- diff --git a/log4j-streams/src/test/java/org/apache/logging/log4j/streams/LoggerOutputStreamTest.java b/log4j-streams/src/test/java/org/apache/logging/log4j/streams/LoggerOutputStreamTest.java index 8a3d238..a42c5bb 100644 --- a/log4j-streams/src/test/java/org/apache/logging/log4j/streams/LoggerOutputStreamTest.java +++ b/log4j-streams/src/test/java/org/apache/logging/log4j/streams/LoggerOutputStreamTest.java @@ -34,29 +34,29 @@ public class LoggerOutputStreamTest extends AbstractStreamTest { protected OutputStream out; protected OutputStream createOutputStream() { - return new LoggerOutputStream(wrapped, getLogger(), Level.ERROR); + return new LoggerOutputStream(this.wrapped, getLogger(), Level.ERROR); } @Before public void createStream() { - wrapped = new ByteArrayOutputStream(); - out = createOutputStream(); + this.wrapped = new ByteArrayOutputStream(); + this.out = createOutputStream(); } @Test public void testClose_HasRemainingData() throws IOException { - out.write(FIRST.getBytes()); + this.out.write(FIRST.getBytes()); assertMessages(); - out.close(); + this.out.close(); assertMessages(FIRST); - assertEquals(FIRST, wrapped.toString()); + assertEquals(FIRST, this.wrapped.toString()); } @Test public void testClose_NoRemainingData() throws IOException { - out.close(); + this.out.close(); assertMessages(); - assertEquals("", wrapped.toString()); + assertEquals("", this.wrapped.toString()); } @Test @@ -75,11 +75,11 @@ public class LoggerOutputStreamTest extends AbstractStreamTest { @Test public void testWrite_ByteArray() throws Exception { final byte[] bytes = "byte[]".getBytes(); - out.write(bytes); + this.out.write(bytes); assertMessages(); - out.write('\n'); + this.out.write('\n'); assertMessages("byte[]"); - assertEquals("byte[]\n", wrapped.toString()); + assertEquals("byte[]\n", this.wrapped.toString()); } @Test @@ -88,38 +88,38 @@ public class LoggerOutputStreamTest extends AbstractStreamTest { final int middle = bytes.length/2; final int length = bytes.length - middle; final String right = new String(bytes, middle, length); - out.write(bytes, middle, length); + this.out.write(bytes, middle, length); assertMessages(); - out.write('\n'); + this.out.write('\n'); assertMessages(right); - assertEquals("byte[]".substring(middle, bytes.length) + '\n', wrapped.toString()); + assertEquals("byte[]".substring(middle, bytes.length) + '\n', this.wrapped.toString()); } @Test public void testWrite_IgnoresWindowsNewline() throws IOException { - out.write(FIRST.getBytes()); - out.write("\r\n".getBytes()); - out.write(LAST.getBytes()); - out.close(); + this.out.write(FIRST.getBytes()); + this.out.write("\r\n".getBytes()); + this.out.write(LAST.getBytes()); + this.out.close(); assertMessages(FIRST, LAST); - assertEquals(FIRST + "\r\n" + LAST, wrapped.toString()); + assertEquals(FIRST + "\r\n" + LAST, this.wrapped.toString()); } @Test public void testWrite_Int() throws Exception { for (final byte b : "int".getBytes()) { - out.write(b); + this.out.write(b); assertMessages(); } - out.write('\n'); + this.out.write('\n'); assertMessages("int"); - assertEquals("int" + '\n', wrapped.toString()); + assertEquals("int" + '\n', this.wrapped.toString()); } @Test public void testWrite_MultipleLines() throws IOException { - out.write((FIRST + '\n' + LAST + '\n').getBytes()); + this.out.write((FIRST + '\n' + LAST + '\n').getBytes()); assertMessages(FIRST, LAST); - assertEquals(FIRST + '\n' + LAST + '\n', wrapped.toString()); + assertEquals(FIRST + '\n' + LAST + '\n', this.wrapped.toString()); } } http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/7f969fa7/log4j-streams/src/test/java/org/apache/logging/log4j/streams/LoggerPrintStreamCallerInfoTest.java ---------------------------------------------------------------------- diff --git a/log4j-streams/src/test/java/org/apache/logging/log4j/streams/LoggerPrintStreamCallerInfoTest.java b/log4j-streams/src/test/java/org/apache/logging/log4j/streams/LoggerPrintStreamCallerInfoTest.java index e2c7f2b..21d8b58 100644 --- a/log4j-streams/src/test/java/org/apache/logging/log4j/streams/LoggerPrintStreamCallerInfoTest.java +++ b/log4j-streams/src/test/java/org/apache/logging/log4j/streams/LoggerPrintStreamCallerInfoTest.java @@ -28,118 +28,118 @@ public class LoggerPrintStreamCallerInfoTest extends LoggerStreamsCallerInfoTest @Test public void close() throws Exception { - logOut.print("a\nb"); + this.logOut.print("a\nb"); assertMessages("before close size", 1, "close"); - logOut.close(); + this.logOut.close(); assertMessages("after close size", 2, "close"); } @Test public void print_boolean() throws Exception { - logOut.print(true); + this.logOut.print(true); assertMessages("print", 0, "print_boolean"); - logOut.println(true); + this.logOut.println(true); assertMessages("println", 1, "print_boolean"); } @Test public void print_char() throws Exception { - logOut.print('a'); + this.logOut.print('a'); assertMessages("print", 0, "print_char"); - logOut.println('b'); + this.logOut.println('b'); assertMessages("println", 1, "print_char"); } @Test public void print_chararray() throws Exception { - logOut.print("a".toCharArray()); + this.logOut.print("a".toCharArray()); assertMessages("print", 0, "print_chararray"); - logOut.println("b".toCharArray()); + this.logOut.println("b".toCharArray()); assertMessages("println", 1, "print_chararray"); } @Test public void print_double() throws Exception { - logOut.print(1D); + this.logOut.print(1D); assertMessages("print", 0, "print_double"); - logOut.println(2D); + this.logOut.println(2D); assertMessages("println", 1, "print_double"); } @Test public void print_float() throws Exception { - logOut.print(1f); + this.logOut.print(1f); assertMessages("print", 0, "print_float"); - logOut.println(2f); + this.logOut.println(2f); assertMessages("println", 1, "print_float"); } @Test public void print_int() throws Exception { - logOut.print(1); + this.logOut.print(1); assertMessages("print", 0, "print_int"); - logOut.println(2); + this.logOut.println(2); assertMessages("println", 1, "print_int"); } @Test public void print_long() throws Exception { - logOut.print(1L); + this.logOut.print(1L); assertMessages("print", 0, "print_long"); - logOut.println(2L); + this.logOut.println(2L); assertMessages("println", 1, "print_long"); } @Test public void print_object() throws Exception { - logOut.print((Object) 'a'); + this.logOut.print((Object) 'a'); assertMessages("print", 0, "print_object"); - logOut.println((Object) 'b'); + this.logOut.println((Object) 'b'); assertMessages("println", 1, "print_object"); } @Test public void print_printf() throws Exception { - logOut.printf("a\n"); + this.logOut.printf("a\n"); assertMessages("println", 1, "print_printf"); } @Test public void print_printf_locale() throws Exception { - logOut.printf(Locale.getDefault(), "a\n"); + this.logOut.printf(Locale.getDefault(), "a\n"); assertMessages("println", 1, "print_printf_locale"); } @Test public void print_string() throws Exception { - logOut.print("a"); + this.logOut.print("a"); assertMessages("print", 0, "print_string"); - logOut.println("b"); + this.logOut.println("b"); assertMessages("println", 1, "print_string"); } @Before public void setupStreams() { - logOut = new LoggerPrintStream(getLogger(), Level.WARN); + this.logOut = new LoggerPrintStream(getLogger(), Level.WARN); } @Test public void write_bytes() throws Exception { - logOut.write("b\n".getBytes()); + this.logOut.write("b\n".getBytes()); assertMessages("write", 1, "write_bytes"); } @Test public void write_bytes_offset() throws Exception { - logOut.write("c\n".getBytes(), 0, 2); + this.logOut.write("c\n".getBytes(), 0, 2); assertMessages("write", 1, "write_bytes_offset"); } @Test public void write_int() throws Exception { - logOut.write('a'); + this.logOut.write('a'); assertMessages("write int", 0, "write_int"); - logOut.write('\n'); + this.logOut.write('\n'); assertMessages("write newline", 1, "write_int"); } } http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/7f969fa7/log4j-streams/src/test/java/org/apache/logging/log4j/streams/LoggerPrintStreamTest.java ---------------------------------------------------------------------- diff --git a/log4j-streams/src/test/java/org/apache/logging/log4j/streams/LoggerPrintStreamTest.java b/log4j-streams/src/test/java/org/apache/logging/log4j/streams/LoggerPrintStreamTest.java index 864d300..399738d 100644 --- a/log4j-streams/src/test/java/org/apache/logging/log4j/streams/LoggerPrintStreamTest.java +++ b/log4j-streams/src/test/java/org/apache/logging/log4j/streams/LoggerPrintStreamTest.java @@ -28,89 +28,89 @@ public class LoggerPrintStreamTest extends LoggerOutputStreamTest { @Override protected OutputStream createOutputStream() { - return print = new LoggerPrintStream(wrapped, getLogger(), LEVEL); + return this.print = new LoggerPrintStream(this.wrapped, getLogger(), LEVEL); } @Test public void testFormat() throws Exception { - assertSame(print, print.format("[%s]", FIRST)); + assertSame(this.print, this.print.format("[%s]", FIRST)); assertMessages(); - print.println(); + this.print.println(); assertMessages("[" + FIRST + "]"); - assertEquals("[" + FIRST + "]" + NEWLINE, wrapped.toString()); + assertEquals("[" + FIRST + "]" + NEWLINE, this.wrapped.toString()); } @Test public void testPrint_boolean() throws Exception { - print.print(true); + this.print.print(true); assertMessages(); - print.println(); + this.print.println(); assertMessages("true"); - assertEquals("true" + NEWLINE, wrapped.toString()); + assertEquals("true" + NEWLINE, this.wrapped.toString()); } @Test public void testPrint_char() throws Exception { for (final char c : FIRST.toCharArray()) { - print.print(c); + this.print.print(c); assertMessages(); } - print.println(); + this.print.println(); assertMessages(FIRST); - assertEquals(FIRST + NEWLINE, wrapped.toString()); + assertEquals(FIRST + NEWLINE, this.wrapped.toString()); } @Test public void testPrint_CharacterArray() throws Exception { - print.print(FIRST.toCharArray()); + this.print.print(FIRST.toCharArray()); assertMessages(); - print.println(); + this.print.println(); assertMessages(FIRST); - assertEquals(FIRST + NEWLINE, wrapped.toString()); + assertEquals(FIRST + NEWLINE, this.wrapped.toString()); } @Test public void testPrint_int() throws Exception { - print.print(12); + this.print.print(12); assertMessages(); - print.println(); + this.print.println(); assertMessages("12"); - assertEquals("12" + NEWLINE, wrapped.toString()); + assertEquals("12" + NEWLINE, this.wrapped.toString()); } @Test public void testPrint_long() throws Exception { - print.print(12L); + this.print.print(12L); assertMessages(); - print.println(); + this.print.println(); assertMessages("12"); - assertEquals("12" + NEWLINE, wrapped.toString()); + assertEquals("12" + NEWLINE, this.wrapped.toString()); } @Test public void testPrint_Object() throws Exception { - print.print((Object) FIRST); + this.print.print((Object) FIRST); assertMessages(); - print.println(); + this.print.println(); assertMessages(FIRST); - assertEquals(FIRST + NEWLINE, wrapped.toString()); + assertEquals(FIRST + NEWLINE, this.wrapped.toString()); } @Test public void testPrint_String() throws Exception { - print.print(FIRST); + this.print.print(FIRST); assertMessages(); - print.println(); + this.print.println(); assertMessages(FIRST); - assertEquals(FIRST + NEWLINE, wrapped.toString()); + assertEquals(FIRST + NEWLINE, this.wrapped.toString()); } @Test public void testPrintf() throws Exception { - assertSame(print, print.printf("<<<%s>>>", FIRST)); + assertSame(this.print, this.print.printf("<<<%s>>>", FIRST)); assertMessages(); - print.println(); + this.print.println(); assertMessages("<<<" + FIRST + ">>>"); - assertEquals("<<<" + FIRST + ">>>" + NEWLINE, wrapped.toString()); + assertEquals("<<<" + FIRST + ">>>" + NEWLINE, this.wrapped.toString()); } } http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/7f969fa7/log4j-streams/src/test/java/org/apache/logging/log4j/streams/LoggerPrintWriterCallerInfoTest.java ---------------------------------------------------------------------- diff --git a/log4j-streams/src/test/java/org/apache/logging/log4j/streams/LoggerPrintWriterCallerInfoTest.java b/log4j-streams/src/test/java/org/apache/logging/log4j/streams/LoggerPrintWriterCallerInfoTest.java index f3133e2..16e271e 100644 --- a/log4j-streams/src/test/java/org/apache/logging/log4j/streams/LoggerPrintWriterCallerInfoTest.java +++ b/log4j-streams/src/test/java/org/apache/logging/log4j/streams/LoggerPrintWriterCallerInfoTest.java @@ -28,118 +28,118 @@ public class LoggerPrintWriterCallerInfoTest extends LoggerStreamsCallerInfoTest @Test public void close() throws Exception { - logOut.print("a\nb"); + this.logOut.print("a\nb"); assertMessages("before close size", 1, "close"); - logOut.close(); + this.logOut.close(); assertMessages("after close size", 2, "close"); } @Test public void print_boolean() throws Exception { - logOut.print(true); + this.logOut.print(true); assertMessages("print", 0, "print_boolean"); - logOut.println(true); + this.logOut.println(true); assertMessages("println", 1, "print_boolean"); } @Test public void print_char() throws Exception { - logOut.print('a'); + this.logOut.print('a'); assertMessages("print", 0, "print_char"); - logOut.println('b'); + this.logOut.println('b'); assertMessages("println", 1, "print_char"); } @Test public void print_chararray() throws Exception { - logOut.print("a".toCharArray()); + this.logOut.print("a".toCharArray()); assertMessages("print", 0, "print_chararray"); - logOut.println("b".toCharArray()); + this.logOut.println("b".toCharArray()); assertMessages("println", 1, "print_chararray"); } @Test public void print_double() throws Exception { - logOut.print(1D); + this.logOut.print(1D); assertMessages("print", 0, "print_double"); - logOut.println(2D); + this.logOut.println(2D); assertMessages("println", 1, "print_double"); } @Test public void print_float() throws Exception { - logOut.print(1f); + this.logOut.print(1f); assertMessages("print", 0, "print_float"); - logOut.println(2f); + this.logOut.println(2f); assertMessages("println", 1, "print_float"); } @Test public void print_int() throws Exception { - logOut.print(1); + this.logOut.print(1); assertMessages("print", 0, "print_int"); - logOut.println(2); + this.logOut.println(2); assertMessages("println", 1, "print_int"); } @Test public void print_long() throws Exception { - logOut.print(1L); + this.logOut.print(1L); assertMessages("print", 0, "print_long"); - logOut.println(2L); + this.logOut.println(2L); assertMessages("println", 1, "print_long"); } @Test public void print_object() throws Exception { - logOut.print((Object) 'a'); + this.logOut.print((Object) 'a'); assertMessages("print", 0, "print_object"); - logOut.println((Object) 'b'); + this.logOut.println((Object) 'b'); assertMessages("println", 1, "print_object"); } @Test public void print_printf() throws Exception { - logOut.printf("a\n"); + this.logOut.printf("a\n"); assertMessages("println", 1, "print_printf"); } @Test public void print_printf_locale() throws Exception { - logOut.printf(Locale.getDefault(), "a\n"); + this.logOut.printf(Locale.getDefault(), "a\n"); assertMessages("println", 1, "print_printf_locale"); } @Test public void print_string() throws Exception { - logOut.print("a"); + this.logOut.print("a"); assertMessages("print", 0, "print_string"); - logOut.println("b"); + this.logOut.println("b"); assertMessages("println", 1, "print_string"); } @Before public void setupStreams() { - logOut = new LoggerPrintWriter(getLogger(), Level.WARN); + this.logOut = new LoggerPrintWriter(getLogger(), Level.WARN); } @Test public void write_bytes() throws Exception { - logOut.write("b\n".toCharArray()); + this.logOut.write("b\n".toCharArray()); assertMessages("write", 1, "write_bytes"); } @Test public void write_bytes_offset() throws Exception { - logOut.write("c\n".toCharArray(), 0, 2); + this.logOut.write("c\n".toCharArray(), 0, 2); assertMessages("write", 1, "write_bytes_offset"); } @Test public void write_int() throws Exception { - logOut.write('a'); + this.logOut.write('a'); assertMessages("write int", 0, "write_int"); - logOut.write('\n'); + this.logOut.write('\n'); assertMessages("write newline", 1, "write_int"); } } http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/7f969fa7/log4j-streams/src/test/java/org/apache/logging/log4j/streams/LoggerPrintWriterTest.java ---------------------------------------------------------------------- diff --git a/log4j-streams/src/test/java/org/apache/logging/log4j/streams/LoggerPrintWriterTest.java b/log4j-streams/src/test/java/org/apache/logging/log4j/streams/LoggerPrintWriterTest.java index 7d1fac3..5e46e65 100644 --- a/log4j-streams/src/test/java/org/apache/logging/log4j/streams/LoggerPrintWriterTest.java +++ b/log4j-streams/src/test/java/org/apache/logging/log4j/streams/LoggerPrintWriterTest.java @@ -35,90 +35,90 @@ public class LoggerPrintWriterTest extends AbstractLoggerWriterTest { @Override protected Writer createWriterWrapper() { - print = new LoggerPrintWriter(wrapped, getLogger(), LEVEL); - return print; + this.print = new LoggerPrintWriter(this.wrapped, getLogger(), LEVEL); + return this.print; } @Test public void testFormat() throws Exception { - assertSame(print, print.format("[%s]", FIRST)); + assertSame(this.print, this.print.format("[%s]", FIRST)); assertMessages(); - print.println(); + this.print.println(); assertMessages("[" + FIRST + "]"); - assertEquals("[" + FIRST + "]" + NEWLINE, wrapped.toString()); + assertEquals("[" + FIRST + "]" + NEWLINE, this.wrapped.toString()); } @Test public void testPrint_boolean() throws Exception { - print.print(true); + this.print.print(true); assertMessages(); - print.println(); + this.print.println(); assertMessages("true"); - assertEquals("true" + NEWLINE, wrapped.toString()); + assertEquals("true" + NEWLINE, this.wrapped.toString()); } @Test public void testPrint_char() throws Exception { for (final char c : FIRST.toCharArray()) { - print.print(c); + this.print.print(c); assertMessages(); } - print.println(); + this.print.println(); assertMessages(FIRST); - assertEquals(FIRST + NEWLINE, wrapped.toString()); + assertEquals(FIRST + NEWLINE, this.wrapped.toString()); } @Test public void testPrint_CharacterArray() throws Exception { - print.print(FIRST.toCharArray()); + this.print.print(FIRST.toCharArray()); assertMessages(); - print.println(); + this.print.println(); assertMessages(FIRST); - assertEquals(FIRST + NEWLINE, wrapped.toString()); + assertEquals(FIRST + NEWLINE, this.wrapped.toString()); } @Test public void testPrint_int() throws Exception { - print.print(12); + this.print.print(12); assertMessages(); - print.println(); + this.print.println(); assertMessages("12"); - assertEquals("12" + NEWLINE, wrapped.toString()); + assertEquals("12" + NEWLINE, this.wrapped.toString()); } @Test public void testPrint_long() throws Exception { - print.print(12L); + this.print.print(12L); assertMessages(); - print.println(); + this.print.println(); assertMessages("12"); - assertEquals("12" + NEWLINE, wrapped.toString()); + assertEquals("12" + NEWLINE, this.wrapped.toString()); } @Test public void testPrint_Object() throws Exception { - print.print((Object) FIRST); + this.print.print((Object) FIRST); assertMessages(); - print.println(); + this.print.println(); assertMessages(FIRST); - assertEquals(FIRST + NEWLINE, wrapped.toString()); + assertEquals(FIRST + NEWLINE, this.wrapped.toString()); } @Test public void testPrint_String() throws Exception { - print.print(FIRST); + this.print.print(FIRST); assertMessages(); - print.println(); + this.print.println(); assertMessages(FIRST); - assertEquals(FIRST + NEWLINE, wrapped.toString()); + assertEquals(FIRST + NEWLINE, this.wrapped.toString()); } @Test public void testPrintf() throws Exception { - assertSame(print, print.printf("<<<%s>>>", FIRST)); + assertSame(this.print, this.print.printf("<<<%s>>>", FIRST)); assertMessages(); - print.println(); + this.print.println(); assertMessages("<<<" + FIRST + ">>>"); - assertEquals("<<<" + FIRST + ">>>" + NEWLINE, wrapped.toString()); + assertEquals("<<<" + FIRST + ">>>" + NEWLINE, this.wrapped.toString()); } } http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/7f969fa7/log4j-streams/src/test/java/org/apache/logging/log4j/streams/LoggerReaderCallerInfoTest.java ---------------------------------------------------------------------- diff --git a/log4j-streams/src/test/java/org/apache/logging/log4j/streams/LoggerReaderCallerInfoTest.java b/log4j-streams/src/test/java/org/apache/logging/log4j/streams/LoggerReaderCallerInfoTest.java index 18a8cdf..88c2311 100644 --- a/log4j-streams/src/test/java/org/apache/logging/log4j/streams/LoggerReaderCallerInfoTest.java +++ b/log4j-streams/src/test/java/org/apache/logging/log4j/streams/LoggerReaderCallerInfoTest.java @@ -29,29 +29,29 @@ public class LoggerReaderCallerInfoTest extends LoggerStreamsCallerInfoTesting { @Test public void read() throws Exception { - logReader.read(); + this.logReader.read(); assertMessages("before read int size", 0, "read"); - logReader.read(); + this.logReader.read(); assertMessages("after read int size", 1, "read"); - logReader.read(new char[2]); + this.logReader.read(new char[2]); assertMessages("after read bytes size", 2, "read"); - logReader.read(new char[2], 0, 2); + this.logReader.read(new char[2], 0, 2); assertMessages("after read bytes offset size", 3, "read"); - logReader.read(CharBuffer.allocate(2)); + this.logReader.read(CharBuffer.allocate(2)); assertMessages("after read charBuffer size", 4, "read"); - logReader.read(); + this.logReader.read(); assertMessages("before close size", 4, "read"); - logReader.close(); + this.logReader.close(); assertMessages("after close size", 5, "read"); } @Before public void setupReader() { final Reader srcReader = new StringReader("a\nb\nc\nd\ne"); - logReader = new LoggerReader(srcReader, getLogger(), LEVEL); + this.logReader = new LoggerReader(srcReader, getLogger(), LEVEL); } }
