8041564: Improved management of logger resources
authordfuchs
Wed, 14 May 2014 15:40:39 +0200
changeset 27074 4abca40e7d0c
parent 27073 fc35bdd9a8eb
child 27075 5edf23ff04f3
8041564: Improved management of logger resources Reviewed-by: skoivu, mchung, igerasim
jdk/src/java.logging/share/classes/java/util/logging/Logger.java
--- a/jdk/src/java.logging/share/classes/java/util/logging/Logger.java	Mon May 12 10:18:51 2014 -0400
+++ b/jdk/src/java.logging/share/classes/java/util/logging/Logger.java	Wed May 14 15:40:39 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2014, 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
@@ -1937,6 +1937,9 @@
         }
 
         setCallersClassLoaderRef(callersClass);
+        if (isSystemLogger && getCallersClassLoader() != null) {
+            checkPermission();
+        }
         if (findResourceBundle(name, true) == null) {
             // We've failed to find an expected ResourceBundle.
             // unset the caller's ClassLoader since we were unable to find the
@@ -2170,11 +2173,13 @@
                 return trb;
             }
             final String rbName = isSystemLogger
-                ? trb.resourceBundleName
+                // ancestor of a system logger is expected to be a system logger.
+                // ignore resource bundle name if it's not.
+                ? (target.isSystemLogger ? trb.resourceBundleName : null)
                 : target.getResourceBundleName();
             if (rbName != null) {
                 return LoggerBundle.get(rbName,
-                            findResourceBundle(rbName, true));
+                        findResourceBundle(rbName, true));
             }
             target = isSystemLogger ? target.parent : target.getParent();
         }