2011/10/21 Anthony Petrov <anthony.pet...@oracle.com>:
>
> Could you make a patch, test it, and post it to this mailing list for review
> please?
>

Here's a patch. I tried to follow the style used in other places where
one line if statements are used to avoid calling the logging code.

I hope the patch is acceptable.
# This patch file was generated by NetBeans IDE
# Following Index: paths are relative to: /home/fede/Desarrollo/jdk7/jdk
# This patch can be applied using context Tools: Patch action on respective folder.
# It uses platform neutral UTF-8 encoding and \n newlines.
# Above lines and this line are ignored by the patching process.
Index: src/solaris/classes/sun/awt/X11/XComponentPeer.java
--- src/solaris/classes/sun/awt/X11/XComponentPeer.java Base (BASE)
+++ src/solaris/classes/sun/awt/X11/XComponentPeer.java Locally Modified (Based On LOCAL)
@@ -38,7 +38,6 @@
 import java.awt.GraphicsConfiguration;
 import java.awt.Image;
 import java.awt.Insets;
-import java.awt.KeyboardFocusManager;
 import java.awt.Rectangle;
 import java.awt.SystemColor;
 import java.awt.Toolkit;
@@ -59,13 +58,10 @@
 import java.awt.image.VolatileImage;
 import java.awt.peer.ComponentPeer;
 import java.awt.peer.ContainerPeer;
-import java.awt.peer.LightweightPeer;
 import java.lang.reflect.*;
 import java.security.*;
 import java.util.Collection;
-import java.util.HashSet;
 import java.util.Set;
-import java.util.Vector;
 import sun.util.logging.PlatformLogger;
 
 import sun.awt.*;
@@ -475,10 +471,12 @@
         if (true) {
             switch(e.getID()) {
               case PaintEvent.UPDATE:
+                  if(log.isLoggable(PlatformLogger.FINER)) 
                   log.finer("XCP coalescePaintEvent : UPDATE : add : x = " +
                             r.x + ", y = " + r.y + ", width = " + r.width + ",height = " + r.height);
                   return;
               case PaintEvent.PAINT:
+                  if(log.isLoggable(PlatformLogger.FINER)) 
                   log.finer("XCP coalescePaintEvent : PAINT : add : x = " +
                             r.x + ", y = " + r.y + ", width = " + r.width + ",height = " + r.height);
                   return;
@@ -1257,6 +1255,7 @@
      * ButtonPress, ButtonRelease, KeyPress, KeyRelease, EnterNotify, LeaveNotify, MotionNotify
      */
     protected boolean isEventDisabled(XEvent e) {
+        if(enableLog.isLoggable(PlatformLogger.FINEST))
         enableLog.finest("Component is {1}, checking for disabled event {0}", e, (isEnabled()?"enabled":"disable"));
         if (!isEnabled()) {
             switch (e.get_type()) {
@@ -1267,6 +1266,7 @@
               case XConstants.EnterNotify:
               case XConstants.LeaveNotify:
               case XConstants.MotionNotify:
+                  if(enableLog.isLoggable(PlatformLogger.FINER))
                   enableLog.finer("Event {0} is disable", e);
                   return true;
             }

Reply via email to