This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
FYI: Patch: gnu.java.awt.EmbeddedWindow
- From: Michael Koch <konqueror at gmx dot de>
- To: java-patches at gcc dot gnu dot org
- Date: Fri, 30 Jul 2004 17:05:31 +0200
- Subject: FYI: Patch: gnu.java.awt.EmbeddedWindow
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi list,
I just commited the attached patch to make the the peer field
accessible.
Michael
2004-07-30 Michael Koch <konqueror@gmx.de>
* gnu/java/awt/EmbeddedWindow.java
(addNotify): Use AccessController to allow execution of privileged
code.
- --
Homepage: http://www.worldforge.org/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)
iD8DBQFBCmO/WSOgCCdjSDsRAgY3AKCgoMfQ3XYNGGeUUduX8bugD9oXiwCfd8GS
9BtYXPAHcXKz9G4rNP/uecM=
=4tUr
-----END PGP SIGNATURE-----
Index: gnu/java/awt/EmbeddedWindow.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/gnu/java/awt/EmbeddedWindow.java,v
retrieving revision 1.6
diff -u -b -B -r1.6 EmbeddedWindow.java
--- gnu/java/awt/EmbeddedWindow.java 17 Jul 2004 08:37:22 -0000 1.6
+++ gnu/java/awt/EmbeddedWindow.java 30 Jul 2004 14:46:19 -0000
@@ -40,11 +40,13 @@
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 @@
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)