PansonPanson opened a new issue, #4513:
URL: https://github.com/apache/rocketmq/issues/4513
it seems to not be elegant for overirding `equals` in class
`org.apache.rocketmq.common.protocol.route.BrokerData::equals`
```java
/**
* origin
*/
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
BrokerData other = (BrokerData) obj;
if (brokerAddrs == null) {
if (other.brokerAddrs != null)
return false;
} else if (!brokerAddrs.equals(other.brokerAddrs))
return false;
// modified
if (brokerName == null) {
if (other.brokerName != null)
return false;
} else if (!brokerName.equals(other.brokerName))
return false;
return true;
}
```
```java
/**
* use org.apache.commons.lang3.StringUtils
*/
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
BrokerData other = (BrokerData) obj;
if (brokerAddrs == null) {
if (other.brokerAddrs != null)
return false;
} else if (!brokerAddrs.equals(other.brokerAddrs))
return false;
return StringUtils.equals(brokerName, other.brokerName);
}
```
--
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]