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

PathUtils.copyDirectory() does not work when source and dest belong to different file systems

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 2.8.0
    • 2.9.0
    • Utilities
    • None
    • Java 8, Linux

    Description

      This code:

      @Test
      public void pathUtilsCopyDirFailure() throws IOException {
      	FileSystem fs1 = Jimfs.newFileSystem();
      	Path srcDir = fs1.getPath("srcDir");
      	// Create files/dirs in srcDir
      	Path targetDir = Paths.get("targetDir");
      	PathUtils.copyDirectory(srcDir, targetDir);
      }
      

      throws exception:

      java.nio.file.ProviderMismatchException
      	at java.base/sun.nio.fs.UnixPath.toUnixPath(UnixPath.java:198)
      	at java.base/sun.nio.fs.UnixPath.resolve(UnixPath.java:410)
      	at java.base/sun.nio.fs.UnixPath.resolve(UnixPath.java:43)
      	at org.apache.commons.io.file.CopyDirectoryVisitor.preVisitDirectory(CopyDirectoryVisitor.java:130)
      	at org.apache.commons.io.file.CopyDirectoryVisitor.preVisitDirectory(CopyDirectoryVisitor.java:36)
      	at java.base/java.nio.file.Files.walkFileTree(Files.java:2731)
      	at java.base/java.nio.file.Files.walkFileTree(Files.java:2796)
      	at org.apache.commons.io.file.PathUtils.visitFileTree(PathUtils.java:687)
      	at org.apache.commons.io.file.PathUtils.copyDirectory(PathUtils.java:196)
      

      Attachments

        Activity

          People

            Unassigned Unassigned
            ashcheglov Andrew Shcheglov
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

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