eureka tag-4.2.5
tanghc 4 years ago
parent 2f707cc99d
commit 0f5f659b48
  1. 6
      sop-common/sop-gateway-common/src/main/java/com/gitee/sop/gatewaycommon/message/ErrorFactory.java

@ -7,6 +7,7 @@ import org.springframework.context.support.ResourceBundleMessageSource;
import org.springframework.util.Assert;
import org.springframework.util.StringUtils;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
@ -33,6 +34,8 @@ public class ErrorFactory {
private static Map<String, Error> errorCache = new HashMap<>(64);
private static List<Locale> localeList = Arrays.asList(Locale.ENGLISH, Locale.SIMPLIFIED_CHINESE);
/**
* 错误信息的国际化信息
*/
@ -70,6 +73,9 @@ public class ErrorFactory {
if (locale == null) {
locale = Locale.SIMPLIFIED_CHINESE;
}
if (!localeList.contains(locale)) {
locale = Locale.ENGLISH;
}
String key = errorMeta.getModulePrefix() + errorMeta.getCode() + errorMeta.getSubCode() + locale.toString();
Error error = errorCache.get(key);
if (error == null) {

Loading…
Cancel
Save