msingermann commented on a change in pull request #3408:
URL: https://github.com/apache/activemq-artemis/pull/3408#discussion_r559499105
##########
File path:
artemis-server/src/main/java/org/apache/activemq/artemis/core/settings/impl/HierarchicalObjectRepository.java
##########
@@ -484,17 +482,10 @@ public int compare(final String o1, final String o2) {
} else if (!o1.contains(singleWord) && o2.contains(singleWord)) {
return -1;
} else if (o1.contains(singleWord) && o2.contains(singleWord)) {
- String[] leftSplits = o1.split(quotedDelimiter);
- String[] rightSplits = o2.split(quotedDelimiter);
- for (int i = 0; i < leftSplits.length; i++) {
- String left = leftSplits[i];
- if (left.equals(singleWord)) {
- if (rightSplits.length < i ||
!rightSplits[i].equals(singleWord)) {
- return -1;
- } else {
- return +1;
- }
- }
+ int o1Count = StringUtils.countMatches(o1, singleWord);
+ int o2Count = StringUtils.countMatches(o2, singleWord);
+ if (o1Count != o2Count) {
+ return o1Count - o2Count;
Review comment:
Didn't know that it should behave that way. Let me change the code as it
doesn't take it into account. (neither the tests)
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]