You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by se...@apache.org on 2013/04/26 10:26:01 UTC

svn commit: r1476097 - in /commons/proper/io/trunk/src: changes/changes.xml main/java/org/apache/commons/io/input/Tailer.java

Author: sebb
Date: Fri Apr 26 08:26:01 2013
New Revision: 1476097

URL: http://svn.apache.org/r1476097
Log:
IO-279  Tailer erroneously considers file as new.
        Fix to use file.lastModified() rather than System.currentTimeMillis()

Modified:
    commons/proper/io/trunk/src/changes/changes.xml
    commons/proper/io/trunk/src/main/java/org/apache/commons/io/input/Tailer.java

Modified: commons/proper/io/trunk/src/changes/changes.xml
URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/changes/changes.xml?rev=1476097&r1=1476096&r2=1476097&view=diff
==============================================================================
--- commons/proper/io/trunk/src/changes/changes.xml (original)
+++ commons/proper/io/trunk/src/changes/changes.xml Fri Apr 26 08:26:01 2013
@@ -47,6 +47,10 @@ The <action> type attribute can be add,u
   <body>
     <!-- The release date is the date RC is cut -->
     <release version="2.5" date="2013-??-??" description="New features and bug fixes.">    
+      <action issue="IO-279" dev="sebb" type="fix">
+        Tailer erroneously considers file as new.
+        Fix to use file.lastModified() rather than System.currentTimeMillis()
+      </action>            
       <action issue="IO-356" dev="sebb" type="fix">
          CharSequenceInputStream#reset() behaves incorrectly in case when buffer size is not dividable by data size.
          Fix code so skip relates to the encoded bytes; reset now re-encodes the data up to the point of the mark

Modified: commons/proper/io/trunk/src/main/java/org/apache/commons/io/input/Tailer.java
URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/main/java/org/apache/commons/io/input/Tailer.java?rev=1476097&r1=1476096&r2=1476097&view=diff
==============================================================================
--- commons/proper/io/trunk/src/main/java/org/apache/commons/io/input/Tailer.java (original)
+++ commons/proper/io/trunk/src/main/java/org/apache/commons/io/input/Tailer.java Fri Apr 26 08:26:01 2013
@@ -363,7 +363,7 @@ public class Tailer implements Runnable 
                 } else {
                     // The current position in the file
                     position = end ? file.length() : 0;
-                    last = System.currentTimeMillis();
+                    last = file.lastModified();
                     reader.seek(position);
                 }
             }
@@ -400,7 +400,7 @@ public class Tailer implements Runnable 
                     if (length > position) {
                         // The file has more content than it did last time
                         position = readLines(reader);
-                        last = System.currentTimeMillis();
+                        last = file.lastModified();
                     } else if (newer) {
                         /*
                          * This can happen if the file is truncated or overwritten with the exact same length of
@@ -411,7 +411,7 @@ public class Tailer implements Runnable 
 
                         // Now we can read new lines
                         position = readLines(reader);
-                        last = System.currentTimeMillis();
+                        last = file.lastModified();
                     }
                 }
                 if (reOpen) {