Skip to content

Commit

Permalink
FileUtils isFolderEmpty should throw IOException
Browse files Browse the repository at this point in the history
- And this also eliminates a warning in Eclipse 4.31 about a potential resource leak
  • Loading branch information
Phillipus committed Feb 27, 2024
1 parent 3244726 commit 3ef1be6
Showing 1 changed file with 1 addition and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,7 @@ public static String getValidFileName(String name) {
* @param folder
* @return true if the folder is empty
*/
public static boolean isFolderEmpty(File folder) {
public static boolean isFolderEmpty(File folder) throws IOException {
if(!(folder != null && folder.exists() && folder.isDirectory())) {
return true;
}
Expand All @@ -426,9 +426,6 @@ public static boolean isFolderEmpty(File folder) {
.filter(path -> !path.endsWith(".DS_Store"))) { // Ignore Mac file
return entries.findFirst().isEmpty();
}
catch(IOException ex) {
return true;
}
}
}

0 comments on commit 3ef1be6

Please sign in to comment.