未验证 提交 e58a6b2a 编写于 作者: 张旭 提交者: GitHub

[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: Nzhangxu16 <zhangxu16@xiaomi.com>
上级 ea7acf4a
...@@ -65,7 +65,6 @@ public class Permission { ...@@ -65,7 +65,6 @@ public class Permission {
case "SUB": case "SUB":
return Permission.SUB; return Permission.SUB;
case "PUB|SUB": case "PUB|SUB":
return Permission.PUB | Permission.SUB;
case "SUB|PUB": case "SUB|PUB":
return Permission.PUB | Permission.SUB; return Permission.PUB | Permission.SUB;
case "DENY": case "DENY":
......
...@@ -73,7 +73,7 @@ public class PlainPermissionManager { ...@@ -73,7 +73,7 @@ public class PlainPermissionManager {
JSONObject plainAclConfData = AclUtils.getYamlDataObject(fileHome + File.separator + fileName, JSONObject plainAclConfData = AclUtils.getYamlDataObject(fileHome + File.separator + fileName,
JSONObject.class); JSONObject.class);
if (plainAclConfData == null || plainAclConfData.isEmpty()) { 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()); log.info("Broker plain acl conf data is : ", plainAclConfData.toString());
JSONArray globalWhiteRemoteAddressesList = plainAclConfData.getJSONArray("globalWhiteRemoteAddresses"); JSONArray globalWhiteRemoteAddressesList = plainAclConfData.getJSONArray("globalWhiteRemoteAddresses");
...@@ -164,14 +164,13 @@ public class PlainPermissionManager { ...@@ -164,14 +164,13 @@ public class PlainPermissionManager {
return false; return false;
} }
private Map<String, Object> createAclAccessConfigMap(Map<String, Object> existedAccoutMap, PlainAccessConfig plainAccessConfig) { private Map<String, Object> createAclAccessConfigMap(Map<String, Object> existedAccountMap, PlainAccessConfig plainAccessConfig) {
Map<String, Object> newAccountsMap = null; Map<String, Object> newAccountsMap = null;
if (existedAccoutMap == null) { if (existedAccountMap == null) {
newAccountsMap = new LinkedHashMap<String, Object>(); newAccountsMap = new LinkedHashMap<String, Object>();
} else { } else {
newAccountsMap = existedAccoutMap; newAccountsMap = existedAccountMap;
} }
if (StringUtils.isEmpty(plainAccessConfig.getAccessKey()) || if (StringUtils.isEmpty(plainAccessConfig.getAccessKey()) ||
...@@ -278,7 +277,7 @@ public class PlainPermissionManager { ...@@ -278,7 +277,7 @@ public class PlainPermissionManager {
JSONObject plainAclConfData = AclUtils.getYamlDataObject(fileHome + File.separator + fileName, JSONObject plainAclConfData = AclUtils.getYamlDataObject(fileHome + File.separator + fileName,
JSONObject.class); JSONObject.class);
if (plainAclConfData == null || plainAclConfData.isEmpty()) { 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); JSONArray globalWhiteAddrs = plainAclConfData.getJSONArray(AclConstants.CONFIG_GLOBAL_WHITE_ADDRS);
if (globalWhiteAddrs != null && !globalWhiteAddrs.isEmpty()) { if (globalWhiteAddrs != null && !globalWhiteAddrs.isEmpty()) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册