palantir / giraffe

Gracefully Integrated Remote Access For Files and Execution
https://palantir.github.io/giraffe/
Apache License 2.0
51 stars 16 forks source link

UnsupportedOperationException when copying files from SMB on Windows #39

Closed qwertzguy closed 9 years ago

qwertzguy commented 9 years ago

When doing this:

Path source = Paths.get("\\\\filer.domain.local\\folder");
Path target = Paths.get("c:\\tmp");
MoreFiles.copyRecursive(source, target);

I get this exception:

java.lang.UnsupportedOperationException
    at sun.nio.fs.WindowsFileSystemProvider.readAttributes(WindowsFileSystemProvider.java:192)
    at java.nio.file.Files.readAttributes(Files.java:1686)
    at java.nio.file.Files.getPosixFilePermissions(Files.java:1953)
    at com.palantir.giraffe.file.MoreFiles$CopyVisitor.preVisitDirectory(MoreFiles.java:285)
    at com.palantir.giraffe.file.MoreFiles$CopyVisitor.preVisitDirectory(MoreFiles.java:269)
    at java.nio.file.FileTreeWalker.walk(FileTreeWalker.java:192)
    at java.nio.file.FileTreeWalker.walk(FileTreeWalker.java:69)
    at java.nio.file.Files.walkFileTree(Files.java:2602)
    at java.nio.file.Files.walkFileTree(Files.java:2635)
    at com.palantir.giraffe.file.MoreFiles.copyRecursive(MoreFiles.java:266)
bluekeyes commented 9 years ago

I suspect this actually happens for any paths on Windows and is not specific to SMB paths - copyRecursive should work even if getPosixFilePermissions is not not supported.