Skip to content

Commit

Permalink
fix warning 'The constructor Locale is deprecated since version 20'
Browse files Browse the repository at this point in the history
  • Loading branch information
EcljpseB0T committed Jun 4, 2024
1 parent 8fe6bba commit e614171
Showing 1 changed file with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -289,21 +289,21 @@ private static boolean isMatchingLocale(String candidateValues, String locale) {
}
return false;
}

public static Locale getDefaultLocale() {
String nl = getNL();
// sanity test
if (nl == null)
return Locale.getDefault();

// break the string into tokens to get the Locale object
StringTokenizer locales = new StringTokenizer(nl,"_"); //$NON-NLS-1$
StringTokenizer locales = new StringTokenizer(nl, "_"); //$NON-NLS-1$
if (locales.countTokens() == 1)
return new Locale(locales.nextToken(), ""); //$NON-NLS-1$
return Locale.of(locales.nextToken());
else if (locales.countTokens() == 2)
return new Locale(locales.nextToken(), locales.nextToken());
return Locale.of(locales.nextToken(), locales.nextToken());
else if (locales.countTokens() == 3)
return new Locale(locales.nextToken(), locales.nextToken(), locales.nextToken());
return Locale.of(locales.nextToken(), locales.nextToken(), locales.nextToken());
else
return Locale.getDefault();
}
Expand Down

0 comments on commit e614171

Please sign in to comment.