[
https://issues.apache.org/jira/browse/IO-502?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15257252#comment-15257252
]
Christian Schulte commented on IO-502:
--------------------------------------
The 'close' method of 'FileOutputStream' translates to a call to OpenJDK's
native
[fileClose|http://hg.openjdk.java.net/jdk7u/jdk7u/jdk/file/34c594b52b73/src/solaris/native/java/io/io_util_md.c#l88]
method. That will call
[JVM_Close|http://hg.openjdk.java.net/jdk7u/jdk7u-dev/hotspot/file/2cd3690f644c/src/share/vm/prims/jvm.cpp#l2642]
leading to the operating system's C libraries 'close' function getting called.
Definitely want any error that function returns to be propagated as an
exception to the caller. It's completely operating system dependent. On my
system the manpage of close states:
{noformat}
ERRORS
close() will fail if:
[EBADF] d is not an active descriptor.
[EINTR] An interrupt was received.
[EIO] An I/O error occurred while writing to the file system.
{noformat}
Not suppressing any of these errors silently should do. I think closing a
channel obtained from a stream will also close the stream internally. I do not
know if that is specified behaviour or just an implementation detail of e.g.
OpenJDK.
> Exceptions are suppressed incorrectly when copying files.
> ---------------------------------------------------------
>
> Key: IO-502
> URL: https://issues.apache.org/jira/browse/IO-502
> Project: Commons IO
> Issue Type: Bug
> Components: Utilities
> Reporter: Christian Schulte
> Priority: Critical
> Attachments: IO-502.patch
>
>
> When copying files or directories, exceptions thrown on closing streams are
> suppressed incorrectly and need to be propagated to the caller.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)