-
Notifications
You must be signed in to change notification settings - Fork 38.1k
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
LinkedCaseInsensitiveMap does not track removals via keySet, entrySet, or values #22821
Comments
Thanks. This looks like a bug in @Override
@Nullable
public V computeIfAbsent(String key, Function<? super String, ? extends V> mappingFunction) {
String oldKey = this.caseInsensitiveKeys.putIfAbsent(convertKey(key), key);
if (oldKey != null) {
return this.targetMap.get(oldKey);
}
return this.targetMap.computeIfAbsent(key, mappingFunction);
} The |
@philwebb should this be a |
@Deadpool1111 @rhamedy Thanks for the offer of help. Anyone is free to contribute to Spring as long as they are happy to sign a CLA. Submissions are usually handled via pull-requests which are reviewed by a member of the team. For this specific issue, I think we should wait until someone from the Framework team has reviewed it. It looks like the fix might be quite involved as we'll probably need to return specialized types from |
FYI: I introduced failing tests that reproduce this bug in e187a42. |
|
Ensure that results returned from keySet, entrySet & values are tracked to remove case insensitive keys from the source map. Closes spring-projectsgh-22821
@philwebb This looks good to me; please simply merge it to master right away! Since the changes are quite involved (and the use cases rather limited), I'd rather keep this as 5.2 only. As for the example above, why not simply call |
Can we please consider backporting this, or at least the parts of it that are necessary to fix #23633, to 5.1? As things stand Spring REST Docs' support for removing headers from a request or response before they're documented does not work with Framework 5.1.x. |
This updates REST Docs to test against Framework's latest 5.1 snapshot. Due to a bug in the behaviour of HttpHeaders' key set [1], HeaderRemovingOperationPreprocessor has been updated to no longer use it when removing headers from a request or response prior to it being documented. [1] spring-projects/spring-framework#22821
Nevermind. I've worked around it in a way that works with 5.0, 5.1, and (hopefully) 5.2. |
Ensure that results returned from keySet, entrySet & values are tracked to remove case insensitive keys from the source map. Closes gh-22821
I'm learning spring boot (using Spring-boot 2.1.3) while playing with REST API calls i found something interesting with
HttpHeaders
objectSuppose if i have an HttpHeaders object with some values
But now if i try to delete and add them again it throws
NullPointerException
Error:
The text was updated successfully, but these errors were encountered: