From 2a1bf40142fd7077b719841c22ee2682df9b740e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Kubitz?= Date: Tue, 4 Jun 2024 12:08:51 +0200 Subject: [PATCH] fix warning 'The constructor Locale is deprecated since version 20' --- .../eclipse/update/internal/configurator/Utils.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/update/org.eclipse.update.configurator/src/org/eclipse/update/internal/configurator/Utils.java b/update/org.eclipse.update.configurator/src/org/eclipse/update/internal/configurator/Utils.java index 20c96811305..8e184809777 100644 --- a/update/org.eclipse.update.configurator/src/org/eclipse/update/internal/configurator/Utils.java +++ b/update/org.eclipse.update.configurator/src/org/eclipse/update/internal/configurator/Utils.java @@ -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(); }