< prev index next >

src/share/classes/java/awt/KeyboardFocusManager.java

Print this page
rev 1571 : 8010297: Missing isLoggable() checks in logging code
Summary: Add isLoggable() checks
Reviewed-by: anthony, mchung, serb
Contributed-by: Laurent Bourges <bourges.laurent@gmail.com>

@@ -2381,12 +2381,13 @@
                                    temporary, currentFocusOwner, cause);
                 // Fix 5028014. Rolled out.
                 // SunToolkit.postPriorityEvent(newFocusOwnerEvent);
                 SunToolkit.postEvent(descendant.appContext, newFocusOwnerEvent);
 
-                if (focusLog.isLoggable(Level.FINEST))
+                if (focusLog.isLoggable(Level.FINEST)) {
                     focusLog.log(Level.FINEST, "2. SNFH_HANDLED for {0}", String.valueOf(descendant));
+                }
                 return SNFH_SUCCESS_HANDLED;
             } else if (hwFocusRequest != null &&
                        hwFocusRequest.heavyweight == heavyweight) {
                 // 'heavyweight' doesn't have the native focus right now, but
                 // if all pending requests were completed, it would. Add

@@ -2395,13 +2396,14 @@
                 if (hwFocusRequest.addLightweightRequest(descendant,
                                                          temporary, cause)) {
                     manager.enqueueKeyEvents(time, descendant);
                 }
 
-                if (focusLog.isLoggable(Level.FINEST))
+                if (focusLog.isLoggable(Level.FINEST)) {
                     focusLog.finest("3. SNFH_HANDLED for lightweight" +
                                     descendant + " in " + heavyweight);
+                }
                 return SNFH_SUCCESS_HANDLED;
             } else {
                 if (!focusedWindowChangeAllowed) {
                     // For purposes of computing oldFocusedWindow, we should look at
                     // the second to last HeavyweightFocusRequest on the queue iff the

@@ -2418,22 +2420,24 @@
                     }
                     if (focusedWindowChanged(heavyweight,
                                              (hwFocusRequest != null)
                                              ? hwFocusRequest.heavyweight
                                              : nativeFocusedWindow)) {
-                        if (focusLog.isLoggable(Level.FINEST))
+                        if (focusLog.isLoggable(Level.FINEST)) {
                             focusLog.finest("4. SNFH_FAILURE for " + descendant);
+                        }
                         return SNFH_FAILURE;
                     }
                 }
 
                 manager.enqueueKeyEvents(time, descendant);
                 heavyweightRequests.add
                     (new HeavyweightFocusRequest(heavyweight, descendant,
                                                  temporary, cause));
-                if (focusLog.isLoggable(Level.FINEST))
+                if (focusLog.isLoggable(Level.FINEST)) {
                     focusLog.finest("5. SNFH_PROCEED for " + descendant);
+                }
                 return SNFH_SUCCESS_PROCEED;
             }
         }
     }
     static void heavyweightButtonDown(Component heavyweight, long time) {
< prev index next >