-
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
Removing a key from HttpHeaders' key set leaves it in an inconsistent state #23633
Comments
Interestingly, the provided test case passes on We'll look into it! |
I have confirmed that the following test fails when added to @Test
public void removeFromKeySet() {
headers.add("Alpha", "apple");
headers.add("Bravo", "banana");
assertEquals(2, headers.size());
headers.keySet().remove("Alpha");
assertEquals(1, headers.size());
assertEquals(Collections.singletonMap("Bravo", Arrays.asList("banana")).entrySet(), headers.entrySet());
// Fails!
assertFalse("Alpha should have been removed", headers.containsKey("Alpha"));
} |
It turns out that the underlying cause is a bug in the anonymous inner |
My local fix works, but it turns out that @philwebb already addressed this issue plus additional related issues in #22821. I am therefore closing this as a duplicate of #22821. Rationale provided by @jhoeller in #22821 (comment). |
I think it's worth noting that this is a regression. The supplied test works in 5.1.0 but fails with 5.1.1 and later. |
That's a very valid point. I'll raise that with the team. |
Affects: 5.1.10 snapshots
The problem is illustrated by the following test:
The first assertion passes but the second fails:
The text was updated successfully, but these errors were encountered: