diff -r 6a1c87e2876b -r f672d9cf521e jdk/src/share/classes/java/awt/KeyboardFocusManager.java --- a/jdk/src/share/classes/java/awt/KeyboardFocusManager.java Mon Dec 07 16:38:44 2009 +0300 +++ b/jdk/src/share/classes/java/awt/KeyboardFocusManager.java Tue Dec 08 09:02:09 2009 -0800 @@ -53,8 +53,7 @@ import java.util.StringTokenizer; import java.util.WeakHashMap; -import java.util.logging.Level; -import java.util.logging.Logger; +import sun.util.logging.PlatformLogger; import sun.awt.AppContext; import sun.awt.HeadlessToolkit; @@ -111,7 +110,7 @@ { // Shared focus engine logger - private static final Logger focusLog = Logger.getLogger("java.awt.focus.KeyboardFocusManager"); + private static final PlatformLogger focusLog = PlatformLogger.getLogger("java.awt.focus.KeyboardFocusManager"); static { /* ensure that the necessary native libraries are loaded */ @@ -154,7 +153,7 @@ */ private static native void initIDs(); - private static final Logger log = Logger.getLogger("java.awt.KeyboardFocusManager"); + private static final PlatformLogger log = PlatformLogger.getLogger("java.awt.KeyboardFocusManager"); /** * The identifier for the Forward focus traversal keys. @@ -504,8 +503,8 @@ if (this == getCurrentKeyboardFocusManager()) { return focusOwner; } else { - if (focusLog.isLoggable(Level.FINER)) { - focusLog.log(Level.FINER, "This manager is " + this + ", current is " + getCurrentKeyboardFocusManager()); + if (focusLog.isLoggable(PlatformLogger.FINER)) { + focusLog.finer("This manager is " + this + ", current is " + getCurrentKeyboardFocusManager()); } throw new SecurityException(notPrivileged); } @@ -609,9 +608,9 @@ } void setNativeFocusOwner(Component comp) { - if (focusLog.isLoggable(Level.FINEST)) { - focusLog.log(Level.FINEST, "Calling peer {0} setCurrentFocusOwner for {1}", - new Object[] {String.valueOf(peer), String.valueOf(comp)}); + if (focusLog.isLoggable(PlatformLogger.FINEST)) { + focusLog.finest("Calling peer {0} setCurrentFocusOwner for {1}", + String.valueOf(peer), String.valueOf(comp)); } peer.setCurrentFocusOwner(comp); } @@ -673,8 +672,8 @@ if (this == getCurrentKeyboardFocusManager()) { return permanentFocusOwner; } else { - if (focusLog.isLoggable(Level.FINER)) { - focusLog.log(Level.FINER, "This manager is " + this + ", current is " + getCurrentKeyboardFocusManager()); + if (focusLog.isLoggable(PlatformLogger.FINER)) { + focusLog.finer("This manager is " + this + ", current is " + getCurrentKeyboardFocusManager()); } throw new SecurityException(notPrivileged); } @@ -781,8 +780,8 @@ if (this == getCurrentKeyboardFocusManager()) { return focusedWindow; } else { - if (focusLog.isLoggable(Level.FINER)) { - focusLog.log(Level.FINER, "This manager is " + this + ", current is " + getCurrentKeyboardFocusManager()); + if (focusLog.isLoggable(PlatformLogger.FINER)) { + focusLog.finer("This manager is " + this + ", current is " + getCurrentKeyboardFocusManager()); } throw new SecurityException(notPrivileged); } @@ -885,8 +884,8 @@ if (this == getCurrentKeyboardFocusManager()) { return activeWindow; } else { - if (focusLog.isLoggable(Level.FINER)) { - focusLog.log(Level.FINER, "This manager is " + this + ", current is " + getCurrentKeyboardFocusManager()); + if (focusLog.isLoggable(PlatformLogger.FINER)) { + focusLog.finer("This manager is " + this + ", current is " + getCurrentKeyboardFocusManager()); } throw new SecurityException(notPrivileged); } @@ -919,8 +918,8 @@ Window oldActiveWindow; synchronized (KeyboardFocusManager.class) { oldActiveWindow = getActiveWindow(); - if (focusLog.isLoggable(Level.FINER)) { - focusLog.log(Level.FINER, "Setting global active window to " + activeWindow + ", old active " + oldActiveWindow); + if (focusLog.isLoggable(PlatformLogger.FINER)) { + focusLog.finer("Setting global active window to " + activeWindow + ", old active " + oldActiveWindow); } try { @@ -1215,8 +1214,8 @@ if (this == getCurrentKeyboardFocusManager()) { return currentFocusCycleRoot; } else { - if (focusLog.isLoggable(Level.FINER)) { - focusLog.log(Level.FINER, "This manager is " + this + ", current is " + getCurrentKeyboardFocusManager()); + if (focusLog.isLoggable(PlatformLogger.FINER)) { + focusLog.finer("This manager is " + this + ", current is " + getCurrentKeyboardFocusManager()); } throw new SecurityException(notPrivileged); } @@ -2149,9 +2148,9 @@ HeavyweightFocusRequest(Component heavyweight, Component descendant, boolean temporary, CausedFocusEvent.Cause cause) { - if (log.isLoggable(Level.FINE)) { + if (log.isLoggable(PlatformLogger.FINE)) { if (heavyweight == null) { - log.log(Level.FINE, "Assertion (heavyweight != null) failed"); + log.fine("Assertion (heavyweight != null) failed"); } } @@ -2161,12 +2160,12 @@ } boolean addLightweightRequest(Component descendant, boolean temporary, CausedFocusEvent.Cause cause) { - if (log.isLoggable(Level.FINE)) { + if (log.isLoggable(PlatformLogger.FINE)) { if (this == HeavyweightFocusRequest.CLEAR_GLOBAL_FOCUS_OWNER) { - log.log(Level.FINE, "Assertion (this != HeavyweightFocusRequest.CLEAR_GLOBAL_FOCUS_OWNER) failed"); + log.fine("Assertion (this != HeavyweightFocusRequest.CLEAR_GLOBAL_FOCUS_OWNER) failed"); } if (descendant == null) { - log.log(Level.FINE, "Assertion (descendant != null) failed"); + log.fine("Assertion (descendant != null) failed"); } } @@ -2339,12 +2338,12 @@ (Component heavyweight, Component descendant, boolean temporary, boolean focusedWindowChangeAllowed, long time, CausedFocusEvent.Cause cause) { - if (log.isLoggable(Level.FINE)) { + if (log.isLoggable(PlatformLogger.FINE)) { if (heavyweight == null) { - log.log(Level.FINE, "Assertion (heavyweight != null) failed"); + log.fine("Assertion (heavyweight != null) failed"); } if (time == 0) { - log.log(Level.FINE, "Assertion (time != 0) failed"); + log.fine("Assertion (time != 0) failed"); } } @@ -2361,31 +2360,31 @@ Component currentFocusOwner = thisManager.getGlobalFocusOwner(); Component nativeFocusOwner = thisManager.getNativeFocusOwner(); Window nativeFocusedWindow = thisManager.getNativeFocusedWindow(); - if (focusLog.isLoggable(Level.FINER)) { - focusLog.log(Level.FINER, "SNFH for {0} in {1}", - new Object[] {String.valueOf(descendant), String.valueOf(heavyweight)}); + if (focusLog.isLoggable(PlatformLogger.FINER)) { + focusLog.finer("SNFH for {0} in {1}", + String.valueOf(descendant), String.valueOf(heavyweight)); } - if (focusLog.isLoggable(Level.FINEST)) { - focusLog.log(Level.FINEST, "0. Current focus owner {0}", - String.valueOf(currentFocusOwner)); - focusLog.log(Level.FINEST, "0. Native focus owner {0}", - String.valueOf(nativeFocusOwner)); - focusLog.log(Level.FINEST, "0. Native focused window {0}", - String.valueOf(nativeFocusedWindow)); + if (focusLog.isLoggable(PlatformLogger.FINEST)) { + focusLog.finest("0. Current focus owner {0}", + String.valueOf(currentFocusOwner)); + focusLog.finest("0. Native focus owner {0}", + String.valueOf(nativeFocusOwner)); + focusLog.finest("0. Native focused window {0}", + String.valueOf(nativeFocusedWindow)); } synchronized (heavyweightRequests) { HeavyweightFocusRequest hwFocusRequest = getLastHWRequest(); - if (focusLog.isLoggable(Level.FINEST)) { - focusLog.log(Level.FINEST, "Request {0}", String.valueOf(hwFocusRequest)); + if (focusLog.isLoggable(PlatformLogger.FINEST)) { + focusLog.finest("Request {0}", String.valueOf(hwFocusRequest)); } if (hwFocusRequest == null && heavyweight == nativeFocusOwner) { if (descendant == currentFocusOwner) { // Redundant request. - if (focusLog.isLoggable(Level.FINEST)) - focusLog.log(Level.FINEST, "1. SNFH_FAILURE for {0}", - String.valueOf(descendant)); + if (focusLog.isLoggable(PlatformLogger.FINEST)) + focusLog.finest("1. SNFH_FAILURE for {0}", + String.valueOf(descendant)); return SNFH_FAILURE; } @@ -2417,8 +2416,8 @@ // SunToolkit.postPriorityEvent(newFocusOwnerEvent); SunToolkit.postEvent(descendant.appContext, newFocusOwnerEvent); - if (focusLog.isLoggable(Level.FINEST)) - focusLog.log(Level.FINEST, "2. SNFH_HANDLED for {0}", String.valueOf(descendant)); + if (focusLog.isLoggable(PlatformLogger.FINEST)) + focusLog.finest("2. SNFH_HANDLED for {0}", String.valueOf(descendant)); return SNFH_SUCCESS_HANDLED; } else if (hwFocusRequest != null && hwFocusRequest.heavyweight == heavyweight) { @@ -2431,7 +2430,7 @@ manager.enqueueKeyEvents(time, descendant); } - if (focusLog.isLoggable(Level.FINEST)) + if (focusLog.isLoggable(PlatformLogger.FINEST)) focusLog.finest("3. SNFH_HANDLED for lightweight" + descendant + " in " + heavyweight); return SNFH_SUCCESS_HANDLED; @@ -2454,7 +2453,7 @@ (hwFocusRequest != null) ? hwFocusRequest.heavyweight : nativeFocusedWindow)) { - if (focusLog.isLoggable(Level.FINEST)) + if (focusLog.isLoggable(PlatformLogger.FINEST)) focusLog.finest("4. SNFH_FAILURE for " + descendant); return SNFH_FAILURE; } @@ -2464,7 +2463,7 @@ heavyweightRequests.add (new HeavyweightFocusRequest(heavyweight, descendant, temporary, cause)); - if (focusLog.isLoggable(Level.FINEST)) + if (focusLog.isLoggable(PlatformLogger.FINEST)) focusLog.finest("5. SNFH_PROCEED for " + descendant); return SNFH_SUCCESS_PROCEED; } @@ -2855,14 +2854,14 @@ } KeyboardFocusManager manager = getCurrentKeyboardFocusManager(); - if (focusLog.isLoggable(Level.FINER)) { + if (focusLog.isLoggable(PlatformLogger.FINER)) { if (event instanceof FocusEvent || event instanceof WindowEvent) { - focusLog.log(Level.FINER, ">>> {0}", new Object[] {String.valueOf(event)}); + focusLog.finer(">>> {0}", String.valueOf(event)); } - if (focusLog.isLoggable(Level.FINER) && event instanceof KeyEvent) { - focusLog.log(Level.FINER, " focus owner is {0}", - new Object[] {String.valueOf(manager.getGlobalFocusOwner())}); - focusLog.log(Level.FINER, ">>> {0}", new Object[] {String.valueOf(event)}); + if (focusLog.isLoggable(PlatformLogger.FINER) && event instanceof KeyEvent) { + focusLog.finer(" focus owner is {0}", + String.valueOf(manager.getGlobalFocusOwner())); + focusLog.finer(">>> {0}", String.valueOf(event)); } } @@ -2946,9 +2945,9 @@ } } static void removeLastFocusRequest(Component heavyweight) { - if (log.isLoggable(Level.FINE)) { + if (log.isLoggable(PlatformLogger.FINE)) { if (heavyweight == null) { - log.log(Level.FINE, "Assertion (heavyweight != null) failed"); + log.fine("Assertion (heavyweight != null) failed"); } }