< prev index next >
src/java.logging/share/classes/java/util/logging/Logger.java
Print this page
@@ -257,12 +257,17 @@
// This instance indicates that no resource bundle has been specified yet,
// and it will be shared by all loggers which have no resource bundle.
private static final LoggerBundle NO_RESOURCE_BUNDLE =
new LoggerBundle(null, null);
- private static final JavaUtilResourceBundleAccess RB_ACCESS =
+ // Calling SharedSecrets.getJavaUtilResourceBundleAccess()
+ // forces the initialization of ResourceBundle.class, which
+ // can be too early if the VM has not finished booting yet.
+ private static final class RbAccess {
+ static final JavaUtilResourceBundleAccess RB_ACCESS =
SharedSecrets.getJavaUtilResourceBundleAccess();
+ }
// A value class that holds the logger configuration data.
// This configuration can be shared between an application logger
// and a system logger of the same name.
private static final class ConfigurationData {
@@ -2181,11 +2186,11 @@
// that is provided by the user. In that case we will look in the TCCL.
// We also look in the TCCL if callerModule is null or unnamed.
if (!useCallersModule || callerModule == null || !callerModule.isNamed()) {
try {
Module mod = cl.getUnnamedModule();
- catalog = RB_ACCESS.getBundle(name, currentLocale, mod);
+ catalog = RbAccess.RB_ACCESS.getBundle(name, currentLocale, mod);
catalogName = name;
catalogLocale = currentLocale;
return catalog;
} catch (MissingResourceException ex) {
// We can't find the ResourceBundle in the default
@@ -2225,11 +2230,11 @@
// we should have:
// useCallersModule && callerModule != null && callerModule.isNamed();
// Try with the caller's module
try {
// Use the caller's module
- catalog = RB_ACCESS.getBundle(name, currentLocale, callerModule);
+ catalog = RbAccess.RB_ACCESS.getBundle(name, currentLocale, callerModule);
catalogName = name;
catalogLocale = currentLocale;
return catalog;
} catch (MissingResourceException ex) {
return null; // no luck
< prev index next >