diff options
author | Roman Kennke <roman@kennke.org> | 2006-07-26 21:14:15 +0000 |
---|---|---|
committer | Roman Kennke <roman@kennke.org> | 2006-07-26 21:14:15 +0000 |
commit | bb55f931505b4f1cb267bf2cc4c6462e10e7e591 (patch) | |
tree | de42027f89d07b7a47b7ec0c0a0ddc497a57b934 | |
parent | d66ca1edeeea4459adce77905fb74b5a39556e2e (diff) | |
download | classpath-bb55f931505b4f1cb267bf2cc4c6462e10e7e591.tar.gz |
2006-07-26 Roman Kennke <kennke@aicas.com>
* java/awt/KeyboardFocusManager.java
(getGlobalFocusOwner): Explicitly check for thread security.
(getGlobalPermanentFocusOwner): Explicitly check for thread security.
(getGlobalFocusedWindow): Explicitly check for thread security.
(getGlobalActiveWindow): Explicitly check for thread security.
(getGlobalCurrentFocusCycleRoot): Explicitly check for thread security.
(getGlobalObject): Added new argument for specifying if
a security check should be performed or not.
(setGlobalObject): Don't check for thread security when
calling getGlobalObject.
-rw-r--r-- | ChangeLog | 13 | ||||
-rw-r--r-- | java/awt/KeyboardFocusManager.java | 32 |
2 files changed, 30 insertions, 15 deletions
@@ -1,3 +1,16 @@ +2006-07-26 Roman Kennke <kennke@aicas.com> + + * java/awt/KeyboardFocusManager.java + (getGlobalFocusOwner): Explicitly check for thread security. + (getGlobalPermanentFocusOwner): Explicitly check for thread security. + (getGlobalFocusedWindow): Explicitly check for thread security. + (getGlobalActiveWindow): Explicitly check for thread security. + (getGlobalCurrentFocusCycleRoot): Explicitly check for thread security. + (getGlobalObject): Added new argument for specifying if + a security check should be performed or not. + (setGlobalObject): Don't check for thread security when + calling getGlobalObject. + 2006-07-26 Andrew John Hughes <gnu_andrew@member.fsf.org> * javax/management/MBeanConstructorInfo.java: diff --git a/java/awt/KeyboardFocusManager.java b/java/awt/KeyboardFocusManager.java index 0b329ba6e..eacbceb7d 100644 --- a/java/awt/KeyboardFocusManager.java +++ b/java/awt/KeyboardFocusManager.java @@ -320,7 +320,7 @@ public abstract class KeyboardFocusManager */ protected Component getGlobalFocusOwner () { - return (Component) getGlobalObject(currentFocusOwners); + return (Component) getGlobalObject(currentFocusOwners, true); } /** @@ -403,7 +403,7 @@ public abstract class KeyboardFocusManager */ protected Component getGlobalPermanentFocusOwner () { - return (Component) getGlobalObject (currentPermanentFocusOwners); + return (Component) getGlobalObject (currentPermanentFocusOwners, true); } /** @@ -449,7 +449,7 @@ public abstract class KeyboardFocusManager */ protected Window getGlobalFocusedWindow () { - return (Window) getGlobalObject (currentFocusedWindows); + return (Window) getGlobalObject (currentFocusedWindows, true); } /** @@ -491,7 +491,7 @@ public abstract class KeyboardFocusManager */ protected Window getGlobalActiveWindow() { - return (Window) getGlobalObject (currentActiveWindows); + return (Window) getGlobalObject (currentActiveWindows, true); } /** @@ -657,7 +657,7 @@ public abstract class KeyboardFocusManager */ protected Container getGlobalCurrentFocusCycleRoot () { - return (Container) getGlobalObject (currentFocusCycleRoots); + return (Container) getGlobalObject (currentFocusCycleRoots, true); } /** @@ -1347,17 +1347,19 @@ public abstract class KeyboardFocusManager * @see #getGlobalActiveWindow() * @see #getGlobalCurrentFocusCycleRoot() */ - private Object getGlobalObject (Map globalMap) + private Object getGlobalObject (Map globalMap, boolean checkThread) { - ThreadGroup currentGroup = Thread.currentThread ().getThreadGroup (); - KeyboardFocusManager managerForCallingThread - = (KeyboardFocusManager) currentKeyboardFocusManagers.get (currentGroup); - - if (this != managerForCallingThread) - throw new SecurityException ("Attempted to retrieve an object from a " - + "keyboard focus manager that isn't " - + "associated with the current thread group."); + if (checkThread) + { + ThreadGroup currentGroup = Thread.currentThread ().getThreadGroup (); + KeyboardFocusManager managerForCallingThread = + (KeyboardFocusManager) currentKeyboardFocusManagers.get(currentGroup); + if (this != managerForCallingThread) + throw new SecurityException ("Attempted to retrieve an object from a " + + "keyboard focus manager that isn't " + + "associated with the current thread group."); + } synchronized (globalMap) { Collection globalObjects = globalMap.values (); @@ -1398,7 +1400,7 @@ public abstract class KeyboardFocusManager synchronized (globalMap) { // Save old object. - Object oldObject = getGlobalObject (globalMap); + Object oldObject = getGlobalObject(globalMap, false); // Nullify old object. Collection threadGroups = globalMap.keySet (); |