From d648f7741b141bf7d0e0f976d37e6c915086cddc Mon Sep 17 00:00:00 2001 From: "Jonguk. Lim" Date: Fri, 17 Mar 2023 11:48:48 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20jdk=2011=20>=201.8=20=EC=82=AC=EC=9A=A9?= =?UTF-8?q?=EC=9C=BC=EB=A1=9C=20String.repeat=20=ED=95=A8=EC=88=98=20?= =?UTF-8?q?=EB=8C=80=EC=B2=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../framework/core/annotation/mask/Masking.java | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/main/java/kr/xit/framework/core/annotation/mask/Masking.java b/src/main/java/kr/xit/framework/core/annotation/mask/Masking.java index 121d10cf..73bdc7f2 100644 --- a/src/main/java/kr/xit/framework/core/annotation/mask/Masking.java +++ b/src/main/java/kr/xit/framework/core/annotation/mask/Masking.java @@ -4,6 +4,8 @@ import java.util.Arrays; import java.util.regex.Matcher; import java.util.regex.Pattern; +import org.apache.commons.lang3.StringUtils; + public class Masking { final static String MASKING_STAR = "*"; final static char CHAR_STAR = '*'; @@ -48,13 +50,13 @@ public class Masking { Pattern pattern = Pattern.compile(NAME_MASKING_EN); Matcher m = pattern.matcher(name); - if(m.find()) return name.replaceFirst(NAME_MASKING_EN, MASKING_STAR.repeat(m.group().length())); - //if(m.find()) return name.replaceFirst(NAME_MASKING_EN, StringUtils.repeat(MASKING_STAR, m.group().length())); + //if(m.find()) return name.replaceFirst(NAME_MASKING_EN, MASKING_STAR.repeat(m.group().length())); + if(m.find()) return name.replaceFirst(NAME_MASKING_EN, StringUtils.repeat(MASKING_STAR, m.group().length())); } // 한글인 경우 - return name.replaceFirst(NAME_MASKING_KO, MASKING_STAR.repeat(name.length() - 2)); - //return name.replaceFirst(NAME_MASKING_KO, StringUtils.repeat(MASKING_STAR, name.length() - 2)); + //return name.replaceFirst(NAME_MASKING_KO, MASKING_STAR.repeat(name.length() - 2)); + return name.replaceFirst(NAME_MASKING_KO, StringUtils.repeat(MASKING_STAR, name.length() - 2)); } /** @@ -64,7 +66,8 @@ public class Masking { */ public static String maskingRn(String regNumber) { - return regNumber.replaceAll("([0-9]{6})-([1-4]{1})([0-9]{6})", "$1-$2".concat(MASKING_STAR.repeat(6))); + //return regNumber.replaceAll("([0-9]{6})-([1-4]{1})([0-9]{6})", "$1-$2".concat(MASKING_STAR.repeat(6))); + return regNumber.replaceAll("([0-9]{6})-([1-4]{1})([0-9]{6})", "$1-$2".concat(StringUtils.repeat(MASKING_STAR,6))); } /** @@ -94,7 +97,7 @@ public class Masking { * @return */ public static String maskingMail(String email) { - return email.replaceAll("[A-z|0-9|.-]+@", MASKING_STAR.repeat(5).concat("@")); + return email.replaceAll("[A-z|0-9|.-]+@", StringUtils.repeat(MASKING_STAR,5).concat("@")); }