1. 修正语法检查

This commit is contained in:
黄昕 2024-04-09 14:54:33 +08:00
parent ec3a59ffad
commit b09994e130
1 changed files with 4 additions and 2 deletions

View File

@ -11,6 +11,8 @@ import java.util.Locale;
* @author xajhuang @163.com
*/
public class MessageUtil {
private final static int arraySize = 2;
private MessageUtil() {
throw new AssertionError("Instantiating utility class.");
}
@ -25,7 +27,7 @@ public class MessageUtil {
public static String get(String key, String language) {
if (!StringUtils.isEmpty(language)) {
String[] arrs = language.split("_");
if (arrs.length == 2) {
if (arrs.length == arraySize) {
return get(key, new Locale(arrs[0], arrs[1]));
}
}
@ -44,7 +46,7 @@ public class MessageUtil {
public static String get(String key, Object[] params, String language) {
if (!StringUtils.isEmpty(language)) {
String[] arrs = language.split("_");
if (arrs.length == 2) {
if (arrs.length == arraySize) {
return get(key, params, new Locale(arrs[0], arrs[1]));
}
}