Customizer null checks in HTTP client builders assert the wrong attribute - #51509
Merged
Conversation
kdomo
force-pushed
the
fix-http-client-assert
branch
from
August 30, 2026 05:44
ca1c303 to
755c393
Compare
AbstractClientHttpRequestFactoryBuilder.mergedCustomizers and its reactive counterpart asserted on the customizers field rather than the customizer parameter. The field is never null since the constructor defaults it to an empty list, so the assertion always passed and a null customizer was not rejected. See spring-projectsgh-51509 Signed-off-by: kdomo <dongho5088@naver.com>
snicoll
force-pushed
the
fix-http-client-assert
branch
from
August 30, 2026 18:26
755c393 to
60445a5
Compare
Member
|
Thanks. The tests should have been put on the base class for consistency. In doing so I've noticed one more place where that check isn't consistent. I have also removed the update of assertion in the two other locations that are unrelated. See 60445a5 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
AbstractClientHttpRequestFactoryBuilder.mergedCustomizers(Consumer<T>)and its reactive counterpart assert on thecustomizersfield instead of thecustomizerparameter:The field can never be null because the constructor defaults it to an empty list, so the assertion always passes and a null
customizeris not rejected. Callers get an NPE fromList.of(customizer)on the next line rather than the intendedIllegalArgumentException. ThemergedCustomizers(Collection<Consumer<T>>)overload just below does check its parameter.This affects
withCustomizer(...)on all builders that extend these two base classes.The same commit also corrects two
Assertmessages that name a parameter which doesn't exist on the method:ClientHttpConnectorBuilder.of(Class<T> clientHttpConnectorType)reports'requestFactoryType', which looks like a leftover fromClientHttpRequestFactoryBuilder.of. TheAssert.isTrueon the following line already uses the correct name.HttpComponentsClientHttpConnectorBuilder.withHttpClientCustomizer(Consumer<HttpAsyncClientBuilder> httpClientCustomizer)reports'customizer', whilewithConnectionManagerCustomizerandwithConnectionConfigCustomizerin the same class both use their parameter names.I've added tests for the null checks. There's no test class for the
ClientHttpConnectorBuilderinterface, so theofmessage change isn't covered — happy to add one if you'd prefer.