7104625: sun.awt.X11.XEvent is creating 600 MB of char[] for no good reason
Summary: Wrap logging calls with if(){} statements
Reviewed-by: anthony, son
Contributed-by: Federico Tello Gentile <federicotg@gmail.com>
--- a/jdk/src/solaris/classes/sun/awt/X11/XComponentPeer.java Mon Oct 17 19:06:24 2011 -0700
+++ b/jdk/src/solaris/classes/sun/awt/X11/XComponentPeer.java Tue Nov 01 18:01:58 2011 +0300
@@ -466,12 +466,16 @@
if (true) {
switch(e.getID()) {
case PaintEvent.UPDATE:
- log.finer("XCP coalescePaintEvent : UPDATE : add : x = " +
+ 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:
- log.finer("XCP coalescePaintEvent : PAINT : add : x = " +
+ if (log.isLoggable(PlatformLogger.FINER)) {
+ log.finer("XCP coalescePaintEvent : PAINT : add : x = " +
r.x + ", y = " + r.y + ", width = " + r.width + ",height = " + r.height);
+ }
return;
}
}
@@ -1248,7 +1252,9 @@
* ButtonPress, ButtonRelease, KeyPress, KeyRelease, EnterNotify, LeaveNotify, MotionNotify
*/
protected boolean isEventDisabled(XEvent e) {
- enableLog.finest("Component is {1}, checking for disabled event {0}", e, (isEnabled()?"enabled":"disable"));
+ 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()) {
case XConstants.ButtonPress:
@@ -1258,7 +1264,9 @@
case XConstants.EnterNotify:
case XConstants.LeaveNotify:
case XConstants.MotionNotify:
- enableLog.finer("Event {0} is disable", e);
+ if (enableLog.isLoggable(PlatformLogger.FINER)) {
+ enableLog.finer("Event {0} is disable", e);
+ }
return true;
}
}