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 8973320237c684c68864c29ff0c4a90d75bfdd3e..c4847239a2ee4290fcb93ecd47b8fcb9f4b714a1 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 6931eb7c426aa3511769f5e9fa8a4abc6c260bb3..242c98d6af29dd7d065e511bdd7332af935ee020 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 5705b745a0e7472ca7a215468ae20775a53babfb..d1fdcb66d4384c084513ef72f8ed70b864a2cfa1 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);