This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java project.
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
| Other format: | [Raw text] | |
Hi,
This merges in the EmbeddedWindow changes that were committed to HEAD
instead of going to the gui branch. To make the merge a little easier I
also added the new gnu.java.security.action package.
2004-07-30 Mark Wielaard <mark@klomp.org>
* Makefile.in: Regenerated.
2004-07-30 Michael Koch <konqueror@gmx.de>
* gnu/java/awt/EmbeddedWindow.java
(addNotify): Use AccessController to allow execution of privileged
code.
2004-07-30 Michael Koch <konqueror@gmx.de>
* gnu/java/awt/EmbeddedWindow.java
(static): Removed.
(addNotify): Set peer via reflection.
(setWindowPeer): Removed.
* gnu/java/awt/natEmbeddedWindow.cc: Removed.
* Makefile.am (nat_source_files):
Removed gnu/java/awt/natEmbeddedWindow.cc.
2004-07-30 Bryce McKinlay <mckinlay@redhat.com>
* Makefile.am: Add gnu/java/security/action/GetPropertyAction.java
and gnu/java/security/action/SetAccessibleAction.java.
2004-07-30 Bryce McKinlay <mckinlay@redhat.com>
* gnu/java/security/action/GetPropertyAction.java (setParameters):
Renamed from 'setName'. New 2-argument form with default value.
(run): Pass default 'value' parameter to System.getProperty().
* gnu/java/security/action/SetAccessibleAction.java: Fix javadoc
typos.
2004-07-30 Bryce McKinlay <mckinlay@redhat.com>
* gnu/java/security/action/GetPropertyAction.java: New class.
* gnu/java/security/action/SetAccessibleAction.java: New class.
Discussed and approved on irc by Graydon.
Cheers,
Mark
Index: Makefile.am
===================================================================
RCS file: /cvs/gcc/gcc/libjava/Makefile.am,v
retrieving revision 1.361.2.31
diff -u -r1.361.2.31 Makefile.am
--- Makefile.am 30 Jul 2004 09:47:52 -0000 1.361.2.31
+++ Makefile.am 30 Jul 2004 18:40:09 -0000
@@ -2554,6 +2554,8 @@
gnu/java/security/der/DERReader.java \
gnu/java/security/der/DERValue.java \
gnu/java/security/der/DERWriter.java \
+gnu/java/security/action/GetPropertyAction.java \
+gnu/java/security/action/SetAccessibleAction.java \
gnu/java/security/provider/DefaultPolicy.java \
gnu/java/security/provider/DSAKeyFactory.java \
gnu/java/security/provider/DSAKeyPairGenerator.java \
@@ -2998,7 +3000,6 @@
gnu/gcj/runtime/natStackTrace.cc \
gnu/gcj/runtime/natStringBuffer.cc \
gnu/gcj/runtime/natVMClassLoader.cc \
-gnu/java/awt/natEmbeddedWindow.cc \
gnu/java/net/natPlainDatagramSocketImpl.cc \
gnu/java/net/natPlainSocketImpl.cc \
gnu/java/net/protocol/core/natCoreInputStream.cc \
Index: gnu/java/awt/EmbeddedWindow.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/gnu/java/awt/EmbeddedWindow.java,v
retrieving revision 1.4
diff -u -r1.4 EmbeddedWindow.java
--- gnu/java/awt/EmbeddedWindow.java 10 Feb 2004 17:46:28 -0000 1.4
+++ gnu/java/awt/EmbeddedWindow.java 30 Jul 2004 18:40:10 -0000
@@ -39,14 +39,19 @@
package gnu.java.awt;
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
* application.
*
- * @author Michael Koch <konqueror@gmx.de>
+ * @author Michael Koch (konqueror@gmx.de)
*/
public class EmbeddedWindow extends Frame
{
@@ -84,15 +89,28 @@
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());
- setWindowPeer (((EmbeddedWindowSupport) tk).createEmbeddedWindow (this));
- super.addNotify();
+ // 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)
+ {
+ // This should never happen.
+ }
+ catch (NoSuchFieldException e)
+ {
+ // This should never happen.
}
- // This method is only made native to circumvent the package-privateness of
- // an AWT internal java.awt.Component.peer member variable.
- native void setWindowPeer (EmbeddedWindowPeer peer);
+ super.addNotify();
+ }
/**
* If the native peer for this embedded window has been created,
Index: gnu/java/awt/natEmbeddedWindow.cc
===================================================================
RCS file: gnu/java/awt/natEmbeddedWindow.cc
diff -N gnu/java/awt/natEmbeddedWindow.cc
--- gnu/java/awt/natEmbeddedWindow.cc 4 Sep 2003 16:58:13 -0000 1.3
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,18 +0,0 @@
-/* Copyright (C) 2003 Free Software Foundation
-
- This file is part of libgcj.
-
-This software is copyrighted work licensed under the terms of the
-Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
-details. */
-
-#include <gnu/java/awt/EmbeddedWindow.h>
-#include <gnu/java/awt/peer/EmbeddedWindowPeer.h>
-#include <java/awt/peer/ComponentPeer.h>
-
-void
-gnu::java::awt::EmbeddedWindow::setWindowPeer (gnu::java::awt::peer::EmbeddedWindowPeer* w)
-{
- if (!peer)
- peer = reinterpret_cast< ::java::awt::peer::ComponentPeer *> (w);
-}
Index: gnu/java/security/action/GetPropertyAction.java
===================================================================
RCS file: gnu/java/security/action/GetPropertyAction.java
diff -N gnu/java/security/action/GetPropertyAction.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gnu/java/security/action/GetPropertyAction.java 30 Jul 2004 18:40:10 -0000
@@ -0,0 +1,89 @@
+/* GetPropertyAction.java
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package gnu.java.security.action;
+
+import java.security.PrivilegedAction;
+
+/**
+ * PrivilegedAction implementation that calls System.getProperty() with
+ * the property name passed to its constructor.
+ *
+ * Example of use:
+ * <code>
+ * GetPropertyAction action = new GetPropertyAction("http.proxyPort");
+ * String port = AccessController.doPrivileged(action);
+ * </code>
+ */
+public class GetPropertyAction implements PrivilegedAction
+{
+ String name;
+ String value = null;
+
+ public GetPropertyAction()
+ {
+ }
+
+ public GetPropertyAction(String propName)
+ {
+ setParameters(propName);
+ }
+
+ public GetPropertyAction(String propName, String defaultValue)
+ {
+ setParameters(propName, defaultValue);
+ }
+
+ public Object run()
+ {
+ return System.getProperty(name, value);
+ }
+
+ public GetPropertyAction setParameters(String propName)
+ {
+ this.name = propName;
+ this.value = null;
+ return this;
+ }
+
+ public GetPropertyAction setParameters(String propName, String defaultValue)
+ {
+ this.name = propName;
+ this.value = defaultValue;
+ return this;
+ }
+}
Index: gnu/java/security/action/SetAccessibleAction.java
===================================================================
RCS file: gnu/java/security/action/SetAccessibleAction.java
diff -N gnu/java/security/action/SetAccessibleAction.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gnu/java/security/action/SetAccessibleAction.java 30 Jul 2004 18:40:10 -0000
@@ -0,0 +1,77 @@
+/* SetAccessibleAction.java
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package gnu.java.security.action;
+
+import java.lang.reflect.AccessibleObject;
+import java.security.PrivilegedAction;
+
+/**
+ * PrivilegedAction implementation that calls setAccessible(true) on the
+ * AccessibleObject passed to its constructor.
+ *
+ * Example of use:
+ * <code>
+ * Field dataField = cl.getDeclaredField("data");
+ * AccessController.doPrivileged(new SetAccessibleAction(dataField));
+ * </code>
+ */
+public class SetAccessibleAction implements PrivilegedAction
+{
+ AccessibleObject member;
+
+ public SetAccessibleAction()
+ {
+ }
+
+ public SetAccessibleAction(AccessibleObject member)
+ {
+ this.member = member;
+ }
+
+ public Object run()
+ {
+ member.setAccessible(true);
+ return null;
+ }
+
+ public SetAccessibleAction setMember(AccessibleObject member)
+ {
+ this.member = member;
+ return this;
+ }
+}
Attachment:
signature.asc
Description: This is a digitally signed message part
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |