JarFile constructor throws undocumented exception (only) on Windows OS

Alan Bateman Alan.Bateman at oracle.com
Fri Oct 5 10:45:05 UTC 2018


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. Note that the issue is not specific to Windows, 
you'll see the same thing on Linux/other with other garbage input - a 
good example to try is a path string with NUL characters.

-Alan


More information about the core-libs-dev mailing list