[ https://issues.apache.org/jira/browse/HADOOP-6531?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12828586#action_12828586 ]
Ravi Gummadi commented on HADOOP-6531: -------------------------------------- We are not checking the return value of fullyDeleteContents() in fullyDelete() method. But if fullyDeleteContents() returns false, next line "dir.delete()" will be executed extra for all the directories in the heirarchy that we traversed. Though it is harmless with this existing patch, it looks better to have the check here and return false if fullyDeleteContents() returns false. Minor nit in testcase: Last 3 assertions in both testcases in TestFileUtil.java are same and can be moved to a separate method (say validateTmpDir() ) to avoid code-duplication. > add FileUtil.fullyDeleteContents(dir) api to delete contents of a directory > --------------------------------------------------------------------------- > > Key: HADOOP-6531 > URL: https://issues.apache.org/jira/browse/HADOOP-6531 > Project: Hadoop Common > Issue Type: Improvement > Components: fs > Reporter: Amareshwari Sriramadasu > Assignee: Amareshwari Sriramadasu > Priority: Minor > Fix For: 0.22.0 > > Attachments: patch-6531-1.txt, patch-6531.txt > > > Add FileUtil.fullyDeleteContents(dir) api to delete contents of a directory, > not directory itself. This will be useful if we want to clear the contents of > cwd. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.