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

Duplicate values in the AwsProxyHttpServletRequest.getParameterMap() #86

Closed
avinashbitra opened this issue Dec 30, 2017 · 7 comments
Closed
Assignees
Labels
Milestone

Comments

@avinashbitra
Copy link

avinashbitra commented Dec 30, 2017

screen shot 2017-12-30 at 12 42 12 pm

File: AwsProxyHttpServletRequest

@OverRide
public Map<String, String[]> getParameterMap() {
Map<String, String[]> output = new HashMap<>();
Map<String, List> params = urlEncodedFormParameters
.....
if (params.containsKey(entry.getKey())) {
params.get(entry.getKey()).add(entry.getValue());
}
.....

urlEncodedFormParameters are initialized in the constructor and getParameterMap whenever invoked keeps adding to the same Map which ends up in having duplicate values.

Map<String, List> params = this.getFormUrlEncodedParametersMap();
should reset the params map.

@avinashbitra avinashbitra changed the title Getting duplicate value in the AwsProxyHttpServletRequest.getParameterMap() Getting duplicate values in the AwsProxyHttpServletRequest.getParameterMap() Dec 30, 2017
@avinashbitra avinashbitra changed the title Getting duplicate values in the AwsProxyHttpServletRequest.getParameterMap() Duplicate values in the AwsProxyHttpServletRequest.getParameterMap() Dec 30, 2017
@sapessi
Copy link
Collaborator

sapessi commented Jan 2, 2018

Hey @avinashbitra, can you share what the original request you sent looks like?

@avinashbitra
Copy link
Author

avinashbitra commented Jan 3, 2018

@sapessi
Its a http GET request with query parameters for spring rest repositories
http://hostname/repo/search/findByParam?&param=value

@avinashbitra
Copy link
Author

avinashbitra commented Jan 3, 2018

@sapessi issue here is inside the spring framework while using spring rest repositories and making a http get request with query parameters, framework is trying to map the request parameters to method parameters.

While framework is trying to map the parameters, it makes multiple request.getParameterMap() invocations and because of the above code we are seeing duplicate values for a parameter and ends up with wrong parameter value passed to the method.

@avinashbitra
Copy link
Author

@sapessi Is there any update on this.

@sapessi
Copy link
Collaborator

sapessi commented Jan 7, 2018

Hey @avinashbitra, I'll try to get this fixed for the next release of the framework. I'm at home on Paternity leave for the next 2 weeks.

@sapessi sapessi self-assigned this Jan 7, 2018
@sapessi sapessi added the bug label Jan 7, 2018
@sapessi sapessi added this to the Release 0.9 milestone Jan 7, 2018
@avinashbitra
Copy link
Author

Thanks @sapessi

@sapessi
Copy link
Collaborator

sapessi commented Jan 11, 2018

The latest commit addresses this issue. I'm closing this for the time being.

@sapessi sapessi closed this as completed Jan 11, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants