This is an automated email from the ASF dual-hosted git repository. ggregory pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/commons-io.git
commit a25b1440bdbcd5854ad3516aa17576140415f8d6 Author: Gary Gregory <gardgreg...@gmail.com> AuthorDate: Sat Dec 12 09:52:55 2020 -0500 Formatting. --- .../java/org/apache/commons/io/input/Tailer.java | 41 +++++++++++----------- 1 file changed, 20 insertions(+), 21 deletions(-) diff --git a/src/main/java/org/apache/commons/io/input/Tailer.java b/src/main/java/org/apache/commons/io/input/Tailer.java index 6d2ac52..a03f33f 100644 --- a/src/main/java/org/apache/commons/io/input/Tailer.java +++ b/src/main/java/org/apache/commons/io/input/Tailer.java @@ -441,7 +441,7 @@ public class Tailer implements Runnable { // Finish scanning the old file and then we'll start with the new one try { readLines(save); - } catch (final IOException ioe) { + } catch (final IOException ioe) { listener.handle(ioe); } position = 0; @@ -489,8 +489,7 @@ public class Tailer implements Runnable { if (reader != null) { reader.close(); } - } - catch (final IOException e) { + } catch (final IOException e) { listener.handle(e); } stop(); @@ -520,27 +519,27 @@ public class Tailer implements Runnable { while (getRun() && ((num = reader.read(inbuf)) != EOF)) { for (int i = 0; i < num; i++) { final byte ch = inbuf[i]; - switch ( ch ) { - case '\n': - seenCR = false; // swallow CR before LF + switch (ch) { + case '\n': + seenCR = false; // swallow CR before LF + listener.handle(new String(lineBuf.toByteArray(), charset)); + lineBuf.reset(); + rePos = pos + i + 1; + break; + case '\r': + if (seenCR) { + lineBuf.write('\r'); + } + seenCR = true; + break; + default: + if (seenCR) { + seenCR = false; // swallow final CR listener.handle(new String(lineBuf.toByteArray(), charset)); lineBuf.reset(); rePos = pos + i + 1; - break; - case '\r': - if (seenCR) { - lineBuf.write('\r'); - } - seenCR = true; - break; - default: - if (seenCR) { - seenCR = false; // swallow final CR - listener.handle(new String(lineBuf.toByteArray(), charset)); - lineBuf.reset(); - rePos = pos + i + 1; - } - lineBuf.write(ch); + } + lineBuf.write(ch); } } pos = reader.getFilePointer();