You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Gary D. Gregory (Jira)" <ji...@apache.org> on 2023/10/01 14:54:00 UTC

[jira] [Commented] (IO-813) LastModifiedFileComparator should not throw exceptions, period

    [ https://issues.apache.org/jira/browse/IO-813?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17770878#comment-17770878 ] 

Gary D. Gregory commented on IO-813:
------------------------------------

Here is an unrelated example (in the abstract for IO) of why throwing an exception is good:
 https://lists.apache.org/thread/scvg6r3jxm1prh4gyvv03x6lx23zobs6

> LastModifiedFileComparator should not throw exceptions, period
> --------------------------------------------------------------
>
>                 Key: IO-813
>                 URL: https://issues.apache.org/jira/browse/IO-813
>             Project: Commons IO
>          Issue Type: Bug
>            Reporter: Elliotte Rusty Harold
>            Priority: Major
>
> LastModifiedFileComparator is likely broken by design since it can unexpectedly throw UncheckedIOException. This violates the contract of Comparable.compareTo which is not documented to throw that exception. 
> I analyzed almost this exact case in detail here: https://medium.com/@elharo/when-you-cant-throw-an-exception-b9f9b0db9ba4
> I'm not sure how to fix this now, but I'm, tempted to simply deprecate this entire class.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)