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

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

Hello [~jdigital] 

Note that Java provides both {{FileNotFoundException}} and 
{{NoSuchFileException}} which are both kinds of {{{}IOException{}}}. So in app 
code, you might as well catch {{IOException}} and test for file existence if 
you want to refine feedback to the call site.

The {{setReadOnly()}} method does not know the file is missing.

Feel free to propose a PR on GitHub so we can better understand how you propose 
to change the behavior.

HTH

> FileUtils.forceDelete on non-existent file on Windows throws IOException 
> rather than FileNotFoundException
> ----------------------------------------------------------------------------------------------------------
>
>                 Key: IO-859
>                 URL: https://issues.apache.org/jira/browse/IO-859
>             Project: Commons IO
>          Issue Type: Bug
>          Components: Utilities
>    Affects Versions: 2.16.1
>         Environment: Windows
>            Reporter: JD Dean
>            Priority: Minor
>
> using FileUtils.forceDelete on a non-existent file throws *IOException: DOS 
> or POSIX file operations not available* in setReadOnly.
> {code:java}
> Caused by: java.io.IOException: DOS or POSIX file operations not available 
> for <path>
>     PathUtils.setReadOnly(PathUtils.java:1602)
>     PathUtils.deleteFile(PathUtils.java:584)
>     PathUtils.delete(PathUtils.java:477)
>     FileUtils.forceDelete(FileUtils.java:1386)
>  {code}



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

Reply via email to