From f57ce543567c6efa8949e98d11bf9c9e15a4a7cc Mon Sep 17 00:00:00 2001 From: ZhouYixun <291028775@qq.com> Date: Sat, 2 Jul 2022 09:58:20 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=AF=B7=E6=B1=82=E5=A4=B4?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sonic/common/config/CommonResultControllerAdvice.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/sonic-server-common/src/main/java/org/cloud/sonic/common/config/CommonResultControllerAdvice.java b/sonic-server-common/src/main/java/org/cloud/sonic/common/config/CommonResultControllerAdvice.java index cac623c0..1c0ee588 100644 --- a/sonic-server-common/src/main/java/org/cloud/sonic/common/config/CommonResultControllerAdvice.java +++ b/sonic-server-common/src/main/java/org/cloud/sonic/common/config/CommonResultControllerAdvice.java @@ -55,7 +55,12 @@ public Object beforeBodyWrite(Object body, MethodParameter returnType, MediaType language = l; } String[] split = language.split("_"); - Locale locale = new Locale(split[0], split[1]); + Locale locale; + if (split.length >= 2) { + locale = new Locale(split[0], split[1]); + } else { + locale = new Locale("zh", "CN"); + } // Get return body Object returnBody = container.getValue();