mirror of
https://gitee.com/dromara/RuoYi-Vue-Plus.git
synced 2026-09-19 01:48:47 +08:00
fix 修复 I18nLocaleResolver的ArrayIndexOutOfBoundsException异常
This commit is contained in:
parent
dd2abd95c9
commit
51e54773fe
@ -1,9 +1,9 @@
|
||||
package org.dromara.common.web.core;
|
||||
|
||||
import org.springframework.web.servlet.LocaleResolver;
|
||||
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import org.springframework.web.servlet.LocaleResolver;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
/**
|
||||
@ -19,7 +19,11 @@ public class I18nLocaleResolver implements LocaleResolver {
|
||||
Locale locale = Locale.getDefault();
|
||||
if (language != null && language.length() > 0) {
|
||||
String[] split = language.split("_");
|
||||
locale = new Locale(split[0], split[1]);
|
||||
try {
|
||||
locale = new Locale(split[0], split[1]);
|
||||
} catch (ArrayIndexOutOfBoundsException e) {
|
||||
return locale;
|
||||
}
|
||||
}
|
||||
return locale;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user