Repository: commons-io Updated Branches: refs/heads/master 27fb1044f -> 467386105
Don't need to nest else clause. Project: http://git-wip-us.apache.org/repos/asf/commons-io/repo Commit: http://git-wip-us.apache.org/repos/asf/commons-io/commit/46738610 Tree: http://git-wip-us.apache.org/repos/asf/commons-io/tree/46738610 Diff: http://git-wip-us.apache.org/repos/asf/commons-io/diff/46738610 Branch: refs/heads/master Commit: 467386105ad855e793a09632142c00cd01c5dd10 Parents: 27fb104 Author: Gary Gregory <garydgreg...@gmail.com> Authored: Tue Mar 6 09:27:13 2018 -0700 Committer: Gary Gregory <garydgreg...@gmail.com> Committed: Tue Mar 6 09:27:13 2018 -0700 ---------------------------------------------------------------------- .../org/apache/commons/io/input/Tailer.java | 37 ++++++++++---------- 1 file changed, 18 insertions(+), 19 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/commons-io/blob/46738610/src/main/java/org/apache/commons/io/input/Tailer.java ---------------------------------------------------------------------- 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 0434e83..3702fc5 100644 --- a/src/main/java/org/apache/commons/io/input/Tailer.java +++ b/src/main/java/org/apache/commons/io/input/Tailer.java @@ -449,25 +449,24 @@ public class Tailer implements Runnable { Thread.sleep(delayMillis); } continue; - } else { - // File was not rotated - // See if the file needs to be read again - if (length > position) { - // The file has more content than it did last time - position = readLines(reader); - last = file.lastModified(); - } else if (newer) { - /* - * This can happen if the file is truncated or overwritten with the exact same length of - * information. In cases like this, the file position needs to be reset - */ - position = 0; - reader.seek(position); // cannot be null here - - // Now we can read new lines - position = readLines(reader); - last = file.lastModified(); - } + } + // File was not rotated + // See if the file needs to be read again + if (length > position) { + // The file has more content than it did last time + position = readLines(reader); + last = file.lastModified(); + } else if (newer) { + /* + * This can happen if the file is truncated or overwritten with the exact same length of + * information. In cases like this, the file position needs to be reset + */ + position = 0; + reader.seek(position); // cannot be null here + + // Now we can read new lines + position = readLines(reader); + last = file.lastModified(); } if (reOpen && reader != null) { reader.close();