From 9f077aaeb371a35c05ca1b795f4c5a61a4abfa84 Mon Sep 17 00:00:00 2001 From: Joakim Erdfelt Date: Fri, 21 Jun 2024 13:40:06 -0500 Subject: [PATCH] Issue #11944 - Part.delete() should only attempt to delete if the file exists. --- .../src/main/java/org/eclipse/jetty/http/MultiPart.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/jetty-core/jetty-http/src/main/java/org/eclipse/jetty/http/MultiPart.java b/jetty-core/jetty-http/src/main/java/org/eclipse/jetty/http/MultiPart.java index da534a781aaa..32562dbcb1f9 100644 --- a/jetty-core/jetty-http/src/main/java/org/eclipse/jetty/http/MultiPart.java +++ b/jetty-core/jetty-http/src/main/java/org/eclipse/jetty/http/MultiPart.java @@ -306,7 +306,7 @@ public void delete() throws IOException Path path = getPath(); if (path != null) { - Files.delete(path); + Files.deleteIfExists(path); try (AutoLock ignored = lock.lock()) { this.path = null; @@ -338,7 +338,7 @@ public void fail(Throwable t) if (source != null) source.fail(t); if (path != null) - Files.delete(path); + Files.deleteIfExists(path); } catch (Throwable x) {