8344898: SM cleanup of java.base sun/util calendar, locale, cldr, and resources
Reviewed-by: naoto
This commit is contained in:
parent
4d898aa451
commit
df2d4c1575
@ -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,10 +210,7 @@ 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(
|
||||
@ -226,9 +221,6 @@ public final class ZoneInfoFile {
|
||||
} catch (Exception x) {
|
||||
throw new Error(x);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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;
|
||||
nonBaseMetaInfo = ldmi;
|
||||
return;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
});
|
||||
} catch (PrivilegedActionException pae) {
|
||||
throw new InternalError(pae.getCause());
|
||||
}
|
||||
|
||||
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) {
|
||||
|
@ -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
|
||||
|
@ -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) {
|
||||
|
@ -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(
|
||||
BreakIteratorProvider provider = new BreakIteratorProviderImpl(
|
||||
getAdapterType(),
|
||||
getLanguageTagSet("FormatData")));
|
||||
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(
|
||||
CollatorProvider provider = new CollatorProviderImpl(
|
||||
getAdapterType(),
|
||||
getLanguageTagSet("CollationData")));
|
||||
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(
|
||||
DateFormatProvider provider = new DateFormatProviderImpl(
|
||||
getAdapterType(),
|
||||
getLanguageTagSet("FormatData")));
|
||||
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(
|
||||
DateFormatSymbolsProvider provider = new DateFormatSymbolsProviderImpl(
|
||||
getAdapterType(),
|
||||
getLanguageTagSet("FormatData")));
|
||||
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(
|
||||
DecimalFormatSymbolsProvider provider = new DecimalFormatSymbolsProviderImpl(
|
||||
getAdapterType(),
|
||||
getLanguageTagSet("FormatData")));
|
||||
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,9 +418,6 @@ 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)) {
|
||||
@ -477,15 +431,11 @@ public class JRELocaleProviderAdapter extends LocaleProviderAdapter implements R
|
||||
}
|
||||
}
|
||||
}
|
||||
return tags.toString();
|
||||
});
|
||||
String nonBaseTags = tags.toString();
|
||||
|
||||
if (nonBaseTags != null) {
|
||||
supportedLocaleString += " " + nonBaseTags;
|
||||
}
|
||||
} catch (PrivilegedActionException pae) {
|
||||
throw new InternalError(pae.getCause());
|
||||
}
|
||||
|
||||
return supportedLocaleString;
|
||||
}
|
||||
|
@ -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,16 +66,10 @@ public class SPILocaleProviderAdapter extends AuxLocaleProviderAdapter {
|
||||
return LocaleProviderAdapter.Type.SPI;
|
||||
}
|
||||
|
||||
@SuppressWarnings("removal")
|
||||
@Override
|
||||
protected <P extends LocaleServiceProvider> P findInstalledProvider(final Class<P> c) {
|
||||
try {
|
||||
return AccessController.doPrivileged(new PrivilegedExceptionAction<>() {
|
||||
@Override
|
||||
@SuppressWarnings(value={"unchecked", "deprecation"})
|
||||
public P run() {
|
||||
protected <P extends LocaleServiceProvider> P findInstalledProvider(final Class<P> c) {
|
||||
P delegate = null;
|
||||
|
||||
for (LocaleServiceProvider provider :
|
||||
ServiceLoader.load(c, ClassLoader.getSystemClassLoader())) {
|
||||
if (delegate == null) {
|
||||
@ -101,12 +92,6 @@ public class SPILocaleProviderAdapter extends AuxLocaleProviderAdapter {
|
||||
}
|
||||
return delegate;
|
||||
}
|
||||
});
|
||||
} catch (PrivilegedActionException e) {
|
||||
throw new ServiceConfigurationError(
|
||||
"SPI locale provider cannot be instantiated.", e);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Delegate interface. All the implementations have to have the class name
|
||||
|
@ -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());
|
||||
|
@ -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,15 +253,11 @@ 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();
|
||||
@ -271,7 +265,7 @@ public abstract class Bundles {
|
||||
if (bundle != null) {
|
||||
return bundle;
|
||||
}
|
||||
} catch (ServiceConfigurationError | SecurityException e) {
|
||||
} catch (ServiceConfigurationError e) {
|
||||
if (cacheKey != null) {
|
||||
cacheKey.setCause(e);
|
||||
}
|
||||
@ -279,9 +273,6 @@ public abstract class Bundles {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
private static boolean isValidBundle(ResourceBundle bundle) {
|
||||
return bundle != null && bundle != NONEXISTENT_BUNDLE;
|
||||
|
@ -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,21 +175,11 @@ 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);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@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,
|
||||
@ -201,8 +189,6 @@ public class LocaleData {
|
||||
}
|
||||
return rb;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private abstract static class LocaleDataResourceBundleProvider
|
||||
implements ResourceBundleProvider {
|
||||
|
Loading…
Reference in New Issue
Block a user