Uploaded image for project: 'Commons IO'
  1. Commons IO
  2. IO-481

org.apache.commons.io.FileUtils#waitFor waits too long

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.4
    • Fix Version/s: 2.5
    • Component/s: None
    • Labels:
      None

      Description

      The timing algorithm is basically broken, since Thread.sleep is imprecise. There is also a counter error in the looping code.

      The following testcase will never run in less than 4 seconds on my machine

      public void testRealWallTime()

      { long start = System.currentTimeMillis(); FileUtils.waitFor(new File(""), 2); System.out.println("elapsed = " + (System.currentTimeMillis() - start)); }

        Attachments

          Activity

            People

            • Assignee:
              krosenvold Kristian Rosenvold
              Reporter:
              krosenvold Kristian Rosenvold
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: