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

Sebb commented on IO-147:
-------------------------

The Javadoc for forceDelete() fails to mention that it can throw  
FileNotFoundException.
AFAICS there is no test for deleting a non-existent file.

A compromise solution would be to check if the file exists, and then try and 
delete it.
If the deletion fails, then either throw FileNotFoundException or IOException 
as appropriate.

Patch to follow.

> Deletion of orphaned Softlinks does not work
> --------------------------------------------
>
>                 Key: IO-147
>                 URL: https://issues.apache.org/jira/browse/IO-147
>             Project: Commons IO
>          Issue Type: Bug
>    Affects Versions: 1.3.2
>         Environment: Debian Linux JDK 1.5
>            Reporter: Stefan Lischke
>            Priority: Critical
>
> If there is an orphaned softlink a -> b, but b does not exists anymore than 
> the softlink will not be removed. This happens when you call 
> FileUtils.deleteDirectory() and when the linked target b is deleted earlier 
> than the link.
> This is caused by the "ugly" file.exists() call in forceDelete()
> if (!file.exists()) {
>          throw new FileNotFoundException("File does not exist: " + file);
> }
> if this check is not done, everything works as expected. I think this test is 
> not neccessery, cause file.delete will test this better.
> Please discuss and change this.
> thanx
> Stefan 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to