2004-07-30 Michael Koch <konqueror@gmx.de>

* gnu/java/awt/EmbeddedWindow.java
	(addNotify): Use AccessController to allow execution of privileged
	code.

From-SVN: r85337
This commit is contained in:
Michael Koch 2004-07-30 14:50:50 +00:00 committed by Michael Koch
parent 0a925a32e2
commit 2afed683ea
2 changed files with 11 additions and 1 deletions

View File

@ -1,3 +1,9 @@
2004-07-30 Michael Koch <konqueror@gmx.de>
* gnu/java/awt/EmbeddedWindow.java
(addNotify): Use AccessController to allow execution of privileged
code.
2004-07-29 Michael Koch <konqueror@gmx.de>
* gnu/java/lang/MainThread.java:

View File

@ -40,11 +40,13 @@ package gnu.java.awt;
import gnu.classpath.Configuration;
import gnu.java.awt.peer.EmbeddedWindowPeer;
import gnu.java.security.action.SetAccessibleAction;
import java.awt.Component;
import java.awt.Frame;
import java.awt.Toolkit;
import java.lang.reflect.Field;
import java.security.AccessController;
/**
* Represents an AWT window that can be embedded into another
@ -88,13 +90,15 @@ public class EmbeddedWindow extends Frame
if (! (tk instanceof EmbeddedWindowSupport))
throw new UnsupportedOperationException
("Embedded windows are not supported by the current peers: " + tk.getClass());
("Embedded windows are not supported by the current peers: "
+ tk.getClass());
// Circumvent the package-privateness of the AWT internal
// java.awt.Component.peer member variable.
try
{
Field peerField = Component.class.getDeclaredField("peer");
AccessController.doPrivileged(new SetAccessibleAction(peerField));
peerField.set(this, ((EmbeddedWindowSupport) tk).createEmbeddedWindow (this));
}
catch (IllegalAccessException e)