Patch: FYI: minor Window fix

Tom Tromey tromey@redhat.com
Tue Jul 22 21:03:00 GMT 2003


I'm checking this in on the trunk.
I've also put it in Classpath.

This changes java.awt.Window to properly compute the warningString.
We still don't do anything with it though.

Tom

Index: ChangeLog
from  Tom Tromey  <tromey@redhat.com>
	* java/awt/Window.java (getWarningString): Just return the
	string.
	(Window): Set warningString; check with security manager.

Index: java/awt/Window.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/awt/Window.java,v
retrieving revision 1.24
diff -u -r1.24 Window.java
--- java/awt/Window.java 27 Jun 2003 22:18:30 -0000 1.24
+++ java/awt/Window.java 22 Jul 2003 20:59:34 -0000
@@ -145,9 +145,10 @@
     // FIXME: add to owner's "owned window" list
     //owner.owned.add(this); // this should be a weak reference
     
-    /*  FIXME: Security check
-    SecurityManager.checkTopLevelWindow(...)
-    */
+    // FIXME: make this text visible in the window.
+    SecurityManager s = System.getSecurityManager();
+    if (s != null && ! s.checkTopLevelWindow(this))
+      warningString = System.getProperty("awt.appletWarning");
 
     if (gc != null
         && gc.getDevice().getType() != GraphicsDevice.TYPE_RASTER_SCREEN)
@@ -301,20 +302,7 @@
    */
   public final String getWarningString()
   {
-    boolean secure = true;
-    /* boolean secure = SecurityManager.checkTopLevelWindow(...) */
-
-    if (!secure)
-      {
-        if (warningString != null)
-          return warningString;
-        else
-          {
-            String warning = System.getProperty("awt.appletWarning");
-            return warning;
-          }
-      }
-    return null;
+    return warningString;
   }
 
   /**



More information about the Java-patches mailing list