I traced it down. First, the stack trace showing where the exception is precisely thrown, executed on OS X using Oracle JDK 1.8.0_161:
Caused by: java.nio.file.ProviderMismatchException |
at sun.nio.fs.UnixPath.toUnixPath(UnixPath.java:200) |
at sun.nio.fs.UnixFileSystemProvider.createDirectory(UnixFileSystemProvider.java:375) |
at java.nio.file.Files.createDirectory(Files.java:674) |
at java.nio.file.Files.createAndCheckIsDirectory(Files.java:781) |
at java.nio.file.Files.createDirectories(Files.java:727)
|
The code of `sun.nio.fs.UnixPath.toUnixPath(UnixPath)` used is (resulting from decompilation):
static UnixPath toUnixPath(Path arg) { |
if(arg == null) { |
throw new NullPointerException(); |
} else if(!(arg instanceof UnixPath)) { |
throw new ProviderMismatchException(); // *** line 200 *** |
} else { |
return (UnixPath)arg; |
} |
}
|
This method throws the exception at line 200 if `arg` is a WELD proxy. While debugging the type was `Comparable$Iterable$Path$Watchable$538699755$Proxy$_$$_WeldClientProxy`, causing the test `arg instanceof UnixPath` to become false. Which means that there are situations where a WELD proxy for a Path object on Unix-like platforms is not an instance of a UnixPath. |