Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ISSUE#6595] fix NPE and repeat access key log #6596

Merged
merged 2 commits into from May 26, 2023

Conversation

miles-ton
Copy link
Contributor

Make sure set the target branch to develop

What is the purpose of the change

fix #6595

Brief changelog

XX

Verifying this change

XXXX

Follow this checklist to help us incorporate your contribution quickly and easily. Notice, it would be helpful if you could finish the following 5 checklist(the last one is not necessary)before request the community to review your PR.

  • Make sure there is a Github issue filed for the change (usually before you start working on it). Trivial changes like typos do not require a Github issue. Your pull request should address just this issue, without pulling in other changes - one PR resolves one issue.
  • Format the pull request title like [ISSUE #123] Fix UnknownException when host config not exist. Each commit in the pull request should have a meaningful subject line and body.
  • Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
  • Write necessary unit-test(over 80% coverage) to verify your logic correction, more mock a little better when cross module dependency exist. If the new feature or significant change is committed, please remember to add integration-test in test module.
  • Run mvn -B clean apache-rat:check findbugs:findbugs checkstyle:checkstyle to make sure basic checks pass. Run mvn clean install -DskipITs to make sure unit-test pass. Run mvn clean test-compile failsafe:integration-test to make sure integration-test pass.
  • If this contribution is large, please file an Apache Individual Contributor License Agreement.

@codecov-commenter
Copy link

Codecov Report

Merging #6596 (601d7de) into develop (3fe81bf) will increase coverage by 0.03%.
The diff coverage is 75.00%.

@@              Coverage Diff              @@
##             develop    #6596      +/-   ##
=============================================
+ Coverage      43.10%   43.13%   +0.03%     
+ Complexity      8996     8992       -4     
=============================================
  Files           1107     1107              
  Lines          78287    78289       +2     
  Branches       10202    10203       +1     
=============================================
+ Hits           33745    33771      +26     
+ Misses         40314    40291      -23     
+ Partials        4228     4227       -1     
Impacted Files Coverage Δ
...che/rocketmq/acl/plain/PlainPermissionManager.java 78.16% <75.00%> (+0.66%) ⬆️

... and 25 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

caigy
caigy previously requested changes Apr 17, 2023
Comment on lines 618 to 619
if (aclPlainAccessResourceMap.get(aclFileName) == null ||
aclPlainAccessResourceMap.get(aclFileName).get(plainAccessResource.getAccessKey()) == null) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You'd better extract aclPlainAccessResourceMap.get(aclFileName) as a variable so that the code would be more clear.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for your suggestion, i will adjust it

PlainAccessResource ownedAccess = aclPlainAccessResourceMap.get(aclFileName).get(plainAccessResource.getAccessKey());
if (null == ownedAccess) {
if (aclPlainAccessResourceMap.get(aclFileName) == null ||
aclPlainAccessResourceMap.get(aclFileName).get(plainAccessResource.getAccessKey()) == null) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can try getOrDefault() to reduce one time's get from map

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for your suggestion, i will adjust it

Copy link
Contributor

@drpmma drpmma left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@miles-ton miles-ton requested a review from caigy April 24, 2023 10:38
@zhouxinyu zhouxinyu dismissed caigy’s stale review April 26, 2023 03:59

The request is stale, and we already have enough approves.

@RongtongJin RongtongJin merged commit 330d56b into apache:develop May 26, 2023
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

PlainPermissionManager.validate may cause NPE
9 participants