Skip to content

Commit

Permalink
Revert "Update Locale constructor calls to use Locale.of"
Browse files Browse the repository at this point in the history
This reverts commit bc5c6eb.
  • Loading branch information
kagemomiji committed Apr 30, 2024
1 parent a453570 commit 7ca63ba
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1137,7 +1137,7 @@ public Locale getLocale() {
String country = getProperty(KEY_LOCALE_COUNTRY, DEFAULT_LOCALE_COUNTRY);
String variant = getProperty(KEY_LOCALE_VARIANT, DEFAULT_LOCALE_VARIANT);

return Locale.of(language, country, variant);
return new Locale(language, country, variant);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public String getLanguage() {
public String getLanguageName() {
if (this.language == null)
return String.valueOf(this.id);
Locale locale = Locale.of(this.language);
Locale locale = new Locale(this.language);
String languageName = StringUtils.trimToNull(locale.getDisplayLanguage(Locale.ENGLISH));
return (languageName == null) ? this.language : languageName;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ public static Locale parseLocale(String s) {
while (elements.size() < 3) {
elements.add("");
}
return Locale.of(elements.get(0), elements.get(1), elements.get(2));
return new Locale(elements.get(0), elements.get(1), elements.get(2));
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public void testFormatBytes() {
assertEquals("410.00 TB", StringUtil.formatBytes(450799767388160L, locale), "Error in formatBytes()");
assertEquals("4413.43 TB", StringUtil.formatBytes(4852617603375432L, locale), "Error in formatBytes()");

locale = Locale.of("no", "", "");
locale = new Locale("no", "", "");
assertEquals("918 B", StringUtil.formatBytes(918L, locale), "Error in formatBytes()");
assertEquals("1023 B", StringUtil.formatBytes(1023L, locale), "Error in formatBytes()");
assertEquals("1 KB", StringUtil.formatBytes(1024L, locale), "Error in formatBytes()");
Expand Down Expand Up @@ -124,12 +124,12 @@ private void doTestSplit(String input, String... expected) {

@Test
public void testParseLocale() {
assertEquals(Locale.of("en"), StringUtil.parseLocale("en"), "Error in parseLocale()");
assertEquals(Locale.of("en"), StringUtil.parseLocale("en_"), "Error in parseLocale()");
assertEquals(Locale.of("en"), StringUtil.parseLocale("en__"), "Error in parseLocale()");
assertEquals(Locale.of("en", "US"), StringUtil.parseLocale("en_US"), "Error in parseLocale()");
assertEquals(Locale.of("en", "US", "WIN"), StringUtil.parseLocale("en_US_WIN"), "Error in parseLocale()");
assertEquals(Locale.of("en", "", "WIN"), StringUtil.parseLocale("en__WIN"), "Error in parseLocale()");
assertEquals(new Locale("en"), StringUtil.parseLocale("en"), "Error in parseLocale()");
assertEquals(new Locale("en"), StringUtil.parseLocale("en_"), "Error in parseLocale()");
assertEquals(new Locale("en"), StringUtil.parseLocale("en__"), "Error in parseLocale()");
assertEquals(new Locale("en", "US"), StringUtil.parseLocale("en_US"), "Error in parseLocale()");
assertEquals(new Locale("en", "US", "WIN"), StringUtil.parseLocale("en_US_WIN"), "Error in parseLocale()");
assertEquals(new Locale("en", "", "WIN"), StringUtil.parseLocale("en__WIN"), "Error in parseLocale()");
}

@Test
Expand Down

0 comments on commit 7ca63ba

Please sign in to comment.