-
Notifications
You must be signed in to change notification settings - Fork 26.5k
Description
Pre-check
- I am sure that all the content I provide is in English.
Search before asking
- I had searched in the issues and found no similar issues.
Apache Dubbo Component
Java SDK (apache/dubbo)
Dubbo Version
dubbo java 3.3.2
jdk 21
windows idea
Steps to reproduce this issue
@OverRide
public List locales() {
List locales = this.locales;
if (locales == null) {
locales = HttpUtils.parseAcceptLanguage(headers.getFirst(HttpHeaderNames.CONTENT_LANGUAGE.getKey()));
if (locales.isEmpty()) {
locales.add(Locale.getDefault());
}
this.locales = locales;
}
return locales;
}
public static List parseAcceptLanguage(String header) {
List<Item> locales = new ArrayList<>();
if (header == null) {
return Collections.emptyList();
}
for (String item : StringUtils.tokenize(header, ',')) {
String[] pair = StringUtils.tokenize(item, ';');
locales.add(new Item<>(parseLocale(pair[0]), pair.length > 1 ? Float.parseFloat(pair[1]) : 1.0F));
}
return Item.sortAndGet(locales);
}
Collections.emptyList() is final
if Collections.emptyList()
locales.add(Locale.getDefault()) throw exception
What you expected to happen
no exception
Anything else
No response
Are you willing to submit a pull request to fix on your own?
- Yes I am willing to submit a pull request on my own!
Code of Conduct
- I agree to follow this project's Code of Conduct
Metadata
Metadata
Assignees
Labels
Type
Projects
Status