This is the mail archive of the mauve-patches@sourceware.org mailing list for the Mauve project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

FYI: New KeyboardFocusManager tests


Here come a couple of KeyboardFocusManager related tests that back up my latest patch, and show that we are overly restrictive wrt SecurityExceptions here.

2006-07-26 Roman Kennke <kennke@aicas.com>

* gnu/testlet/java/awt/KeyboardFocusManager/TestKeyboardFocusManager.java,
* gnu/testlet/java/awt/KeyboardFocusManager/getFocusOwner.java,
* gnu/testlet/java/awt/KeyboardFocusManager/getGlobalFocusOwner.java,
* gnu/testlet/java/awt/KeyboardFocusManager/getGlobalPermanentFocusOwner.java:
New tests.


/Roman
Index: java/awt/KeyboardFocusManager.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/awt/KeyboardFocusManager.java,v
retrieving revision 1.18
diff -u -1 -2 -r1.18 KeyboardFocusManager.java
--- java/awt/KeyboardFocusManager.java	26 Jul 2006 19:09:50 -0000	1.18
+++ java/awt/KeyboardFocusManager.java	26 Jul 2006 19:39:28 -0000
@@ -295,47 +295,41 @@
     currentKeyboardFocusManagers.put (currentGroup, manager);
   }
 
   /**
    * Retrieve the {@link Component} that has the keyboard focus, or
    * null if the focus owner was not set by a thread in the current
    * {@link java.lang.ThreadGroup}.
    *
    * @return the keyboard focus owner or null
    */
   public Component getFocusOwner ()
   {
-    Component owner = (Component) getObject (currentFocusOwners);
-    if (owner == null)
-      owner = (Component) getObject (currentPermanentFocusOwners);
-    return owner;
+    return (Component) getObject (currentFocusOwners);
   }
 
   /**
    * Retrieve the {@link Component} that has the keyboard focus,
    * regardless of whether or not it was set by a thread in the
    * current {@link java.lang.ThreadGroup}.  If there is no temporary
    * focus owner in effect then this method will return the same value
    * as {@link #getGlobalPermanentFocusOwner}.
    *
    * @return the keyboard focus owner
    * @throws SecurityException if this is not the keyboard focus
    * manager associated with the current {@link java.lang.ThreadGroup}
    */
   protected Component getGlobalFocusOwner ()
   {
-    // Check if there is a temporary focus owner.
-    Component focusOwner = (Component) getGlobalObject (currentFocusOwners);
-
-    return (focusOwner == null) ? getGlobalPermanentFocusOwner () : focusOwner;
+    return (Component) getGlobalObject(currentFocusOwners);
   }
 
   /**
    * Set the {@link Component} that will be returned by {@link
    * #getFocusOwner} (when it is called from the current {@link
    * java.lang.ThreadGroup}) and {@link #getGlobalFocusOwner}.  This
    * method does not actually transfer the keyboard focus.
    *
    * @param owner the Component to return from getFocusOwner and
    * getGlobalFocusOwner
    *
    * @see Component#requestFocus()

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]