LI123456mo opened a new pull request, #15936: URL: https://github.com/apache/dubbo/pull/15936
## What is the purpose of the change? This PR addresses issue #15935 by: 1. Adding a new public `isValidV4Address(String address)` method to `NetUtils` to allow direct string-based IP validation. 2. Improving the `IP_PATTERN` regex to strictly validate IPv4 segments (ensuring values are between 0-255). 3. Adding comprehensive unit tests in `NetUtilsTest` to cover edge cases (null, empty strings, out-of-range numbers, and invalid formats). ## Brief changelog - Modified `NetUtils.java`: Updated `IP_PATTERN` and added `isValidV4Address(String)`. - Modified `NetUtilsTest.java`: Added `testIsValidV4Address_String()` with multiple edge-case assertions. ## Verifying this change Validated by running: `mvn test -Dtest=NetUtilsTest -pl dubbo-common` All tests passed locally. Fixes #15935 -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
