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

   ### Motivation
   
   `parseInstanceIdFromEndpoint` used the result of `endpoint.indexOf('.')` 
directly as the substring end index:
   
   ```java
   return endpoint.substring(0, endpoint.indexOf('.'));
   ```
   
   so any non-empty endpoint without a dot (for example 
`MQ_INST_123456789_BXXUzaee:80`) produced `-1` and threw 
`StringIndexOutOfBoundsException` from a public utility.
   
   ### Modifications
   
   Treat a missing dot as a non-instance endpoint and return null.
   
   ### Verification
   
   Fail-before (new test, run against the unpatched code):
   
   ```
   Tests run: 4, Failures: 0, Errors: 1, Skipped: 1 -- 
NameServerAddressUtilsTest#testParseInstanceIdFromEndpointWithoutDot
   java.lang.StringIndexOutOfBoundsException: begin 0, end -1, length 29
   ```
   
   Pass-after:
   
   ```
   Tests run: 4, Failures: 0, Errors: 0, Skipped: 1 -- 
NameServerAddressUtilsTest
   ```
   


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