You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-commits@axis.apache.org by ve...@apache.org on 2018/01/04 21:34:43 UTC
svn commit: r1820221 -
/axis/axis2/java/core/trunk/modules/transport/mail/src/main/java/org/apache/axis2/transport/mail/LogWriter.java
Author: veithen
Date: Thu Jan 4 21:34:43 2018
New Revision: 1820221
URL: http://svn.apache.org/viewvc?rev=1820221&view=rev
Log:
Normalize whitespace.
Modified:
axis/axis2/java/core/trunk/modules/transport/mail/src/main/java/org/apache/axis2/transport/mail/LogWriter.java
Modified: axis/axis2/java/core/trunk/modules/transport/mail/src/main/java/org/apache/axis2/transport/mail/LogWriter.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/transport/mail/src/main/java/org/apache/axis2/transport/mail/LogWriter.java?rev=1820221&r1=1820220&r2=1820221&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/transport/mail/src/main/java/org/apache/axis2/transport/mail/LogWriter.java (original)
+++ axis/axis2/java/core/trunk/modules/transport/mail/src/main/java/org/apache/axis2/transport/mail/LogWriter.java Thu Jan 4 21:34:43 2018
@@ -27,54 +27,54 @@ import org.apache.commons.logging.Log;
* {@link Writer} implementation that redirects to a logger.
*/
public class LogWriter extends Writer {
- private final Log log;
- private final String endOfLine;
- private final StringBuffer lineBuffer = new StringBuffer();
- private int endOfLineMatch;
-
- public LogWriter(Log log, String endOfLine) {
- this.log = log;
- this.endOfLine = endOfLine;
- }
+ private final Log log;
+ private final String endOfLine;
+ private final StringBuffer lineBuffer = new StringBuffer();
+ private int endOfLineMatch;
+
+ public LogWriter(Log log, String endOfLine) {
+ this.log = log;
+ this.endOfLine = endOfLine;
+ }
- public LogWriter(Log log) {
- this(log, System.getProperty("line.separator"));
- }
-
- @Override
- public void write(char[] cbuf, int off, int len) {
- int start = off;
- for (int i=off; i<off+len; i++) {
- if (cbuf[i] == endOfLine.charAt(endOfLineMatch)) {
- endOfLineMatch++;
- if (endOfLineMatch == endOfLine.length()) {
- lineBuffer.append(cbuf, start, i-start+1);
- lineBuffer.setLength(lineBuffer.length()-endOfLine.length());
- flushLineBuffer();
- start = i+1;
- endOfLineMatch = 0;
- }
- } else {
- endOfLineMatch = 0;
- }
- }
- lineBuffer.append(cbuf, start, off+len-start);
- }
+ public LogWriter(Log log) {
+ this(log, System.getProperty("line.separator"));
+ }
+
+ @Override
+ public void write(char[] cbuf, int off, int len) {
+ int start = off;
+ for (int i=off; i<off+len; i++) {
+ if (cbuf[i] == endOfLine.charAt(endOfLineMatch)) {
+ endOfLineMatch++;
+ if (endOfLineMatch == endOfLine.length()) {
+ lineBuffer.append(cbuf, start, i-start+1);
+ lineBuffer.setLength(lineBuffer.length()-endOfLine.length());
+ flushLineBuffer();
+ start = i+1;
+ endOfLineMatch = 0;
+ }
+ } else {
+ endOfLineMatch = 0;
+ }
+ }
+ lineBuffer.append(cbuf, start, off+len-start);
+ }
- @Override
- public void close() {
- if (lineBuffer.length() > 0) {
- flushLineBuffer();
- }
- }
-
- @Override
- public void flush() {
- // Nothing to do
- }
+ @Override
+ public void close() {
+ if (lineBuffer.length() > 0) {
+ flushLineBuffer();
+ }
+ }
+
+ @Override
+ public void flush() {
+ // Nothing to do
+ }
- private void flushLineBuffer() {
- log.info(lineBuffer.toString());
- lineBuffer.setLength(0);
- }
+ private void flushLineBuffer() {
+ log.info(lineBuffer.toString());
+ lineBuffer.setLength(0);
+ }
}