NullPointerException fix in http/2 codec
Motivation: There is a NPE due to the order of builder initialization in the class. Modifications: -Correct the ordering of initialization and building to avoid NPE. Result: No more NPE in construction.
This commit is contained in:
parent
034699268c
commit
ce817e0d30
@ -85,17 +85,16 @@ public class Http2ConnectionHandler extends ByteToMessageDecoder implements Http
|
|||||||
checkNotNull(encoderBuilder, "encoderBuilder");
|
checkNotNull(encoderBuilder, "encoderBuilder");
|
||||||
|
|
||||||
// Build the encoder.
|
// Build the encoder.
|
||||||
decoderBuilder.lifecycleManager(this);
|
encoderBuilder.lifecycleManager(this);
|
||||||
encoder = checkNotNull(encoderBuilder.build(), "encoder");
|
encoder = checkNotNull(encoderBuilder.build(), "encoder");
|
||||||
|
|
||||||
// Build the decoder.
|
// Build the decoder.
|
||||||
decoderBuilder.encoder(encoder);
|
decoderBuilder.encoder(encoder);
|
||||||
encoderBuilder.lifecycleManager(this);
|
decoderBuilder.lifecycleManager(this);
|
||||||
decoder = checkNotNull(decoderBuilder.build(), "decoder");
|
decoder = checkNotNull(decoderBuilder.build(), "decoder");
|
||||||
|
|
||||||
// Verify that the encoder and decoder use the same connection.
|
// Verify that the encoder and decoder use the same connection.
|
||||||
checkNotNull(encoder.connection(), "encoder.connection");
|
checkNotNull(encoder.connection(), "encoder.connection");
|
||||||
checkNotNull(decoder.connection(), "decoder.connection");
|
|
||||||
if (encoder.connection() != decoder.connection()) {
|
if (encoder.connection() != decoder.connection()) {
|
||||||
throw new IllegalArgumentException("Encoder and Decoder do not share the same connection object");
|
throw new IllegalArgumentException("Encoder and Decoder do not share the same connection object");
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user