Toolkit.java (getSystemEventQueue): Call SecurityManager if one is installed.
authorSascha Brawer <brawer@dandelis.ch>
Thu, 11 Sep 2003 16:45:10 +0000 (18:45 +0200)
committerTom Tromey <tromey@gcc.gnu.org>
Thu, 11 Sep 2003 16:45:10 +0000 (16:45 +0000)
2003-09-11  Sascha Brawer  <brawer@dandelis.ch>

* java/awt/Toolkit.java (getSystemEventQueue): Call SecurityManager
if one is installed. Improve Javadoc.
(getSystemEventQueueImpl): Improve Javadoc.

From-SVN: r71308

libjava/ChangeLog
libjava/java/awt/Toolkit.java

index 8a633e6483aff4033f63c12a5481759a58c76771..a1551e6cf4102c756c94a3775e3fa4fa1a9a0f8a 100644 (file)
@@ -1,3 +1,9 @@
+2003-09-11  Sascha Brawer  <brawer@dandelis.ch>
+
+       * java/awt/Toolkit.java (getSystemEventQueue): Call SecurityManager
+       if one is installed. Improve Javadoc.
+       (getSystemEventQueueImpl): Improve Javadoc.
+
 2003-09-11  Tom Tromey  <tromey@redhat.com>
 
        * java/io/natFilePosix.cc (getCanonicalPath): Handle case where
index f8cc6bffa2c8cf101c3e5c50e64214db7b332717..e13bd5f4db14ed9b8b2a5ea670dacddc9eef9417 100644 (file)
@@ -803,23 +803,58 @@ public abstract class Toolkit
     return props.getProperty(key, def);
   }
 
+
   /**
-   * Returns the event queue for the applet.  Despite the word "System"
-   * in the name of this method, there is no guarantee that the same queue
-   * is shared system wide.
+   * Returns the event queue that is suitable for the calling context.
+   *
+   * <p>Despite the word “System” in the name of this
+   * method, a toolkit may provide different event queues for each
+   * applet. There is no guarantee that the same queue is shared
+   * system-wide.
+   *
+   * <p>The implementation first checks whether a
+   * SecurityManager has been installed. If so, its {@link
+   * java.lang.SecurityManager#checkAwtEventQueueAccess()} method gets
+   * called. The security manager will throw a SecurityException if it
+   * does not grant the permission to access the event queue.
    *
-   * @return The event queue for this applet (or application)
+   * <p>Next, the call is delegated to {@link
+   * #getSystemEventQueueImpl()}.
+   *
+   * @return The event queue for this applet (or application).
+   *
+   * @throws SecurityException if a security manager has been
+   * installed, and it does not grant the permission to access the
+   * event queue.
    */
   public final EventQueue getSystemEventQueue()
   {
+    SecurityManager sm;
+
+    sm = System.getSecurityManager();
+    if (sm != null)
+      sm.checkAwtEventQueueAccess();
+
     return getSystemEventQueueImpl();
   }
 
+
   /**
-   * // FIXME: What does this do?
+   * Returns the event queue that is suitable for the calling context.
+   *
+   * <p>Despite the word “,System”, in the name of this
+   * method, a toolkit may provide different event queues for each
+   * applet. There is no guarantee that the same queue is shared
+   * system-wide.
+   *
+   * <p>No security checks are performed, which is why this method
+   * may only be called by Toolkits.
+   *
+   * @see #getSystemEventQueue()
    */
   protected abstract EventQueue getSystemEventQueueImpl();
 
+
   /**
    * @since 1.3
    */