niuhutao opened a new issue, #14895:
URL: https://github.com/apache/dubbo/issues/14895

   ### Pre-check
   
   - [X] I am sure that all the content I provide is in English.
   
   
   ### Search before asking
   
   - [X] I had searched in the 
[issues](https://github.com/apache/dubbo/issues?q=is%3Aissue) 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<Locale> locales() {
           List<Locale> 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<Locale> parseAcceptLanguage(String header) {
           List<Item<Locale>> 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
   
   - [X] I agree to follow this project's [Code of 
Conduct](https://www.apache.org/foundation/policies/conduct)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to