Bug in Files.createDirectories(Path, FileAttribute<?>...)

Alan Bateman Alan.Bateman at oracle.com
Sat Jan 18 09:57:11 PST 2014


On 18/01/2014 16:44, Christian Schlichtherle wrote:
> Hi everyone,
>
> running the following program:
>
> import  java.io.IOException;
> import  java.nio.file.Files;
> import  java.nio.file.Paths;
>
> public  class ShouldNotThrowException {
>      public  static  void main(String[] args)throws  IOException {
>          Files.createDirectories(Paths.get("/"));
>      }
> }
> produces the following output:
>
> Exception in thread "main" java.io.IOException: Root directory does not exist
> 	at java.nio.file.Files.createDirectories(Files.java:711)
> 	at ShouldNotThrowException.main(ShouldNotThrowException.java:7)
>
Files.createDirectories may be overly reliant on specific exceptions 
bring thrown by the underlying FileSystemProvider. On OS X then it seems 
that mkdir returns a special error for /. It also appears that Windows 
does something special for root directories too. Linux seems to be okay. 
In any case, I'll create a bug for this. It hasn't been reported before 
(to my knowledge anyway).

-Alan.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.openjdk.java.net/pipermail/nio-discuss/attachments/20140118/0c1a52a0/attachment.html 


More information about the nio-discuss mailing list