Skip to content

Fix IPv4 address port parsing in NetUtils#16309

Open
yin-bo-Final wants to merge 2 commits into
apache:3.3from
yin-bo-Final:fix-netutils-ipv4-address-port
Open

Fix IPv4 address port parsing in NetUtils#16309
yin-bo-Final wants to merge 2 commits into
apache:3.3from
yin-bo-Final:fix-netutils-ipv4-address-port

Conversation

@yin-bo-Final
Copy link
Copy Markdown

Fixes #16308

What is the purpose of the change?

This PR fixes NetUtils.matchIpExpression(String, String) so it can correctly parse normal IPv4 host:port addresses, such as 192.168.1.63:90.

Previously, the method only split the address when it ended with :, so a normal IPv4 address with port was treated as the full host string and could fail with UnknownHostException.

The fix parses the address only when it contains exactly one colon, avoiding impact on IPv6 addresses.

Checklist

  • Make sure there is a GitHub_issue field for the change.
  • Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
  • Write necessary unit-test to verify your logic correction. If the new feature or significant change is committed, please remember to add sample in dubbo samples project.
  • Make sure gitHub actions can pass. Why the workflow is failing and how to fix it?

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Jun 3, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 60.79%. Comparing base (ee9c190) to head (982f398).

Additional details and impacted files
@@             Coverage Diff              @@
##                3.3   #16309      +/-   ##
============================================
+ Coverage     60.77%   60.79%   +0.01%     
+ Complexity    11768       15   -11753     
============================================
  Files          1953     1953              
  Lines         89196    89196              
  Branches      13457    13458       +1     
============================================
+ Hits          54212    54223      +11     
+ Misses        29418    29405      -13     
- Partials       5566     5568       +2     
Flag Coverage Δ
integration-tests-java21 32.11% <0.00%> (-0.01%) ⬇️
integration-tests-java8 32.24% <0.00%> (-0.01%) ⬇️
samples-tests-java21 32.13% <0.00%> (-0.06%) ⬇️
samples-tests-java8 29.83% <0.00%> (-0.03%) ⬇️
unit-tests-java11 59.01% <100.00%> (-0.03%) ⬇️
unit-tests-java17 58.51% <100.00%> (ø)
unit-tests-java21 58.53% <100.00%> (+0.04%) ⬆️
unit-tests-java25 58.44% <100.00%> (+0.03%) ⬆️
unit-tests-java8 59.04% <100.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@yin-bo-Final yin-bo-Final force-pushed the fix-netutils-ipv4-address-port branch from 13b5b3e to 71a360b Compare June 3, 2026 10:48
@yin-bo-Final yin-bo-Final force-pushed the fix-netutils-ipv4-address-port branch from 71a360b to b63b256 Compare June 3, 2026 10:50
@yin-bo-Final
Copy link
Copy Markdown
Author

The failed Samples Test seems caused by Docker Hub timeout while pulling eclipse-temurin:21-jdk and mysql:5.7.40.

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.

[Bug] NetUtils.matchIpExpression(String, String) fails to parse normal IPv4 address with port

2 participants