8032220: Files.createDirectories throws exception with confusing message for root directories that exist
Alan Bateman
Alan.Bateman at oracle.com
Mon Jan 20 11:36:23 PST 2014
This one came up on nio-discuss a few days ago.
The issue is that Files.createDirectories fails on some platforms when
called with a path to a root directory that exists. The exception (which
is misleading) happens on OS X and Windows (Linux and Solaris are okay).
On OS X then the issue is that mkdir fails with EISDIR when you attempt
to use it to create /. On Windows it's because the win32 CreateDirectory
fails with an ERROR_ACCESS_DENIED for this case. I've updated both
implementations to better handle this case so that createDirectory
throws the expected FileAlreadyExistsException. I've also tweaked the
exception throw by createDirectories so it's less confusing for the case
that the root directory is not accessible. The webrev with the changes
is here:
http://cr.openjdk.java.net/~alanb/8032220/webrev/
-Alan.
More information about the nio-dev
mailing list