From 3df7c71c2300d123998ea6534843fd9fe9c2dfb3 Mon Sep 17 00:00:00 2001 From: tromey Date: Thu, 11 Sep 2003 16:45:10 +0000 Subject: [PATCH] 2003-09-11 Sascha Brawer * java/awt/Toolkit.java (getSystemEventQueue): Call SecurityManager if one is installed. Improve Javadoc. (getSystemEventQueueImpl): Improve Javadoc. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@71308 138bc75d-0d04-0410-961f-82ee72b054a4 --- libjava/ChangeLog | 6 ++++++ libjava/java/awt/Toolkit.java | 45 ++++++++++++++++++++++++++++++++++++++----- 2 files changed, 46 insertions(+), 5 deletions(-) diff --git a/libjava/ChangeLog b/libjava/ChangeLog index 8a633e6483a..a1551e6cf41 100644 --- a/libjava/ChangeLog +++ b/libjava/ChangeLog @@ -1,3 +1,9 @@ +2003-09-11 Sascha Brawer + + * java/awt/Toolkit.java (getSystemEventQueue): Call SecurityManager + if one is installed. Improve Javadoc. + (getSystemEventQueueImpl): Improve Javadoc. + 2003-09-11 Tom Tromey * java/io/natFilePosix.cc (getCanonicalPath): Handle case where diff --git a/libjava/java/awt/Toolkit.java b/libjava/java/awt/Toolkit.java index f8cc6bffa2c..e13bd5f4db1 100644 --- a/libjava/java/awt/Toolkit.java +++ b/libjava/java/awt/Toolkit.java @@ -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. + * + *

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. + * + *

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) + *

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. + * + *

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. + * + *

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 */ -- 2.11.0