8344898: SM cleanup of java.base sun/util calendar, locale, cldr, and resources

Reviewed-by: naoto
This commit is contained in:
Roger Riggs 2024-11-25 19:44:40 +00:00
parent 4d898aa451
commit df2d4c1575
9 changed files with 119 additions and 263 deletions

View File

@ -33,8 +33,6 @@ import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.StreamCorruptedException;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.ZoneOffset;
@ -212,23 +210,17 @@ public final class ZoneInfoFile {
loadTZDB();
}
@SuppressWarnings("removal")
private static void loadTZDB() {
AccessController.doPrivileged(new PrivilegedAction<Void>() {
public Void run() {
try {
String libDir = StaticProperty.javaHome() + File.separator + "lib";
try (DataInputStream dis = new DataInputStream(
new BufferedInputStream(new FileInputStream(
new File(libDir, "tzdb.dat"))))) {
load(dis);
}
} catch (Exception x) {
throw new Error(x);
}
return null;
try {
String libDir = StaticProperty.javaHome() + File.separator + "lib";
try (DataInputStream dis = new DataInputStream(
new BufferedInputStream(new FileInputStream(
new File(libDir, "tzdb.dat"))))) {
load(dis);
}
});
} catch (Exception x) {
throw new Error(x);
}
}
/**

View File

@ -25,10 +25,6 @@
package sun.util.cldr;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.security.PrivilegedActionException;
import java.security.PrivilegedExceptionAction;
import java.text.spi.BreakIteratorProvider;
import java.text.spi.CollatorProvider;
import java.util.Arrays;
@ -75,24 +71,14 @@ public class CLDRLocaleProviderAdapter extends JRELocaleProviderAdapter {
parentLocalesMap.put(Locale.US, Locale.US);
}
@SuppressWarnings("removal")
public CLDRLocaleProviderAdapter() {
LocaleDataMetaInfo nbmi;
try {
nbmi = AccessController.doPrivileged((PrivilegedExceptionAction<LocaleDataMetaInfo>) () -> {
for (LocaleDataMetaInfo ldmi : ServiceLoader.loadInstalled(LocaleDataMetaInfo.class)) {
if (ldmi.getType() == Type.CLDR) {
return ldmi;
}
}
return null;
});
} catch (PrivilegedActionException pae) {
throw new InternalError(pae.getCause());
for (LocaleDataMetaInfo ldmi : ServiceLoader.loadInstalled(LocaleDataMetaInfo.class)) {
if (ldmi.getType() == Type.CLDR) {
nonBaseMetaInfo = ldmi;
return;
}
}
nonBaseMetaInfo = nbmi;
nonBaseMetaInfo = null;
}
/**
@ -112,12 +98,9 @@ public class CLDRLocaleProviderAdapter extends JRELocaleProviderAdapter {
@Override
public CalendarDataProvider getCalendarDataProvider() {
if (calendarDataProvider == null) {
@SuppressWarnings("removal")
CalendarDataProvider provider = AccessController.doPrivileged(
(PrivilegedAction<CalendarDataProvider>) () ->
new CLDRCalendarDataProviderImpl(
CalendarDataProvider provider = new CLDRCalendarDataProviderImpl(
getAdapterType(),
getLanguageTagSet("CalendarData")));
getLanguageTagSet("CalendarData"));
synchronized (this) {
if (calendarDataProvider == null) {
@ -131,12 +114,9 @@ public class CLDRLocaleProviderAdapter extends JRELocaleProviderAdapter {
@Override
public CalendarNameProvider getCalendarNameProvider() {
if (calendarNameProvider == null) {
@SuppressWarnings("removal")
CalendarNameProvider provider = AccessController.doPrivileged(
(PrivilegedAction<CalendarNameProvider>) ()
-> new CLDRCalendarNameProviderImpl(
CalendarNameProvider provider = new CLDRCalendarNameProviderImpl(
getAdapterType(),
getLanguageTagSet("FormatData")));
getLanguageTagSet("FormatData"));
synchronized (this) {
if (calendarNameProvider == null) {
@ -155,12 +135,9 @@ public class CLDRLocaleProviderAdapter extends JRELocaleProviderAdapter {
@Override
public TimeZoneNameProvider getTimeZoneNameProvider() {
if (timeZoneNameProvider == null) {
@SuppressWarnings("removal")
TimeZoneNameProvider provider = AccessController.doPrivileged(
(PrivilegedAction<TimeZoneNameProvider>) () ->
new CLDRTimeZoneNameProviderImpl(
TimeZoneNameProvider provider = new CLDRTimeZoneNameProviderImpl(
getAdapterType(),
getLanguageTagSet("TimeZoneNames")));
getLanguageTagSet("TimeZoneNames"));
synchronized (this) {
if (timeZoneNameProvider == null) {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2012, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -25,8 +25,6 @@
package sun.util.locale.provider;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.text.spi.BreakIteratorProvider;
import java.text.spi.CollatorProvider;
import java.text.spi.DateFormatProvider;
@ -186,9 +184,7 @@ public abstract class AuxLocaleProviderAdapter extends LocaleProviderAdapter {
* A dummy locale service provider that indicates there is no
* provider available
*/
@SuppressWarnings("removal")
private static final NullProvider NULL_PROVIDER = AccessController.doPrivileged(
(PrivilegedAction<NullProvider>) () -> new NullProvider());
private static final NullProvider NULL_PROVIDER = new NullProvider();
private static class NullProvider extends LocaleServiceProvider {
@Override

View File

@ -25,8 +25,6 @@
package sun.util.locale.provider;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.text.spi.BreakIteratorProvider;
import java.util.Arrays;
import java.util.HashSet;
@ -85,12 +83,9 @@ public class FallbackLocaleProviderAdapter extends JRELocaleProviderAdapter {
// In order to correctly report supported locales
public BreakIteratorProvider getBreakIteratorProvider() {
if (breakIteratorProvider == null) {
@SuppressWarnings("removal")
BreakIteratorProvider provider = AccessController.doPrivileged(
(PrivilegedAction<BreakIteratorProvider>) () ->
new BreakIteratorProviderImpl(
BreakIteratorProvider provider = new BreakIteratorProviderImpl(
getAdapterType(),
getLanguageTagSet("BreakIteratorRules")));
getLanguageTagSet("BreakIteratorRules"));
synchronized (this) {
if (breakIteratorProvider == null) {

View File

@ -25,10 +25,6 @@
package sun.util.locale.provider;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.security.PrivilegedActionException;
import java.security.PrivilegedExceptionAction;
import java.text.spi.BreakIteratorProvider;
import java.text.spi.CollatorProvider;
import java.text.spi.DateFormatProvider;
@ -139,12 +135,9 @@ public class JRELocaleProviderAdapter extends LocaleProviderAdapter implements R
@Override
public BreakIteratorProvider getBreakIteratorProvider() {
if (breakIteratorProvider == null) {
@SuppressWarnings("removal")
BreakIteratorProvider provider = AccessController.doPrivileged(
(PrivilegedAction<BreakIteratorProvider>) () ->
new BreakIteratorProviderImpl(
getAdapterType(),
getLanguageTagSet("FormatData")));
BreakIteratorProvider provider = new BreakIteratorProviderImpl(
getAdapterType(),
getLanguageTagSet("FormatData"));
synchronized (this) {
if (breakIteratorProvider == null) {
@ -158,12 +151,9 @@ public class JRELocaleProviderAdapter extends LocaleProviderAdapter implements R
@Override
public CollatorProvider getCollatorProvider() {
if (collatorProvider == null) {
@SuppressWarnings("removal")
CollatorProvider provider = AccessController.doPrivileged(
(PrivilegedAction<CollatorProvider>) () ->
new CollatorProviderImpl(
getAdapterType(),
getLanguageTagSet("CollationData")));
CollatorProvider provider = new CollatorProviderImpl(
getAdapterType(),
getLanguageTagSet("CollationData"));
synchronized (this) {
if (collatorProvider == null) {
@ -177,12 +167,9 @@ public class JRELocaleProviderAdapter extends LocaleProviderAdapter implements R
@Override
public DateFormatProvider getDateFormatProvider() {
if (dateFormatProvider == null) {
@SuppressWarnings("removal")
DateFormatProvider provider = AccessController.doPrivileged(
(PrivilegedAction<DateFormatProvider>) () ->
new DateFormatProviderImpl(
getAdapterType(),
getLanguageTagSet("FormatData")));
DateFormatProvider provider = new DateFormatProviderImpl(
getAdapterType(),
getLanguageTagSet("FormatData"));
synchronized (this) {
if (dateFormatProvider == null) {
@ -196,12 +183,9 @@ public class JRELocaleProviderAdapter extends LocaleProviderAdapter implements R
@Override
public DateFormatSymbolsProvider getDateFormatSymbolsProvider() {
if (dateFormatSymbolsProvider == null) {
@SuppressWarnings("removal")
DateFormatSymbolsProvider provider = AccessController.doPrivileged(
(PrivilegedAction<DateFormatSymbolsProvider>) () ->
new DateFormatSymbolsProviderImpl(
getAdapterType(),
getLanguageTagSet("FormatData")));
DateFormatSymbolsProvider provider = new DateFormatSymbolsProviderImpl(
getAdapterType(),
getLanguageTagSet("FormatData"));
synchronized (this) {
if (dateFormatSymbolsProvider == null) {
@ -215,12 +199,9 @@ public class JRELocaleProviderAdapter extends LocaleProviderAdapter implements R
@Override
public DecimalFormatSymbolsProvider getDecimalFormatSymbolsProvider() {
if (decimalFormatSymbolsProvider == null) {
@SuppressWarnings("removal")
DecimalFormatSymbolsProvider provider = AccessController.doPrivileged(
(PrivilegedAction<DecimalFormatSymbolsProvider>) () ->
new DecimalFormatSymbolsProviderImpl(
getAdapterType(),
getLanguageTagSet("FormatData")));
DecimalFormatSymbolsProvider provider = new DecimalFormatSymbolsProviderImpl(
getAdapterType(),
getLanguageTagSet("FormatData"));
synchronized (this) {
if (decimalFormatSymbolsProvider == null) {
@ -234,12 +215,9 @@ public class JRELocaleProviderAdapter extends LocaleProviderAdapter implements R
@Override
public NumberFormatProvider getNumberFormatProvider() {
if (numberFormatProvider == null) {
@SuppressWarnings("removal")
NumberFormatProvider provider = AccessController.doPrivileged(
(PrivilegedAction<NumberFormatProvider>) () ->
new NumberFormatProviderImpl(
NumberFormatProvider provider = new NumberFormatProviderImpl(
getAdapterType(),
getLanguageTagSet("FormatData")));
getLanguageTagSet("FormatData"));
synchronized (this) {
if (numberFormatProvider == null) {
@ -256,12 +234,9 @@ public class JRELocaleProviderAdapter extends LocaleProviderAdapter implements R
@Override
public CurrencyNameProvider getCurrencyNameProvider() {
if (currencyNameProvider == null) {
@SuppressWarnings("removal")
CurrencyNameProvider provider = AccessController.doPrivileged(
(PrivilegedAction<CurrencyNameProvider>) () ->
new CurrencyNameProviderImpl(
CurrencyNameProvider provider = new CurrencyNameProviderImpl(
getAdapterType(),
getLanguageTagSet("CurrencyNames")));
getLanguageTagSet("CurrencyNames"));
synchronized (this) {
if (currencyNameProvider == null) {
@ -275,12 +250,9 @@ public class JRELocaleProviderAdapter extends LocaleProviderAdapter implements R
@Override
public LocaleNameProvider getLocaleNameProvider() {
if (localeNameProvider == null) {
@SuppressWarnings("removal")
LocaleNameProvider provider = AccessController.doPrivileged(
(PrivilegedAction<LocaleNameProvider>) () ->
new LocaleNameProviderImpl(
LocaleNameProvider provider = new LocaleNameProviderImpl(
getAdapterType(),
getLanguageTagSet("LocaleNames")));
getLanguageTagSet("LocaleNames"));
synchronized (this) {
if (localeNameProvider == null) {
@ -294,12 +266,9 @@ public class JRELocaleProviderAdapter extends LocaleProviderAdapter implements R
@Override
public TimeZoneNameProvider getTimeZoneNameProvider() {
if (timeZoneNameProvider == null) {
@SuppressWarnings("removal")
TimeZoneNameProvider provider = AccessController.doPrivileged(
(PrivilegedAction<TimeZoneNameProvider>) () ->
new TimeZoneNameProviderImpl(
TimeZoneNameProvider provider = new TimeZoneNameProviderImpl(
getAdapterType(),
getLanguageTagSet("TimeZoneNames")));
getLanguageTagSet("TimeZoneNames"));
synchronized (this) {
if (timeZoneNameProvider == null) {
@ -313,12 +282,9 @@ public class JRELocaleProviderAdapter extends LocaleProviderAdapter implements R
@Override
public CalendarDataProvider getCalendarDataProvider() {
if (calendarDataProvider == null) {
@SuppressWarnings("removal")
CalendarDataProvider provider = AccessController.doPrivileged(
(PrivilegedAction<CalendarDataProvider>) () ->
new CalendarDataProviderImpl(
CalendarDataProvider provider = new CalendarDataProviderImpl(
getAdapterType(),
getLanguageTagSet("CalendarData")));
getLanguageTagSet("CalendarData"));
synchronized (this) {
if (calendarDataProvider == null) {
@ -332,12 +298,9 @@ public class JRELocaleProviderAdapter extends LocaleProviderAdapter implements R
@Override
public CalendarNameProvider getCalendarNameProvider() {
if (calendarNameProvider == null) {
@SuppressWarnings("removal")
CalendarNameProvider provider = AccessController.doPrivileged(
(PrivilegedAction<CalendarNameProvider>) () ->
new CalendarNameProviderImpl(
CalendarNameProvider provider = new CalendarNameProviderImpl(
getAdapterType(),
getLanguageTagSet("FormatData")));
getLanguageTagSet("FormatData"));
synchronized (this) {
if (calendarNameProvider == null) {
@ -354,12 +317,9 @@ public class JRELocaleProviderAdapter extends LocaleProviderAdapter implements R
@Override
public CalendarProvider getCalendarProvider() {
if (calendarProvider == null) {
@SuppressWarnings("removal")
CalendarProvider provider = AccessController.doPrivileged(
(PrivilegedAction<CalendarProvider>) () ->
new CalendarProviderImpl(
CalendarProvider provider = new CalendarProviderImpl(
getAdapterType(),
getLanguageTagSet("CalendarData")));
getLanguageTagSet("CalendarData"));
synchronized (this) {
if (calendarProvider == null) {
@ -376,12 +336,9 @@ public class JRELocaleProviderAdapter extends LocaleProviderAdapter implements R
@Override
public JavaTimeDateTimePatternProvider getJavaTimeDateTimePatternProvider() {
if (javaTimeDateTimePatternProvider == null) {
@SuppressWarnings("removal")
JavaTimeDateTimePatternProvider provider = AccessController.doPrivileged(
(PrivilegedAction<JavaTimeDateTimePatternProvider>) ()
-> new JavaTimeDateTimePatternImpl(
JavaTimeDateTimePatternProvider provider = new JavaTimeDateTimePatternImpl(
getAdapterType(),
getLanguageTagSet("FormatData")));
getLanguageTagSet("FormatData"));
synchronized (this) {
if (javaTimeDateTimePatternProvider == null) {
@ -461,30 +418,23 @@ public class JRELocaleProviderAdapter extends LocaleProviderAdapter implements R
String supportedLocaleString = BaseLocaleDataMetaInfo.getSupportedLocaleString(category);
// Use ServiceLoader to dynamically acquire installed locales' tags.
try {
@SuppressWarnings("removal")
String nonBaseTags = AccessController.doPrivileged((PrivilegedExceptionAction<String>) () -> {
StringBuilder tags = new StringBuilder();
for (LocaleDataMetaInfo ldmi :
ServiceLoader.loadInstalled(LocaleDataMetaInfo.class)) {
if (ldmi.getType() == LocaleProviderAdapter.Type.JRE) {
String t = ldmi.availableLanguageTags(category);
if (t != null) {
if (!tags.isEmpty()) {
tags.append(' ');
}
tags.append(t);
}
StringBuilder tags = new StringBuilder();
for (LocaleDataMetaInfo ldmi :
ServiceLoader.loadInstalled(LocaleDataMetaInfo.class)) {
if (ldmi.getType() == LocaleProviderAdapter.Type.JRE) {
String t = ldmi.availableLanguageTags(category);
if (t != null) {
if (!tags.isEmpty()) {
tags.append(' ');
}
tags.append(t);
}
return tags.toString();
});
if (nonBaseTags != null) {
supportedLocaleString += " " + nonBaseTags;
}
} catch (PrivilegedActionException pae) {
throw new InternalError(pae.getCause());
}
String nonBaseTags = tags.toString();
if (nonBaseTags != null) {
supportedLocaleString += " " + nonBaseTags;
}
return supportedLocaleString;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2012, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -25,9 +25,6 @@
package sun.util.locale.provider;
import java.security.AccessController;
import java.security.PrivilegedActionException;
import java.security.PrivilegedExceptionAction;
import java.text.BreakIterator;
import java.text.Collator;
import java.text.DateFormat;
@ -69,43 +66,31 @@ public class SPILocaleProviderAdapter extends AuxLocaleProviderAdapter {
return LocaleProviderAdapter.Type.SPI;
}
@SuppressWarnings("removal")
@Override
@SuppressWarnings(value={"unchecked", "deprecation"})
protected <P extends LocaleServiceProvider> P findInstalledProvider(final Class<P> c) {
try {
return AccessController.doPrivileged(new PrivilegedExceptionAction<>() {
@Override
@SuppressWarnings(value={"unchecked", "deprecation"})
public P run() {
P delegate = null;
for (LocaleServiceProvider provider :
ServiceLoader.load(c, ClassLoader.getSystemClassLoader())) {
if (delegate == null) {
try {
delegate =
(P) Class.forName(SPILocaleProviderAdapter.class.getCanonicalName() +
"$" +
c.getSimpleName() +
"Delegate")
.newInstance();
} catch (ClassNotFoundException |
InstantiationException |
IllegalAccessException e) {
throw new ServiceConfigurationError(
"SPI locale provider cannot be instantiated.", e);
}
}
((Delegate)delegate).addImpl(provider);
}
return delegate;
P delegate = null;
for (LocaleServiceProvider provider :
ServiceLoader.load(c, ClassLoader.getSystemClassLoader())) {
if (delegate == null) {
try {
delegate =
(P) Class.forName(SPILocaleProviderAdapter.class.getCanonicalName() +
"$" +
c.getSimpleName() +
"Delegate")
.newInstance();
} catch (ClassNotFoundException |
InstantiationException |
IllegalAccessException e) {
throw new ServiceConfigurationError(
"SPI locale provider cannot be instantiated.", e);
}
});
} catch (PrivilegedActionException e) {
throw new ServiceConfigurationError(
"SPI locale provider cannot be instantiated.", e);
}
((Delegate)delegate).addImpl(provider);
}
return delegate;
}
/*

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -26,9 +26,6 @@
package sun.util.resources;
import java.io.InputStream;
import java.security.AccessController;
import java.security.PrivilegedActionException;
import java.security.PrivilegedExceptionAction;
import java.util.Collections;
import java.util.Enumeration;
import java.util.ResourceBundle;
@ -72,7 +69,7 @@ public abstract class BreakIteratorResourceBundle extends ResourceBundle {
String path = getClass().getPackageName().replace('.', '/')
+ '/' + info.getString(key);
byte[] data;
try (InputStream is = getResourceAsStream(path)) {
try (InputStream is = getClass().getModule().getResourceAsStream(path)) {
data = is.readAllBytes();
} catch (Exception e) {
throw new InternalError("Can't load " + path, e);
@ -80,19 +77,6 @@ public abstract class BreakIteratorResourceBundle extends ResourceBundle {
return data;
}
@SuppressWarnings("removal")
private InputStream getResourceAsStream(String path) throws Exception {
PrivilegedExceptionAction<InputStream> pa;
pa = () -> getClass().getModule().getResourceAsStream(path);
InputStream is;
try {
is = AccessController.doPrivileged(pa);
} catch (PrivilegedActionException e) {
throw e.getException();
}
return is;
}
@Override
public Enumeration<String> getKeys() {
return Collections.enumeration(keySet());

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -42,8 +42,6 @@ package sun.util.resources;
import java.lang.ref.ReferenceQueue;
import java.lang.ref.SoftReference;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.Enumeration;
import java.util.Iterator;
import java.util.List;
@ -255,32 +253,25 @@ public abstract class Bundles {
/**
* Loads ResourceBundle from service providers.
*/
@SuppressWarnings("removal")
private static ResourceBundle loadBundleFromProviders(String baseName,
Locale locale,
ServiceLoader<ResourceBundleProvider> providers,
CacheKey cacheKey)
{
return AccessController.doPrivileged(
new PrivilegedAction<>() {
public ResourceBundle run() {
for (Iterator<ResourceBundleProvider> itr = providers.iterator(); itr.hasNext(); ) {
try {
ResourceBundleProvider provider = itr.next();
ResourceBundle bundle = provider.getBundle(baseName, locale);
if (bundle != null) {
return bundle;
}
} catch (ServiceConfigurationError | SecurityException e) {
if (cacheKey != null) {
cacheKey.setCause(e);
}
}
}
return null;
}
});
for (Iterator<ResourceBundleProvider> itr = providers.iterator(); itr.hasNext(); ) {
try {
ResourceBundleProvider provider = itr.next();
ResourceBundle bundle = provider.getBundle(baseName, locale);
if (bundle != null) {
return bundle;
}
} catch (ServiceConfigurationError e) {
if (cacheKey != null) {
cacheKey.setCause(e);
}
}
}
return null;
}
private static boolean isValidBundle(ResourceBundle bundle) {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1996, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -40,8 +40,6 @@
package sun.util.resources;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
@ -177,31 +175,19 @@ public class LocaleData {
return getBundle(type.getTextResourcesPackage() + ".FormatData", locale);
}
@SuppressWarnings("removal")
public static ResourceBundle getBundle(final String baseName, final Locale locale) {
return AccessController.doPrivileged(new PrivilegedAction<>() {
@Override
public ResourceBundle run() {
return Bundles.of(baseName, locale, LocaleDataStrategy.INSTANCE);
}
});
return Bundles.of(baseName, locale, LocaleDataStrategy.INSTANCE);
}
@SuppressWarnings("removal")
private static OpenListResourceBundle getSupplementary(final String baseName, final Locale locale) {
return AccessController.doPrivileged(new PrivilegedAction<>() {
@Override
public OpenListResourceBundle run() {
OpenListResourceBundle rb = null;
try {
rb = (OpenListResourceBundle) Bundles.of(baseName, locale,
SupplementaryStrategy.INSTANCE);
} catch (MissingResourceException e) {
// return null if no supplementary is available
}
return rb;
}
});
OpenListResourceBundle rb = null;
try {
rb = (OpenListResourceBundle) Bundles.of(baseName, locale,
SupplementaryStrategy.INSTANCE);
} catch (MissingResourceException e) {
// return null if no supplementary is available
}
return rb;
}
private abstract static class LocaleDataResourceBundleProvider