fix: Handle null server address by blakeli0 · Pull Request #4165 · googleapis/sdk-platform-java · GitHub
Skip to content
This repository was archived by the owner on May 14, 2026. It is now read-only.

fix: Handle null server address#4165

Closed
blakeli0 wants to merge 3 commits into
mainfrom
fix-null-serveraddress
Closed

fix: Handle null server address#4165
blakeli0 wants to merge 3 commits into
mainfrom
fix-null-serveraddress

Conversation

@blakeli0

@blakeli0 blakeli0 commented Mar 23, 2026

Copy link
Copy Markdown
Contributor

In case of an invalid endpoint such as localhost:-1, the current parsing logic returns null for server address. This PR made server address nullable. And added a null check for the port parsing.

In addition, added a try catch for the whole parsing logic because serviceAddress and serverPort should only be used for obersevability and should not affect regular requests.

@product-auto-label product-auto-label Bot added the size: s Pull request size is small. label Mar 23, 2026
@gemini-code-assist

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request addresses an issue where a null server address could cause problems by adding exception handling around server address and port parsing. The changes are logical and include a new test case to cover the fix. My feedback focuses on refining the exception handling to be more specific, which improves the robustness of the code by not suppressing critical system errors.

Comment thread gax-java/gax/src/main/java/com/google/api/gax/rpc/EndpointContext.java Outdated
@blakeli0 blakeli0 requested a review from diegomarquezp March 23, 2026 19:33
@sonarqubecloud

Copy link
Copy Markdown

@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed for 'java_showcase_integration_tests'

Failed conditions
57.1% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube Cloud

@blakeli0

Copy link
Copy Markdown
Contributor Author

@blakeli0 blakeli0 closed this Mar 24, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

size: s Pull request size is small.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant