-
Notifications
You must be signed in to change notification settings - Fork 571
Fix NPE for null in the query parameters #8
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
Conversation
| public Enumeration<String> getParameterNames() { | ||
| List<String> paramNames = new ArrayList<>(); | ||
| paramNames.addAll(request.getQueryStringParameters().keySet()); | ||
| Map<String, String> queryStringParameters = request.getQueryStringParameters(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we reduce this to:
if (request.getQueryStringParameters() != null) {
paramsNames.addAll(request.getQueryStringParameters().keySet());
}
|
|
||
| private String getQueryStringParameterCaseInsensitive(String key) { | ||
| if (request.getQueryStringParameters() == null) { | ||
| Map<String, String> queryStringParameters = request.getQueryStringParameters(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to assign here? Wouldn't this method have worked before?
sapessi
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left a couple of comments. I'd like to try and avoid assignments unless necessary.
|
Thanks for the pull request, bugs slipped through the cracks. Left just a couple of comments in the commit. |
… to comments in PR
|
@sapessi I've changed the code according to your comments. |
I've tried to use the Spring EchoApp in the real AWS Lambda and the
/echo/query-stringGET-request was failed for non-set query parameters. It happened because in this caseAwsProxyRequest.queryStringParametersremains uninitialized.