Index: gnu/java/nio/NIOServerSocket.java =================================================================== RCS file: /cvsroot/classpath/classpath/gnu/java/nio/NIOServerSocket.java,v retrieving revision 1.2 diff -u -r1.2 NIOServerSocket.java --- gnu/java/nio/NIOServerSocket.java 6 Feb 2004 09:13:24 -0000 1.2 +++ gnu/java/nio/NIOServerSocket.java 23 Nov 2004 12:50:25 -0000 @@ -39,14 +39,18 @@ package gnu.java.nio; import gnu.java.net.PlainSocketImpl; + import java.io.IOException; +import java.lang.reflect.Method; import java.net.ServerSocket; import java.net.Socket; import java.nio.channels.ServerSocketChannel; import java.nio.channels.SocketChannel; +import java.security.AccessController; +import java.security.PrivilegedExceptionAction; /** - * @author Michael Koch + * @author Michael Koch (address@hidden) */ public final class NIOServerSocket extends ServerSocket { @@ -59,7 +63,36 @@ this.channel = channel; } - public native PlainSocketImpl getPlainSocketImpl(); + public PlainSocketImpl getPlainSocketImpl() + { + try + { + Method[] methods = NIOServerSocket.class.getDeclaredMethods(); + for (int i = 0; i < methods.length; i++) + { + System.out.println("Michael: method: " + methods[i].getName()); + } + + final Object t = this; + final Method method = ServerSocket.class.getDeclaredMethod("getImpl", new Class[0]); + method.setAccessible(true); + PrivilegedExceptionAction action = new PrivilegedExceptionAction() + { + public Object run() throws Exception + { + return method.invoke(t, new Object[0]); + } + }; + return (PlainSocketImpl) AccessController.doPrivileged(action); + } + catch (Exception e) + { + // This should never happen. + Error error = new InternalError("unable to invoke method ServerSocket.getImpl()"); + error.initCause(e); + throw error; + } + } public ServerSocketChannel getChannel() { Index: include/gnu_java_nio_NIOServerSocket.h =================================================================== RCS file: include/gnu_java_nio_NIOServerSocket.h diff -N include/gnu_java_nio_NIOServerSocket.h --- include/gnu_java_nio_NIOServerSocket.h 28 May 2004 17:27:53 -0000 1.2 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,19 +0,0 @@ -/* DO NOT EDIT THIS FILE - it is machine generated */ - -#ifndef __gnu_java_nio_NIOServerSocket__ -#define __gnu_java_nio_NIOServerSocket__ - -#include - -#ifdef __cplusplus -extern "C" -{ -#endif - -JNIEXPORT jobject JNICALL Java_gnu_java_nio_NIOServerSocket_getPlainSocketImpl (JNIEnv *env, jobject); - -#ifdef __cplusplus -} -#endif - -#endif /* __gnu_java_nio_NIOServerSocket__ */ Index: include/Makefile.am =================================================================== RCS file: /cvsroot/classpath/classpath/include/Makefile.am,v retrieving revision 1.33 diff -u -r1.33 Makefile.am --- include/Makefile.am 21 Nov 2004 11:03:46 -0000 1.33 +++ include/Makefile.am 23 Nov 2004 12:50:25 -0000 @@ -45,7 +45,6 @@ $(top_srcdir)/include/gnu_java_awt_peer_gtk_GThreadNativeMethodRunner.h \ $(top_srcdir)/include/gnu_java_net_PlainDatagramSocketImpl.h \ $(top_srcdir)/include/gnu_java_net_PlainSocketImpl.h \ -$(top_srcdir)/include/gnu_java_nio_NIOServerSocket.h \ $(top_srcdir)/include/gnu_java_nio_VMPipe.h \ $(top_srcdir)/include/gnu_java_nio_VMSelector.h \ $(top_srcdir)/include/gnu_java_nio_channels_FileChannelImpl.h \ @@ -151,8 +150,6 @@ $(JAVAH) -o $@ gnu.java.net.PlainDatagramSocketImpl $(top_srcdir)/include/gnu_java_net_PlainSocketImpl.h: $(top_srcdir)/gnu/java/net/PlainSocketImpl.java $(JAVAH) -o $@ gnu.java.net.PlainSocketImpl -$(top_srcdir)/include/gnu_java_nio_NIOServerSocket.h: $(top_srcdir)/gnu/java/nio/NIOServerSocket.java - $(JAVAH) -o $@ gnu.java.nio.NIOServerSocket $(top_srcdir)/include/gnu_java_nio_VMPipe.h: $(top_srcdir)/vm/reference/gnu/java/nio/VMPipe.java $(JAVAH) -o $@ gnu.java.nio.VMPipe $(top_srcdir)/include/gnu_java_nio_VMSelector.h: $(top_srcdir)/vm/reference/gnu/java/nio/VMSelector.java Index: native/jni/java-nio/gnu_java_nio_NIOServerSocket.c =================================================================== RCS file: native/jni/java-nio/gnu_java_nio_NIOServerSocket.c diff -N native/jni/java-nio/gnu_java_nio_NIOServerSocket.c --- native/jni/java-nio/gnu_java_nio_NIOServerSocket.c 26 Oct 2004 20:26:03 -0000 1.5 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,55 +0,0 @@ -/* gnu_java_nio_NIOServerSocket.c - Native methods for NIOServerSocket class - Copyright (C) 2003 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. */ - -#include -#include - -#include -#include - -#include "gnu_java_nio_NIOServerSocket.h" - -#define IO_EXCEPTION "java/io/IOException" - -JNIEXPORT jobject JNICALL -Java_gnu_java_nio_NIOServerSocket_getPlainSocketImpl (JNIEnv *env, - jclass class - __attribute__ ((__unused__))) -{ - JCL_ThrowException (env, IO_EXCEPTION, "gnu.java.nio.NIOServerSocket.getPlainSocketImpl(): not implemented"); - return NULL; -} Index: native/jni/java-nio/Makefile.am =================================================================== RCS file: /cvsroot/classpath/classpath/native/jni/java-nio/Makefile.am,v retrieving revision 1.14 diff -u -r1.14 Makefile.am --- native/jni/java-nio/Makefile.am 21 Nov 2004 11:03:46 -0000 1.14 +++ native/jni/java-nio/Makefile.am 23 Nov 2004 12:50:25 -0000 @@ -1,7 +1,6 @@ pkglib_LTLIBRARIES = libjavanio.la -libjavanio_la_SOURCES = gnu_java_nio_NIOServerSocket.c \ - gnu_java_nio_VMPipe.c \ +libjavanio_la_SOURCES = gnu_java_nio_VMPipe.c \ gnu_java_nio_VMSelector.c \ gnu_java_nio_channels_FileChannelImpl.c \ java_nio_MappedByteBufferImpl.c \