Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

api: Remove use of terminally deprecated SecurityManager api #781

Merged
merged 1 commit into from Jun 10, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -29,9 +29,6 @@
import java.net.URL;
import java.net.URLConnection;
import java.nio.charset.StandardCharsets;
import java.security.AccessController;
import java.security.PrivilegedActionException;
import java.security.PrivilegedExceptionAction;
import java.util.Locale;
import java.util.PropertyResourceBundle;
import java.util.ResourceBundle;
Expand Down Expand Up @@ -62,26 +59,20 @@ public ResourceBundle newBundle(final String baseName, final Locale locale, fina
if (format.equals("java.properties")) {
final String bundle = this.toBundleName(baseName, locale);
final String resource = this.toResourceName(bundle, "properties");
final InputStream is;
try {
is = AccessController.doPrivileged((PrivilegedExceptionAction<InputStream>) () -> {
if (reload) {
final URL url = loader.getResource(resource);
if (url != null) {
final URLConnection connection = url.openConnection();
if (connection != null) {
connection.setUseCaches(false);
return connection.getInputStream();
}
}
return null;
} else {
return loader.getResourceAsStream(resource);
InputStream is = null;
if (reload) {
final URL url = loader.getResource(resource);
if (url != null) {
final URLConnection connection = url.openConnection();
if (connection != null) {
connection.setUseCaches(false);
is = connection.getInputStream();
}
});
} catch (final PrivilegedActionException e) {
throw (IOException) e.getException();
}
} else {
is = loader.getResourceAsStream(resource);
}

if (is != null) {
try(final InputStreamReader isr = new InputStreamReader(is, StandardCharsets.UTF_8)) {
return new PropertyResourceBundle(isr);
Expand Down