6664512: Component and [Default]KeyboardFocusManager pass security sensitive objects to loggers
authordcherepanov
Thu, 20 Aug 2009 12:46:43 +0400
changeset 4191 ca8d3ef845c8
parent 4190 227655c2ff8c
child 4192 34d923c996e4
6664512: Component and [Default]KeyboardFocusManager pass security sensitive objects to loggers Summary: toString is called on security sensitive objects Reviewed-by: art, hawtin
jdk/src/share/classes/java/awt/Component.java
jdk/src/share/classes/java/awt/DefaultKeyboardFocusManager.java
jdk/src/share/classes/java/awt/KeyboardFocusManager.java
jdk/src/share/classes/sun/awt/DebugSettings.java
jdk/src/solaris/classes/sun/awt/X11/XBaseWindow.java
jdk/src/solaris/classes/sun/awt/X11/XCheckboxMenuItemPeer.java
jdk/src/solaris/classes/sun/awt/X11/XComponentPeer.java
jdk/src/solaris/classes/sun/awt/X11/XContentWindow.java
jdk/src/solaris/classes/sun/awt/X11/XDecoratedPeer.java
jdk/src/solaris/classes/sun/awt/X11/XDropTargetProtocol.java
jdk/src/solaris/classes/sun/awt/X11/XFocusProxyWindow.java
jdk/src/solaris/classes/sun/awt/X11/XFramePeer.java
jdk/src/solaris/classes/sun/awt/X11/XIconWindow.java
jdk/src/solaris/classes/sun/awt/X11/XInputMethod.java
jdk/src/solaris/classes/sun/awt/X11/XMenuItemPeer.java
jdk/src/solaris/classes/sun/awt/X11/XNETProtocol.java
jdk/src/solaris/classes/sun/awt/X11/XProtocol.java
jdk/src/solaris/classes/sun/awt/X11/XQueryTree.java
jdk/src/solaris/classes/sun/awt/X11/XToolkit.java
jdk/src/solaris/classes/sun/awt/X11/XTrayIconPeer.java
jdk/src/solaris/classes/sun/awt/X11/XWM.java
jdk/src/solaris/classes/sun/awt/X11/XWindow.java
jdk/src/solaris/classes/sun/awt/X11/XWindowPeer.java
jdk/src/windows/classes/sun/awt/windows/WMenuItemPeer.java
jdk/src/windows/classes/sun/awt/windows/WPanelPeer.java
--- a/jdk/src/share/classes/java/awt/Component.java	Tue Aug 18 20:47:13 2009 -0700
+++ b/jdk/src/share/classes/java/awt/Component.java	Thu Aug 20 12:46:43 2009 +0400
@@ -4477,7 +4477,7 @@
         }
 
         if (eventLog.isLoggable(Level.FINEST)) {
-            eventLog.log(Level.FINEST, "{0}", e);
+            eventLog.log(Level.FINEST, "{0}", String.valueOf(e));
         }
 
         /*
--- a/jdk/src/share/classes/java/awt/DefaultKeyboardFocusManager.java	Tue Aug 18 20:47:13 2009 -0700
+++ b/jdk/src/share/classes/java/awt/DefaultKeyboardFocusManager.java	Thu Aug 20 12:46:43 2009 +0400
@@ -380,7 +380,7 @@
                     // should receive focus first
                     if (focusLog.isLoggable(Level.FINER)) {
                         focusLog.log(Level.FINER, "tempLost {0}, toFocus {1}",
-                                     new Object[]{tempLost, toFocus});
+                                     new Object[]{String.valueOf(tempLost), String.valueOf(toFocus)});
                     }
                     if (tempLost != null) {
                         tempLost.requestFocusInWindow(CausedFocusEvent.Cause.ACTIVATION);
@@ -448,7 +448,8 @@
                 Component newFocusOwner = fe.getComponent();
                 if (oldFocusOwner == newFocusOwner) {
                     if (focusLog.isLoggable(Level.FINE)) {
-                        focusLog.log(Level.FINE, "Skipping {0} because focus owner is the same", new Object[] {e});
+                        focusLog.log(Level.FINE, "Skipping {0} because focus owner is the same",
+                                                 new Object[] {String.valueOf(e)});
                     }
                     // We can't just drop the event - there could be
                     // type-ahead markers associated with it.
@@ -565,16 +566,20 @@
                 FocusEvent fe = (FocusEvent)e;
                 Component currentFocusOwner = getGlobalFocusOwner();
                 if (currentFocusOwner == null) {
-                    if (focusLog.isLoggable(Level.FINE)) focusLog.log(Level.FINE, "Skipping {0} because focus owner is null",
-                                                                        new Object[] {e});
+                    if (focusLog.isLoggable(Level.FINE)) {
+                        focusLog.log(Level.FINE, "Skipping {0} because focus owner is null",
+                                                 new Object[] {String.valueOf(e)});
+                    }
                     break;
                 }
                 // Ignore cases where a Component loses focus to itself.
                 // If we make a mistake because of retargeting, then the
                 // FOCUS_GAINED handler will correct it.
                 if (currentFocusOwner == fe.getOppositeComponent()) {
-                    if (focusLog.isLoggable(Level.FINE)) focusLog.log(Level.FINE, "Skipping {0} because current focus owner is equal to opposite",
-                                                                      new Object[] {e});
+                    if (focusLog.isLoggable(Level.FINE)) {
+                        focusLog.log(Level.FINE, "Skipping {0} because current focus owner is equal to opposite",
+                                                 new Object[] {String.valueOf(e)});
+                    }
                     break;
                 }
 
@@ -642,9 +647,11 @@
                 Window losingFocusWindow = we.getWindow();
                 Window activeWindow = getGlobalActiveWindow();
                 Window oppositeWindow = we.getOppositeWindow();
-                if (focusLog.isLoggable(Level.FINE)) focusLog.log(Level.FINE, "Active {0}, Current focused {1}, losing focus {2} opposite {3}",
-                                                                  new Object[] {activeWindow, currentFocusedWindow,
-                                                                                losingFocusWindow, oppositeWindow});
+                if (focusLog.isLoggable(Level.FINE)) {
+                    focusLog.log(Level.FINE, "Active {0}, Current focused {1}, losing focus {2} opposite {3}",
+                                 new Object[] {String.valueOf(activeWindow), String.valueOf(currentFocusedWindow),
+                                               String.valueOf(losingFocusWindow), String.valueOf(oppositeWindow)});
+                }
                 if (currentFocusedWindow == null) {
                     break;
                 }
@@ -828,7 +835,10 @@
                         }
                     }
                     if (ke != null) {
-                        focusLog.log(Level.FINER, "Pumping approved event {0}", new Object[] {ke});
+                        if (focusLog.isLoggable(Level.FINER)) {
+                            focusLog.log(Level.FINER, "Pumping approved event {0}",
+                                                      new Object[] {String.valueOf(ke)});
+                        }
                         enqueuedKeyEvents.removeFirst();
                     }
                 }
@@ -850,7 +860,7 @@
                     Iterator iter = typeAheadMarkers.iterator();
                     while (iter.hasNext()) {
                         TypeAheadMarker marker = (TypeAheadMarker)iter.next();
-                        focusLog.log(Level.FINEST, "    {0}", marker);
+                        focusLog.log(Level.FINEST, "    {0}", String.valueOf(marker));
                     }
                 }
             }
@@ -878,7 +888,10 @@
                         // The fix is rolled out.
 
                         if (ke.getWhen() > marker.after) {
-                            focusLog.log(Level.FINER, "Storing event {0} because of marker {1}", new Object[] {ke, marker});
+                            if (focusLog.isLoggable(Level.FINER)) {
+                                focusLog.log(Level.FINER, "Storing event {0} because of marker {1}",
+                                             new Object[] {String.valueOf(ke), String.valueOf(marker)});
+                            }
                             enqueuedKeyEvents.addLast(ke);
                             return true;
                         }
@@ -890,7 +903,10 @@
             }
 
             case FocusEvent.FOCUS_GAINED:
-                focusLog.log(Level.FINEST, "Markers before FOCUS_GAINED on {0}", new Object[] {target});
+                if (focusLog.isLoggable(Level.FINEST)) {
+                    focusLog.log(Level.FINEST, "Markers before FOCUS_GAINED on {0}",
+                                 new Object[] {String.valueOf(target)});
+                }
                 dumpMarkers();
                 // Search the marker list for the first marker tied to
                 // the Component which just gained focus. Then remove
@@ -919,10 +935,14 @@
                         }
                     } else {
                         // Exception condition - event without marker
-                        focusLog.log(Level.FINER, "Event without marker {0}", e);
+                        if (focusLog.isLoggable(Level.FINER)) {
+                            focusLog.log(Level.FINER, "Event without marker {0}", String.valueOf(e));
+                        }
                     }
                 }
+
                 focusLog.log(Level.FINEST, "Markers after FOCUS_GAINED");
+
                 dumpMarkers();
 
                 redispatchEvent(target, e);
@@ -1159,8 +1179,10 @@
             return;
         }
 
-        focusLog.log(Level.FINER, "Enqueue at {0} for {1}",
-                     new Object[] {after, untilFocused});
+        if (focusLog.isLoggable(Level.FINER)) {
+            focusLog.log(Level.FINER, "Enqueue at {0} for {1}",
+                         new Object[] {after, String.valueOf(untilFocused)});
+        }
 
         int insertionIndex = 0,
             i = typeAheadMarkers.size();
@@ -1199,8 +1221,10 @@
             return;
         }
 
-        focusLog.log(Level.FINER, "Dequeue at {0} for {1}",
-                     new Object[] {after, untilFocused});
+        if (focusLog.isLoggable(Level.FINER)) {
+            focusLog.log(Level.FINER, "Dequeue at {0} for {1}",
+                         new Object[] {after, String.valueOf(untilFocused)});
+        }
 
         TypeAheadMarker marker;
         ListIterator iter = typeAheadMarkers.listIterator
--- a/jdk/src/share/classes/java/awt/KeyboardFocusManager.java	Tue Aug 18 20:47:13 2009 -0700
+++ b/jdk/src/share/classes/java/awt/KeyboardFocusManager.java	Thu Aug 20 12:46:43 2009 +0400
@@ -611,7 +611,7 @@
     void setNativeFocusOwner(Component comp) {
         if (focusLog.isLoggable(Level.FINEST)) {
             focusLog.log(Level.FINEST, "Calling peer {0} setCurrentFocusOwner for {1}",
-                         new Object[] {peer, comp});
+                         new Object[] {String.valueOf(peer), String.valueOf(comp)});
         }
         peer.setCurrentFocusOwner(comp);
     }
@@ -2363,20 +2363,20 @@
         Window nativeFocusedWindow = thisManager.getNativeFocusedWindow();
         if (focusLog.isLoggable(Level.FINER)) {
             focusLog.log(Level.FINER, "SNFH for {0} in {1}",
-                         new Object[] {descendant, heavyweight});
+                         new Object[] {String.valueOf(descendant), String.valueOf(heavyweight)});
         }
         if (focusLog.isLoggable(Level.FINEST)) {
             focusLog.log(Level.FINEST, "0. Current focus owner {0}",
-                         currentFocusOwner);
+                         String.valueOf(currentFocusOwner));
             focusLog.log(Level.FINEST, "0. Native focus owner {0}",
-                         nativeFocusOwner);
+                         String.valueOf(nativeFocusOwner));
             focusLog.log(Level.FINEST, "0. Native focused window {0}",
-                         nativeFocusedWindow);
+                         String.valueOf(nativeFocusedWindow));
         }
         synchronized (heavyweightRequests) {
             HeavyweightFocusRequest hwFocusRequest = getLastHWRequest();
             if (focusLog.isLoggable(Level.FINEST)) {
-                focusLog.log(Level.FINEST, "Request {0}", hwFocusRequest);
+                focusLog.log(Level.FINEST, "Request {0}", String.valueOf(hwFocusRequest));
             }
             if (hwFocusRequest == null &&
                 heavyweight == nativeFocusOwner)
@@ -2385,7 +2385,7 @@
                     // Redundant request.
                     if (focusLog.isLoggable(Level.FINEST))
                         focusLog.log(Level.FINEST, "1. SNFH_FAILURE for {0}",
-                                     descendant);
+                                     String.valueOf(descendant));
                     return SNFH_FAILURE;
                 }
 
@@ -2418,7 +2418,7 @@
                 SunToolkit.postEvent(descendant.appContext, newFocusOwnerEvent);
 
                 if (focusLog.isLoggable(Level.FINEST))
-                    focusLog.log(Level.FINEST, "2. SNFH_HANDLED for {0}", descendant);
+                    focusLog.log(Level.FINEST, "2. SNFH_HANDLED for {0}", String.valueOf(descendant));
                 return SNFH_SUCCESS_HANDLED;
             } else if (hwFocusRequest != null &&
                        hwFocusRequest.heavyweight == heavyweight) {
@@ -2857,11 +2857,12 @@
         KeyboardFocusManager manager = getCurrentKeyboardFocusManager();
         if (focusLog.isLoggable(Level.FINER)) {
             if (event instanceof FocusEvent || event instanceof WindowEvent) {
-                focusLog.log(Level.FINER, ">>> {0}", new Object[] {event});
+                focusLog.log(Level.FINER, ">>> {0}", new Object[] {String.valueOf(event)});
             }
             if (focusLog.isLoggable(Level.FINER) && event instanceof KeyEvent) {
-                focusLog.log(Level.FINER, "    focus owner is {0}", new Object[] {manager.getGlobalFocusOwner()});
-                focusLog.log(Level.FINER, ">>> {0}", new Object[] {event});
+                focusLog.log(Level.FINER, "    focus owner is {0}",
+                                          new Object[] {String.valueOf(manager.getGlobalFocusOwner())});
+                focusLog.log(Level.FINER, ">>> {0}", new Object[] {String.valueOf(event)});
             }
         }
 
--- a/jdk/src/share/classes/sun/awt/DebugSettings.java	Tue Aug 18 20:47:13 2009 -0700
+++ b/jdk/src/share/classes/sun/awt/DebugSettings.java	Thu Aug 20 12:46:43 2009 +0400
@@ -129,7 +129,7 @@
 
         // echo the initial property settings to stdout
         if (log.isLoggable(Level.FINE)) {
-            log.log(Level.FINE, "DebugSettings:\n{0}", this);
+            log.log(Level.FINE, "DebugSettings:\n{0}", String.valueOf(this));
         }
     }
 
--- a/jdk/src/solaris/classes/sun/awt/X11/XBaseWindow.java	Tue Aug 18 20:47:13 2009 -0700
+++ b/jdk/src/solaris/classes/sun/awt/X11/XBaseWindow.java	Thu Aug 20 12:46:43 2009 +0400
@@ -824,7 +824,9 @@
      * The active grab overrides activated automatic grab.
      */
     public boolean grabInput() {
-        grabLog.log(Level.FINE, "Grab input on {0}", new Object[] {this});
+        if (grabLog.isLoggable(Level.FINE)) {
+            grabLog.log(Level.FINE, "Grab input on {0}", new Object[] {String.valueOf(this)});
+        }
 
         XToolkit.awtLock();
         try {
@@ -887,7 +889,10 @@
         XToolkit.awtLock();
         try {
             XBaseWindow grabWindow = XAwtState.getGrabWindow();
-            grabLog.log(Level.FINE, "UnGrab input on {0}", new Object[] {grabWindow});
+            if (grabLog.isLoggable(Level.FINE)) {
+                grabLog.log(Level.FINE, "UnGrab input on {0}",
+                                        new Object[] {String.valueOf(grabWindow)});
+            }
             if (grabWindow != null) {
                 grabWindow.ungrabInputImpl();
                 if (!XToolkit.getSunAwtDisableGrab()) {
@@ -940,7 +945,7 @@
             XPropertyCache.clearCache(window, XAtom.get(msg.get_atom()));
         }
         if (eventLog.isLoggable(Level.FINER)) {
-            eventLog.log(Level.FINER, "{0}", new Object[] {msg});
+            eventLog.log(Level.FINER, "{0}", new Object[] {String.valueOf(msg)});
         }
     }
 
@@ -1021,8 +1026,10 @@
     }
     public void handleConfigureNotifyEvent(XEvent xev) {
         XConfigureEvent xe = xev.get_xconfigure();
-        insLog.log(Level.FINER, "Configure, {0}",
-                   new Object[] {xe});
+        if (insLog.isLoggable(Level.FINER)) {
+            insLog.log(Level.FINER, "Configure, {0}",
+                       new Object[] {String.valueOf(xe)});
+        }
         x = xe.get_x();
         y = xe.get_y();
         width = xe.get_width();
--- a/jdk/src/solaris/classes/sun/awt/X11/XCheckboxMenuItemPeer.java	Tue Aug 18 20:47:13 2009 -0700
+++ b/jdk/src/solaris/classes/sun/awt/X11/XCheckboxMenuItemPeer.java	Thu Aug 20 12:46:43 2009 +0400
@@ -29,8 +29,6 @@
 import java.awt.peer.*;
 import java.awt.event.*;
 
-import java.util.logging.*;
-
 import java.lang.reflect.Field;
 import sun.awt.SunToolkit;
 
@@ -42,8 +40,6 @@
      *
      ************************************************/
 
-    private static Logger log = Logger.getLogger("sun.awt.X11.XCheckboxMenuItemPeer");
-
     /*
      * CheckboxMenuItem's fields
      */
--- a/jdk/src/solaris/classes/sun/awt/X11/XComponentPeer.java	Tue Aug 18 20:47:13 2009 -0700
+++ b/jdk/src/solaris/classes/sun/awt/X11/XComponentPeer.java	Thu Aug 20 12:46:43 2009 +0400
@@ -253,7 +253,9 @@
      * Called when component receives focus
      */
     public void focusGained(FocusEvent e) {
-        focusLog.log(Level.FINE, "{0}", new Object[] {e});
+        if (focusLog.isLoggable(Level.FINE)) {
+            focusLog.log(Level.FINE, "{0}", new Object[] {String.valueOf(e)});
+        }
         bHasFocus = true;
     }
 
@@ -261,7 +263,9 @@
      * Called when component loses focus
      */
     public void focusLost(FocusEvent e) {
-        focusLog.log(Level.FINE, "{0}", new Object[] {e});
+        if (focusLog.isLoggable(Level.FINE)) {
+            focusLog.log(Level.FINE, "{0}", new Object[] {String.valueOf(e)});
+        }
         bHasFocus = false;
     }
 
@@ -414,7 +418,10 @@
      * @see java.awt.peer.ComponentPeer
      */
     public void setEnabled(boolean value) {
-        enableLog.log(Level.FINE, "{0}ing {1}", new Object[] {(value?"Enabl":"Disabl"), this});
+        if (enableLog.isLoggable(Level.FINE)) {
+            enableLog.log(Level.FINE, "{0}ing {1}",
+                          new Object[] {(value?"Enabl":"Disabl"), String.valueOf(this)});
+        }
         boolean repaintNeeded = (enabled != value);
         enabled = value;
         if (target instanceof Container) {
@@ -1262,7 +1269,10 @@
      * ButtonPress, ButtonRelease, KeyPress, KeyRelease, EnterNotify, LeaveNotify, MotionNotify
      */
     protected boolean isEventDisabled(XEvent e) {
-        enableLog.log(Level.FINEST, "Component is {1}, checking for disabled event {0}", new Object[] {e, (isEnabled()?"enabled":"disable")});
+        if (enableLog.isLoggable(Level.FINEST)) {
+            enableLog.log(Level.FINEST, "Component is {1}, checking for disabled event {0}",
+                          new Object[] {String.valueOf(e), (isEnabled()?"enabled":"disable")});
+        }
         if (!isEnabled()) {
             switch (e.get_type()) {
               case XConstants.ButtonPress:
@@ -1272,7 +1282,9 @@
               case XConstants.EnterNotify:
               case XConstants.LeaveNotify:
               case XConstants.MotionNotify:
-                  enableLog.log(Level.FINER, "Event {0} is disable", new Object[] {e});
+                  if (enableLog.isLoggable(Level.FINER)) {
+                      enableLog.log(Level.FINER, "Event {0} is disable", new Object[] {String.valueOf(e)});
+                  }
                   return true;
             }
         }
--- a/jdk/src/solaris/classes/sun/awt/X11/XContentWindow.java	Tue Aug 18 20:47:13 2009 -0700
+++ b/jdk/src/solaris/classes/sun/awt/X11/XContentWindow.java	Thu Aug 20 12:46:43 2009 +0400
@@ -116,8 +116,10 @@
             if (in != null) {
                 newBounds.setLocation(-in.left, -in.top);
             }
-            if (insLog.isLoggable(Level.FINE)) insLog.log(Level.FINE, "Setting content bounds {0}, old bounds {1}",
-                                                          new Object[] {newBounds, getBounds()});
+            if (insLog.isLoggable(Level.FINE)) {
+                insLog.log(Level.FINE, "Setting content bounds {0}, old bounds {1}",
+                           new Object[] {String.valueOf(newBounds), String.valueOf(getBounds())});
+            }
             // Fix for 5023533:
             // Change in the size of the content window means, well, change of the size
             // Change in the location of the content window means change in insets
--- a/jdk/src/solaris/classes/sun/awt/X11/XDecoratedPeer.java	Tue Aug 18 20:47:13 2009 -0700
+++ b/jdk/src/solaris/classes/sun/awt/X11/XDecoratedPeer.java	Thu Aug 20 12:46:43 2009 +0400
@@ -79,7 +79,9 @@
         Rectangle bounds = (Rectangle)params.get(BOUNDS);
         dimensions = new WindowDimensions(bounds, getRealInsets(), false);
         params.put(BOUNDS, dimensions.getClientRect());
-        insLog.log(Level.FINE, "Initial dimensions {0}", new Object[] { dimensions });
+        if (insLog.isLoggable(Level.FINE)) {
+            insLog.log(Level.FINE, "Initial dimensions {0}",new Object[] { String.valueOf(dimensions) });
+        }
 
         // Deny default processing of these events on the shell - proxy will take care of
         // them instead
@@ -265,7 +267,10 @@
             wm_set_insets = XWM.getInsetsFromProp(getWindow(), changedAtom);
         }
 
-        insLog.log(Level.FINER, "FRAME_EXTENTS: {0}", new Object[]{wm_set_insets});
+        if (insLog.isLoggable(Level.FINER)) {
+            insLog.log(Level.FINER, "FRAME_EXTENTS: {0}",
+                       new Object[]{String.valueOf(wm_set_insets)});
+        }
 
         if (wm_set_insets != null) {
             wm_set_insets = copy(wm_set_insets);
@@ -331,7 +336,10 @@
                 // Check if we have insets provided by the WM
                 Insets correctWM = getWMSetInsets(null);
                 if (correctWM != null) {
-                    insLog.log(Level.FINER, "wm-provided insets {0}", new Object[]{correctWM});
+                    if (insLog.isLoggable(Level.FINER)) {
+                        insLog.log(Level.FINER, "wm-provided insets {0}",
+                                   new Object[]{String.valueOf(correctWM)});
+                    }
                     // If these insets are equal to our current insets - no actions are necessary
                     Insets dimInsets = dimensions.getInsets();
                     if (correctWM.equals(dimInsets)) {
@@ -345,7 +353,9 @@
                     correctWM = XWM.getWM().getInsets(this, xe.get_window(), xe.get_parent());
 
                     if (correctWM != null) {
-                        insLog.log(Level.FINER, "correctWM {0}", new Object[] {correctWM});
+                        if (insLog.isLoggable(Level.FINE)) {
+                            insLog.log(Level.FINER, "correctWM {0}", new Object[] {String.valueOf(correctWM)});
+                        }
                     } else {
                         insLog.log(Level.FINER, "correctWM insets are not available, waiting for configureNotify");
                     }
@@ -368,7 +378,10 @@
              * initial insets were wrong (most likely they were).
              */
             Insets correction = difference(correctWM, currentInsets);
-            insLog.log(Level.FINEST, "Corrention {0}", new Object[] {correction});
+            if (insLog.isLoggable(Level.FINEST)) {
+                insLog.log(Level.FINEST, "Corrention {0}",
+                           new Object[] {String.valueOf(correction)});
+            }
             if (!isNull(correction)) {
                 currentInsets = copy(correctWM);
                 applyGuessedInsets();
@@ -453,7 +466,7 @@
         Insets in = copy(getRealInsets());
         in.top += getMenuBarHeight();
         if (insLog.isLoggable(Level.FINEST)) {
-            insLog.log(Level.FINEST, "Get insets returns {0}", new Object[] {in});
+            insLog.log(Level.FINEST, "Get insets returns {0}", new Object[] {String.valueOf(in)});
         }
         return in;
     }
@@ -610,7 +623,7 @@
               break;
         }
         if (insLog.isLoggable(Level.FINE)) insLog.log(Level.FINE, "For the operation {0} new dimensions are {1}",
-                                                      new Object[] {operationToString(operation), dims});
+                                                      new Object[] {operationToString(operation), String.valueOf(dims)});
 
         reshape(dims, operation, userReshape);
     }
@@ -640,7 +653,9 @@
     public void handleConfigureNotifyEvent(XEvent xev) {
         assert (SunToolkit.isAWTLockHeldByCurrentThread());
         XConfigureEvent xe = xev.get_xconfigure();
-        insLog.log(Level.FINE, "Configure notify {0}", new Object[] {xe});
+        if (insLog.isLoggable(Level.FINE)) {
+            insLog.log(Level.FINE, "Configure notify {0}", new Object[] {String.valueOf(xe)});
+        }
 
         // XXX: should really only consider synthetic events, but
         if (isReparented()) {
@@ -732,7 +747,10 @@
                 case XWM.SAWFISH_WM:
                 {
                     Point xlocation = queryXLocation();
-                    if (log.isLoggable(Level.FINE)) log.log(Level.FINE, "New X location: {0}", new Object[]{xlocation});
+                    if (log.isLoggable(Level.FINE)) {
+                        log.log(Level.FINE, "New X location: {0}",
+                                new Object[]{String.valueOf(xlocation)});
+                    }
                     if (xlocation != null) {
                         newLocation = xlocation;
                     }
@@ -749,8 +767,10 @@
                 copy(currentInsets),
                 true);
 
-        insLog.log(Level.FINER, "Insets are {0}, new dimensions {1}",
-                new Object[] {currentInsets, newDimensions});
+        if (insLog.isLoggable(Level.FINER)) {
+            insLog.log(Level.FINER, "Insets are {0}, new dimensions {1}",
+                       new Object[] {String.valueOf(currentInsets), String.valueOf(newDimensions)});
+        }
 
         checkIfOnNewScreen(newDimensions.getBounds());
 
@@ -917,7 +937,7 @@
                 Point location = target.getLocation();
                 if (insLog.isLoggable(Level.FINE))
                     insLog.log(Level.FINE, "getLocationOnScreen {0} not reparented: {1} ",
-                               new Object[] {this, location});
+                               new Object[] {String.valueOf(this), String.valueOf(location)});
                 return location;
             }
         } finally {
@@ -954,7 +974,10 @@
     }
 
     public void setVisible(boolean vis) {
-        log.log(Level.FINER, "Setting {0} to visible {1}", new Object[] {this, Boolean.valueOf(vis)});
+        if (log.isLoggable(Level.FINE)) {
+            log.log(Level.FINER, "Setting {0} to visible {1}",
+                    new Object[] {String.valueOf(this), Boolean.valueOf(vis)});
+        }
         if (vis && !isVisible()) {
             XWM.setShellDecor(this);
             super.setVisible(vis);
@@ -1005,7 +1028,9 @@
     }
 
     private void handleWmTakeFocus(XClientMessageEvent cl) {
-        focusLog.log(Level.FINE, "WM_TAKE_FOCUS on {0}", new Object[]{this});
+        if (focusLog.isLoggable(Level.FINE)) {
+            focusLog.log(Level.FINE, "WM_TAKE_FOCUS on {0}", new Object[]{String.valueOf(this)});
+        }
         requestWindowFocus(cl.get_data(1), true);
     }
 
--- a/jdk/src/solaris/classes/sun/awt/X11/XDropTargetProtocol.java	Tue Aug 18 20:47:13 2009 -0700
+++ b/jdk/src/solaris/classes/sun/awt/X11/XDropTargetProtocol.java	Thu Aug 20 12:46:43 2009 +0400
@@ -117,7 +117,7 @@
         EmbedderRegistryEntry entry = getEmbedderRegistryEntry(toplevel);
 
         if (logger.isLoggable(Level.FINEST)) {
-            logger.log(Level.FINEST, "        entry={0}", new Object[] {entry});
+            logger.log(Level.FINEST, "        entry={0}", new Object[] {String.valueOf(entry)});
         }
         // Window not registered as an embedder for this protocol.
         if (entry == null) {
@@ -138,7 +138,8 @@
         long proxy = entry.getProxy();
 
         if (logger.isLoggable(Level.FINEST)) {
-            logger.log(Level.FINEST, "        proxy={0} toplevel={1}", new Object[] {proxy, toplevel});
+            logger.log(Level.FINEST, "        proxy={0} toplevel={1}",
+                       new Object[] {String.valueOf(proxy), String.valueOf(toplevel)});
         }
         if (proxy == 0) {
             proxy = toplevel;
--- a/jdk/src/solaris/classes/sun/awt/X11/XFocusProxyWindow.java	Tue Aug 18 20:47:13 2009 -0700
+++ b/jdk/src/solaris/classes/sun/awt/X11/XFocusProxyWindow.java	Thu Aug 20 12:46:43 2009 +0400
@@ -34,7 +34,6 @@
  * and therefore X doesn't control focus after we have set it to proxy.
  */
 public class XFocusProxyWindow extends XBaseWindow {
-    private static final Logger focusLog = Logger.getLogger("sun.awt.X11.focus.XFocusProxyWindow");
     XWindowPeer owner;
 
     public XFocusProxyWindow(XWindowPeer owner) {
--- a/jdk/src/solaris/classes/sun/awt/X11/XFramePeer.java	Tue Aug 18 20:47:13 2009 -0700
+++ b/jdk/src/solaris/classes/sun/awt/X11/XFramePeer.java	Thu Aug 20 12:46:43 2009 +0400
@@ -283,7 +283,9 @@
         super.handlePropertyNotify(xev);
         XPropertyEvent ev = xev.get_xproperty();
 
-        log.log(Level.FINER, "Property change {0}", new Object[] {ev});
+        if (log.isLoggable(Level.FINER)) {
+            log.log(Level.FINER, "Property change {0}", new Object[] {String.valueOf(ev)});
+        }
         /*
          * Let's see if this is a window state protocol message, and
          * if it is - decode a new state in terms of java constants.
--- a/jdk/src/solaris/classes/sun/awt/X11/XIconWindow.java	Tue Aug 18 20:47:13 2009 -0700
+++ b/jdk/src/solaris/classes/sun/awt/X11/XIconWindow.java	Thu Aug 20 12:46:43 2009 +0400
@@ -75,7 +75,7 @@
             XIconSize[] res = new XIconSize[count];
             for (int i = 0; i < count; i++, sizes_ptr += XIconSize.getSize()) {
                 res[i] = new XIconSize(sizes_ptr);
-                log.log(Level.FINEST, "sizes_ptr[{1}] = {0}", new Object[] {res[i], Integer.valueOf(i)});
+                log.log(Level.FINEST, "sizes_ptr[{1}] = {0}", new Object[] {String.valueOf(res[i]), Integer.valueOf(i)});
             }
             return res;
         } finally {
@@ -92,7 +92,10 @@
         }
 
         XIconSize[] sizeList = getIconSizes();
-        log.log(Level.FINEST, "Icon sizes: {0}", new Object[] {sizeList});
+
+        if (log.isLoggable(Level.FINEST)) {
+            log.log(Level.FINEST, "Icon sizes: {0}", new Object[] {String.valueOf(sizeList)});
+        }
         if (sizeList == null) {
             // No icon sizes so we simply fall back to 16x16
             return new Dimension(16, 16);
@@ -444,7 +447,9 @@
             }
             Dimension iconSize = getIconSize(width, height);
             if (iconSize != null) {
-                log.log(Level.FINEST, "Icon size: {0}", iconSize);
+                if (log.isLoggable(Level.FINEST)) {
+                    log.log(Level.FINEST, "Icon size: {0}", String.valueOf(iconSize));
+                }
                 iconWidth = iconSize.width;
                 iconHeight = iconSize.height;
             } else {
--- a/jdk/src/solaris/classes/sun/awt/X11/XInputMethod.java	Tue Aug 18 20:47:13 2009 -0700
+++ b/jdk/src/solaris/classes/sun/awt/X11/XInputMethod.java	Thu Aug 20 12:46:43 2009 +0400
@@ -108,7 +108,10 @@
             client = getParent(client);
             peer = (XComponentPeer)XToolkit.targetToPeer(client);
         }
-        log.log(Level.FINE, "Peer is {0}, client is {1}", new Object[] {peer, client});
+        if (log.isLoggable(Level.FINE)) {
+            log.log(Level.FINE, "Peer is {0}, client is {1}",
+                    new Object[] {String.valueOf(peer), String.valueOf(client)});
+        }
 
         if (peer != null)
             return peer;
--- a/jdk/src/solaris/classes/sun/awt/X11/XMenuItemPeer.java	Tue Aug 18 20:47:13 2009 -0700
+++ b/jdk/src/solaris/classes/sun/awt/X11/XMenuItemPeer.java	Thu Aug 20 12:46:43 2009 +0400
@@ -43,8 +43,6 @@
      *
      ************************************************/
 
-    private static Logger log = Logger.getLogger("sun.awt.X11.XMenuItemPeer");
-
     /*
      * Primary members
      */
--- a/jdk/src/solaris/classes/sun/awt/X11/XNETProtocol.java	Tue Aug 18 20:47:13 2009 -0700
+++ b/jdk/src/solaris/classes/sun/awt/X11/XNETProtocol.java	Thu Aug 20 12:46:43 2009 +0400
@@ -54,7 +54,11 @@
 
     private void setInitialState(XWindowPeer window, int state) {
         XAtomList old_state = window.getNETWMState();
-        log.log(Level.FINE, "Current state of the window {0} is {1}", new Object[] {window, old_state});
+        if (log.isLoggable(Level.FINE)) {
+            log.log(Level.FINE, "Current state of the window {0} is {1}",
+                    new Object[] {String.valueOf(window),
+                                  String.valueOf(old_state)});
+        }
         if ((state & Frame.MAXIMIZED_VERT) != 0) {
             old_state.add(XA_NET_WM_STATE_MAXIMIZED_VERT);
         } else {
@@ -65,7 +69,10 @@
         } else {
             old_state.remove(XA_NET_WM_STATE_MAXIMIZED_HORZ);
         }
-        log.log(Level.FINE, "Setting initial state of the window {0} to {1}", new Object[] {window, old_state});
+        if (log.isLoggable(Level.FINE)) {
+            log.log(Level.FINE, "Setting initial state of the window {0} to {1}",
+                    new Object[] {String.valueOf(window), String.valueOf(old_state)});
+        }
         window.setNETWMState(old_state);
     }
 
@@ -180,7 +187,11 @@
             req.set_data(1, state.getAtom());
             // Fix for 6735584: req.data[2] must be set to 0 when only one property is changed
             req.set_data(2, 0);
-            log.log(Level.FINE, "Setting _NET_STATE atom {0} on {1} for {2}", new Object[] {state, window, Boolean.valueOf(isAdd)});
+            if (log.isLoggable(Level.FINE)) {
+                log.log(Level.FINE, "Setting _NET_STATE atom {0} on {1} for {2}",
+                                    new Object[] {String.valueOf(state), String.valueOf(window),
+                                                  Boolean.valueOf(isAdd)});
+            }
             XToolkit.awtLock();
             try {
                 XlibWrapper.XSendEvent(XToolkit.getDisplay(),
@@ -212,13 +223,19 @@
             requestState(window, state, set);
         } else {
             XAtomList net_wm_state = window.getNETWMState();
-            log.log(Level.FINE, "Current state on {0} is {1}", new Object[] {window, net_wm_state});
+            if (log.isLoggable(Level.FINE)) {
+                log.log(Level.FINE, "Current state on {0} is {1}",
+                        new Object[] {String.valueOf(window), net_wm_state});
+            }
             if (!set) {
                 net_wm_state.remove(state);
             } else {
                 net_wm_state.add(state);
             }
-            log.log(Level.FINE, "Setting states on {0} to {1}", new Object[] {window, net_wm_state});
+            if (log.isLoggable(Level.FINE)) {
+                log.log(Level.FINE, "Setting states on {0} to {1}",
+                        new Object[] {String.valueOf(window), net_wm_state});
+            }
             window.setNETWMState(net_wm_state);
         }
         XToolkit.XSync();
--- a/jdk/src/solaris/classes/sun/awt/X11/XProtocol.java	Tue Aug 18 20:47:13 2009 -0700
+++ b/jdk/src/solaris/classes/sun/awt/X11/XProtocol.java	Thu Aug 20 12:46:43 2009 +0400
@@ -54,7 +54,11 @@
         } finally {
             if (firstCheck) {
                 firstCheck = false;
-                log.log(Level.FINE, "{0}:{1} supports {2}", new Object[] {this, listName, protocols});
+                if (log.isLoggable(Level.FINE)) {
+                    log.log(Level.FINE, "{0}:{1} supports {2}",
+                            new Object[] {String.valueOf(this), String.valueOf(listName),
+                                          String.valueOf(protocols)});
+                }
             }
         }
     }
--- a/jdk/src/solaris/classes/sun/awt/X11/XQueryTree.java	Tue Aug 18 20:47:13 2009 -0700
+++ b/jdk/src/solaris/classes/sun/awt/X11/XQueryTree.java	Thu Aug 20 12:46:43 2009 +0400
@@ -32,7 +32,6 @@
 
 public class XQueryTree {
         private static Unsafe unsafe = XlibWrapper.unsafe;
-    private static final Logger log = Logger.getLogger("sun.awt.X11.XQueryTree");
         private boolean __executed = false;
         long _w;
         long root_ptr = unsafe.allocateMemory(Native.getLongSize());
--- a/jdk/src/solaris/classes/sun/awt/X11/XToolkit.java	Tue Aug 18 20:47:13 2009 -0700
+++ b/jdk/src/solaris/classes/sun/awt/X11/XToolkit.java	Thu Aug 20 12:46:43 2009 +0400
@@ -624,7 +624,7 @@
                 }
 
                 if (eventLog.isLoggable(Level.FINER)) {
-                    eventLog.log(Level.FINER, "{0}", ev);
+                    eventLog.log(Level.FINER, "{0}", String.valueOf(ev));
                 }
 
                 // Check if input method consumes the event
@@ -1837,8 +1837,10 @@
             if (timeoutTaskLog.isLoggable(Level.FINER)) {
                 timeoutTaskLog.log(Level.FINER, "XToolkit.schedule(): current time={0}" +
                                    ";  interval={1}" +
-                                   ";  task being added={2}" + ";  tasks before addition={3}", new Object[] {
-                                   Long.valueOf(System.currentTimeMillis()), Long.valueOf(interval), task, timeoutTasks});
+                                   ";  task being added={2}" + ";  tasks before addition={3}",
+                                   new Object[] {Long.valueOf(System.currentTimeMillis()),
+                                                 Long.valueOf(interval), String.valueOf(task),
+                                                 String.valueOf(timeoutTasks)});
             }
 
             if (timeoutTasks == null) {
@@ -1883,7 +1885,8 @@
     private static void callTimeoutTasks() {
         if (timeoutTaskLog.isLoggable(Level.FINER)) {
             timeoutTaskLog.log(Level.FINER, "XToolkit.callTimeoutTasks(): current time={0}" +
-                               ";  tasks={1}",  new Object[] {Long.valueOf(System.currentTimeMillis()), timeoutTasks});
+                               ";  tasks={1}",
+                               new Object[] {Long.valueOf(System.currentTimeMillis()), String.valueOf(timeoutTasks)});
         }
 
         if (timeoutTasks == null || timeoutTasks.isEmpty()) {
@@ -1901,7 +1904,8 @@
 
                 if (timeoutTaskLog.isLoggable(Level.FINER)) {
                     timeoutTaskLog.log(Level.FINER, "XToolkit.callTimeoutTasks(): current time={0}" +
-                                       ";  about to run task={1}", new Object[] {Long.valueOf(currentTime), task});
+                                       ";  about to run task={1}",
+                                       new Object[] {Long.valueOf(currentTime), String.valueOf(task)});
                 }
 
                 try {
@@ -2358,7 +2362,10 @@
             // Wait for selection notify for oops on win
             long event_number = getEventNumber();
             XAtom atom = XAtom.get("WM_S0");
-            eventLog.log(Level.FINER, "WM_S0 selection owner {0}", new Object[] {XlibWrapper.XGetSelectionOwner(getDisplay(), atom.getAtom())});
+            if (eventLog.isLoggable(Level.FINER)) {
+                eventLog.log(Level.FINER, "WM_S0 selection owner {0}",
+                             new Object[] {String.valueOf(XlibWrapper.XGetSelectionOwner(getDisplay(), atom.getAtom()))});
+            }
             XlibWrapper.XConvertSelection(getDisplay(), atom.getAtom(),
                                           XAtom.get("VERSION").getAtom(), oops.getAtom(),
                                           win.getWindow(), XConstants.CurrentTime);
--- a/jdk/src/solaris/classes/sun/awt/X11/XTrayIconPeer.java	Tue Aug 18 20:47:13 2009 -0700
+++ b/jdk/src/solaris/classes/sun/awt/X11/XTrayIconPeer.java	Thu Aug 20 12:46:43 2009 +0400
@@ -129,14 +129,17 @@
                         // If both the height and the width differ from the fixed size then WM
                         // must level at least one side to the fixed size. For some reason it may take
                         // a few hops (even after reparenting) and we have to skip the intermediate ones.
-                        ctrLog.log(Level.FINE, "ConfigureNotify on parent of {0}. Skipping as intermediate resizing.",
-                                   XTrayIconPeer.this);
+                        if (ctrLog.isLoggable(Level.FINE)) {
+                            ctrLog.log(Level.FINE, "ConfigureNotify on parent of {0}. Skipping as intermediate resizing.",
+                                       String.valueOf(XTrayIconPeer.this));
+                        }
                         return;
 
                     } else if (ce.get_height() > TRAY_ICON_HEIGHT) {
-
-                        ctrLog.log(Level.FINE, "ConfigureNotify on parent of {0}. Centering by \"Y\".",
-                                   XTrayIconPeer.this);
+                        if (ctrLog.isLoggable(Level.FINE)) {
+                            ctrLog.log(Level.FINE, "ConfigureNotify on parent of {0}. Centering by \"Y\".",
+                                       String.valueOf(XTrayIconPeer.this));
+                        }
 
                         XlibWrapper.XMoveResizeWindow(XToolkit.getDisplay(), eframeParentID,
                                                       ce.get_x(),
@@ -147,9 +150,10 @@
                         ex_width = 0;
 
                     } else if (ce.get_width() > TRAY_ICON_WIDTH) {
-
-                        ctrLog.log(Level.FINE, "ConfigureNotify on parent of {0}. Centering by \"X\".",
-                                   XTrayIconPeer.this);
+                        if (ctrLog.isLoggable(Level.FINE)) {
+                            ctrLog.log(Level.FINE, "ConfigureNotify on parent of {0}. Centering by \"X\".",
+                                       String.valueOf(XTrayIconPeer.this));
+                        }
 
                         XlibWrapper.XMoveResizeWindow(XToolkit.getDisplay(), eframeParentID,
                                                       ce.get_x()+ce.get_width()/2 - TRAY_ICON_WIDTH/2,
@@ -165,25 +169,32 @@
                         // In this case the parent window also lose centering. We have to restore it.
 
                         if (ex_height != 0) {
-
-                            ctrLog.log(Level.FINE, "ConfigureNotify on parent of {0}. Move detected. Centering by \"Y\".",
-                                       XTrayIconPeer.this);
+                            if (ctrLog.isLoggable(Level.FINE)) {
+                                ctrLog.log(Level.FINE, "ConfigureNotify on parent of {0}." +
+                                           " Move detected. Centering by \"Y\".",
+                                           String.valueOf(XTrayIconPeer.this));
+                            }
 
                             XlibWrapper.XMoveWindow(XToolkit.getDisplay(), eframeParentID,
                                                     ce.get_x(),
                                                     ce.get_y() + ex_height/2 - TRAY_ICON_HEIGHT/2);
 
                         } else if (ex_width != 0) {
-
-                            ctrLog.log(Level.FINE, "ConfigureNotify on parent of {0}. Move detected. Centering by \"X\".",
-                                       XTrayIconPeer.this);
+                            if (ctrLog.isLoggable(Level.FINE)) {
+                                ctrLog.log(Level.FINE, "ConfigureNotify on parent of {0}." +
+                                           "Move detected. Centering by \"X\".",
+                                           String.valueOf(XTrayIconPeer.this));
+                            }
 
                             XlibWrapper.XMoveWindow(XToolkit.getDisplay(), eframeParentID,
                                                     ce.get_x() + ex_width/2 - TRAY_ICON_WIDTH/2,
                                                     ce.get_y());
                         } else {
-                            ctrLog.log(Level.FINE, "ConfigureNotify on parent of {0}. Move detected. Skipping.",
-                                       XTrayIconPeer.this);
+                            if (ctrLog.isLoggable(Level.FINE)) {
+                                ctrLog.log(Level.FINE, "ConfigureNotify on parent of {0}." +
+                                           "Move detected. Skipping.",
+                                           String.valueOf(XTrayIconPeer.this));
+                            }
                         }
                     }
                     old_x = ce.get_x();
--- a/jdk/src/solaris/classes/sun/awt/X11/XWM.java	Tue Aug 18 20:47:13 2009 -0700
+++ b/jdk/src/solaris/classes/sun/awt/X11/XWM.java	Thu Aug 20 12:46:43 2009 +0400
@@ -401,7 +401,10 @@
     static boolean isCDE() {
 
         if (!XA_DT_SM_WINDOW_INFO.isInterned()) {
-            log.log(Level.FINER, "{0} is not interned", new Object[] {XA_DT_SM_WINDOW_INFO});
+            if (log.isLoggable(Level.FINER)) {
+                log.log(Level.FINER, "{0} is not interned",
+                        new Object[] {String.valueOf(XA_DT_SM_WINDOW_INFO)});
+            }
             return false;
         }
 
@@ -432,7 +435,10 @@
 
             /* Now check that this window has _DT_SM_STATE_INFO (ignore contents) */
             if (!XA_DT_SM_STATE_INFO.isInterned()) {
-                log.log(Level.FINER, "{0} is not interned", new Object[] {XA_DT_SM_STATE_INFO});
+                if (log.isLoggable(Level.FINER)) {
+                    log.log(Level.FINER, "{0} is not interned",
+                            new Object[] {String.valueOf(XA_DT_SM_STATE_INFO)});
+                }
                 return false;
             }
             WindowPropertyGetter getter2 =
@@ -596,7 +602,10 @@
          */
 
         if (!XA_ICEWM_WINOPTHINT.isInterned()) {
-            log.log(Level.FINER, "{0} is not interned", new Object[] {XA_ICEWM_WINOPTHINT});
+            if (log.isLoggable(Level.FINER)) {
+                log.log(Level.FINER, "{0} is not interned",
+                        String.valueOf(XA_ICEWM_WINOPTHINT));
+            }
             return false;
         }
 
@@ -629,7 +638,10 @@
      */
     static boolean isIceWM() {
         if (!XA_ICEWM_WINOPTHINT.isInterned()) {
-            log.log(Level.FINER, "{0} is not interned", new Object[] {XA_ICEWM_WINOPTHINT});
+            if (log.isLoggable(Level.FINER)) {
+                log.log(Level.FINER, "{0} is not interned",
+                        new Object[] {String.valueOf(XA_ICEWM_WINOPTHINT)});
+            }
             return false;
         }
 
@@ -1354,7 +1366,9 @@
         XNETProtocol net_protocol = getWM().getNETProtocol();
         if (net_protocol != null && net_protocol.active()) {
             Insets insets = getInsetsFromProp(window, XA_NET_FRAME_EXTENTS);
-            insLog.log(Level.FINE, "_NET_FRAME_EXTENTS: {0}", insets);
+            if (insLog.isLoggable(Level.FINE)) {
+                insLog.log(Level.FINE, "_NET_FRAME_EXTENTS: {0}", String.valueOf(insets));
+            }
 
             if (insets != null) {
                 return insets;
@@ -1495,7 +1509,10 @@
          *       [mwm, e!, kwin, fvwm2 ... ]
          */
         Insets correctWM = XWM.getInsetsFromExtents(window);
-        insLog.log(Level.FINER, "Got insets from property: {0}", correctWM);
+        if (insLog.isLoggable(Level.FINER)) {
+            insLog.log(Level.FINER, "Got insets from property: {0}",
+                       String.valueOf(correctWM));
+        }
 
         if (correctWM == null) {
             correctWM = new Insets(0,0,0,0);
@@ -1556,7 +1573,10 @@
                   }
                   case XWM.OTHER_WM:
                   default: {                /* this is very similar to the E! case above */
-                      insLog.log(Level.FINEST, "Getting correct insets for OTHER_WM/default, parent: {0}", parent);
+                      if (insLog.isLoggable(Level.FINEST)) {
+                          insLog.log(Level.FINEST, "Getting correct insets for OTHER_WM/default, parent: {0}",
+                                     String.valueOf(parent));
+                      }
                       syncTopLevelPos(parent, lwinAttr);
                       int status = XlibWrapper.XGetWindowAttributes(XToolkit.getDisplay(),
                                                                     window, lwinAttr.pData);
@@ -1583,8 +1603,11 @@
                           && lwinAttr.get_width()+2*lwinAttr.get_border_width() == pattr.get_width()
                           && lwinAttr.get_height()+2*lwinAttr.get_border_width() == pattr.get_height())
                       {
-                          insLog.log(Level.FINEST, "Double reparenting detected, pattr({2})={0}, lwinAttr({3})={1}",
-                                     new Object[] {lwinAttr, pattr, parent, window});
+                          if (insLog.isLoggable(Level.FINEST)) {
+                              insLog.log(Level.FINEST, "Double reparenting detected, pattr({2})={0}, lwinAttr({3})={1}",
+                                         new Object[] {String.valueOf(lwinAttr), String.valueOf(pattr),
+                                                       String.valueOf(parent), String.valueOf(window)});
+                          }
                           lwinAttr.set_x(pattr.get_x());
                           lwinAttr.set_y(pattr.get_y());
                           lwinAttr.set_border_width(lwinAttr.get_border_width()+pattr.get_border_width());
@@ -1611,8 +1634,11 @@
                        * widths and inner/outer distinction, so for the time
                        * being, just ignore it.
                        */
-                      insLog.log(Level.FINEST, "Attrs before calculation: pattr({2})={0}, lwinAttr({3})={1}",
-                                 new Object[] {lwinAttr, pattr, parent, window});
+                      if (insLog.isLoggable(Level.FINEST)) {
+                          insLog.log(Level.FINEST, "Attrs before calculation: pattr({2})={0}, lwinAttr({3})={1}",
+                                     new Object[] {String.valueOf(lwinAttr), String.valueOf(pattr),
+                                                   String.valueOf(parent), String.valueOf(window)});
+                      }
                       correctWM = new Insets(lwinAttr.get_y() + lwinAttr.get_border_width(),
                                              lwinAttr.get_x() + lwinAttr.get_border_width(),
                                              pattr.get_height() - (lwinAttr.get_y() + lwinAttr.get_height() + 2*lwinAttr.get_border_width()),
--- a/jdk/src/solaris/classes/sun/awt/X11/XWindow.java	Tue Aug 18 20:47:13 2009 -0700
+++ b/jdk/src/solaris/classes/sun/awt/X11/XWindow.java	Thu Aug 20 12:46:43 2009 +0400
@@ -997,8 +997,10 @@
         Rectangle oldBounds = getBounds();
 
         super.handleConfigureNotifyEvent(xev);
-        insLog.log(Level.FINER, "Configure, {0}, event disabled: {1}",
-                   new Object[] {xev.get_xconfigure(), isEventDisabled(xev)});
+        if (insLog.isLoggable(Level.FINER)) {
+           insLog.log(Level.FINER, "Configure, {0}, event disabled: {1}",
+                      new Object[] {String.valueOf(xev.get_xconfigure()), isEventDisabled(xev)});
+        }
         if (isEventDisabled(xev)) {
             return;
         }
@@ -1017,7 +1019,9 @@
 
     public void handleMapNotifyEvent(XEvent xev) {
         super.handleMapNotifyEvent(xev);
-        log.log(Level.FINE, "Mapped {0}", new Object[] {this});
+        if (log.isLoggable(Level.FINE)) {
+            log.log(Level.FINE, "Mapped {0}", new Object[] {String.valueOf(this)});
+        }
         if (isEventDisabled(xev)) {
             return;
         }
@@ -1333,10 +1337,16 @@
     void updateSizeHints(int x, int y, int width, int height) {
         long flags = XUtilConstants.PSize | (isLocationByPlatform() ? 0 : (XUtilConstants.PPosition | XUtilConstants.USPosition));
         if (!isResizable()) {
-            log.log(Level.FINER, "Window {0} is not resizable", new Object[] {this});
+            if (log.isLoggable(Level.FINER)) {
+                log.log(Level.FINER, "Window {0} is not resizable",
+                        new Object[] {String.valueOf(this)});
+            }
             flags |= XUtilConstants.PMinSize | XUtilConstants.PMaxSize;
         } else {
-            log.log(Level.FINER, "Window {0} is resizable", new Object[] {this});
+            if (keyEventLog.isLoggable(Level.FINER)) {
+                log.log(Level.FINER, "Window {0} is resizable",
+                        new Object[] {String.valueOf(this)});
+            }
         }
         setSizeHints(flags, x, y, width, height);
     }
@@ -1344,10 +1354,16 @@
     void updateSizeHints(int x, int y) {
         long flags = isLocationByPlatform() ? 0 : (XUtilConstants.PPosition | XUtilConstants.USPosition);
         if (!isResizable()) {
-            log.log(Level.FINER, "Window {0} is not resizable", new Object[] {this});
+            if (log.isLoggable(Level.FINER)) {
+                log.log(Level.FINER, "Window {0} is not resizable",
+                        new Object[] {String.valueOf(this)});
+            }
             flags |= XUtilConstants.PMinSize | XUtilConstants.PMaxSize | XUtilConstants.PSize;
         } else {
-            log.log(Level.FINER, "Window {0} is resizable", new Object[] {this});
+            if (log.isLoggable(Level.FINER)) {
+                log.log(Level.FINER, "Window {0} is resizable",
+                        new Object[] {String.valueOf(this)});
+            }
         }
         setSizeHints(flags, x, y, width, height);
     }
--- a/jdk/src/solaris/classes/sun/awt/X11/XWindowPeer.java	Tue Aug 18 20:47:13 2009 -0700
+++ b/jdk/src/solaris/classes/sun/awt/X11/XWindowPeer.java	Thu Aug 20 12:46:43 2009 +0400
@@ -354,7 +354,7 @@
         if (iconLog.isLoggable(Level.FINEST)) {
             iconLog.log(Level.FINEST, ">>> Sizes of icon images:");
             for (Iterator<XIconInfo> i = icons.iterator(); i.hasNext(); ) {
-                iconLog.log(Level.FINEST, "    {0}", i.next());
+                iconLog.log(Level.FINEST, "    {0}", String.valueOf(i.next()));
             }
         }
     }
@@ -769,7 +769,9 @@
     public void handleFocusEvent(XEvent xev) {
         XFocusChangeEvent xfe = xev.get_xfocus();
         FocusEvent fe;
-        focusLog.log(Level.FINE, "{0}", new Object[] {xfe});
+        if (focusLog.isLoggable(Level.FINE)) {
+            focusLog.log(Level.FINE, "{0}", new Object[] {String.valueOf(xfe)});
+        }
         if (isEventDisabled(xev)) {
             return;
         }
@@ -1388,7 +1390,10 @@
             synchronized(getStateLock()) {
                 XDialogPeer blockerPeer = (XDialogPeer) ComponentAccessor.getPeer(d);
                 if (blocked) {
-                    log.log(Level.FINE, "{0} is blocked by {1}", new Object[] { this, blockerPeer});
+                    if (log.isLoggable(Level.FINE)) {
+                        log.log(Level.FINE, "{0} is blocked by {1}",
+                                new Object[] { String.valueOf(this), String.valueOf(blockerPeer)});
+                    }
                     modalBlocker = d;
 
                     if (isReparented() || XWM.isNonReparentingWM()) {
@@ -1866,7 +1871,8 @@
         XCrossingEvent xce = xev.get_xcrossing();
         if (grabLog.isLoggable(Level.FINE)) {
             grabLog.log(Level.FINE, "{0}, when grabbed {1}, contains {2}",
-                        new Object[] {xce, isGrabbed(), containsGlobal(xce.get_x_root(), xce.get_y_root())});
+                        new Object[] {String.valueOf(xce), isGrabbed(),
+                                      containsGlobal(xce.get_x_root(), xce.get_y_root())});
         }
         if (isGrabbed()) {
             // When window is grabbed, all events are dispatched to
@@ -1877,7 +1883,10 @@
             // since it generates MOUSE_ENTERED/MOUSE_EXITED for frame and dialog.
             // (fix for 6390326)
             XBaseWindow target = XToolkit.windowToXWindow(xce.get_window());
-            grabLog.log(Level.FINER, "  -  Grab event target {0}", new Object[] {target});
+            if (grabLog.isLoggable(Level.FINER)) {
+                grabLog.log(Level.FINER, "  -  Grab event target {0}",
+                            new Object[] {String.valueOf(target)});
+            }
             if (target != null && target != this) {
                 target.dispatchEvent(xev);
                 return;
@@ -1890,7 +1899,8 @@
         XMotionEvent xme = xev.get_xmotion();
         if (grabLog.isLoggable(Level.FINE)) {
             grabLog.log(Level.FINER, "{0}, when grabbed {1}, contains {2}",
-                        new Object[] {xme, isGrabbed(), containsGlobal(xme.get_x_root(), xme.get_y_root())});
+                        new Object[] {String.valueOf(xme), isGrabbed(),
+                                      containsGlobal(xme.get_x_root(), xme.get_y_root())});
         }
         if (isGrabbed()) {
             boolean dragging = false;
@@ -1919,7 +1929,10 @@
                 xme.set_x(localCoord.x);
                 xme.set_y(localCoord.y);
             }
-            grabLog.log(Level.FINER, "  -  Grab event target {0}", new Object[] {target});
+            if (grabLog.isLoggable(Level.FINER)) {
+                grabLog.log(Level.FINER, "  -  Grab event target {0}",
+                            new Object[] {String.valueOf(target)});
+            }
             if (target != null) {
                 if (target != getContentXWindow() && target != this) {
                     target.dispatchEvent(xev);
@@ -1953,7 +1966,9 @@
         }
         if (grabLog.isLoggable(Level.FINE)) {
             grabLog.log(Level.FINE, "{0}, when grabbed {1}, contains {2} ({3}, {4}, {5}x{6})",
-                        new Object[] {xbe, isGrabbed(), containsGlobal(xbe.get_x_root(), xbe.get_y_root()), getAbsoluteX(), getAbsoluteY(), getWidth(), getHeight()});
+                        new Object[] {String.valueOf(xbe), isGrabbed(),
+                                      containsGlobal(xbe.get_x_root(), xbe.get_y_root()),
+                                      getAbsoluteX(), getAbsoluteY(), getWidth(), getHeight()});
         }
         if (isGrabbed()) {
             // When window is grabbed, all events are dispatched to
@@ -1962,7 +1977,10 @@
             // translation)
             XBaseWindow target = XToolkit.windowToXWindow(xbe.get_window());
             try {
-                grabLog.log(Level.FINER, "  -  Grab event target {0} (press target {1})", new Object[] {target, pressTarget});
+                if (grabLog.isLoggable(Level.FINER)) {
+                    grabLog.log(Level.FINER, "  -  Grab event target {0} (press target {1})",
+                                new Object[] {String.valueOf(target), String.valueOf(pressTarget)});
+                }
                 if (xbe.get_type() == XConstants.ButtonPress
                     && xbe.get_button() == XConstants.buttons[0])
                 {
@@ -1995,7 +2013,10 @@
                         // Outside this toplevel hierarchy
                         // According to the specification of UngrabEvent, post it
                         // when press occurs outside of the window and not on its owned windows
-                        grabLog.log(Level.FINE, "Generating UngrabEvent on {0} because not inside of shell", this);
+                        if (grabLog.isLoggable(Level.FINE)) {
+                            grabLog.log(Level.FINE, "Generating UngrabEvent on {0} because not inside of shell",
+                                        String.valueOf(this));
+                        }
                         postEventToEventQueue(new sun.awt.UngrabEvent(getEventSource()));
                         return;
                     }
@@ -2013,18 +2034,27 @@
                             // toplevel == null - outside of
                             // hierarchy, toplevel is Dialog - should
                             // send ungrab (but shouldn't for Window)
-                            grabLog.log(Level.FINE, "Generating UngrabEvent on {0} because hierarchy ended", this);
+                            if (grabLog.isLoggable(Level.FINE)) {
+                                grabLog.log(Level.FINE, "Generating UngrabEvent on {0} because hierarchy ended",
+                                            String.valueOf(this));
+                            }
                             postEventToEventQueue(new sun.awt.UngrabEvent(getEventSource()));
                         }
                     } else {
                         // toplevel is null - outside of hierarchy
-                        grabLog.log(Level.FINE, "Generating UngrabEvent on {0} because toplevel is null", this);
+                        if (grabLog.isLoggable(Level.FINE)) {
+                            grabLog.log(Level.FINE, "Generating UngrabEvent on {0} because toplevel is null",
+                                        String.valueOf(this));
+                        }
                         postEventToEventQueue(new sun.awt.UngrabEvent(getEventSource()));
                         return;
                     }
                 } else {
                     // target doesn't map to XAWT window - outside of hierarchy
-                    grabLog.log(Level.FINE, "Generating UngrabEvent on because target is null {0}", this);
+                    if (grabLog.isLoggable(Level.FINE)) {
+                        grabLog.log(Level.FINE, "Generating UngrabEvent on because target is null {0}",
+                                    String.valueOf(this));
+                    }
                     postEventToEventQueue(new sun.awt.UngrabEvent(getEventSource()));
                     return;
                 }
--- a/jdk/src/windows/classes/sun/awt/windows/WMenuItemPeer.java	Tue Aug 18 20:47:13 2009 -0700
+++ b/jdk/src/windows/classes/sun/awt/windows/WMenuItemPeer.java	Thu Aug 20 12:46:43 2009 +0400
@@ -35,7 +35,7 @@
 import java.util.logging.Level;
 
 class WMenuItemPeer extends WObjectPeer implements MenuItemPeer {
-    private static final Logger log = Logger.getLogger("sun.awt.WMenuItemPeer");
+    private static final Logger log = Logger.getLogger("sun.awt.windows.WMenuItemPeer");
 
     static {
         initIDs();
--- a/jdk/src/windows/classes/sun/awt/windows/WPanelPeer.java	Tue Aug 18 20:47:13 2009 -0700
+++ b/jdk/src/windows/classes/sun/awt/windows/WPanelPeer.java	Thu Aug 20 12:46:43 2009 +0400
@@ -34,7 +34,6 @@
 
 class WPanelPeer extends WCanvasPeer implements PanelPeer {
 
-    private static final Logger log = Logger.getLogger("sun.awt.windows.WPanelPeer");
     // ComponentPeer overrides
 
     public void paint(Graphics g) {