JarFile constructor throws undocumented exception (only) on Windows OS
Chris Hegarty
chris.hegarty at oracle.com
Fri Oct 5 11:06:01 UTC 2018
On 05/10/18 11:45, Alan Bateman wrote:
> On 04/10/2018 10:36, Jaikiran Pai wrote:
>> :
>>
>>
>> The javadoc of JarFile constructor(s) mentions that:
>>
>> * @throws IOException if an I/O error has occurred
>>
>> Given that the javadoc doesn't mention anything about this other
>> exception, would this throwing of java.nio.file.InvalidPathException be
>> considered a bug in the implementation?
>>
> Yes, it's a bug in the ZipFile code as it's not specified to throw this
> unchecked exception.
Given the stacktrace, from a previous email in this thread,
does it make more sense to wrap the IPE in an IOException,
rather then declaring that the ZipFile constructor can throw
IPE? The reason I suggest this is that it looks, from that
stacktrace, that the error is detected deep in the
implementation, rather than when performing argument
validation.
If this is not the case, then maybe the implementation could
be updated to perform the toPath operation earlier, or at
least add some comment indicating the implicit arg check.
-Chris.
More information about the core-libs-dev
mailing list