6664512: Component and [Default]KeyboardFocusManager pass security sensitive objects to loggers
authordcherepanov
Thu Aug 20 18:20:07 2009 +0400 (6 months ago)
changeset 21939a17e094418
parent 21839a8e48517ce
child 2209b95de10b74e
6664512: Component and [Default]KeyboardFocusManager pass security sensitive objects to loggers
Summary: toString is called on security sensitive objects
Reviewed-by: art, hawtin
src/share/classes/java/awt/Component.java
src/share/classes/java/awt/DefaultKeyboardFocusManager.java
src/share/classes/java/awt/KeyboardFocusManager.java
src/share/classes/sun/awt/DebugSettings.java
src/solaris/classes/sun/awt/X11/XBaseWindow.java
src/solaris/classes/sun/awt/X11/XCheckboxMenuItemPeer.java
src/solaris/classes/sun/awt/X11/XComponentPeer.java
src/solaris/classes/sun/awt/X11/XContentWindow.java
src/solaris/classes/sun/awt/X11/XDecoratedPeer.java
src/solaris/classes/sun/awt/X11/XDropTargetProtocol.java
src/solaris/classes/sun/awt/X11/XFocusProxyWindow.java
src/solaris/classes/sun/awt/X11/XFramePeer.java
src/solaris/classes/sun/awt/X11/XIconWindow.java
src/solaris/classes/sun/awt/X11/XInputMethod.java
src/solaris/classes/sun/awt/X11/XMenuItemPeer.java
src/solaris/classes/sun/awt/X11/XNETProtocol.java
src/solaris/classes/sun/awt/X11/XProtocol.java
src/solaris/classes/sun/awt/X11/XQueryTree.java
src/solaris/classes/sun/awt/X11/XToolkit.java
src/solaris/classes/sun/awt/X11/XTrayIconPeer.java
src/solaris/classes/sun/awt/X11/XWM.java
src/solaris/classes/sun/awt/X11/XWindow.java
src/solaris/classes/sun/awt/X11/XWindowPeer.java
src/solaris/classes/sun/awt/X11InputMethod.java
--- a/src/share/classes/java/awt/Component.java Tue Aug 18 11:13:57 2009 +0800
+++ b/src/share/classes/java/awt/Component.java Thu Aug 20 18:20:07 2009 +0400
@@ -4307,7 +4307,7 @@ public abstract class Component implemen
}
if (eventLog.isLoggable(Level.FINEST)) {
- eventLog.log(Level.FINEST, "{0}", e);
+ eventLog.log(Level.FINEST, "{0}", String.valueOf(e));
}
/*
--- a/src/share/classes/java/awt/DefaultKeyboardFocusManager.java Tue Aug 18 11:13:57 2009 +0800
+++ b/src/share/classes/java/awt/DefaultKeyboardFocusManager.java Thu Aug 20 18:20:07 2009 +0400
@@ -379,7 +379,7 @@ public class DefaultKeyboardFocusManager
// 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);
@@ -447,7 +447,8 @@ public class DefaultKeyboardFocusManager
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.
@@ -554,16 +555,20 @@ public class DefaultKeyboardFocusManager
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;
}
@@ -631,9 +636,11 @@ public class DefaultKeyboardFocusManager
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;
}
@@ -818,7 +825,10 @@ public class DefaultKeyboardFocusManager
}
}
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();
}
}
@@ -840,7 +850,7 @@ public class DefaultKeyboardFocusManager
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));
}
}
}
@@ -868,7 +878,10 @@ public class DefaultKeyboardFocusManager
// 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;
}
@@ -880,7 +893,10 @@ public class DefaultKeyboardFocusManager
}
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
@@ -909,7 +925,9 @@ public class DefaultKeyboardFocusManager
}
} 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");
@@ -1146,8 +1164,10 @@ public class DefaultKeyboardFocusManager
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();
@@ -1186,8 +1206,10 @@ public class DefaultKeyboardFocusManager
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/src/share/classes/java/awt/KeyboardFocusManager.java Tue Aug 18 11:13:57 2009 +0800
+++ b/src/share/classes/java/awt/KeyboardFocusManager.java Thu Aug 20 18:20:07 2009 +0400
@@ -586,7 +586,7 @@ public abstract class KeyboardFocusManag
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);
}
@@ -2338,20 +2338,20 @@ public abstract class KeyboardFocusManag
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)
@@ -2360,7 +2360,7 @@ public abstract class KeyboardFocusManag
// Redundant request.
if (focusLog.isLoggable(Level.FINEST))
focusLog.log(Level.FINEST, "1. SNFH_FAILURE for {0}",
- descendant);
+ String.valueOf(descendant));
return SNFH_FAILURE;
}
@@ -2393,7 +2393,7 @@ public abstract class KeyboardFocusManag
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) {
@@ -2900,11 +2900,11 @@ public abstract class KeyboardFocusManag
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/src/share/classes/sun/awt/DebugSettings.java Tue Aug 18 11:13:57 2009 +0800
+++ b/src/share/classes/sun/awt/DebugSettings.java Thu Aug 20 18:20:07 2009 +0400
@@ -129,7 +129,7 @@ final class DebugSettings {
// 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/src/solaris/classes/sun/awt/X11/XBaseWindow.java Tue Aug 18 11:13:57 2009 +0800
+++ b/src/solaris/classes/sun/awt/X11/XBaseWindow.java Thu Aug 20 18:20:07 2009 +0400
@@ -824,7 +824,9 @@ public class XBaseWindow implements XCon
* 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 {
@@ -879,7 +881,10 @@ public class XBaseWindow implements XCon
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();
XlibWrapper.XUngrabPointer(XToolkit.getDisplay(), CurrentTime);
@@ -930,7 +935,7 @@ public class XBaseWindow implements XCon
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)});
}
}
@@ -1000,8 +1005,10 @@ public class XBaseWindow implements XCon
}
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/src/solaris/classes/sun/awt/X11/XCheckboxMenuItemPeer.java Tue Aug 18 11:13:57 2009 +0800
+++ b/src/solaris/classes/sun/awt/X11/XCheckboxMenuItemPeer.java Thu Aug 20 18:20:07 2009 +0400
@@ -29,8 +29,6 @@ import java.awt.peer.*;
import java.awt.peer.*;
import java.awt.event.*;
-import java.util.logging.*;
-
import java.lang.reflect.Field;
import sun.awt.SunToolkit;
@@ -41,8 +39,6 @@ class XCheckboxMenuItemPeer extends XMen
* Data members
*
************************************************/
-
- private static Logger log = Logger.getLogger("sun.awt.X11.XCheckboxMenuItemPeer");
/*
* CheckboxMenuItem's fields
--- a/src/solaris/classes/sun/awt/X11/XComponentPeer.java Tue Aug 18 11:13:57 2009 +0800
+++ b/src/solaris/classes/sun/awt/X11/XComponentPeer.java Thu Aug 20 18:20:07 2009 +0400
@@ -261,7 +261,9 @@ public class XComponentPeer extends XWin
* Called when component receives focus
*/
public void focusGained(FocusEvent e) {
- focusLog.log(Level.FINE, "{0}", new Object[] {e});
+ if (focusLog.isLoggable(Level.FINER)) {
+ focusLog.log(Level.FINER, "{0}", new Object[] {String.valueOf(e)});
+ }
bHasFocus = true;
}
@@ -269,7 +271,9 @@ public class XComponentPeer extends XWin
* 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;
}
@@ -511,7 +515,10 @@ public class XComponentPeer extends XWin
* @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) {
@@ -1346,7 +1353,10 @@ public class XComponentPeer extends XWin
* 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 ButtonPress:
@@ -1356,7 +1366,9 @@ public class XComponentPeer extends XWin
case EnterNotify:
case LeaveNotify:
case 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/src/solaris/classes/sun/awt/X11/XContentWindow.java Tue Aug 18 11:13:57 2009 +0800
+++ b/src/solaris/classes/sun/awt/X11/XContentWindow.java Thu Aug 20 18:20:07 2009 +0400
@@ -98,8 +98,10 @@ public class XContentWindow extends XWin
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/src/solaris/classes/sun/awt/X11/XDecoratedPeer.java Tue Aug 18 11:13:57 2009 +0800
+++ b/src/solaris/classes/sun/awt/X11/XDecoratedPeer.java Thu Aug 20 18:20:07 2009 +0400
@@ -84,7 +84,11 @@ abstract class XDecoratedPeer extends XW
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
@@ -313,7 +317,10 @@ abstract class XDecoratedPeer extends XW
// 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)) {
@@ -327,7 +334,10 @@ abstract class XDecoratedPeer extends XW
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.FINER)) {
+ insLog.log(Level.FINER, "correctWM {0}",
+ new Object[] {String.valueOf(correctWM)});
+ }
} else {
insLog.log(Level.FINER, "correctWM insets are not available, waiting for configureNotify");
}
@@ -350,7 +360,9 @@ abstract class XDecoratedPeer extends XW
* 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)) {
/*
* Actual insets account for menubar/warning label,
@@ -440,7 +452,10 @@ abstract class XDecoratedPeer extends XW
public Insets getInsets() {
Insets in = copy(getRealInsets());
in.top += getMenuBarHeight() + getWarningWindowHeight();
- if (insLog.isLoggable(Level.FINEST)) insLog.log(Level.FINEST, "Get insets returns {0}", new Object[] {in});
+ if (insLog.isLoggable(Level.FINEST)) {
+ insLog.log(Level.FINEST, "Get insets returns {0}",
+ new Object[] {String.valueOf(in)});
+ }
return in;
}
@@ -589,8 +604,10 @@ abstract class XDecoratedPeer extends XW
dims.setSize(width, height);
break;
}
- if (insLog.isLoggable(Level.FINE)) insLog.log(Level.FINE, "For the operation {0} new dimensions are {1}",
- new Object[] {operationToString(operation), dims});
+ if (insLog.isLoggable(Level.FINE)) {
+ insLog.log(Level.FINE, "For the operation {0} new dimensions are {1}",
+ new Object[] {operationToString(operation), String.valueOf(dims)});
+ }
reshape(dims, operation, userReshape);
}
@@ -660,7 +677,10 @@ abstract class XDecoratedPeer extends XW
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()) {
@@ -752,7 +772,9 @@ abstract class XDecoratedPeer extends XW
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;
}
@@ -769,8 +791,10 @@ abstract class XDecoratedPeer extends XW
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());
@@ -935,7 +959,7 @@ abstract class XDecoratedPeer extends XW
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 {
@@ -972,7 +996,10 @@ abstract class XDecoratedPeer extends XW
}
public void setVisible(boolean vis) {
- log.log(Level.FINER, "Setting {0} to visible {1}", new Object[] {this, Boolean.valueOf(vis)});
+ if (log.isLoggable(Level.FINER)) {
+ 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);
@@ -1027,7 +1054,10 @@ abstract class XDecoratedPeer extends XW
}
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/src/solaris/classes/sun/awt/X11/XDropTargetProtocol.java Tue Aug 18 11:13:57 2009 +0800
+++ b/src/solaris/classes/sun/awt/X11/XDropTargetProtocol.java Thu Aug 20 18:20:07 2009 +0400
@@ -117,7 +117,7 @@ abstract class XDropTargetProtocol {
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 @@ abstract class XDropTargetProtocol {
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/src/solaris/classes/sun/awt/X11/XFocusProxyWindow.java Tue Aug 18 11:13:57 2009 +0800
+++ b/src/solaris/classes/sun/awt/X11/XFocusProxyWindow.java Thu Aug 20 18:20:07 2009 +0400
@@ -34,7 +34,6 @@ import java.util.logging.*;
* 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/src/solaris/classes/sun/awt/X11/XFramePeer.java Tue Aug 18 11:13:57 2009 +0800
+++ b/src/solaris/classes/sun/awt/X11/XFramePeer.java Thu Aug 20 18:20:07 2009 +0400
@@ -281,7 +281,10 @@ class XFramePeer extends XDecoratedPeer
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/src/solaris/classes/sun/awt/X11/XIconWindow.java Tue Aug 18 11:13:57 2009 +0800
+++ b/src/solaris/classes/sun/awt/X11/XIconWindow.java Thu Aug 20 18:20:07 2009 +0400
@@ -75,7 +75,10 @@ public class XIconWindow extends XBaseWi
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)});
+ if (log.isLoggable(Level.FINEST)) {
+ log.log(Level.FINEST, "sizes_ptr[{1}] = {0}",
+ new Object[] {String.valueOf(res[i]), Integer.valueOf(i)});
+ }
}
return res;
} finally {
@@ -92,7 +95,9 @@ public class XIconWindow extends XBaseWi
}
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 +449,9 @@ public class XIconWindow extends XBaseWi
}
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/src/solaris/classes/sun/awt/X11/XInputMethod.java Tue Aug 18 11:13:57 2009 +0800
+++ b/src/solaris/classes/sun/awt/X11/XInputMethod.java Thu Aug 20 18:20:07 2009 +0400
@@ -108,8 +108,10 @@ public class XInputMethod extends X11Inp
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/src/solaris/classes/sun/awt/X11/XMenuItemPeer.java Tue Aug 18 11:13:57 2009 +0800
+++ b/src/solaris/classes/sun/awt/X11/XMenuItemPeer.java Thu Aug 20 18:20:07 2009 +0400
@@ -43,8 +43,6 @@ public class XMenuItemPeer implements Me
*
************************************************/
- private static Logger log = Logger.getLogger("sun.awt.X11.XMenuItemPeer");
-
/*
* Primary members
*/
--- a/src/solaris/classes/sun/awt/X11/XNETProtocol.java Tue Aug 18 11:13:57 2009 +0800
+++ b/src/solaris/classes/sun/awt/X11/XNETProtocol.java Thu Aug 20 18:20:07 2009 +0400
@@ -56,7 +56,11 @@ class XNETProtocol extends XProtocol imp
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 {
@@ -67,7 +71,10 @@ class XNETProtocol extends XProtocol imp
} 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);
}
@@ -191,7 +198,10 @@ class XNETProtocol extends XProtocol imp
req.set_format(32);
req.set_data(0, (!set) ? _NET_WM_STATE_REMOVE : _NET_WM_STATE_ADD);
req.set_data(1, state.getAtom());
- log.log(Level.FINE, "Setting _NET_STATE atom {0} on {1} for {2}", new Object[] {state, window, Boolean.valueOf(set)});
+ 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(set)});
+ }
XToolkit.awtLock();
try {
XlibWrapper.XSendEvent(XToolkit.getDisplay(),
@@ -208,13 +218,19 @@ class XNETProtocol extends XProtocol imp
}
} 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), String.valueOf(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), String.valueOf(net_wm_state)});
+ }
window.setNETWMState(net_wm_state);
}
XToolkit.XSync();
--- a/src/solaris/classes/sun/awt/X11/XProtocol.java Tue Aug 18 11:13:57 2009 +0800
+++ b/src/solaris/classes/sun/awt/X11/XProtocol.java Thu Aug 20 18:20:07 2009 +0400
@@ -68,7 +68,10 @@ class XProtocol {
} 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/src/solaris/classes/sun/awt/X11/XQueryTree.java Tue Aug 18 11:13:57 2009 +0800
+++ b/src/solaris/classes/sun/awt/X11/XQueryTree.java Thu Aug 20 18:20:07 2009 +0400
@@ -32,7 +32,6 @@ import java.util.logging.*;
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/src/solaris/classes/sun/awt/X11/XToolkit.java Tue Aug 18 11:13:57 2009 +0800
+++ b/src/solaris/classes/sun/awt/X11/XToolkit.java Thu Aug 20 18:20:07 2009 +0400
@@ -555,7 +555,7 @@ public class XToolkit extends UNIXToolki
}
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
@@ -1668,8 +1668,10 @@ public class XToolkit extends UNIXToolki
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) {
@@ -1714,7 +1716,8 @@ public class XToolkit extends UNIXToolki
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()) {
@@ -1732,7 +1735,8 @@ public class XToolkit extends UNIXToolki
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 {
--- a/src/solaris/classes/sun/awt/X11/XTrayIconPeer.java Tue Aug 18 11:13:57 2009 +0800
+++ b/src/solaris/classes/sun/awt/X11/XTrayIconPeer.java Thu Aug 20 18:20:07 2009 +0400
@@ -106,10 +106,11 @@ public class XTrayIconPeer implements Tr
}
XConfigureEvent ce = ev.get_xconfigure();
-
- ctrLog.log(Level.FINE, "ConfigureNotify on parent of {0}: {1}x{2}+{3}+{4} (old: {5}+{6})",
- new Object[] { XTrayIconPeer.this, ce.get_width(), ce.get_height(),
- ce.get_x(), ce.get_y(), old_x, old_y });
+ if (ctrLog.isLoggable(Level.FINE)) {
+ ctrLog.log(Level.FINE, "ConfigureNotify on parent of {0}: {1}x{2}+{3}+{4} (old: {5}+{6})",
+ new Object[] { String.valueOf(XTrayIconPeer.this), ce.get_width(), ce.get_height(),
+ ce.get_x(), ce.get_y(), old_x, old_y });
+ }
// A workaround for Gnome/Metacity (it doesn't affect the behaviour on KDE).
// On Metacity the EmbeddedFrame's parent window bounds are larger
@@ -129,15 +130,17 @@ public class XTrayIconPeer implements Tr
// 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(),
ce.get_y()+ce.get_height()/2-TRAY_ICON_HEIGHT/2,
@@ -147,10 +150,10 @@ public class XTrayIconPeer implements Tr
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,
ce.get_y(),
@@ -165,25 +168,27 @@ public class XTrayIconPeer implements Tr
// 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/src/solaris/classes/sun/awt/X11/XWM.java Tue Aug 18 11:13:57 2009 +0800
+++ b/src/solaris/classes/sun/awt/X11/XWM.java Thu Aug 20 18:20:07 2009 +0400
@@ -398,7 +398,10 @@ class XWM implements MWMConstants, XUtil
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;
}
@@ -429,7 +432,10 @@ class XWM implements MWMConstants, XUtil
/* 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 =
@@ -608,7 +614,10 @@ class XWM implements MWMConstants, XUtil
*/
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;
}
@@ -641,7 +650,10 @@ class XWM implements MWMConstants, XUtil
*/
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;
}
@@ -1376,8 +1388,9 @@ class XWM implements MWMConstants, XUtil
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;
}
@@ -1515,7 +1528,9 @@ class XWM implements MWMConstants, XUtil
* [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);
@@ -1576,7 +1591,10 @@ class XWM implements MWMConstants, XUtil
}
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);
@@ -1603,8 +1621,11 @@ class XWM implements MWMConstants, XUtil
&& 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());
@@ -1631,8 +1652,11 @@ class XWM implements MWMConstants, XUtil
* 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/src/solaris/classes/sun/awt/X11/XWindow.java Tue Aug 18 11:13:57 2009 +0800
+++ b/src/solaris/classes/sun/awt/X11/XWindow.java Thu Aug 20 18:20:07 2009 +0400
@@ -901,8 +901,10 @@ public class XWindow extends XBaseWindow
Rectangle oldBounds = getBounds();
super.handleConfigureNotifyEvent(xev);
- insLog.log(Level.FINER, "Configure, {0}, event disabled: {1}",
- new Object[] {xev, isEventDisabled(xev)});
+ if (insLog.isLoggable(Level.FINER)) {
+ insLog.log(Level.FINER, "Configure, {0}, event disabled: {1}",
+ new Object[] {String.valueOf(xev), isEventDisabled(xev)});
+ }
if (isEventDisabled(xev)) {
return;
}
@@ -923,7 +925,9 @@ public class XWindow extends XBaseWindow
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;
}
@@ -1151,10 +1155,14 @@ public class XWindow extends XBaseWindow
void updateSizeHints(int x, int y, int width, int height) {
long flags = XlibWrapper.PSize | (isLocationByPlatform() ? 0 : (XlibWrapper.PPosition | XlibWrapper.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 |= XlibWrapper.PMinSize | XlibWrapper.PMaxSize;
} 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);
}
@@ -1162,10 +1170,14 @@ public class XWindow extends XBaseWindow
void updateSizeHints(int x, int y) {
long flags = isLocationByPlatform() ? 0 : (XlibWrapper.PPosition | XlibWrapper.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 |= XlibWrapper.PMinSize | XlibWrapper.PMaxSize | XlibWrapper.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/src/solaris/classes/sun/awt/X11/XWindowPeer.java Tue Aug 18 11:13:57 2009 +0800
+++ b/src/solaris/classes/sun/awt/X11/XWindowPeer.java Thu Aug 20 18:20:07 2009 +0400
@@ -376,7 +376,7 @@ class XWindowPeer extends XPanelPeer imp
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()));
}
}
}
@@ -826,7 +826,9 @@ class XWindowPeer extends XPanelPeer imp
public void handleFocusEvent(XEvent xev) {
XFocusChangeEvent xfe = xev.get_xfocus();
FocusEvent fe;
- focusLog.log(Level.FINE, "{0}", new Object[] {xfe});
+ if (focusLog.isLoggable(Level.FINER)) {
+ focusLog.log(Level.FINER, "{0}", new Object[] {String.valueOf(xfe)});
+ }
if (isEventDisabled(xev)) {
return;
}
@@ -1438,7 +1440,10 @@ class XWindowPeer extends XPanelPeer imp
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()) {
@@ -1899,7 +1904,9 @@ class XWindowPeer extends XPanelPeer imp
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) {
handleWMSetInsets(wm_set_insets);
@@ -1942,7 +1949,8 @@ class XWindowPeer extends XPanelPeer imp
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
@@ -1953,7 +1961,10 @@ class XWindowPeer extends XPanelPeer imp
// 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;
@@ -1966,7 +1977,8 @@ class XWindowPeer extends XPanelPeer imp
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 = (xme.get_state() & (Button1Mask | Button2Mask | Button3Mask)) != 0;
@@ -1986,7 +1998,10 @@ class XWindowPeer extends XPanelPeer imp
xme.set_x(xme.get_x_root() - target.getX());
xme.set_y(xme.get_y_root() - target.getY());
}
- 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);
@@ -2011,7 +2026,8 @@ class XWindowPeer extends XPanelPeer imp
XButtonEvent xbe = xev.get_xbutton();
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
@@ -2020,7 +2036,10 @@ class XWindowPeer extends XPanelPeer imp
// 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() == XlibWrapper.Button1)
{
@@ -2052,7 +2071,10 @@ class XWindowPeer extends XPanelPeer imp
// 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;
}
@@ -2070,18 +2092,27 @@ class XWindowPeer extends XPanelPeer imp
// 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/src/solaris/classes/sun/awt/X11InputMethod.java Tue Aug 18 11:13:57 2009 +0800
+++ b/src/solaris/classes/sun/awt/X11InputMethod.java Thu Aug 20 18:20:07 2009 +0400
@@ -324,8 +324,11 @@ public abstract class X11InputMethod ext
return;
if (lastXICFocussedComponent != null){
- if (log.isLoggable(Level.FINE)) log.log(Level.FINE, "XICFocused {0}, AWTFocused {1}", new Object[] {
- lastXICFocussedComponent, awtFocussedComponent});
+ if (log.isLoggable(Level.FINE)) {
+ log.log(Level.FINE, "XICFocused {0}, AWTFocused {1}",
+ new Object[] { String.valueOf(lastXICFocussedComponent),
+ String.valueOf(awtFocussedComponent)});
+ }
}
if (pData == 0) {