brusdev commented on a change in pull request #3408:
URL: https://github.com/apache/activemq-artemis/pull/3408#discussion_r558117860
##########
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:
The MatchComparator should take into account the position of the
`singleWord` wild card too, ie `foo.*.too.*` is more specific than `*.too` in a
hierarchical sense.
----------------------------------------------------------------
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]