[
https://issues.apache.org/jira/browse/IO-814?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17772533#comment-17772533
]
Elliotte Rusty Harold commented on IO-814:
------------------------------------------
The problem here is the use of org.apache.commons.io.function.Uncheck in
PathUtils.readAttributes which bubbles up to methods that weren't aware of it
and weren't prepared to handle it, leading to unexpected runtime failures in
other projects.
This is a classic example of exactly why a checked IOException is necessary. We
have decades of experience showing that we cannot rely on programmers to
document and handle error conditions unless the compiler forces them to.
> FileUtils.deleteDirectory can throw UncheckedIOException
> --------------------------------------------------------
>
> Key: IO-814
> URL: https://issues.apache.org/jira/browse/IO-814
> Project: Commons IO
> Issue Type: Bug
> Affects Versions: 2.13.0, 2.14.0
> Reporter: Elliotte Rusty Harold
> Priority: Critical
>
> This was a behavior breaking change, and an incorrect one to boot.
> Operations that can have I/O errors should throw IOException if they can't
> directly handle the I/O error. UncheckedIOException is not a reasonable
> alternative.
> A method that can neither handle nor throw IOException must not perform I/O
> operations.
> It's worth noting that functional programming, not just in Java but in
> general, does not allow I/O. As soon as a method performs I/O, it's no longer
> a pure function and should not be written in a functional style.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)