jdk/src/java.logging/share/classes/java/util/logging/Logger.java
changeset 42462 c12ae7eefac0
parent 42338 a60f280f803c
child 44545 83b611b88ac8
child 44538 a603c475d649
equal deleted inserted replaced
42461:713c5f76b607 42462:c12ae7eefac0
   257     // This instance indicates that no resource bundle has been specified yet,
   257     // This instance indicates that no resource bundle has been specified yet,
   258     // and it will be shared by all loggers which have no resource bundle.
   258     // and it will be shared by all loggers which have no resource bundle.
   259     private static final LoggerBundle NO_RESOURCE_BUNDLE =
   259     private static final LoggerBundle NO_RESOURCE_BUNDLE =
   260             new LoggerBundle(null, null);
   260             new LoggerBundle(null, null);
   261 
   261 
   262     private static final JavaUtilResourceBundleAccess RB_ACCESS =
   262     // Calling SharedSecrets.getJavaUtilResourceBundleAccess()
       
   263     // forces the initialization of ResourceBundle.class, which
       
   264     // can be too early if the VM has not finished booting yet.
       
   265     private static final class RbAccess {
       
   266         static final JavaUtilResourceBundleAccess RB_ACCESS =
   263             SharedSecrets.getJavaUtilResourceBundleAccess();
   267             SharedSecrets.getJavaUtilResourceBundleAccess();
       
   268     }
   264 
   269 
   265     // A value class that holds the logger configuration data.
   270     // A value class that holds the logger configuration data.
   266     // This configuration can be shared between an application logger
   271     // This configuration can be shared between an application logger
   267     // and a system logger of the same name.
   272     // and a system logger of the same name.
   268     private static final class ConfigurationData {
   273     private static final class ConfigurationData {
  2181         // that is provided by the user. In that case we will look in the TCCL.
  2186         // that is provided by the user. In that case we will look in the TCCL.
  2182         // We also look in the TCCL if callerModule is null or unnamed.
  2187         // We also look in the TCCL if callerModule is null or unnamed.
  2183         if (!useCallersModule || callerModule == null || !callerModule.isNamed()) {
  2188         if (!useCallersModule || callerModule == null || !callerModule.isNamed()) {
  2184             try {
  2189             try {
  2185                 Module mod = cl.getUnnamedModule();
  2190                 Module mod = cl.getUnnamedModule();
  2186                 catalog = RB_ACCESS.getBundle(name, currentLocale, mod);
  2191                 catalog = RbAccess.RB_ACCESS.getBundle(name, currentLocale, mod);
  2187                 catalogName = name;
  2192                 catalogName = name;
  2188                 catalogLocale = currentLocale;
  2193                 catalogLocale = currentLocale;
  2189                 return catalog;
  2194                 return catalog;
  2190             } catch (MissingResourceException ex) {
  2195             } catch (MissingResourceException ex) {
  2191                 // We can't find the ResourceBundle in the default
  2196                 // We can't find the ResourceBundle in the default
  2225             // we should have:
  2230             // we should have:
  2226             //  useCallersModule && callerModule != null && callerModule.isNamed();
  2231             //  useCallersModule && callerModule != null && callerModule.isNamed();
  2227             // Try with the caller's module
  2232             // Try with the caller's module
  2228             try {
  2233             try {
  2229                 // Use the caller's module
  2234                 // Use the caller's module
  2230                 catalog = RB_ACCESS.getBundle(name, currentLocale, callerModule);
  2235                 catalog = RbAccess.RB_ACCESS.getBundle(name, currentLocale, callerModule);
  2231                 catalogName = name;
  2236                 catalogName = name;
  2232                 catalogLocale = currentLocale;
  2237                 catalogLocale = currentLocale;
  2233                 return catalog;
  2238                 return catalog;
  2234             } catch (MissingResourceException ex) {
  2239             } catch (MissingResourceException ex) {
  2235                 return null; // no luck
  2240                 return null; // no luck