Skip to content

Commit

Permalink
Issue #5480 - NPE protection on IO.delete(File)
Browse files Browse the repository at this point in the history
Signed-off-by: Joakim Erdfelt <[email protected]>
  • Loading branch information
joakime committed Oct 20, 2020
1 parent 4ecaf30 commit 0e98c37
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion jetty-util/src/main/java/org/eclipse/jetty/util/IO.java
Original file line number Diff line number Diff line change
Expand Up @@ -361,10 +361,13 @@ public static String toString(Reader in)
* This delete will recursively delete directories - BE CAREFUL
*
* @param file The file (or directory) to be deleted.
* @return true if anything was deleted. (note: this does not mean that all content in a directory was deleted)
* @return true if file was deleted, or directory referenced was deleted.
* false if file doesn't exist, or was null.
*/
public static boolean delete(File file)
{
if (file == null)
return false;
if (!file.exists())
return false;
if (file.isDirectory())
Expand Down

0 comments on commit 0e98c37

Please sign in to comment.