AliasJeff opened a new pull request, #10694:
URL: https://github.com/apache/rocketmq/pull/10694

   ### Which Issue(s) This PR Fixes
   
   Related to [#9987](https://github.com/apache/rocketmq/issues/9987)
   
   ### Brief Description
   
   `NetworkUtil.string2SocketAddress` currently parses socket addresses by 
using `lastIndexOf(":")`.
   
   This works fine for normal `host:port` addresses, but it doesn't handle 
bracketed IPv6 addresses correctly. For example, with `[2001:db8::1]:9876`, the 
brackets may remain in the host part after parsing.
   
   This PR adds handling for the standard `[IPv6]:port` format before using the 
existing parser logic.
   
   For IPv6 addresses with a scope id, the scope part is removed before 
creating `InetSocketAddress`. Also, `socketAddress2String` is updated to always 
output IPv6 addresses in `[IPv6]:port` format.
   
   The issue was reported as fixed after upgrading to 5.3.1, but this change 
focuses on fixing the remaining parsing problem in `NetworkUtil` and does not 
change the existing IPv4 or hostname behavior.
   
   ### How Did You Test This Change?
   
   ```bash
   mvn -pl common -Dtest=NetworkUtilTest test
   ```
   
   Result:
   BUILD SUCCESS
   Tests run: 6, Failures: 0, Errors: 0, Skipped: 0
   
   I also verified the regression case by temporarily reverting the parser 
implementation to the old version while keeping the new test. The test 
testString2SocketAddressWithBracketedIPv6Scope fails because the parsed address 
becomes null.


-- 
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]

Reply via email to