File tree 2 files changed +7
-3
lines changed
main/java/org/springframework/beans/propertyeditors
test/java/org/springframework/beans/propertyeditors
2 files changed +7
-3
lines changed Original file line number Diff line number Diff line change 1
1
/*
2
- * Copyright 2002-2021 the original author or authors.
2
+ * Copyright 2002-2024 the original author or authors.
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
30
30
* @author Juergen Hoeller
31
31
* @since 26.05.2003
32
32
* @see java.util.Locale
33
- * @see org.springframework.util.StringUtils#parseLocaleString
33
+ * @see org.springframework.util.StringUtils#parseLocale
34
34
*/
35
35
public class LocaleEditor extends PropertyEditorSupport {
36
36
37
37
@ Override
38
38
public void setAsText (String text ) {
39
- setValue (StringUtils .parseLocaleString (text ));
39
+ setValue (StringUtils .parseLocale (text ));
40
40
}
41
41
42
42
@ Override
Original file line number Diff line number Diff line change @@ -648,6 +648,10 @@ void localeEditor() {
648
648
assertThat (localeEditor .getValue ()).isEqualTo (Locale .CANADA );
649
649
assertThat (localeEditor .getAsText ()).isEqualTo ("en_CA" );
650
650
651
+ localeEditor = new LocaleEditor ();
652
+ localeEditor .setAsText ("zh-Hans" );
653
+ assertThat (localeEditor .getValue ()).isEqualTo (Locale .forLanguageTag ("zh-Hans" ));
654
+
651
655
localeEditor = new LocaleEditor ();
652
656
assertThat (localeEditor .getAsText ()).isEmpty ();
653
657
}
You can’t perform that action at this time.
0 commit comments