-
Notifications
You must be signed in to change notification settings - Fork 6.2k
Fixed NPE for unknown request in FilterChainProxy #18166
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
base: main
Are you sure you want to change the base?
Fixed NPE for unknown request in FilterChainProxy #18166
Conversation
539fa3e to
c8bd4d4
Compare
| String requestMethod = request.getMethod(); | ||
| return requestMethod != null && this.method.name().equals(requestMethod); |
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.
We don’t need to check for null because this.method.name() will return a String type and String#equals(null) will return false, so the test passes without any changes.
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.
but this fixes the NPE case - ig that is our expectation of getting false for invalid
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.
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.
oh got it - thanks for the explanation
|
Thank you for your submission @ronodhirSoumik As pointed out, the test will pass without changes to the code. Additionally, the issue you are linking to is caused by ConcurrentHashMap not supporting a null key (which is of type ServletContext) and is unrelated to the method being null. I think that the test would still provide value by ensuring that we do not get a NullPointerException later. If you would modify the PR to just have the test and update the PR subject, I can merge it. |
c8bd4d4 to
e292d4c
Compare
Signed-off-by: Soumik Sarker <[email protected]>
d8a7001 to
d3e138c
Compare

Fixes #18157