Skip to content
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

Avoid NPE when a connect address isn't specified and newHandler is in use #474

Merged
merged 1 commit into from
Oct 24, 2018

Conversation

violetagg
Copy link
Member

@violetagg violetagg commented Oct 23, 2018

In case of HttpClient used with a specified request type and no connect address,
it will be calculated based on the url (HttpClientOptions#formatSchemeAndHost).
In case no request type is specified, but newHandler is used, the HttpClient will try
to connect to https://localhost.

java.lang.NullPointerException
	at reactor.ipc.netty.resources.DefaultPoolResources$SocketAddressHolder.hashCode(DefaultPoolResources.java:294)
	at java.util.concurrent.ConcurrentHashMap.get(ConcurrentHashMap.java:936)
	at reactor.ipc.netty.resources.DefaultPoolResources.selectOrCreate(DefaultPoolResources.java:73)
	at reactor.ipc.netty.tcp.TcpResources.selectOrCreate(TcpResources.java:157)
	at reactor.ipc.netty.tcp.TcpClient.lambda$newHandler$1(TcpClient.java:181)
	at reactor.core.publisher.MonoCreate.subscribe(MonoCreate.java:53)
	at reactor.core.publisher.Mono.block(Mono.java:1498)

… use

In case of HttpClient used with a specified request type and no connect address,
it will be calculated based on the url (HttpClientOptions#formatSchemeAndHost).
In case no request type is specified, but newHandler is used, the HttpClient will try
to connect to https://localhost.

java.lang.NullPointerException
	at reactor.ipc.netty.resources.DefaultPoolResources$SocketAddressHolder.hashCode(DefaultPoolResources.java:294)
	at java.util.concurrent.ConcurrentHashMap.get(ConcurrentHashMap.java:936)
	at reactor.ipc.netty.resources.DefaultPoolResources.selectOrCreate(DefaultPoolResources.java:73)
	at reactor.ipc.netty.tcp.TcpResources.selectOrCreate(TcpResources.java:157)
	at reactor.ipc.netty.tcp.TcpClient.lambda$newHandler$1(TcpClient.java:181)
	at reactor.core.publisher.MonoCreate.subscribe(MonoCreate.java:53)
	at reactor.core.publisher.Mono.block(Mono.java:1498)
	at reactor.ipc.netty.http.client.HttpClientTest.testConnectAddressNotSpecified(HttpClientTest.java:987)
@violetagg violetagg added this to the 0.7.11.RELEASE milestone Oct 23, 2018
@violetagg violetagg merged commit 68adf14 into 0.7.x Oct 24, 2018
@violetagg violetagg deleted the npe-connect-address branch October 24, 2018 19:18
@codecov-io
Copy link

Codecov Report

Merging #474 into 0.7.x will increase coverage by 0.15%.
The diff coverage is 50%.

Impacted file tree graph

@@            Coverage Diff             @@
##              0.7.x   #474      +/-   ##
==========================================
+ Coverage     67.84%    68%   +0.15%     
- Complexity     1074   1080       +6     
==========================================
  Files            73     73              
  Lines          4615   4622       +7     
  Branches        661    662       +1     
==========================================
+ Hits           3131   3143      +12     
+ Misses         1096   1089       -7     
- Partials        388    390       +2
Impacted Files Coverage Δ Complexity Δ
src/main/java/reactor/ipc/netty/tcp/TcpClient.java 90.56% <ø> (ø) 20 <0> (ø) ⬇️
...actor/ipc/netty/http/client/HttpClientOptions.java 86.44% <100%> (+0.47%) 24 <0> (+1) ⬆️
...java/reactor/ipc/netty/http/client/HttpClient.java 73.97% <33.33%> (-2.5%) 26 <1> (+1)
.../ipc/netty/http/server/HttpServerWSOperations.java 60% <0%> (+1.42%) 17% <0%> (+1%) ⬆️
.../ipc/netty/channel/PooledClientContextHandler.java 71.42% <0%> (+5.04%) 28% <0%> (+2%) ⬆️
...va/reactor/ipc/netty/channel/AbortedException.java 43.75% <0%> (+6.25%) 6% <0%> (+1%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f75fa46...68adf14. Read the comment docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants