Return-Path: X-Original-To: apmail-commons-commits-archive@minotaur.apache.org Delivered-To: apmail-commons-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id C82201087A for ; Wed, 8 May 2013 19:34:31 +0000 (UTC) Received: (qmail 37786 invoked by uid 500); 8 May 2013 19:34:31 -0000 Delivered-To: apmail-commons-commits-archive@commons.apache.org Received: (qmail 37701 invoked by uid 500); 8 May 2013 19:34:31 -0000 Mailing-List: contact commits-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@commons.apache.org Delivered-To: mailing list commits@commons.apache.org Received: (qmail 37693 invoked by uid 99); 8 May 2013 19:34:31 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 08 May 2013 19:34:31 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 08 May 2013 19:34:25 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 4942F2388C32 for ; Wed, 8 May 2013 19:32:57 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r861378 [29/41] - in /websites/production/commons/content/proper/commons-io: ./ apidocs/ apidocs/org/apache/commons/io/ apidocs/src-html/org/apache/commons/io/ cobertura/ xref/org/apache/commons/io/ Date: Wed, 08 May 2013 19:32:41 -0000 To: commits@commons.apache.org From: ggregory@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20130508193257.4942F2388C32@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Modified: websites/production/commons/content/proper/commons-io/cobertura/org.apache.commons.io.input.Tailer.html ============================================================================== --- websites/production/commons/content/proper/commons-io/cobertura/org.apache.commons.io.input.Tailer.html (original) +++ websites/production/commons/content/proper/commons-io/cobertura/org.apache.commons.io.input.Tailer.html Wed May 8 19:32:39 2013 @@ -12,7 +12,7 @@
 
- +
Classes in this File Line Coverage Branch Coverage Complexity
Tailer
86%
103/119
97%
34/35
2.211
Tailer
86%
103/119
94%
33/35
2.211
 
@@ -325,7 +325,7 @@
      * The tailer will run as long as this value is true.
 154  
      */
-  155  36
     private volatile boolean run = true;
+  155  9
     private volatile boolean run = true;
 156  
 
 157   @@ -378,8 +378,8 @@
      */
 183  
     public Tailer(final File file, final TailerListener listener, final long delayMillis, final boolean end) {
-  184  16
         this(file, listener, delayMillis, end, DEFAULT_BUFSIZE);
-  185  16
     }
+  184  4
         this(file, listener, delayMillis, end, DEFAULT_BUFSIZE);
+  185  4
     }
 186  
 
 187   @@ -400,8 +400,8 @@
      */
 195  
     public Tailer(final File file, final TailerListener listener, final long delayMillis, final boolean end, final boolean reOpen) {
-  196  8
         this(file, listener, delayMillis, end, reOpen, DEFAULT_BUFSIZE);
-  197  8
     }
+  196  2
         this(file, listener, delayMillis, end, reOpen, DEFAULT_BUFSIZE);
+  197  2
     }
 198  
 
 199   @@ -422,8 +422,8 @@
      */
 207  
     public Tailer(final File file, final TailerListener listener, final long delayMillis, final boolean end, final int bufSize) {
-  208  24
         this(file, listener, delayMillis, end, false, bufSize);
-  209  24
     }
+  208  6
         this(file, listener, delayMillis, end, false, bufSize);
+  209  6
     }
 210  
 
 211   @@ -444,21 +444,21 @@
      * @param bufSize Buffer size
 219  
      */
-  220  36
     public Tailer(final File file, final TailerListener listener, final long delayMillis, final boolean end, final boolean reOpen, final int bufSize) {
-  221  36
         this.file = file;
-  222  36
         this.delayMillis = delayMillis;
-  223  36
         this.end = end;
+  220  9
     public Tailer(final File file, final TailerListener listener, final long delayMillis, final boolean end, final boolean reOpen, final int bufSize) {
+  221  9
         this.file = file;
+  222  9
         this.delayMillis = delayMillis;
+  223  9
         this.end = end;
 224  
 
-  225  36
         this.inbuf = new byte[bufSize];
+  225  9
         this.inbuf = new byte[bufSize];
 226  
 
 227  
         // Save and prepare the listener
-  228  36
         this.listener = listener;
-  229  36
         listener.init(this);
-  230  36
         this.reOpen = reOpen;
-  231  36
     }
+  228  9
         this.listener = listener;
+  229  9
         listener.init(this);
+  230  9
         this.reOpen = reOpen;
+  231  9
     }
 232  
 
 233   @@ -483,7 +483,7 @@
      */
 243  
     public static Tailer create(final File file, final TailerListener listener, final long delayMillis, final boolean end, final int bufSize) {
-  244  4
         return create(file, listener, delayMillis, end, false, bufSize);
+  244  1
         return create(file, listener, delayMillis, end, false, bufSize);
 245  
     }
 246   @@ -514,11 +514,11 @@
     public static Tailer create(final File file, final TailerListener listener, final long delayMillis, final boolean end, final boolean reOpen,
 259  
             final int bufSize) {
-  260  4
         final Tailer tailer = new Tailer(file, listener, delayMillis, end, reOpen, bufSize);
-  261  4
         final Thread thread = new Thread(tailer);
-  262  4
         thread.setDaemon(true);
-  263  4
         thread.start();
-  264  4
         return tailer;
+  260  1
         final Tailer tailer = new Tailer(file, listener, delayMillis, end, reOpen, bufSize);
+  261  1
         final Thread thread = new Thread(tailer);
+  262  1
         thread.setDaemon(true);
+  263  1
         thread.start();
+  264  1
         return tailer;
 265  
     }
 266   @@ -543,7 +543,7 @@
      */
 276  
     public static Tailer create(final File file, final TailerListener listener, final long delayMillis, final boolean end) {
-  277  4
         return create(file, listener, delayMillis, end, DEFAULT_BUFSIZE);
+  277  1
         return create(file, listener, delayMillis, end, DEFAULT_BUFSIZE);
 278  
     }
 279   @@ -652,7 +652,7 @@
      */
 333  
     protected boolean getRun() {
-  334  4818
         return run;
+  334  1215
         return run;
 335  
     }
 336   @@ -682,69 +682,69 @@
      */
 349  
     public void run() {
-  350  36
         RandomAccessFile reader = null;
+  350  9
         RandomAccessFile reader = null;
 351  
         try {
-  352  36
             long last = 0; // The last time the file was checked for changes
-  353  36
             long position = 0; // position within the file
+  352  9
             long last = 0; // The last time the file was checked for changes
+  353  9
             long position = 0; // position within the file
 354  
             // Open the file
-  355  68
             while (getRun() && reader == null) {
+  355  17
             while (getRun() && reader == null) {
 356  
                 try {
-  357  36
                     reader = new RandomAccessFile(file, RAF_MODE);
-  358  12
                 } catch (final FileNotFoundException e) {
-  359  12
                     listener.fileNotFound();
-  360  24
                 }
-  361  36
                 if (reader == null) {
-  362  12
                     Thread.sleep(delayMillis);
+  357  9
                     reader = new RandomAccessFile(file, RAF_MODE);
+  358  3
                 } catch (final FileNotFoundException e) {
+  359  3
                     listener.fileNotFound();
+  360  6
                 }
+  361  9
                 if (reader == null) {
+  362  3
                     Thread.sleep(delayMillis);
 363  
                 } else {
 364  
                     // The current position in the file
-  365  24
                     position = end ? file.length() : 0;
-  366  24
                     last = file.lastModified();
-  367  24
                     reader.seek(position);
+  365  6
                     position = end ? file.length() : 0;
+  366  6
                     last = file.lastModified();
+  367  6
                     reader.seek(position);
 368  
                 }
 369  
             }
-  370  295
             while (getRun()) {
-  371  269
                 final boolean newer = FileUtils.isFileNewer(file, last); // IO-279, must be done first
+  370  79
             while (getRun()) {
+  371  73
                 final boolean newer = FileUtils.isFileNewer(file, last); // IO-279, must be done first
 372  
                 // Check the file length to see if it was rotated
-  373  269
                 final long length = file.length();
-  374  269
                 if (length < position) {
+  373  73
                 final long length = file.length();
+  374  73
                 if (length < position) {
 375  
                     // File was rotated
-  376  3
                     listener.fileRotated();
+  376  1
                     listener.fileRotated();
 377  
                     // Reopen the reader after rotation
 378  
                     try {
 379  
                         // Ensure that the old file is closed iff we re-open it successfully
-  380  3
                         final RandomAccessFile save = reader;
-  381  3
                         reader = new RandomAccessFile(file, RAF_MODE);
+  380  1
                         final RandomAccessFile save = reader;
+  381  1
                         reader = new RandomAccessFile(file, RAF_MODE);
 382  
                         // At this point, we're sure that the old file is rotated
 383  
                         // Finish scanning the old file and then we'll start with the new one
 384  
                         try {
-  385  3
                             readLines(save);
+  385  1
                             readLines(save);
 386  0
                         }  catch (IOException ioe) {
 387  0
                             listener.handle(ioe);
-  388  3
                         }
-  389  3
                         position = 0;
+  388  1
                         }
+  389  1
                         position = 0;
 390  
                         // close old file explicitly rather than relying on GC picking up previous RAF
-  391  3
                         IOUtils.closeQuietly(save);
+  391  1
                         IOUtils.closeQuietly(save);
 392  0
                     } catch (final FileNotFoundException e) {
 393  
                         // in this case we continue to use the previous reader and position values
 394  0
                         listener.fileNotFound();
-  395  3
                     }
+  395  1
                     }
 396  0
                     continue;
 397  
                 } else {
@@ -752,12 +752,12 @@
                     // File was not rotated
 399  
                     // See if the file needs to be read again
-  400  266
                     if (length > position) {
+  400  72
                     if (length > position) {
 401  
                         // The file has more content than it did last time
-  402  77
                         position = readLines(reader);
-  403  77
                         last = file.lastModified();
-  404  189
                     } else if (newer) {
+  402  19
                         position = readLines(reader);
+  403  19
                         last = file.lastModified();
+  404  53
                     } else if (newer) {
 405  
                         /*
 406   @@ -766,46 +766,46 @@
                          * information. In cases like this, the file position needs to be reset
 408  
                          */
-  409  3
                         position = 0;
-  410  3
                         reader.seek(position); // cannot be null here
+  409  1
                         position = 0;
+  410  1
                         reader.seek(position); // cannot be null here
 411  
 
 412  
                         // Now we can read new lines
-  413  3
                         position = readLines(reader);
-  414  3
                         last = file.lastModified();
+  413  1
                         position = readLines(reader);
+  414  1
                         last = file.lastModified();
 415  
                     }
 416  
                 }
-  417  266
                 if (reOpen) {
-  418  199
                     IOUtils.closeQuietly(reader);
+  417  72
                 if (reOpen) {
+  418  56
                     IOUtils.closeQuietly(reader);
 419  
                 }
-  420  266
                 Thread.sleep(delayMillis);
-  421  260
                 if (getRun() && reOpen) {
-  422  191
                     reader = new RandomAccessFile(file, RAF_MODE);
-  423  191
                     reader.seek(position);
+  420  72
                 Thread.sleep(delayMillis);
+  421  70
                 if (getRun() && reOpen) {
+  422  54
                     reader = new RandomAccessFile(file, RAF_MODE);
+  423  54
                     reader.seek(position);
 424  
                 }
-  425  260
             }
-  426  10
         } catch (final InterruptedException e) {
-  427  10
             Thread.currentThread().interrupt();
-  428  10
             stop(e);
+  425  70
             }
+  426  3
         } catch (final InterruptedException e) {
+  427  3
             Thread.currentThread().interrupt();
+  428  3
             stop(e);
 429  0
         } catch (final Exception e) {
 430  0
             stop(e);
 431  
         } finally {
-  432  36
             IOUtils.closeQuietly(reader);
-  433  36
         }
-  434  36
     }
+  432  9
             IOUtils.closeQuietly(reader);
+  433  9
         }
+  434  9
     }
 435  
 
 436  
     private void stop(final Exception e) {
-  437  10
         listener.handle(e);
-  438  10
         stop();
-  439  10
     }
+  437  3
         listener.handle(e);
+  438  3
         stop();
+  439  3
     }
 440  
 
 441   @@ -816,8 +816,8 @@
      */
 444  
     public void stop() {
-  445  46
         this.run = false;
-  446  46
     }
+  445  12
         this.run = false;
+  446  12
     }
 447  
 
 448   @@ -838,52 +838,52 @@
     private long readLines(final RandomAccessFile reader) throws IOException {
 456  
         // Make explicit that the default charset is being used here
-  457  83
         Charset cset = Charset.defaultCharset();
-  458  83
         ByteArrayOutputStream lineBuf = new ByteArrayOutputStream(64);
-  459  83
         long pos = reader.getFilePointer();
-  460  83
         long rePos = pos; // position to re-read
+  457  21
         Charset cset = Charset.defaultCharset();
+  458  21
         ByteArrayOutputStream lineBuf = new ByteArrayOutputStream(64);
+  459  21
         long pos = reader.getFilePointer();
+  460  21
         long rePos = pos; // position to re-read
 461  
         int num;
-  462  83
         boolean seenCR = false;
-  463  4195
         while (getRun() && ((num = reader.read(inbuf)) != -1)) {
-  464  16411466
             for (int i = 0; i < num; i++) {
-  465  16407354
                 final byte ch = inbuf[i];
-  466  16407354
                 switch (ch) {
+  462  21
         boolean seenCR = false;
+  463  1049
         while (getRun() && ((num = reader.read(inbuf)) != -1)) {
+  464  4102868
             for (int i = 0; i < num; i++) {
+  465  4101840
                 final byte ch = inbuf[i];
+  466  4101840
                 switch (ch) {
 467  
                 case '\n':
-  468  400243
                     seenCR = false; // swallow CR before LF
-  469  400243
                     listener.handle(new String(lineBuf.toByteArray(), cset));
-  470  400243
                     lineBuf.reset();
-  471  400243
                     rePos = pos + i + 1;
-  472  400243
                     break;
+  468  100061
                     seenCR = false; // swallow CR before LF
+  469  100061
                     listener.handle(new String(lineBuf.toByteArray(), cset));
+  470  100061
                     lineBuf.reset();
+  471  100061
                     rePos = pos + i + 1;
+  472  100061
                     break;
 473  
                 case '\r':
-  474  16
                     if (seenCR) {
-  475  4
                         lineBuf.write('\r');
+  474  4
                     if (seenCR) {
+  475  1
                         lineBuf.write('\r');
 476  
                     }
-  477  16
                     seenCR = true;
-  478  16
                     break;
+  477  4
                     seenCR = true;
+  478  4
                     break;
 479  
                 default:
-  480  16007095
                     if (seenCR) {
-  481  8
                         seenCR = false; // swallow final CR
-  482  8
                         listener.handle(new String(lineBuf.toByteArray(), cset));
-  483  8
                         lineBuf.reset();
-  484  8
                         rePos = pos + i + 1;
+  480  4001775
                     if (seenCR) {
+  481  2
                         seenCR = false; // swallow final CR
+  482  2
                         listener.handle(new String(lineBuf.toByteArray(), cset));
+  483  2
                         lineBuf.reset();
+  484  2
                         rePos = pos + i + 1;
 485  
                     }
-  486  16007095
                     lineBuf.write(ch);
+  486  4001775
                     lineBuf.write(ch);
 487  
                 }
 488  
             }
-  489  4112
             pos = reader.getFilePointer();
+  489  1028
             pos = reader.getFilePointer();
 490  
         }
-  491  83
         IOUtils.closeQuietly(lineBuf); // not strictly necessary
-  492  83
         reader.seek(rePos); // Ensure we can re-read if necessary
-  493  83
         return rePos;
+  491  21
         IOUtils.closeQuietly(lineBuf); // not strictly necessary
+  492  21
         reader.seek(rePos); // Ensure we can re-read if necessary
+  493  21
         return rePos;
 494  
     }
 495   @@ -892,6 +892,6 @@
 }
- + \ No newline at end of file Modified: websites/production/commons/content/proper/commons-io/cobertura/org.apache.commons.io.input.TailerListener.html ============================================================================== --- websites/production/commons/content/proper/commons-io/cobertura/org.apache.commons.io.input.TailerListener.html (original) +++ websites/production/commons/content/proper/commons-io/cobertura/org.apache.commons.io.input.TailerListener.html Wed May 8 19:32:39 2013 @@ -153,6 +153,6 @@
 }
- + \ No newline at end of file Modified: websites/production/commons/content/proper/commons-io/cobertura/org.apache.commons.io.input.TailerListenerAdapter.html ============================================================================== --- websites/production/commons/content/proper/commons-io/cobertura/org.apache.commons.io.input.TailerListenerAdapter.html (original) +++ websites/production/commons/content/proper/commons-io/cobertura/org.apache.commons.io.input.TailerListenerAdapter.html Wed May 8 19:32:39 2013 @@ -141,6 +141,6 @@
 }
- + \ No newline at end of file Modified: websites/production/commons/content/proper/commons-io/cobertura/org.apache.commons.io.input.TeeInputStream.html ============================================================================== --- websites/production/commons/content/proper/commons-io/cobertura/org.apache.commons.io.input.TeeInputStream.html (original) +++ websites/production/commons/content/proper/commons-io/cobertura/org.apache.commons.io.input.TeeInputStream.html Wed May 8 19:32:39 2013 @@ -135,8 +135,8 @@
      */
 59  
     public TeeInputStream(final InputStream input, final OutputStream branch) {
-  60  28
         this(input, branch, false);
-  61  28
     }
+  60  7
         this(input, branch, false);
+  61  7
     }
 62  
 
 63   @@ -165,10 +165,10 @@
     public TeeInputStream(
 75  
             final InputStream input, final OutputStream branch, final boolean closeBranch) {
-  76  28
         super(input);
-  77  28
         this.branch = branch;
-  78  28
         this.closeBranch = closeBranch;
-  79  28
     }
+  76  7
         super(input);
+  77  7
         this.branch = branch;
+  78  7
         this.closeBranch = closeBranch;
+  79  7
     }
 80  
 
 81   @@ -221,12 +221,12 @@
     @Override
 107  
     public int read() throws IOException {
-  108  52
         final int ch = super.read();
-  109  52
         if (ch != -1) {
-  110  40
             branch.write(ch);
+  108  13
         final int ch = super.read();
+  109  13
         if (ch != -1) {
+  110  10
             branch.write(ch);
 111  
         }
-  112  52
         return ch;
+  112  13
         return ch;
 113  
     }
 114   @@ -255,12 +255,12 @@
     @Override
 126  
     public int read(final byte[] bts, final int st, final int end) throws IOException {
-  127  8
         final int n = super.read(bts, st, end);
-  128  8
         if (n != -1) {
-  129  4
             branch.write(bts, st, n);
+  127  2
         final int n = super.read(bts, st, end);
+  128  2
         if (n != -1) {
+  129  1
             branch.write(bts, st, n);
 130  
         }
-  131  8
         return n;
+  131  2
         return n;
 132  
     }
 133   @@ -285,12 +285,12 @@
     @Override
 143  
     public int read(final byte[] bts) throws IOException {
-  144  8
         final int n = super.read(bts);
-  145  8
         if (n != -1) {
-  146  4
             branch.write(bts, 0, n);
+  144  2
         final int n = super.read(bts);
+  145  2
         if (n != -1) {
+  146  1
             branch.write(bts, 0, n);
 147  
         }
-  148  8
         return n;
+  148  2
         return n;
 149  
     }
 150   @@ -299,6 +299,6 @@
 }
- + \ No newline at end of file