-
Bug
-
Resolution: Fixed
-
P2
-
8, 25
-
b07
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8362933 | 25.0.1 | Brian Burkhalter | P2 | Resolved | Fixed | b03 |
JDK-8362426 | 25 | Brian Burkhalter | P2 | Closed | Fixed | b32 |
As per the "java.io.File" class level specification "Accessing a file with the empty abstract pathname is equivalent to accessing the current user directory."
However, when listFiles() is invoked on such a File instance with system assertions enabled (-esa), an unexpected AssertionError is thrown.
`-esa` is a standard option https://docs.oracle.com/en/java/javase/24/docs/specs/man/java.html#standard-options-for-java
This behavior is observed only when system assertions are turned on, suggesting that there's an internal assertion in the JDK code path (likely in java.io.File or related native code) that fails under this scenario.
Sample code :
File file = new File(""); // empty path
File[] files = file.listFiles(); // cause AssertionError
=== possible cause ===
private File(String child, File parent) {
assert parent.path != null;
** assert (!parent.path.isEmpty());
- backported by
-
JDK-8362933 AssertionError in File.listFiles() when path is empty and -esa is enabled
-
- Resolved
-
-
JDK-8362426 AssertionError in File.listFiles() when path is empty and -esa is enabled
-
- Closed
-
- relates to
-
JDK-8362429 AssertionError in File.listFiles(FileFilter | FilenameFilter)
-
- Resolved
-
-
JDK-8024695 new File("").exists() returns false whereas it is the current working directory
-
- Resolved
-
-
JDK-8346673 new File("").exists() returns false whereas it is the current working directory
-
- Closed
-
- links to
-
Commit(jdk25) openjdk/jdk/69ea85ee
-
Commit(master) openjdk/jdk/eefbfdce
-
Review(jdk25) openjdk/jdk/26327
-
Review(master) openjdk/jdk/26224