You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rocketmq.apache.org by hu...@apache.org on 2019/03/20 03:14:00 UTC
[rocketmq] branch develop updated: [ISSUE #1086] Fix
NullPointerException in PlainPermissionLoader if permissions are not
configured(with admin user)
This is an automated email from the ASF dual-hosted git repository.
huzongtang pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/rocketmq.git
The following commit(s) were added to refs/heads/develop by this push:
new 7b1ef8f [ISSUE #1086] Fix NullPointerException in PlainPermissionLoader if permissions are not configured(with admin user)
7b1ef8f is described below
commit 7b1ef8f33a7381056c04667aacb0445f2f0dd009
Author: Scruel Tao <sc...@gmail.com>
AuthorDate: Wed Mar 20 11:13:55 2019 +0800
[ISSUE #1086] Fix NullPointerException in PlainPermissionLoader if permissions are not configured(with admin user)
---
.../java/org/apache/rocketmq/acl/plain/PlainPermissionLoader.java | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/acl/src/main/java/org/apache/rocketmq/acl/plain/PlainPermissionLoader.java b/acl/src/main/java/org/apache/rocketmq/acl/plain/PlainPermissionLoader.java
index 9148422..e97825d 100644
--- a/acl/src/main/java/org/apache/rocketmq/acl/plain/PlainPermissionLoader.java
+++ b/acl/src/main/java/org/apache/rocketmq/acl/plain/PlainPermissionLoader.java
@@ -123,12 +123,17 @@ public class PlainPermissionLoader {
return;
}
+ if (ownedPermMap == null && ownedAccess.isAdmin()) {
+ // If the ownedPermMap is null and it is an admin user, then return
+ return;
+ }
+
for (Map.Entry<String, Byte> needCheckedEntry : needCheckedPermMap.entrySet()) {
String resource = needCheckedEntry.getKey();
Byte neededPerm = needCheckedEntry.getValue();
boolean isGroup = PlainAccessResource.isRetryTopic(resource);
- if (!ownedPermMap.containsKey(resource)) {
+ if (ownedPermMap == null || !ownedPermMap.containsKey(resource)) {
// Check the default perm
byte ownedPerm = isGroup ? ownedAccess.getDefaultGroupPerm() :
ownedAccess.getDefaultTopicPerm();