Description
Before Creating the Bug Report
-
I found a bug, not just asking a question, which should be created in GitHub Discussions.
-
I have searched the GitHub Issues and GitHub Discussions of this repository and believe that this is not a duplicate.
-
I have confirmed that this bug belongs to the current repository, not other repositories of RocketMQ.
Runtime platform environment
RocketMQ version
branch: devlop
version: 5.3.3
JDK Version
Describe the Bug
As shown below, in the comparePolicyEntries method in AclAuthorizationHandler, the logic in the third if branch should be that r1 returns 1 and r2 returns -1. It seems that r1 is written instead all. This may cause sorting errors in some cases, but I'm not sure, but it looks like something that needs to be fixed.
private int comparePolicyEntries(PolicyEntry o1, PolicyEntry o2) {
// ......
} else {
if (r1.getResourcePattern() == ResourcePattern.LITERAL) {
compare = 1;
}
if (r1.getResourcePattern() == ResourcePattern.LITERAL) {
compare = -1;
}
if (r1.getResourcePattern() == ResourcePattern.PREFIXED) {
compare = 1;
}
if (r1.getResourcePattern() == ResourcePattern.PREFIXED) {
compare = -1;
}
}
// ......
}
Steps to Reproduce
What Did You Expect to See?
The r1 branch returns 1, and the r2 branch returns -1.
What Did You See Instead?
The logic of r2 is mistakenly written as r1 in the code.
Additional Context
No response