ManagedChannelImpl.SubchannelImpl args check bug (#9651)

Previously it could trigger NPE without the string saying which argument
was null.
This commit is contained in:
RapperCL 2022-11-11 08:15:13 +08:00 committed by GitHub
parent b8f142c1e7
commit 096898a46e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 1 deletions

View File

@ -1942,13 +1942,14 @@ final class ManagedChannelImpl extends ManagedChannel implements
ScheduledHandle delayedShutdownTask;
SubchannelImpl(CreateSubchannelArgs args, LbHelperImpl helper) {
checkNotNull(args, "args");
addressGroups = args.getAddresses();
if (authorityOverride != null) {
List<EquivalentAddressGroup> eagsWithoutOverrideAttr =
stripOverrideAuthorityAttributes(args.getAddresses());
args = args.toBuilder().setAddresses(eagsWithoutOverrideAttr).build();
}
this.args = checkNotNull(args, "args");
this.args = args;
this.helper = checkNotNull(helper, "helper");
subchannelLogId = InternalLogId.allocate("Subchannel", /*details=*/ authority());
subchannelTracer = new ChannelTracer(