Before Creating the Bug Report
Runtime platform environment
macOS (Darwin), reproduced with an isolated local unit test.
RocketMQ version
Branch: develop
Git commit: fd0c959
JDK Version
Zulu OpenJDK 8 (8.94.0.17)
Describe the Bug
BrokerData.selectBrokerAddr assumes brokerAddrs is non-null and non-empty. A default BrokerData instance throws NullPointerException, while an empty map reaches Random.nextInt(0) and throws IllegalArgumentException.
Steps to Reproduce
- Create a default BrokerData and call selectBrokerAddr.
- Alternatively, set brokerAddrs to an empty HashMap and call selectBrokerAddr.
- Observe the exception.
What Did You Expect to See?
The method should return null when no broker address is registered, consistent with its nullable selection result.
What Did You See Instead?
The method throws for both null and empty address tables.
Additional Context
Master preference and slave fallback remain valid; only the no-address boundary is affected.
Before Creating the Bug Report
Runtime platform environment
macOS (Darwin), reproduced with an isolated local unit test.
RocketMQ version
Branch: develop
Git commit: fd0c959
JDK Version
Zulu OpenJDK 8 (8.94.0.17)
Describe the Bug
BrokerData.selectBrokerAddr assumes brokerAddrs is non-null and non-empty. A default BrokerData instance throws NullPointerException, while an empty map reaches Random.nextInt(0) and throws IllegalArgumentException.
Steps to Reproduce
What Did You Expect to See?
The method should return null when no broker address is registered, consistent with its nullable selection result.
What Did You See Instead?
The method throws for both null and empty address tables.
Additional Context
Master preference and slave fallback remain valid; only the no-address boundary is affected.