< prev index next >
src/java.logging/share/classes/java/util/logging/Level.java
Print this page
*** 77,88 ****
public class Level implements java.io.Serializable {
private static final String defaultBundle =
"sun.util.logging.resources.logging";
! private static final JavaUtilResourceBundleAccess RB_ACCESS =
SharedSecrets.getJavaUtilResourceBundleAccess();
/**
* @serial The non-localized name of the level.
*/
private final String name;
--- 77,93 ----
public class Level implements java.io.Serializable {
private static final String defaultBundle =
"sun.util.logging.resources.logging";
! // 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();
+ }
/**
* @serial The non-localized name of the level.
*/
private final String name;
*** 284,294 ****
private String computeLocalizedLevelName(Locale newLocale) {
// Resource bundle should be loaded from the defining module
// or its defining class loader, if it's unnamed module,
// of this Level instance that can be a custom Level subclass;
Module module = this.getClass().getModule();
! ResourceBundle rb = RB_ACCESS.getBundle(resourceBundleName,
newLocale, module);
final String localizedName = rb.getString(name);
final boolean isDefaultBundle = defaultBundle.equals(resourceBundleName);
if (!isDefaultBundle) return localizedName;
--- 289,299 ----
private String computeLocalizedLevelName(Locale newLocale) {
// Resource bundle should be loaded from the defining module
// or its defining class loader, if it's unnamed module,
// of this Level instance that can be a custom Level subclass;
Module module = this.getClass().getModule();
! ResourceBundle rb = RbAccess.RB_ACCESS.getBundle(resourceBundleName,
newLocale, module);
final String localizedName = rb.getString(name);
final boolean isDefaultBundle = defaultBundle.equals(resourceBundleName);
if (!isDefaultBundle) return localizedName;
< prev index next >