FULL PRODUCT VERSION :
java version "1.7.0_79"
OpenJDK Runtime Environment (IcedTea 2.5.5) (Arch Linux build 7.u79_2.5.5-1-x86_64)
OpenJDK 64-Bit Server VM (build 24.79-b02, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Linux host 4.0.7-2-ARCH #1 SMP PREEMPT Tue Jun 30 07:50:21 UTC 2015 x86_64 GNU/Linux
A DESCRIPTION OF THE PROBLEM :
createDirectories throws FileAlreadyExistsException if the path is a symlink pointing to a directory. The documentation states "an exception is not thrown if the directory could not be created because it already exists. ", so as user experience I'd expect to be able to replace any directory passed there by a symlink to a directory.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
No exception.
ACTUAL -
Exception in thread "main" java.nio.file.FileAlreadyExistsException: /tmp/symlink
at sun.nio.fs.UnixException.translateToIOException(UnixException.java:88)
at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102)
at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:107)
at sun.nio.fs.UnixFileSystemProvider.createDirectory(UnixFileSystemProvider.java:383)
at java.nio.file.Files.createDirectory(Files.java:630)
at java.nio.file.Files.createAndCheckIsDirectory(Files.java:734)
at java.nio.file.Files.createDirectories(Files.java:683)
at Test.main(Test.java:10)
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.nio.file.Files;
import java.nio.file.Paths;
import java.io.IOException;
public class Test {
public static void main(String[] args) throws IOException {
java.nio.file.Files.createDirectories(Paths.get("/tmp/emptyDirectory"));
java.nio.file.Files.createSymbolicLink(Paths.get("/tmp/symlink"), Paths.get("/tmp/emptyDirectory"));
// following line errors, but should work
java.nio.file.Files.createDirectories(Paths.get("/tmp/symlink"));
}
}
---------- END SOURCE ----------
java version "1.7.0_79"
OpenJDK Runtime Environment (IcedTea 2.5.5) (Arch Linux build 7.u79_2.5.5-1-x86_64)
OpenJDK 64-Bit Server VM (build 24.79-b02, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Linux host 4.0.7-2-ARCH #1 SMP PREEMPT Tue Jun 30 07:50:21 UTC 2015 x86_64 GNU/Linux
A DESCRIPTION OF THE PROBLEM :
createDirectories throws FileAlreadyExistsException if the path is a symlink pointing to a directory. The documentation states "an exception is not thrown if the directory could not be created because it already exists. ", so as user experience I'd expect to be able to replace any directory passed there by a symlink to a directory.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
No exception.
ACTUAL -
Exception in thread "main" java.nio.file.FileAlreadyExistsException: /tmp/symlink
at sun.nio.fs.UnixException.translateToIOException(UnixException.java:88)
at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102)
at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:107)
at sun.nio.fs.UnixFileSystemProvider.createDirectory(UnixFileSystemProvider.java:383)
at java.nio.file.Files.createDirectory(Files.java:630)
at java.nio.file.Files.createAndCheckIsDirectory(Files.java:734)
at java.nio.file.Files.createDirectories(Files.java:683)
at Test.main(Test.java:10)
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.nio.file.Files;
import java.nio.file.Paths;
import java.io.IOException;
public class Test {
public static void main(String[] args) throws IOException {
java.nio.file.Files.createDirectories(Paths.get("/tmp/emptyDirectory"));
java.nio.file.Files.createSymbolicLink(Paths.get("/tmp/symlink"), Paths.get("/tmp/emptyDirectory"));
// following line errors, but should work
java.nio.file.Files.createDirectories(Paths.get("/tmp/symlink"));
}
}
---------- END SOURCE ----------