On Fri, 13 Oct 2023 12:18:41 GMT, Sean Coffey <[email protected]> wrote:
>> Fix up java.util.zip.ZipFile$Source hashCode() impl so that duplicate Source
>> objects aren't created for the same zip file.
>
> Sean Coffey has updated the pull request incrementally with one additional
> commit since the last revision:
>
> minor test edits and comment updates
src/java.base/share/classes/java/util/zip/ZipFile.java line 1423:
> 1421: (PrivilegedExceptionAction<File>)
> file::getCanonicalFile);
> 1422: } catch (PrivilegedActionException pae) {
> 1423: throw new IOException(pae.getException());
The exception handling isn't right, you should be re-throwing pae.getException
when it's an IOException, this should do what you want
PrivilegedExceptionAction<File> pa = file::getCanonicalFile;
try {
return AccessController.doPrivileged(pa);
} catch (PrivilegedActionException pae) {
Throwable cause = pae.getCause();
if (cause instanceof IOException ioe) {
throw ioe;
} else {
throw new IOException(cause);
}
}
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/16115#discussion_r1360264749