Skip to content

Commit f811661

Browse files
committed
Stop using deprecated Locale constructors in o.e.help.webapp
1 parent 0c9f17e commit f811661

File tree

3 files changed

+10
-13
lines changed

3 files changed

+10
-13
lines changed

ua/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/WebappResources.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2000, 2017 IBM Corporation and others.
2+
* Copyright (c) 2000, 2024 IBM Corporation and others.
33
*
44
* This program and the accompanying materials
55
* are made available under the terms of the Eclipse Public License 2.0
@@ -182,12 +182,11 @@ private static Locale getDefaultLocale() {
182182
// break the string into tokens to get the Locale object
183183
StringTokenizer locales = new StringTokenizer(nl, "_"); //$NON-NLS-1$
184184
if (locales.countTokens() == 1)
185-
return new Locale(locales.nextToken(), ""); //$NON-NLS-1$
185+
return Locale.of(locales.nextToken(), ""); //$NON-NLS-1$
186186
else if (locales.countTokens() == 2)
187-
return new Locale(locales.nextToken(), locales.nextToken());
187+
return Locale.of(locales.nextToken(), locales.nextToken());
188188
else if (locales.countTokens() == 3)
189-
return new Locale(locales.nextToken(), locales.nextToken(), locales
190-
.nextToken());
189+
return Locale.of(locales.nextToken(), locales.nextToken(), locales.nextToken());
191190
else
192191
return Locale.getDefault();
193192
}

ua/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/UrlUtil.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -459,10 +459,9 @@ public static Locale getLocaleObj(HttpServletRequest request,
459459
*/
460460
public static Locale getLocale(String localeStr) {
461461
if (localeStr.length() >= 5) {
462-
return new Locale(localeStr.substring(0, 2), localeStr.substring(3,
463-
5));
462+
return Locale.of(localeStr.substring(0, 2), localeStr.substring(3, 5));
464463
} else if (localeStr.length() >= 2) {
465-
return new Locale(localeStr.substring(0, 2), ""); //$NON-NLS-1$
464+
return Locale.of(localeStr.substring(0, 2), ""); //$NON-NLS-1$
466465
} else {
467466
return Locale.getDefault();
468467
}

ua/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/NavServlet.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2007, 2016 IBM Corporation and others.
2+
* Copyright (c) 2007, 2024 IBM Corporation and others.
33
*
44
* This program and the accompanying materials
55
* are made available under the terms of the Eclipse Public License 2.0
@@ -111,12 +111,11 @@ protected Locale getLocale (HttpServletRequest req, HttpServletResponse resp) {
111111
// break the string into tokens to get the Locale object
112112
StringTokenizer locales = new StringTokenizer(nl, "_"); //$NON-NLS-1$
113113
if (locales.countTokens() == 1)
114-
locale = new Locale(locales.nextToken(), ""); //$NON-NLS-1$
114+
locale = Locale.of(locales.nextToken(), ""); //$NON-NLS-1$
115115
else if (locales.countTokens() == 2)
116-
locale = new Locale(locales.nextToken(), locales.nextToken());
116+
locale = Locale.of(locales.nextToken(), locales.nextToken());
117117
else if (locales.countTokens() == 3)
118-
locale = new Locale(locales.nextToken(), locales.nextToken(), locales
119-
.nextToken());
118+
locale = Locale.of(locales.nextToken(), locales.nextToken(), locales.nextToken());
120119
else
121120
locale = Locale.getDefault();
122121
return locale;

0 commit comments

Comments
 (0)