Github user franz1981 commented on a diff in the pull request:
https://github.com/apache/activemq-artemis/pull/1757#discussion_r160247350
--- Diff:
artemis-commons/src/main/java/org/apache/activemq/artemis/api/core/SimpleString.java
---
@@ -259,22 +281,23 @@ public boolean equals(final Object other) {
if (other instanceof SimpleString) {
SimpleString s = (SimpleString) other;
- if (data.length != s.data.length) {
- return false;
- }
-
- for (int i = 0; i < data.length; i++) {
- if (data[i] != s.data[i]) {
- return false;
- }
- }
-
- return true;
+ return ByteUtil.equals(data, s.data);
--- End diff --
I've implemented it in the last commit as:
```
@Override
public boolean equals(final Object other) {
if (this == other) {
return true;
}
if (other instanceof SimpleString) {
SimpleString s = (SimpleString) other;
if (s.hash != 0 && this.hash != 0) {
if (s.hash != this.hash)
return false;
}
if (s.str != null && this.str != null) {
return this.str.equals(s.str);
} else {
return ByteUtil.equals(this.data, s.data);
}
} else {
return false;
}
}
```
---