[BLOSSOM-18] Multipart support doesn't work with Spring 3 Created: 03/Oct/10  Updated: 06/Dec/14  Resolved: 07/Oct/10

Status: Closed
Project: Blossom
Component/s: None
Affects Version/s: 1.1.1
Fix Version/s: 1.2

Type: Bug Priority: Major
Reporter: Danilo Ghirardelli Assignee: Tobias Mattsson
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: Text File reflectionPatch.patch    
Template:
Patch included:
Yes
Acceptance criteria:
Empty
Task DoD:
[ ]* Doc/release notes changes? Comment present?
[ ]* Downstream builds green?
[ ]* Solution information and context easily available?
[ ]* Tests
[ ]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Bug DoR:
[ ]* Steps to reproduce, expected, and actual results filled
[ ]* Affected version filled
Date of First Response:

 Description   

BlossomMultipartRequestWrapper estends AbstractMultipartHttpServletRequest. In Spring 2.5.x, AbstractMultipartHttpServletRequest.setMultipartFiles has a parameter of type Map, but in Sping 3.0.x the parameter has been narrowed to type MultiValueMap, which is an extension of Map included in spring-core 3 (and unfortunately not included in spring 2.5).
Current BlossomMultipartRequestWrapper is passing a Map to the setMultipartFiles, and using Spring 3 this will cause an exception.

Before writing a reflection nightmare to populate the right parameter, is there any other way to get around this? Maybe two different BlossomMultipartRequestWrapper compiled for specific spring versions?
I honestly can't see a simple solution to overcome the problem, even upgrading the dependency to spring version would make it incompatible with older spring, unless MultiValueMap is copied and included in blossom release (which doesn't seem a good idea).



 Comments   
Comment by Tobias Mattsson [ 04/Oct/10 ]

Appears to have been introduced with SPR-2784 https://jira.springframework.org/browse/SPR-2784.

Comment by Danilo Ghirardelli [ 04/Oct/10 ]

Attached patch with invocation by reflection depending on spring version.

Comment by Tobias Mattsson [ 07/Oct/10 ]

Added CompatibleAbstractMultipartHttpServletRequest.java that uses reflection to use either available API.

Comment by Jan Haderka [ 06/Dec/14 ]

Bulk close of old resolved issues.

Generated at Sun Feb 11 23:29:18 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.