diff --git a/coder-common-thin-common/src/main/java/org/leocoder/thin/common/utils/date/DateUtil.java b/coder-common-thin-common/src/main/java/org/leocoder/thin/common/utils/date/DateUtil.java index 750449d..254aeea 100755 --- a/coder-common-thin-common/src/main/java/org/leocoder/thin/common/utils/date/DateUtil.java +++ b/coder-common-thin-common/src/main/java/org/leocoder/thin/common/utils/date/DateUtil.java @@ -607,7 +607,8 @@ public class DateUtil { long hour = diff % nd / nh; // 计算差多少分钟 long min = diff % nd % nh / nm; - // 计算差多少秒//输出结果 + //输出结果 + // 计算差多少秒 // long sec = diff % nd % nh % nm / ns; return day + "天" + hour + "小时" + min + "分钟"; } @@ -637,7 +638,8 @@ public class DateUtil { long min = diff % nd % nh / nm; // 计算相差的秒2 long sec = diff % nd % nh % nm / ns; - // 计算差多少秒//输出结果 + //输出结果 + // 计算差多少秒 // long sec = diff % nd % nh % nm / ns; Map map = new HashMap<>(); map.put("day", day); @@ -746,7 +748,8 @@ public class DateUtil { long hour = diff % nd / nh; // 计算差多少分钟 long min = diff % nd % nh / nm; - // 计算差多少秒//输出结果 + //输出结果 + // 计算差多少秒 // long sec = diff % nd % nh % nm / ns; return day + "天" + hour + "小时" + min + "分钟"; } diff --git a/coder-common-thin-common/src/main/java/org/leocoder/thin/common/utils/html/HTMLFilter.java b/coder-common-thin-common/src/main/java/org/leocoder/thin/common/utils/html/HTMLFilter.java index 2759da5..f59e08d 100755 --- a/coder-common-thin-common/src/main/java/org/leocoder/thin/common/utils/html/HTMLFilter.java +++ b/coder-common-thin-common/src/main/java/org/leocoder/thin/common/utils/html/HTMLFilter.java @@ -129,7 +129,8 @@ public final class HTMLFilter { vSelfClosingTags = new String[]{"img"}; vNeedClosingTags = new String[]{"a", "b", "strong", "i", "em"}; vDisallowed = new String[]{}; - vAllowedProtocols = new String[]{"http", "mailto", "https"}; // no ftp. + // no ftp. + vAllowedProtocols = new String[]{"http", "mailto", "https"}; vProtocolAtts = new String[]{"src", "href"}; vRemoveBlanks = new String[]{"a", "b", "strong", "i", "em"}; vAllowedEntities = new String[]{"amp", "gt", "lt", "quot"}; @@ -224,7 +225,8 @@ public final class HTMLFilter { final Matcher m = P_COMMENTS.matcher(s); final StringBuffer buf = new StringBuffer(); if (m.find()) { - final String match = m.group(1); // (.*?) + // (.*?) + final String match = m.group(1); m.appendReplacement(buf, Matcher.quoteReplacement("")); } m.appendTail(buf); @@ -336,12 +338,16 @@ public final class HTMLFilter { final List paramNames = new ArrayList<>(); final List paramValues = new ArrayList<>(); while (m2.find()) { - paramNames.add(m2.group(1)); // ([a-z0-9]+) - paramValues.add(m2.group(3)); // (.*?) + // ([a-z0-9]+) + paramNames.add(m2.group(1)); + // (.*?) + paramValues.add(m2.group(3)); } while (m3.find()) { - paramNames.add(m3.group(1)); // ([a-z0-9]+) - paramValues.add(m3.group(3)); // ([^\"\\s']+) + // ([a-z0-9]+) + paramNames.add(m3.group(1)); + // ([^\"\\s']+) + paramValues.add(m3.group(3)); } String paramName, paramValue; @@ -452,8 +458,10 @@ public final class HTMLFilter { // validate entities throughout the string Matcher m = P_VALID_ENTITIES.matcher(s); while (m.find()) { - final String one = m.group(1); // ([^&;]*) - final String two = m.group(2); // (?=(;|&|$)) + // ([^&;]*) + final String one = m.group(1); + // (?=(;|&|$)) + final String two = m.group(2); m.appendReplacement(buf, Matcher.quoteReplacement(checkEntity(one, two))); } m.appendTail(buf); @@ -466,9 +474,12 @@ public final class HTMLFilter { StringBuffer buf = new StringBuffer(); Matcher m = P_VALID_QUOTES.matcher(s); while (m.find()) { - final String one = m.group(1); // (>|^) - final String two = m.group(2); // ([^<]+?) - final String three = m.group(3); // (<|$) + // (>|^) + final String one = m.group(1); + // ([^<]+?) + final String two = m.group(2); + // (<|$) + final String three = m.group(3); // 不替换双引号为",防止json格式无效 regexReplace(P_QUOTE, """, two) m.appendReplacement(buf, Matcher.quoteReplacement(one + two + three)); }