Skip to content

Avoid NumberFormatException when port is null#18708

Merged
trask merged 1 commit into
open-telemetry:mainfrom
laurit:jdbc-numberformat
May 12, 2026
Merged

Avoid NumberFormatException when port is null#18708
trask merged 1 commit into
open-telemetry:mainfrom
laurit:jdbc-numberformat

Conversation

@laurit

@laurit laurit commented May 12, 2026

Copy link
Copy Markdown
Contributor

The exceptions is caught. Noticed it being logged while running vertx-rx-java-3.5 tests.

Copilot AI review requested due to automatic review settings May 12, 2026 14:07
@laurit
laurit requested a review from a team as a code owner May 12, 2026 14:07

Copilot AI 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.

Pull request overview

This PR adjusts JDBC URL port parsing to avoid triggering (and logging) a NumberFormatException when the extracted port string is null, which was observed during vertx-rx-java-3.5 test runs.

Changes:

  • Make UrlParsingUtils.parsePort accept nullable input and return null early when the input is null.
  • Annotate parsePort’s parameter and return value with @Nullable to reflect the behavior.

Comment on lines 95 to +99
* @param value the string value to parse
* @return the parsed integer, or null if parsing fails
*/
public static Integer parsePort(String value) {
@Nullable
public static Integer parsePort(@Nullable String value) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

internal, javadoc is good enough

Comment on lines +98 to +102
@Nullable
public static Integer parsePort(@Nullable String value) {
if (value == null) {
return null;
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

no thanks

@trask
trask enabled auto-merge (squash) May 12, 2026 14:32
@trask
trask merged commit 95d968d into open-telemetry:main May 12, 2026
185 of 188 checks passed
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