diff options
| author | 李皓宸 <[email protected]> | 2019-05-14 18:39:40 +0800 |
|---|---|---|
| committer | 李皓宸 <[email protected]> | 2019-05-14 18:39:40 +0800 |
| commit | f6c37c7bdaf060f0961674f357886184234aee82 (patch) | |
| tree | e0d08db65d6e9c73c486f9983a8937902210a8b2 | |
| parent | c81dd92acabba4614a0f348bbfbbfc8e681eeac3 (diff) | |
修改 导入时源IP/目的IP为默认值时的提示语
| -rw-r--r-- | src/main/java/com/nis/util/excel/thread/CheckIpFormatThread.java | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/src/main/java/com/nis/util/excel/thread/CheckIpFormatThread.java b/src/main/java/com/nis/util/excel/thread/CheckIpFormatThread.java index 30d7765f..fd6efb7d 100644 --- a/src/main/java/com/nis/util/excel/thread/CheckIpFormatThread.java +++ b/src/main/java/com/nis/util/excel/thread/CheckIpFormatThread.java @@ -602,10 +602,13 @@ public class CheckIpFormatThread implements Callable<String>{ Pattern ip6 = Constants.IPV6_IP_PATTERN;
Matcher ip4Matcher = ip4.matcher(srcIpAddress);
Matcher ip6Matcher = ip6.matcher(srcIpAddress);
- if ((ip4Matcher.matches() && srcIpAddress.startsWith("0.0.0.0"))
- || (ip6Matcher.matches() && srcIpAddress.startsWith("::"))) {
+ if (ip4Matcher.matches() && srcIpAddress.startsWith("0.0.0.0")) {
errInfo.append(prop.getProperty("client_ip")
- + String.format(prop.getProperty("can_not_be"), prop.getProperty("default_value"))
+ + String.format(prop.getProperty("can_not_be"), Constants.IPV4_DEFAULT_IP_VALUE)
+ + ";");
+ } else if (ip6Matcher.matches() && srcIpAddress.startsWith("::")) {
+ errInfo.append(prop.getProperty("client_ip")
+ + String.format(prop.getProperty("can_not_be"), Constants.IPV6_DEFAULT_IP_VALUE)
+ ";");
}
}
@@ -627,10 +630,13 @@ public class CheckIpFormatThread implements Callable<String>{ Pattern ip6 = Constants.IPV6_IP_PATTERN;
Matcher ip4Matcher = ip4.matcher(destIpAddress);
Matcher ip6Matcher = ip6.matcher(destIpAddress);
- if ((ip4Matcher.matches() && destIpAddress.startsWith("0.0.0.0"))
- || (ip6Matcher.matches() && destIpAddress.startsWith("::"))) {
+ if (ip4Matcher.matches() && destIpAddress.startsWith("0.0.0.0")) {
+ errInfo.append(prop.getProperty("server_ip")
+ + String.format(prop.getProperty("can_not_be"), Constants.IPV4_DEFAULT_IP_VALUE)
+ + ";");
+ } else if (ip6Matcher.matches() && destIpAddress.startsWith("::")) {
errInfo.append(prop.getProperty("server_ip")
- + String.format(prop.getProperty("can_not_be"), prop.getProperty("default_value"))
+ + String.format(prop.getProperty("can_not_be"), Constants.IPV6_DEFAULT_IP_VALUE)
+ ";");
}
}
|
