JDK-8223771 : (zipfs) FileSystemProvider.newFileSystem(Path, Map) should throw IOException when called with a file that cannot be open
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.nio
  • Affected Version: 13
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2019-05-13
  • Updated: 2019-10-09
  • Resolved: 2019-10-04
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 14
14 b18Fixed
Related Reports
CSR :  
Duplicate :  
Relates :  
Relates :  
Sub Tasks
JDK-8231899 :  
New methods added by JDK-8219793 don't describe (or mismatch specified) scenarios when referenced path item is not present.

"Throws: IOException if an I/O error occurs" 
declaration, however for example the following code:



java.nio.file.FileSystemNotFoundException: doesnotexist

And FileSystemNotFoundException is not a subclass of IOException.

URL: https://hg.openjdk.java.net/jdk/jdk/rev/ff45c1bf8129 User: lancea Date: 2019-10-04 19:51:46 +0000

The newFileSystem(URI) methods can (and it's provider specific) can work with a registry so this is why FileSystemAlreadyExistsException can be thrown. The newFileSystem(Path) just open a file as a file system so FileSystemAlreadyExistsException doesn't make sense.

This is not new behavior. ZipFileSystem constructor has thrown FileSystemNotFoundException since its inception in JDK 7 when the zip/jar does not exist and is not being created.. So we have to decide is do we want to change the Exception from FileSystemNotFoundException to IOException in the constructor or leave it as is.

The seems to be a bug in the zip provider's newFileSystem(Path, Map) method. It should throw IOException when called with a file that it cannot open.