Skip to content

Commit

Permalink
Update BaseUtils.java
Browse files Browse the repository at this point in the history
  • Loading branch information
mcchampions committed Dec 21, 2024
1 parent 9b5d4b5 commit 46ff64a
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ public class BaseUtils {
private static final Pattern PATTERN = Pattern.compile("\"");
private static final Pattern REGEX = Pattern.compile("'");
private static final Pattern REGEXP = Pattern.compile("&");
private static final Pattern PATTERN1 = Pattern.compile("<");
private static final Pattern PATTERN2 = Pattern.compile(">");

/**
* 拼接 Authorization
Expand Down Expand Up @@ -61,7 +63,7 @@ public static List<String> toStringList(@NonNull List<Object> list) {
* @return str
*/
public static String replaceXmlSpecialCharacters(@NonNull String text) {
return PATTERN.matcher(REGEX.matcher(REGEXP.matcher(text).replaceAll("&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;")).replaceAll("&apos;")).replaceAll("&quot;");
return PATTERN.matcher(REGEX.matcher(PATTERN2.matcher(PATTERN1.matcher(REGEXP.matcher(text).replaceAll("&amp;")).replaceAll("&lt;")).replaceAll("&gt;")).replaceAll("&apos;")).replaceAll("&quot;");
}

/**
Expand Down

0 comments on commit 46ff64a

Please sign in to comment.