RFR: 8280881: (fs) UnixNativeDispatcher.close0 may throw UnixException [v2]

Alan Bateman alanb at openjdk.java.net
Fri Feb 18 17:28:53 UTC 2022


On Fri, 18 Feb 2022 17:21:40 GMT, Brian Burkhalter <bpb at openjdk.org> wrote:

> So in finally blocks where throwing an `IOException` because of a `close()` failure would mask any exception thrown in the `try` block it would be
> 
> ```
> close(fd, null);
> ```
> 
> which would mean ignoring the `UnixException` of `close()`?

close(fd, e -> null) should work for the cases where it's okay to ignore. The important cases to throw is when writing but most of the cases will be reading.

-------------

PR: https://git.openjdk.java.net/jdk/pull/7467


More information about the nio-dev mailing list