Uploaded image for project: 'NetarchiveSuite'
  1. NetarchiveSuite
  2. NAS-2270

HarvestDocumentation.moveAwayForeignFiles() has broken logic

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Minor
    • 4.4
    • 4.2
    • None
    • None
    • Hide

      The fix is verified by the Unit Test. If it is thought necessary, one could test it as part of the release test:

      1. Start a harvest
      2. Create some spurious files in the harvest directory while the harvest is happening
      3. Check that they are processed separately from the harvest files. (I haven't checked what the precise expected behaviour is.)
      Show
      The fix is verified by the Unit Test. If it is thought necessary, one could test it as part of the release test: Start a harvest Create some spurious files in the harvest directory while the harvest is happening Check that they are processed separately from the harvest files. (I haven't checked what the precise expected behaviour is.)

    Description

      The code block

       if (!lostfilesDir.exists()) {
                              FileUtils.createDir(lostfilesDir);
                              File moveTo = new File(lostfilesDir,
                                                     archiveFile.getName());
                              archiveFile.renameTo(moveTo);
                              movedFiles.add(moveTo);
                          }
      

      is wrong. The if block should only include the createDir() call.

      The corresponding unit test either passes or fails depending on the order in which the two bad-files are processed, so the result is system-dependent. The fix is trivial but I'll beef up the unit test to make sure it always fails with the existing code.

      Attachments

        Activity

          People

            csr Colin Rosenthal
            csr Colin Rosenthal
            Søren Vejrup Carlsen Søren Vejrup Carlsen (Inactive)
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - 3h
                3h
                Remaining:
                Remaining Estimate - 3h
                3h
                Logged:
                Time Spent - Not Specified
                Not Specified