1. 修正语法检查
This commit is contained in:
parent
ec3a59ffad
commit
b09994e130
|
@ -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]));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue