master
duhui 2022-08-27 21:53:25 +08:00
parent 58b9446a16
commit f50224f78e
1 changed files with 4 additions and 9 deletions

View File

@ -132,14 +132,11 @@ public class SensitivewordFilter {
int matchFlag = 0;//匹配标识数默认为0
char word = 0;
Map nowMap = sensitiveWordMap;
boolean logTest = true;
for (int i = beginIndex; i < txt.length(); i++) {
word = txt.charAt(i);
nowMap = (Map) nowMap.get(word); //获取指定key
if (logTest){
LOGGER.info("============================={}",nowMap.toString());
System.out.println("============================="+nowMap.toString());
}
LOGGER.info("============================={}",nowMap.toString());
System.out.println("============================="+nowMap.toString());
//不存在,直接返回
if (nowMap == null){
break;
@ -161,10 +158,8 @@ public class SensitivewordFilter {
if (matchFlag < 1 || !flag) {
matchFlag = 0;
}
if (logTest){
System.out.println("=========================结果:"+matchFlag);
LOGGER.info("=========================结果:{}",matchFlag);
}
System.out.println("=========================结果:"+matchFlag);
LOGGER.info("=========================结果:{}",matchFlag);
return matchFlag;
}