WW-5573 Multipart stream file cleanup#1445
Conversation
There was a problem hiding this comment.
Pull request overview
This PR improves the robustness of multipart file upload cleanup in Apache Struts by adding exception handling to ensure cleanup operations continue even when individual file deletions fail.
Key changes:
- Added try-catch blocks around file cleanup operations to prevent individual failures from stopping the cleanup of other files
- Refactored file item tracking in JakartaMultiPartRequest to add all items upfront, ensuring cleanup even if processing throws an exception
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| JakartaStreamMultiPartRequest.java | Added try-catch exception handling in cleanUp() method to ensure all files are attempted for deletion even if individual deletions fail |
| JakartaMultiPartRequest.java | Changed file item tracking to use addAll() before the processing loop, ensuring all parsed items are tracked for cleanup even if processing throws an exception mid-loop |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Is this PR related to the latest CVE? |
I noticed that the cleanup commit for WW-5573 handled exceptions in both the stream and non-stream multipart upload cleanup methods. The later commit added a try/catch block, but only for the non-stream path, so I updated the code to make the behavior consistent. For the other change, I noticed when running tests on older branches that a |
d9d3c8c to
51bb1e1
Compare
|
Thanks @ryanmurf, I created a new branch and rebased your PR |
Refs WW-5573