Skip to content

Conversation

@bohhyang
Copy link
Contributor

@bohhyang bohhyang commented Oct 2, 2025

As the title, add null guards for critical params. Also add a setter to disable detecting raw d2 client, so test apps like indis-canary can use it to disable the detection as needed.

Test Done

N/A


public D2ClientBuilder setXdsServer(String xdsServer)
{
checkNotNull(xdsServer, "xdsServer");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't need this right ? See my other comment we could directly to throw Exception there.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is called earlier than when createChannel is called. This can throw as soon as anyone is setting null, instead of wait until XdsChannelFactory actually try to use the null.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IIRC, without the nullable annotation, the parameter should already be treated as non-null.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For coding wise, yes, but it won't prevent any user from actually calling it with a null. That's what happened to some espresso-pub users. So we need this explicit null check and throw.

@bohhyang bohhyang merged commit 7048e8e into master Oct 3, 2025
2 checks passed
@bohhyang bohhyang deleted the by/nullGuards branch October 3, 2025 19:19
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.

3 participants