Skip to content

Commit

Permalink
修改隐患
Browse files Browse the repository at this point in the history
  • Loading branch information
KeRan213539 committed Sep 8, 2020
1 parent b4f234d commit bb4e177
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,14 @@ public class IpUtil {

public static final String IP_PORT_SPLITER = ":";

public static final int SPLIT_IP_PORT_RESULT_LENGTH = 2;

private static final String LOCAL_HOST_IP_V4 = "127.0.0.1";

private static final String LOCAL_HOST_IP_V6 = "[::1]";

private static Pattern ipv4Pattern = Pattern.compile("\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}");

private static final int SPLIT_IP_PORT_RESULT_LENGTH = 2;

private static final int IPV4_ADDRESS_LENGTH = 4;

private static final int IPV6_ADDRESS_LENGTH = 16;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ public static Instance fromString(String config) {
}

int port = 0;
if (NumberUtils.isNumber(providerAddr[1])) {
if (providerAddr.length == IpUtil.SPLIT_IP_PORT_RESULT_LENGTH && NumberUtils.isNumber(providerAddr[1])) {
port = Integer.parseInt(providerAddr[1]);
}

Expand Down

0 comments on commit bb4e177

Please sign in to comment.