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

Jaikiran Pai jpai at openjdk.java.net
Thu Feb 17 04:18:04 UTC 2022


On Wed, 16 Feb 2022 00:44:37 GMT, Brian Burkhalter <bpb at openjdk.org> wrote:

>> Re-specify `sun.nio.fs.UnixNativeDispatcher.close0()` to throw `sun.nio.fs.UnixException` and modify callers either to ignore it or to rethrow it as an `IOException`, as appropriate.
>
> Brian Burkhalter has updated the pull request incrementally with one additional commit since the last revision:
> 
>   8280881: Correct previous version; make Linux changes

src/java.base/unix/classes/sun/nio/fs/UnixCopyFile.java line 221:

> 219:                 } catch (UnixException e) {
> 220:                     if (done)
> 221:                         e.rethrowAsIOException(target);

Should we just ignore the exception irrespective of whether or not it is `done`? That I think would probably be a bit more consistent with some other places where we ignore exception from `close`. I think ignoring this instead of (conditionally) throwing this will also help propagate any previous raised exception, where a few lines above this `finally` block there's an "inner" try/catch which can potentially throw an `IOException` (line 211).

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

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


More information about the nio-dev mailing list