-
Bug
-
Resolution: Duplicate
-
P3
-
17
-
generic
-
generic
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8340283 | 17.0.14 | Goetz Lindenmaier | P4 | Resolved | Fixed | b01 |
A DESCRIPTION OF THE PROBLEM :
It appears that the issue reported inJDK-8294193 is not fixed in JDK17. Can this be fixed in JDK17?
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. Create a symlink. For example:
ln -s <some-path> /opt/test
2. Create a simple code as below and run it using the latest JDK17 and JDK20. JDK17 should give FileAlreadyExistsException.
import java.io.File;
import java.nio.file.Files;
public class Main {
public static void main(String[] args) {
File test = new File("/opt/test");
try {
Files.createDirectories(test.toPath());
} catch(Exception e) {
System.out.println(e);
}
}
}
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
There shouldn't be FileAlreadyExistsException.
ACTUAL -
JDK17 gives FileAlreadyExistsException.
---------- BEGIN SOURCE ----------
import java.io.File;
import java.nio.file.Files;
public class Main {
public static void main(String[] args) {
File test = new File("/opt/test");
try {
Files.createDirectories(test.toPath());
} catch(Exception e) {
System.out.println(e);
}
}
}
---------- END SOURCE ----------
FREQUENCY : always
It appears that the issue reported in
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. Create a symlink. For example:
ln -s <some-path> /opt/test
2. Create a simple code as below and run it using the latest JDK17 and JDK20. JDK17 should give FileAlreadyExistsException.
import java.io.File;
import java.nio.file.Files;
public class Main {
public static void main(String[] args) {
File test = new File("/opt/test");
try {
Files.createDirectories(test.toPath());
} catch(Exception e) {
System.out.println(e);
}
}
}
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
There shouldn't be FileAlreadyExistsException.
ACTUAL -
JDK17 gives FileAlreadyExistsException.
---------- BEGIN SOURCE ----------
import java.io.File;
import java.nio.file.Files;
public class Main {
public static void main(String[] args) {
File test = new File("/opt/test");
try {
Files.createDirectories(test.toPath());
} catch(Exception e) {
System.out.println(e);
}
}
}
---------- END SOURCE ----------
FREQUENCY : always
- backported by
-
JDK-8340283 Files.createDirectories throws FileAlreadyExistsException for a symbolic link whose target is an existing directory
-
- Resolved
-
- duplicates
-
JDK-8339117 Files.createDirectories throws FileAlreadyExistsException for a symbolic link whose target is an existing directory
-
- Resolved
-
- relates to
-
JDK-8294193 Files.createDirectories throws FileAlreadyExistsException for a symbolic link whose target is an existing directory
-
- Resolved
-