I'm really wondering what this code does:
scala> import java.nio.file._
import java.nio.file._
scala> Files.copy(Paths.get(""), Paths.get(""))
res0: java.nio.file.Path =
Shouldn't that throw a NoSuchFileException
?
Reading the JavaDoc reveals:
By default, the copy fails if the target file already exists or is a symbolic link, except if the source and target are the same file, in which case the method completes without copying the file.
But I'm not sure this is the true cause, because Files.copy(Paths.get("a"), Paths.get("a"))
fails as expected.
You might want to check http://download.oracle.com/javase/7/docs/api/java/nio/file/Paths.html for what paths.get does when provided an empty string (it generates an empty path) and http://download.oracle.com/javase/7/docs/api/java/nio/file/Path.html for details on what an empty path means:
So it looks like your code is getting an empty path which is valid and then considers the source and destination to be the same.