hexueyuan opened a new issue, #9462:
URL: https://github.com/apache/rocketmq/issues/9462

   ### Before Creating the Bug Report
   
   - [x] I found a bug, not just asking a question, which should be created in 
[GitHub Discussions](https://github.com/apache/rocketmq/discussions).
   
   - [x] I have searched the [GitHub 
Issues](https://github.com/apache/rocketmq/issues) and [GitHub 
Discussions](https://github.com/apache/rocketmq/discussions)  of this 
repository and believe that this is not a duplicate.
   
   - [x] 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.
   ```JAVA
   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_


-- 
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]

Reply via email to