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

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

Hello [~eamonnmcmanus] 

Thank you for your report.

Feel free to create a PR ;)

A unit test should fail before changes to the "main" side of the source tree is 
applied.

Run "mvn" by itself before pushing to git to run all build checks.

TY!

 

> FileUtils.deleteDirectory fails for a directory containing a broken symlink
> ---------------------------------------------------------------------------
>
>                 Key: IO-862
>                 URL: https://issues.apache.org/jira/browse/IO-862
>             Project: Commons IO
>          Issue Type: Bug
>          Components: Utilities
>    Affects Versions: 2.18.0
>         Environment: JDK 21 on Linux.
>            Reporter: Éamonn McManus
>            Priority: Major
>
> I tried importing Commons IO from HEAD into Google's monorepo and running all 
> affected tests, and I found that [this 
> test|https://gerrit.googlesource.com/plugins/uploadvalidator/+/refs/heads/master/src/test/java/com/googlesource/gerrit/plugins/uploadvalidator/SymlinkValidatorTest.java]
>  fails. It creates a directory hierarchy that includes a broken symbolic link 
> (one that points to a nonexistent file). Then in the test teardown it calls 
> FileUtils.deleteDirectory. That call fails when it encounters the broken 
> symlink.
> The failure looks like this:
> {noformat}
> org.apache.commons.io.IOExceptionList: 2 exception(s): 
> [org.apache.commons.io.IOIndexedException: FileNotFoundException #2: 
> /build/work/d4eb40af2b074d2b15ddd69536752eec859c/google3/tmp/Git11272691366437749178/symbolicFolder,
>  org.apache.commons.io.IOIndexedException: FileNotFoundException #3: 
> /build/work/d4eb40af2b074d2b15ddd69536752eec859c/google3/tmp/Git11272691366437749178/foo.txt|#2:
>  
> /build/work/d4eb40af2b074d2b15ddd69536752eec859c/google3/tmp/Git11272691366437749178/symbolicFolder,
>  org.apache.commons.io.IOIndexedException: FileNotFoundException #3: 
> /build/work/d4eb40af2b074d2b15ddd69536752eec859c/google3/tmp/Git11272691366437749178/foo.txt]
> at org.apache.commons.io.IOExceptionList.checkEmpty(IOExceptionList.java:50)
> at org.apache.commons.io.function.IOStream.forAll(IOStream.java:357)
> at org.apache.commons.io.function.IOStreams.forAll(IOStreams.java:42)
> at org.apache.commons.io.function.IOStreams.forAll(IOStreams.java:36)
> at org.apache.commons.io.function.IOConsumer.forAll(IOConsumer.java:80)
> at org.apache.commons.io.FileUtils.cleanDirectory(FileUtils.java:372)
> at org.apache.commons.io.FileUtils.deleteDirectory(FileUtils.java:1247)
> at 
> com.googlesource.gerrit.plugins.uploadvalidator.ValidatorTestCase.cleanup(ValidatorTestCase.java:39)
> ... 33 trimmed
> Caused by: org.apache.commons.io.IOIndexedException: FileNotFoundException 
> #2: 
> /build/work/d4eb40af2b074d2b15ddd69536752eec859c/google3/tmp/Git11272691366437749178/symbolicFolder
> at org.apache.commons.io.function.IOStream.lambda$forAll$1(IOStream.java:352)
> at 
> java.base/java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:1024)
> at 
> java.base/java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:762)
> at org.apache.commons.io.function.IOStream.forAll(IOStream.java:343)
> ... 40 more
> Caused by: java.io.FileNotFoundException: 
> /build/work/d4eb40af2b074d2b15ddd69536752eec859c/google3/tmp/Git11272691366437749178/symbolicFolder
> at org.apache.commons.io.FileUtils.checkExists(FileUtils.java:297)
> at org.apache.commons.io.FileUtils.forceDelete(FileUtils.java:1390)
> at org.apache.commons.io.function.IOStream.lambda$forAll$1(IOStream.java:345)
> ... 43 more
> {noformat}
>  
> The issue looks to have been introduced by 
> [0b9c657|https://github.com/apache/commons-io/commit/0b9c657cc0b6dc6571e27b7f41f6a548db7682ca].
>  



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

Reply via email to