jdk/src/solaris/classes/sun/awt/X11/XWindowPeer.java
changeset 4191 ca8d3ef845c8
parent 2810 fa49c6a06baf
child 4214 0fa32d38146b
--- 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;
                 }