Navigation
Recherche
|
Java 25 to change Windows file operation behaviors
mardi 17 juin 2025, 01:47 , par InfoWorld
As part of a quality outreach, some changes are coming in the planned Java 25 release with regard to file operations on Windows. The File.delete command will no longer delete read-only files on Windows, and file operations on a path with a trailing space in a directory or file name will now fail consistently on Windows.
In a June 16 bulletin on Oracle’s inside.java blog, David Delabassee, Oracle director of Java relations, said File.delete in JDK 25 has been changed on Windows so it now fails and returns false for regular files when the DOS read-only attribute is set. Before JDK 25, File.delete would delete read-only files by removing the DOS read-only attribute before deletion was attempted. But because removing the attribute and deleting the file are not a single atomic operation, this could result in the file remaining, with modified attributes. Applications that depend on the previous behavior should be updated to clear the file attributes before deleting files, Delabassee said. To make the transition easier, a system property has been introduced to restore the previous behavior. Running File.delete with -Djdk.io.File.allowDeleteReadOnlyFiles=true will remove the DOS read-only attribute prior to deleting the file, restoring the legacy behavior. Also in JDK 25, file operations on a path with a trailing space in a directory or file name now fail consistently on Windows. For example, File::mkdir will return false, or File::createNewFile will throw IOException, if an element in the path has a trailing space, because path names such as these are not legal on Windows. Prior to JDK 25, operations on a file created from such an illegal abstract path name could appear to succeed when they did not, Delabassee said. Now in a rampdown phase, JDK 25, a long-term support (LTS) release, is due to be generally available September 16.
https://www.infoworld.com/article/4007824/java-25-to-change-windows-file-operation-behaviors.html
Voir aussi |
56 sources (32 en français)
Date Actuelle
mar. 17 juin - 05:39 CEST
|