From e58a6b2a0120124226da13464010c71b3b3af6c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E6=97=AD?= Date: Wed, 29 Jul 2020 11:49:30 +0800 Subject: [PATCH] [ISSUE #2196] code style(acl): correct spell mistake, remove redundant code (#2197) * code style(acl): correct spell mistake, remove redundant code * refine Co-authored-by: zhangxu16 --- .../org/apache/rocketmq/acl/common/Permission.java | 1 - .../rocketmq/acl/plain/PlainPermissionManager.java | 13 ++++++------- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/acl/src/main/java/org/apache/rocketmq/acl/common/Permission.java b/acl/src/main/java/org/apache/rocketmq/acl/common/Permission.java index 0acc8e95..8ceb135f 100644 --- a/acl/src/main/java/org/apache/rocketmq/acl/common/Permission.java +++ b/acl/src/main/java/org/apache/rocketmq/acl/common/Permission.java @@ -65,7 +65,6 @@ public class Permission { case "SUB": return Permission.SUB; case "PUB|SUB": - return Permission.PUB | Permission.SUB; case "SUB|PUB": return Permission.PUB | Permission.SUB; case "DENY": diff --git a/acl/src/main/java/org/apache/rocketmq/acl/plain/PlainPermissionManager.java b/acl/src/main/java/org/apache/rocketmq/acl/plain/PlainPermissionManager.java index 89638f6a..c182d7eb 100644 --- a/acl/src/main/java/org/apache/rocketmq/acl/plain/PlainPermissionManager.java +++ b/acl/src/main/java/org/apache/rocketmq/acl/plain/PlainPermissionManager.java @@ -73,7 +73,7 @@ public class PlainPermissionManager { JSONObject plainAclConfData = AclUtils.getYamlDataObject(fileHome + File.separator + fileName, JSONObject.class); if (plainAclConfData == null || plainAclConfData.isEmpty()) { - throw new AclException(String.format("%s file is not data", fileHome + File.separator + fileName)); + throw new AclException(String.format("%s file is not data", fileHome + File.separator + fileName)); } log.info("Broker plain acl conf data is : ", plainAclConfData.toString()); JSONArray globalWhiteRemoteAddressesList = plainAclConfData.getJSONArray("globalWhiteRemoteAddresses"); @@ -164,14 +164,13 @@ public class PlainPermissionManager { return false; } - private Map createAclAccessConfigMap(Map existedAccoutMap, PlainAccessConfig plainAccessConfig) { - - + private Map createAclAccessConfigMap(Map existedAccountMap, PlainAccessConfig plainAccessConfig) { + Map newAccountsMap = null; - if (existedAccoutMap == null) { + if (existedAccountMap == null) { newAccountsMap = new LinkedHashMap(); } else { - newAccountsMap = existedAccoutMap; + newAccountsMap = existedAccountMap; } if (StringUtils.isEmpty(plainAccessConfig.getAccessKey()) || @@ -278,7 +277,7 @@ public class PlainPermissionManager { JSONObject plainAclConfData = AclUtils.getYamlDataObject(fileHome + File.separator + fileName, JSONObject.class); if (plainAclConfData == null || plainAclConfData.isEmpty()) { - throw new AclException(String.format("%s file is not data", fileHome + File.separator + fileName)); + throw new AclException(String.format("%s file is not data", fileHome + File.separator + fileName)); } JSONArray globalWhiteAddrs = plainAclConfData.getJSONArray(AclConstants.CONFIG_GLOBAL_WHITE_ADDRS); if (globalWhiteAddrs != null && !globalWhiteAddrs.isEmpty()) { -- GitLab