File tree Expand file tree Collapse file tree 2 files changed +7
-3
lines changed
main/java/org/springframework/beans/propertyeditors
test/java/org/springframework/beans/propertyeditors Expand file tree Collapse file tree 2 files changed +7
-3
lines changed Original file line number Diff line number Diff line change 11/*
2- * Copyright 2002-2021 the original author or authors.
2+ * Copyright 2002-2024 the original author or authors.
33 *
44 * Licensed under the Apache License, Version 2.0 (the "License");
55 * you may not use this file except in compliance with the License.
3030 * @author Juergen Hoeller
3131 * @since 26.05.2003
3232 * @see java.util.Locale
33- * @see org.springframework.util.StringUtils#parseLocaleString
33+ * @see org.springframework.util.StringUtils#parseLocale
3434 */
3535public class LocaleEditor extends PropertyEditorSupport {
3636
3737 @ Override
3838 public void setAsText (String text ) {
39- setValue (StringUtils .parseLocaleString (text ));
39+ setValue (StringUtils .parseLocale (text ));
4040 }
4141
4242 @ Override
Original file line number Diff line number Diff line change @@ -648,6 +648,10 @@ void localeEditor() {
648648 assertThat (localeEditor .getValue ()).isEqualTo (Locale .CANADA );
649649 assertThat (localeEditor .getAsText ()).isEqualTo ("en_CA" );
650650
651+ localeEditor = new LocaleEditor ();
652+ localeEditor .setAsText ("zh-Hans" );
653+ assertThat (localeEditor .getValue ()).isEqualTo (Locale .forLanguageTag ("zh-Hans" ));
654+
651655 localeEditor = new LocaleEditor ();
652656 assertThat (localeEditor .getAsText ()).isEmpty ();
653657 }
You can’t perform that action at this time.
0 commit comments