From 336f55c2db2859a5ee8e141bd9af2202ae5c1949 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E9=98=B3?= <1727611626@qq.com> Date: Thu, 23 Jul 2020 11:17:04 +0800 Subject: [PATCH] [ISSUE #2171] fix the spell error in ACL (#2175) * fix issue#2171 * fix the issue#2171 Co-authored-by: fantow --- .../main/java/org/apache/rocketmq/acl/common/AclUtils.java | 2 +- .../rocketmq/acl/plain/RemoteAddressStrategyFactory.java | 4 ++-- .../java/org/apache/rocketmq/acl/common/AclUtilsTest.java | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/acl/src/main/java/org/apache/rocketmq/acl/common/AclUtils.java b/acl/src/main/java/org/apache/rocketmq/acl/common/AclUtils.java index 89733202..c4847239 100644 --- a/acl/src/main/java/org/apache/rocketmq/acl/common/AclUtils.java +++ b/acl/src/main/java/org/apache/rocketmq/acl/common/AclUtils.java @@ -120,7 +120,7 @@ public class AclUtils { } } - public static String[] getAddreeStrArray(String netaddress, String partialAddress) { + public static String[] getAddresses(String netaddress, String partialAddress) { String[] parAddStrArray = StringUtils.split(partialAddress.substring(1, partialAddress.length() - 1), ","); String address = netaddress.substring(0, netaddress.indexOf("{")); String[] addreeStrArray = new String[parAddStrArray.length]; diff --git a/acl/src/main/java/org/apache/rocketmq/acl/plain/RemoteAddressStrategyFactory.java b/acl/src/main/java/org/apache/rocketmq/acl/plain/RemoteAddressStrategyFactory.java index 6931eb7c..242c98d6 100644 --- a/acl/src/main/java/org/apache/rocketmq/acl/plain/RemoteAddressStrategyFactory.java +++ b/acl/src/main/java/org/apache/rocketmq/acl/plain/RemoteAddressStrategyFactory.java @@ -52,14 +52,14 @@ public class RemoteAddressStrategyFactory { if (!last.startsWith("{")) { throw new AclException(String.format("MultipleRemoteAddressStrategy netaddress examine scope Exception netaddress", remoteAddr)); } - return new MultipleRemoteAddressStrategy(AclUtils.getAddreeStrArray(remoteAddr, last)); + return new MultipleRemoteAddressStrategy(AclUtils.getAddresses(remoteAddr, last)); } else { String[] strArray = StringUtils.split(remoteAddr, "."); String four = strArray[3]; if (!four.startsWith("{")) { throw new AclException(String.format("MultipleRemoteAddressStrategy netaddress examine scope Exception netaddress", remoteAddr)); } - return new MultipleRemoteAddressStrategy(AclUtils.getAddreeStrArray(remoteAddr, four)); + return new MultipleRemoteAddressStrategy(AclUtils.getAddresses(remoteAddr, four)); } } else if (AclUtils.isComma(remoteAddr)) { return new MultipleRemoteAddressStrategy(StringUtils.split(remoteAddr, ",")); diff --git a/acl/src/test/java/org/apache/rocketmq/acl/common/AclUtilsTest.java b/acl/src/test/java/org/apache/rocketmq/acl/common/AclUtilsTest.java index 5705b745..d1fdcb66 100644 --- a/acl/src/test/java/org/apache/rocketmq/acl/common/AclUtilsTest.java +++ b/acl/src/test/java/org/apache/rocketmq/acl/common/AclUtilsTest.java @@ -32,9 +32,9 @@ import org.junit.Test; public class AclUtilsTest { @Test - public void getAddreeStrArray() { + public void getAddresses() { String address = "1.1.1.{1,2,3,4}"; - String[] addressArray = AclUtils.getAddreeStrArray(address, "{1,2,3,4}"); + String[] addressArray = AclUtils.getAddresses(address, "{1,2,3,4}"); List newAddressList = new ArrayList<>(); for (String a : addressArray) { newAddressList.add(a); @@ -49,7 +49,7 @@ public class AclUtilsTest { // IPv6 test String ipv6Address = "1:ac41:9987::bb22:666:{1,2,3,4}"; - String[] ipv6AddressArray = AclUtils.getAddreeStrArray(ipv6Address, "{1,2,3,4}"); + String[] ipv6AddressArray = AclUtils.getAddresses(ipv6Address, "{1,2,3,4}"); List newIPv6AddressList = new ArrayList<>(); for (String a : ipv6AddressArray) { newIPv6AddressList.add(a); -- GitLab