You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by zh...@apache.org on 2020/06/10 10:56:11 UTC

[shardingsphere-elastic-job-lite] branch master updated: Move IP Regex Pattern out of the method #762 (#763)

This is an automated email from the ASF dual-hosted git repository.

zhangliang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere-elastic-job-lite.git


The following commit(s) were added to refs/heads/master by this push:
     new 26983ae  Move IP Regex Pattern out of the method #762 (#763)
26983ae is described below

commit 26983ae9f35c0cd7054b49575d811fd61b9b2b50
Author: Tboy <gu...@immomo.com>
AuthorDate: Wed Jun 10 18:56:04 2020 +0800

    Move IP Regex Pattern out of the method #762 (#763)
---
 .../elasticjob/lite/internal/util/SensitiveInfoUtils.java             | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/elastic-job-lite-core/src/main/java/org/apache/shardingsphere/elasticjob/lite/internal/util/SensitiveInfoUtils.java b/elastic-job-lite-core/src/main/java/org/apache/shardingsphere/elasticjob/lite/internal/util/SensitiveInfoUtils.java
index cf46268..5afa8ec 100644
--- a/elastic-job-lite-core/src/main/java/org/apache/shardingsphere/elasticjob/lite/internal/util/SensitiveInfoUtils.java
+++ b/elastic-job-lite-core/src/main/java/org/apache/shardingsphere/elasticjob/lite/internal/util/SensitiveInfoUtils.java
@@ -37,6 +37,8 @@ import java.util.stream.Collectors;
 public final class SensitiveInfoUtils {
     
     private static final String FAKE_IP_SAMPLE = "ip";
+
+    private static final Pattern IP_PATTERN = Pattern.compile(IpUtils.IP_REGEX);
     
     /**
      * Filter sensitive IP addresses.
@@ -48,7 +50,7 @@ public final class SensitiveInfoUtils {
         final Map<String, String> fakeIpMap = new HashMap<>();
         final AtomicInteger step = new AtomicInteger();
         return target.stream().map(input -> {
-            Matcher matcher = Pattern.compile(IpUtils.IP_REGEX).matcher(input);
+            Matcher matcher = IP_PATTERN.matcher(input);
             String result = input;
             while (matcher.find()) {
                 String realIp = matcher.group();