Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: eliminate commons-fileupload dependency #4372

Closed
wants to merge 1 commit into from

Conversation

erikgb
Copy link
Contributor

@erikgb erikgb commented Jan 18, 2023

and replace it with multipart support added in Servlet 3.0.

GitHub issue resolved: #

Briefly describe the changes proposed in this PR:

commons-fileupload hasn't had any release since 2018, and is not really required - as Java EE added support for multipart handling in Servlet 3.0, ref. https://docs.oracle.com/javaee/7/tutorial/servlets011.htm

Removing the dependency to commons-fileupload is a pre-requirement to the javax -> jakarta migration proposed in #3559.

I did the simplest thing to remove the dependency, and IMO the affected code should be refactored more, but I am leaving this to a follow-up PR.


PR Author Checklist (see the contributor guidelines for more details):

  • my pull request is self-contained
  • I've added tests for the changes I made
  • I've applied code formatting (you can use mvn process-resources to format from the command line)
  • I've squashed my commits where necessary
  • every commit message starts with the issue number (GH-xxxx) followed by a meaningful description of the change

@@ -31,6 +32,7 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

@MultipartConfig
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suspect this annotation is not inherited, and would have to be added to all subclasses. But hoping tests and/or maintainers can verify if this works.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not familiar with this annotation. What does it do?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It adds multipart request support to the servlet. Can also be configured in web.xml. I am happy to do that instead, but I need to know which servlets need it - as this is configured per servlet. See https://docs.oracle.com/javaee/7/tutorial/servlets011.htm for additional details.

@erikgb erikgb marked this pull request as ready for review January 18, 2023 15:46
@abrokenjester
Copy link
Contributor

abrokenjester commented Jan 18, 2023

@erikgb can you can create an issue specifically for this please, and link your PR to it? We base our release notes on our issue backlog so it's kinda important that changes are represented by issues. Please have a look at the contributor guidelines for details on how to create your issues and PRs.

Copy link
Contributor

@abrokenjester abrokenjester left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me! I haven't been able to test it yet (Can you perhaps add a few test to cover this behavior? I'm aware test coverage on the workbench is currently poor), but the idea looks solid enough. And eliminating an unneeded/obsolete dependency is a good idea.

@@ -31,6 +32,7 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

@MultipartConfig
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not familiar with this annotation. What does it do?

@erikgb
Copy link
Contributor Author

erikgb commented Jan 18, 2023

Looks good to me! I haven't been able to test it yet (Can you perhaps add a few test to cover this behavior? I'm aware test coverage on the workbench is currently poor), but the idea looks solid enough. And eliminating an unneeded/obsolete dependency is a good idea.

Thanks. Apart from verifying the new multipart setup, I have tried to do a safe refactoring, so I do not expect any issues when multipart request works at all.

Sorry, I probably don't have the bandwidth to add additional tests now. According to @hmottestad there are some tests that could be enabled in CI, ref. #4370 (comment)

@erikgb
Copy link
Contributor Author

erikgb commented Jan 18, 2023

Superseeded by #4375, closing.

@erikgb erikgb closed this Jan 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants