You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Java version/vendor(use: java -version)
java version "21.0.1" 2023-10-17 LTS
Java(TM) SE Runtime Environment (build 21.0.1+12-LTS-29)
Java HotSpot(TM) 64-Bit Server VM (build 21.0.1+12-LTS-29, mixed mode, sharing)
OS type/version
Microsoft Windows [Version 10.0.19045.4412]
Description
Recently, we upgraded from Jetty 9.4.x to 12.0.7. We are using Spring Boot 3.2.1. After the upgrade, we noticed warnings being logged when uploading files through Jetty. The warnings are logged by the StandardServletMultipartResolver of Spring which tries to delete all the Parts of the multipart/form-data request after it has been handled by the application.
After doing some investigation, it turns out the implementation of jakarta.servlet.http.Part#delete() in Jetty 12 throws an IOException if the file doesn't exist (see org.eclipse.jetty.http.MultiPart$Part#delete()). In Jetty 9, this wasn't the case. In that version, a File#exists() check is done before the file get deleted (see org.eclipse.jetty.util.MultiPartInputStreamParser$MultiPart#delete()).
In our situation, we already delete these files in our application code. So it's normal that the files doesn't exist any more when the StandardServletMultipartResolver of Spring tries to cleanup the uploaded files. Would it be possible to add a similar file-exist check to Jetty 12 in the org.eclipse.jetty.http.MultiPart$Part#delete() method to avoid throwing IOExceptions for files that don't exist (any more)?
The text was updated successfully, but these errors were encountered:
Jetty version(s)
Jetty 12.0.7
Jetty Environment
ee10
Java version/vendor
(use: java -version)
java version "21.0.1" 2023-10-17 LTS
Java(TM) SE Runtime Environment (build 21.0.1+12-LTS-29)
Java HotSpot(TM) 64-Bit Server VM (build 21.0.1+12-LTS-29, mixed mode, sharing)
OS type/version
Microsoft Windows [Version 10.0.19045.4412]
Description
Recently, we upgraded from Jetty 9.4.x to 12.0.7. We are using Spring Boot 3.2.1. After the upgrade, we noticed warnings being logged when uploading files through Jetty. The warnings are logged by the
StandardServletMultipartResolver
of Spring which tries to delete all the Parts of the multipart/form-data request after it has been handled by the application.After doing some investigation, it turns out the implementation of
jakarta.servlet.http.Part#delete()
in Jetty 12 throws an IOException if the file doesn't exist (seeorg.eclipse.jetty.http.MultiPart$Part#delete()
). In Jetty 9, this wasn't the case. In that version, aFile#exists()
check is done before the file get deleted (seeorg.eclipse.jetty.util.MultiPartInputStreamParser$MultiPart#delete()
).In our situation, we already delete these files in our application code. So it's normal that the files doesn't exist any more when the
StandardServletMultipartResolver
of Spring tries to cleanup the uploaded files. Would it be possible to add a similar file-exist check to Jetty 12 in theorg.eclipse.jetty.http.MultiPart$Part#delete()
method to avoid throwing IOExceptions for files that don't exist (any more)?The text was updated successfully, but these errors were encountered: