aboutsummaryrefslogtreecommitdiff
path: root/libjava
diff options
context:
space:
mode:
author(no author) <(no author)@138bc75d-0d04-0410-961f-82ee72b054a4>2002-12-14 08:55:36 +0000
committer(no author) <(no author)@138bc75d-0d04-0410-961f-82ee72b054a4>2002-12-14 08:55:36 +0000
commit6fdccaa858cdf0bb9db3c0b3d9f1995d757ca3d5 (patch)
tree2b908fb043259eb8a98b28d5d6d91d4f48cef4d1 /libjava
parentb2c70b118eacbf74cad603bd6ee927320f0f737b (diff)
This commit was manufactured by cvs2svn to create tagrtlopt-merge-20021412
'rtlopt-merge-20021412'. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/tags/rtlopt-merge-20021412@60129 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava')
-rw-r--r--libjava/ChangeLog3463
-rw-r--r--libjava/Makefile.am140
-rw-r--r--libjava/Makefile.in327
-rw-r--r--libjava/acconfig.h1
-rw-r--r--libjava/acinclude.m426
-rw-r--r--libjava/aclocal.m442
-rw-r--r--libjava/boehm.cc8
-rwxr-xr-xlibjava/configure699
-rw-r--r--libjava/configure.host30
-rw-r--r--libjava/configure.in10
-rw-r--r--libjava/defineclass.cc1
-rw-r--r--libjava/gcj/.cvsignore1
-rw-r--r--libjava/gcj/javaprims.h6
-rw-r--r--libjava/gij.cc19
-rw-r--r--libjava/gnu/classpath/Configuration.java.in5
-rw-r--r--libjava/gnu/gcj/protocol/core/Connection.java15
-rw-r--r--libjava/gnu/gcj/protocol/file/Connection.java15
-rw-r--r--libjava/gnu/gcj/protocol/http/Connection.java17
-rw-r--r--libjava/gnu/gcj/runtime/NameFinder.java548
-rw-r--r--libjava/gnu/gcj/runtime/natNameFinder.cc113
-rw-r--r--libjava/gnu/java/lang/reflect/TypeSignature.java384
-rw-r--r--libjava/gnu/java/nio/ByteBufferImpl.java193
-rw-r--r--libjava/gnu/java/nio/CharBufferImpl.java212
-rw-r--r--libjava/gnu/java/nio/DatagramChannelImpl.java112
-rw-r--r--libjava/gnu/java/nio/DoubleBufferImpl.java190
-rw-r--r--libjava/gnu/java/nio/FileChannelImpl.java234
-rw-r--r--libjava/gnu/java/nio/FloatBufferImpl.java196
-rw-r--r--libjava/gnu/java/nio/IntBufferImpl.java190
-rw-r--r--libjava/gnu/java/nio/LongBufferImpl.java190
-rw-r--r--libjava/gnu/java/nio/PipeImpl.java57
-rw-r--r--libjava/gnu/java/nio/SelectionKeyImpl.java91
-rw-r--r--libjava/gnu/java/nio/SelectorImpl.java299
-rw-r--r--libjava/gnu/java/nio/SelectorProviderImpl.java77
-rw-r--r--libjava/gnu/java/nio/ServerSocketChannelImpl.java113
-rw-r--r--libjava/gnu/java/nio/ShortBufferImpl.java190
-rw-r--r--libjava/gnu/java/nio/SocketChannelImpl.java223
-rw-r--r--libjava/gnu/java/nio/charset/ISO_8859_1.java132
-rw-r--r--libjava/gnu/java/nio/charset/Provider.java135
-rw-r--r--libjava/gnu/java/nio/charset/US_ASCII.java137
-rw-r--r--libjava/gnu/java/nio/charset/UTF_16.java75
-rw-r--r--libjava/gnu/java/nio/charset/UTF_16BE.java75
-rw-r--r--libjava/gnu/java/nio/charset/UTF_16Decoder.java169
-rw-r--r--libjava/gnu/java/nio/charset/UTF_16Encoder.java153
-rw-r--r--libjava/gnu/java/nio/charset/UTF_16LE.java75
-rw-r--r--libjava/gnu/java/nio/charset/UTF_8.java279
-rw-r--r--libjava/gnu/java/nio/natByteBufferImpl.cc125
-rw-r--r--libjava/gnu/java/nio/natCharBufferImpl.cc125
-rw-r--r--libjava/gnu/java/nio/natDoubleBufferImpl.cc125
-rw-r--r--libjava/gnu/java/nio/natFloatBufferImpl.cc125
-rw-r--r--libjava/gnu/java/nio/natIntBufferImpl.cc125
-rw-r--r--libjava/gnu/java/nio/natLongBufferImpl.cc125
-rw-r--r--libjava/gnu/java/nio/natSelectorImpl.cc126
-rw-r--r--libjava/gnu/java/nio/natServerSocketChannelImpl.cc77
-rw-r--r--libjava/gnu/java/nio/natShortBufferImpl.cc125
-rw-r--r--libjava/gnu/java/nio/natSocketChannelImpl.cc130
-rw-r--r--libjava/gnu/java/rmi/RMIMarshalledObjectInputStream.java70
-rw-r--r--libjava/gnu/java/rmi/RMIMarshalledObjectOutputStream.java83
-rw-r--r--libjava/gnu/java/rmi/dgc/DGCImpl.java65
-rw-r--r--libjava/gnu/java/rmi/dgc/DGCImpl_Skel.java38
-rw-r--r--libjava/gnu/java/rmi/dgc/DGCImpl_Stub.java38
-rw-r--r--libjava/gnu/java/rmi/registry/RegistryImpl.java3
-rw-r--r--libjava/gnu/java/rmi/registry/RegistryImpl_Skel.java38
-rw-r--r--libjava/gnu/java/rmi/registry/RegistryImpl_Stub.java40
-rw-r--r--libjava/gnu/java/rmi/server/ConnectionRunnerPool.java155
-rw-r--r--libjava/gnu/java/rmi/server/RMIHashes.java48
-rw-r--r--libjava/gnu/java/rmi/server/RMIObjectInputStream.java83
-rw-r--r--libjava/gnu/java/rmi/server/RMIObjectOutputStream.java62
-rw-r--r--libjava/gnu/java/rmi/server/UnicastConnection.java63
-rw-r--r--libjava/gnu/java/rmi/server/UnicastConnectionManager.java210
-rw-r--r--libjava/gnu/java/rmi/server/UnicastRef.java96
-rw-r--r--libjava/gnu/java/rmi/server/UnicastRemoteCall.java122
-rw-r--r--libjava/gnu/java/rmi/server/UnicastServer.java32
-rw-r--r--libjava/gnu/java/rmi/server/UnicastServerRef.java73
-rw-r--r--libjava/gnu/java/security/provider/MD5.java2
-rw-r--r--libjava/gnu/java/security/provider/SHA.java4
-rw-r--r--libjava/include/.cvsignore1
-rw-r--r--libjava/include/config.h.in12
-rw-r--r--libjava/include/java-interp.h24
-rw-r--r--libjava/include/jni.h816
-rw-r--r--libjava/include/jvm.h14
-rw-r--r--libjava/include/name-finder.h103
-rw-r--r--libjava/include/posix.h69
-rw-r--r--libjava/include/win32-threads.h8
-rw-r--r--libjava/include/win32.h67
-rw-r--r--libjava/interpret.cc38
-rw-r--r--libjava/java/applet/Applet.java542
-rw-r--r--libjava/java/applet/AppletContext.java149
-rw-r--r--libjava/java/applet/AppletStub.java97
-rw-r--r--libjava/java/applet/AudioClip.java41
-rw-r--r--libjava/java/awt/BorderLayout.java244
-rw-r--r--libjava/java/awt/CardLayout.java165
-rw-r--r--libjava/java/awt/Choice.java6
-rw-r--r--libjava/java/awt/Container.java481
-rw-r--r--libjava/java/awt/ContainerOrderFocusTraversalPolicy.java2
-rw-r--r--libjava/java/awt/Cursor.java2
-rw-r--r--libjava/java/awt/Event.java132
-rw-r--r--libjava/java/awt/FlowLayout.java166
-rw-r--r--libjava/java/awt/Frame.java12
-rw-r--r--libjava/java/awt/GridBagConstraints.java2
-rw-r--r--libjava/java/awt/GridBagLayout.java8
-rw-r--r--libjava/java/awt/GridLayout.java168
-rw-r--r--libjava/java/awt/List.java6
-rw-r--r--libjava/java/awt/ScrollPane.java8
-rw-r--r--libjava/java/awt/Toolkit.java4
-rw-r--r--libjava/java/awt/Window.java16
-rw-r--r--libjava/java/awt/color/ColorSpace.java119
-rw-r--r--libjava/java/awt/color/ICC_ColorSpace.java80
-rw-r--r--libjava/java/awt/color/ICC_Profile.java249
-rw-r--r--libjava/java/awt/color/ICC_ProfileGray.java71
-rw-r--r--libjava/java/awt/color/ICC_ProfileRGB.java80
-rw-r--r--libjava/java/awt/datatransfer/DataFlavor.java13
-rw-r--r--libjava/java/awt/dnd/Autoscroll.java67
-rw-r--r--libjava/java/awt/dnd/DragSourceAdapter.java4
-rw-r--r--libjava/java/awt/dnd/DragSourceContext.java6
-rw-r--r--libjava/java/awt/dnd/DragSourceDropEvent.java84
-rw-r--r--libjava/java/awt/dnd/DragSourceListener.java4
-rw-r--r--libjava/java/awt/dnd/DropTarget.java181
-rw-r--r--libjava/java/awt/dnd/DropTargetAdapter.java100
-rw-r--r--libjava/java/awt/dnd/DropTargetContext.java176
-rw-r--r--libjava/java/awt/dnd/DropTargetDragEvent.java107
-rw-r--r--libjava/java/awt/dnd/DropTargetDropEvent.java132
-rw-r--r--libjava/java/awt/dnd/DropTargetEvent.java56
-rw-r--r--libjava/java/awt/dnd/DropTargetListener.java89
-rw-r--r--libjava/java/awt/dnd/MouseDragGestureRecognizer.java118
-rw-r--r--libjava/java/awt/dnd/peer/DropTargetContextPeer.java45
-rw-r--r--libjava/java/awt/event/KeyEvent.java12
-rw-r--r--libjava/java/awt/font/TextHitInfo.java4
-rw-r--r--libjava/java/awt/geom/PathIterator.java14
-rw-r--r--libjava/java/awt/image/ColorModel.java4
-rw-r--r--libjava/java/awt/image/VolatileImage.java2
-rw-r--r--libjava/java/awt/image/renderable/RenderableImage.java2
-rw-r--r--libjava/java/awt/peer/ContainerPeer.java11
-rw-r--r--libjava/java/beans/BeanInfo.java8
-rw-r--r--libjava/java/beans/Introspector.java28
-rw-r--r--libjava/java/beans/beancontext/BeanContextChildSupport.java6
-rw-r--r--libjava/java/io/CharArrayWriter.java33
-rw-r--r--libjava/java/io/DataInputStream.java4
-rw-r--r--libjava/java/io/Externalizable.java1
-rw-r--r--libjava/java/io/FileInputStream.java11
-rw-r--r--libjava/java/io/FileOutputStream.java7
-rw-r--r--libjava/java/io/FilePermission.java5
-rw-r--r--libjava/java/io/ObjectInputStream.java29
-rw-r--r--libjava/java/io/ObjectStreamConstants.java2
-rw-r--r--libjava/java/io/Serializable.java1
-rw-r--r--libjava/java/io/SerializablePermission.java3
-rw-r--r--libjava/java/io/natFileDescriptorPosix.cc9
-rw-r--r--libjava/java/io/natFileDescriptorWin32.cc4
-rw-r--r--libjava/java/io/natFileWin32.cc9
-rw-r--r--libjava/java/lang/AssertionError.java2
-rw-r--r--libjava/java/lang/Class.h14
-rw-r--r--libjava/java/lang/Class.java28
-rw-r--r--libjava/java/lang/ClassLoader.java49
-rw-r--r--libjava/java/lang/Double.java5
-rw-r--r--libjava/java/lang/SecurityManager.java1639
-rw-r--r--libjava/java/lang/Thread.java7
-rw-r--r--libjava/java/lang/Throwable.java176
-rw-r--r--libjava/java/lang/VMClassLoader.java8
-rw-r--r--libjava/java/lang/VMThrowable.java97
-rw-r--r--libjava/java/lang/natClass.cc20
-rw-r--r--libjava/java/lang/natClassLoader.cc22
-rw-r--r--libjava/java/lang/natObject.cc36
-rw-r--r--libjava/java/lang/natRuntime.cc39
-rw-r--r--libjava/java/lang/natThrowable.cc99
-rw-r--r--libjava/java/lang/natVMThrowable.cc97
-rw-r--r--libjava/java/lang/ref/Reference.java4
-rw-r--r--libjava/java/lang/ref/natReference.cc15
-rw-r--r--libjava/java/lang/reflect/InvocationHandler.java136
-rw-r--r--libjava/java/lang/reflect/Proxy.java1624
-rw-r--r--libjava/java/lang/reflect/UndeclaredThrowableException.java128
-rw-r--r--libjava/java/lang/reflect/natConstructor.cc4
-rw-r--r--libjava/java/lang/reflect/natField.cc68
-rw-r--r--libjava/java/lang/reflect/natMethod.cc16
-rw-r--r--libjava/java/lang/reflect/natProxy.cc38
-rw-r--r--libjava/java/net/Authenticator.java34
-rw-r--r--libjava/java/net/BindException.java1
-rw-r--r--libjava/java/net/DatagramPacket.java372
-rw-r--r--libjava/java/net/DatagramSocket.java558
-rw-r--r--libjava/java/net/DatagramSocketImpl.java89
-rw-r--r--libjava/java/net/DatagramSocketImplFactory.java59
-rw-r--r--libjava/java/net/FileNameMap.java1
-rw-r--r--libjava/java/net/HttpURLConnection.java490
-rw-r--r--libjava/java/net/Inet4Address.java275
-rw-r--r--libjava/java/net/Inet6Address.java272
-rw-r--r--libjava/java/net/InetAddress.java348
-rw-r--r--libjava/java/net/InetSocketAddress.java219
-rw-r--r--libjava/java/net/JarURLConnection.java102
-rw-r--r--libjava/java/net/MulticastSocket.java409
-rw-r--r--libjava/java/net/NetPermission.java2
-rw-r--r--libjava/java/net/NetworkInterface.java237
-rw-r--r--libjava/java/net/PasswordAuthentication.java1
-rw-r--r--libjava/java/net/PlainDatagramSocketImpl.java36
-rw-r--r--libjava/java/net/PlainSocketImpl.java29
-rw-r--r--libjava/java/net/ServerSocket.java276
-rw-r--r--libjava/java/net/Socket.java394
-rw-r--r--libjava/java/net/SocketAddress.java17
-rw-r--r--libjava/java/net/SocketImpl.java58
-rw-r--r--libjava/java/net/SocketOptions.java215
-rw-r--r--libjava/java/net/SocketPermission.java12
-rw-r--r--libjava/java/net/URI.java433
-rw-r--r--libjava/java/net/URL.java543
-rw-r--r--libjava/java/net/URLClassLoader.java226
-rw-r--r--libjava/java/net/URLConnection.java377
-rw-r--r--libjava/java/net/URLDecoder.java111
-rw-r--r--libjava/java/net/URLEncoder.java9
-rw-r--r--libjava/java/net/URLStreamHandler.java360
-rw-r--r--libjava/java/net/natInetAddress.cc2
-rw-r--r--libjava/java/net/natNetworkInterface.cc144
-rw-r--r--libjava/java/net/natPlainDatagramSocketImpl.cc246
-rw-r--r--libjava/java/net/natPlainSocketImpl.cc620
-rw-r--r--libjava/java/nio/Buffer.java193
-rw-r--r--libjava/java/nio/BufferOverflowException.java51
-rw-r--r--libjava/java/nio/BufferUnderflowException.java51
-rw-r--r--libjava/java/nio/ByteBuffer.java79
-rw-r--r--libjava/java/nio/ByteOrder.java60
-rw-r--r--libjava/java/nio/CharBuffer.java291
-rw-r--r--libjava/java/nio/DoubleBuffer.java225
-rw-r--r--libjava/java/nio/FloatBuffer.java224
-rw-r--r--libjava/java/nio/IntBuffer.java225
-rw-r--r--libjava/java/nio/InvalidMarkException.java52
-rw-r--r--libjava/java/nio/LongBuffer.java226
-rw-r--r--libjava/java/nio/MappedByteBuffer.java42
-rw-r--r--libjava/java/nio/ReadOnlyBufferException.java52
-rw-r--r--libjava/java/nio/ShortBuffer.java226
-rw-r--r--libjava/java/nio/channels/AlreadyConnectedException.java48
-rw-r--r--libjava/java/nio/channels/AsynchronousCloseException.java52
-rw-r--r--libjava/java/nio/channels/ByteChannel.java43
-rw-r--r--libjava/java/nio/channels/CancelledKeyException.java52
-rw-r--r--libjava/java/nio/channels/Channel.java55
-rw-r--r--libjava/java/nio/channels/ClosedByInterruptException.java52
-rw-r--r--libjava/java/nio/channels/ClosedChannelException.java54
-rw-r--r--libjava/java/nio/channels/ClosedSelectorException.java52
-rw-r--r--libjava/java/nio/channels/ConnectionPendingException.java52
-rw-r--r--libjava/java/nio/channels/DatagramChannel.java205
-rw-r--r--libjava/java/nio/channels/FileChannel.java135
-rw-r--r--libjava/java/nio/channels/FileLockInterruptionException.java54
-rw-r--r--libjava/java/nio/channels/GatheringByteChannel.java79
-rw-r--r--libjava/java/nio/channels/IllegalBlockingModeException.java56
-rw-r--r--libjava/java/nio/channels/IllegalSelectorException.java52
-rw-r--r--libjava/java/nio/channels/InterruptibleChannel.java50
-rw-r--r--libjava/java/nio/channels/NoConnectionPendingException.java52
-rw-r--r--libjava/java/nio/channels/NonReadableChannelException.java52
-rw-r--r--libjava/java/nio/channels/NonWritableChannelException.java52
-rw-r--r--libjava/java/nio/channels/NotYetBoundException.java52
-rw-r--r--libjava/java/nio/channels/NotYetConnectedException.java52
-rw-r--r--libjava/java/nio/channels/OverlappingFileLockException.java52
-rw-r--r--libjava/java/nio/channels/Pipe.java121
-rw-r--r--libjava/java/nio/channels/ReadableByteChannel.java59
-rw-r--r--libjava/java/nio/channels/ScatteringByteChannel.java79
-rw-r--r--libjava/java/nio/channels/SelectableChannel.java138
-rw-r--r--libjava/java/nio/channels/SelectionKey.java164
-rw-r--r--libjava/java/nio/channels/Selector.java133
-rw-r--r--libjava/java/nio/channels/ServerSocketChannel.java100
-rw-r--r--libjava/java/nio/channels/SocketChannel.java222
-rw-r--r--libjava/java/nio/channels/UnresolvedAddressException.java52
-rw-r--r--libjava/java/nio/channels/UnsupportedAddressTypeException.java52
-rw-r--r--libjava/java/nio/channels/WritableByteChannel.java60
-rw-r--r--libjava/java/nio/channels/spi/AbstractInterruptibleChannel.java104
-rw-r--r--libjava/java/nio/channels/spi/AbstractSelectableChannel.java213
-rw-r--r--libjava/java/nio/channels/spi/AbstractSelectionKey.java75
-rw-r--r--libjava/java/nio/channels/spi/AbstractSelector.java114
-rw-r--r--libjava/java/nio/channels/spi/SelectorProvider.java103
-rw-r--r--libjava/java/nio/charset/CharacterCodingException.java53
-rw-r--r--libjava/java/nio/charset/Charset.java285
-rw-r--r--libjava/java/nio/charset/CharsetDecoder.java312
-rw-r--r--libjava/java/nio/charset/CharsetEncoder.java360
-rw-r--r--libjava/java/nio/charset/CoderMalfunctionError.java52
-rw-r--r--libjava/java/nio/charset/CoderResult.java193
-rw-r--r--libjava/java/nio/charset/CodingErrorAction.java66
-rw-r--r--libjava/java/nio/charset/IllegalCharsetNameException.java60
-rw-r--r--libjava/java/nio/charset/MalformedInputException.java71
-rw-r--r--libjava/java/nio/charset/UnmappableCharacterException.java71
-rw-r--r--libjava/java/nio/charset/UnsupportedCharsetException.java60
-rw-r--r--libjava/java/nio/charset/spi/CharsetProvider.java88
-rw-r--r--libjava/java/rmi/MarshalledObject.java85
-rw-r--r--libjava/java/rmi/activation/ActivationDesc.java5
-rw-r--r--libjava/java/rmi/activation/ActivationGroupDesc.java5
-rw-r--r--libjava/java/rmi/activation/ActivationGroupID.java5
-rw-r--r--libjava/java/rmi/activation/ActivationID.java5
-rw-r--r--libjava/java/rmi/server/LogStream.java4
-rw-r--r--libjava/java/rmi/server/RMIClassLoader.java178
-rw-r--r--libjava/java/rmi/server/RemoteObject.java84
-rw-r--r--libjava/java/rmi/server/RemoteServer.java2
-rw-r--r--libjava/java/rmi/server/UnicastRemoteObject.java69
-rw-r--r--libjava/java/security/DummyKeyPairGenerator.java16
-rw-r--r--libjava/java/security/DummyMessageDigest.java46
-rw-r--r--libjava/java/security/DummySignature.java15
-rw-r--r--libjava/java/security/Identity.java2
-rw-r--r--libjava/java/security/KeyPair.java2
-rw-r--r--libjava/java/security/KeyPairGenerator.java55
-rw-r--r--libjava/java/security/KeyPairGeneratorSpi.java18
-rw-r--r--libjava/java/security/KeyStore.java45
-rw-r--r--libjava/java/security/MessageDigest.java70
-rw-r--r--libjava/java/security/ProtectionDomain.java3
-rw-r--r--libjava/java/security/Provider.java51
-rw-r--r--libjava/java/security/SecureClassLoader.java16
-rw-r--r--libjava/java/security/SecureRandom.java2
-rw-r--r--libjava/java/security/SecureRandomSpi.java2
-rw-r--r--libjava/java/security/Security.java114
-rw-r--r--libjava/java/security/Signature.java67
-rw-r--r--libjava/java/security/SignedObject.java2
-rw-r--r--libjava/java/security/cert/Certificate.java3
-rw-r--r--libjava/java/text/Collator.java8
-rw-r--r--libjava/java/text/Format.java2
-rw-r--r--libjava/java/util/AbstractMap.java29
-rw-r--r--libjava/java/util/ArrayList.java6
-rw-r--r--libjava/java/util/Calendar.java8
-rw-r--r--libjava/java/util/HashMap.java59
-rw-r--r--libjava/java/util/LinkedHashMap.java202
-rw-r--r--libjava/java/util/Locale.java2
-rw-r--r--libjava/java/util/Random.java4
-rw-r--r--libjava/java/util/ResourceBundle.java208
-rw-r--r--libjava/java/util/TimeZone.java16
-rw-r--r--libjava/java/util/jar/Attributes.java3
-rw-r--r--libjava/java/util/regex/Matcher.java51
-rw-r--r--libjava/java/util/regex/Pattern.java59
-rw-r--r--libjava/java/util/regex/PatternSyntaxException.java131
-rw-r--r--libjava/java/util/zip/GZIPInputStream.java36
-rw-r--r--libjava/java/util/zip/ZipFile.java97
-rw-r--r--libjava/java/util/zip/ZipInputStream.java16
-rw-r--r--libjava/java/util/zip/ZipOutputStream.java12
-rw-r--r--libjava/java/util/zip/natDeflater.cc1
-rw-r--r--libjava/java/util/zip/natInflater.cc1
-rw-r--r--libjava/javax/naming/AuthenticationException.java40
-rw-r--r--libjava/javax/naming/AuthenticationNotSupportedException.java40
-rw-r--r--libjava/javax/naming/BinaryRefAddr.java15
-rw-r--r--libjava/javax/naming/Binding.java40
-rw-r--r--libjava/javax/naming/CannotProceedException.java40
-rw-r--r--libjava/javax/naming/CommunicationException.java42
-rw-r--r--libjava/javax/naming/CompositeName.java40
-rw-r--r--libjava/javax/naming/CompoundName.java42
-rw-r--r--libjava/javax/naming/ConfigurationException.java42
-rw-r--r--libjava/javax/naming/Context.java42
-rw-r--r--libjava/javax/naming/ContextNotEmptyException.java42
-rw-r--r--libjava/javax/naming/InitialContext.java44
-rw-r--r--libjava/javax/naming/InsufficientResourcesException.java40
-rw-r--r--libjava/javax/naming/InterruptedNamingException.java42
-rw-r--r--libjava/javax/naming/LimitExceededException.java40
-rw-r--r--libjava/javax/naming/LinkException.java42
-rw-r--r--libjava/javax/naming/LinkLoopException.java40
-rw-r--r--libjava/javax/naming/LinkRef.java40
-rw-r--r--libjava/javax/naming/MalformedLinkException.java42
-rw-r--r--libjava/javax/naming/Name.java2
-rw-r--r--libjava/javax/naming/NameAlreadyBoundException.java42
-rw-r--r--libjava/javax/naming/NameClassPair.java40
-rw-r--r--libjava/javax/naming/NameNotFoundException.java40
-rw-r--r--libjava/javax/naming/NameParser.java40
-rw-r--r--libjava/javax/naming/NamingEnumeration.java40
-rw-r--r--libjava/javax/naming/NamingException.java2
-rw-r--r--libjava/javax/naming/NamingSecurityException.java42
-rw-r--r--libjava/javax/naming/NoInitialContextException.java42
-rw-r--r--libjava/javax/naming/NoPermissionException.java42
-rw-r--r--libjava/javax/naming/NotContextException.java42
-rw-r--r--libjava/javax/naming/OperationNotSupportedException.java42
-rw-r--r--libjava/javax/naming/PartialResultException.java42
-rw-r--r--libjava/javax/naming/RefAddr.java26
-rw-r--r--libjava/javax/naming/Reference.java42
-rw-r--r--libjava/javax/naming/Referenceable.java40
-rw-r--r--libjava/javax/naming/ReferralException.java42
-rw-r--r--libjava/javax/naming/ServiceUnavailableException.java42
-rw-r--r--libjava/javax/naming/SizeLimitExceededException.java42
-rw-r--r--libjava/javax/naming/TimeLimitExceededException.java42
-rw-r--r--libjava/javax/naming/directory/Attribute.java42
-rw-r--r--libjava/javax/naming/directory/AttributeInUseException.java40
-rw-r--r--libjava/javax/naming/directory/AttributeModificationException.java42
-rw-r--r--libjava/javax/naming/directory/Attributes.java42
-rw-r--r--libjava/javax/naming/directory/BasicAttribute.java42
-rw-r--r--libjava/javax/naming/directory/BasicAttributes.java42
-rw-r--r--libjava/javax/naming/directory/DirContext.java42
-rw-r--r--libjava/javax/naming/directory/InitialDirContext.java42
-rw-r--r--libjava/javax/naming/directory/InvalidAttributeIdentifierException.java42
-rw-r--r--libjava/javax/naming/directory/InvalidAttributeValueException.java42
-rw-r--r--libjava/javax/naming/directory/InvalidAttributesException.java42
-rw-r--r--libjava/javax/naming/directory/InvalidSearchControlsException.java42
-rw-r--r--libjava/javax/naming/directory/InvalidSearchFilterException.java42
-rw-r--r--libjava/javax/naming/directory/ModificationItem.java42
-rw-r--r--libjava/javax/naming/directory/NoSuchAttributeException.java42
-rw-r--r--libjava/javax/naming/directory/SchemaViolationException.java42
-rw-r--r--libjava/javax/naming/directory/SearchControls.java42
-rw-r--r--libjava/javax/naming/directory/SearchResult.java42
-rw-r--r--libjava/javax/naming/event/EventContext.java42
-rw-r--r--libjava/javax/naming/event/EventDirContext.java42
-rw-r--r--libjava/javax/naming/event/NamespaceChangeListener.java42
-rw-r--r--libjava/javax/naming/event/NamingEvent.java42
-rw-r--r--libjava/javax/naming/event/NamingExceptionEvent.java42
-rw-r--r--libjava/javax/naming/event/NamingListener.java42
-rw-r--r--libjava/javax/naming/event/ObjectChangeListener.java42
-rw-r--r--libjava/javax/naming/ldap/Control.java42
-rw-r--r--libjava/javax/naming/ldap/ControlFactory.java42
-rw-r--r--libjava/javax/naming/ldap/ExtendedRequest.java42
-rw-r--r--libjava/javax/naming/ldap/ExtendedResponse.java42
-rw-r--r--libjava/javax/naming/ldap/HasControls.java42
-rw-r--r--libjava/javax/naming/ldap/InitialLdapContext.java42
-rw-r--r--libjava/javax/naming/ldap/LdapContext.java42
-rw-r--r--libjava/javax/naming/ldap/LdapReferralException.java42
-rw-r--r--libjava/javax/naming/ldap/UnsolicitedNotification.java42
-rw-r--r--libjava/javax/naming/ldap/UnsolicitedNotificationEvent.java42
-rw-r--r--libjava/javax/naming/ldap/UnsolicitedNotificationListener.java42
-rw-r--r--libjava/javax/naming/spi/DirObjectFactory.java42
-rw-r--r--libjava/javax/naming/spi/DirStateFactory.java42
-rw-r--r--libjava/javax/naming/spi/DirectoryManager.java44
-rw-r--r--libjava/javax/naming/spi/InitialContextFactory.java44
-rw-r--r--libjava/javax/naming/spi/InitialContextFactoryBuilder.java44
-rw-r--r--libjava/javax/naming/spi/NamingManager.java48
-rw-r--r--libjava/javax/naming/spi/ObjectFactory.java40
-rw-r--r--libjava/javax/naming/spi/ObjectFactoryBuilder.java42
-rw-r--r--libjava/javax/naming/spi/ResolveResult.java42
-rw-r--r--libjava/javax/naming/spi/Resolver.java42
-rw-r--r--libjava/javax/naming/spi/StateFactory.java42
-rw-r--r--libjava/javax/swing/AbstractListModel.java9
-rw-r--r--libjava/javax/swing/DefaultBoundedRangeModel.java9
-rw-r--r--libjava/javax/swing/DefaultSingleSelectionModel.java9
-rw-r--r--libjava/javax/transaction/HeuristicCommitException.java44
-rw-r--r--libjava/javax/transaction/HeuristicMixedException.java44
-rw-r--r--libjava/javax/transaction/HeuristicRollbackException.java44
-rw-r--r--libjava/javax/transaction/InvalidTransactionException.java39
-rw-r--r--libjava/javax/transaction/NotSupportedException.java44
-rw-r--r--libjava/javax/transaction/RollbackException.java44
-rw-r--r--libjava/javax/transaction/Status.java44
-rw-r--r--libjava/javax/transaction/Synchronization.java44
-rw-r--r--libjava/javax/transaction/SystemException.java44
-rw-r--r--libjava/javax/transaction/Transaction.java63
-rw-r--r--libjava/javax/transaction/TransactionManager.java63
-rw-r--r--libjava/javax/transaction/TransactionRequiredException.java39
-rw-r--r--libjava/javax/transaction/TransactionRolledbackException.java39
-rw-r--r--libjava/javax/transaction/UserTransaction.java58
-rw-r--r--libjava/javax/transaction/xa/XAException.java39
-rw-r--r--libjava/javax/transaction/xa/XAResource.java41
-rw-r--r--libjava/javax/transaction/xa/Xid.java41
-rw-r--r--libjava/jni.cc285
-rw-r--r--libjava/mauve-libgcj21
-rw-r--r--libjava/name-finder.cc356
-rw-r--r--libjava/prims.cc8
-rw-r--r--libjava/resolve.cc264
-rw-r--r--libjava/sysdep/s390/locks.h77
-rw-r--r--libjava/sysdep/x86-64/locks.h7
-rw-r--r--libjava/testsuite/ChangeLog121
-rw-r--r--libjava/testsuite/lib/libjava.exp2
-rw-r--r--libjava/testsuite/libjava.compile/narrow_case.java11
-rw-r--r--libjava/testsuite/libjava.compile/pr7912.java8
-rw-r--r--libjava/testsuite/libjava.jacks/jacks.exp99
-rw-r--r--libjava/testsuite/libjava.jacks/jacks.xfail848
-rw-r--r--libjava/testsuite/libjava.lang/Array_3.java19
-rw-r--r--libjava/testsuite/libjava.lang/EvaluationOrder.java22
-rw-r--r--libjava/testsuite/libjava.lang/EvaluationOrder.out3
-rw-r--r--libjava/testsuite/libjava.lang/Primes.java213
-rw-r--r--libjava/testsuite/libjava.lang/Primes.out51
-rw-r--r--libjava/testsuite/libjava.lang/StaticConstructor.java29
-rw-r--r--libjava/testsuite/libjava.lang/StaticConstructor.out1
-rw-r--r--libjava/testsuite/libjava.lang/TestProxy.java34
-rw-r--r--libjava/testsuite/libjava.lang/TestProxy.out1
-rw-r--r--libjava/testsuite/libjava.lang/initexc.java37
-rw-r--r--libjava/testsuite/libjava.lang/initexc.out0
-rw-r--r--libjava/testsuite/libjava.lang/pr6388.java10
-rw-r--r--libjava/testsuite/libjava.lang/pr6388.out4
-rw-r--r--libjava/testsuite/libjava.lang/pr8415.java15
-rw-r--r--libjava/testsuite/libjava.lang/pr8415.out1
-rw-r--r--libjava/testsuite/libjava.lang/pr8676.java11
-rw-r--r--libjava/testsuite/libjava.lang/pr8676.out0
-rw-r--r--libjava/testsuite/libjava.lang/utf8concat.java11
-rw-r--r--libjava/testsuite/libjava.lang/utf8concat.out0
-rw-r--r--libjava/testsuite/libjava.lang/utilTest.java58
-rw-r--r--libjava/testsuite/libjava.lang/utilTest.out3
-rw-r--r--libjava/testsuite/libjava.loader/MyLoader.java14
-rw-r--r--libjava/testsuite/libjava.loader/TestEarlyGC.java52
-rw-r--r--libjava/testsuite/libjava.loader/TestEarlyGC.out0
-rw-r--r--libjava/testsuite/libjava.loader/TestLeak.java33
-rw-r--r--libjava/testsuite/libjava.loader/TestLeak.out0
-rw-r--r--libjava/testsuite/libjava.loader/TestMultiple.java28
-rw-r--r--libjava/testsuite/libjava.loader/TestMultiple.out0
-rw-r--r--libjava/testsuite/libjava.loader/TestParent.java29
-rw-r--r--libjava/testsuite/libjava.loader/TestParent.out0
-rw-r--r--libjava/testsuite/libjava.loader/dummy.java6
-rw-r--r--libjava/testsuite/libjava.loader/loader.exp67
-rw-r--r--libjava/testsuite/libjava.mauve/mauve.exp19
-rw-r--r--libjava/testsuite/libjava.mauve/xfails12
-rw-r--r--libjava/verify.cc75
476 files changed, 38263 insertions, 7297 deletions
diff --git a/libjava/ChangeLog b/libjava/ChangeLog
index 2d8e5931f72..667fd4b7355 100644
--- a/libjava/ChangeLog
+++ b/libjava/ChangeLog
@@ -1,3 +1,2217 @@
+2002-12-02 Kaz Kojima <kkojima@gcc.gnu.org>
+
+ * configure.host [sh-linux* | sh[34]*-linux*]: Don't set
+ CHECKREFSPEC and EXCEPTIONSPEC. Set can_unwind_signal to
+ yes also for sh-linux* and sh[34]*-linux*.
+ * configure.in: Add sh-linux* and sh[34]*-linux* cases and
+ set SIGNAL_HANDLER to use DWARF2 exception for them.
+ * configure: Regenerate.
+
+2002-12-01 Tom Tromey <tromey@redhat.com>
+
+ Bug compatibility, for PR libgcj/8738:
+ * java/io/CharArrayWriter.java (close): Do nothing.
+ (flush): Likewise.
+ (reset): Don't touch `closed'.
+ (write(int)): Don't throw IOException.
+ (write(char[],int,int)): Likewise.
+ (write(String,int,int)): Likewise.
+ (closed): Removed.
+
+2002-12-01 Mark Wielaard <mark@klomp.org>
+
+ * java/lang/SecurityManager.java: Remerge comments, indenting and
+ checkXXX methods with Classpath.
+
+2002-11-29 Scott Gilbertson <scottg@mantatest.com>
+
+ * java/awt/image/ColorModel.java (getUnnormalizedComponents,
+ getNormalizedComponents): Fix calculation which was using one too
+ many bits in the unnormalized format.
+
+2002-11-29 Gary Benson <gbenson@redhat.com>
+
+ For PR libgcj/8759:
+ * java/beans/Introspector.java (flushCaches): New method.
+ (flushFromCaches): Likewise.
+
+2002-11-29 Michael Koch <konqueror@gmx.de>
+
+ * java/nio/channels/DatagramChannel.java
+ (open): Added exception documentation.
+ (write): Added exception documentation.
+ (connect): Added exception documentation.
+ (disconnect): Added exception documentation.
+ (isConnected): Added exception documentation.
+ (read): Added exception documentation.
+ (receive): Added exception documentation.
+ (send): Added exception documentation.
+ (validOps): Added exception documentation.
+ * java/nio/channels/SocketChannel.java
+ (open): Added exception documentation.
+ (read): Added exception documentation.
+ (write): Added exception documentation.
+ (connect): Added exception documentation.
+ (finishConnect): Added exception documentation.
+
+2002-11-29 Michael Koch <konqueror@gmx.de>
+
+ * gnu/java/nio/DatagramChannelImpl:
+ (fd): New member variable to store file descriptor of socket.
+ * gnu/java/nio/SelectionKeyImpl.java:
+ (ops): Removed.
+ (readyOps): New member variable.
+ (interestOps): New member variable.
+ (readyOps): Implemented.
+ (readyOps): New method to set member variable readyOps.
+ (interestOps): Replaced ops by interestOps.
+ * gnu/java/nio/SelectorImpl.java:
+ (SelectorImpl): Initialize key sets.
+ (select): Call select with -1 instead of Long.MAX_VALUE).
+ (java_do_select): Make it a native method.
+ (getFDsAsArray): New helper method.
+ (select): Remove canceled keys, give only interested file discriptors
+ to java_do_select, set ready ops.
+ (add): No need to initialize keys set here.
+ (add_selected): No need to initialize selected set here.
+ (deregisterCanceledKeys): New helper method.
+ (register): Set interest ops, set attachments, added handling of datagram
+ channels.
+ * gnu/java/nio/ServerSocketChannelImpl:
+ (SocketAccept): Renamed from NioSocketAccept.
+ (implConfigureBlocking): Implemented.
+ (accept): Use SocketAccept instead of NioSocketAccept.
+ * gnu/java/nio/SocketChannelImpl:
+ Reactivate native methods.
+
+2002-11-29 Michael Koch <konqueror@gmx.de>
+
+ * gnu/java/nio/natByteBufferImpl.cc,
+ gnu/java/nio/natCharBufferImpl.cc,
+ gnu/java/nio/natDoubleBufferImpl.cc,
+ gnu/java/nio/natFloatBufferImpl.cc,
+ gnu/java/nio/natIntBufferImpl.cc,
+ gnu/java/nio/natLongBufferImpl.cc,
+ gnu/java/nio/natSelectorImpl.cc,
+ gnu/java/nio/natServerSocketChannelImpl.cc,
+ gnu/java/nio/natShortBufferImpl.cc,
+ gnu/java/nio/natSocketChannelImpl.cc:
+ New files that implement native functionalities.
+
+2002-11-29 Michael Koch <konqueror@gmx.de>
+
+ * gnu/java/nio/ByteBufferImpl.java
+ (ByteBufferImpl): Moved position() after limit.
+ (nio_*): Use native implementation.
+ * gnu/java/nio/CharBufferImpl.java:
+ Reformated.
+ (endian): New member variable string endianess of buffer.
+ (CharBufferImpl): Moved position() after limit.
+ (nio_*): Use native implementation.
+ (subSequence): Implemented.
+ * gnu/java/nio/DoubleBufferImpl.java
+ (DoubleBufferImpl): Moved position() after limit.
+ (nio_*): Use native implementation.
+ * gnu/java/nio/FloatBufferImpl.java
+ Reformated.
+ (FloatBufferImpl): Moved position() after limit.
+ (nio_*): Use native implementation.
+ * gnu/java/nio/IntBufferImpl.java
+ Added needed imports, Reformated.
+ (IntBufferImpl): Moved position() after limit.
+ (nio_*): Use native implementation.
+ * gnu/java/nio/LongBufferImpl.java
+ Reformated.
+ (LongBufferImpl): Moved position() after limit.
+ (nio_*): Use native implementation.
+ * gnu/java/nio/ShortBufferImpl.java
+ Reformated.
+ (ShortBufferImpl): Moved position() after limit.
+ (nio_*): Use native implementation.
+
+2002-11-27 Julian Dolby <dolby@us.ibm.com>
+
+ * java/util/Locale.java (toString): Improve efficiency if country
+ and variant are both empty.
+
+2002-11-26 Tom Tromey <tromey@redhat.com>
+
+ * verify.cc (pop_init_ref): New method.
+ (verify_instructions_0) [op_iaload, op_laload, op_faload,
+ op_daload, op_aaload, op_baload, op_caload, op_saload, op_iastore,
+ op_lastore, op_fastore, op_dastore, op_aastore, op_bastore,
+ op_castore, op_sastore, op_areturn, op_arraylength, op_checkcast,
+ op_instanceof, op_monitorenter, op_monitorexit]: Use it.
+ (verify_instructions_0) [op_invokevirtual, op_invokespecial,
+ op_invokestatic, op_invokeinterface]: Use pop_init_ref. Don't
+ let `this' argument be uninitialized. Don't let `null' be passed
+ as `this' to construtor.
+
+2002-11-26 Mark Wielaard <mark@klomp.org>
+
+ * javax/transaction/HeuristicCommitException.java: Classpath merge.
+ * javax/transaction/HeuristicMixedException.java: Likewise.
+ * javax/transaction/HeuristicRollbackException.java: Likewise.
+ * javax/transaction/InvalidTransactionException.java: Likewise.
+ * javax/transaction/NotSupportedException.java: Likewise.
+ * javax/transaction/RollbackException.java: Likewise.
+ * javax/transaction/Status.java: Likewise.
+ * javax/transaction/Synchronization.java: Likewise.
+ * javax/transaction/SystemException.java: Likewise.
+ * javax/transaction/Transaction.java: Likewise.
+ * javax/transaction/TransactionManager.java: Likewise.
+ * javax/transaction/TransactionRequiredException.java: Likewise.
+ * javax/transaction/TransactionRolledbackException.java: Likewise.
+ * javax/transaction/UserTransaction.java: Likewise.
+ * javax/transaction/xa/XAException.java: Likewise.
+ * javax/transaction/xa/XAResource.java: Likewise.
+ * javax/transaction/xa/Xid.java: Likewise.
+
+2002-11-26 Andreas Tobler <a.tobler@schweiz.ch>
+
+ * java/net/natPlainDatagramSocketImpl.cc (socklen_t): Don't
+ define.
+ * java/net/natPlainSocketImpl.cc (socklen_t): Don't define.
+ * include/posix.h (socklen_t): Define if not already defined.
+
+2002-11-25 Tom Tromey <tromey@redhat.com>
+
+ * verify.cc (type::compatible): Backed out broken change.
+
+ * verify.cc (type::compatible): Check initialization status
+ first.
+ * interpret.cc (run) [insn_invokespecial, invokespecial_resolved]:
+ Don't use NULLCHECK.
+
+2002-11-23 H.J. Lu <hjl@gnu.org>
+
+ * acinclude.m4 (AC_COMPILE_CHECK_SIZEOF): Removed.
+ Include ../config/accross.m4.
+ * aclocal.m4; Rebuild.
+ * configure: Likewise.
+
+2002-11-23 Mark Wielaard <mark@klomp.org>
+
+ * javax/naming/AuthenticationException.java: Update copyright header.
+ * javax/naming/AuthenticationNotSupportedException.java: Likewise.
+ * javax/naming/Binding.java: Likewise.
+ * javax/naming/CannotProceedException.java: Likewise.
+ * javax/naming/CommunicationException.java: Likewise.
+ * javax/naming/CompositeName.java: Likewise.
+ * javax/naming/CompoundName.java: Likewise.
+ * javax/naming/ConfigurationException.java: Likewise.
+ * javax/naming/Context.java: Likewise.
+ * javax/naming/ContextNotEmptyException.java: Likewise.
+ * javax/naming/InitialContext.java: Likewise.
+ * javax/naming/InsufficientResourcesException.java: Likewise.
+ * javax/naming/InterruptedNamingException.java: Likewise.
+ * javax/naming/LimitExceededException.java: Likewise.
+ * javax/naming/LinkException.java: Likewise.
+ * javax/naming/LinkLoopException.java: Likewise.
+ * javax/naming/LinkRef.java: Likewise.
+ * javax/naming/MalformedLinkException.java: Likewise.
+ * javax/naming/NameAlreadyBoundException.java: Likewise.
+ * javax/naming/NameClassPair.java: Likewise.
+ * javax/naming/NameNotFoundException.java: Likewise.
+ * javax/naming/NameParser.java: Likewise.
+ * javax/naming/NamingEnumeration.java: Likewise.
+ * javax/naming/NamingSecurityException.java: Likewise.
+ * javax/naming/NoInitialContextException.java: Likewise.
+ * javax/naming/NoPermissionException.java: Likewise.
+ * javax/naming/NotContextException.java: Likewise.
+ * javax/naming/OperationNotSupportedException.java: Likewise.
+ * javax/naming/PartialResultException.java: Likewise.
+ * javax/naming/Reference.java: Likewise.
+ * javax/naming/Referenceable.java: Likewise.
+ * javax/naming/ReferralException.java: Likewise.
+ * javax/naming/ServiceUnavailableException.java: Likewise.
+ * javax/naming/SizeLimitExceededException.java: Likewise.
+ * javax/naming/TimeLimitExceededException.java: Likewise.
+ * javax/naming/directory/Attribute.java: Likewise.
+ * javax/naming/directory/AttributeInUseException.java: Likewise.
+ * javax/naming/directory/AttributeModificationException.java: Likewise.
+ * javax/naming/directory/Attributes.java: Likewise.
+ * javax/naming/directory/BasicAttribute.java: Likewise.
+ * javax/naming/directory/BasicAttributes.java: Likewise.
+ * javax/naming/directory/DirContext.java: Likewise.
+ * javax/naming/directory/InitialDirContext.java: Likewise.
+ * javax/naming/directory/InvalidAttributeIdentifierException.java:
+ Likewise.
+ * javax/naming/directory/InvalidAttributeValueException.java: Likewise.
+ * javax/naming/directory/InvalidAttributesException.java: Likewise.
+ * javax/naming/directory/InvalidSearchControlsException.java: Likewise.
+ * javax/naming/directory/InvalidSearchFilterException.java: Likewise.
+ * javax/naming/directory/ModificationItem.java: Likewise.
+ * javax/naming/directory/NoSuchAttributeException.java: Likewise.
+ * javax/naming/directory/SchemaViolationException.java: Likewise.
+ * javax/naming/directory/SearchControls.java: Likewise.
+ * javax/naming/directory/SearchResult.java: Likewise.
+ * javax/naming/event/EventContext.java: Likewise.
+ * javax/naming/event/EventDirContext.java: Likewise.
+ * javax/naming/event/NamespaceChangeListener.java: Likewise.
+ * javax/naming/event/NamingEvent.java: Likewise.
+ * javax/naming/event/NamingExceptionEvent.java: Likewise.
+ * javax/naming/event/NamingListener.java: Likewise.
+ * javax/naming/event/ObjectChangeListener.java: Likewise.
+ * javax/naming/ldap/Control.java: Likewise.
+ * javax/naming/ldap/ControlFactory.java: Likewise.
+ * javax/naming/ldap/ExtendedRequest.java: Likewise.
+ * javax/naming/ldap/ExtendedResponse.java: Likewise.
+ * javax/naming/ldap/HasControls.java: Likewise.
+ * javax/naming/ldap/InitialLdapContext.java: Likewise.
+ * javax/naming/ldap/LdapContext.java: Likewise.
+ * javax/naming/ldap/LdapReferralException.java: Likewise.
+ * javax/naming/ldap/UnsolicitedNotification.java: Likewise.
+ * javax/naming/ldap/UnsolicitedNotificationEvent.java: Likewise.
+ * javax/naming/ldap/UnsolicitedNotificationListener.java: Likewise.
+ * javax/naming/spi/DirObjectFactory.java: Likewise.
+ * javax/naming/spi/DirStateFactory.java: Likewise.
+ * javax/naming/spi/DirectoryManager.java: Likewise.
+ * javax/naming/spi/InitialContextFactory.java: Likewise.
+ * javax/naming/spi/InitialContextFactoryBuilder.java: Likewise.
+ * javax/naming/spi/NamingManager.java: Likewise.
+ * javax/naming/spi/ObjectFactory.java: Likewise.
+ * javax/naming/spi/ObjectFactoryBuilder.java: Likewise.
+ * javax/naming/spi/ResolveResult.java: Likewise.
+ * javax/naming/spi/Resolver.java: Likewise.
+ * javax/naming/spi/StateFactory.java: Likewise.
+
+ * javax/naming/spi/NamingManager.java (ofb): Package private.
+
+2002-11-21 Mark Wielaard <mark@klomp.org>
+
+ * java/net/URL.java: Merge with Classpath (partly).
+ * java/net/URLStreamHandler: Merge with Classpath.
+
+2002-11-22 Michael Koch <konqueror@gmx.de>
+
+ * include/posix.h:
+ (_Jv_platform_on_close): Moved out of #ifndef DISBALE_JAVA_NET.
+ * include/win32.h:
+ (_Jv_platform_on_close): Moved out of #ifndef DISBALE_JAVA_NET.
+ (backtrace): Moved out of #ifndef DISBALE_JAVA_NET.
+
+2002-11-21 Michael Koch <konqueror@gmx.de>
+
+ * include/posix.h: I put too much into the #ifndef DISABLE_JAVA_NET.
+ Only the new network functions should be in it.
+
+2002-11-21 Michael Koch <konqueror@gmx.de>
+
+ * include/posix.h: Moved new functions into a #ifndef DISABLE_JAVA_NET
+ * include/win32.h: Moved new functions into a #ifndef DISABLE_JAVA_NET
+
+2002-11-21 Michael Koch <konqueror@gmx.de>
+
+ * java/nio/channels/AsynchronousCloseException.java,
+ java/nio/channels/CancelledKeyException.java,
+ java/nio/channels/ClosedByInterruptException.java,
+ java/nio/channels/ConnectionPendingException.java,
+ java/nio/channels/FileLockInterruptionException.java,
+ java/nio/channels/IllegalSelectorException.java,
+ java/nio/channels/NoConnectionPendingException.java,
+ java/nio/channels/NonReadableChannelException.java,
+ java/nio/channels/NonWritableChannelException.java,
+ java/nio/channels/NotYetBoundException.java,
+ java/nio/channels/NotYetConnectedException.java,
+ java/nio/channels/OverlappingFileLockException.java,
+ java/nio/channels/UnresolvedAddressException.java,
+ java/nio/channels/UnsupportedAddressTypeException.java:
+ New files.
+ * Makefile.am (ordinary_java_source_files): Added new files.
+ * Makefile.in: Regenerated.
+
+2002-11-21 Michael Koch <konqueror@gmx.de>
+
+ * include/posix.h
+ (_Jv_socket): New method.
+ (_Jv_connect): New method.
+ (_Jv_close): New method.
+ (_Jv_platform_close_on_exec): Prefixed system function with "::".
+ (_Jv_bind): New method.
+ (_Jv_listen): New method.
+ (_Jv_write): New method.
+ (_Jv_read): New method.
+ * include/win32.h
+ (_Jv_socket): New method.
+ (_Jv_connect): New method.
+ (_Jv_close): New method.
+ (_Jv_bind): New method.
+ (_Jv_listen): New method.
+ (_Jv_write): New method.
+ (_Jv_read): New method.
+ * java/net/natNetworkInterface.cc:
+ Include platform.h, removed inclusion of socket.h
+ (getRealNetworkInterfaces): Replaced ::socket() by _Jv_socket() and
+ ::close() by _Jv_close().
+ * java/net/natPlainDatagramSocketImpl.cc:
+ Removed include of socket.h, definition of NATIVE_CLOSE and _Jv_bind,
+ added some new lines to make code more readable.
+ (create): Replaced ::socket() by _Jv_socket().
+ (close): Replaced NATIVE_CLOSE() by _Jv_close().
+ * java/net/natPlainSocketImpl.cc:
+ Removed definition of NATIVE_CLOSE, _Jv_bind, Jv_connect and _Jv_accept,
+ removed include of socket.h, removed some windows defines
+ (now in include/win32.h).
+ (create): Replaced ::socket() by _Jv_socket().
+ (close): Replaced NATIVE_CLOSE() by _Jv_close().
+ (write): Replaced ::read by _Jv_write().
+ (read): Replaced ::read by _Jv_read().
+
+2002-11-20 Michael Koch <konqueror@gmx.de>
+
+ * Makefile.am (ordinary_java_source_files):
+ Added java/nio/channels/FileChannel.java.
+ * Makefile.in: Regenerated.
+
+2002-11-20 Michael Koch <konqueror@gmx.de>
+
+ * java/io/FileInputStream.java
+ (getChannel): New method.
+ * java/io/FileOutputStream.java
+ (getChannel): New method.
+ * java/net/ServerSocket.java
+ (bind): Removed duplicate code and called another bind method instead.
+ * java/nio/channels/SelectionKey.java
+ (isValid): Removed wrong exception documentation.
+ * java/nio/channels/ServerSocketChannel.java
+ (accept): Added exception documentation.
+ (open): Fixed typo, added exception documentation.
+ * java/nio/channels/spi/AbstractSelectableChannel.java
+ (implCloseChannel): Added exception documentation.
+ (add): Reformated.
+ (register): Added exception documentation.
+
+2002-11-20 Andreas Jaeger <aj@suse.de>
+
+ * configure: Regenerated with new libtool.m4.
+
+2002-11-19 Tom Tromey <tromey@redhat.com>
+
+ * java/lang/ref/natReference.cc (add_to_hash): Look at `copy', not
+ `referent'.
+ (finalize_referred_to_object): Don't modify `referent' or `copy'
+ fields.
+ (add_to_hash): Correctly set `n->next' when updating list.
+ * java/lang/ref/Reference.java (enqueue): Return false if already
+ enqueued.
+
+2002-11-19 Ranjit Mathew <rmathew@hotmail.com>
+
+ * include/jni.h: Add missing JNICALL and JNIEXPORT attributes
+ to function and function pointer declarations in accordance with
+ Sun's JDKs. Define JNIIMPEXP to either JNIEXPORT or JNIIMPORT
+ based on whether __GCJ_JNI_IMPL__ has been defined or not.
+ * jni.cc: Add missing JNICALL and JNIEXPORT attributes to
+ JNI function definitions.
+
+2002-11-18 Jesse Rosenstock <jmr@ugcs.caltech.edu>
+
+ * java/nio/charset/CoderResult.java (Cache.get): Fix a bug
+ that was causing CoderResults to be cached, not WeakReferences
+ to CoderResults.
+
+2002-11-18 Joerg Brunsmann <joerg_brunsmann@yahoo.de>
+
+ * java/security/KeyStore.java (getInstance): Fix
+ comment and throw IllegalArgumentException if
+ given provider is null.
+ (getInstance): New method for jdk1.4 compatibility.
+
+2002-11-18 Michael Koch <konqueror@gmx.de>
+
+ * java/net/PlainSocketImpl.java: Fix imports.
+
+2002-11-18 Michael Koch <konqueror@gmx.de>
+
+ * java/nio/channels/SelectionKey.java
+ (isValid): Added exception documentation.
+ * java/nio/channels/Selector.java
+ (open): Declare "throws IOException".
+
+2002-11-18 Jesse Rosenstock <jmr@ugcs.caltech.edu>
+
+ * java/nio/charset/Charset.java
+ (<clinit>): New method.
+ (encode): Synchronize use of cached encoder object.
+ (decode): Synchronize use of cached encoder object.
+
+2002-11-18 Michael Koch <konqueror@gmx.de>
+
+ * gnu/java/nio/ByteBufferImpl.java,
+ gnu/java/nio/CharBufferImpl.java,
+ gnu/java/nio/DatagramChannelImpl.java,
+ gnu/java/nio/DoubleBufferImpl.java,
+ gnu/java/nio/FileChannelImpl.java,
+ gnu/java/nio/FloatBufferImpl.java,
+ gnu/java/nio/IntBufferImpl.java,
+ gnu/java/nio/LongBufferImpl.java,
+ gnu/java/nio/PipeImpl.java,
+ gnu/java/nio/SelectionKeyImpl.java,
+ gnu/java/nio/SelectorImpl.java,
+ gnu/java/nio/SelectorProviderImpl.java,
+ gnu/java/nio/ServerSocketChannelImpl.java,
+ gnu/java/nio/ShortBufferImpl.java,
+ gnu/java/nio/SocketChannelImpl.java,
+ java/nio/DoubleBuffer.java,
+ java/nio/FloatBuffer.java,
+ java/nio/IntBuffer.java,
+ java/nio/LongBuffer.java,
+ java/nio/ShortBuffer.java,
+ java/nio/channels/FileChannel.java: New files.
+
+2002-11-18 Michael Koch <konqueror@gmx.de>
+
+ * Makefile.am (ordinary_java_source_files):
+ Added java/nio/ReadOnlyBufferException.java and
+ java/nio/channels/ClosedSelectorException.java.
+ * Makefile.in: Regenerated.
+
+2002-11-18 Michael Koch <konqueror@gmx.de>
+
+ * java/net/PlainSocketImpl.java: Reworked imports.
+ * java/net/ServerSocket.java
+ (ServerSocket): Create socket.
+ * java/net/SocketAddress.java: Documentation added.
+ * java/net/natPlainSocketImpl.cc: Reindented.
+ * java/nio/ReadOnlyBufferException.java: New file
+ * java/nio/channels/ClosedChannelException.java: Documentation added.
+ * java/nio/channels/ClosedSelectorException.java: New file.
+
+2002-11-17 Mark Wielaard <mark@klomp.org>
+
+ * java/net/HttpURLConnection.java ((getPermission): Take port
+ into consideration.
+ (getErrorStream): Implement.
+
+2002-11-17 Mark Wielaard <mark@klomp.org>
+
+ * java/net/HttpURLConnection.java: Merge with GNU Classpath.
+
+2002-11-16 Mark Wielaard <mark@klomp.org>
+
+ Integrate work by Raif S. Naffah (raif@fl.net.au)
+ * java/security/DummyKeyPairGenerator.java (clone): New method.
+ * java/security/DummyMessageDigest.java (clone): New method.
+ (engineUpdate): Now public.
+ (engineReset): Likewise.
+ (engineDigest): Likewise.
+ (engineGetDigestLength): New method.
+ * java/security/DummySignature.java (clone): New method.
+ * java/security/KeyPairGenerator.java (provider): Now package private.
+ (getInstance(String)): Use getInstance(String,Provider).
+ (getInstance(String,String): Use getInstance(String,Provider)
+ (getInstance(String,Provider): New method.
+ (getInstance(String,String,Provider): Don't cast DummyKeyPairGenerator.
+ * java/security/KeyPairGeneratorSpi.java (clone): New method.
+ * java/security/MessageDigest.java (provider): Now package private.
+ (getInstance(String): Use getInstance(String,Provider).
+ (getInstance(String,String): Use getInstance(String,Provider)
+ (getInstance(String,Provider): New method.
+ * java/security/Provider.java (toCanonicalKey): New method.
+ (get): New method that uses toCanonicalKey().
+ (put): Use toCanonicalKey().
+ (remove): Likewise.
+ * java/security/Security.java (insertProviderAt): Provider index is one
+ based, not zero based.
+ (addProvider): Likewise.
+ (removeProvider): Likewise.
+ * java/security/Signature.java (provider): Now package private.
+ (getInstance(String)): Use getInstance(String,Provider).
+ (getInstance(String,String): Use getInstance(String,Provider)
+ (getInstance(String,Provider): New method.
+ (getInstance(String,String,Provider): Don't cast DummySignature.
+
+2002-11-15 Tom Tromey <tromey@redhat.com>
+
+ For PR libgcj/8593:
+ * java/util/zip/GZIPInputStream.java (read): Check file size.
+ Look in inflater for remaining input bytes.
+ (read4): Added buf and offset arguments.
+
+2002-11-12 Eric Blake <ebb9@email.byu.edu>
+
+ * java/applet/AppletContext.java: Fix typo and remove redundant
+ modifiers.
+
+2002-11-14 Tom Tromey <tromey@redhat.com>
+
+ * java/lang/natRuntime.cc (insertSystemProperties): Set
+ gnu.classpath.home.
+
+2002-11-13 Michael Koch <konqueror@gmx.de>
+
+ * java/nio/ByteBuffer.java
+ (allocate): New method.
+ (wrap): New method.
+ (put): New method.
+ (get): New method.
+
+2002-11-13 Michael Koch <konqueror@gmx.de>
+
+ * java/nio/channels/AlreadyConnectedException.java:
+ Removed unneeded import.
+ (AlreadyConnectedException): Documentation added.
+ * java/nio/channels/Pipe.java
+ (SinkChannel.SinkChannel): Documentation added.
+ (SinkChannel.validOps): New method.
+ (SourceChannel.SourceChannel): Documentation added.
+ (SourceChannel.validOps): New method.
+ (Pipe): Documentation added.
+ (open): Documentation added.
+ (SinkChannel.channel): Documentation added.
+ (SourceChannel.channel): Documentation added.
+ * java/nio/channel/SelectableChannel.java
+ (SelectableChannel): Documentation added.
+ (blockingLock): Documentation added.
+ (configureBlocking):Documentation added.
+ (isBlocking):Documentation added.
+ (isRegistered):Documentation added.
+ (keyFor):Documentation added.
+ (provider):Documentation added.
+ (register): Documentation added.
+ (validOps): Documentation added.
+ * jaba/nio/channels/SelectionKey.java
+ (SelectionKey): Documentation added.
+ (attach): Documentation added.
+ (attachment): Documentation added.
+ (isAcceptable): Documentation added.
+ (isConnetable): Documentation added.
+ (isReadable): Documentation added.
+ (isWritable): Documentation added.
+ (cancel): Documentation added.
+ (channel): Documentation added.
+ (interestOps): Documentation added.
+ (isValid): Documentation added.
+ (readyOps): Documentation added.
+ (selector): Documentation added.
+ * jaba/nio/channels/Selector.java
+ (Selector): Documentation added.
+ (open): Documentation added.
+ (close): Documentation added.
+ (isOpen): Documentation added.
+ (keys): Documentation added.
+ (provider): Documentation added.
+ (select): Documentation added.
+ (selectedKeys): Documentation added.
+ (selectNow): Documentation added.
+ (wakeup): Documentation added.
+ * java/nio/channels/spi/AbstractInterruptibleChannel.java
+ (AbstractInterruptibleChannel): Documentation added.
+ (opened): Default to true;
+ (begin): Documentation added.
+ (close): Set opened to false, documentation added.
+ (isOpen): Documentation added.
+ * java/nio/channels/spi/AbstractSelectionKey.java
+ (AbstractSelectionKey): Documentation added.
+ (cancel): Documentation added.
+ (isValid): Documentation added.
+ * java/nio/channels/spi/AbstractSelector.java
+ (AbstractSelector): Documentation added.
+ (begin): Documentation added.
+ (close): Documentation added.
+ (isOpen): Documentation added.
+ (deregister): Documentation added.
+ (end): Documentation added.
+ (provider): Documentation added.
+ (implCloseSelector): Documentation added.
+ (register): Documentation added.
+ * java/nio/channels/spi/SelectorProvider.java
+ (SelectorProvider): Documentation added.
+ (openDatagramChannel): Documentation added.
+ (openPipe): Documentation added.
+ (openSelector): Documentation added.
+ (openServerSocketChannel): Documentation added.
+ (openSocketChannel): Documentation added.
+ (provider): Documentation added.
+
+2002-11-12 Michael Koch <konqueror@gmx.de>
+
+ * java/nio/Buffer.java: Implemented.
+ * java/nio/CharBuffer.java: New file.
+ * java/nio/InvalidMarkException.java: New file.
+ * java/nio/channels/DatagramChannel.java: Implemented.
+ * java/nio/channels/ServerSocketChannel.java: Implemented.
+ * java/nio/channels/SocketChannel.java: Implemented.
+ * java/nio/channels/spi/AbstractChannel.java: Removed.
+ * java/nio/channels/spi/AbstractSelectableChannel.java:
+ Implemented.
+ * java/nio/charset/Charset.java:
+ Merge from Classpath.
+ * java/nio/charset/CharsetDecoder.java: New file.
+ * java/nio/charset/CharsetEncoder.java: New file.
+ * java/nio/charset/CoderResult.java: New file.
+ * Makefile.am (ordinary_java_source_files): Added new files.
+ * Makefile.in: Regenerated.
+
+2002-11-11 Jesse Rosenstock <jmr@ugcs.caltech.edu>
+
+ * gnu/java/nio/charset/ISO_8859_1.java,
+ gnu/java/nio/charset/Provider.java,
+ gnu/java/nio/charset/US_ASCII.java,
+ gnu/java/nio/charset/UTF_16.java,
+ gnu/java/nio/charset/UTF_16BE.java,
+ gnu/java/nio/charset/UTF_16Decoder.java,
+ gnu/java/nio/charset/UTF_16Encoder.java,
+ gnu/java/nio/charset/UTF_16LE.java,
+ gnu/java/nio/charset/UTF_8.java: New files.
+
+2002-11-11 Michael Koch <konqueror@gmx.de>
+
+ * java/nio/charset/CharacterCodingException.java:
+ This class must be public.
+ * java/nio/charset/CoderMalfunctionError.java:
+ This class must be public.
+ * java/nio/charset/CodingErrorAction.java:
+ This class must be public.
+ * java/nio/charset/IllegalCharsetNameException.java:
+ This class must be public, better implementation.
+ * java/nio/charset/MalformedInputException.java:
+ This class must be public, better implementation.
+ * java/nio/charset/UnmappableCharacterException.java:
+ This class must be public, better implementation.
+ * java/nio/charset/UnsupportedCharsetException.java:
+ This class must be public, better implementation.
+
+2002-11-11 Michael Koch <konqueror@gmx.de>
+
+ * java/nio/BufferOverflowException.java,
+ java/nio/BufferUnderflowException.java: New file.
+ * Makefile.am (ordinary_java_source_files):
+ Added new files.
+ * Makefile.in: Regenerated.
+
+2002-11-10 Tom Tromey <tromey@redhat.com>
+
+ * java/awt/Container.java (validate): Use tree lock.
+ (getComponent): Likewise.
+ (getComponents): Likewise.
+ (addImpl): Likewise.
+ (remove): Likewise.
+ (removeAll): Likewise.
+ (processEvent): Fixed indentation.
+ (getComponentAt): Use tree lock.
+ (findComponentAt): Likewise.
+ (removeNotify): Likewise.
+ (isAncestorOf): Likewise.
+ (list): Likewise.
+ (visitChildren): Likewise.
+ (findNextFocusComponent): Likewise.
+ (addNotifyContainerChildren): Likewise.
+ (getAccessibleChildrenCount): Likewise.
+ (getAccessibleChild): Likewise.
+
+ * java/awt/GridLayout.java (layoutContainer): Use tree lock.
+ (getSize): Likewise.
+ * java/awt/FlowLayout.java (layoutContainer): Use tree lock.
+ (getSize): Likewise.
+ * java/awt/BorderLayout.java (layoutContainer): Use tree lock.
+ (calcSize): Likewise.
+ * java/awt/CardLayout.java (getSize): Use tree lock.
+ (gotoComponent): Likewise.
+ (layoutContainer): Likewise.
+
+ * java/io/natFileDescriptorWin32.cc (read): Handle case where
+ count is 0.
+ * java/io/natFileDescriptorPosix.cc (read): Handle case where
+ count is 0.
+
+ * java/io/Externalizable.java, java/io/FilePermission.java,
+ java/io/ObjectStreamConstants.java, java/io/Serializable.java,
+ java/io/SerializablePermission.java, java/text/Format.java,
+ java/util/AbstractMap.java, java/util/HashMap.java,
+ java/util/LinkedHashMap.java, javax/naming/BinaryRefAddr.java: New
+ versions from Classpath.
+
+2002-11-10 Anthony Green <green@redhat.com>
+
+ * java/util/jar/Attributes.java (Name): Fix name check.
+
+2002-11-10 Mark Wielaard <mark@klomp.org>
+
+ * java/lang/natClass.cc (initializeClass): Throw NoClassDefFoundError
+ with getName() as message.
+ (_Jv_CheckArrayStore): Throw ArrayStoreException with object and array
+ type as message.
+
+ * java/lang/natVMThrowable.cc: Don't declare parameter t, it is
+ unused.
+
+2002-11-08 Ranjit Mathew <rmathew@hotmail.com>
+
+ * include/jni.h (JNIIMPORT, JNIEXPORT, JNICALL): Linker defines
+ for Win32. JNICALL has been defined to __stdcall to be compatible
+ with Sun's JDKs.
+
+2002-11-10 Tom Tromey <tromey@redhat.com>
+
+ * java/awt/GridLayout.java (setColumns): Check newCols, not cols.
+ (setRows): Check newRows, not rows.
+
+ * jni.cc (_Jv_GetJNIEnvNewFrame): Set env->ex in all cases.
+
+2002-11-09 Tom Tromey <tromey@redhat.com>
+
+ * java/applet/Applet.java, java/applet/AppletContext.java,
+ java/applet/AppletStub.java, java/applet/AudioClip.java,
+ java/awt/CardLayout.java,
+ java/awt/ContainerOrderFocusTraversalPolicy.java,
+ java/awt/Cursor.java, java/awt/Event.java, java/awt/Frame.java,
+ java/awt/GridBagConstraints.java, java/awt/GridBagLayout.java,
+ java/awt/GridLayout.java, java/awt/color/ColorSpace.java,
+ java/awt/color/ICC_ColorSpace.java,
+ java/awt/color/ICC_Profile.java,
+ java/awt/color/ICC_ProfileGray.java,
+ java/awt/color/ICC_ProfileRGB.java,
+ java/awt/datatransfer/DataFlavor.java,
+ java/awt/dnd/DragSourceContext.java, java/awt/dnd/DropTarget.java,
+ java/awt/dnd/DropTargetContext.java, java/awt/event/KeyEvent.java:
+ New versions from Classpath.
+ * Makefile.in: Rebuilt.
+ * Makefile.am (awt_java_source_files): Added ICC_ProfileGray and
+ ICC_ProfileRGB.
+
+ * java/awt/ScrollPane.java (ScrollPane): Fixed test for valid
+ display policy.
+
+ * java/awt/List.java (processEvent): Added missing `else's.
+
+ * java/awt/Window.java (show): validate() before showing. Make
+ parent displayable.
+ (isDisplayable): New method.
+
+2002-11-07 Mark Wielaard <mark@klomp.org>
+
+ Merge Orp RMI patches from Wu Gansha <gansha.wu@intel.com>
+ * java/rmi/MarshalledObject.java (equals): Check hashcode first.
+
+ * java/rmi/server/RMIClassLoader.java (MyClassLoader): Create/Use
+ annotation.
+ (loadClass): Take String as codebases.
+ (getClassAnnotation): Use MyClassLoader annotations.
+ * java/rmi/server/UnicastRemoteObject.java (UnicastRemoteObject):
+ call exportObject(this).
+
+ * gnu/java/rmi/RMIMarshalledObjectOutputStream.java
+ (RMIMarshalledObjectOutputStream): set locBytesStream and locStream.
+ (setAnnotation): Don't set locBytesStream and locStream.
+ (replaceObject): Removed.
+ (flush): Don't test locStream.
+ (getLocBytes): LikeWise.
+ * gnu/java/rmi/dgc/DGCImpl.java: extends UnicastServerRef.
+ (leaseCache): New field.
+ (dirty): Use leaseCache.
+ (LeaseRecord): New inner class.
+ * gnu/java/rmi/registry/RegistryImpl.java (RegistryImpl): Don't
+ explicitly call exportObject().
+ * gnu/java/rmi/registry/RegistryImpl_Stub.java: set useNewInvoke to
+ false to communicate with Sun JDK130.
+ * gnu/java/rmi/server/ConnectionRunnerPool.java: Add CPU comment.
+ * gnu/java/rmi/server/RMIObjectInputStream.java
+ (UnicastConnectionManager): Removed field.
+ * gnu/java/rmi/server/RMIObjectOutputStream.java (replaceObject):
+ Use UnicastServer.getExportedRef().
+ * gnu/java/rmi/server/UnicastConnection.java (reviveTime): New field.
+ (expireTime): Likewise.
+ (CONNECTION_TIMEOUT): Likewise.
+ (disconnect): Call sock.close().
+ (isExpired): New method.
+ (resetTime): Likewise.
+ (run): Use do while loop and catch Exception for discardConnection().
+ * gnu/java/rmi/server/UnicastConnectionManager.java: Pool connections.
+ * gnu/java/rmi/server/UnicastRef.java: Lots of changes.
+ * gnu/java/rmi/server/UnicastRemoteCall.java: Lots of changes.
+ * gnu/java/rmi/server/UnicastServer.java (refcache): New field.
+ (exportObject): Use refcache.
+ (unexportObject): Likewise.
+ (getExportedRef): New method.
+ * gnu/java/rmi/server/UnicastServerRef.java (UnicastServerRef): New
+ constructor.
+ (exportObject): Save manager.serverobj.
+ (getStub): New method.
+
+2002-11-07 Mark Wielaard <mark@klomp.org>
+
+ * java/lang/reflect/natField.cc (getBoolean): Use getType().
+ (getByte): Likewise.
+ (getShort): Likewise.
+ (getInt): Likewise.
+ (getLong): Likewise.
+ (getFloat): Likewise.
+ (getDouble): Likewise.
+ (get): Likewise.
+ (setChar): Likewise.
+ (setByte): Likewise.
+ (setShort): Likewise.
+ (setInt): Likewise.
+ (setLong): Likewise.
+ (setFloat): Likewise.
+ (setDouble): Likewise.
+
+2002-11-07 Michael Koch <konqueror@gmx.de>
+
+ * java/awt/Choice.java,
+ java/awt/Container.java,
+ java/awt/GridBagLayout.java:
+ Fixed documentation.
+ * java/awt/peer/ContainerPeer.java:
+ Reindented.
+
+2002-11-07 Michael Koch <konqueror@gmx.de>
+
+ * java/awt/color/ICC_Profile.java:
+ Added missing constants.
+ * java/awt/color/ICC_ColorSpace.java
+ (getMinValue): Added dummy implementation.
+ (getMaxValue): Added dummy implementation.
+ * java/awt/datatransfer/DataFlavor.java
+ (imageFlavor): Added.
+ (isMimeTypeEqual): Must be final.
+ (getDefaultRepresentationClass): Must be non-static.
+ (getDefaultRepresentationClassAsString): Must be non-static.
+ * java/awt/dnd/DragSourceContext.java
+ (dragExit): Corrected argument.
+ (dragDropEnd): Corrected argument.
+ * java/awt/dnd/DragSourceListener.java.java
+ (dragExit): Corrected argument.
+ (dragDropEnd): Corrected argument.
+ * java/awt/font/TextHitInfo.java
+ (toString): Added stubbed implementation.
+ * java/awt/geom/PathIterator.java:
+ The constants must be static.
+ * java/awt/image/VolatileImage.java
+ (IMAGE_INCOMPATIBLE): Fixed typo.
+ * java/awt/image/renderable/RenderableImage.java
+ (HINTS_OBSERVED): Must be static.
+ * java/beans/BeanInfo.java:
+ Constants must be final.
+
+2002-11-06 Tom Tromey <tromey@redhat.com>
+
+ From svens@it.uu.se. For PR libgcj/8481.
+ * java/util/Random.java (nextInt(int)): Only use 31 bits.
+
+2002-11-06 Tom Tromey <tromey@redhat.com>
+
+ * jni.cc (array_from_valist): Assume that jlong won't be
+ promoted.
+
+2002-11-04 R. A. Rivas Diaz <rivasdiaz@yahoo.com>
+
+ * gnu/java/security/provider/SHA.java (engineGetDigestLength):
+ Return 20.
+ * gnu/java/security/provider/MD5.java (engineGetDigestLength):
+ Return 16.
+
+2002-11-03 Tom Tromey <tromey@redhat.com>
+
+ * java/lang/ClassLoader.java (loadClass): Call loadClass on
+ VMClassLoader, not findClass.
+
+2002-11-03 Jeff Sturm <jsturm@one-point.com>
+
+ * resolve.cc (METHOD_NOT_THERE, METHOD_INACCESSIBLE): Remove.
+ (_Jv_ResolvePoolEntry): Use _Jv_Method.index, not
+ _Jv_DetermineVTableIndex, to determine vtable offset.
+ (_Jv_DetermineVTableIndex): Remove.
+ (_Jv_PrepareClass): Don't layout vtable. Use _Jv_MakeVTable instead.
+
+ * java/lang/Class.h (friend int _Jv_DetermineVTableIndex): Remove.
+
+2002-11-03 Tom Tromey <tromey@redhat.com>
+
+ * java/nio/channels/AlreadyConnectedException.java: Extend
+ IllegalStateException, per spec.
+
+2002-10-31 Stephen Crawley <crawley@dstc.edu.au>
+
+ * java/lang/Double.java (valueOf): Return new Double(parseDouble(s)).
+
+2002-10-31 Wu Gansha <gansha.wu@intel.com>:
+
+ * java/util/ArrayList.java (readObject, writeObject): Only read/write
+ size items.
+
+2002-10-31 Wu Gansha <gansha.wu@intel.com>:
+
+ * java/io/DataInputStream.java (convertFromUTF): Give StringBuffer an
+ initial estimated size to avoid enlarge buffer frequently.
+
+2002-10-31 Wu Gansha <gansha.wu@intel.com>:
+
+ * java/lang/reflect/Proxy.java (ProxyType): Set loader to System
+ ClassLoader when null.
+ (ProxyType.hashCode): Loader null check no longer needed.
+ (ProxyType.sameTypes): New method.
+ (ProxyType.equals): Use new method.
+
+2002-10-31 Mark Wielaard <mark@klomp.org>
+
+ * java/net/URLDecoder.java (decode): Initialize Stringbuffer size to
+ length of String.
+ * java/net/URLEncoder.java (encode): Likewise.
+
+2002-10-31 Mark Wielaard <mark@klomp.org>
+
+ * java/util/zip/ZipInputStream.java (getNextEntry): Throw IOException
+ when stream is closed.
+ (closeEntry): Likewise.
+ (read): Likewise.
+ * java/util/zip/ZipOutputStream.java (putNextEntry): Throw
+ ZipException when no entry active.
+ (closeEntry): Likewise.
+ (write): Likewise.
+
+2002-11-02 Tom Tromey <tromey@redhat.com>
+
+ * java/lang/Class.h: Move JV_STATE_ERROR before JV_STATE_DONE.
+ * java/lang/natClass.cc (initializeClass): Don't return just
+ because self==thread.
+
+ For PR java/8415:
+ * java/lang/reflect/natMethod.cc (getType): Use _Jv_FindClass.
+ * prims.cc (_Jv_FindClassFromSignature): Indentation fix.
+
+2002-11-02 Andreas Schwab <schwab@suse.de>
+
+ * Makefile.am (AM_MAKEFLAGS): Don't pass JC1FLAGS, CC and CXX, do
+ pass GCJFLAGS.
+ (FLAGS_TO_PASS): Define.
+ * Makefile.in: Regenerated.
+
+2002-11-01 Michael Koch <konqueror@gmx.de>
+
+ * java/nio/ByteOrder.java: New file.
+ * java/nio/channels/DatagramChannel.java:
+ (DatagramChannel): New constructor.
+ * java/nio/channels/Pipe.java: New file.
+ * java/nio/channels/SelectableChannel.java: New file.
+ * java/nio/channels/SelectionKey.java: New file.
+ * java/nio/channels/Selector.java: New file.
+ * java/nio/channels/ServerSocketChannel.java
+ (ServerSocketChannel): New constructor.
+ * java/nio/channels/SocketChannel.java
+ (SocketChannel): New constructor.
+ * java/nio/channels/Pipe.java: New file.
+ * java/nio/channels/spi/AbstractChannel.java: New file.
+ * java/nio/channels/spi/AbstractInterruptibleChannel.java: New file.
+ * java/nio/channels/spi/AbstractSelectableChannel.java:
+ License added
+ (AbstractSelectableChannel): New stubbed method.
+ * java/nio/channels/spi/AbstractSelectionKey.java: New file.
+ * java/nio/channels/spi/AbstractSelector.java: New file.
+ * java/nio/channels/spi/SelectorProvider.java: New file.
+ * java/nio/charset/Charset.java: New file.
+ * java/nio/charset/CoderMalfunctionError.java: New file.
+ * java/nio/charset/CodingErrorAction.java: New file.
+ * java/nio/charset/spi/CharsetProvider.java
+ (charsetForName): Uncommented.
+ * Makefile.am (java_native_source_files): Added new files.
+ * Makefile.in: Regenerated.
+
+2002-11-01 Michael Koch <konqueror@gmx.de>
+
+ * java/net/InetAddress.java:
+ (isAnyLocalAddress): Implemented.
+ (isLoopbackAddress): Implemented, comment added.
+ (isLinkLocalAddress): Implemented, documentation added.
+ (isSiteLocalAddress): Implemented, documentation added.
+ (isMCGlobal): Implemented, documentation added.
+ (isMCNodeLocal): Implemented, documentation added.
+ (isMCLinkLocal): Implemented, documentation added.
+ (isMCSiteLocal): Implemented, documentation added.
+ (isMCOrgLocal): Implemented, documentation added.
+ (getHostName): Documentation added.
+ (getCanonicalHostName): Implemented, documentation added.
+ (getAddress): Documentation added.
+ (hashCode): Documentation added.
+ (equals): Documentation added.
+ (toString): Fixed implementation.
+ (getByAddress): Use Inet4Address and Inet6Address.
+ (lookup): New linewrap.
+ (getByName): SecurityManager check added, support Inet4Address and
+ Inet6address, comments added.
+ (getAllByName): SecurityManager check added, comments added.
+ * java/net/Inet6Address.java:
+ (Inet6Address): Initialize parent class with addr instead of null.
+ * java/net/URL.java
+ (equals): Documentation added.
+ (getFile): Documentation added.
+ (hashCode): Documentation added.
+ * java/net/natInetAddress.cc:
+ (aton): Fix IPv6 support.
+ * java/net/natPlainDatagramSocketImpl.cc:
+ (peek): Throw PortUnreachableException when suitable.
+ (peekData): Throw PortUnreachableException when suitable.
+ (send): Throw PortUnreachableException when suitable.
+ (receive): Throw PortUnreachableException when suitable.
+
+2002-10-27 Mark Wielaard <mark@klomp.org>
+
+ * java/util/zip/ZipFile.java (readLeShort): Take and use DataInput as
+ argument.
+ (readLeShort): Likewise and use byte[].
+ (readLeInt): Likewise.
+ (readEntries): Use new versions of methods and use byte[] for reading
+ a complete zip entry. Add ZipFile name to exceptions.
+ (entries): Add ZipFile name to exceptions.
+ (getEntry): Likewise.
+ (checkLocalHeader): Use new versions of methods and add ZipFile name
+ to exceptions.
+
+2002-10-31 Mark Anderson <mark@panonet.net>
+
+ * java/awt/GridBagLayout.java (setConstraints): New stubbed method
+ added
+
+2002-10-25 Krister Walfridsson <cato@df.lth.se>
+
+ * configure.in: Disable hash sync when not using threads.
+ * configure: Regenerated.
+
+2002-10-24 Tom Tromey <tromey@redhat.com>
+
+ * java/lang/natRuntime.cc (_Jv_SetDLLSearchPath): New function.
+ (_Jv_FindSymbolInExecutable): Removed argument name.
+ (insertSystemProperties): Call _Jv_SetDLLSearchPath if
+ java.library.path is set.
+
+ * gij.cc (help): Document --showversion.
+ (version): Don't exit.
+ (main): Handle --showversion. Exit if --version given.
+
+2002-10-23 Tom Tromey <tromey@redhat.com>
+
+ * jni.cc (_Jv_JNI_AllocObject): Removed old FIXME comment.
+ (array_from_valist): Correctly handle promotion for jint, jlong,
+ jfloat, and jdouble.
+
+2002-10-23 Ranjit Mathew <rmathew@hotmail.com>
+
+ * java/io/natFileWin32.cc (attr): Use FindFirstFile( ) instead of
+ GetFileAttributesEx( ) to find file length and modification times,
+ as the latter is not present on Windows 95.
+
+2002-10-21 Michael Koch <konqueror@gmx.de>
+
+ * java/net/URL.java
+ (URL): Activate SecurityManager checks.
+ (equals): Use URLStreamHandler implementation instead of doing it
+ alone. This allows special protocol stream handlers to change default
+ behaviour.
+ (hashCode): Use URLStreamHandler implementation instead of doing it
+ alone. This allows special protocol stream handlers to change default
+ behaviour.
+ * java/net/URLStreamHandler.java
+ (equals): Implemented default URL equality check.
+ (hostsEqual): Implemented default URL equality check.
+ (hashCode): Implemented default URL hashCode algorithm.
+ * java/net/natPlainDatagramSocketImpl.cc:
+ No lines longer then 80 characters.
+
+2002-10-20 Adam Megacz <adam@xwt.org>
+
+ * aclocal.m4 (CHECK_FOR_BROKEN_MINGW_LD): added
+ * configure.in: enabled hash sync on Win32
+ * include/win32-threads.h (_Jv_ThreadId_t): added.
+ * java/lang/natObject.cc (_Jv_MonitorEnter, _Jv_MonitorExit,
+ heavy_lock_obj_finalization_proc, wait, notify, notifyAll):
+ removed some posix-isms, use Thread::sleep() instead of usleep,
+ added code to clear bottom three bits if platform has a broken
+ linker. * include/win32-threads.h (_Jv_ThreadId_t): added.
+
+2002-10-19 Ranjit Mathew <rmathew@hotmail.com>
+
+ * java/lang/natRuntime.cc (insertSystemProperties): Added GCJ
+ runtime property "gnu.gcj.progname" containing the name used to
+ invoke the current Java program (similar to argv[0] for C
+ programs).
+
+2002-10-15 Tom Tromey <tromey@redhat.com>
+
+ Fix for PR libgcj/8234:
+ * java/util/zip/natInflater.cc (reset): Reset avail_in.
+ * java/util/zip/natDeflater.cc (reset): Reset avail_in.
+
+2002-10-13 Mark Wielaard <mark@klomp.org>
+
+ * mauve-libgcj: Enable Mauve tests that compile now.
+
+2002-10-11 Mark Wielaard <mark@klomp.org>
+
+ Fix for PR libgcj/8142
+ * java/lang/natClassLoader.cc (findClass): Skip inner classes when
+ loading native modules.
+
+2002-10-10 Michael Koch <konqueror@gmx.de>
+
+ * javax/swing/AbstractListModel.java
+ (getListDataListeners): New stubbed method.
+ javax/swing/DefaultBoundedRangeModel.java
+ (getChangeListeners): New stubbed method.
+ javax/swing/DefaultSingleSelectionModel.java
+ (getChangeListeners): New stubbed method.
+
+2002-10-10 Michael Koch <konqueror@gmx.de>
+
+ * gcj/.cvsignore: New file to ignore files generated during build.
+ * include/.cvsignore: New file to ignore files generated during build.
+
+2002-10-10 Michael Koch <konqueror@gmx.de>
+
+ * java/net/HttpURLConnection.java
+ (getPermission): New method.
+ (getErrorStream): New stub method.
+ (getHeaderFieldDate): New stub method.
+ * java/net/Inet4Address.java:
+ (isLinkLocalAddress): Typo fixed.
+ * java/net/InetAddress.java:
+ (readResolve): New stubbed method (for serialization).
+ (isAnyLocalAddress): New stubbed method.
+ (isLoopbackAddress): New stubbed method.
+ (isLinkLocalAddress): New stubbed method.
+ (isSiteLocalAddress): New stubbed method.
+ (isMCGlobal): New stubbed method.
+ (isMCNodeGlobal): New stubbed method.
+ (isMCLinkLocal): New stubbed method.
+ (isMCSiteLocal): New stubbed method.
+ (isMCOrgLocal): New stubbed method.
+ (getCanonicalHostName): New stubbed method.
+ (getByAddress): Create instances of Inet4Address/Inet6Address,
+ instead of InetAddress, documentation added.
+ * java/net/MulticastSocket.java
+ (getInterface): Removed FIXME.
+ (getNetworkInterface): New method.
+ (setNetworkInterface): New method.
+ * java/net/NetworkInterface.java:
+ (toString): Use property "line.separator" instead of "\n".
+ * java/net/URLConnection.java
+ (getContent): New stubbed method.
+ * java/net/URLStreamHandler.java:
+ (equals): New stubbed method.
+ (hostsEqual): New stubbed method.
+ (hashCode): New stubbed method.
+ * java/net/natNetworkInterface.cc:
+ (getRealNetworkInterfaces): Create Inet4Address object
+ instead of InetAddress.
+
+2002-10-08 Ulrich Weigand <uweigand@de.ibm.com>
+
+ * interpret.cc (_Jv_InterpMethod::run): Use UINT32 instead of
+ unsigned long temporary to implement insn_iushr shifts.
+
+2002-10-08 Ulrich Weigand <uweigand@de.ibm.com>
+
+ * configure.host [s390*-*]: Enable Java interpreter.
+ Enable hash synchronization. Add sysdeps dir.
+ * sysdep/s390/locks.h: New file.
+
+2002-10-06 Mark Wielaard <mark@klomp.org>
+
+ * java/lang/Thread.java (setDaemon): Check startable_flag,
+ not isAlive().
+
+2002-10-07 Michael Koch <konqueror@gmx.de>
+
+ * java/nio/Buffer.java: New stub file.
+ * java/nio/charset/spi/CharsetProvider.java: Commented out all usages
+ of class Charset.
+ * Makefile.am (java_native_source_files): Added java/nio/Buffer.java.
+ * Makefile.in: Regenerated.
+
+2002-10-07 Michael Koch <konqueror@gmx.de>
+
+ * java/nio/ByteBuffer.java:
+ removed import of not commited class.
+
+2002-10-07 Michael Koch <konqueror@gmx.de>
+
+ * java/nio/ByteBuffer.java,
+ java/nio/MappedByteBuffer.java:
+ New files, forgot to add these dummies.
+ * Makefile.am (java_native_source_files): Added new files.
+ * Makefile.in: Regenerated.
+
+2002-10-07 Michael Koch <konqueror@gmx.de>
+
+ * java/nio/channels/AlreadyConnectedException.java,
+ java/nio/channels/ClosedChannelException.java,
+ java/nio/channels/ReadableByteChannel.java,
+ java/nio/channels/InterruptibleChannel.java,
+ java/nio/channels/Channel.java,
+ java/nio/channels/ByteChannel.java,
+ java/nio/channels/GatheringByteChannel.java,
+ java/nio/channels/ScatteringByteChannel.java,
+ java/nio/channels/WritableByteChannel.java,
+ java/nio/charset/CharacterCodingException.java,
+ java/nio/charset/IllegalCharsetNameException.java,
+ java/nio/charset/MalformedInputException.java,
+ java/nio/charset/UnmappableCharacterException.java,
+ java/nio/charset/UnsupportedCharsetException.java,
+ java/nio/charset/spi/CharsetProvider.java: New file.
+ These files are exceptions or interfaces,
+ no real or abstract classes.
+ * Makefile.am (java_native_source_files): Added new files.
+ * Makefile.in: Regenerated.
+
+2002-10-05 Michael Koch <konqueror@gmx.de>
+
+ * java/net/InetAddress.java
+ (getByAddress): Fixed documentation.
+ (getByAddress): New method.
+ * java/net/Inet4Address.java: New file.
+ * java/net/URL.java
+ (URL): Documentation added.
+ (getContent): Documentation added.
+ (getContent): New stubbed method.
+ (getQuery): New method.
+ (openConnection): Documentation added.
+ (openStream): Documentation added.
+ (setURLStreamHandlerFactory): Documentation added.
+ * java/net/URI.java: New stub file.
+ * Makefile.am
+ (java_native_source_files): Added java/net/Inet4Address.java,
+ java/net/Inet6Address.java and java/net/URI.java.
+ * Makefile.in: Regenerated.
+
+2002-10-04 C. Scott Ananian <cananian@lesser-magoo.lcs.mit.edu>
+
+ * java/lang/ProtectionDomain.java (linesep): Remove field.
+ (toString): Use System.getProperty("line.separator").
+
+2002-10-04 Michael Koch <konqueror@gmx.de>
+
+ * java/security/Identity.java: Added serialVersionUID.
+ * java/security/KeyPair.java: Added serialVersionUID.
+ * java/security/Provider.java: Added serialVersionUID.
+ * java/security/SecureRandom.java: Added serialVersionUID.
+ * java/security/SecureRandomSpi.java: Added serialVersionUID.
+ * java/security/SignedObject.java: Added serialVersionUID.
+ * java/security/cert/Certificate.java: Added serialVersionUID.
+
+2002-10-04 Mark Wielaard <mark@klomp.org>
+
+ * java/security/Security.java: Use java.home or gnu.classpath.home
+ to load providers.
+ (loadProviders): Extra dir argument.
+ (getProvider): Return null when not found.
+
+2002-10-04 Mark Wielaard <mark@klomp.org>
+
+ * java/lang/Throwable.java: Remerge with Classpath.
+
+2002-10-04 Michael Koch <konqueror@gmx.de>
+
+ * java/net/InetAddress.java:
+ (isMulticastAddress): Added documentation.
+ (getHostAddress): Added documentation.
+ (toString): Added documentation.
+ (getByAddress): Fixed documentation.
+ (getByName): Added documentation.
+ (getAllByName): Added documentation.
+ (getLocalHost): Added documentation.
+
+2002-10-04 Michael Koch <konqueror@gmx.de>
+
+ * java/beans/beancontext/BeanContextChildSupport.java:
+ Added serialVersionUID.
+ * java/text/Collator.java: (compare): Made documentation HTML-aware.
+ * javax/naming/BinaryRefAddr.java: Added serialVersionUID.
+ * javax/naming/Name.java: Added serialVersionUID.
+
+2002-10-03 Adam Megacz <adam@xwt.org>
+
+ * natNetworkInterface.cc (getRealNetworkInterfaces): ifdef out
+ some functionality that isn't supported yet on WIN32.
+
+2002-10-03 Tom Tromey <tromey@redhat.com>
+
+ * Makefile.in: Rebuilt.
+ * Makefile.am (awt_java_source_files): Added new files.
+
+2002-10-03 Michael Koch <konqueror@gmx.de>
+
+ * java/net/InetAddress.java
+ (class InetAddress): Removed final keyword.
+ (equals): Fixed typo.
+ (getByAddress): New method.
+
+2002-10-03 Michael Koch <konqueror@gmx.de>
+
+ * java/awt/dnd/Autoscroll.java:
+ New file, merge from Classpath.
+ * java/awt/dnd/DragSourceAdapter.java:
+ (dragExit): Fixed typos in argument type.
+ (dragDropEnd): Fixed typos in argument type.
+ * java/awt/dnd/DragSourceDropEvent.java:
+ New file, merge from Classpath.
+ * java/awt/dnd/DropTarget.java:
+ Added stubs, merge from Classpath.
+ * java/awt/dnd/DropTargetAdapter.java:
+ New file, merge from Classpath.
+ * java/awt/dnd/DropTargetContext.java:
+ New file, merge from Classpath.
+ * java/awt/dnd/DropTargetDragEvent.java:
+ New file, merge from Classpath.
+ * java/awt/dnd/DropTargetDropEvent.java:
+ New file, merge from Classpath.
+ * java/awt/dnd/DropTargetEvent.java:
+ New file, merge from Classpath.
+ * java/awt/dnd/DropTargetListener.java:
+ New file, merge from Classpath.
+ * java/awt/dnd/MouseDragGestureRecognizer.java:
+ New file, merge from Classpath.
+ * java/awt/dnd/peer/DropTargetContextPeer.java:
+ New file, merge from Classpath.
+
+2002-10-03 Michael Koch <konqueror@gmx.de>
+
+ * java/net/DatagramPacket.java
+ (setLength): Fixed typo and be HTML-aware.
+ * java/net/InetSocketAddress.java
+ (InetSocketAddress): Correct initialization of hostname, fixed typo.
+ (equals): Added comment about equality of InetSocketAddress objects.
+ * java/net/ServerSocket.java
+ (accept): Added checks.
+ (isClosed): New stubbed method.
+ * java/net/SocketOptions.java: Reindention.
+ * java/net/SocketPermission
+ (SocketPermission): Documentation fixed.
+
+2002-10-03 Michael Koch <konqueror@gmx.de>
+
+ * java/net/DatagramSocket.java
+ (receive): Check with SecurityManager AFTER the packet is received,
+ check if connected to multicast address, documentation added.
+ (send): Only check SecurityManager if connected, check address of
+ packet to send.
+ (connect): Implemented, documentation added.
+ * java/net/Inet6Address.java: New file (not added yet to Makefile.am).
+ * java/net/InetSocketAddress.java
+ (whole file): Reindented.
+ (hostname): New attribute.
+ (InetSocketAddress): Initialize new attribute.
+ (getAddress): Documentation added.
+ (getHostName): Documentation added.
+ (getPort): Documentation added.
+ (hashCode): Documentation added.
+ (isUnresolved): Documentation added.
+ (toString): Conform to output of JDK 1.4.1, documentation added.
+ * java/net/MulticastSocket.java
+ (joinGroup): Removed FIXME, documentation added.
+ (leaveGroup): Removed FIXME, documentation added.
+ (send): Documentation added.
+ * java/net/Socket.java
+ (inputShutdown): New variable.
+ (outputShutdown): New variable.
+ (Socket): Initialize new variables.
+ (getRemoteSocketAddress): Check if connected.
+ (shutdownInput): Set new variable.
+ (shutdownOutput): Set new variable.
+ (isConnected): New method.
+ (isClosed): New method.
+ (isInputShutdown): New method.
+ (isOutputShutdown): New method.
+ * java/net/URLStreamHandler.java
+ (URLStreamHandler): New method.
+ (openConnection): Added documentation.
+ (parseURL): Added documentation.
+ (getHostAddress): New method.
+ (getDefaultPort): New method.
+
+2002-10-02 Tom Tromey <tromey@redhat.com>
+
+ * java/rmi/activation/ActivationDesc.java,
+ java/rmi/activation/ActivationGroupDesc.java,
+ java/rmi/activation/ActivationGroupID.java,
+ java/rmi/activation/ActivationID.java: New versions from
+ Classpath.
+
+2002-09-30 Bo Thorsen <bo@suse.de>
+
+ * sysdep/x86-64/locks.h (compare_and_swap): Fix multilib support.
+
+2002-09-30 Tom Tromey <tromey@redhat.com>
+
+ * java/io/ObjectInputStream.java (resolveProxyClass): New method
+ from Classpath.
+ * Makefile.in: Rebuilt.
+ * Makefile.am (rmi_java_source_files): Added new files.
+ * gnu/java/rmi/RMIMarshalledObjectInputStream.java,
+ gnu/java/rmi/RMIMarshalledObjectOutputStream.java,
+ gnu/java/rmi/server/ConnectionRunnerPool.java: New files from
+ Classpath.
+ * gnu/java/rmi/dgc/DGCImpl.java,
+ gnu/java/rmi/dgc/DGCImpl_Skel.java,
+ gnu/java/rmi/dgc/DGCImpl_Stub.java,
+ gnu/java/rmi/registry/RegistryImpl_Skel.java,
+ gnu/java/rmi/registry/RegistryImpl_Stub.java,
+ gnu/java/rmi/server/RMIHashes.java,
+ gnu/java/rmi/server/RMIObjectInputStream.java,
+ gnu/java/rmi/server/RMIObjectOutputStream.java,
+ gnu/java/rmi/server/UnicastConnection.java,
+ gnu/java/rmi/server/UnicastConnectionManager.java,
+ gnu/java/rmi/server/UnicastRef.java,
+ gnu/java/rmi/server/UnicastServer.java,
+ gnu/java/rmi/server/UnicastServerRef.java,
+ java/rmi/MarshalledObject.java,
+ java/rmi/server/RMIClassLoader.java,
+ java/rmi/server/RemoteObject.java,
+ java/rmi/server/UnicastRemoteObject.java,
+ java/security/SecureClassLoader.java: Merged from Classpath.
+
+2002-09-29 Anthony Green <green@redhat.com>
+
+ * java/lang/reflect/UndeclaredThrowableException.java: New file.
+ Imported from GNU Classpath.
+ * java/lang/reflect/natProxy.cc: New file.
+ * java/lang/reflect/InvocationHandler.java: New file. Imported
+ from GNU Classpath.
+ * java/lang/reflect/Proxy.java: New file. Imported from GNU
+ Classpath.
+ * gnu/java/lang/reflect/TypeSignature.java: Refresh from GNU
+ Classpath.
+ * gnu/classpath/Configuration.java.in (HAVE_NATIVE_GET_PROXY_DATA,
+ HAVE_NATIVE_GET_PROXY_CLASS, HAVE_NATIVE_GENERATE_PROXY_CLASS):
+ New statics.
+ * gcj/javaprims.h ("Java"): Add new classes.
+ * java/lang/reflect/Proxy.java: Fix check for duplicate interfaces.
+ * Makefile.am (java/lang/reflect/Proxy$$ProxyData.h): Create this.
+ java/lang/reflect/Proxy$$ProxyType.h): And this.
+ (inner_nat_headers): Add these new headers.
+ (ordinary_java_source_files): Add new files.
+ (nat_source_files): Add new file.
+ * Makefile.in: Rebuilt.
+
+2002-09-28 Richard Earnshaw <rearnsha@arm.com>
+
+ * configure.host: Handle arm*-elf, strongarm*-elf and xscale*-elf with
+ a single configuration.
+
+2002-09-25 Jesse Rosenstock <jmr@ugcs.caltech.edu>
+
+ * java/util/TimeZone.java (getDSTSavings): New method.
+ Fixes PR libgcj/7786.
+
+2002-09-25 Jesse Rosenstock <jmr@ugcs.caltech.edu>
+
+ * resolve.cc (_Jv_ResolvePoolEntry) [end_of_method_search]: Check
+ to see if `the_method == 0' before looking up vtable index.
+ Fixes PR libgcj/7709.
+
+2002-09-25 Tom Tromey <tromey@redhat.com>
+
+ * java/lang/natClassLoader.cc:
+ (_Jv_PrepareCompiledClass): Throw NoClassDefFoundError, per spec.
+ * resolve.cc: Include NoClassDefFoundError.h, not
+ ClassNotFoundException.h.
+ (_Jv_ResolvePoolEntry): Throw NoClassDefFoundError, per spec.
+
+ * defineclass.cc: Don't include ClassNotFoundException.h.
+
+ * resolve.cc: Include StringBuffer.
+ (_Jv_ResolvePoolEntry): Use StringBuffer to create error string.
+
+ * boehm.cc (_Jv_MarkObj): Don't fail if class object has been
+ allocated but not initialized.
+
+2002-09-25 Jesse Rosenstock <jmr@ugcs.caltech.edu>
+
+ Fix for PR libgcj/7766:
+ * java/util/zip/ZipInputStream.java (entryAtEOF): New field.
+ (getNextEntry): Set it.
+ (closeEntry): Likewise.
+ (read): Likewise.
+ (close): Likewise.
+ (available): Use it.
+
+2002-09-25 Michael Koch <konqueror@gmx.de>
+
+ * java/net/DatagramSocket.java
+ (DatagramSocket): Initialize new instance variables.
+ (close): Reset new instance variables.
+ (getLocalAddress): Remove unneeded SecurityManager usage.
+ (getLocalPort): Check if socket is already bound.
+ (isConnected): New method.
+ (getInetAddress): Implemented.
+ (getPort): Better Implementation, documentation fixed.
+ (getRemoteSocketAddress): New method.
+ * java/net/JarURLConnection.java
+ (element): Typo fixed.
+ (getMainAttributes): New method.
+ (getAttributes): New method (stub only).
+ (getManifest): New method (stub only).
+ * java/net/NetPermission.java: Added serialVersionsUID.
+ * java/net/Socket.java
+ (connect): Check blocking mode of associated channel,
+ documentation added.
+ (getLocalSocketAddress): Better implementation.
+ (getRemoteSocketAddress): Implemented.
+ (isBound): New method.
+ (setSendBufferSize): Documentation added.
+ * java/net/SocketAddress.java: Added serialVersionsUID.
+ * java/net/SocketPermission.java: Added serialVersionsUID.
+ * java/net/URL.java
+ (URL): Wrap for shorter lines, initialize new instance variables,
+ documentation added.
+ (equals): Check new instance variables too.
+ (getContent): Documentation added.
+ (getPath): Documentation added.
+ (getAuthority): New method.
+ (getHost): Documentation added.
+ (getPort): Documentation added.
+ (getDefaultPort): New method.
+ (getProtocol): Documentation added.
+ (getUserInfo): Documentation added.
+ (set): Initialize new instance variables, documentation added.
+ * java/net/URLStreamHandler.java
+ (setURL): New method.
+ * java/net/natPlainDatagramSocketImpl.cc
+ (connect): Fix exception name.
+ (disconnect): Fix exception name.
+
+2002-09-25 Michael Koch <konqueror@gmx.de>
+
+ * java/nio/channels/spi/AbstractSelectableChannel.java: New file.
+ * java/nio/channels/DatagramChannel.java:
+ extends AbstractSelectableChannel
+ * java/nio/channels/ServerSocketChannel.java:
+ extends AbstractSelectableChannel
+ * java/nio/channels/SocketChannel.java:
+ extends AbstractSelectableChannel
+ * Makefile.am (ordinary_java_source_files):
+ java/nio/channels/spi/AbstractSelectableChannel.java added.
+ * Makefile.in: Regenerated.
+
+2002-09-25 Michael Koch <konqueror@gmx.de>
+
+ * java/net/DatagramSocket.java
+ (DatagramSocket): Exception documentation added.
+ (bind): Exception documentation added, addded SecurityManager check,
+ added SocketAddress type check.
+ (getSoTimeout): Check impl.
+ (receive): Fix SecurityManager check, check impl, documentation added.
+ (send): Check channel mode, documentation added.
+ (connect): New method.
+ (disconnect): Implemented.
+ (getLocalSocketAddress): New method.
+ (getReceiveBufferSize): Check impl.
+ (setReuseAddress): Check impl.
+ (getReuseAddress): Check impl.
+ (setBroadcast): Check impl.
+ (getBroadcast): Check impl.
+ (setTrafficClass): Check impl, Documentation cleared.
+ (getTrafficClass): Check impl.
+ (getSendBufferSize): Check impl.
+ (setReceiveBufferSize): Check impl, documentation added.
+ (setSendBufferSize): Documentation added.
+ (setDatagramSocketImplFactory): New method.
+ * java/net/HttpURLConnection.java
+ (HTTP_INTERNAL_ERROR): The correct code is 500.
+ (HTTP_NOT_IMPLEMENTED): Added new constant.
+ (setFollowRedirects): Documentation added.
+ (getInstanceFollowRedirects): New method.
+ (setInstanceFollowRedirects): New method.
+ (setRequestMethod): Documentation added.
+ (getResponseCode): Documentation added.
+ (getResponseMessage): Documentation added.
+ * java/net/JarURLConnection.java
+ (JarURLConnection): protected since JDK 1.4.
+ (getJarEntry): java.io.IOException to IOException, documentation added.
+ (getJarFile): Documentation added.
+ * java/net/ServerSocket.java
+ (ServerSocket): Private to public, exception added.
+ (ServerSocket): java.io.IOException to IOException, documentation added.
+ (bind): Check socket address type, documentation added.
+ (bind): java.io.IOException to IOException, documentation added.
+ (accept): Documentation added.
+ (implAccept): Check ch is not non-blocking, documentation added.
+ (setSoTimeout): Documentation fixed.
+ (setReceiveBufferSize): Documentation added.
+ * java/net/Socket.java
+ (Socket): Documentation added.
+ (bind): Documentation added.
+ (connect): Check socket address type, documentation added.
+ (getRemoteSocketAddress): New method.
+ (getLocalSocketAddress): New method.
+ (setSoLinger): Documentation added.
+ (getReuseAddress): New method.
+ (setReuseAddress): New method.
+ (getTrafficClass): New method.
+ (setTrafficClass): New method.
+ * java/net/URLStreamHandler.java
+ (openConnection): java.io.IOException to IOException.
+ (parseURL): Documentation added.
+ (sameFile): public to protected, documentation added.
+ (setURL): Documentation added.
+ * java/nio/IllegalBlockingModeException.java: New file.
+ * Makefile.am (ordinary_java_source_files):
+ added java/nio/IllegalBlockingModeException.java
+ * Makefile.in: Regenerated.
+
+2002-09-25 Michael Koch <konqueror@gmx.de>
+
+ * java/net/DatagramPacket
+ (DatagramPacket): Exception documentation added.
+ (setData): Likewise.
+ (setSocketAddress): Likewise.
+ * java/net/DatagramSocketImpl.java
+ (peek): Documentation addded.
+ (peekData): Documentation addded.
+ (send): Documentation addded.
+ (receive): Documentation addded.
+ (connect): New method.
+ (disconnect): New method.
+ (joinGroup): New abstract method.
+ (leaveGroup): New abstract method.
+ * java/net/InetSocketAddress.java
+ (InetSocketAddress): Documentation added.
+ (equals): final keyword added.
+ (getAddress): final keyword added.
+ (getHostName): final keyword added.
+ (getPort): final keyword added.
+ (hashCode): final keyword added.
+ (isUnresolved): final keyword added.
+ * java/net/MulticastSocket.java
+ (MulticastSocket): Documentation added.
+ (MulticastSocket): New method.
+ (joinGroup): Documentation added.
+ (joinGroup): New method.
+ (leaveGroup): Documentation added.
+ (leaveGroup): New method.
+ (send): Documentation added.
+ * java/net/NetworkInterface.java
+ (getByName): Documentation added.
+ (getByInetAddress): Documentation added.
+ (getNetworkInterfaces): Documentation added.
+ * java/net/PlainDatagramSocketImpl.java
+ (connect): New method.
+ (disconnect): New method.
+ * java/net/SocketImpl.java
+ (create): Documentation added.
+ (shutdownInput): Convert public to protected, as it always was.
+ (shutdownOutput): Convert public to protected, as it always was.
+ * java/net/SocketOptions.java
+ (whole file): Reintented.
+ * java/net/URLClassLoader.java
+ (URLClassLoader): SecurityManager check added, documentation added.
+ (findResources): Documentation added.
+ (findClass): Documentation added.
+ (newInstance): More correct method arguments.
+ * java/net/URLConnection.java
+ (connect): Documentation added.
+ (getContent): Documentation added.
+ (getPermission): Documentation added.
+ (getInputStream): Documentation added.
+ (getOutputStream): Documentation added.
+ (setDoInput): Throw correct exception, documentation added.
+ (setDoOutput): Throw correct exception, documentation added.
+ (setAllowUserInteraction): Throw correct exception, documentation added.
+ (setUseCaches): Throw correct exception, documentation added.
+ (setIfModifiedSince): Throw correct exception, documentation added.
+ (setRequestProperty): Throw exception, documentation added.
+ (addRequestProperty): Throw exception, documentation added.
+ (getRequestProperty): Throw exception, documentation added.
+ (getRequestProperties): Documentation added.
+ (setContentHandlerFactory): Documentation added.
+ (guessContentTypeFromName): protected to public.
+ (setFileNameMap): Documentation added.
+ * java/net/URLDecoder.java
+ (URLDecoder): New method.
+ (decode): Documentation added.
+ (whole file): Reindented.
+ * java/net/URLEncoder.java
+ (encode): Documentation added.
+ * java/net/natPlainDatagramSocketImpl.cc
+ (connect): New method.
+ (disconnect): New method.
+ * javax/naming/RefAddr:
+ (addrType): addrType was never final.
+ (equals): Fix typo in method name.
+ * javax/naming/BinaryRefAddr:
+ (equals): Fix typo in method name.
+
+2002-09-22 Tom Tromey <tromey@redhat.com>
+
+ Fix for PR libgcj/6576:
+ * java/util/ResourceBundle.java (tryBundle): Cache `null' if we
+ didn't find a given bundle.
+ (getBundle): Don't require base bundle.
+ (setParent): Removed old comment.
+ (tryLocalBundle): Try components even if preceding components were
+ empty.
+
+2002-09-22 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * Makefile.am (all-multi): Fix multilib parallel build.
+
+2002-09-21 Michael Koch <konqueror@gmx.de>
+
+ * java/net/Socket.java
+ (sendUrgentData): New method.
+ (getChannel): New method.
+ * java/net/ServerSocket.java
+ (getChannel): New method.
+ (isBound): New method.
+ * java/net/DatagramSocket.java
+ (DatagramSocket): Two new methods.
+ (bind): New method.
+ (getChannel): New method.
+ (isBound): New method.
+ (send): Added newline to to make shorter lines.
+ * java/net/PlainDatagramSocketImpl.java
+ (mcastGrp): Added argument.
+ (join): Use new mcastGrp.
+ (leave): Use new mcastGrp.
+ (joinGroup): New method.
+ (leaveGroup): New method.
+ * java/net/natPlainDatagramSocketImpl.cc
+ (mcastGrp): Added argument, no yet really implemented.
+ (getOption): Added newline for shorter lines.
+ * java/net/natPlainSocketImpl.cc
+ (read, setOption, getOption): Added newline for shorter lines.
+
+2002-09-19 Tom Tromey <tromey@redhat.com>
+
+ * java/lang/ClassLoader.java (resolveClass0): Set cause for
+ newly-created exception.
+
+2002-09-18 Michael Koch <konqueror@gmx.de>
+
+ * java/util/regex/Matcher.java, java/util/regex/Pattern.java,
+ java/util/regex/PatternSyntaxException.java:
+ Merge with classpath, new files.
+ * Makefile.am (core_java_source_files):
+ Added java/util/regex/Matcher.java,
+ java/util/regex/Pattern.java,
+ java/util/regex/PatternSyntaxException.java
+ * Makefile.in: Regenerated.
+ * include/config.h.in: Added HAVE_NET_IF_H.
+ * java/net/natNetworkInterface.cc (getRealNetworkInterfaces):
+ Removed #if 0 ... #endif.
+
+2002-09-17 Michael Koch <konqueror@gmx.de>
+
+ * java/net/natNetworkInterface.cc:
+ Removed unneed and yet wrong includes.
+
+2002-09-17 Michael Koch <konqueror@gmx.de>
+
+ * java/net/NetworkInterface.java: New file.
+ * java/net/natNetworkInterface.java: New file.
+ * configure.in: Added check for net/if.h.
+ * configure: Regenerated.
+ * Makefile.am
+ (ordinary_java_source_files): Added NetworkInterface.java.
+ (nat_source_files): Added natNetworkInterface.cc.
+ * Makefile.in: Regenerated.
+
+2002-09-16 Tom Tromey <tromey@redhat.com>
+
+ * java/net/URLClassLoader.java (findClass): Code source for a
+ class from a jar is not necessarily a jar: URL.
+
+2002-09-16 Michael Koch <konqueror@gmx.de>
+
+ * java/lang/AssertionError.java:
+ Merge with classpath, fixes HTML.
+ * java/rmi/server/LogStream.java:
+ Merge with classpath, fixes some constants.
+ * java/net/server/RemoteServer.java:
+ Merge with classpath, adds serialVersionUID.
+ * javax/naming/BinaryRefAddr.java:
+ Merge with classpath, s/equal/equals/.
+ * javax/naming/NamingException.java:
+ Merge with classpath, fixed typo.
+ * javax/naming/RefAddr.java:
+ Merge with classpath, s/equal/equals/.
+ * java/awt/Toolkit.java:
+ s/gnu.java.awt.peer.gtk.GtkToolkit/gnu.awt.gtk.GtkToolkit/
+ and typo fixed.
+
+2002-09-15 Adam Megacz <adam@xwt.org>
+
+ * java/net/natPlainSocketImpl.cc: fixed typo.
+
+2002-09-15 Adam Megacz <adam@xwt.org>
+
+ * java/net/natPlainSocketImpl.cc: #ifdef-shielded socket timeouts,
+ which don't work on Win32 (yet).
+
+2002-09-14 Adam Megacz <adam@xwt.org>
+
+ * java/net/natPlainDatagramSocket.cc: removed #include
+ <ws2tcpip.h>; the mingw header is broken (conflicts with itself).
+ * include/win32.h: included definition for IP_TOS to satisfy
+ natPlainDatagramSocket.cc
+
+2002-09-13 Michael Koch <konqueror@gmx.de>
+
+ * java/net/DatagramPacket.java (DatagramPacket):
+ Added linebreak for 80 chars per line.
+ * java/net/JarURLConection.java
+ (getInputStreami, getJarEntry): Likewise.
+ * java/net/SocketPErmission.java
+ (SocketPermission class docu, implies): Likewise.
+ * java/net/URLClassLoader.java (findResources): Likewise.
+ * java/net/URLConnection.java: Reindendet remark for 80 chars per line
+
+2002-09-13 Michael Koch <konqueror@gmx.de>
+
+ * java/nio/channels/DatagramChannel.java,
+ java/nio/channels/ServerSocketChannel.java
+ java/nio/channels/SocketChannel.java:
+ New dummy files to make java.net fully JDK 1.4 compatible
+ * Makefile.am (ordinary_java_source_files): Added
+ java/net/DatagramSocketImplFactory.java (long forgotten),
+ java/nio/SocketChannel.java,
+ java/nio/ServerSocketChannel.java,
+ java/nio/DatagramChannel.java
+ * Makefile.in: Regenrated.
+
+2002-09-12 Michael Koch <konqueror@gmx.de>
+
+ * java/net/DatagramSocketImpl.java
+ (peekData): New method.
+ * java/net/PlainDatagramSocketImpl.java
+ (peekData): New method.
+ * java/net/natPlainDatagramSocketImpl.cc
+ (peekData): New method.
+ * java/net/URLConnection
+ (getPermission): New method.
+ (addRequestProperty): New method.
+ (getRequestProperties): New method.
+ (guessContentTypeFromStream): New method, not really implemented.
+ (URLConnection): Added/updated documentation.
+ (connect): Added/updated documentation.
+ (getURL): Added/updated documentation.
+ (getContentLength): Added/updated documentation.
+ (getContentType: Added/updated documentation.
+ (getContentEncoding): Added/updated documentation.
+ (getExpiration): Added/updated documentation.
+ (getDate): Added/updated documentation.
+ (getLastModified): Added/updated documentation.
+ (getHeaderField): Added/updated documentation.
+ (getHeaderFields): Added/updated documentation.
+ (getHeaderFieldInt): Added/updated documentation.
+ (getHeaderFieldDate): Added/updated documentation.
+ (getHeaderFieldKey): Added/updated documentation.
+ (getContent): Added/updated documentation.
+ (getInputStream): Added/updated documentation.
+ (getOutputStream): Added/updated documentation.
+ (toString): Added/updated documentation.
+ (setDoInput): Added/updated documentation.
+ (getDoInput): Added/updated documentation.
+ (setDoOutput): Added/updated documentation.
+ (getDoOutput): Added/updated documentation.
+ (setAllowUserInteraction): Added/updated documentation.
+ (getAllowUserInteraction): Added/updated documentation.
+ (setDefaultAllowUserInteraction): Added/updated documentation.
+ (getDefaultAllowUserInteraction): Added/updated documentation.
+ (setUseCaches): Added/updated documentation.
+ (getUseCaches): Added/updated documentation.
+ (setIfModifiedSince): Added/updated documentation.
+ (getIfModifiedSince): Added/updated documentation.
+ (getDefaultUseCaches): Added/updated documentation.
+ (setDefaultUseCaches): Added/updated documentation.
+ (setRequestProperty): Added/updated documentation.
+ (getRequestProperty): Added/updated documentation.
+ (setDefaultRequestProperty): Added/updated documentation.
+ (getDefaultRequestProperty): Added/updated documentation.
+ (setContentHandlerFactory): Added/updated documentation.
+ (guessContentTypeFromName): Added/updated documentation.
+ (getFileNameMap): Added/updated documentation.
+ (setFileNameMap): Added/updated documentation.
+
+2002-09-11 Michael Koch <konqueror@gmx.de>
+
+ * java/net/Socket.java
+ (Socket): protected to public (since JDK 1.4). Added @specnote.
+ (bind): New method.
+ (connect): Two new methods.
+ (getKeepalive): Get correct socket option.
+ (setKeepalive): Set correct socket option.
+ (getOOBInline): New method.
+ (setOOBInline): New method.
+ * java/net/ServerSocket.java
+ (bind): Two new methods.
+ (getInetAddress): Reimplemented, catch exception.
+ (getLocalSocketAddress): New method.
+ (setReuseAddress): New method.
+ (getReuseAdress): New method.
+ (setReceiveBufferSize): New method.
+ (getReceiveBufferSize): New method.
+ (toString): Made string JDK 1.4 compliant.
+
+2002-09-10 Michael Koch <konqueror@gmx.de>
+
+ * java/net/SocketImpl.java
+ (connect): New method.
+ (supportsUrgentData): New method.
+ (sendUrgentData): New method.
+ * java/net/PlainSocketImpl.java
+ (connect): One new method and two new implementation.
+ (sendUrgentData): New method.
+ * java/natPlainSocketImpl.cc
+ (connect): Arguments changed, added support for timeouts.
+ (getOption): Another __java_boolean to jboolean.
+
+2002-09-07 Adam Megacz <adam@xwt.org>
+
+ * java/net/natPlainDatagramSocket.cc: include ws2tcpip.h for
+ definition of IP_TOS.
+
+2002-09-04 Michael Koch <konqueror@gmx.de>
+
+ * java/net/DatagramSocket.java
+ (DatagramSocket): Added documentation.
+ (close): Likewise.
+ (getLocalAddress): Likewise.
+ (getLocalPort): Likewise.
+ (receive): Likewise.
+ (send): Likewise.
+ (setSoTimeout): Likewise.
+ (connect): New method.
+ (disconnect): New method.
+ (getInetAddress): New method (FIXME)
+ (getPort): New method.
+ (setReuseAddress): New method.
+ (getReuseAddress): New method.
+ (setBroadcast): New method.
+ (getBroadcast): New method.
+ (setTrafficClass): New method.
+ (getTrafficClass): New method.
+ * java/net/MulticastSocket.java):
+ (getTTL): Added @see in documentation.
+ (setTTL): Added @see in documentation.
+ (setLoopbackMode): New method.
+ (getLoopbackMode): New method.
+ * java/net/PlainSocketImpl.java:
+ Added new constants for the options SO_BROADCAST, SO_OOBINLINE,
+ IP_MULTICAST_IF2, IP_MULTICAST_LOOP, IP_TOS
+ * java/net/PlainDatagramSocketImpl.java
+ Added new constants for the options SO_BROADCAST, SO_OOBINLINE,
+ IP_MULTICAST_IF2, IP_MULTICAST_LOOP, IP_TOS
+ * java/net/natPlainSocketImpl.cc
+ (getOption): Implemented the options SO_BROADCAST, SO_OOBINLINE,
+ IP_MULTICAST_IF2, IP_MULTICAST_LOOP, IP_TOS
+ (setOption): Implemented the options SO_BROADCAST, SO_OOBINLINE,
+ IP_MULTICAST_IF2, IP_MULTICAST_LOOP, IP_TOS
+ This should also fix SO_KEEPALIVE
+ * java/net/natPlainDatagramSocketImpl.cc
+ (getOption): Implemented the options SO_BROADCAST, SO_OOBINLINE,
+ IP_MULTICAST_IF2, IP_MULTICAST_LOOP, IP_TOS
+ (setOption): Implemented the options SO_BROADCAST, SO_OOBINLINE,
+ IP_MULTICAST_IF2, IP_MULTICAST_LOOP, IP_TOS
+
+2002-09-04 Michael Koch <konqueror@gmx.de>
+
+ * java/net/SocketOptions.java: added static variables to be JDK 1.4
+ compatible (SO_BROADCAST, SO_OOBINLINE, IP_MULTICAST_IF2,
+ IP_MULTICAST_LOOP, IP_TOS
+
+2002-09-03 Tom Tromey <tromey@redhat.com>
+
+ * java/lang/Class.h (_getDeclaredMethod): Declare.
+ (_getMethod): Now private.
+ * java/lang/natClass.cc (_getDeclaredMethod): Renamed from
+ getDeclaredMethod. Now returns NULL on failure.
+ * java/lang/Class.java (_getDeclaredMethod): Declare.
+ (getDeclaredMethod): No longer native; implements access checks.
+
+2002-09-01 Mark Wielaard <mark@klomp.org>
+
+ * gnu/gcj/runtime/NameFinder.java (remove_interpreter): New field.
+ (sanitizeStack): Correctly reset unknown and interpreter counters,
+ detect interpreter runtime frames.
+ (demangleInterpreterMethod): New method.
+ * gnu/gcj/runtime/natNameFinder.cc (lookupInterp): Use new method.
+ * java/lang/natVMThrowable.cc (fillInStackTrace): Change order of
+ filling in addrs[].
+
+2002-09-02 Michael Koch <konqueror@gmx.de>
+
+ * java/net/DatagramPacket.java, java/net/MulticsstSocket.java:
+ re-indented documentation.
+
+2002-08-30 Jesse Rosenstock <jmr@ugcs.caltech.edu>
+
+ * java/util/Calendar.java (getTimeInMillis, getTimeInMillis): Now
+ public, per 1.4 spec. Fixes PR libgcj/7785.
+
+2002-08-30 Jeff Sturm <jsturm@one-point.com>
+
+ * Makefile.in: Rebuilt.
+ * Makefile.am (ZIP, GCJH): Remove $(EXEEXT).
+
+2002-08-29 Tom Tromey <tromey@redhat.com>
+
+ * java/net/JarURLConnection.java (getCertificates): New method
+ from Classpath.
+ * java/net/URLClassLoader.java (URLClassLoader): Extends
+ SecureClassLoader.
+ (definePackage): New method from Classpath.
+ (getPermissions): Likewise.
+ (newInstance): Likewise.
+ (findClass): Construct CodeSource for new class (from Classpath).
+ * java/net/SocketImpl.java (shutdownInput, shutdownOutput): New
+ methods.
+ * java/net/URL.java (getUserInfo): New method.
+ (set(String,String,int,String,String,String,String,String)): New
+ method.
+ * java/net/PlainSocketImpl.java (_Jv_SO_KEEPALIVE_): Define.
+ (shutdownInput, shutdownOutput): Declare.
+ * java/net/PlainDatagramSocketImpl.java (_Jv_SO_KEEPALIVE_):
+ Define.
+ * java/net/natPlainSocketImpl.cc (setOption): Handle keepalive.
+ (getOption): Likewise.
+ (shutdownInput): New method.
+ (shutdownOutput): Likewise.
+ * java/net/natPlainDatagramSocketImpl.cc (setOption): Handle
+ keepalive.
+ (getOption): Likewise.
+ * java/net/SocketOptions.java (SO_KEEPALIVE): New constant.
+ * java/net/Socket.java (setKeepAlive): New method.
+ (getKeepAlive): Likewise.
+ (shutdownInput, shutdownOutput): New methods.
+
+2002-08-29 Michael Koch <konqueror@gmx.de>
+
+ * java/net/DatagramPacket.java: updated to JDK 1.4 API
+ new methods are:
+ DatagramPacket(byte[] buf, int offset, int length, SocketAddress
+ address),
+ DatagramPacket(byte[] buf, int length, SocketAddress address),
+ void setSocketAddress(SocketAddress address)
+ public SocketAddress getSocketAddress()
+
+2002-08-29 Tom Tromey <tromey@redhat.com>
+
+ * java/io/natFileDescriptorPosix.cc (setLength): Handle case where
+ ftruncate is missing.
+ * configure, include/config.h.in: Rebuilt.
+ * acconfig.h (HAVE_FTRUNCATE): Mention.
+ * configure.in: Check for ftruncate.
+
+2002-08-29 Tom Tromey <tromey@redhat.com>
+
+ * include/jvm.h (struct _Jv_frame_info): New structure.
+ * gnu/gcj/runtime/natNameFinder.cc: Include StringBuffer.h,
+ java-interp.h.
+ (lookupInterp): New method.
+ (getAddrAsString): Use _Jv_frame_info.
+ (dladdrLookup): Likewise.
+ * gnu/gcj/runtime/NameFinder.java (lookup): Try to look up
+ interpreted frame.
+ (lookupInterp): Declare.
+ * java/lang/natVMThrowable.cc: Include Thread.h, java-interp.h.
+ (fillInStackTrace): Collect information on interpreted frames.
+ Use _Jv_frame_info.
+ * interpret.cc: Include Thread.h.
+ (run): Create and push _Jv_MethodChain object.
+ (_Jv_EndOfInterpreter): New global.
+ * java/lang/Thread.java (interp_frame): New field.
+ * include/java-interp.h (struct _Jv_MethodChain): New structure.
+ Include NameFinder.h.
+
+2002-08-28 Tom Tromey <tromey@redhat.com>
+
+ * java/lang/Class.h: Include Package.h.
+ (Class::getProtectionDomain): Declare.
+ (Class::getPackage): Declare.
+
+2002-08-28 Michael Koch <konqueror@gmx.de>
+
+ * java/net/InetSocketAddress.java: Added some documentation and argument
+ checks for the port numbers.
+ * java/net/DatagramSocketImplFactory.java: New file.
+
+2002-08-28 Michael Koch <konqueror@gmx.de>
+
+ * java/net/Authenticator.java: added some documentation.
+
+2002-08-27 Tom Tromey <tromey@redhat.com>
+
+ * java/lang/reflect/natConstructor.cc (newInstance): Initialize
+ class.
+ * java/lang/reflect/natMethod.cc (invoke): Initialize class.
+
+2002-08-27 Michael Koch <konqueror@gmx.de>
+
+ * java/net/BindException.java,
+ java/net/JarURLConnection.java,
+ java/net/FileNameMap.java,
+ java/net/HttpURLConnection.java,
+ java/net/InetSocketAddress.java,
+ java/net/DatagramPacket.java,
+ java/net/DatagramSocket.java,
+ java/net/DatagramSocketImpl.java,
+ java/net/MulticastSocket.java,
+ java/net/PasswordAuthentication.java,
+ java/net/ServerSocket.java,
+ java/net/Socket.java,
+ java/net/URLClassLoader.java,
+ java/net/URLConnection.java: add/update of some @since/@deprecated
+
+2002-08-27 Tony Kimball <alk@pobox.com>
+ Tom Tromey <tromey@redhat.com>
+
+ * java/net/natPlainDatagramSocketImpl.cc (NATIVE_CLOSE): New
+ define.
+ (::close): Removed.
+ (PlainDatagramSocketImpl::close): Use NATIVE_CLOSE.
+ * java/net/natPlainSocketImpl.cc (NATIVE_CLOSE): New define.
+ (::close): Removed.
+ (PlainSocketImpl::close): Use NATIVE_CLOSE.
+ * include/win32.h (getcwd): Removed declaration. Include io.h.
+
+2002-08-25 Adam Megacz <adam@xwt.org>
+
+ * include/win32.h (getcwd): copied function declaration as
+ temporary fix for header confusion.
+
+2002-08-24 Mark Wielaard <mark@klomp.org>
+
+ * Makefile.am (libgcj_la_SOURCES): Remove name-finder.cc.
+ (core_java_source_files): Add VMThrowable.java and NameFinder.java
+ (nat_source_files): Remove natThrowable.cc, add natVMThrowable.cc
+ and natNameFinder.cc.
+ * Makefile.in: Regenerate.
+ * prims.cc: Use trace_enabled from VMThrowable.
+ * name-finder.cc: Removed.
+ * gcj/javaprims.h: Add class VMThrowable.
+ * gnu/gcj/runtime/NameFinder.java: New file.
+ * gnu/gcj/runtime/natNameFinder.cc: Likewise.
+ * include/name-finder.h: Removed.
+ * java/lang/Throwable.java (printStackTrace (PrintStream)): Use new
+ method stackTraceString().
+ (printStackTrace (PrintWriter)): Likewise.
+ (stackTraceString): Complete rewrite of old printStackTrace using
+ StringBuffer.
+ (stackTraceStringBuffer): New helper method for stackTraceString().
+ (fillInStackTrace): Delegate to VMTrowable.
+ (getStackTrace): Likewise.
+ (getStackTrace0): Removed.
+ (trace_enabled, stackTraceBytes): Moved to new VMThrowable.java.
+ (setStackTrace): Copy given array.
+ * java/lang/natThrowable.cc: Removed (replaced by natVMThrowable).
+ * java/lang/VMThrowable.java: New class.
+ * java/lang/natVMThrowable.cc: New file.
+
+2003-08-23 Michael Koch <konqueror@gmx.de>
+
+ * java/net/URLConnection.java,
+ java/netJarURLConnection.java,
+ gnu/gcj/protocol/core/Connection.java,
+ gnu/gcj/protocol/file/Connection.java,
+ gnu/gcj/protocol/http/Connection.java: Added implementation of
+ getHeaderFields().
+
+2002-08-22 Tom Tromey <tromey@redhat.com>
+
+ * gij.cc (help): Document -cp and -classpath.
+ (main): Handle -classpath.
+
2002-08-21 Tom Tromey <tromey@redhat.com>
* Makefile.in: Rebuilt.
@@ -18,7 +2232,7 @@
* java/net/URISyntaxException.java: New file.
* java/net/SocketTimeoutException.java: New file.
- * java/net/PortUnreachableException.java: New file.
+ * java/net/PortUnreachableException.java: New file.
* Makefile.am: Updated.
* Makefile.in: Rebuilt.
@@ -76,7 +2290,7 @@
* Makefile.in: Regenerate.
* gnu/java/security/provider/DefaultPolicy.java
(getPermissions): Don't maintain static class variable of Permissions.
- * gnu/java/security/provider/SHA.java
+ * gnu/java/security/provider/SHA.java
(engineUpdate): algorithm change.
(engineDigest): algorithm change.
@@ -98,22 +2312,22 @@
* gnu/awt/j2d/Graphics2DImpl.java: Implement stubs for new abstract
methods in Graphics2D.
-
+
2002-08-09 Bryce McKinlay <bryce@waitaki.otago.ac.nz>
AWT/Swing merge from GNU Classpath.
- * java/awt/AlphaComposite.java, java/awt/AttributeValue.java,
+ * java/awt/AlphaComposite.java, java/awt/AttributeValue.java,
java/awt/BasicStroke.java, java/awt/BufferCapabilities.java,
java/awt/color/CMMException.java, java/awt/ColorPaintContext.java,
- java/awt/color/ProfileDataException.java,
+ java/awt/color/ProfileDataException.java,
java/awt/CompositeContext.java, java/awt/Composite.java,
java/awt/ContainerOrderFocusTraversalPolicy.java,
java/awt/datatransfer/FlavorTable.java,
java/awt/DefaultFocusTraversalPolicy.java,
java/awt/DefaultKeyboardFocusManager.java, java/awt/DisplayMode.java,
java/awt/dnd/DnDConstants.java, java/awt/dnd/DragGestureEvent.java,
- java/awt/dnd/DragGestureListener.java,
+ java/awt/dnd/DragGestureListener.java,
java/awt/dnd/DragGestureRecognizer.java,
java/awt/dnd/DragSourceAdapter.java,
java/awt/dnd/DragSourceContext.java,
@@ -429,7 +2643,7 @@
javax/swing/UnsupportedLookAndFeelException.java,
javax/swing/ViewportLayout.java,
javax/swing/WindowConstants.java: New files, from GNU Classpath.
-
+
* java/awt/ActiveEvent.java,
java/awt/Adjustable.java, java/awt/AWTError.java,
java/awt/AWTEvent.java, java/awt/AWTEventMulticaster.java,
@@ -488,7 +2702,7 @@
java/awt/MenuItem.java, java/awt/PaintContext.java,
java/awt/Paint.java, java/awt/Panel.java, java/awt/Point.java,
java/awt/Polygon.java, java/awt/PrintGraphics.java,
- java/awt/PrintJob.java, java/awt/Rectangle.java,
+ java/awt/PrintJob.java, java/awt/Rectangle.java,
java/awt/RenderingHints.java, java/awt/ScrollPane.java,
java/awt/Shape.java, java/awt/SystemColor.java, java/awt/Toolkit.java,
java/awt/Transparency.java, java/awt/Window.java: Merge from classpath.
@@ -512,8 +2726,8 @@
* gnu/awt/xlib/XGraphicsConfiguration.java,
gnu/awt/xlib/XToolkit.java: Updated to compile against 1.4 abstract
API.
-
- * javax/swing/plaf/metal/MetalLookAndFeel.java: New file from
+
+ * javax/swing/plaf/metal/MetalLookAndFeel.java: New file from
GNU Classpath.
* Makefile.am: Add new files.
@@ -522,7 +2736,7 @@
2002-08-07 Bryce McKinlay <bryce@waitaki.otago.ac.nz>
* java/lang/ClassLoader.java (getSystemClassLoader, findClass,
- defineClass, setSigners, getSystemResource, getSystemResourceAsStream,
+ defineClass, setSigners, getSystemResource, getSystemResourceAsStream,
findResource, getResources, findResources): Add javadoc from classpath.
(getSystemResources): Implemented.
@@ -547,14 +2761,14 @@
* gnu/java/security/provider/DefaultPolicy.java
(getPermissions): Revert to maintaining static class variable of
Permissions.
- * gnu/java/security/provider/SHA.java
+ * gnu/java/security/provider/SHA.java
(engineUpdate): Revert algorithm change.
(engineDigest): Revert algorithm change.
2002-08-01 Kaz Kojima <kkojima@gcc.gnu.org>
* configure.host: Add SH support.
- * sysdep/sh/locks.h: New file.
+ * sysdep/sh/locks.h: New file.
2002-07-31 Bryce McKinlay <bryce@waitaki.otago.ac.nz>
@@ -593,7 +2807,7 @@
argument to _load.
2002-07-24 Tom Tromey <tromey@redhat.com>
- Tony Kimball <alk@pobox.com>
+ Tony Kimball <alk@pobox.com>
* java/io/natFileDescriptorWin32.cc (setLength): New method.
* java/io/natFileDescriptorPosix.cc (setLength): New method.
@@ -677,7 +2891,7 @@
* gnu/java/security/provider/DefaultPolicy.java
(getPermissions): do not maintain static class variable of
Permissions
- * gnu/java/security/provider/SHA.java
+ * gnu/java/security/provider/SHA.java
(engineUpdate): algorithm change
(engineDigest): algorithm change
@@ -720,7 +2934,7 @@
* java/lang/natRuntime.cc (nativeGetLibname): Added missing `#'.
2002-07-04 Tom Tromey <tromey@redhat.com>
- Jeff Sturm <jsturm@one-point.com>
+ Jeff Sturm <jsturm@one-point.com>
Fix for PR libgcj/7060:
* java/lang/Class.h (_getMethod): Renamed from getMethod.
@@ -731,7 +2945,7 @@
(_getMethod): New native method.
2002-07-02 Tom Tromey <tromey@redhat.com>
- David Hovemeyer <daveho@cs.umd.edu>
+ David Hovemeyer <daveho@cs.umd.edu>
* java/text/ChoiceFormat.java
(format(double,StringBuffer,FieldPosition)): Fix fencepost error
@@ -819,7 +3033,7 @@
java/sql/Statement.java, java/sql/Struct.java, java/sql/Time.java,
java/sql/Timestamp.java, java/sql/Types.java: Updated to JDBC 3.0
(JDK 1.4) specification.
- * javax/sql/ConnectionEvent.java,
+ * javax/sql/ConnectionEvent.java,
javax/sql/ConnectionEventListener.java,
javax/sql/ConnectionPoolDataSource.java,
javax/sql/DataSource.java, javax/sql/PooledConnection.java,
@@ -830,7 +3044,7 @@
javax/sql/XADataSource.java: New files.
* Makefile.am: Add new files.
* Makefile.in: Rebuilt.
-
+
2002-06-20 Tom Tromey <tromey@redhat.com>
For PR libgcj/7073:
@@ -1112,9 +3326,9 @@
2002-06-06 Adam Megacz <adam@xwt.org>
- * java/io/natFileDescriptorWin32.cc (open): Disable Win32 file
- locking, just like the Sun JVM does.
-
+ * java/io/natFileDescriptorWin32.cc (open): Disable Win32 file
+ locking, just like the Sun JVM does.
+
2002-06-05 H.J. Lu (hjl@gnu.org)
* Makefile.am (libgcj_convenience.la): Revert the last change.
@@ -1216,7 +3430,7 @@
* Makefile.am: Add new CertPath classes.
* Makefile.in: Rebuilt.
- * gnu/java/util/EmptyEnumeration.java: New file from classpath.
+ * gnu/java/util/EmptyEnumeration.java: New file from classpath.
2002-05-24 Bryce McKinlay <bryce@waitaki.otago.ac.nz>
@@ -1306,7 +3520,7 @@
.java.class: New rule.
(CLEANFILES): Remove tmp-list.
* libjava/Makefile.in: Regenerated.
-
+
2002-05-09 David.Billinghurst <David.Billinghurst@riotinto.com>
* testsuite/lib/libjava.exp (test_libjava_from_javac):
@@ -1457,7 +3671,7 @@
2002-04-17 Adam King <aking@dreammechanics.com>
- * java/io/File.java (normalizePath): Add Win32 support for auto
+ * java/io/File.java (normalizePath): Add Win32 support for auto
conversion of a '/' path separator to Win32's '\' separator.
2002-04-16 Tom Tromey <tromey@redhat.com>
@@ -1477,7 +3691,7 @@
(_access, _stat, attr, getCanonicalPath, performMkdir,
performRenameTo): Don't use fixed-size array.
(getCanonicalPath): Use throw, not _Jv_Throw.
-
+
2002-04-15 DJ Delorie <dj@redhat.com>
* configure.in: Allow building in $srcdir.
@@ -1571,8 +3785,8 @@
2002-04-07 Mark Wielaard <mark@klomp.org>
- * java/util/AbstractMap.java (putAll): Use entrySet size.
- (toString): Explicitly use getKey() and getValue().
+ * java/util/AbstractMap.java (putAll): Use entrySet size.
+ (toString): Explicitly use getKey() and getValue().
2002-04-07 Mark Wielaard <mark@klomp.org>
@@ -1585,8 +3799,8 @@
* java/lang/natSystem.cc (init_properties): Call new function
_Jv_platform_initProperties.
- * win32.cc (_Jv_platform_initProperties): New function that adds Win32
- support for the System properties os.name, os.arch, os.version,
+ * win32.cc (_Jv_platform_initProperties): New function that adds Win32
+ support for the System properties os.name, os.arch, os.version,
user.name, user.home, and user.dir.
* include/posix.h, include/win32.h, posix.cc: New function
_Jv_platform_initProperties.
@@ -1613,7 +3827,7 @@
2002-04-05 Adam Megacz <adam@xwt.org>
- * exception.cc (abort): added static modifier
+ * exception.cc (abort): added static modifier
2002-04-04 Adam Megacz <adam@xwt.org>
@@ -1660,14 +3874,14 @@
2002-04-01 Mark Wielaard <mark@klomp.org>
- * java/util/BitSet.java (BitSet(int)): if nbits < 0 throw
- NegativeArraySizeException
- (clear(int)): Use sign extended shift.
- (flip(int)): Likewise.
- (get(int)): Likewise.
- (nextClearBit(int)): Likewise.
- (nextSetBit(int)): Likewise.
- (set(int)): Likewise.
+ * java/util/BitSet.java (BitSet(int)): if nbits < 0 throw
+ NegativeArraySizeException
+ (clear(int)): Use sign extended shift.
+ (flip(int)): Likewise.
+ (get(int)): Likewise.
+ (nextClearBit(int)): Likewise.
+ (nextSetBit(int)): Likewise.
+ (set(int)): Likewise.
2002-04-01 Mark Wielaard <mark@klomp.org>
@@ -1711,10 +3925,10 @@
2002-03-25 Andrew Haley <aph@cambridge.redhat.com>, Hans Boehm <Hans_Boehm@hp.com>
- * include/dwarf2-signal.h (MAKE_THROW_FRAME): Add for IA-64.
- (INIT_SEGV, INIT_FPE): Add versions that use __libc_sigaction
- instead of syscall on IA-64.
- Add FIXME comment.
+ * include/dwarf2-signal.h (MAKE_THROW_FRAME): Add for IA-64.
+ (INIT_SEGV, INIT_FPE): Add versions that use __libc_sigaction
+ instead of syscall on IA-64.
+ Add FIXME comment.
2002-03-27 Anthony Green <green@redhat.com>
@@ -1738,7 +3952,7 @@
* include/dwarf2-signal.h (MAKE_THROW_FRAME): Add for IA-64.
(INIT_SEGV, INIT_FPE): Use __libc_sigaction instead of syscall.
Add FIXME comment.
-
+
2002-03-25 Tom Tromey <tromey@redhat.com>
* Makefile.am (libgcj_la_LDFLAGS): Use THREADLDFLAGS.
@@ -1772,9 +3986,9 @@
* java/io/FileInputStream.java (skip): Call fd.getFilePointer() and
calculate correct number of bytes skipped.
-
+
Based on patch from Intel's ORP team:
- * java/io/PushbackInputStream.java (available): Calculate correct
+ * java/io/PushbackInputStream.java (available): Calculate correct
number of bytes in buffer.
(read): Remove redundant bound check. Return bytes from both the
buffer and the stream.
@@ -1920,7 +4134,7 @@
2002-03-15 Tom Tromey <tromey@redhat.com>
Rainer Orth <ro@TechFak.Uni-Bielefeld.DE>
-
+
Fix for PR libgcj/5944.
* gnu/gcj/io/shs.h: Define uint8_t and uint32_t.
@@ -1944,8 +4158,8 @@
2002-03-10 Adam Megacz <adam@xwt.org>
- * java/net/natPlainSocketImpl.cc: Added #include <platform.h>.
-
+ * java/net/natPlainSocketImpl.cc: Added #include <platform.h>.
+
2002-03-10 Tom Tromey <tromey@redhat.com>
* java/awt/GridLayout.java (layoutContainer): Handle case where
@@ -1986,8 +4200,8 @@
slow_pthread_self. Set up symlink for sysdeps directory.
* configure: Rebuild.
* configure.host: Document more shell variables. Set sysdeps_dir
- for most platforms. Set slow_pthread_self for i686. Set
- enable_hash_synchronization_default and slow_pthread_self for PowerPC.
+ for most platforms. Set slow_pthread_self for i686. Set
+ enable_hash_synchronization_default and slow_pthread_self for PowerPC.
* posix-threads.cc (_Jv_ThreadSelf_out_of_line): Use release_set so
that memory barrier is emitted where required.
* prims.cc: 64-bit align static primitive class instances.
@@ -1995,7 +4209,7 @@
read_barrier() to enforce ordering of reads.
* sysdep/powerpc/locks.h: New file. Implementation of synchronization
primitives for PowerPC.
- * sysdep/i386/locks.h: New file. Synchronization primitives for i386
+ * sysdep/i386/locks.h: New file. Synchronization primitives for i386
moved from natObject.cc.
* sysdep/alpha/locks.h: Likewise.
* sysdep/ia64/locks.h: Likewise.
@@ -2005,17 +4219,17 @@
2002-03-09 Adam Megacz <adam@xwt.org>
- * java/io/natFileDescriptorWin32.cc (read): Return -1 if zero
- bytes read and no failure code returned.
+ * java/io/natFileDescriptorWin32.cc (read): Return -1 if zero
+ bytes read and no failure code returned.
2002-03-09 Adam Megacz <adam@xwt.org>
- * win32.cc (_CRT_MT, __mingwthr_key_dtor) Added fake
- definitions to simulate -mthreads.
-
+ * win32.cc (_CRT_MT, __mingwthr_key_dtor) Added fake
+ definitions to simulate -mthreads.
+
2002-03-09 Adam Megacz <adam@xwt.org>
- * win32.cc (_Jv_platform_gettimeofday) Cast 1000 to long long to
+ * win32.cc (_Jv_platform_gettimeofday) Cast 1000 to long long to
avoid precision loss.
2002-03-09 Per Bothner <per@bothner.com>
@@ -2026,13 +4240,13 @@
2002-03-09 Adam Megacz <adam@xwt.org>
- * java/lang/Win32Process.java (ConcreteProcess): Now throws an
- IOException so that Throwable.printStackTrace fails correctly.
+ * java/lang/Win32Process.java (ConcreteProcess): Now throws an
+ IOException so that Throwable.printStackTrace fails correctly.
2002-03-08 Adam Megacz <adam@xwt.org>
- * java/net/natPlainSocketImpl.cc (read, write, close): Formatting
- fixed.
+ * java/net/natPlainSocketImpl.cc (read, write, close): Formatting
+ fixed.
2002-03-09 Bryce McKinlay <bryce@waitaki.otago.ac.nz>
@@ -2050,24 +4264,24 @@
2002-03-07 Adam Megacz <adam@xwt.org>
- * java/net/natPlainSocketImpl.cc: Changed USE_WINSOCK to
- WIN32, and added thunks for read(), write(), and close().
- * java/net/natPlainSocketImpl.cc (accept, read, read):
- Disabled timeouts on WIN32 pending discussion.
+ * java/net/natPlainSocketImpl.cc: Changed USE_WINSOCK to
+ WIN32, and added thunks for read(), write(), and close().
+ * java/net/natPlainSocketImpl.cc (accept, read, read):
+ Disabled timeouts on WIN32 pending discussion.
2002-03-07 Adam Megacz <adam@xwt.org>
- * win32.cc (_Jv_platform_gettimeofday): Now takes no args,
- returns jlong. Added implementation
- * posix.cc (_Jv_platform_gettimeofday): Now takes no args,
- returns jlong.
- * win32.h (_Jv_platform_gettimeofday): Now takes no args,
- returns jlong.
- * posix.h (_Jv_platform_gettimeofday): Now takes no args,
- returns jlong.
- * java/lang/natSystem.cc (currentTimeMillis): Now uses updated
- _Jv_platform_gettimeofday signature.
-
+ * win32.cc (_Jv_platform_gettimeofday): Now takes no args,
+ returns jlong. Added implementation
+ * posix.cc (_Jv_platform_gettimeofday): Now takes no args,
+ returns jlong.
+ * win32.h (_Jv_platform_gettimeofday): Now takes no args,
+ returns jlong.
+ * posix.h (_Jv_platform_gettimeofday): Now takes no args,
+ returns jlong.
+ * java/lang/natSystem.cc (currentTimeMillis): Now uses updated
+ _Jv_platform_gettimeofday signature.
+
2002-03-07 Bryce McKinlay <bryce@waitaki.otago.ac.nz>
* java/net/natPlainSocketImpl.cc (_Jv_recv): Removed.
@@ -2087,10 +4301,10 @@
2002-03-06 Adam Megacz <adam@xwt.org>
- * java/io/FileDescriptor.java: Initialize in/out/err in init().
- * java/io/natFileDescriptorWin32.cc (init()): Added function.
- * java/io/natFileDescriptorPosix.cc (init()): Added function.
- * java/io/natFileDescriptorEcos.cc (init()): Added function.
+ * java/io/FileDescriptor.java: Initialize in/out/err in init().
+ * java/io/natFileDescriptorWin32.cc (init()): Added function.
+ * java/io/natFileDescriptorPosix.cc (init()): Added function.
+ * java/io/natFileDescriptorEcos.cc (init()): Added function.
2002-03-06 Eric Blake <ebb9@email.byu.edu>
@@ -2203,7 +4417,7 @@
* java/lang/reflect/natMethod.cc (_Jv_CallAnyMethodA):
Define ffi_result union for ffi_call result. Cast
ffi_result members to jvalue.
-
+
2002-02-23 Alexandre Oliva <aoliva@redhat.com>
* Makefile.in, gcj/Makefile.in, include/Makefile.in: Rebuilt.
@@ -2364,12 +4578,12 @@
2002-02-12 Adam Megacz <adam@xwt.org>
- * java/lang/Win32Process.java: Filled in a placeholder
+ * java/lang/Win32Process.java: Filled in a placeholder
implementation so Win32 will build.
2002-02-12 Adam Megacz <adam@xwt.org>
- * java/io/natFilePosix.cc: Copied this from natFile.cc.
+ * java/io/natFilePosix.cc: Copied this from natFile.cc.
* java/io/natFile.cc: Removed from repository.
* configure.in: Added AC_LINK_FILES for natFile${PLATFORM}.
@@ -2381,7 +4595,7 @@
* boehm.cc (initialized, obj_kind_x, obj_free_list): Removed unused
declarations.
- (_Jv_InitGC): Don't bother locking, as this is always called from a
+ (_Jv_InitGC): Don't bother locking, as this is always called from a
single-thread. Turn off GC_all_interior_pointers. Remove dead code.
2002-02-11 Adam Megacz <adam@xwt.org>
@@ -2505,11 +4719,11 @@
* gnu/gcj/io/shs.h, gnu/gcj/io/shs.cc, gnu/gcj/io/natSimpleSHSStream.cc:
use uint<n>_t instead of LONG and BYTE
-
+
2002-02-06 Adam Megacz <adam@xwt.org>
* name-finder.h: don't #include sys/wait.h unless HAVE_SYS_WAIT_H
-
+
2002-02-06 Anthony Green <green@redhat.com>
* java/net/natPlainSocketImpl.cc: Fix DISABLE_JAVA_NET targets.
@@ -2525,8 +4739,8 @@
* prims.cc (_Jv_RunMain): Use DISABLE_MAIN_ARGS.
* configure: Rebuilt.
* configure.in: Add --disable-main-args option. Test for
- opendir function. Replace AC_CHECK_SIZEOF with
- AC_COMPILE_CHECK_SIZEOF.
+ opendir function. Replace AC_CHECK_SIZEOF with
+ AC_COMPILE_CHECK_SIZEOF.
* java/io/natFile.cc (performList): Check HAVE_OPENDIR.
* aclocal.m4: Rebuilt.
* acinclude.m4: Add AC_COMPILE_CHECK_SIZEOF.
@@ -2567,7 +4781,7 @@
* configure.in: Added PLATFORM_SPECIFIC_SOURCES,
which is set to posix.cc or win32.cc.
* Makefile.am: Updated it to use $(PLATFORM_SPECIFIC_SOURCES).
-
+
2002-02-04 Adam Megacz <adam@xwt.org>
* configure.in: Corrected mingw case branches; added * before
@@ -2603,7 +4817,7 @@
2002-02-01 Adam Megacz <adam@xwt.org>
* prims.cc: Added #undef STRICT after #include<windows.h>.
-
+
2002-02-01 Adam Megacz <adam@xwt.org>
* prims.cc
@@ -2611,7 +4825,7 @@
USE_WIN32_SIGNALLING and USE_WINSOCK.
(win32_exception_handler): Now throws an exception out of
the signal handler; assumes SJLJ.
-
+
2002-02-01 Adam Megacz <adam@xwt.org>
* win32-threads.cc:
@@ -2642,7 +4856,7 @@
2002-02-01 Craig Rodrigues <rodrigc@gcc.gnu.org>
PR java/4972
- * aclocal.m4, acinclude.m4 (AM_ICONV): Put linking flags
+ * aclocal.m4, acinclude.m4 (AM_ICONV): Put linking flags
for libiconv in LIBICONV variable.
* configure: Regenerated.
@@ -2748,9 +4962,9 @@
2002-01-25 Bryce McKinlay <bryce@waitaki.otago.ac.nz>
* java/lang/natObject.cc (X86 compare_and_swap): Use +m constraint.
-
+
* java/awt/image/PixelGrabber.java (grabPixels()): Call grabPixels(0).
- (grabPixels(long)): Wait to be notified that the ImageProducer has
+ (grabPixels(long)): Wait to be notified that the ImageProducer has
completed.
2002-01-24 Per Bothner <per@bothner.com>
@@ -2829,539 +5043,539 @@
2002-01-22 Mark Wielaard <mark@klomp.org>
- * java/awt/Adjustable.java java/awt/CheckboxMenuItem.java
- java/awt/Choice.java java/awt/Color.java java/awt/Cursor.java
- java/awt/Dialog.java java/awt/FileDialog.java
- java/awt/Font.java java/awt/FontMetrics.java
- java/awt/Image.java java/awt/ImageMediaEntry.java
- java/awt/Insets.java java/awt/List.java
- java/awt/MediaEntry.java java/awt/MediaTracker.java
- java/awt/Menu.java java/awt/MenuBar.java
- java/awt/MenuContainer.java java/awt/MenuShortcut.java
- java/awt/PaintContext.java java/awt/Panel.java
- java/awt/PopupMenu.java java/awt/SystemColor.java
- java/awt/peer/ButtonPeer.java java/awt/peer/CanvasPeer.java
- java/awt/peer/CheckboxMenuItemPeer.java
- java/awt/peer/CheckboxPeer.java java/awt/peer/ChoicePeer.java
- java/awt/peer/ComponentPeer.java
- java/awt/peer/ContainerPeer.java java/awt/peer/DialogPeer.java
- java/awt/peer/FileDialogPeer.java java/awt/peer/FontPeer.java
- java/awt/peer/FramePeer.java java/awt/peer/LabelPeer.java
- java/awt/peer/LightweightPeer.java java/awt/peer/ListPeer.java
- java/awt/peer/MenuBarPeer.java
- java/awt/peer/MenuComponentPeer.java
- java/awt/peer/MenuItemPeer.java java/awt/peer/MenuPeer.java
- java/awt/peer/PanelPeer.java java/awt/peer/PopupMenuPeer.java
- java/awt/peer/ScrollPanePeer.java
- java/awt/peer/ScrollbarPeer.java
- java/awt/peer/TextAreaPeer.java
- java/awt/peer/TextComponentPeer.java
+ * java/awt/Adjustable.java java/awt/CheckboxMenuItem.java
+ java/awt/Choice.java java/awt/Color.java java/awt/Cursor.java
+ java/awt/Dialog.java java/awt/FileDialog.java
+ java/awt/Font.java java/awt/FontMetrics.java
+ java/awt/Image.java java/awt/ImageMediaEntry.java
+ java/awt/Insets.java java/awt/List.java
+ java/awt/MediaEntry.java java/awt/MediaTracker.java
+ java/awt/Menu.java java/awt/MenuBar.java
+ java/awt/MenuContainer.java java/awt/MenuShortcut.java
+ java/awt/PaintContext.java java/awt/Panel.java
+ java/awt/PopupMenu.java java/awt/SystemColor.java
+ java/awt/peer/ButtonPeer.java java/awt/peer/CanvasPeer.java
+ java/awt/peer/CheckboxMenuItemPeer.java
+ java/awt/peer/CheckboxPeer.java java/awt/peer/ChoicePeer.java
+ java/awt/peer/ComponentPeer.java
+ java/awt/peer/ContainerPeer.java java/awt/peer/DialogPeer.java
+ java/awt/peer/FileDialogPeer.java java/awt/peer/FontPeer.java
+ java/awt/peer/FramePeer.java java/awt/peer/LabelPeer.java
+ java/awt/peer/LightweightPeer.java java/awt/peer/ListPeer.java
+ java/awt/peer/MenuBarPeer.java
+ java/awt/peer/MenuComponentPeer.java
+ java/awt/peer/MenuItemPeer.java java/awt/peer/MenuPeer.java
+ java/awt/peer/PanelPeer.java java/awt/peer/PopupMenuPeer.java
+ java/awt/peer/ScrollPanePeer.java
+ java/awt/peer/ScrollbarPeer.java
+ java/awt/peer/TextAreaPeer.java
+ java/awt/peer/TextComponentPeer.java
java/awt/peer/TextFieldPeer.java
java/awt/peer/WindowPeer.java: Add license clarification.
2002-01-22 Mark Wielaard <mark@klomp.org>
- * LIBGCJ_LICENSE gnu/classpath/Configuration.java.in
- gnu/gcj/runtime/StringBuffer.java
- gnu/java/awt/BitMaskExtent.java gnu/java/awt/Buffers.java
- gnu/java/awt/ComponentDataBlitOp.java
- gnu/java/awt/GLightweightPeer.java
- gnu/java/beans/BeanInfoEmbryo.java
- gnu/java/beans/EmptyBeanInfo.java
- gnu/java/beans/ExplicitBeanInfo.java
- gnu/java/beans/IntrospectionIncubator.java
- gnu/java/beans/editors/ColorEditor.java
- gnu/java/beans/editors/FontEditor.java
- gnu/java/beans/editors/NativeBooleanEditor.java
- gnu/java/beans/editors/NativeByteEditor.java
- gnu/java/beans/editors/NativeDoubleEditor.java
- gnu/java/beans/editors/NativeFloatEditor.java
- gnu/java/beans/editors/NativeIntEditor.java
- gnu/java/beans/editors/NativeLongEditor.java
- gnu/java/beans/editors/NativeShortEditor.java
- gnu/java/beans/editors/StringEditor.java
- gnu/java/beans/info/ComponentBeanInfo.java
- gnu/java/io/ClassLoaderObjectInputStream.java
- gnu/java/io/NullOutputStream.java
- gnu/java/io/ObjectIdentityWrapper.java
- gnu/java/lang/ArrayHelper.java gnu/java/lang/ClassHelper.java
- gnu/java/lang/reflect/TypeSignature.java
- gnu/java/locale/Calendar.java gnu/java/locale/Calendar_de.java
- gnu/java/locale/Calendar_en.java
- gnu/java/locale/Calendar_nl.java
- gnu/java/locale/LocaleInformation.java
- gnu/java/locale/LocaleInformation_de.java
- gnu/java/locale/LocaleInformation_en.java
- gnu/java/locale/LocaleInformation_nl.java
- gnu/java/math/MPN.java gnu/java/rmi/dgc/DGCImpl.java
- gnu/java/rmi/registry/RegistryImpl.java
- gnu/java/rmi/rmic/Compile_gcj.java
- gnu/java/rmi/rmic/Compiler.java
- gnu/java/rmi/rmic/CompilerProcess.java
- gnu/java/rmi/rmic/RMIC.java
- gnu/java/rmi/rmic/TabbedWriter.java
- gnu/java/rmi/server/ProtocolConstants.java
- gnu/java/rmi/server/RMIDefaultSocketFactory.java
- gnu/java/rmi/server/RMIHashes.java
- gnu/java/rmi/server/RMIObjectInputStream.java
- gnu/java/rmi/server/RMIObjectOutputStream.java
- gnu/java/rmi/server/UnicastConnection.java
- gnu/java/rmi/server/UnicastConnectionManager.java
- gnu/java/rmi/server/UnicastRef.java
- gnu/java/rmi/server/UnicastRemoteCall.java
- gnu/java/rmi/server/UnicastRemoteStub.java
- gnu/java/rmi/server/UnicastServer.java
- gnu/java/rmi/server/UnicastServerRef.java
- gnu/java/security/provider/DefaultPolicy.java
- gnu/java/security/provider/Gnu.java
- gnu/java/security/provider/SHA.java
- gnu/java/security/provider/SHA1PRNG.java
- gnu/java/text/BaseBreakIterator.java
- gnu/java/text/CharacterBreakIterator.java
- gnu/java/text/LineBreakIterator.java
- gnu/java/text/SentenceBreakIterator.java
- gnu/java/text/WordBreakIterator.java
- gnu/java/util/DoubleEnumeration.java java/applet/Applet.java
- java/applet/AppletContext.java java/applet/AppletStub.java
- java/applet/AudioClip.java java/awt/AWTError.java
- java/awt/AWTEvent.java java/awt/AWTEventMulticaster.java
- java/awt/AWTException.java java/awt/AWTPermission.java
- java/awt/ActiveEvent.java java/awt/BorderLayout.java
- java/awt/Button.java java/awt/Canvas.java
- java/awt/CardLayout.java java/awt/Checkbox.java
- java/awt/CheckboxGroup.java java/awt/Component.java
- java/awt/ComponentOrientation.java java/awt/Container.java
- java/awt/Dimension.java java/awt/Event.java
- java/awt/EventDispatchThread.java java/awt/EventQueue.java
- java/awt/FlowLayout.java java/awt/Frame.java
- java/awt/Graphics.java java/awt/Graphics2D.java
- java/awt/GraphicsConfiguration.java java/awt/GridLayout.java
- java/awt/IllegalComponentStateException.java
- java/awt/ItemSelectable.java java/awt/Label.java
- java/awt/LayoutManager.java java/awt/LayoutManager2.java
- java/awt/MenuComponent.java java/awt/MenuItem.java
- java/awt/Paint.java java/awt/Point.java
- java/awt/Rectangle.java java/awt/RenderingHints.java
- java/awt/Transparency.java java/awt/Window.java
- java/awt/color/ColorSpace.java
- java/awt/color/ICC_ColorSpace.java
- java/awt/color/ICC_Profile.java
- java/awt/event/HierarchyBoundsAdapter.java
- java/awt/event/HierarchyBoundsListener.java
- java/awt/event/HierarchyEvent.java
- java/awt/event/HierarchyListener.java
- java/awt/geom/AffineTransform.java
- java/awt/geom/Dimension2D.java java/awt/geom/Ellipse2D.java
- java/awt/geom/IllegalPathStateException.java
- java/awt/geom/Line2D.java
- java/awt/geom/NoninvertibleTransformException.java
- java/awt/geom/PathIterator.java java/awt/geom/Point2D.java
- java/awt/geom/Rectangle2D.java
- java/awt/geom/RectangularShape.java
- java/awt/geom/RoundRectangle2D.java
- java/awt/image/BufferedImage.java
- java/awt/image/ColorModel.java
- java/awt/image/ComponentColorModel.java
- java/awt/image/ComponentSampleModel.java
- java/awt/image/DataBuffer.java
- java/awt/image/DataBufferByte.java
- java/awt/image/DataBufferInt.java
- java/awt/image/DataBufferUShort.java
- java/awt/image/DirectColorModel.java
- java/awt/image/PackedColorModel.java
- java/awt/image/Raster.java java/awt/image/RasterOp.java
- java/awt/image/SampleModel.java
- java/awt/image/SinglePixelPackedSampleModel.java
- java/awt/image/WritableRaster.java
- java/beans/AppletInitializer.java
- java/beans/BeanDescriptor.java java/beans/BeanInfo.java
- java/beans/Beans.java java/beans/Customizer.java
- java/beans/DesignMode.java java/beans/EventSetDescriptor.java
- java/beans/FeatureDescriptor.java
- java/beans/IndexedPropertyDescriptor.java
- java/beans/IntrospectionException.java
- java/beans/Introspector.java java/beans/MethodDescriptor.java
- java/beans/ParameterDescriptor.java
- java/beans/PropertyChangeEvent.java
- java/beans/PropertyChangeListener.java
- java/beans/PropertyChangeSupport.java
- java/beans/PropertyDescriptor.java
- java/beans/PropertyEditor.java
- java/beans/PropertyEditorManager.java
- java/beans/PropertyEditorSupport.java
- java/beans/PropertyVetoException.java
- java/beans/SimpleBeanInfo.java
- java/beans/VetoableChangeListener.java
- java/beans/VetoableChangeSupport.java
- java/beans/Visibility.java
- java/beans/beancontext/BeanContext.java
- java/beans/beancontext/BeanContextChild.java
- java/beans/beancontext/BeanContextChildComponentProxy.java
- java/beans/beancontext/BeanContextChildSupport.java
- java/beans/beancontext/BeanContextContainerProxy.java
- java/beans/beancontext/BeanContextEvent.java
- java/beans/beancontext/BeanContextMembershipEvent.java
- java/beans/beancontext/BeanContextMembershipListener.java
- java/beans/beancontext/BeanContextProxy.java
- java/beans/beancontext/BeanContextServiceAvailableEvent.java
- java/beans/beancontext/BeanContextServiceProvider.java
- java/beans/beancontext/BeanContextServiceProviderBeanInfo.java
- java/beans/beancontext/BeanContextServiceRevokedEvent.java
- java/beans/beancontext/BeanContextServiceRevokedListener.java
- java/beans/beancontext/BeanContextServices.java
- java/beans/beancontext/BeanContextServicesListener.java
- java/io/BufferedInputStream.java
- java/io/BufferedOutputStream.java java/io/BufferedReader.java
- java/io/BufferedWriter.java java/io/ByteArrayInputStream.java
- java/io/ByteArrayOutputStream.java
- java/io/CharArrayReader.java java/io/CharArrayWriter.java
- java/io/CharConversionException.java java/io/DataInput.java
- java/io/DataInputStream.java java/io/DataOutput.java
- java/io/EOFException.java java/io/Externalizable.java
- java/io/FileFilter.java java/io/FileNotFoundException.java
- java/io/FilePermission.java java/io/FileReader.java
- java/io/FileWriter.java java/io/FilenameFilter.java
- java/io/FilterInputStream.java java/io/FilterOutputStream.java
- java/io/FilterReader.java java/io/FilterWriter.java
- java/io/IOException.java java/io/InputStream.java
- java/io/InterruptedIOException.java
- java/io/InvalidClassException.java
- java/io/InvalidObjectException.java
- java/io/NotActiveException.java
- java/io/NotSerializableException.java java/io/ObjectInput.java
- java/io/ObjectInputStream.java
- java/io/ObjectInputValidation.java java/io/ObjectOutput.java
- java/io/ObjectOutputStream.java java/io/ObjectStreamClass.java
- java/io/ObjectStreamConstants.java
- java/io/ObjectStreamException.java
- java/io/ObjectStreamField.java
- java/io/OptionalDataException.java java/io/OutputStream.java
- java/io/PipedInputStream.java java/io/PipedOutputStream.java
- java/io/PipedReader.java java/io/PipedWriter.java
- java/io/PrintWriter.java java/io/PushbackInputStream.java
- java/io/PushbackReader.java java/io/Reader.java
- java/io/SequenceInputStream.java java/io/Serializable.java
- java/io/SerializablePermission.java
- java/io/StreamCorruptedException.java
- java/io/StreamTokenizer.java
- java/io/StringBufferInputStream.java java/io/StringReader.java
- java/io/StringWriter.java java/io/SyncFailedException.java
- java/io/UTFDataFormatException.java
- java/io/UnsupportedEncodingException.java
- java/io/WriteAbortedException.java java/io/Writer.java
- java/lang/AbstractMethodError.java
- java/lang/ArithmeticException.java
- java/lang/ArrayIndexOutOfBoundsException.java
- java/lang/ArrayStoreException.java java/lang/Boolean.java
- java/lang/Byte.java java/lang/CharSequence.java
- java/lang/ClassCastException.java
- java/lang/ClassCircularityError.java
- java/lang/ClassFormatError.java
- java/lang/ClassNotFoundException.java
- java/lang/CloneNotSupportedException.java
- java/lang/Cloneable.java java/lang/Comparable.java
- java/lang/Compiler.java java/lang/Double.java
- java/lang/Error.java java/lang/Exception.java
- java/lang/ExceptionInInitializerError.java
- java/lang/Float.java java/lang/IllegalAccessError.java
- java/lang/IllegalAccessException.java
- java/lang/IllegalArgumentException.java
- java/lang/IllegalMonitorStateException.java
- java/lang/IllegalStateException.java
- java/lang/IllegalThreadStateException.java
- java/lang/IncompatibleClassChangeError.java
- java/lang/IndexOutOfBoundsException.java
- java/lang/InheritableThreadLocal.java
- java/lang/InstantiationError.java
- java/lang/InstantiationException.java java/lang/Integer.java
- java/lang/InternalError.java
- java/lang/InterruptedException.java
- java/lang/LinkageError.java java/lang/Long.java
- java/lang/NegativeArraySizeException.java
- java/lang/NoClassDefFoundError.java
- java/lang/NoSuchFieldError.java
- java/lang/NoSuchFieldException.java
- java/lang/NoSuchMethodError.java
- java/lang/NoSuchMethodException.java
- java/lang/NullPointerException.java java/lang/Number.java
- java/lang/NumberFormatException.java
- java/lang/OutOfMemoryError.java java/lang/Package.java
- java/lang/Process.java java/lang/Runnable.java
- java/lang/RuntimeException.java
- java/lang/RuntimePermission.java
- java/lang/SecurityException.java
- java/lang/SecurityManager.java java/lang/Short.java
- java/lang/StackOverflowError.java java/lang/StringBuffer.java
- java/lang/StringIndexOutOfBoundsException.java
- java/lang/ThreadDeath.java java/lang/ThreadGroup.java
- java/lang/ThreadLocal.java java/lang/UnknownError.java
- java/lang/UnsatisfiedLinkError.java
- java/lang/UnsupportedClassVersionError.java
- java/lang/UnsupportedOperationException.java
- java/lang/VerifyError.java java/lang/VirtualMachineError.java
- java/lang/Void.java java/lang/ref/PhantomReference.java
- java/lang/ref/Reference.java java/lang/ref/ReferenceQueue.java
- java/lang/ref/SoftReference.java
- java/lang/ref/WeakReference.java
- java/lang/reflect/AccessibleObject.java
- java/lang/reflect/InvocationTargetException.java
- java/lang/reflect/Member.java java/lang/reflect/Modifier.java
- java/lang/reflect/ReflectPermission.java
- java/math/BigDecimal.java java/math/BigInteger.java
- java/net/Authenticator.java java/net/BindException.java
- java/net/ConnectException.java java/net/ContentHandler.java
- java/net/ContentHandlerFactory.java
- java/net/DatagramPacket.java java/net/DatagramSocketImpl.java
- java/net/FileNameMap.java java/net/MalformedURLException.java
- java/net/MulticastSocket.java java/net/NetPermission.java
- java/net/NoRouteToHostException.java
- java/net/PasswordAuthentication.java
- java/net/ProtocolException.java java/net/ServerSocket.java
- java/net/Socket.java java/net/SocketException.java
- java/net/SocketImpl.java java/net/SocketImplFactory.java
- java/net/SocketOptions.java java/net/SocketPermission.java
- java/net/URLDecoder.java java/net/URLEncoder.java
- java/net/URLStreamHandlerFactory.java
- java/net/UnknownHostException.java
- java/net/UnknownServiceException.java
- java/rmi/AccessException.java
- java/rmi/AlreadyBoundException.java
- java/rmi/ConnectException.java
- java/rmi/ConnectIOException.java
- java/rmi/MarshalException.java java/rmi/MarshalledObject.java
- java/rmi/Naming.java java/rmi/NoSuchObjectException.java
- java/rmi/NotBoundException.java
- java/rmi/RMISecurityException.java
- java/rmi/RMISecurityManager.java java/rmi/Remote.java
- java/rmi/RemoteException.java java/rmi/ServerError.java
- java/rmi/ServerException.java
- java/rmi/ServerRuntimeException.java
- java/rmi/StubNotFoundException.java
- java/rmi/UnexpectedException.java
- java/rmi/UnknownHostException.java
- java/rmi/UnmarshalException.java
- java/rmi/activation/Activatable.java
- java/rmi/activation/ActivateFailedException.java
- java/rmi/activation/ActivationDesc.java
- java/rmi/activation/ActivationException.java
- java/rmi/activation/ActivationGroup.java
- java/rmi/activation/ActivationGroupDesc.java
- java/rmi/activation/ActivationGroupID.java
- java/rmi/activation/ActivationID.java
- java/rmi/activation/ActivationInstantiator.java
- java/rmi/activation/ActivationMonitor.java
- java/rmi/activation/ActivationSystem.java
- java/rmi/activation/Activator.java
- java/rmi/activation/UnknownGroupException.java
- java/rmi/activation/UnknownObjectException.java
- java/rmi/dgc/DGC.java java/rmi/dgc/Lease.java
- java/rmi/dgc/VMID.java java/rmi/registry/LocateRegistry.java
- java/rmi/registry/Registry.java
- java/rmi/registry/RegistryHandler.java
- java/rmi/server/ExportException.java
- java/rmi/server/LoaderHandler.java
- java/rmi/server/LogStream.java java/rmi/server/ObjID.java
- java/rmi/server/Operation.java
- java/rmi/server/RMIClassLoader.java
- java/rmi/server/RMIClientSocketFactory.java
- java/rmi/server/RMIFailureHandler.java
- java/rmi/server/RMIServerSocketFactory.java
- java/rmi/server/RMISocketFactory.java
- java/rmi/server/RemoteCall.java
- java/rmi/server/RemoteObject.java
- java/rmi/server/RemoteRef.java
- java/rmi/server/RemoteServer.java
- java/rmi/server/RemoteStub.java
- java/rmi/server/ServerCloneException.java
- java/rmi/server/ServerNotActiveException.java
- java/rmi/server/ServerRef.java java/rmi/server/Skeleton.java
- java/rmi/server/SkeletonMismatchException.java
- java/rmi/server/SkeletonNotFoundException.java
- java/rmi/server/SocketSecurityException.java
- java/rmi/server/UID.java
- java/rmi/server/UnicastRemoteObject.java
- java/rmi/server/Unreferenced.java
- java/security/AccessControlContext.java
- java/security/AccessControlException.java
- java/security/AccessController.java
- java/security/AlgorithmParameterGenerator.java
- java/security/AlgorithmParameterGeneratorSpi.java
- java/security/AlgorithmParameters.java
- java/security/AlgorithmParametersSpi.java
- java/security/AllPermission.java
- java/security/BasicPermission.java
- java/security/Certificate.java java/security/CodeSource.java
- java/security/DigestException.java
- java/security/DigestInputStream.java
- java/security/DigestOutputStream.java
- java/security/DomainCombiner.java
- java/security/DummyKeyPairGenerator.java
- java/security/DummyMessageDigest.java
- java/security/DummySignature.java
- java/security/GeneralSecurityException.java
- java/security/Guard.java java/security/GuardedObject.java
- java/security/Identity.java java/security/IdentityScope.java
- java/security/InvalidAlgorithmParameterException.java
- java/security/InvalidKeyException.java
- java/security/InvalidParameterException.java
- java/security/Key.java java/security/KeyException.java
- java/security/KeyFactory.java java/security/KeyFactorySpi.java
- java/security/KeyManagementException.java
- java/security/KeyPair.java java/security/KeyPairGenerator.java
- java/security/KeyPairGeneratorSpi.java
- java/security/KeyStore.java
- java/security/KeyStoreException.java
- java/security/KeyStoreSpi.java
- java/security/MessageDigest.java
- java/security/MessageDigestSpi.java
- java/security/NoSuchAlgorithmException.java
- java/security/NoSuchProviderException.java
- java/security/Permission.java
- java/security/PermissionCollection.java
- java/security/Permissions.java java/security/Policy.java
- java/security/Principal.java java/security/PrivateKey.java
- java/security/PrivilegedAction.java
- java/security/PrivilegedActionException.java
- java/security/PrivilegedExceptionAction.java
- java/security/ProtectionDomain.java
- java/security/Provider.java
- java/security/ProviderException.java
- java/security/PublicKey.java
- java/security/SecureClassLoader.java
- java/security/SecureRandom.java
- java/security/SecureRandomSpi.java java/security/Security.java
- java/security/SecurityPermission.java
- java/security/Signature.java
- java/security/SignatureException.java
- java/security/SignatureSpi.java
- java/security/SignedObject.java java/security/Signer.java
- java/security/UnrecoverableKeyException.java
- java/security/UnresolvedPermission.java
- java/security/acl/Acl.java java/security/acl/AclEntry.java
- java/security/acl/AclNotFoundException.java
- java/security/acl/Group.java
- java/security/acl/LastOwnerException.java
- java/security/acl/NotOwnerException.java
- java/security/acl/Owner.java java/security/acl/Permission.java
- java/security/cert/CRL.java
- java/security/cert/CRLException.java
- java/security/cert/Certificate.java
- java/security/cert/CertificateEncodingException.java
- java/security/cert/CertificateException.java
- java/security/cert/CertificateExpiredException.java
- java/security/cert/CertificateFactory.java
- java/security/cert/CertificateFactorySpi.java
- java/security/cert/CertificateNotYetValidException.java
- java/security/cert/CertificateParsingException.java
- java/security/cert/X509CRL.java
- java/security/cert/X509CRLEntry.java
- java/security/cert/X509Certificate.java
- java/security/cert/X509Extension.java
- java/security/interfaces/DSAKey.java
- java/security/interfaces/DSAKeyPairGenerator.java
- java/security/interfaces/DSAParams.java
- java/security/interfaces/DSAPrivateKey.java
- java/security/interfaces/DSAPublicKey.java
- java/security/interfaces/RSAKey.java
- java/security/interfaces/RSAPrivateCrtKey.java
- java/security/interfaces/RSAPrivateKey.java
- java/security/interfaces/RSAPublicKey.java
- java/security/spec/AlgorithmParameterSpec.java
- java/security/spec/DSAParameterSpec.java
- java/security/spec/DSAPrivateKeySpec.java
- java/security/spec/DSAPublicKeySpec.java
- java/security/spec/EncodedKeySpec.java
- java/security/spec/InvalidKeySpecException.java
- java/security/spec/InvalidParameterSpecException.java
- java/security/spec/KeySpec.java
- java/security/spec/PKCS8EncodedKeySpec.java
- java/security/spec/RSAKeyGenParameterSpec.java
- java/security/spec/RSAPrivateCrtKeySpec.java
- java/security/spec/RSAPrivateKeySpec.java
- java/security/spec/RSAPublicKeySpec.java
- java/security/spec/X509EncodedKeySpec.java java/sql/Array.java
- java/sql/BatchUpdateException.java java/sql/Blob.java
- java/sql/CallableStatement.java java/sql/Clob.java
- java/sql/Connection.java java/sql/DataTruncation.java
- java/sql/DatabaseMetaData.java java/sql/Date.java
- java/sql/Driver.java java/sql/DriverManager.java
- java/sql/DriverPropertyInfo.java
- java/sql/PreparedStatement.java java/sql/Ref.java
- java/sql/ResultSet.java java/sql/ResultSetMetaData.java
- java/sql/SQLData.java java/sql/SQLException.java
- java/sql/SQLInput.java java/sql/SQLOutput.java
- java/sql/SQLWarning.java java/sql/Statement.java
- java/sql/Struct.java java/sql/Time.java
- java/sql/Timestamp.java java/sql/Types.java
- java/text/Annotation.java
- java/text/AttributedCharacterIterator.java
- java/text/AttributedString.java
- java/text/AttributedStringIterator.java
- java/text/BreakIterator.java java/text/CharacterIterator.java
- java/text/ChoiceFormat.java java/text/Collator.java
- java/text/DateFormat.java java/text/DateFormatSymbols.java
- java/text/DecimalFormat.java
- java/text/DecimalFormatSymbols.java
- java/text/FieldPosition.java java/text/Format.java
- java/text/MessageFormat.java java/text/NumberFormat.java
- java/text/ParseException.java java/text/ParsePosition.java
- java/text/SimpleDateFormat.java
- java/text/StringCharacterIterator.java
- java/util/AbstractCollection.java java/util/AbstractList.java
- java/util/AbstractMap.java
- java/util/AbstractSequentialList.java
- java/util/AbstractSet.java java/util/ArrayList.java
- java/util/Arrays.java java/util/BasicMapEntry.java
- java/util/BitSet.java java/util/Calendar.java
- java/util/Collection.java java/util/Collections.java
- java/util/Comparator.java
- java/util/ConcurrentModificationException.java
- java/util/Date.java java/util/Dictionary.java
- java/util/EmptyStackException.java java/util/Enumeration.java
- java/util/EventListener.java java/util/EventObject.java
- java/util/GregorianCalendar.java java/util/HashMap.java
- java/util/HashSet.java java/util/Hashtable.java
- java/util/IdentityHashMap.java java/util/Iterator.java
- java/util/LinkedHashMap.java java/util/LinkedHashSet.java
- java/util/LinkedList.java java/util/List.java
- java/util/ListIterator.java java/util/ListResourceBundle.java
- java/util/Locale.java java/util/Map.java
- java/util/MissingResourceException.java
- java/util/NoSuchElementException.java
- java/util/Observable.java java/util/Observer.java
- java/util/Properties.java java/util/PropertyPermission.java
- java/util/PropertyResourceBundle.java java/util/Random.java
- java/util/RandomAccess.java java/util/ResourceBundle.java
- java/util/Set.java java/util/SimpleTimeZone.java
- java/util/SortedMap.java java/util/SortedSet.java
- java/util/Stack.java java/util/StringTokenizer.java
- java/util/TimeZone.java java/util/Timer.java
- java/util/TimerTask.java
- java/util/TooManyListenersException.java
- java/util/TreeMap.java java/util/TreeSet.java
- java/util/Vector.java java/util/WeakHashMap.java
- java/util/jar/Attributes.java java/util/jar/JarEntry.java
- java/util/jar/JarException.java java/util/jar/JarFile.java
- java/util/jar/JarInputStream.java
- java/util/jar/JarOutputStream.java java/util/jar/Manifest.java
- java/util/zip/Adler32.java java/util/zip/CRC32.java
- java/util/zip/CheckedInputStream.java
- java/util/zip/CheckedOutputStream.java
- java/util/zip/Checksum.java
- java/util/zip/DataFormatException.java
- java/util/zip/Deflater.java
- java/util/zip/DeflaterOutputStream.java
- java/util/zip/GZIPInputStream.java
- java/util/zip/GZIPOutputStream.java
- java/util/zip/Inflater.java
- java/util/zip/InflaterInputStream.java
- java/util/zip/ZipConstants.java java/util/zip/ZipEntry.java
- java/util/zip/ZipException.java java/util/zip/ZipFile.java
- java/util/zip/ZipInputStream.java
- java/util/zip/ZipOutputStream.java
- javax/naming/BinaryRefAddr.java
- javax/naming/InvalidNameException.java javax/naming/Name.java
- javax/naming/NamingException.java javax/naming/RefAddr.java
+ * LIBGCJ_LICENSE gnu/classpath/Configuration.java.in
+ gnu/gcj/runtime/StringBuffer.java
+ gnu/java/awt/BitMaskExtent.java gnu/java/awt/Buffers.java
+ gnu/java/awt/ComponentDataBlitOp.java
+ gnu/java/awt/GLightweightPeer.java
+ gnu/java/beans/BeanInfoEmbryo.java
+ gnu/java/beans/EmptyBeanInfo.java
+ gnu/java/beans/ExplicitBeanInfo.java
+ gnu/java/beans/IntrospectionIncubator.java
+ gnu/java/beans/editors/ColorEditor.java
+ gnu/java/beans/editors/FontEditor.java
+ gnu/java/beans/editors/NativeBooleanEditor.java
+ gnu/java/beans/editors/NativeByteEditor.java
+ gnu/java/beans/editors/NativeDoubleEditor.java
+ gnu/java/beans/editors/NativeFloatEditor.java
+ gnu/java/beans/editors/NativeIntEditor.java
+ gnu/java/beans/editors/NativeLongEditor.java
+ gnu/java/beans/editors/NativeShortEditor.java
+ gnu/java/beans/editors/StringEditor.java
+ gnu/java/beans/info/ComponentBeanInfo.java
+ gnu/java/io/ClassLoaderObjectInputStream.java
+ gnu/java/io/NullOutputStream.java
+ gnu/java/io/ObjectIdentityWrapper.java
+ gnu/java/lang/ArrayHelper.java gnu/java/lang/ClassHelper.java
+ gnu/java/lang/reflect/TypeSignature.java
+ gnu/java/locale/Calendar.java gnu/java/locale/Calendar_de.java
+ gnu/java/locale/Calendar_en.java
+ gnu/java/locale/Calendar_nl.java
+ gnu/java/locale/LocaleInformation.java
+ gnu/java/locale/LocaleInformation_de.java
+ gnu/java/locale/LocaleInformation_en.java
+ gnu/java/locale/LocaleInformation_nl.java
+ gnu/java/math/MPN.java gnu/java/rmi/dgc/DGCImpl.java
+ gnu/java/rmi/registry/RegistryImpl.java
+ gnu/java/rmi/rmic/Compile_gcj.java
+ gnu/java/rmi/rmic/Compiler.java
+ gnu/java/rmi/rmic/CompilerProcess.java
+ gnu/java/rmi/rmic/RMIC.java
+ gnu/java/rmi/rmic/TabbedWriter.java
+ gnu/java/rmi/server/ProtocolConstants.java
+ gnu/java/rmi/server/RMIDefaultSocketFactory.java
+ gnu/java/rmi/server/RMIHashes.java
+ gnu/java/rmi/server/RMIObjectInputStream.java
+ gnu/java/rmi/server/RMIObjectOutputStream.java
+ gnu/java/rmi/server/UnicastConnection.java
+ gnu/java/rmi/server/UnicastConnectionManager.java
+ gnu/java/rmi/server/UnicastRef.java
+ gnu/java/rmi/server/UnicastRemoteCall.java
+ gnu/java/rmi/server/UnicastRemoteStub.java
+ gnu/java/rmi/server/UnicastServer.java
+ gnu/java/rmi/server/UnicastServerRef.java
+ gnu/java/security/provider/DefaultPolicy.java
+ gnu/java/security/provider/Gnu.java
+ gnu/java/security/provider/SHA.java
+ gnu/java/security/provider/SHA1PRNG.java
+ gnu/java/text/BaseBreakIterator.java
+ gnu/java/text/CharacterBreakIterator.java
+ gnu/java/text/LineBreakIterator.java
+ gnu/java/text/SentenceBreakIterator.java
+ gnu/java/text/WordBreakIterator.java
+ gnu/java/util/DoubleEnumeration.java java/applet/Applet.java
+ java/applet/AppletContext.java java/applet/AppletStub.java
+ java/applet/AudioClip.java java/awt/AWTError.java
+ java/awt/AWTEvent.java java/awt/AWTEventMulticaster.java
+ java/awt/AWTException.java java/awt/AWTPermission.java
+ java/awt/ActiveEvent.java java/awt/BorderLayout.java
+ java/awt/Button.java java/awt/Canvas.java
+ java/awt/CardLayout.java java/awt/Checkbox.java
+ java/awt/CheckboxGroup.java java/awt/Component.java
+ java/awt/ComponentOrientation.java java/awt/Container.java
+ java/awt/Dimension.java java/awt/Event.java
+ java/awt/EventDispatchThread.java java/awt/EventQueue.java
+ java/awt/FlowLayout.java java/awt/Frame.java
+ java/awt/Graphics.java java/awt/Graphics2D.java
+ java/awt/GraphicsConfiguration.java java/awt/GridLayout.java
+ java/awt/IllegalComponentStateException.java
+ java/awt/ItemSelectable.java java/awt/Label.java
+ java/awt/LayoutManager.java java/awt/LayoutManager2.java
+ java/awt/MenuComponent.java java/awt/MenuItem.java
+ java/awt/Paint.java java/awt/Point.java
+ java/awt/Rectangle.java java/awt/RenderingHints.java
+ java/awt/Transparency.java java/awt/Window.java
+ java/awt/color/ColorSpace.java
+ java/awt/color/ICC_ColorSpace.java
+ java/awt/color/ICC_Profile.java
+ java/awt/event/HierarchyBoundsAdapter.java
+ java/awt/event/HierarchyBoundsListener.java
+ java/awt/event/HierarchyEvent.java
+ java/awt/event/HierarchyListener.java
+ java/awt/geom/AffineTransform.java
+ java/awt/geom/Dimension2D.java java/awt/geom/Ellipse2D.java
+ java/awt/geom/IllegalPathStateException.java
+ java/awt/geom/Line2D.java
+ java/awt/geom/NoninvertibleTransformException.java
+ java/awt/geom/PathIterator.java java/awt/geom/Point2D.java
+ java/awt/geom/Rectangle2D.java
+ java/awt/geom/RectangularShape.java
+ java/awt/geom/RoundRectangle2D.java
+ java/awt/image/BufferedImage.java
+ java/awt/image/ColorModel.java
+ java/awt/image/ComponentColorModel.java
+ java/awt/image/ComponentSampleModel.java
+ java/awt/image/DataBuffer.java
+ java/awt/image/DataBufferByte.java
+ java/awt/image/DataBufferInt.java
+ java/awt/image/DataBufferUShort.java
+ java/awt/image/DirectColorModel.java
+ java/awt/image/PackedColorModel.java
+ java/awt/image/Raster.java java/awt/image/RasterOp.java
+ java/awt/image/SampleModel.java
+ java/awt/image/SinglePixelPackedSampleModel.java
+ java/awt/image/WritableRaster.java
+ java/beans/AppletInitializer.java
+ java/beans/BeanDescriptor.java java/beans/BeanInfo.java
+ java/beans/Beans.java java/beans/Customizer.java
+ java/beans/DesignMode.java java/beans/EventSetDescriptor.java
+ java/beans/FeatureDescriptor.java
+ java/beans/IndexedPropertyDescriptor.java
+ java/beans/IntrospectionException.java
+ java/beans/Introspector.java java/beans/MethodDescriptor.java
+ java/beans/ParameterDescriptor.java
+ java/beans/PropertyChangeEvent.java
+ java/beans/PropertyChangeListener.java
+ java/beans/PropertyChangeSupport.java
+ java/beans/PropertyDescriptor.java
+ java/beans/PropertyEditor.java
+ java/beans/PropertyEditorManager.java
+ java/beans/PropertyEditorSupport.java
+ java/beans/PropertyVetoException.java
+ java/beans/SimpleBeanInfo.java
+ java/beans/VetoableChangeListener.java
+ java/beans/VetoableChangeSupport.java
+ java/beans/Visibility.java
+ java/beans/beancontext/BeanContext.java
+ java/beans/beancontext/BeanContextChild.java
+ java/beans/beancontext/BeanContextChildComponentProxy.java
+ java/beans/beancontext/BeanContextChildSupport.java
+ java/beans/beancontext/BeanContextContainerProxy.java
+ java/beans/beancontext/BeanContextEvent.java
+ java/beans/beancontext/BeanContextMembershipEvent.java
+ java/beans/beancontext/BeanContextMembershipListener.java
+ java/beans/beancontext/BeanContextProxy.java
+ java/beans/beancontext/BeanContextServiceAvailableEvent.java
+ java/beans/beancontext/BeanContextServiceProvider.java
+ java/beans/beancontext/BeanContextServiceProviderBeanInfo.java
+ java/beans/beancontext/BeanContextServiceRevokedEvent.java
+ java/beans/beancontext/BeanContextServiceRevokedListener.java
+ java/beans/beancontext/BeanContextServices.java
+ java/beans/beancontext/BeanContextServicesListener.java
+ java/io/BufferedInputStream.java
+ java/io/BufferedOutputStream.java java/io/BufferedReader.java
+ java/io/BufferedWriter.java java/io/ByteArrayInputStream.java
+ java/io/ByteArrayOutputStream.java
+ java/io/CharArrayReader.java java/io/CharArrayWriter.java
+ java/io/CharConversionException.java java/io/DataInput.java
+ java/io/DataInputStream.java java/io/DataOutput.java
+ java/io/EOFException.java java/io/Externalizable.java
+ java/io/FileFilter.java java/io/FileNotFoundException.java
+ java/io/FilePermission.java java/io/FileReader.java
+ java/io/FileWriter.java java/io/FilenameFilter.java
+ java/io/FilterInputStream.java java/io/FilterOutputStream.java
+ java/io/FilterReader.java java/io/FilterWriter.java
+ java/io/IOException.java java/io/InputStream.java
+ java/io/InterruptedIOException.java
+ java/io/InvalidClassException.java
+ java/io/InvalidObjectException.java
+ java/io/NotActiveException.java
+ java/io/NotSerializableException.java java/io/ObjectInput.java
+ java/io/ObjectInputStream.java
+ java/io/ObjectInputValidation.java java/io/ObjectOutput.java
+ java/io/ObjectOutputStream.java java/io/ObjectStreamClass.java
+ java/io/ObjectStreamConstants.java
+ java/io/ObjectStreamException.java
+ java/io/ObjectStreamField.java
+ java/io/OptionalDataException.java java/io/OutputStream.java
+ java/io/PipedInputStream.java java/io/PipedOutputStream.java
+ java/io/PipedReader.java java/io/PipedWriter.java
+ java/io/PrintWriter.java java/io/PushbackInputStream.java
+ java/io/PushbackReader.java java/io/Reader.java
+ java/io/SequenceInputStream.java java/io/Serializable.java
+ java/io/SerializablePermission.java
+ java/io/StreamCorruptedException.java
+ java/io/StreamTokenizer.java
+ java/io/StringBufferInputStream.java java/io/StringReader.java
+ java/io/StringWriter.java java/io/SyncFailedException.java
+ java/io/UTFDataFormatException.java
+ java/io/UnsupportedEncodingException.java
+ java/io/WriteAbortedException.java java/io/Writer.java
+ java/lang/AbstractMethodError.java
+ java/lang/ArithmeticException.java
+ java/lang/ArrayIndexOutOfBoundsException.java
+ java/lang/ArrayStoreException.java java/lang/Boolean.java
+ java/lang/Byte.java java/lang/CharSequence.java
+ java/lang/ClassCastException.java
+ java/lang/ClassCircularityError.java
+ java/lang/ClassFormatError.java
+ java/lang/ClassNotFoundException.java
+ java/lang/CloneNotSupportedException.java
+ java/lang/Cloneable.java java/lang/Comparable.java
+ java/lang/Compiler.java java/lang/Double.java
+ java/lang/Error.java java/lang/Exception.java
+ java/lang/ExceptionInInitializerError.java
+ java/lang/Float.java java/lang/IllegalAccessError.java
+ java/lang/IllegalAccessException.java
+ java/lang/IllegalArgumentException.java
+ java/lang/IllegalMonitorStateException.java
+ java/lang/IllegalStateException.java
+ java/lang/IllegalThreadStateException.java
+ java/lang/IncompatibleClassChangeError.java
+ java/lang/IndexOutOfBoundsException.java
+ java/lang/InheritableThreadLocal.java
+ java/lang/InstantiationError.java
+ java/lang/InstantiationException.java java/lang/Integer.java
+ java/lang/InternalError.java
+ java/lang/InterruptedException.java
+ java/lang/LinkageError.java java/lang/Long.java
+ java/lang/NegativeArraySizeException.java
+ java/lang/NoClassDefFoundError.java
+ java/lang/NoSuchFieldError.java
+ java/lang/NoSuchFieldException.java
+ java/lang/NoSuchMethodError.java
+ java/lang/NoSuchMethodException.java
+ java/lang/NullPointerException.java java/lang/Number.java
+ java/lang/NumberFormatException.java
+ java/lang/OutOfMemoryError.java java/lang/Package.java
+ java/lang/Process.java java/lang/Runnable.java
+ java/lang/RuntimeException.java
+ java/lang/RuntimePermission.java
+ java/lang/SecurityException.java
+ java/lang/SecurityManager.java java/lang/Short.java
+ java/lang/StackOverflowError.java java/lang/StringBuffer.java
+ java/lang/StringIndexOutOfBoundsException.java
+ java/lang/ThreadDeath.java java/lang/ThreadGroup.java
+ java/lang/ThreadLocal.java java/lang/UnknownError.java
+ java/lang/UnsatisfiedLinkError.java
+ java/lang/UnsupportedClassVersionError.java
+ java/lang/UnsupportedOperationException.java
+ java/lang/VerifyError.java java/lang/VirtualMachineError.java
+ java/lang/Void.java java/lang/ref/PhantomReference.java
+ java/lang/ref/Reference.java java/lang/ref/ReferenceQueue.java
+ java/lang/ref/SoftReference.java
+ java/lang/ref/WeakReference.java
+ java/lang/reflect/AccessibleObject.java
+ java/lang/reflect/InvocationTargetException.java
+ java/lang/reflect/Member.java java/lang/reflect/Modifier.java
+ java/lang/reflect/ReflectPermission.java
+ java/math/BigDecimal.java java/math/BigInteger.java
+ java/net/Authenticator.java java/net/BindException.java
+ java/net/ConnectException.java java/net/ContentHandler.java
+ java/net/ContentHandlerFactory.java
+ java/net/DatagramPacket.java java/net/DatagramSocketImpl.java
+ java/net/FileNameMap.java java/net/MalformedURLException.java
+ java/net/MulticastSocket.java java/net/NetPermission.java
+ java/net/NoRouteToHostException.java
+ java/net/PasswordAuthentication.java
+ java/net/ProtocolException.java java/net/ServerSocket.java
+ java/net/Socket.java java/net/SocketException.java
+ java/net/SocketImpl.java java/net/SocketImplFactory.java
+ java/net/SocketOptions.java java/net/SocketPermission.java
+ java/net/URLDecoder.java java/net/URLEncoder.java
+ java/net/URLStreamHandlerFactory.java
+ java/net/UnknownHostException.java
+ java/net/UnknownServiceException.java
+ java/rmi/AccessException.java
+ java/rmi/AlreadyBoundException.java
+ java/rmi/ConnectException.java
+ java/rmi/ConnectIOException.java
+ java/rmi/MarshalException.java java/rmi/MarshalledObject.java
+ java/rmi/Naming.java java/rmi/NoSuchObjectException.java
+ java/rmi/NotBoundException.java
+ java/rmi/RMISecurityException.java
+ java/rmi/RMISecurityManager.java java/rmi/Remote.java
+ java/rmi/RemoteException.java java/rmi/ServerError.java
+ java/rmi/ServerException.java
+ java/rmi/ServerRuntimeException.java
+ java/rmi/StubNotFoundException.java
+ java/rmi/UnexpectedException.java
+ java/rmi/UnknownHostException.java
+ java/rmi/UnmarshalException.java
+ java/rmi/activation/Activatable.java
+ java/rmi/activation/ActivateFailedException.java
+ java/rmi/activation/ActivationDesc.java
+ java/rmi/activation/ActivationException.java
+ java/rmi/activation/ActivationGroup.java
+ java/rmi/activation/ActivationGroupDesc.java
+ java/rmi/activation/ActivationGroupID.java
+ java/rmi/activation/ActivationID.java
+ java/rmi/activation/ActivationInstantiator.java
+ java/rmi/activation/ActivationMonitor.java
+ java/rmi/activation/ActivationSystem.java
+ java/rmi/activation/Activator.java
+ java/rmi/activation/UnknownGroupException.java
+ java/rmi/activation/UnknownObjectException.java
+ java/rmi/dgc/DGC.java java/rmi/dgc/Lease.java
+ java/rmi/dgc/VMID.java java/rmi/registry/LocateRegistry.java
+ java/rmi/registry/Registry.java
+ java/rmi/registry/RegistryHandler.java
+ java/rmi/server/ExportException.java
+ java/rmi/server/LoaderHandler.java
+ java/rmi/server/LogStream.java java/rmi/server/ObjID.java
+ java/rmi/server/Operation.java
+ java/rmi/server/RMIClassLoader.java
+ java/rmi/server/RMIClientSocketFactory.java
+ java/rmi/server/RMIFailureHandler.java
+ java/rmi/server/RMIServerSocketFactory.java
+ java/rmi/server/RMISocketFactory.java
+ java/rmi/server/RemoteCall.java
+ java/rmi/server/RemoteObject.java
+ java/rmi/server/RemoteRef.java
+ java/rmi/server/RemoteServer.java
+ java/rmi/server/RemoteStub.java
+ java/rmi/server/ServerCloneException.java
+ java/rmi/server/ServerNotActiveException.java
+ java/rmi/server/ServerRef.java java/rmi/server/Skeleton.java
+ java/rmi/server/SkeletonMismatchException.java
+ java/rmi/server/SkeletonNotFoundException.java
+ java/rmi/server/SocketSecurityException.java
+ java/rmi/server/UID.java
+ java/rmi/server/UnicastRemoteObject.java
+ java/rmi/server/Unreferenced.java
+ java/security/AccessControlContext.java
+ java/security/AccessControlException.java
+ java/security/AccessController.java
+ java/security/AlgorithmParameterGenerator.java
+ java/security/AlgorithmParameterGeneratorSpi.java
+ java/security/AlgorithmParameters.java
+ java/security/AlgorithmParametersSpi.java
+ java/security/AllPermission.java
+ java/security/BasicPermission.java
+ java/security/Certificate.java java/security/CodeSource.java
+ java/security/DigestException.java
+ java/security/DigestInputStream.java
+ java/security/DigestOutputStream.java
+ java/security/DomainCombiner.java
+ java/security/DummyKeyPairGenerator.java
+ java/security/DummyMessageDigest.java
+ java/security/DummySignature.java
+ java/security/GeneralSecurityException.java
+ java/security/Guard.java java/security/GuardedObject.java
+ java/security/Identity.java java/security/IdentityScope.java
+ java/security/InvalidAlgorithmParameterException.java
+ java/security/InvalidKeyException.java
+ java/security/InvalidParameterException.java
+ java/security/Key.java java/security/KeyException.java
+ java/security/KeyFactory.java java/security/KeyFactorySpi.java
+ java/security/KeyManagementException.java
+ java/security/KeyPair.java java/security/KeyPairGenerator.java
+ java/security/KeyPairGeneratorSpi.java
+ java/security/KeyStore.java
+ java/security/KeyStoreException.java
+ java/security/KeyStoreSpi.java
+ java/security/MessageDigest.java
+ java/security/MessageDigestSpi.java
+ java/security/NoSuchAlgorithmException.java
+ java/security/NoSuchProviderException.java
+ java/security/Permission.java
+ java/security/PermissionCollection.java
+ java/security/Permissions.java java/security/Policy.java
+ java/security/Principal.java java/security/PrivateKey.java
+ java/security/PrivilegedAction.java
+ java/security/PrivilegedActionException.java
+ java/security/PrivilegedExceptionAction.java
+ java/security/ProtectionDomain.java
+ java/security/Provider.java
+ java/security/ProviderException.java
+ java/security/PublicKey.java
+ java/security/SecureClassLoader.java
+ java/security/SecureRandom.java
+ java/security/SecureRandomSpi.java java/security/Security.java
+ java/security/SecurityPermission.java
+ java/security/Signature.java
+ java/security/SignatureException.java
+ java/security/SignatureSpi.java
+ java/security/SignedObject.java java/security/Signer.java
+ java/security/UnrecoverableKeyException.java
+ java/security/UnresolvedPermission.java
+ java/security/acl/Acl.java java/security/acl/AclEntry.java
+ java/security/acl/AclNotFoundException.java
+ java/security/acl/Group.java
+ java/security/acl/LastOwnerException.java
+ java/security/acl/NotOwnerException.java
+ java/security/acl/Owner.java java/security/acl/Permission.java
+ java/security/cert/CRL.java
+ java/security/cert/CRLException.java
+ java/security/cert/Certificate.java
+ java/security/cert/CertificateEncodingException.java
+ java/security/cert/CertificateException.java
+ java/security/cert/CertificateExpiredException.java
+ java/security/cert/CertificateFactory.java
+ java/security/cert/CertificateFactorySpi.java
+ java/security/cert/CertificateNotYetValidException.java
+ java/security/cert/CertificateParsingException.java
+ java/security/cert/X509CRL.java
+ java/security/cert/X509CRLEntry.java
+ java/security/cert/X509Certificate.java
+ java/security/cert/X509Extension.java
+ java/security/interfaces/DSAKey.java
+ java/security/interfaces/DSAKeyPairGenerator.java
+ java/security/interfaces/DSAParams.java
+ java/security/interfaces/DSAPrivateKey.java
+ java/security/interfaces/DSAPublicKey.java
+ java/security/interfaces/RSAKey.java
+ java/security/interfaces/RSAPrivateCrtKey.java
+ java/security/interfaces/RSAPrivateKey.java
+ java/security/interfaces/RSAPublicKey.java
+ java/security/spec/AlgorithmParameterSpec.java
+ java/security/spec/DSAParameterSpec.java
+ java/security/spec/DSAPrivateKeySpec.java
+ java/security/spec/DSAPublicKeySpec.java
+ java/security/spec/EncodedKeySpec.java
+ java/security/spec/InvalidKeySpecException.java
+ java/security/spec/InvalidParameterSpecException.java
+ java/security/spec/KeySpec.java
+ java/security/spec/PKCS8EncodedKeySpec.java
+ java/security/spec/RSAKeyGenParameterSpec.java
+ java/security/spec/RSAPrivateCrtKeySpec.java
+ java/security/spec/RSAPrivateKeySpec.java
+ java/security/spec/RSAPublicKeySpec.java
+ java/security/spec/X509EncodedKeySpec.java java/sql/Array.java
+ java/sql/BatchUpdateException.java java/sql/Blob.java
+ java/sql/CallableStatement.java java/sql/Clob.java
+ java/sql/Connection.java java/sql/DataTruncation.java
+ java/sql/DatabaseMetaData.java java/sql/Date.java
+ java/sql/Driver.java java/sql/DriverManager.java
+ java/sql/DriverPropertyInfo.java
+ java/sql/PreparedStatement.java java/sql/Ref.java
+ java/sql/ResultSet.java java/sql/ResultSetMetaData.java
+ java/sql/SQLData.java java/sql/SQLException.java
+ java/sql/SQLInput.java java/sql/SQLOutput.java
+ java/sql/SQLWarning.java java/sql/Statement.java
+ java/sql/Struct.java java/sql/Time.java
+ java/sql/Timestamp.java java/sql/Types.java
+ java/text/Annotation.java
+ java/text/AttributedCharacterIterator.java
+ java/text/AttributedString.java
+ java/text/AttributedStringIterator.java
+ java/text/BreakIterator.java java/text/CharacterIterator.java
+ java/text/ChoiceFormat.java java/text/Collator.java
+ java/text/DateFormat.java java/text/DateFormatSymbols.java
+ java/text/DecimalFormat.java
+ java/text/DecimalFormatSymbols.java
+ java/text/FieldPosition.java java/text/Format.java
+ java/text/MessageFormat.java java/text/NumberFormat.java
+ java/text/ParseException.java java/text/ParsePosition.java
+ java/text/SimpleDateFormat.java
+ java/text/StringCharacterIterator.java
+ java/util/AbstractCollection.java java/util/AbstractList.java
+ java/util/AbstractMap.java
+ java/util/AbstractSequentialList.java
+ java/util/AbstractSet.java java/util/ArrayList.java
+ java/util/Arrays.java java/util/BasicMapEntry.java
+ java/util/BitSet.java java/util/Calendar.java
+ java/util/Collection.java java/util/Collections.java
+ java/util/Comparator.java
+ java/util/ConcurrentModificationException.java
+ java/util/Date.java java/util/Dictionary.java
+ java/util/EmptyStackException.java java/util/Enumeration.java
+ java/util/EventListener.java java/util/EventObject.java
+ java/util/GregorianCalendar.java java/util/HashMap.java
+ java/util/HashSet.java java/util/Hashtable.java
+ java/util/IdentityHashMap.java java/util/Iterator.java
+ java/util/LinkedHashMap.java java/util/LinkedHashSet.java
+ java/util/LinkedList.java java/util/List.java
+ java/util/ListIterator.java java/util/ListResourceBundle.java
+ java/util/Locale.java java/util/Map.java
+ java/util/MissingResourceException.java
+ java/util/NoSuchElementException.java
+ java/util/Observable.java java/util/Observer.java
+ java/util/Properties.java java/util/PropertyPermission.java
+ java/util/PropertyResourceBundle.java java/util/Random.java
+ java/util/RandomAccess.java java/util/ResourceBundle.java
+ java/util/Set.java java/util/SimpleTimeZone.java
+ java/util/SortedMap.java java/util/SortedSet.java
+ java/util/Stack.java java/util/StringTokenizer.java
+ java/util/TimeZone.java java/util/Timer.java
+ java/util/TimerTask.java
+ java/util/TooManyListenersException.java
+ java/util/TreeMap.java java/util/TreeSet.java
+ java/util/Vector.java java/util/WeakHashMap.java
+ java/util/jar/Attributes.java java/util/jar/JarEntry.java
+ java/util/jar/JarException.java java/util/jar/JarFile.java
+ java/util/jar/JarInputStream.java
+ java/util/jar/JarOutputStream.java java/util/jar/Manifest.java
+ java/util/zip/Adler32.java java/util/zip/CRC32.java
+ java/util/zip/CheckedInputStream.java
+ java/util/zip/CheckedOutputStream.java
+ java/util/zip/Checksum.java
+ java/util/zip/DataFormatException.java
+ java/util/zip/Deflater.java
+ java/util/zip/DeflaterOutputStream.java
+ java/util/zip/GZIPInputStream.java
+ java/util/zip/GZIPOutputStream.java
+ java/util/zip/Inflater.java
+ java/util/zip/InflaterInputStream.java
+ java/util/zip/ZipConstants.java java/util/zip/ZipEntry.java
+ java/util/zip/ZipException.java java/util/zip/ZipFile.java
+ java/util/zip/ZipInputStream.java
+ java/util/zip/ZipOutputStream.java
+ javax/naming/BinaryRefAddr.java
+ javax/naming/InvalidNameException.java javax/naming/Name.java
+ javax/naming/NamingException.java javax/naming/RefAddr.java
javax/naming/StringRefAddr.java: Add license clarification.
2002-01-22 Tom Tromey <tromey@redhat.com>
@@ -3848,7 +6062,7 @@
* Makefile.in: Rebuilt.
* Makefile.am (jv_convert_LDADD): Removed convert_source_files.
-2002-01-08 Nic Ferrier <nferrier@tf1.tapsellferrier.co.uk>
+2002-01-08 Nic Ferrier <nferrier@tf1.tapsellferrier.co.uk>
* java/net/natPlainSocketImpl.cc: Added timeout handling for
sockets.
@@ -3904,4 +6118,3 @@
* libjava/java/lang/ieeefp.h: Define __IEEE_BIG_ENDIAN for
PPC Darwin, not for all of Darwin.
-
diff --git a/libjava/Makefile.am b/libjava/Makefile.am
index 89fff76cbfb..34135e77e99 100644
--- a/libjava/Makefile.am
+++ b/libjava/Makefile.am
@@ -57,14 +57,14 @@ if CANADIAN
if NULL_TARGET
## In this case, gcj is found outside the build tree. However, zip is
## found in the build tree.
-ZIP = $(MULTIBUILDTOP)../$(COMPPATH)/fastjar/jar$(EXEEXT)
+ZIP = $(MULTIBUILDTOP)../$(COMPPATH)/fastjar/jar
else
ZIP = jar
endif
GCJH = gcjh
else # CANADIAN
-GCJH = $(MULTIBUILDTOP)../$(COMPPATH)/gcc/gcjh$(EXEEXT)
-ZIP = $(MULTIBUILDTOP)../$(COMPPATH)/fastjar/jar$(EXEEXT)
+GCJH = $(MULTIBUILDTOP)../$(COMPPATH)/gcc/gcjh
+ZIP = $(MULTIBUILDTOP)../$(COMPPATH)/fastjar/jar
endif # CANADIAN
## The compiler with whatever flags we want for both -c and -C
@@ -128,7 +128,7 @@ javao_files = $(java_source_files:.java=.lo) \
x_javao_files = $(x_java_source_files:.java=.lo)
libgcj_la_SOURCES = prims.cc jni.cc exception.cc \
- resolve.cc defineclass.cc interpret.cc name-finder.cc verify.cc \
+ resolve.cc defineclass.cc interpret.cc verify.cc \
$(nat_source_files)
EXTRA_libgcj_la_SOURCES = boehm.cc nogc.cc posix-threads.cc no-threads.cc \
win32-threads.cc posix.cc win32.cc \
@@ -249,7 +249,9 @@ ordinary_nat_headers = $(ordinary_java_source_files:.java=.h) \
$(built_java_source_files:.java=.h)
inner_nat_headers = java/io/ObjectOutputStream$$PutField.h \
- java/io/ObjectInputStream$$GetField.h
+ java/io/ObjectInputStream$$GetField.h \
+ java/lang/reflect/Proxy$$ProxyData.h \
+ java/lang/reflect/Proxy$$ProxyType.h
nat_headers = $(ordinary_nat_headers) $(inner_nat_headers)
@@ -309,6 +311,18 @@ java/lang/reflect/Method.h: java/lang/reflect/Method.class
-friend 'jobject _Jv_JNI_ToReflectedMethod (_Jv_JNIEnv *, jclass, jmethodID, jboolean);' \
$(basename $<)
+java/lang/reflect/Proxy.h: java/lang/reflect/Proxy.class
+ $(GCJH) -classpath '' -bootclasspath $(top_builddir) \
+ $(basename $<)
+
+java/lang/reflect/Proxy$$ProxyData.h: java/lang/reflect/Proxy.class
+ $(GCJH) -classpath '' -bootclasspath $(top_builddir) \
+ 'java/lang/reflect/Proxy$$ProxyData'
+
+java/lang/reflect/Proxy$$ProxyType.h: java/lang/reflect/Proxy.class
+ $(GCJH) -classpath '' -bootclasspath $(top_builddir) \
+ 'java/lang/reflect/Proxy$$ProxyType'
+
gnu/gcj/runtime/VMClassLoader.h: gnu/gcj/runtime/VMClassLoader.class
$(GCJH) -classpath '' -bootclasspath $(top_builddir) \
-friend 'class ::java::lang::ClassLoader;' \
@@ -664,6 +678,8 @@ java/awt/Window.java \
java/awt/color/ColorSpace.java \
java/awt/color/ICC_ColorSpace.java \
java/awt/color/ICC_Profile.java \
+java/awt/color/ICC_ProfileGray.java \
+java/awt/color/ICC_ProfileRGB.java \
java/awt/color/CMMException.java \
java/awt/color/ProfileDataException.java \
java/awt/datatransfer/Clipboard.java \
@@ -838,10 +854,12 @@ java/awt/Robot.java \
java/awt/ScrollPaneAdjustable.java \
java/awt/Stroke.java \
java/awt/TexturePaint.java \
+java/awt/dnd/peer/DragSourceContextPeer.java \
+java/awt/dnd/peer/DropTargetContextPeer.java \
java/awt/dnd/DnDConstants.java \
java/awt/dnd/DragGestureEvent.java \
java/awt/dnd/DragGestureListener.java \
-java/awt/dnd/DragGestureRecognizer.java \
+java/awt/dnd/DragGestureRecognizer.java \
java/awt/dnd/DragSource.java \
java/awt/dnd/DragSourceAdapter.java \
java/awt/dnd/DragSourceContext.java \
@@ -851,7 +869,15 @@ java/awt/dnd/DragSourceListener.java \
java/awt/dnd/DragSourceMotionListener.java \
java/awt/dnd/DropTarget.java \
java/awt/dnd/InvalidDnDOperationException.java \
-java/awt/dnd/peer/DragSourceContextPeer.java \
+java/awt/dnd/Autoscroll.java \
+java/awt/dnd/DragSourceDropEvent.java \
+java/awt/dnd/DropTargetAdapter.java \
+java/awt/dnd/DropTargetContext.java \
+java/awt/dnd/DropTargetDragEvent.java \
+java/awt/dnd/DropTargetDropEvent.java \
+java/awt/dnd/DropTargetEvent.java \
+java/awt/dnd/DropTargetListener.java \
+java/awt/dnd/MouseDragGestureRecognizer.java \
java/awt/font/TextHitInfo.java \
java/awt/im/spi/InputMethod.java \
java/awt/im/spi/InputMethodContext.java \
@@ -1270,6 +1296,8 @@ java/rmi/server/SocketSecurityException.java \
java/rmi/server/UID.java \
java/rmi/server/UnicastRemoteObject.java \
java/rmi/server/Unreferenced.java \
+gnu/java/rmi/RMIMarshalledObjectInputStream.java \
+gnu/java/rmi/RMIMarshalledObjectOutputStream.java \
gnu/java/rmi/dgc/DGCImpl.java \
gnu/java/rmi/dgc/DGCImpl_Skel.java \
gnu/java/rmi/dgc/DGCImpl_Stub.java \
@@ -1281,6 +1309,7 @@ gnu/java/rmi/rmic/Compiler.java \
gnu/java/rmi/rmic/CompilerProcess.java \
gnu/java/rmi/rmic/RMIC.java \
gnu/java/rmi/rmic/TabbedWriter.java \
+gnu/java/rmi/server/ConnectionRunnerPool.java \
gnu/java/rmi/server/ProtocolConstants.java \
gnu/java/rmi/server/RMIDefaultSocketFactory.java \
gnu/java/rmi/server/RMIHashes.java \
@@ -1527,6 +1556,7 @@ java/lang/VerifyError.java \
java/lang/VirtualMachineError.java \
java/lang/VMClassLoader.java \
java/lang/VMSecurityManager.java \
+java/lang/VMThrowable.java \
java/lang/Void.java \
java/io/BufferedInputStream.java \
java/io/BufferedOutputStream.java \
@@ -1660,7 +1690,10 @@ java/util/TreeMap.java \
java/util/TreeSet.java \
java/util/TooManyListenersException.java \
java/util/Vector.java \
-java/util/WeakHashMap.java
+java/util/WeakHashMap.java \
+java/util/regex/Matcher.java \
+java/util/regex/Pattern.java \
+java/util/regex/PatternSyntaxException.java
## List of all .java files to be compiled. Please keep this list
## alphabetical. Please put files from java/lang, java/io, and java/util
@@ -1687,6 +1720,7 @@ gnu/gcj/runtime/FileDeleter.java \
gnu/gcj/runtime/FinalizerThread.java \
gnu/gcj/runtime/FirstThread.java \
gnu/gcj/runtime/JNIWeakRef.java \
+gnu/gcj/runtime/NameFinder.java \
gnu/gcj/runtime/SharedLibLoader.java \
gnu/gcj/runtime/StringBuffer.java \
gnu/gcj/runtime/VMClassLoader.java \
@@ -1837,6 +1871,15 @@ gnu/java/locale/LocaleInformation_zh_HK.java \
gnu/java/locale/LocaleInformation_zh_SG.java \
gnu/java/locale/LocaleInformation_zh_TW.java \
gnu/java/math/MPN.java \
+gnu/java/nio/charset/ISO_8859_1.java \
+gnu/java/nio/charset/Provider.java \
+gnu/java/nio/charset/US_ASCII.java \
+gnu/java/nio/charset/UTF_16.java \
+gnu/java/nio/charset/UTF_16BE.java \
+gnu/java/nio/charset/UTF_16Decoder.java \
+gnu/java/nio/charset/UTF_16Encoder.java \
+gnu/java/nio/charset/UTF_16LE.java \
+gnu/java/nio/charset/UTF_8.java \
gnu/java/security/der/DEREncodingException.java \
gnu/java/security/provider/DERReader.java \
gnu/java/security/provider/DERWriter.java \
@@ -1868,11 +1911,14 @@ java/lang/reflect/AccessibleObject.java \
java/lang/reflect/Array.java \
java/lang/reflect/Constructor.java \
java/lang/reflect/Field.java \
+java/lang/reflect/InvocationHandler.java \
java/lang/reflect/InvocationTargetException.java \
java/lang/reflect/Member.java \
java/lang/reflect/Method.java \
java/lang/reflect/Modifier.java \
+java/lang/reflect/Proxy.java \
java/lang/reflect/ReflectPermission.java \
+java/lang/reflect/UndeclaredThrowableException.java \
java/math/BigDecimal.java \
java/math/BigInteger.java \
java/net/Authenticator.java \
@@ -1883,14 +1929,18 @@ java/net/ContentHandlerFactory.java \
java/net/DatagramPacket.java \
java/net/DatagramSocket.java \
java/net/DatagramSocketImpl.java \
+java/net/DatagramSocketImplFactory.java \
java/net/FileNameMap.java \
java/net/HttpURLConnection.java \
java/net/InetAddress.java \
+java/net/Inet4Address.java \
+java/net/Inet6Address.java \
java/net/InetSocketAddress.java \
java/net/JarURLConnection.java \
java/net/MalformedURLException.java \
java/net/MulticastSocket.java \
java/net/NetPermission.java \
+java/net/NetworkInterface.java \
java/net/NoRouteToHostException.java \
java/net/PasswordAuthentication.java \
java/net/PlainDatagramSocketImpl.java \
@@ -1906,6 +1956,7 @@ java/net/SocketImplFactory.java \
java/net/SocketOptions.java \
java/net/SocketPermission.java \
java/net/SocketTimeoutException.java \
+java/net/URI.java \
java/net/URISyntaxException.java \
java/net/URL.java \
java/net/URLClassLoader.java \
@@ -1916,6 +1967,65 @@ java/net/URLStreamHandler.java \
java/net/URLStreamHandlerFactory.java \
java/net/UnknownHostException.java \
java/net/UnknownServiceException.java \
+java/nio/Buffer.java \
+java/nio/BufferOverflowException.java \
+java/nio/BufferUnderflowException.java \
+java/nio/ByteBuffer.java \
+java/nio/ByteOrder.java \
+java/nio/CharBuffer.java \
+java/nio/InvalidMarkException.java \
+java/nio/MappedByteBuffer.java \
+java/nio/ReadOnlyBufferException.java \
+java/nio/channels/AlreadyConnectedException.java \
+java/nio/channels/AsynchronousCloseException.java \
+java/nio/channels/ByteChannel.java \
+java/nio/channels/CancelledKeyException.java \
+java/nio/channels/Channel.java \
+java/nio/channels/ClosedByInterruptException.java \
+java/nio/channels/ClosedChannelException.java \
+java/nio/channels/ClosedSelectorException.java \
+java/nio/channels/ConnectionPendingException.java \
+java/nio/channels/DatagramChannel.java \
+java/nio/channels/FileChannel.java \
+java/nio/channels/FileLockInterruptionException.java \
+java/nio/channels/GatheringByteChannel.java \
+java/nio/channels/IllegalBlockingModeException.java \
+java/nio/channels/IllegalSelectorException.java \
+java/nio/channels/InterruptibleChannel.java \
+java/nio/channels/NoConnectionPendingException.java \
+java/nio/channels/NonReadableChannelException.java \
+java/nio/channels/NonWritableChannelException.java \
+java/nio/channels/NotYetBoundException.java \
+java/nio/channels/NotYetConnectedException.java \
+java/nio/channels/OverlappingFileLockException.java \
+java/nio/channels/Pipe.java \
+java/nio/channels/ReadableByteChannel.java \
+java/nio/channels/ScatteringByteChannel.java \
+java/nio/channels/SelectableChannel.java \
+java/nio/channels/SelectionKey.java \
+java/nio/channels/Selector.java \
+java/nio/channels/ServerSocketChannel.java \
+java/nio/channels/SocketChannel.java \
+java/nio/channels/UnresolvedAddressException.java \
+java/nio/channels/UnsupportedAddressTypeException.java \
+java/nio/channels/WritableByteChannel.java \
+java/nio/channels/spi/AbstractSelectableChannel.java \
+java/nio/channels/spi/AbstractInterruptibleChannel.java \
+java/nio/channels/spi/AbstractSelectionKey.java \
+java/nio/channels/spi/AbstractSelector.java \
+java/nio/channels/spi/SelectorProvider.java \
+java/nio/charset/Charset.java \
+java/nio/charset/CharacterCodingException.java \
+java/nio/charset/CharsetDecoder.java \
+java/nio/charset/CharsetEncoder.java \
+java/nio/charset/CoderMalfunctionError.java \
+java/nio/charset/CoderResult.java \
+java/nio/charset/CodingErrorAction.java \
+java/nio/charset/IllegalCharsetNameException.java \
+java/nio/charset/MalformedInputException.java \
+java/nio/charset/UnmappableCharacterException.java \
+java/nio/charset/UnsupportedCharsetException.java \
+java/nio/charset/spi/CharsetProvider.java \
java/security/AccessControlContext.java \
java/security/AccessControlException.java \
java/security/AccessController.java \
@@ -2204,6 +2314,7 @@ gnu/gcj/io/shs.cc \
gnu/gcj/protocol/core/natCoreInputStream.cc \
gnu/gcj/runtime/natFinalizerThread.cc \
gnu/gcj/runtime/natFirstThread.cc \
+gnu/gcj/runtime/natNameFinder.cc \
gnu/gcj/runtime/natSharedLibLoader.cc \
gnu/gcj/runtime/natStringBuffer.cc \
java/io/natFile.cc \
@@ -2223,12 +2334,14 @@ java/lang/natString.cc \
java/lang/natStringBuffer.cc \
java/lang/natSystem.cc \
java/lang/natThread.cc \
-java/lang/natThrowable.cc \
+java/lang/natVMThrowable.cc \
java/lang/ref/natReference.cc \
java/lang/reflect/natArray.cc \
java/lang/reflect/natConstructor.cc \
java/lang/reflect/natField.cc \
java/lang/reflect/natMethod.cc \
+java/lang/reflect/natProxy.cc \
+java/net/natNetworkInterface.cc \
java/net/natInetAddress.cc \
java/net/natPlainDatagramSocketImpl.cc \
java/net/natPlainSocketImpl.cc \
@@ -2369,7 +2482,7 @@ AM_MAKEFLAGS = \
"INSTALL_DATA=$(INSTALL_DATA)" \
"INSTALL_PROGRAM=$(INSTALL_PROGRAM)" \
"INSTALL_SCRIPT=$(INSTALL_SCRIPT)" \
- "JC1FLAGS=$(JC1FLAGS)" \
+ "GCJFLAGS=$(GCJFLAGS)" \
"LDFLAGS=$(LDFLAGS)" \
"LIBCFLAGS=$(LIBCFLAGS)" \
"LIBCFLAGS_FOR_TARGET=$(LIBCFLAGS_FOR_TARGET)" \
@@ -2385,8 +2498,6 @@ AM_MAKEFLAGS = \
"prefix=$(prefix)" \
"AR=$(AR)" \
"AS=$(AS)" \
- "CC=$(CC)" \
- "CXX=$(CXX)" \
"LD=$(LD)" \
"LIBCFLAGS=$(LIBCFLAGS)" \
"NM=$(NM)" \
@@ -2394,6 +2505,9 @@ AM_MAKEFLAGS = \
"RANLIB=$(RANLIB)" \
"DESTDIR=$(DESTDIR)"
+# Subdir rules rely on $(FLAGS_TO_PASS)
+FLAGS_TO_PASS = $(AM_MAKEFLAGS)
+
CONFIG_STATUS_DEPENDENCIES = $(srcdir)/configure.host
MAKEOVERRIDES=
@@ -2418,7 +2532,7 @@ distclean-recursive: distclean-multi
maintainer-clean-recursive: maintainer-clean-multi
all-multi:
- $(MULTIDO) $(AM_MAKEFLAGS) DO=all multi-do
+ : $(MAKE) ; exec $(MULTIDO) $(AM_MAKEFLAGS) DO=all multi-do
install-multi:
$(MULTIDO) $(AM_MAKEFLAGS) DO=install multi-do
mostlyclean-multi:
diff --git a/libjava/Makefile.in b/libjava/Makefile.in
index d165075518e..239bd09db32 100644
--- a/libjava/Makefile.in
+++ b/libjava/Makefile.in
@@ -148,11 +148,11 @@ secdir = $(libdir)/security
@NATIVE_TRUE@bin_PROGRAMS = @NATIVE_TRUE@jv-convert gij rmic rmiregistry
bin_SCRIPTS = addr2name.awk
-@CANADIAN_TRUE@@NULL_TARGET_TRUE@ZIP = @CANADIAN_TRUE@@NULL_TARGET_TRUE@$(MULTIBUILDTOP)../$(COMPPATH)/fastjar/jar$(EXEEXT)
+@CANADIAN_TRUE@@NULL_TARGET_TRUE@ZIP = @CANADIAN_TRUE@@NULL_TARGET_TRUE@$(MULTIBUILDTOP)../$(COMPPATH)/fastjar/jar
@CANADIAN_TRUE@@NULL_TARGET_FALSE@ZIP = @CANADIAN_TRUE@@NULL_TARGET_FALSE@jar
-@CANADIAN_FALSE@ZIP = @CANADIAN_FALSE@$(MULTIBUILDTOP)../$(COMPPATH)/fastjar/jar$(EXEEXT)
+@CANADIAN_FALSE@ZIP = @CANADIAN_FALSE@$(MULTIBUILDTOP)../$(COMPPATH)/fastjar/jar
@CANADIAN_TRUE@GCJH = @CANADIAN_TRUE@gcjh
-@CANADIAN_FALSE@GCJH = @CANADIAN_FALSE@$(MULTIBUILDTOP)../$(COMPPATH)/gcc/gcjh$(EXEEXT)
+@CANADIAN_FALSE@GCJH = @CANADIAN_FALSE@$(MULTIBUILDTOP)../$(COMPPATH)/gcc/gcjh
GCJ_WITH_FLAGS = $(GCJ) --encoding=UTF-8
@@ -195,7 +195,7 @@ javao_files = $(java_source_files:.java=.lo) \
x_javao_files = $(x_java_source_files:.java=.lo)
libgcj_la_SOURCES = prims.cc jni.cc exception.cc \
- resolve.cc defineclass.cc interpret.cc name-finder.cc verify.cc \
+ resolve.cc defineclass.cc interpret.cc verify.cc \
$(nat_source_files)
EXTRA_libgcj_la_SOURCES = boehm.cc nogc.cc posix-threads.cc no-threads.cc \
@@ -246,7 +246,9 @@ ordinary_nat_headers = $(ordinary_java_source_files:.java=.h) \
inner_nat_headers = java/io/ObjectOutputStream$$PutField.h \
- java/io/ObjectInputStream$$GetField.h
+ java/io/ObjectInputStream$$GetField.h \
+ java/lang/reflect/Proxy$$ProxyData.h \
+ java/lang/reflect/Proxy$$ProxyType.h
nat_headers = $(ordinary_nat_headers) $(inner_nat_headers)
@@ -433,6 +435,8 @@ java/awt/Window.java \
java/awt/color/ColorSpace.java \
java/awt/color/ICC_ColorSpace.java \
java/awt/color/ICC_Profile.java \
+java/awt/color/ICC_ProfileGray.java \
+java/awt/color/ICC_ProfileRGB.java \
java/awt/color/CMMException.java \
java/awt/color/ProfileDataException.java \
java/awt/datatransfer/Clipboard.java \
@@ -607,10 +611,12 @@ java/awt/Robot.java \
java/awt/ScrollPaneAdjustable.java \
java/awt/Stroke.java \
java/awt/TexturePaint.java \
+java/awt/dnd/peer/DragSourceContextPeer.java \
+java/awt/dnd/peer/DropTargetContextPeer.java \
java/awt/dnd/DnDConstants.java \
java/awt/dnd/DragGestureEvent.java \
java/awt/dnd/DragGestureListener.java \
-java/awt/dnd/DragGestureRecognizer.java \
+java/awt/dnd/DragGestureRecognizer.java \
java/awt/dnd/DragSource.java \
java/awt/dnd/DragSourceAdapter.java \
java/awt/dnd/DragSourceContext.java \
@@ -620,7 +626,15 @@ java/awt/dnd/DragSourceListener.java \
java/awt/dnd/DragSourceMotionListener.java \
java/awt/dnd/DropTarget.java \
java/awt/dnd/InvalidDnDOperationException.java \
-java/awt/dnd/peer/DragSourceContextPeer.java \
+java/awt/dnd/Autoscroll.java \
+java/awt/dnd/DragSourceDropEvent.java \
+java/awt/dnd/DropTargetAdapter.java \
+java/awt/dnd/DropTargetContext.java \
+java/awt/dnd/DropTargetDragEvent.java \
+java/awt/dnd/DropTargetDropEvent.java \
+java/awt/dnd/DropTargetEvent.java \
+java/awt/dnd/DropTargetListener.java \
+java/awt/dnd/MouseDragGestureRecognizer.java \
java/awt/font/TextHitInfo.java \
java/awt/im/spi/InputMethod.java \
java/awt/im/spi/InputMethodContext.java \
@@ -1040,6 +1054,8 @@ java/rmi/server/SocketSecurityException.java \
java/rmi/server/UID.java \
java/rmi/server/UnicastRemoteObject.java \
java/rmi/server/Unreferenced.java \
+gnu/java/rmi/RMIMarshalledObjectInputStream.java \
+gnu/java/rmi/RMIMarshalledObjectOutputStream.java \
gnu/java/rmi/dgc/DGCImpl.java \
gnu/java/rmi/dgc/DGCImpl_Skel.java \
gnu/java/rmi/dgc/DGCImpl_Stub.java \
@@ -1051,6 +1067,7 @@ gnu/java/rmi/rmic/Compiler.java \
gnu/java/rmi/rmic/CompilerProcess.java \
gnu/java/rmi/rmic/RMIC.java \
gnu/java/rmi/rmic/TabbedWriter.java \
+gnu/java/rmi/server/ConnectionRunnerPool.java \
gnu/java/rmi/server/ProtocolConstants.java \
gnu/java/rmi/server/RMIDefaultSocketFactory.java \
gnu/java/rmi/server/RMIHashes.java \
@@ -1294,6 +1311,7 @@ java/lang/VerifyError.java \
java/lang/VirtualMachineError.java \
java/lang/VMClassLoader.java \
java/lang/VMSecurityManager.java \
+java/lang/VMThrowable.java \
java/lang/Void.java \
java/io/BufferedInputStream.java \
java/io/BufferedOutputStream.java \
@@ -1427,7 +1445,10 @@ java/util/TreeMap.java \
java/util/TreeSet.java \
java/util/TooManyListenersException.java \
java/util/Vector.java \
-java/util/WeakHashMap.java
+java/util/WeakHashMap.java \
+java/util/regex/Matcher.java \
+java/util/regex/Pattern.java \
+java/util/regex/PatternSyntaxException.java
ordinary_java_source_files = $(core_java_source_files) \
@@ -1449,6 +1470,7 @@ gnu/gcj/runtime/FileDeleter.java \
gnu/gcj/runtime/FinalizerThread.java \
gnu/gcj/runtime/FirstThread.java \
gnu/gcj/runtime/JNIWeakRef.java \
+gnu/gcj/runtime/NameFinder.java \
gnu/gcj/runtime/SharedLibLoader.java \
gnu/gcj/runtime/StringBuffer.java \
gnu/gcj/runtime/VMClassLoader.java \
@@ -1599,6 +1621,15 @@ gnu/java/locale/LocaleInformation_zh_HK.java \
gnu/java/locale/LocaleInformation_zh_SG.java \
gnu/java/locale/LocaleInformation_zh_TW.java \
gnu/java/math/MPN.java \
+gnu/java/nio/charset/ISO_8859_1.java \
+gnu/java/nio/charset/Provider.java \
+gnu/java/nio/charset/US_ASCII.java \
+gnu/java/nio/charset/UTF_16.java \
+gnu/java/nio/charset/UTF_16BE.java \
+gnu/java/nio/charset/UTF_16Decoder.java \
+gnu/java/nio/charset/UTF_16Encoder.java \
+gnu/java/nio/charset/UTF_16LE.java \
+gnu/java/nio/charset/UTF_8.java \
gnu/java/security/der/DEREncodingException.java \
gnu/java/security/provider/DERReader.java \
gnu/java/security/provider/DERWriter.java \
@@ -1630,11 +1661,14 @@ java/lang/reflect/AccessibleObject.java \
java/lang/reflect/Array.java \
java/lang/reflect/Constructor.java \
java/lang/reflect/Field.java \
+java/lang/reflect/InvocationHandler.java \
java/lang/reflect/InvocationTargetException.java \
java/lang/reflect/Member.java \
java/lang/reflect/Method.java \
java/lang/reflect/Modifier.java \
+java/lang/reflect/Proxy.java \
java/lang/reflect/ReflectPermission.java \
+java/lang/reflect/UndeclaredThrowableException.java \
java/math/BigDecimal.java \
java/math/BigInteger.java \
java/net/Authenticator.java \
@@ -1645,14 +1679,18 @@ java/net/ContentHandlerFactory.java \
java/net/DatagramPacket.java \
java/net/DatagramSocket.java \
java/net/DatagramSocketImpl.java \
+java/net/DatagramSocketImplFactory.java \
java/net/FileNameMap.java \
java/net/HttpURLConnection.java \
java/net/InetAddress.java \
+java/net/Inet4Address.java \
+java/net/Inet6Address.java \
java/net/InetSocketAddress.java \
java/net/JarURLConnection.java \
java/net/MalformedURLException.java \
java/net/MulticastSocket.java \
java/net/NetPermission.java \
+java/net/NetworkInterface.java \
java/net/NoRouteToHostException.java \
java/net/PasswordAuthentication.java \
java/net/PlainDatagramSocketImpl.java \
@@ -1668,6 +1706,7 @@ java/net/SocketImplFactory.java \
java/net/SocketOptions.java \
java/net/SocketPermission.java \
java/net/SocketTimeoutException.java \
+java/net/URI.java \
java/net/URISyntaxException.java \
java/net/URL.java \
java/net/URLClassLoader.java \
@@ -1678,6 +1717,65 @@ java/net/URLStreamHandler.java \
java/net/URLStreamHandlerFactory.java \
java/net/UnknownHostException.java \
java/net/UnknownServiceException.java \
+java/nio/Buffer.java \
+java/nio/BufferOverflowException.java \
+java/nio/BufferUnderflowException.java \
+java/nio/ByteBuffer.java \
+java/nio/ByteOrder.java \
+java/nio/CharBuffer.java \
+java/nio/InvalidMarkException.java \
+java/nio/MappedByteBuffer.java \
+java/nio/ReadOnlyBufferException.java \
+java/nio/channels/AlreadyConnectedException.java \
+java/nio/channels/AsynchronousCloseException.java \
+java/nio/channels/ByteChannel.java \
+java/nio/channels/CancelledKeyException.java \
+java/nio/channels/Channel.java \
+java/nio/channels/ClosedByInterruptException.java \
+java/nio/channels/ClosedChannelException.java \
+java/nio/channels/ClosedSelectorException.java \
+java/nio/channels/ConnectionPendingException.java \
+java/nio/channels/DatagramChannel.java \
+java/nio/channels/FileChannel.java \
+java/nio/channels/FileLockInterruptionException.java \
+java/nio/channels/GatheringByteChannel.java \
+java/nio/channels/IllegalBlockingModeException.java \
+java/nio/channels/IllegalSelectorException.java \
+java/nio/channels/InterruptibleChannel.java \
+java/nio/channels/NoConnectionPendingException.java \
+java/nio/channels/NonReadableChannelException.java \
+java/nio/channels/NonWritableChannelException.java \
+java/nio/channels/NotYetBoundException.java \
+java/nio/channels/NotYetConnectedException.java \
+java/nio/channels/OverlappingFileLockException.java \
+java/nio/channels/Pipe.java \
+java/nio/channels/ReadableByteChannel.java \
+java/nio/channels/ScatteringByteChannel.java \
+java/nio/channels/SelectableChannel.java \
+java/nio/channels/SelectionKey.java \
+java/nio/channels/Selector.java \
+java/nio/channels/ServerSocketChannel.java \
+java/nio/channels/SocketChannel.java \
+java/nio/channels/UnresolvedAddressException.java \
+java/nio/channels/UnsupportedAddressTypeException.java \
+java/nio/channels/WritableByteChannel.java \
+java/nio/channels/spi/AbstractSelectableChannel.java \
+java/nio/channels/spi/AbstractInterruptibleChannel.java \
+java/nio/channels/spi/AbstractSelectionKey.java \
+java/nio/channels/spi/AbstractSelector.java \
+java/nio/channels/spi/SelectorProvider.java \
+java/nio/charset/Charset.java \
+java/nio/charset/CharacterCodingException.java \
+java/nio/charset/CharsetDecoder.java \
+java/nio/charset/CharsetEncoder.java \
+java/nio/charset/CoderMalfunctionError.java \
+java/nio/charset/CoderResult.java \
+java/nio/charset/CodingErrorAction.java \
+java/nio/charset/IllegalCharsetNameException.java \
+java/nio/charset/MalformedInputException.java \
+java/nio/charset/UnmappableCharacterException.java \
+java/nio/charset/UnsupportedCharsetException.java \
+java/nio/charset/spi/CharsetProvider.java \
java/security/AccessControlContext.java \
java/security/AccessControlException.java \
java/security/AccessController.java \
@@ -1965,6 +2063,7 @@ gnu/gcj/io/shs.cc \
gnu/gcj/protocol/core/natCoreInputStream.cc \
gnu/gcj/runtime/natFinalizerThread.cc \
gnu/gcj/runtime/natFirstThread.cc \
+gnu/gcj/runtime/natNameFinder.cc \
gnu/gcj/runtime/natSharedLibLoader.cc \
gnu/gcj/runtime/natStringBuffer.cc \
java/io/natFile.cc \
@@ -1984,12 +2083,14 @@ java/lang/natString.cc \
java/lang/natStringBuffer.cc \
java/lang/natSystem.cc \
java/lang/natThread.cc \
-java/lang/natThrowable.cc \
+java/lang/natVMThrowable.cc \
java/lang/ref/natReference.cc \
java/lang/reflect/natArray.cc \
java/lang/reflect/natConstructor.cc \
java/lang/reflect/natField.cc \
java/lang/reflect/natMethod.cc \
+java/lang/reflect/natProxy.cc \
+java/net/natNetworkInterface.cc \
java/net/natInetAddress.cc \
java/net/natPlainDatagramSocketImpl.cc \
java/net/natPlainSocketImpl.cc \
@@ -2071,7 +2172,7 @@ AM_MAKEFLAGS = \
"INSTALL_DATA=$(INSTALL_DATA)" \
"INSTALL_PROGRAM=$(INSTALL_PROGRAM)" \
"INSTALL_SCRIPT=$(INSTALL_SCRIPT)" \
- "JC1FLAGS=$(JC1FLAGS)" \
+ "GCJFLAGS=$(GCJFLAGS)" \
"LDFLAGS=$(LDFLAGS)" \
"LIBCFLAGS=$(LIBCFLAGS)" \
"LIBCFLAGS_FOR_TARGET=$(LIBCFLAGS_FOR_TARGET)" \
@@ -2087,8 +2188,6 @@ AM_MAKEFLAGS = \
"prefix=$(prefix)" \
"AR=$(AR)" \
"AS=$(AS)" \
- "CC=$(CC)" \
- "CXX=$(CXX)" \
"LD=$(LD)" \
"LIBCFLAGS=$(LIBCFLAGS)" \
"NM=$(NM)" \
@@ -2097,6 +2196,9 @@ AM_MAKEFLAGS = \
"DESTDIR=$(DESTDIR)"
+# Subdir rules rely on $(FLAGS_TO_PASS)
+FLAGS_TO_PASS = $(AM_MAKEFLAGS)
+
CONFIG_STATUS_DEPENDENCIES = $(srcdir)/configure.host
MAKEOVERRIDES =
@@ -2123,7 +2225,7 @@ X_LIBS = @X_LIBS@
X_EXTRA_LIBS = @X_EXTRA_LIBS@
X_PRE_LIBS = @X_PRE_LIBS@
libgcj_la_OBJECTS = prims.lo jni.lo exception.lo resolve.lo \
-defineclass.lo interpret.lo name-finder.lo verify.lo gnu/gcj/natCore.lo \
+defineclass.lo interpret.lo verify.lo gnu/gcj/natCore.lo \
gnu/gcj/convert/JIS0208_to_Unicode.lo \
gnu/gcj/convert/JIS0212_to_Unicode.lo gnu/gcj/convert/Unicode_to_JIS.lo \
gnu/gcj/convert/natIconv.lo gnu/gcj/convert/natInput_EUCJIS.lo \
@@ -2131,7 +2233,7 @@ gnu/gcj/convert/natInput_SJIS.lo gnu/gcj/convert/natOutput_EUCJIS.lo \
gnu/gcj/convert/natOutput_SJIS.lo gnu/gcj/io/natSimpleSHSStream.lo \
gnu/gcj/io/shs.lo gnu/gcj/protocol/core/natCoreInputStream.lo \
gnu/gcj/runtime/natFinalizerThread.lo gnu/gcj/runtime/natFirstThread.lo \
-gnu/gcj/runtime/natSharedLibLoader.lo \
+gnu/gcj/runtime/natNameFinder.lo gnu/gcj/runtime/natSharedLibLoader.lo \
gnu/gcj/runtime/natStringBuffer.lo java/io/natFile.lo \
java/io/natFileDescriptor.lo java/io/natObjectInputStream.lo \
java/io/natObjectOutputStream.lo java/lang/natCharacter.lo \
@@ -2140,10 +2242,11 @@ java/lang/natConcreteProcess.lo java/lang/natDouble.lo \
java/lang/natFloat.lo java/lang/natMath.lo java/lang/natObject.lo \
java/lang/natRuntime.lo java/lang/natString.lo \
java/lang/natStringBuffer.lo java/lang/natSystem.lo \
-java/lang/natThread.lo java/lang/natThrowable.lo \
+java/lang/natThread.lo java/lang/natVMThrowable.lo \
java/lang/ref/natReference.lo java/lang/reflect/natArray.lo \
java/lang/reflect/natConstructor.lo java/lang/reflect/natField.lo \
-java/lang/reflect/natMethod.lo java/net/natInetAddress.lo \
+java/lang/reflect/natMethod.lo java/lang/reflect/natProxy.lo \
+java/net/natNetworkInterface.lo java/net/natInetAddress.lo \
java/net/natPlainDatagramSocketImpl.lo java/net/natPlainSocketImpl.lo \
java/text/natCollator.lo java/util/natTimeZone.lo \
java/util/zip/natDeflater.lo java/util/zip/natInflater.lo
@@ -2246,11 +2349,13 @@ DEP_FILES = .deps/$(srcdir)/$(CONVERT_DIR)/gen-from-JIS.P \
.deps/gnu/gcj/runtime/FileDeleter.P \
.deps/gnu/gcj/runtime/FinalizerThread.P \
.deps/gnu/gcj/runtime/FirstThread.P .deps/gnu/gcj/runtime/JNIWeakRef.P \
+.deps/gnu/gcj/runtime/NameFinder.P \
.deps/gnu/gcj/runtime/SharedLibLoader.P \
.deps/gnu/gcj/runtime/StringBuffer.P \
.deps/gnu/gcj/runtime/VMClassLoader.P \
.deps/gnu/gcj/runtime/natFinalizerThread.P \
.deps/gnu/gcj/runtime/natFirstThread.P \
+.deps/gnu/gcj/runtime/natNameFinder.P \
.deps/gnu/gcj/runtime/natSharedLibLoader.P \
.deps/gnu/gcj/runtime/natStringBuffer.P .deps/gnu/gcj/xlib/Clip.P \
.deps/gnu/gcj/xlib/Colormap.P .deps/gnu/gcj/xlib/Display.P \
@@ -2439,8 +2544,18 @@ DEP_FILES = .deps/$(srcdir)/$(CONVERT_DIR)/gen-from-JIS.P \
.deps/gnu/java/locale/LocaleInformation_zh_HK.P \
.deps/gnu/java/locale/LocaleInformation_zh_SG.P \
.deps/gnu/java/locale/LocaleInformation_zh_TW.P \
-.deps/gnu/java/math/MPN.P .deps/gnu/java/rmi/dgc/DGCImpl.P \
-.deps/gnu/java/rmi/dgc/DGCImpl_Skel.P \
+.deps/gnu/java/math/MPN.P .deps/gnu/java/nio/charset/ISO_8859_1.P \
+.deps/gnu/java/nio/charset/Provider.P \
+.deps/gnu/java/nio/charset/US_ASCII.P \
+.deps/gnu/java/nio/charset/UTF_16.P \
+.deps/gnu/java/nio/charset/UTF_16BE.P \
+.deps/gnu/java/nio/charset/UTF_16Decoder.P \
+.deps/gnu/java/nio/charset/UTF_16Encoder.P \
+.deps/gnu/java/nio/charset/UTF_16LE.P \
+.deps/gnu/java/nio/charset/UTF_8.P \
+.deps/gnu/java/rmi/RMIMarshalledObjectInputStream.P \
+.deps/gnu/java/rmi/RMIMarshalledObjectOutputStream.P \
+.deps/gnu/java/rmi/dgc/DGCImpl.P .deps/gnu/java/rmi/dgc/DGCImpl_Skel.P \
.deps/gnu/java/rmi/dgc/DGCImpl_Stub.P \
.deps/gnu/java/rmi/registry/RegistryImpl.P \
.deps/gnu/java/rmi/registry/RegistryImpl_Skel.P \
@@ -2449,6 +2564,7 @@ DEP_FILES = .deps/$(srcdir)/$(CONVERT_DIR)/gen-from-JIS.P \
.deps/gnu/java/rmi/rmic/Compiler.P \
.deps/gnu/java/rmi/rmic/CompilerProcess.P \
.deps/gnu/java/rmi/rmic/RMIC.P .deps/gnu/java/rmi/rmic/TabbedWriter.P \
+.deps/gnu/java/rmi/server/ConnectionRunnerPool.P \
.deps/gnu/java/rmi/server/ProtocolConstants.P \
.deps/gnu/java/rmi/server/RMIDefaultSocketFactory.P \
.deps/gnu/java/rmi/server/RMIHashes.P \
@@ -2540,6 +2656,8 @@ DEP_FILES = .deps/$(srcdir)/$(CONVERT_DIR)/gen-from-JIS.P \
.deps/java/awt/Window.P .deps/java/awt/color/CMMException.P \
.deps/java/awt/color/ColorSpace.P .deps/java/awt/color/ICC_ColorSpace.P \
.deps/java/awt/color/ICC_Profile.P \
+.deps/java/awt/color/ICC_ProfileGray.P \
+.deps/java/awt/color/ICC_ProfileRGB.P \
.deps/java/awt/color/ProfileDataException.P \
.deps/java/awt/datatransfer/Clipboard.P \
.deps/java/awt/datatransfer/ClipboardOwner.P \
@@ -2551,18 +2669,27 @@ DEP_FILES = .deps/$(srcdir)/$(CONVERT_DIR)/gen-from-JIS.P \
.deps/java/awt/datatransfer/SystemFlavorMap.P \
.deps/java/awt/datatransfer/Transferable.P \
.deps/java/awt/datatransfer/UnsupportedFlavorException.P \
-.deps/java/awt/dnd/DnDConstants.P .deps/java/awt/dnd/DragGestureEvent.P \
+.deps/java/awt/dnd/Autoscroll.P .deps/java/awt/dnd/DnDConstants.P \
+.deps/java/awt/dnd/DragGestureEvent.P \
.deps/java/awt/dnd/DragGestureListener.P \
.deps/java/awt/dnd/DragGestureRecognizer.P \
.deps/java/awt/dnd/DragSource.P .deps/java/awt/dnd/DragSourceAdapter.P \
.deps/java/awt/dnd/DragSourceContext.P \
.deps/java/awt/dnd/DragSourceDragEvent.P \
+.deps/java/awt/dnd/DragSourceDropEvent.P \
.deps/java/awt/dnd/DragSourceEvent.P \
.deps/java/awt/dnd/DragSourceListener.P \
.deps/java/awt/dnd/DragSourceMotionListener.P \
-.deps/java/awt/dnd/DropTarget.P \
+.deps/java/awt/dnd/DropTarget.P .deps/java/awt/dnd/DropTargetAdapter.P \
+.deps/java/awt/dnd/DropTargetContext.P \
+.deps/java/awt/dnd/DropTargetDragEvent.P \
+.deps/java/awt/dnd/DropTargetDropEvent.P \
+.deps/java/awt/dnd/DropTargetEvent.P \
+.deps/java/awt/dnd/DropTargetListener.P \
.deps/java/awt/dnd/InvalidDnDOperationException.P \
+.deps/java/awt/dnd/MouseDragGestureRecognizer.P \
.deps/java/awt/dnd/peer/DragSourceContextPeer.P \
+.deps/java/awt/dnd/peer/DropTargetContextPeer.P \
.deps/java/awt/event/AWTEventListener.P \
.deps/java/awt/event/AWTEventListenerProxy.P \
.deps/java/awt/event/ActionEvent.P \
@@ -2813,8 +2940,9 @@ DEP_FILES = .deps/$(srcdir)/$(CONVERT_DIR)/gen-from-JIS.P \
.deps/java/lang/UnsupportedClassVersionError.P \
.deps/java/lang/UnsupportedOperationException.P \
.deps/java/lang/VMClassLoader.P .deps/java/lang/VMSecurityManager.P \
-.deps/java/lang/VerifyError.P .deps/java/lang/VirtualMachineError.P \
-.deps/java/lang/Void.P .deps/java/lang/dtoa.P .deps/java/lang/e_acos.P \
+.deps/java/lang/VMThrowable.P .deps/java/lang/VerifyError.P \
+.deps/java/lang/VirtualMachineError.P .deps/java/lang/Void.P \
+.deps/java/lang/dtoa.P .deps/java/lang/e_acos.P \
.deps/java/lang/e_asin.P .deps/java/lang/e_atan2.P \
.deps/java/lang/e_exp.P .deps/java/lang/e_fmod.P \
.deps/java/lang/e_log.P .deps/java/lang/e_pow.P \
@@ -2828,7 +2956,7 @@ DEP_FILES = .deps/$(srcdir)/$(CONVERT_DIR)/gen-from-JIS.P \
.deps/java/lang/natMath.P .deps/java/lang/natObject.P \
.deps/java/lang/natRuntime.P .deps/java/lang/natString.P \
.deps/java/lang/natStringBuffer.P .deps/java/lang/natSystem.P \
-.deps/java/lang/natThread.P .deps/java/lang/natThrowable.P \
+.deps/java/lang/natThread.P .deps/java/lang/natVMThrowable.P \
.deps/java/lang/ref/PhantomReference.P .deps/java/lang/ref/Reference.P \
.deps/java/lang/ref/ReferenceQueue.P \
.deps/java/lang/ref/SoftReference.P .deps/java/lang/ref/WeakReference.P \
@@ -2836,34 +2964,39 @@ DEP_FILES = .deps/$(srcdir)/$(CONVERT_DIR)/gen-from-JIS.P \
.deps/java/lang/reflect/AccessibleObject.P \
.deps/java/lang/reflect/Array.P .deps/java/lang/reflect/Constructor.P \
.deps/java/lang/reflect/Field.P \
+.deps/java/lang/reflect/InvocationHandler.P \
.deps/java/lang/reflect/InvocationTargetException.P \
.deps/java/lang/reflect/Member.P .deps/java/lang/reflect/Method.P \
-.deps/java/lang/reflect/Modifier.P \
+.deps/java/lang/reflect/Modifier.P .deps/java/lang/reflect/Proxy.P \
.deps/java/lang/reflect/ReflectPermission.P \
+.deps/java/lang/reflect/UndeclaredThrowableException.P \
.deps/java/lang/reflect/natArray.P \
.deps/java/lang/reflect/natConstructor.P \
.deps/java/lang/reflect/natField.P .deps/java/lang/reflect/natMethod.P \
-.deps/java/lang/s_atan.P .deps/java/lang/s_ceil.P \
-.deps/java/lang/s_copysign.P .deps/java/lang/s_cos.P \
-.deps/java/lang/s_fabs.P .deps/java/lang/s_floor.P \
-.deps/java/lang/s_rint.P .deps/java/lang/s_scalbn.P \
-.deps/java/lang/s_sin.P .deps/java/lang/s_tan.P \
-.deps/java/lang/sf_fabs.P .deps/java/lang/sf_rint.P \
-.deps/java/lang/strtod.P .deps/java/lang/w_acos.P \
-.deps/java/lang/w_asin.P .deps/java/lang/w_atan2.P \
-.deps/java/lang/w_exp.P .deps/java/lang/w_fmod.P \
-.deps/java/lang/w_log.P .deps/java/lang/w_pow.P \
-.deps/java/lang/w_remainder.P .deps/java/lang/w_sqrt.P \
-.deps/java/math/BigDecimal.P .deps/java/math/BigInteger.P \
-.deps/java/net/Authenticator.P .deps/java/net/BindException.P \
-.deps/java/net/ConnectException.P .deps/java/net/ContentHandler.P \
-.deps/java/net/ContentHandlerFactory.P .deps/java/net/DatagramPacket.P \
-.deps/java/net/DatagramSocket.P .deps/java/net/DatagramSocketImpl.P \
-.deps/java/net/FileNameMap.P .deps/java/net/HttpURLConnection.P \
-.deps/java/net/InetAddress.P .deps/java/net/InetSocketAddress.P \
-.deps/java/net/JarURLConnection.P \
+.deps/java/lang/reflect/natProxy.P .deps/java/lang/s_atan.P \
+.deps/java/lang/s_ceil.P .deps/java/lang/s_copysign.P \
+.deps/java/lang/s_cos.P .deps/java/lang/s_fabs.P \
+.deps/java/lang/s_floor.P .deps/java/lang/s_rint.P \
+.deps/java/lang/s_scalbn.P .deps/java/lang/s_sin.P \
+.deps/java/lang/s_tan.P .deps/java/lang/sf_fabs.P \
+.deps/java/lang/sf_rint.P .deps/java/lang/strtod.P \
+.deps/java/lang/w_acos.P .deps/java/lang/w_asin.P \
+.deps/java/lang/w_atan2.P .deps/java/lang/w_exp.P \
+.deps/java/lang/w_fmod.P .deps/java/lang/w_log.P \
+.deps/java/lang/w_pow.P .deps/java/lang/w_remainder.P \
+.deps/java/lang/w_sqrt.P .deps/java/math/BigDecimal.P \
+.deps/java/math/BigInteger.P .deps/java/net/Authenticator.P \
+.deps/java/net/BindException.P .deps/java/net/ConnectException.P \
+.deps/java/net/ContentHandler.P .deps/java/net/ContentHandlerFactory.P \
+.deps/java/net/DatagramPacket.P .deps/java/net/DatagramSocket.P \
+.deps/java/net/DatagramSocketImpl.P \
+.deps/java/net/DatagramSocketImplFactory.P .deps/java/net/FileNameMap.P \
+.deps/java/net/HttpURLConnection.P .deps/java/net/Inet4Address.P \
+.deps/java/net/Inet6Address.P .deps/java/net/InetAddress.P \
+.deps/java/net/InetSocketAddress.P .deps/java/net/JarURLConnection.P \
.deps/java/net/MalformedURLException.P .deps/java/net/MulticastSocket.P \
-.deps/java/net/NetPermission.P .deps/java/net/NoRouteToHostException.P \
+.deps/java/net/NetPermission.P .deps/java/net/NetworkInterface.P \
+.deps/java/net/NoRouteToHostException.P \
.deps/java/net/PasswordAuthentication.P \
.deps/java/net/PlainDatagramSocketImpl.P \
.deps/java/net/PlainSocketImpl.P \
@@ -2873,7 +3006,7 @@ DEP_FILES = .deps/$(srcdir)/$(CONVERT_DIR)/gen-from-JIS.P \
.deps/java/net/SocketException.P .deps/java/net/SocketImpl.P \
.deps/java/net/SocketImplFactory.P .deps/java/net/SocketOptions.P \
.deps/java/net/SocketPermission.P \
-.deps/java/net/SocketTimeoutException.P \
+.deps/java/net/SocketTimeoutException.P .deps/java/net/URI.P \
.deps/java/net/URISyntaxException.P .deps/java/net/URL.P \
.deps/java/net/URLClassLoader.P .deps/java/net/URLConnection.P \
.deps/java/net/URLDecoder.P .deps/java/net/URLEncoder.P \
@@ -2881,10 +3014,65 @@ DEP_FILES = .deps/$(srcdir)/$(CONVERT_DIR)/gen-from-JIS.P \
.deps/java/net/URLStreamHandlerFactory.P \
.deps/java/net/UnknownHostException.P \
.deps/java/net/UnknownServiceException.P \
-.deps/java/net/natInetAddress.P \
+.deps/java/net/natInetAddress.P .deps/java/net/natNetworkInterface.P \
.deps/java/net/natPlainDatagramSocketImpl.P \
-.deps/java/net/natPlainSocketImpl.P .deps/java/rmi/AccessException.P \
-.deps/java/rmi/AlreadyBoundException.P \
+.deps/java/net/natPlainSocketImpl.P .deps/java/nio/Buffer.P \
+.deps/java/nio/BufferOverflowException.P \
+.deps/java/nio/BufferUnderflowException.P .deps/java/nio/ByteBuffer.P \
+.deps/java/nio/ByteOrder.P .deps/java/nio/CharBuffer.P \
+.deps/java/nio/InvalidMarkException.P .deps/java/nio/MappedByteBuffer.P \
+.deps/java/nio/ReadOnlyBufferException.P \
+.deps/java/nio/channels/AlreadyConnectedException.P \
+.deps/java/nio/channels/AsynchronousCloseException.P \
+.deps/java/nio/channels/ByteChannel.P \
+.deps/java/nio/channels/CancelledKeyException.P \
+.deps/java/nio/channels/Channel.P \
+.deps/java/nio/channels/ClosedByInterruptException.P \
+.deps/java/nio/channels/ClosedChannelException.P \
+.deps/java/nio/channels/ClosedSelectorException.P \
+.deps/java/nio/channels/ConnectionPendingException.P \
+.deps/java/nio/channels/DatagramChannel.P \
+.deps/java/nio/channels/FileChannel.P \
+.deps/java/nio/channels/FileLockInterruptionException.P \
+.deps/java/nio/channels/GatheringByteChannel.P \
+.deps/java/nio/channels/IllegalBlockingModeException.P \
+.deps/java/nio/channels/IllegalSelectorException.P \
+.deps/java/nio/channels/InterruptibleChannel.P \
+.deps/java/nio/channels/NoConnectionPendingException.P \
+.deps/java/nio/channels/NonReadableChannelException.P \
+.deps/java/nio/channels/NonWritableChannelException.P \
+.deps/java/nio/channels/NotYetBoundException.P \
+.deps/java/nio/channels/NotYetConnectedException.P \
+.deps/java/nio/channels/OverlappingFileLockException.P \
+.deps/java/nio/channels/Pipe.P \
+.deps/java/nio/channels/ReadableByteChannel.P \
+.deps/java/nio/channels/ScatteringByteChannel.P \
+.deps/java/nio/channels/SelectableChannel.P \
+.deps/java/nio/channels/SelectionKey.P \
+.deps/java/nio/channels/Selector.P \
+.deps/java/nio/channels/ServerSocketChannel.P \
+.deps/java/nio/channels/SocketChannel.P \
+.deps/java/nio/channels/UnresolvedAddressException.P \
+.deps/java/nio/channels/UnsupportedAddressTypeException.P \
+.deps/java/nio/channels/WritableByteChannel.P \
+.deps/java/nio/channels/spi/AbstractInterruptibleChannel.P \
+.deps/java/nio/channels/spi/AbstractSelectableChannel.P \
+.deps/java/nio/channels/spi/AbstractSelectionKey.P \
+.deps/java/nio/channels/spi/AbstractSelector.P \
+.deps/java/nio/channels/spi/SelectorProvider.P \
+.deps/java/nio/charset/CharacterCodingException.P \
+.deps/java/nio/charset/Charset.P \
+.deps/java/nio/charset/CharsetDecoder.P \
+.deps/java/nio/charset/CharsetEncoder.P \
+.deps/java/nio/charset/CoderMalfunctionError.P \
+.deps/java/nio/charset/CoderResult.P \
+.deps/java/nio/charset/CodingErrorAction.P \
+.deps/java/nio/charset/IllegalCharsetNameException.P \
+.deps/java/nio/charset/MalformedInputException.P \
+.deps/java/nio/charset/UnmappableCharacterException.P \
+.deps/java/nio/charset/UnsupportedCharsetException.P \
+.deps/java/nio/charset/spi/CharsetProvider.P \
+.deps/java/rmi/AccessException.P .deps/java/rmi/AlreadyBoundException.P \
.deps/java/rmi/ConnectException.P .deps/java/rmi/ConnectIOException.P \
.deps/java/rmi/MarshalException.P .deps/java/rmi/MarshalledObject.P \
.deps/java/rmi/Naming.P .deps/java/rmi/NoSuchObjectException.P \
@@ -3096,8 +3284,11 @@ DEP_FILES = .deps/$(srcdir)/$(CONVERT_DIR)/gen-from-JIS.P \
.deps/java/util/jar/JarException.P .deps/java/util/jar/JarFile.P \
.deps/java/util/jar/JarInputStream.P \
.deps/java/util/jar/JarOutputStream.P .deps/java/util/jar/Manifest.P \
-.deps/java/util/natTimeZone.P .deps/java/util/zip/Adler32.P \
-.deps/java/util/zip/CRC32.P .deps/java/util/zip/CheckedInputStream.P \
+.deps/java/util/natTimeZone.P .deps/java/util/regex/Matcher.P \
+.deps/java/util/regex/Pattern.P \
+.deps/java/util/regex/PatternSyntaxException.P \
+.deps/java/util/zip/Adler32.P .deps/java/util/zip/CRC32.P \
+.deps/java/util/zip/CheckedInputStream.P \
.deps/java/util/zip/CheckedOutputStream.P \
.deps/java/util/zip/Checksum.P \
.deps/java/util/zip/DataFormatException.P \
@@ -3468,17 +3659,17 @@ DEP_FILES = .deps/$(srcdir)/$(CONVERT_DIR)/gen-from-JIS.P \
.deps/javax/transaction/UserTransaction.P \
.deps/javax/transaction/xa/XAException.P \
.deps/javax/transaction/xa/XAResource.P \
-.deps/javax/transaction/xa/Xid.P .deps/jni.P .deps/name-finder.P \
-.deps/no-threads.P .deps/nogc.P .deps/org/w3c/dom/Attr.P \
-.deps/org/w3c/dom/CDATASection.P .deps/org/w3c/dom/CharacterData.P \
-.deps/org/w3c/dom/Comment.P .deps/org/w3c/dom/DOMException.P \
-.deps/org/w3c/dom/DOMImplementation.P .deps/org/w3c/dom/Document.P \
-.deps/org/w3c/dom/DocumentFragment.P .deps/org/w3c/dom/DocumentType.P \
-.deps/org/w3c/dom/Element.P .deps/org/w3c/dom/Entity.P \
-.deps/org/w3c/dom/EntityReference.P .deps/org/w3c/dom/NamedNodeMap.P \
-.deps/org/w3c/dom/Node.P .deps/org/w3c/dom/NodeList.P \
-.deps/org/w3c/dom/Notation.P .deps/org/w3c/dom/ProcessingInstruction.P \
-.deps/org/w3c/dom/Text.P .deps/org/w3c/dom/ranges/DocumentRange.P \
+.deps/javax/transaction/xa/Xid.P .deps/jni.P .deps/no-threads.P \
+.deps/nogc.P .deps/org/w3c/dom/Attr.P .deps/org/w3c/dom/CDATASection.P \
+.deps/org/w3c/dom/CharacterData.P .deps/org/w3c/dom/Comment.P \
+.deps/org/w3c/dom/DOMException.P .deps/org/w3c/dom/DOMImplementation.P \
+.deps/org/w3c/dom/Document.P .deps/org/w3c/dom/DocumentFragment.P \
+.deps/org/w3c/dom/DocumentType.P .deps/org/w3c/dom/Element.P \
+.deps/org/w3c/dom/Entity.P .deps/org/w3c/dom/EntityReference.P \
+.deps/org/w3c/dom/NamedNodeMap.P .deps/org/w3c/dom/Node.P \
+.deps/org/w3c/dom/NodeList.P .deps/org/w3c/dom/Notation.P \
+.deps/org/w3c/dom/ProcessingInstruction.P .deps/org/w3c/dom/Text.P \
+.deps/org/w3c/dom/ranges/DocumentRange.P \
.deps/org/w3c/dom/ranges/Range.P \
.deps/org/w3c/dom/ranges/RangeException.P \
.deps/org/w3c/dom/traversal/DocumentTraversal.P \
@@ -4135,6 +4326,18 @@ java/lang/reflect/Method.h: java/lang/reflect/Method.class
-friend 'jobject _Jv_JNI_ToReflectedMethod (_Jv_JNIEnv *, jclass, jmethodID, jboolean);' \
$(basename $<)
+java/lang/reflect/Proxy.h: java/lang/reflect/Proxy.class
+ $(GCJH) -classpath '' -bootclasspath $(top_builddir) \
+ $(basename $<)
+
+java/lang/reflect/Proxy$$ProxyData.h: java/lang/reflect/Proxy.class
+ $(GCJH) -classpath '' -bootclasspath $(top_builddir) \
+ 'java/lang/reflect/Proxy$$ProxyData'
+
+java/lang/reflect/Proxy$$ProxyType.h: java/lang/reflect/Proxy.class
+ $(GCJH) -classpath '' -bootclasspath $(top_builddir) \
+ 'java/lang/reflect/Proxy$$ProxyType'
+
gnu/gcj/runtime/VMClassLoader.h: gnu/gcj/runtime/VMClassLoader.class
$(GCJH) -classpath '' -bootclasspath $(top_builddir) \
-friend 'class ::java::lang::ClassLoader;' \
@@ -4287,7 +4490,7 @@ distclean-recursive: distclean-multi
maintainer-clean-recursive: maintainer-clean-multi
all-multi:
- $(MULTIDO) $(AM_MAKEFLAGS) DO=all multi-do
+ : $(MAKE) ; exec $(MULTIDO) $(AM_MAKEFLAGS) DO=all multi-do
install-multi:
$(MULTIDO) $(AM_MAKEFLAGS) DO=install multi-do
mostlyclean-multi:
diff --git a/libjava/acconfig.h b/libjava/acconfig.h
index bd02d33c16f..308f71ebdec 100644
--- a/libjava/acconfig.h
+++ b/libjava/acconfig.h
@@ -107,6 +107,7 @@
#undef HAVE_READDIR_R
#undef HAVE_GETHOSTBYNAME_R
#undef HAVE_GETHOSTBYADDR_R
+#undef HAVE_FTRUNCATE
/* Define if you want a bytecode interpreter. */
#undef INTERPRETER
diff --git a/libjava/acinclude.m4 b/libjava/acinclude.m4
index d205aa029dd..5908f40c5d5 100644
--- a/libjava/acinclude.m4
+++ b/libjava/acinclude.m4
@@ -1,28 +1,4 @@
-AC_DEFUN([AC_COMPILE_CHECK_SIZEOF],
-[changequote(<<, >>)dnl
-dnl The name to #define.
-define(<<AC_TYPE_NAME>>, translit(sizeof_$1, [a-z *], [A-Z_P]))dnl
-dnl The cache variable name.
-define(<<AC_CV_NAME>>, translit(ac_cv_sizeof_$1, [ *], [_p]))dnl
-changequote([, ])dnl
-AC_MSG_CHECKING(size of $1)
-AC_CACHE_VAL(AC_CV_NAME,
-[for ac_size in 4 8 1 2 16 12 $2 ; do # List sizes in rough order of prevalence.
- AC_TRY_COMPILE([#include "confdefs.h"
-#include <sys/types.h>
-$2
-], [switch (0) case 0: case (sizeof ($1) == $ac_size):;], AC_CV_NAME=$ac_size)
- if test x$AC_CV_NAME != x ; then break; fi
-done
-])
-if test x$AC_CV_NAME = x ; then
- AC_MSG_ERROR([cannot determine a size for $1])
-fi
-AC_MSG_RESULT($AC_CV_NAME)
-AC_DEFINE_UNQUOTED(AC_TYPE_NAME, $AC_CV_NAME, [The number of bytes in type $1])
-undefine([AC_TYPE_NAME])dnl
-undefine([AC_CV_NAME])dnl
-])
+sinclude(../config/accross.m4)
AC_DEFUN(LIBGCJ_CONFIGURE,
[
diff --git a/libjava/aclocal.m4 b/libjava/aclocal.m4
index fc85cbde103..2253b6b4d7c 100644
--- a/libjava/aclocal.m4
+++ b/libjava/aclocal.m4
@@ -1,6 +1,6 @@
-dnl aclocal.m4 generated automatically by aclocal 1.4
+dnl aclocal.m4 generated automatically by aclocal 1.4-p5
-dnl Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
+dnl Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
@@ -10,31 +10,7 @@ dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without
dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A
dnl PARTICULAR PURPOSE.
-AC_DEFUN([AC_COMPILE_CHECK_SIZEOF],
-[changequote(<<, >>)dnl
-dnl The name to #define.
-define(<<AC_TYPE_NAME>>, translit(sizeof_$1, [a-z *], [A-Z_P]))dnl
-dnl The cache variable name.
-define(<<AC_CV_NAME>>, translit(ac_cv_sizeof_$1, [ *], [_p]))dnl
-changequote([, ])dnl
-AC_MSG_CHECKING(size of $1)
-AC_CACHE_VAL(AC_CV_NAME,
-[for ac_size in 4 8 1 2 16 12 $2 ; do # List sizes in rough order of prevalence.
- AC_TRY_COMPILE([#include "confdefs.h"
-#include <sys/types.h>
-$2
-], [switch (0) case 0: case (sizeof ($1) == $ac_size):;], AC_CV_NAME=$ac_size)
- if test x$AC_CV_NAME != x ; then break; fi
-done
-])
-if test x$AC_CV_NAME = x ; then
- AC_MSG_ERROR([cannot determine a size for $1])
-fi
-AC_MSG_RESULT($AC_CV_NAME)
-AC_DEFINE_UNQUOTED(AC_TYPE_NAME, $AC_CV_NAME, [The number of bytes in type $1])
-undefine([AC_TYPE_NAME])dnl
-undefine([AC_CV_NAME])dnl
-])
+sinclude(../config/accross.m4)
AC_DEFUN(LIBGCJ_CONFIGURE,
[
@@ -295,7 +271,7 @@ AC_DEFUN([AM_LC_MESSAGES],
dnl Usage:
dnl AM_INIT_AUTOMAKE(package,version, [no-define])
-AC_DEFUN(AM_INIT_AUTOMAKE,
+AC_DEFUN([AM_INIT_AUTOMAKE],
[AC_REQUIRE([AC_PROG_INSTALL])
PACKAGE=[$1]
AC_SUBST(PACKAGE)
@@ -323,7 +299,7 @@ AC_REQUIRE([AC_PROG_MAKE_SET])])
# Check to make sure that the build environment is sane.
#
-AC_DEFUN(AM_SANITY_CHECK,
+AC_DEFUN([AM_SANITY_CHECK],
[AC_MSG_CHECKING([whether build environment is sane])
# Just in case
sleep 1
@@ -364,7 +340,7 @@ AC_MSG_RESULT(yes)])
dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY)
dnl The program must properly implement --version.
-AC_DEFUN(AM_MISSING_PROG,
+AC_DEFUN([AM_MISSING_PROG],
[AC_MSG_CHECKING(for working $2)
# Run test in a subshell; some versions of sh will print an error if
# an executable is not found, even if stderr is redirected.
@@ -383,7 +359,7 @@ AC_SUBST($1)])
# serial 1
-AC_DEFUN(AM_MAINTAINER_MODE,
+AC_DEFUN([AM_MAINTAINER_MODE],
[AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
dnl maintainer-mode is disabled by default
AC_ARG_ENABLE(maintainer-mode,
@@ -400,7 +376,7 @@ AC_DEFUN(AM_MAINTAINER_MODE,
# Define a conditional.
-AC_DEFUN(AM_CONDITIONAL,
+AC_DEFUN([AM_CONDITIONAL],
[AC_SUBST($1_TRUE)
AC_SUBST($1_FALSE)
if $2; then
@@ -413,7 +389,7 @@ fi])
# Like AC_CONFIG_HEADER, but automatically create stamp file.
-AC_DEFUN(AM_CONFIG_HEADER,
+AC_DEFUN([AM_CONFIG_HEADER],
[AC_PREREQ([2.12])
AC_CONFIG_HEADER([$1])
dnl When config.status generates a header, we must update the stamp-h file.
diff --git a/libjava/boehm.cc b/libjava/boehm.cc
index be2855aef72..466c9223ac8 100644
--- a/libjava/boehm.cc
+++ b/libjava/boehm.cc
@@ -1,6 +1,6 @@
// boehm.cc - interface between libjava and Boehm GC.
-/* Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation
+/* Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation
This file is part of libgcj.
@@ -134,6 +134,12 @@ _Jv_MarkObj (void *addr, void *msp, void *msl, void * /* env */)
p = (ptr_t) c->methods;
MAYBE_MARK (p, mark_stack_ptr, mark_stack_limit, c, c6label);
+ // The vtable might have been set, but the rest of the class
+ // could still be uninitialized. If this is the case, then
+ // c.isArray will SEGV. We check for this, and if it is the
+ // case we just return.
+ if (__builtin_expect (c->name == NULL, false))
+ return mark_stack_ptr;
if (! c->isArray() && ! c->isPrimitive())
{
diff --git a/libjava/configure b/libjava/configure
index cb4425d07de..0721b6ae196 100755
--- a/libjava/configure
+++ b/libjava/configure
@@ -82,7 +82,6 @@ program_suffix=NONE
program_transform_name=s,x,x,
silent=
site=
-sitefile=
srcdir=
target=NONE
verbose=
@@ -197,7 +196,6 @@ Configuration:
--help print this message
--no-create do not create output files
--quiet, --silent do not print \`checking...' messages
- --site-file=FILE use FILE as the site file
--version print the version of autoconf that created configure
Directory and file names:
--prefix=PREFIX install architecture-independent files in PREFIX
@@ -368,11 +366,6 @@ EOF
-site=* | --site=* | --sit=*)
site="$ac_optarg" ;;
- -site-file | --site-file | --site-fil | --site-fi | --site-f)
- ac_prev=sitefile ;;
- -site-file=* | --site-file=* | --site-fil=* | --site-fi=* | --site-f=*)
- sitefile="$ac_optarg" ;;
-
-srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
ac_prev=srcdir ;;
-srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
@@ -538,16 +531,12 @@ fi
srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'`
# Prefer explicitly selected file to automatically selected ones.
-if test -z "$sitefile"; then
- if test -z "$CONFIG_SITE"; then
- if test "x$prefix" != xNONE; then
- CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site"
- else
- CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site"
- fi
+if test -z "$CONFIG_SITE"; then
+ if test "x$prefix" != xNONE; then
+ CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site"
+ else
+ CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site"
fi
-else
- CONFIG_SITE="$sitefile"
fi
for ac_site_file in $CONFIG_SITE; do
if test -r "$ac_site_file"; then
@@ -594,7 +583,7 @@ fi
ORIGINAL_LD_FOR_MULTILIBS=$LD
echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6
-echo "configure:598: checking whether ln -s works" >&5
+echo "configure:587: checking whether ln -s works" >&5
if eval "test \"`echo '$''{'ac_cv_prog_LN_S'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -647,7 +636,7 @@ fi
# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
# ./install, which can be erroneously created by make from ./install.sh.
echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
-echo "configure:651: checking for a BSD compatible install" >&5
+echo "configure:640: checking for a BSD compatible install" >&5
if test -z "$INSTALL"; then
if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -700,7 +689,7 @@ test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}'
test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
echo $ac_n "checking whether build environment is sane""... $ac_c" 1>&6
-echo "configure:704: checking whether build environment is sane" >&5
+echo "configure:693: checking whether build environment is sane" >&5
# Just in case
sleep 1
echo timestamp > conftestfile
@@ -757,7 +746,7 @@ test "$program_suffix" != NONE &&
test "$program_transform_name" = "" && program_transform_name="s,x,x,"
echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6
-echo "configure:761: checking whether ${MAKE-make} sets \${MAKE}" >&5
+echo "configure:750: checking whether ${MAKE-make} sets \${MAKE}" >&5
set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -790,12 +779,12 @@ else
fi
echo $ac_n "checking for Cygwin environment""... $ac_c" 1>&6
-echo "configure:794: checking for Cygwin environment" >&5
+echo "configure:783: checking for Cygwin environment" >&5
if eval "test \"`echo '$''{'ac_cv_cygwin'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 799 "configure"
+#line 788 "configure"
#include "confdefs.h"
int main() {
@@ -806,7 +795,7 @@ int main() {
return __CYGWIN__;
; return 0; }
EOF
-if { (eval echo configure:810: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:799: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_cygwin=yes
else
@@ -823,19 +812,19 @@ echo "$ac_t""$ac_cv_cygwin" 1>&6
CYGWIN=
test "$ac_cv_cygwin" = yes && CYGWIN=yes
echo $ac_n "checking for mingw32 environment""... $ac_c" 1>&6
-echo "configure:827: checking for mingw32 environment" >&5
+echo "configure:816: checking for mingw32 environment" >&5
if eval "test \"`echo '$''{'ac_cv_mingw32'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 832 "configure"
+#line 821 "configure"
#include "confdefs.h"
int main() {
return __MINGW32__;
; return 0; }
EOF
-if { (eval echo configure:839: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:828: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_mingw32=yes
else
@@ -962,7 +951,7 @@ else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; }
fi
echo $ac_n "checking host system type""... $ac_c" 1>&6
-echo "configure:966: checking host system type" >&5
+echo "configure:955: checking host system type" >&5
host_alias=$host
case "$host_alias" in
@@ -983,7 +972,7 @@ host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
echo "$ac_t""$host" 1>&6
echo $ac_n "checking target system type""... $ac_c" 1>&6
-echo "configure:987: checking target system type" >&5
+echo "configure:976: checking target system type" >&5
target_alias=$target
case "$target_alias" in
@@ -1001,7 +990,7 @@ target_os=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
echo "$ac_t""$target" 1>&6
echo $ac_n "checking build system type""... $ac_c" 1>&6
-echo "configure:1005: checking build system type" >&5
+echo "configure:994: checking build system type" >&5
build_alias=$build
case "$build_alias" in
@@ -1030,7 +1019,7 @@ test "$host_alias" != "$target_alias" &&
# Extract the first word of "gcc", so it can be a program name with args.
set dummy gcc; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1034: checking for $ac_word" >&5
+echo "configure:1023: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1060,7 +1049,7 @@ if test -z "$CC"; then
# Extract the first word of "cc", so it can be a program name with args.
set dummy cc; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1064: checking for $ac_word" >&5
+echo "configure:1053: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1111,7 +1100,7 @@ fi
# Extract the first word of "cl", so it can be a program name with args.
set dummy cl; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1115: checking for $ac_word" >&5
+echo "configure:1104: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1144,7 +1133,7 @@ fi
echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
-echo "configure:1148: checking whether we are using GNU C" >&5
+echo "configure:1137: checking whether we are using GNU C" >&5
if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1153,7 +1142,7 @@ else
yes;
#endif
EOF
-if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1157: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
+if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1146: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
ac_cv_prog_gcc=yes
else
ac_cv_prog_gcc=no
@@ -1172,7 +1161,7 @@ ac_test_CFLAGS="${CFLAGS+set}"
ac_save_CFLAGS="$CFLAGS"
CFLAGS=
echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
-echo "configure:1176: checking whether ${CC-cc} accepts -g" >&5
+echo "configure:1165: checking whether ${CC-cc} accepts -g" >&5
if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1221,7 +1210,7 @@ do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1225: checking for $ac_word" >&5
+echo "configure:1214: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_glibjava_CXX'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1256,7 +1245,7 @@ CXX=$glibjava_CXX
test -z "$glibjava_CXX" && { echo "configure: error: no acceptable c++ found in \$PATH" 1>&2; exit 1; }
echo $ac_n "checking whether we are using GNU C++""... $ac_c" 1>&6
-echo "configure:1260: checking whether we are using GNU C++" >&5
+echo "configure:1249: checking whether we are using GNU C++" >&5
if eval "test \"`echo '$''{'ac_cv_prog_gxx'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1265,7 +1254,7 @@ else
yes;
#endif
EOF
-if { ac_try='${CXX-g++} -E conftest.C'; { (eval echo configure:1269: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
+if { ac_try='${CXX-g++} -E conftest.C'; { (eval echo configure:1258: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
ac_cv_prog_gxx=yes
else
ac_cv_prog_gxx=no
@@ -1280,7 +1269,7 @@ if test $ac_cv_prog_gxx = yes; then
ac_save_CXXFLAGS="$CXXFLAGS"
CXXFLAGS=
echo $ac_n "checking whether ${CXX-g++} accepts -g""... $ac_c" 1>&6
-echo "configure:1284: checking whether ${CXX-g++} accepts -g" >&5
+echo "configure:1273: checking whether ${CXX-g++} accepts -g" >&5
if eval "test \"`echo '$''{'ac_cv_prog_cxx_g'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1329,7 +1318,7 @@ EOF
missing_dir=`cd $ac_aux_dir && pwd`
echo $ac_n "checking for working aclocal""... $ac_c" 1>&6
-echo "configure:1333: checking for working aclocal" >&5
+echo "configure:1322: checking for working aclocal" >&5
# Run test in a subshell; some versions of sh will print an error if
# an executable is not found, even if stderr is redirected.
# Redirect stdin to placate older versions of autoconf. Sigh.
@@ -1342,7 +1331,7 @@ else
fi
echo $ac_n "checking for working autoconf""... $ac_c" 1>&6
-echo "configure:1346: checking for working autoconf" >&5
+echo "configure:1335: checking for working autoconf" >&5
# Run test in a subshell; some versions of sh will print an error if
# an executable is not found, even if stderr is redirected.
# Redirect stdin to placate older versions of autoconf. Sigh.
@@ -1355,7 +1344,7 @@ else
fi
echo $ac_n "checking for working automake""... $ac_c" 1>&6
-echo "configure:1359: checking for working automake" >&5
+echo "configure:1348: checking for working automake" >&5
# Run test in a subshell; some versions of sh will print an error if
# an executable is not found, even if stderr is redirected.
# Redirect stdin to placate older versions of autoconf. Sigh.
@@ -1368,7 +1357,7 @@ else
fi
echo $ac_n "checking for working autoheader""... $ac_c" 1>&6
-echo "configure:1372: checking for working autoheader" >&5
+echo "configure:1361: checking for working autoheader" >&5
# Run test in a subshell; some versions of sh will print an error if
# an executable is not found, even if stderr is redirected.
# Redirect stdin to placate older versions of autoconf. Sigh.
@@ -1381,7 +1370,7 @@ else
fi
echo $ac_n "checking for working makeinfo""... $ac_c" 1>&6
-echo "configure:1385: checking for working makeinfo" >&5
+echo "configure:1374: checking for working makeinfo" >&5
# Run test in a subshell; some versions of sh will print an error if
# an executable is not found, even if stderr is redirected.
# Redirect stdin to placate older versions of autoconf. Sigh.
@@ -1400,7 +1389,7 @@ fi
# LIBGCJ_CONFIGURE, which doesn't work because that means that it will
# be run before AC_CANONICAL_HOST.
echo $ac_n "checking build system type""... $ac_c" 1>&6
-echo "configure:1404: checking build system type" >&5
+echo "configure:1393: checking build system type" >&5
build_alias=$build
case "$build_alias" in
@@ -1421,7 +1410,7 @@ echo "$ac_t""$build" 1>&6
# Extract the first word of "${ac_tool_prefix}as", so it can be a program name with args.
set dummy ${ac_tool_prefix}as; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1425: checking for $ac_word" >&5
+echo "configure:1414: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_AS'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1453,7 +1442,7 @@ fi
# Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args.
set dummy ${ac_tool_prefix}ar; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1457: checking for $ac_word" >&5
+echo "configure:1446: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_AR'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1485,7 +1474,7 @@ fi
# Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args.
set dummy ${ac_tool_prefix}ranlib; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1489: checking for $ac_word" >&5
+echo "configure:1478: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1517,7 +1506,7 @@ if test -n "$ac_tool_prefix"; then
# Extract the first word of "ranlib", so it can be a program name with args.
set dummy ranlib; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1521: checking for $ac_word" >&5
+echo "configure:1510: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1562,7 +1551,7 @@ fi
# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
# ./install, which can be erroneously created by make from ./install.sh.
echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
-echo "configure:1566: checking for a BSD compatible install" >&5
+echo "configure:1555: checking for a BSD compatible install" >&5
if test -z "$INSTALL"; then
if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -1616,7 +1605,7 @@ test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
echo $ac_n "checking whether to enable maintainer-specific portions of Makefiles""... $ac_c" 1>&6
-echo "configure:1620: checking whether to enable maintainer-specific portions of Makefiles" >&5
+echo "configure:1609: checking whether to enable maintainer-specific portions of Makefiles" >&5
# Check whether --enable-maintainer-mode or --disable-maintainer-mode was given.
if test "${enable_maintainer_mode+set}" = set; then
enableval="$enable_maintainer_mode"
@@ -1642,7 +1631,7 @@ fi
echo $ac_n "checking for executable suffix""... $ac_c" 1>&6
-echo "configure:1646: checking for executable suffix" >&5
+echo "configure:1635: checking for executable suffix" >&5
if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1652,10 +1641,10 @@ else
rm -f conftest*
echo 'int main () { return 0; }' > conftest.$ac_ext
ac_cv_exeext=
- if { (eval echo configure:1656: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
+ if { (eval echo configure:1645: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
for file in conftest.*; do
case $file in
- *.c | *.o | *.obj | *.ilk | *.pdb) ;;
+ *.$ac_ext | *.c | *.o | *.obj) ;;
*) ac_cv_exeext=`echo $file | sed -e s/conftest//` ;;
esac
done
@@ -1802,7 +1791,7 @@ ac_prog=ld
if test "$GCC" = yes; then
# Check if gcc -print-prog-name=ld gives a path.
echo $ac_n "checking for ld used by GCC""... $ac_c" 1>&6
-echo "configure:1806: checking for ld used by GCC" >&5
+echo "configure:1795: checking for ld used by GCC" >&5
case $host in
*-*-mingw*)
# gcc leaves a trailing carriage return which upsets mingw
@@ -1832,10 +1821,10 @@ echo "configure:1806: checking for ld used by GCC" >&5
esac
elif test "$with_gnu_ld" = yes; then
echo $ac_n "checking for GNU ld""... $ac_c" 1>&6
-echo "configure:1836: checking for GNU ld" >&5
+echo "configure:1825: checking for GNU ld" >&5
else
echo $ac_n "checking for non-GNU ld""... $ac_c" 1>&6
-echo "configure:1839: checking for non-GNU ld" >&5
+echo "configure:1828: checking for non-GNU ld" >&5
fi
if eval "test \"`echo '$''{'lt_cv_path_LD'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -1870,7 +1859,7 @@ else
fi
test -z "$LD" && { echo "configure: error: no acceptable ld found in \$PATH" 1>&2; exit 1; }
echo $ac_n "checking if the linker ($LD) is GNU ld""... $ac_c" 1>&6
-echo "configure:1874: checking if the linker ($LD) is GNU ld" >&5
+echo "configure:1863: checking if the linker ($LD) is GNU ld" >&5
if eval "test \"`echo '$''{'lt_cv_prog_gnu_ld'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1887,7 +1876,7 @@ with_gnu_ld=$lt_cv_prog_gnu_ld
echo $ac_n "checking for $LD option to reload object files""... $ac_c" 1>&6
-echo "configure:1891: checking for $LD option to reload object files" >&5
+echo "configure:1880: checking for $LD option to reload object files" >&5
if eval "test \"`echo '$''{'lt_cv_ld_reload_flag'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1899,7 +1888,7 @@ reload_flag=$lt_cv_ld_reload_flag
test -n "$reload_flag" && reload_flag=" $reload_flag"
echo $ac_n "checking for BSD-compatible nm""... $ac_c" 1>&6
-echo "configure:1903: checking for BSD-compatible nm" >&5
+echo "configure:1892: checking for BSD-compatible nm" >&5
if eval "test \"`echo '$''{'lt_cv_path_NM'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1937,7 +1926,7 @@ NM="$lt_cv_path_NM"
echo "$ac_t""$NM" 1>&6
echo $ac_n "checking how to recognise dependant libraries""... $ac_c" 1>&6
-echo "configure:1941: checking how to recognise dependant libraries" >&5
+echo "configure:1930: checking how to recognise dependant libraries" >&5
if eval "test \"`echo '$''{'lt_cv_deplibs_check_method'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -2110,13 +2099,13 @@ file_magic_cmd=$lt_cv_file_magic_cmd
deplibs_check_method=$lt_cv_deplibs_check_method
echo $ac_n "checking for object suffix""... $ac_c" 1>&6
-echo "configure:2114: checking for object suffix" >&5
+echo "configure:2103: checking for object suffix" >&5
if eval "test \"`echo '$''{'ac_cv_objext'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
rm -f conftest*
echo 'int i = 1;' > conftest.$ac_ext
-if { (eval echo configure:2120: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2109: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
for ac_file in conftest.*; do
case $ac_file in
*.c) ;;
@@ -2140,7 +2129,7 @@ case $deplibs_check_method in
file_magic*)
if test "$file_magic_cmd" = '$MAGIC_CMD'; then
echo $ac_n "checking for ${ac_tool_prefix}file""... $ac_c" 1>&6
-echo "configure:2144: checking for ${ac_tool_prefix}file" >&5
+echo "configure:2133: checking for ${ac_tool_prefix}file" >&5
if eval "test \"`echo '$''{'lt_cv_path_MAGIC_CMD'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -2202,7 +2191,7 @@ fi
if test -z "$lt_cv_path_MAGIC_CMD"; then
if test -n "$ac_tool_prefix"; then
echo $ac_n "checking for file""... $ac_c" 1>&6
-echo "configure:2206: checking for file" >&5
+echo "configure:2195: checking for file" >&5
if eval "test \"`echo '$''{'lt_cv_path_MAGIC_CMD'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -2273,7 +2262,7 @@ esac
# Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args.
set dummy ${ac_tool_prefix}ranlib; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:2277: checking for $ac_word" >&5
+echo "configure:2266: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -2305,7 +2294,7 @@ if test -n "$ac_tool_prefix"; then
# Extract the first word of "ranlib", so it can be a program name with args.
set dummy ranlib; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:2309: checking for $ac_word" >&5
+echo "configure:2298: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -2340,7 +2329,7 @@ fi
# Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args.
set dummy ${ac_tool_prefix}strip; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:2344: checking for $ac_word" >&5
+echo "configure:2333: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_STRIP'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -2372,7 +2361,7 @@ if test -n "$ac_tool_prefix"; then
# Extract the first word of "strip", so it can be a program name with args.
set dummy strip; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:2376: checking for $ac_word" >&5
+echo "configure:2365: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_STRIP'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -2439,8 +2428,8 @@ test x"$pic_mode" = xno && libtool_flags="$libtool_flags --prefer-non-pic"
case $host in
*-*-irix6*)
# Find out which ABI we are using.
- echo '#line 2443 "configure"' > conftest.$ac_ext
- if { (eval echo configure:2444: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ echo '#line 2432 "configure"' > conftest.$ac_ext
+ if { (eval echo configure:2433: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
case `/usr/bin/file conftest.$ac_objext` in
*32-bit*)
LD="${LD-ld} -32"
@@ -2459,7 +2448,7 @@ case $host in
ia64-*-hpux*)
# Find out which ABI we are using.
echo 'int i;' > conftest.$ac_ext
- if { (eval echo configure:2463: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ if { (eval echo configure:2452: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
case "`/usr/bin/file conftest.o`" in
*ELF-32*)
HPUX_IA64_MODE="32"
@@ -2472,12 +2461,54 @@ ia64-*-hpux*)
rm -rf conftest*
;;
+x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*|s390*-*linux*|sparc*-*linux*)
+ # Find out which ABI we are using.
+ echo 'int i;' > conftest.$ac_ext
+ if { (eval echo configure:2468: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ case "`/usr/bin/file conftest.o`" in
+ *32-bit*)
+ case $host in
+ x86_64-*linux*)
+ LD="${LD-ld} -m elf_i386"
+ ;;
+ ppc64-*linux*)
+ LD="${LD-ld} -m elf32ppclinux"
+ ;;
+ s390x-*linux*)
+ LD="${LD-ld} -m elf_s390"
+ ;;
+ sparc64-*linux*)
+ LD="${LD-ld} -m elf32_sparc"
+ ;;
+ esac
+ ;;
+ *64-bit*)
+ case $host in
+ x86_64-*linux*)
+ LD="${LD-ld} -m elf_x86_64"
+ ;;
+ ppc*-*linux*|powerpc*-*linux*)
+ LD="${LD-ld} -m elf64ppc"
+ ;;
+ s390*-*linux*)
+ LD="${LD-ld} -m elf64_s390"
+ ;;
+ sparc*-*linux*)
+ LD="${LD-ld} -m elf64_sparc"
+ ;;
+ esac
+ ;;
+ esac
+ fi
+ rm -rf conftest*
+ ;;
+
*-*-sco3.2v5*)
# On SCO OpenServer 5, we need -belf to get full-featured binaries.
SAVE_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -belf"
echo $ac_n "checking whether the C compiler needs -belf""... $ac_c" 1>&6
-echo "configure:2481: checking whether the C compiler needs -belf" >&5
+echo "configure:2512: checking whether the C compiler needs -belf" >&5
if eval "test \"`echo '$''{'lt_cv_cc_needs_belf'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -2490,14 +2521,14 @@ ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$a
cross_compiling=$ac_cv_prog_cc_cross
cat > conftest.$ac_ext <<EOF
-#line 2494 "configure"
+#line 2525 "configure"
#include "confdefs.h"
int main() {
; return 0; }
EOF
-if { (eval echo configure:2501: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2532: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
lt_cv_cc_needs_belf=yes
else
@@ -2527,7 +2558,7 @@ echo "$ac_t""$lt_cv_cc_needs_belf" 1>&6
esac
echo $ac_n "checking how to run the C++ preprocessor""... $ac_c" 1>&6
-echo "configure:2531: checking how to run the C++ preprocessor" >&5
+echo "configure:2562: checking how to run the C++ preprocessor" >&5
if test -z "$CXXCPP"; then
if eval "test \"`echo '$''{'ac_cv_prog_CXXCPP'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -2540,12 +2571,12 @@ ac_link='${CXX-g++} -o conftest${ac_exeext} $CXXFLAGS $CPPFLAGS $LDFLAGS conftes
cross_compiling=$ac_cv_prog_cxx_cross
CXXCPP="${CXX-g++} -E"
cat > conftest.$ac_ext <<EOF
-#line 2544 "configure"
+#line 2575 "configure"
#include "confdefs.h"
#include <stdlib.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2549: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2580: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
:
@@ -2781,7 +2812,7 @@ INTERPRETER="$libgcj_interpreter"
echo $ac_n "checking for exception model to use""... $ac_c" 1>&6
-echo "configure:2785: checking for exception model to use" >&5
+echo "configure:2816: checking for exception model to use" >&5
ac_ext=C
# CXXFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
@@ -2796,7 +2827,7 @@ if test "${enable_sjlj_exceptions+set}" = set; then
:
else
cat > conftest.$ac_ext << EOF
-#line 2800 "configure"
+#line 2831 "configure"
struct S { ~S(); };
void bar();
void foo()
@@ -2807,7 +2838,7 @@ void foo()
EOF
old_CXXFLAGS="$CXXFLAGS"
CXXFLAGS=-S
-if { (eval echo configure:2811: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2842: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
if grep _Unwind_SjLj_Resume conftest.s >/dev/null 2>&1 ; then
enable_sjlj_exceptions=yes
elif grep _Unwind_Resume conftest.s >/dev/null 2>&1 ; then
@@ -2915,6 +2946,7 @@ case "$TARGET_ECOS" in
PLATFORM=Win32
PLATFORMOBJS=win32.lo
PLATFORMH=win32.h
+ CHECK_FOR_BROKEN_MINGW_LD
;;
*)
PLATFORM=Posix
@@ -2937,7 +2969,7 @@ esac
echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
-echo "configure:2941: checking how to run the C preprocessor" >&5
+echo "configure:2973: checking how to run the C preprocessor" >&5
# On Suns, sometimes $CPP names a directory.
if test -n "$CPP" && test -d "$CPP"; then
CPP=
@@ -2952,13 +2984,13 @@ else
# On the NeXT, cc -E runs the code through the compiler's parser,
# not just through cpp.
cat > conftest.$ac_ext <<EOF
-#line 2956 "configure"
+#line 2988 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2962: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2994: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
:
@@ -2969,13 +3001,13 @@ else
rm -rf conftest*
CPP="${CC-cc} -E -traditional-cpp"
cat > conftest.$ac_ext <<EOF
-#line 2973 "configure"
+#line 3005 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2979: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:3011: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
:
@@ -2986,13 +3018,13 @@ else
rm -rf conftest*
CPP="${CC-cc} -nologo -E"
cat > conftest.$ac_ext <<EOF
-#line 2990 "configure"
+#line 3022 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2996: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:3028: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
:
@@ -3017,7 +3049,7 @@ fi
echo "$ac_t""$CPP" 1>&6
cat > conftest.$ac_ext <<EOF
-#line 3021 "configure"
+#line 3053 "configure"
#include "confdefs.h"
#include <stdint.h>
EOF
@@ -3032,7 +3064,7 @@ fi
rm -f conftest*
cat > conftest.$ac_ext <<EOF
-#line 3036 "configure"
+#line 3068 "configure"
#include "confdefs.h"
#include <inttypes.h>
EOF
@@ -3047,7 +3079,7 @@ fi
rm -f conftest*
cat > conftest.$ac_ext <<EOF
-#line 3051 "configure"
+#line 3083 "configure"
#include "confdefs.h"
#include <sys/types.h>
EOF
@@ -3062,7 +3094,7 @@ fi
rm -f conftest*
cat > conftest.$ac_ext <<EOF
-#line 3066 "configure"
+#line 3098 "configure"
#include "confdefs.h"
#include <sys/config.h>
EOF
@@ -3079,7 +3111,7 @@ rm -f conftest*
cat > conftest.$ac_ext <<EOF
-#line 3083 "configure"
+#line 3115 "configure"
#include "confdefs.h"
#include <time.h>
EOF
@@ -3094,7 +3126,7 @@ fi
rm -f conftest*
cat > conftest.$ac_ext <<EOF
-#line 3098 "configure"
+#line 3130 "configure"
#include "confdefs.h"
#include <time.h>
EOF
@@ -3146,7 +3178,7 @@ ZLIBTESTSPEC=
libsubdir=.libs
echo $ac_n "checking for garbage collector to use""... $ac_c" 1>&6
-echo "configure:3150: checking for garbage collector to use" >&5
+echo "configure:3182: checking for garbage collector to use" >&5
# Check whether --enable-java-gc or --disable-java-gc was given.
if test "${enable_java_gc+set}" = set; then
enableval="$enable_java_gc"
@@ -3199,7 +3231,7 @@ esac
echo $ac_n "checking for thread model used by GCC""... $ac_c" 1>&6
-echo "configure:3203: checking for thread model used by GCC" >&5
+echo "configure:3235: checking for thread model used by GCC" >&5
THREADS=`$CC -v 2>&1 | sed -n 's/^Thread model: //p'`
echo "$ac_t""$THREADS" 1>&6
@@ -3314,7 +3346,7 @@ if test -d sysdep; then true; else mkdir sysdep; fi
HASH_SYNC_SPEC=
# Hash synchronization is only useful with posix threads right now.
-if test "$enable_hash_synchronization" = yes && test "$THREADS" = "posix"; then
+if test "$enable_hash_synchronization" = yes && test "$THREADS" != "none"; then
HASH_SYNC_SPEC=-fhash-synchronization
cat >> confdefs.h <<\EOF
#define JV_HASH_SYNCHRONIZATION 1
@@ -3407,12 +3439,12 @@ else
for ac_func in strerror ioctl select fstat open fsync sleep opendir
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:3411: checking for $ac_func" >&5
+echo "configure:3443: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 3416 "configure"
+#line 3448 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -3435,7 +3467,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:3439: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3471: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -3462,12 +3494,12 @@ done
for ac_func in gmtime_r localtime_r readdir_r getpwuid_r getcwd
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:3466: checking for $ac_func" >&5
+echo "configure:3498: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 3471 "configure"
+#line 3503 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -3490,7 +3522,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:3494: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3526: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -3517,12 +3549,12 @@ done
for ac_func in access stat mkdir rename rmdir unlink realpath utime chmod
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:3521: checking for $ac_func" >&5
+echo "configure:3553: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 3526 "configure"
+#line 3558 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -3545,7 +3577,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:3549: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3581: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -3572,12 +3604,12 @@ done
for ac_func in nl_langinfo setlocale
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:3576: checking for $ac_func" >&5
+echo "configure:3608: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 3581 "configure"
+#line 3613 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -3600,7 +3632,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:3604: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3636: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -3627,12 +3659,12 @@ done
for ac_func in inet_aton inet_addr
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:3631: checking for $ac_func" >&5
+echo "configure:3663: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 3636 "configure"
+#line 3668 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -3655,7 +3687,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:3659: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3691: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -3682,12 +3714,12 @@ done
for ac_func in inet_pton uname inet_ntoa
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:3686: checking for $ac_func" >&5
+echo "configure:3718: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 3691 "configure"
+#line 3723 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -3710,7 +3742,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:3714: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3746: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -3734,15 +3766,15 @@ else
fi
done
- for ac_func in fork execvp pipe sigaction
+ for ac_func in fork execvp pipe sigaction ftruncate
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:3741: checking for $ac_func" >&5
+echo "configure:3773: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 3746 "configure"
+#line 3778 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -3765,7 +3797,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:3769: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3801: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -3793,17 +3825,17 @@ done
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:3797: checking for $ac_hdr" >&5
+echo "configure:3829: checking for $ac_hdr" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 3802 "configure"
+#line 3834 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3807: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:3839: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
@@ -3830,12 +3862,12 @@ fi
done
echo $ac_n "checking for backtrace""... $ac_c" 1>&6
-echo "configure:3834: checking for backtrace" >&5
+echo "configure:3866: checking for backtrace" >&5
if eval "test \"`echo '$''{'ac_cv_func_backtrace'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 3839 "configure"
+#line 3871 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char backtrace(); below. */
@@ -3858,7 +3890,7 @@ backtrace();
; return 0; }
EOF
-if { (eval echo configure:3862: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3894: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_backtrace=yes"
else
@@ -3894,7 +3926,7 @@ fi
echo $ac_n "checking for dladdr in -ldl""... $ac_c" 1>&6
-echo "configure:3898: checking for dladdr in -ldl" >&5
+echo "configure:3930: checking for dladdr in -ldl" >&5
ac_lib_var=`echo dl'_'dladdr | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -3902,7 +3934,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-ldl $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 3906 "configure"
+#line 3938 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@@ -3913,7 +3945,7 @@ int main() {
dladdr()
; return 0; }
EOF
-if { (eval echo configure:3917: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3949: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -3943,7 +3975,7 @@ do
ac_safe=`echo "$ac_file" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_file""... $ac_c" 1>&6
-echo "configure:3947: checking for $ac_file" >&5
+echo "configure:3979: checking for $ac_file" >&5
if eval "test \"`echo '$''{'ac_cv_file_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -4001,7 +4033,7 @@ fi
echo $ac_n "checking for iconv""... $ac_c" 1>&6
-echo "configure:4005: checking for iconv" >&5
+echo "configure:4037: checking for iconv" >&5
if eval "test \"`echo '$''{'am_cv_func_iconv'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -4009,7 +4041,7 @@ else
am_cv_func_iconv="no, consider installing GNU libiconv"
am_cv_lib_iconv=no
cat > conftest.$ac_ext <<EOF
-#line 4013 "configure"
+#line 4045 "configure"
#include "confdefs.h"
#include <stdlib.h>
#include <iconv.h>
@@ -4019,7 +4051,7 @@ iconv_t cd = iconv_open("","");
iconv_close(cd);
; return 0; }
EOF
-if { (eval echo configure:4023: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4055: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
am_cv_func_iconv=yes
else
@@ -4031,7 +4063,7 @@ rm -f conftest*
am_save_LIBS="$LIBS"
LIBS="$LIBS $am_cv_libiconv_ldpath -liconv"
cat > conftest.$ac_ext <<EOF
-#line 4035 "configure"
+#line 4067 "configure"
#include "confdefs.h"
#include <stdlib.h>
#include <iconv.h>
@@ -4041,7 +4073,7 @@ iconv_t cd = iconv_open("","");
iconv_close(cd);
; return 0; }
EOF
-if { (eval echo configure:4045: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4077: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
am_cv_lib_iconv=yes
am_cv_func_iconv=yes
@@ -4062,13 +4094,13 @@ echo "$ac_t""$am_cv_func_iconv" 1>&6
EOF
echo $ac_n "checking for iconv declaration""... $ac_c" 1>&6
-echo "configure:4066: checking for iconv declaration" >&5
+echo "configure:4098: checking for iconv declaration" >&5
if eval "test \"`echo '$''{'am_cv_proto_iconv'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 4072 "configure"
+#line 4104 "configure"
#include "confdefs.h"
#include <stdlib.h>
@@ -4087,7 +4119,7 @@ int main() {
; return 0; }
EOF
-if { (eval echo configure:4091: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4123: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
am_cv_proto_iconv_arg1=""
else
@@ -4116,19 +4148,19 @@ EOF
if test $ac_cv_header_locale_h = yes; then
echo $ac_n "checking for LC_MESSAGES""... $ac_c" 1>&6
-echo "configure:4120: checking for LC_MESSAGES" >&5
+echo "configure:4152: checking for LC_MESSAGES" >&5
if eval "test \"`echo '$''{'am_cv_val_LC_MESSAGES'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 4125 "configure"
+#line 4157 "configure"
#include "confdefs.h"
#include <locale.h>
int main() {
return LC_MESSAGES
; return 0; }
EOF
-if { (eval echo configure:4132: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4164: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
am_cv_val_LC_MESSAGES=yes
else
@@ -4149,12 +4181,12 @@ EOF
fi
fi
echo $ac_n "checking whether struct tm is in sys/time.h or time.h""... $ac_c" 1>&6
-echo "configure:4153: checking whether struct tm is in sys/time.h or time.h" >&5
+echo "configure:4185: checking whether struct tm is in sys/time.h or time.h" >&5
if eval "test \"`echo '$''{'ac_cv_struct_tm'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 4158 "configure"
+#line 4190 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <time.h>
@@ -4162,7 +4194,7 @@ int main() {
struct tm *tp; tp->tm_sec;
; return 0; }
EOF
-if { (eval echo configure:4166: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4198: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_struct_tm=time.h
else
@@ -4183,12 +4215,12 @@ EOF
fi
echo $ac_n "checking for tm_zone in struct tm""... $ac_c" 1>&6
-echo "configure:4187: checking for tm_zone in struct tm" >&5
+echo "configure:4219: checking for tm_zone in struct tm" >&5
if eval "test \"`echo '$''{'ac_cv_struct_tm_zone'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 4192 "configure"
+#line 4224 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <$ac_cv_struct_tm>
@@ -4196,7 +4228,7 @@ int main() {
struct tm tm; tm.tm_zone;
; return 0; }
EOF
-if { (eval echo configure:4200: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4232: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_struct_tm_zone=yes
else
@@ -4216,12 +4248,12 @@ EOF
else
echo $ac_n "checking for tzname""... $ac_c" 1>&6
-echo "configure:4220: checking for tzname" >&5
+echo "configure:4252: checking for tzname" >&5
if eval "test \"`echo '$''{'ac_cv_var_tzname'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 4225 "configure"
+#line 4257 "configure"
#include "confdefs.h"
#include <time.h>
#ifndef tzname /* For SGI. */
@@ -4231,7 +4263,7 @@ int main() {
atoi(*tzname);
; return 0; }
EOF
-if { (eval echo configure:4235: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4267: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
ac_cv_var_tzname=yes
else
@@ -4256,12 +4288,12 @@ fi
for ac_func in gethostbyname_r
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:4260: checking for $ac_func" >&5
+echo "configure:4292: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 4265 "configure"
+#line 4297 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -4284,7 +4316,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:4288: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4320: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -4311,7 +4343,7 @@ EOF
# We look for the one that returns `int'.
# Hopefully this check is robust enough.
cat > conftest.$ac_ext <<EOF
-#line 4315 "configure"
+#line 4347 "configure"
#include "confdefs.h"
#include <netdb.h>
EOF
@@ -4331,7 +4363,7 @@ rm -f conftest*
*" -D_REENTRANT "*) ;;
*)
echo $ac_n "checking whether gethostbyname_r declaration requires -D_REENTRANT""... $ac_c" 1>&6
-echo "configure:4335: checking whether gethostbyname_r declaration requires -D_REENTRANT" >&5
+echo "configure:4367: checking whether gethostbyname_r declaration requires -D_REENTRANT" >&5
if eval "test \"`echo '$''{'libjava_cv_gethostbyname_r_needs_reentrant'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -4344,14 +4376,14 @@ ac_link='${CXX-g++} -o conftest${ac_exeext} $CXXFLAGS $CPPFLAGS $LDFLAGS conftes
cross_compiling=$ac_cv_prog_cxx_cross
cat > conftest.$ac_ext <<EOF
-#line 4348 "configure"
+#line 4380 "configure"
#include "confdefs.h"
#include <netdb.h>
int main() {
gethostbyname_r("", 0, 0);
; return 0; }
EOF
-if { (eval echo configure:4355: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4387: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
libjava_cv_gethostbyname_r_needs_reentrant=no
else
@@ -4361,14 +4393,14 @@ else
CPPFLAGS_SAVE="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS -D_REENTRANT"
cat > conftest.$ac_ext <<EOF
-#line 4365 "configure"
+#line 4397 "configure"
#include "confdefs.h"
#include <netdb.h>
int main() {
gethostbyname_r("", 0, 0);
; return 0; }
EOF
-if { (eval echo configure:4372: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4404: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
libjava_cv_gethostbyname_r_needs_reentrant=yes
else
@@ -4403,12 +4435,12 @@ EOF
esac
echo $ac_n "checking for struct hostent_data""... $ac_c" 1>&6
-echo "configure:4407: checking for struct hostent_data" >&5
+echo "configure:4439: checking for struct hostent_data" >&5
if eval "test \"`echo '$''{'libjava_cv_struct_hostent_data'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 4412 "configure"
+#line 4444 "configure"
#include "confdefs.h"
#if GETHOSTBYNAME_R_NEEDS_REENTRANT && !defined(_REENTRANT)
@@ -4419,7 +4451,7 @@ int main() {
struct hostent_data data;
; return 0; }
EOF
-if { (eval echo configure:4423: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4455: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
libjava_cv_struct_hostent_data=yes
else
@@ -4451,7 +4483,7 @@ done
# to exist where expected. (The root issue: AC_CHECK_FUNCS assumes C
# linkage check is enough, yet C++ code requires proper prototypes.)
cat > conftest.$ac_ext <<EOF
-#line 4455 "configure"
+#line 4487 "configure"
#include "confdefs.h"
#include <netdb.h>
EOF
@@ -4462,12 +4494,12 @@ if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
for ac_func in gethostbyaddr_r
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:4466: checking for $ac_func" >&5
+echo "configure:4498: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 4471 "configure"
+#line 4503 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -4490,7 +4522,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:4494: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4526: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -4517,7 +4549,7 @@ EOF
# We look for the one that returns `int'.
# Hopefully this check is robust enough.
cat > conftest.$ac_ext <<EOF
-#line 4521 "configure"
+#line 4553 "configure"
#include "confdefs.h"
#include <netdb.h>
EOF
@@ -4544,12 +4576,12 @@ rm -f conftest*
for ac_func in gethostname
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:4548: checking for $ac_func" >&5
+echo "configure:4580: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 4553 "configure"
+#line 4585 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -4572,7 +4604,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:4576: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4608: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -4596,7 +4628,7 @@ EOF
EOF
cat > conftest.$ac_ext <<EOF
-#line 4600 "configure"
+#line 4632 "configure"
#include "confdefs.h"
#include <unistd.h>
EOF
@@ -4627,12 +4659,12 @@ done
for ac_func in pthread_mutexattr_settype pthread_mutexattr_setkind_np
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:4631: checking for $ac_func" >&5
+echo "configure:4663: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 4636 "configure"
+#line 4668 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -4655,7 +4687,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:4659: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4691: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -4685,12 +4717,12 @@ done
for ac_func in sched_yield
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:4689: checking for $ac_func" >&5
+echo "configure:4721: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 4694 "configure"
+#line 4726 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -4713,7 +4745,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:4717: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4749: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -4735,7 +4767,7 @@ EOF
else
echo "$ac_t""no" 1>&6
echo $ac_n "checking for sched_yield in -lrt""... $ac_c" 1>&6
-echo "configure:4739: checking for sched_yield in -lrt" >&5
+echo "configure:4771: checking for sched_yield in -lrt" >&5
ac_lib_var=`echo rt'_'sched_yield | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -4743,7 +4775,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lrt $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 4747 "configure"
+#line 4779 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@@ -4754,7 +4786,7 @@ int main() {
sched_yield()
; return 0; }
EOF
-if { (eval echo configure:4758: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4790: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -4780,7 +4812,7 @@ else
echo "$ac_t""no" 1>&6
echo $ac_n "checking for sched_yield in -lposix4""... $ac_c" 1>&6
-echo "configure:4784: checking for sched_yield in -lposix4" >&5
+echo "configure:4816: checking for sched_yield in -lposix4" >&5
ac_lib_var=`echo posix4'_'sched_yield | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -4788,7 +4820,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lposix4 $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 4792 "configure"
+#line 4824 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@@ -4799,7 +4831,7 @@ int main() {
sched_yield()
; return 0; }
EOF
-if { (eval echo configure:4803: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4835: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -4835,7 +4867,7 @@ done
# We can save a little space at runtime if the mutex has m_count
# or __m_count. This is a nice hack for Linux.
cat > conftest.$ac_ext <<EOF
-#line 4839 "configure"
+#line 4871 "configure"
#include "confdefs.h"
#include <pthread.h>
int main() {
@@ -4844,7 +4876,7 @@ int main() {
; return 0; }
EOF
-if { (eval echo configure:4848: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4880: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
cat >> confdefs.h <<\EOF
#define PTHREAD_MUTEX_HAVE_M_COUNT 1
@@ -4856,7 +4888,7 @@ else
rm -rf conftest*
cat > conftest.$ac_ext <<EOF
-#line 4860 "configure"
+#line 4892 "configure"
#include "confdefs.h"
#include <pthread.h>
int main() {
@@ -4865,7 +4897,7 @@ int main() {
; return 0; }
EOF
-if { (eval echo configure:4869: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4901: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
cat >> confdefs.h <<\EOF
#define PTHREAD_MUTEX_HAVE___M_COUNT 1
@@ -4885,12 +4917,12 @@ rm -f conftest*
for ac_func in gettimeofday time ftime
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:4889: checking for $ac_func" >&5
+echo "configure:4921: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 4894 "configure"
+#line 4926 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -4913,7 +4945,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:4917: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4949: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -4944,12 +4976,12 @@ done
for ac_func in memmove
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:4948: checking for $ac_func" >&5
+echo "configure:4980: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 4953 "configure"
+#line 4985 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -4972,7 +5004,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:4976: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5008: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -5002,12 +5034,12 @@ done
for ac_func in memcpy
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:5006: checking for $ac_func" >&5
+echo "configure:5038: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 5011 "configure"
+#line 5043 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -5030,7 +5062,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:5034: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5066: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -5059,7 +5091,7 @@ done
fi
echo $ac_n "checking for dlopen in -ldl""... $ac_c" 1>&6
-echo "configure:5063: checking for dlopen in -ldl" >&5
+echo "configure:5095: checking for dlopen in -ldl" >&5
ac_lib_var=`echo dl'_'dlopen | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -5067,7 +5099,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-ldl $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 5071 "configure"
+#line 5103 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@@ -5078,7 +5110,7 @@ int main() {
dlopen()
; return 0; }
EOF
-if { (eval echo configure:5082: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5114: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -5123,7 +5155,7 @@ fi
#--------------------------------------------------------------------
echo $ac_n "checking for socket libraries""... $ac_c" 1>&6
-echo "configure:5127: checking for socket libraries" >&5
+echo "configure:5159: checking for socket libraries" >&5
if eval "test \"`echo '$''{'gcj_cv_lib_sockets'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -5131,12 +5163,12 @@ else
gcj_checkBoth=0
unset ac_cv_func_connect
echo $ac_n "checking for connect""... $ac_c" 1>&6
-echo "configure:5135: checking for connect" >&5
+echo "configure:5167: checking for connect" >&5
if eval "test \"`echo '$''{'ac_cv_func_connect'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 5140 "configure"
+#line 5172 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char connect(); below. */
@@ -5159,7 +5191,7 @@ connect();
; return 0; }
EOF
-if { (eval echo configure:5163: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5195: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_connect=yes"
else
@@ -5182,7 +5214,7 @@ fi
if test "$gcj_checkSocket" = 1; then
unset ac_cv_func_connect
echo $ac_n "checking for main in -lsocket""... $ac_c" 1>&6
-echo "configure:5186: checking for main in -lsocket" >&5
+echo "configure:5218: checking for main in -lsocket" >&5
ac_lib_var=`echo socket'_'main | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -5190,14 +5222,14 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lsocket $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 5194 "configure"
+#line 5226 "configure"
#include "confdefs.h"
int main() {
main()
; return 0; }
EOF
-if { (eval echo configure:5201: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5233: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -5224,12 +5256,12 @@ fi
LIBS="$LIBS -lsocket -lnsl"
unset ac_cv_func_accept
echo $ac_n "checking for accept""... $ac_c" 1>&6
-echo "configure:5228: checking for accept" >&5
+echo "configure:5260: checking for accept" >&5
if eval "test \"`echo '$''{'ac_cv_func_accept'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 5233 "configure"
+#line 5265 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char accept(); below. */
@@ -5252,7 +5284,7 @@ accept();
; return 0; }
EOF
-if { (eval echo configure:5256: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5288: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_accept=yes"
else
@@ -5279,12 +5311,12 @@ fi
gcj_oldLibs=$LIBS
LIBS="$LIBS $gcj_cv_lib_sockets"
echo $ac_n "checking for gethostbyname""... $ac_c" 1>&6
-echo "configure:5283: checking for gethostbyname" >&5
+echo "configure:5315: checking for gethostbyname" >&5
if eval "test \"`echo '$''{'ac_cv_func_gethostbyname'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 5288 "configure"
+#line 5320 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char gethostbyname(); below. */
@@ -5307,7 +5339,7 @@ gethostbyname();
; return 0; }
EOF
-if { (eval echo configure:5311: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5343: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_gethostbyname=yes"
else
@@ -5325,7 +5357,7 @@ if eval "test \"`echo '$ac_cv_func_'gethostbyname`\" = yes"; then
else
echo "$ac_t""no" 1>&6
echo $ac_n "checking for main in -lnsl""... $ac_c" 1>&6
-echo "configure:5329: checking for main in -lnsl" >&5
+echo "configure:5361: checking for main in -lnsl" >&5
ac_lib_var=`echo nsl'_'main | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -5333,14 +5365,14 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lnsl $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 5337 "configure"
+#line 5369 "configure"
#include "confdefs.h"
int main() {
main()
; return 0; }
EOF
-if { (eval echo configure:5344: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5376: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -5372,7 +5404,7 @@ echo "$ac_t""$gcj_cv_lib_sockets" 1>&6
if test "$with_system_zlib" = yes; then
echo $ac_n "checking for deflate in -lz""... $ac_c" 1>&6
-echo "configure:5376: checking for deflate in -lz" >&5
+echo "configure:5408: checking for deflate in -lz" >&5
ac_lib_var=`echo z'_'deflate | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -5380,7 +5412,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lz $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 5384 "configure"
+#line 5416 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@@ -5391,7 +5423,7 @@ int main() {
deflate()
; return 0; }
EOF
-if { (eval echo configure:5395: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5427: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -5418,7 +5450,7 @@ fi
# requires -ldl.
if test "$GC" = boehm; then
echo $ac_n "checking for main in -ldl""... $ac_c" 1>&6
-echo "configure:5422: checking for main in -ldl" >&5
+echo "configure:5454: checking for main in -ldl" >&5
ac_lib_var=`echo dl'_'main | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -5426,14 +5458,14 @@ else
ac_save_LIBS="$LIBS"
LIBS="-ldl $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 5430 "configure"
+#line 5462 "configure"
#include "confdefs.h"
int main() {
main()
; return 0; }
EOF
-if { (eval echo configure:5437: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5469: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -5499,7 +5531,7 @@ fi
# Extract the first word of "${ac_tool_prefix}gcj", so it can be a program name with args.
set dummy ${ac_tool_prefix}gcj; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:5503: checking for $ac_word" >&5
+echo "configure:5535: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_GCJ'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -5531,7 +5563,7 @@ if test -n "$ac_tool_prefix"; then
# Extract the first word of "gcj", so it can be a program name with args.
set dummy gcj; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:5535: checking for $ac_word" >&5
+echo "configure:5567: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_GCJ'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -5593,13 +5625,13 @@ exec 5>>./config.log
CPPFLAGS=$GCJ_SAVE_CPPFLAGS
echo $ac_n "checking size of void *""... $ac_c" 1>&6
-echo "configure:5597: checking size of void *" >&5
+echo "configure:5629: checking size of void *" >&5
if eval "test \"`echo '$''{'ac_cv_sizeof_void_p'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
for ac_size in 4 8 1 2 16 12 ; do # List sizes in rough order of prevalence.
cat > conftest.$ac_ext <<EOF
-#line 5603 "configure"
+#line 5635 "configure"
#include "confdefs.h"
#include "confdefs.h"
#include <sys/types.h>
@@ -5609,7 +5641,7 @@ int main() {
switch (0) case 0: case (sizeof (void *) == $ac_size):;
; return 0; }
EOF
-if { (eval echo configure:5613: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5645: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_sizeof_void_p=$ac_size
else
@@ -5710,18 +5742,18 @@ EOF
echo $ac_n "checking for g++ -ffloat-store bug""... $ac_c" 1>&6
-echo "configure:5714: checking for g++ -ffloat-store bug" >&5
+echo "configure:5746: checking for g++ -ffloat-store bug" >&5
save_CFLAGS="$CFLAGS"
CFLAGS="-x c++ -O2 -ffloat-store"
cat > conftest.$ac_ext <<EOF
-#line 5718 "configure"
+#line 5750 "configure"
#include "confdefs.h"
#include <math.h>
int main() {
; return 0; }
EOF
-if { (eval echo configure:5725: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5757: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
echo "$ac_t""no" 1>&6
else
@@ -5737,21 +5769,21 @@ fi
rm -f conftest*
CFLAGS="$save_CFLAGS"
-for ac_hdr in unistd.h bstring.h sys/time.h sys/types.h fcntl.h sys/ioctl.h sys/filio.h sys/stat.h sys/select.h sys/socket.h netinet/in.h arpa/inet.h netdb.h pwd.h sys/config.h stdint.h langinfo.h locale.h
+for ac_hdr in unistd.h bstring.h sys/time.h sys/types.h fcntl.h sys/ioctl.h sys/filio.h sys/stat.h sys/select.h sys/socket.h netinet/in.h arpa/inet.h netdb.h net/if.h pwd.h sys/config.h stdint.h langinfo.h locale.h
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:5745: checking for $ac_hdr" >&5
+echo "configure:5777: checking for $ac_hdr" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 5750 "configure"
+#line 5782 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:5755: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:5787: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
@@ -5781,17 +5813,17 @@ for ac_hdr in dirent.h
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:5785: checking for $ac_hdr" >&5
+echo "configure:5817: checking for $ac_hdr" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 5790 "configure"
+#line 5822 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:5795: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:5827: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
@@ -5821,17 +5853,17 @@ for ac_hdr in inttypes.h
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:5825: checking for $ac_hdr" >&5
+echo "configure:5857: checking for $ac_hdr" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 5830 "configure"
+#line 5862 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:5835: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:5867: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
@@ -5867,12 +5899,12 @@ fi
done
echo $ac_n "checking for sys/wait.h that is POSIX.1 compatible""... $ac_c" 1>&6
-echo "configure:5871: checking for sys/wait.h that is POSIX.1 compatible" >&5
+echo "configure:5903: checking for sys/wait.h that is POSIX.1 compatible" >&5
if eval "test \"`echo '$''{'ac_cv_header_sys_wait_h'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 5876 "configure"
+#line 5908 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <sys/wait.h>
@@ -5888,7 +5920,7 @@ wait (&s);
s = WIFEXITED (s) ? WEXITSTATUS (s) : 1;
; return 0; }
EOF
-if { (eval echo configure:5892: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5924: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_header_sys_wait_h=yes
else
@@ -5910,12 +5942,12 @@ fi
echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
-echo "configure:5914: checking for ANSI C header files" >&5
+echo "configure:5946: checking for ANSI C header files" >&5
if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 5919 "configure"
+#line 5951 "configure"
#include "confdefs.h"
#include <stdlib.h>
#include <stdarg.h>
@@ -5923,7 +5955,7 @@ else
#include <float.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:5927: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:5959: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
@@ -5940,7 +5972,7 @@ rm -f conftest*
if test $ac_cv_header_stdc = yes; then
# SunOS 4.x string.h does not declare mem*, contrary to ANSI.
cat > conftest.$ac_ext <<EOF
-#line 5944 "configure"
+#line 5976 "configure"
#include "confdefs.h"
#include <string.h>
EOF
@@ -5958,7 +5990,7 @@ fi
if test $ac_cv_header_stdc = yes; then
# ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
cat > conftest.$ac_ext <<EOF
-#line 5962 "configure"
+#line 5994 "configure"
#include "confdefs.h"
#include <stdlib.h>
EOF
@@ -5979,7 +6011,7 @@ if test "$cross_compiling" = yes; then
:
else
cat > conftest.$ac_ext <<EOF
-#line 5983 "configure"
+#line 6015 "configure"
#include "confdefs.h"
#include <ctype.h>
#define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
@@ -5990,7 +6022,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2);
exit (0); }
EOF
-if { (eval echo configure:5994: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:6026: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
:
else
@@ -6014,12 +6046,12 @@ EOF
fi
echo $ac_n "checking for ssize_t""... $ac_c" 1>&6
-echo "configure:6018: checking for ssize_t" >&5
+echo "configure:6050: checking for ssize_t" >&5
if eval "test \"`echo '$''{'ac_cv_type_ssize_t'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 6023 "configure"
+#line 6055 "configure"
#include "confdefs.h"
#include <sys/types.h>
#if STDC_HEADERS
@@ -6048,9 +6080,9 @@ fi
echo $ac_n "checking for in_addr_t""... $ac_c" 1>&6
-echo "configure:6052: checking for in_addr_t" >&5
+echo "configure:6084: checking for in_addr_t" >&5
cat > conftest.$ac_ext <<EOF
-#line 6054 "configure"
+#line 6086 "configure"
#include "confdefs.h"
#include <sys/types.h>
#if STDC_HEADERS
@@ -6064,7 +6096,7 @@ int main() {
in_addr_t foo;
; return 0; }
EOF
-if { (eval echo configure:6068: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:6100: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
cat >> confdefs.h <<\EOF
#define HAVE_IN_ADDR_T 1
@@ -6080,16 +6112,16 @@ fi
rm -f conftest*
echo $ac_n "checking whether struct ip_mreq is in netinet/in.h""... $ac_c" 1>&6
-echo "configure:6084: checking whether struct ip_mreq is in netinet/in.h" >&5
+echo "configure:6116: checking whether struct ip_mreq is in netinet/in.h" >&5
cat > conftest.$ac_ext <<EOF
-#line 6086 "configure"
+#line 6118 "configure"
#include "confdefs.h"
#include <netinet/in.h>
int main() {
struct ip_mreq mreq;
; return 0; }
EOF
-if { (eval echo configure:6093: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:6125: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
cat >> confdefs.h <<\EOF
#define HAVE_STRUCT_IP_MREQ 1
@@ -6105,16 +6137,16 @@ fi
rm -f conftest*
echo $ac_n "checking whether struct ipv6_mreq is in netinet/in.h""... $ac_c" 1>&6
-echo "configure:6109: checking whether struct ipv6_mreq is in netinet/in.h" >&5
+echo "configure:6141: checking whether struct ipv6_mreq is in netinet/in.h" >&5
cat > conftest.$ac_ext <<EOF
-#line 6111 "configure"
+#line 6143 "configure"
#include "confdefs.h"
#include <netinet/in.h>
int main() {
struct ipv6_mreq mreq6;
; return 0; }
EOF
-if { (eval echo configure:6118: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:6150: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
cat >> confdefs.h <<\EOF
#define HAVE_STRUCT_IPV6_MREQ 1
@@ -6130,16 +6162,16 @@ fi
rm -f conftest*
echo $ac_n "checking whether struct sockaddr_in6 is in netinet/in.h""... $ac_c" 1>&6
-echo "configure:6134: checking whether struct sockaddr_in6 is in netinet/in.h" >&5
+echo "configure:6166: checking whether struct sockaddr_in6 is in netinet/in.h" >&5
cat > conftest.$ac_ext <<EOF
-#line 6136 "configure"
+#line 6168 "configure"
#include "confdefs.h"
#include <netinet/in.h>
int main() {
struct sockaddr_in6 addr6;
; return 0; }
EOF
-if { (eval echo configure:6143: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:6175: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
cat >> confdefs.h <<\EOF
#define HAVE_INET6 1
@@ -6155,9 +6187,9 @@ fi
rm -f conftest*
echo $ac_n "checking for socklen_t in sys/socket.h""... $ac_c" 1>&6
-echo "configure:6159: checking for socklen_t in sys/socket.h" >&5
+echo "configure:6191: checking for socklen_t in sys/socket.h" >&5
cat > conftest.$ac_ext <<EOF
-#line 6161 "configure"
+#line 6193 "configure"
#include "confdefs.h"
#define _POSIX_PII_SOCKET
#include <sys/types.h>
@@ -6166,7 +6198,7 @@ int main() {
socklen_t x = 5;
; return 0; }
EOF
-if { (eval echo configure:6170: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:6202: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
cat >> confdefs.h <<\EOF
#define HAVE_SOCKLEN_T 1
@@ -6182,16 +6214,16 @@ fi
rm -f conftest*
echo $ac_n "checking for tm_gmtoff in struct tm""... $ac_c" 1>&6
-echo "configure:6186: checking for tm_gmtoff in struct tm" >&5
+echo "configure:6218: checking for tm_gmtoff in struct tm" >&5
cat > conftest.$ac_ext <<EOF
-#line 6188 "configure"
+#line 6220 "configure"
#include "confdefs.h"
#include <time.h>
int main() {
struct tm tim; tim.tm_gmtoff = 0;
; return 0; }
EOF
-if { (eval echo configure:6195: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:6227: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
cat >> confdefs.h <<\EOF
#define STRUCT_TM_HAS_GMTOFF 1
@@ -6204,16 +6236,16 @@ else
rm -rf conftest*
echo "$ac_t""no" 1>&6
echo $ac_n "checking for global timezone variable""... $ac_c" 1>&6
-echo "configure:6208: checking for global timezone variable" >&5
+echo "configure:6240: checking for global timezone variable" >&5
cat > conftest.$ac_ext <<EOF
-#line 6210 "configure"
+#line 6242 "configure"
#include "confdefs.h"
#include <time.h>
int main() {
void i(){long z2 = 2*timezone;}
; return 0; }
EOF
-if { (eval echo configure:6217: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:6249: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
cat >> confdefs.h <<\EOF
#define HAVE_TIMEZONE 1
@@ -6226,16 +6258,16 @@ else
rm -rf conftest*
echo "$ac_t""no" 1>&6
echo $ac_n "checking for global _timezone variable""... $ac_c" 1>&6
-echo "configure:6230: checking for global _timezone variable" >&5
+echo "configure:6262: checking for global _timezone variable" >&5
cat > conftest.$ac_ext <<EOF
-#line 6232 "configure"
+#line 6264 "configure"
#include "confdefs.h"
#include <time.h>
int main() {
long z2 = _timezone;
; return 0; }
EOF
-if { (eval echo configure:6239: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:6271: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
cat >> confdefs.h <<\EOF
#define HAVE_UNDERSCORE_TIMEZONE 1
@@ -6257,19 +6289,19 @@ rm -f conftest*
# The Ultrix 4.2 mips builtin alloca declared by alloca.h only works
# for constant arguments. Useless!
echo $ac_n "checking for working alloca.h""... $ac_c" 1>&6
-echo "configure:6261: checking for working alloca.h" >&5
+echo "configure:6293: checking for working alloca.h" >&5
if eval "test \"`echo '$''{'ac_cv_header_alloca_h'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 6266 "configure"
+#line 6298 "configure"
#include "confdefs.h"
#include <alloca.h>
int main() {
char *p = alloca(2 * sizeof(int));
; return 0; }
EOF
-if { (eval echo configure:6273: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6305: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
ac_cv_header_alloca_h=yes
else
@@ -6290,12 +6322,12 @@ EOF
fi
echo $ac_n "checking for alloca""... $ac_c" 1>&6
-echo "configure:6294: checking for alloca" >&5
+echo "configure:6326: checking for alloca" >&5
if eval "test \"`echo '$''{'ac_cv_func_alloca_works'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 6299 "configure"
+#line 6331 "configure"
#include "confdefs.h"
#ifdef __GNUC__
@@ -6323,7 +6355,7 @@ int main() {
char *p = (char *) alloca(1);
; return 0; }
EOF
-if { (eval echo configure:6327: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6359: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
ac_cv_func_alloca_works=yes
else
@@ -6355,12 +6387,12 @@ EOF
echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6
-echo "configure:6359: checking whether alloca needs Cray hooks" >&5
+echo "configure:6391: checking whether alloca needs Cray hooks" >&5
if eval "test \"`echo '$''{'ac_cv_os_cray'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 6364 "configure"
+#line 6396 "configure"
#include "confdefs.h"
#if defined(CRAY) && ! defined(CRAY2)
webecray
@@ -6385,12 +6417,12 @@ echo "$ac_t""$ac_cv_os_cray" 1>&6
if test $ac_cv_os_cray = yes; then
for ac_func in _getb67 GETB67 getb67; do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:6389: checking for $ac_func" >&5
+echo "configure:6421: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 6394 "configure"
+#line 6426 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -6413,7 +6445,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:6417: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6449: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -6440,7 +6472,7 @@ done
fi
echo $ac_n "checking stack direction for C alloca""... $ac_c" 1>&6
-echo "configure:6444: checking stack direction for C alloca" >&5
+echo "configure:6476: checking stack direction for C alloca" >&5
if eval "test \"`echo '$''{'ac_cv_c_stack_direction'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -6448,7 +6480,7 @@ else
ac_cv_c_stack_direction=0
else
cat > conftest.$ac_ext <<EOF
-#line 6452 "configure"
+#line 6484 "configure"
#include "confdefs.h"
find_stack_direction ()
{
@@ -6467,7 +6499,7 @@ main ()
exit (find_stack_direction() < 0);
}
EOF
-if { (eval echo configure:6471: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:6503: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
ac_cv_c_stack_direction=1
else
@@ -6494,7 +6526,7 @@ do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:6498: checking for $ac_word" >&5
+echo "configure:6530: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_PERL'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -6556,6 +6588,9 @@ case "${host}" in
sparc*-*-linux*)
SIGNAL_HANDLER=include/dwarf2-signal.h
;;
+ sh-*-linux* | sh[34]*-*-linux*)
+ SIGNAL_HANDLER=include/dwarf2-signal.h
+ ;;
*mingw*)
SIGNAL_HANDLER=include/win32-signal.h
;;
@@ -6584,7 +6619,7 @@ fi
# Uses ac_ vars as temps to allow command line to override cache and checks.
# --without-x overrides everything else, but does not touch the cache.
echo $ac_n "checking for X""... $ac_c" 1>&6
-echo "configure:6588: checking for X" >&5
+echo "configure:6623: checking for X" >&5
# Check whether --with-x or --without-x was given.
if test "${with_x+set}" = set; then
@@ -6646,12 +6681,12 @@ if test "$ac_x_includes" = NO; then
# First, try using that file with no special directory specified.
cat > conftest.$ac_ext <<EOF
-#line 6650 "configure"
+#line 6685 "configure"
#include "confdefs.h"
#include <$x_direct_test_include>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:6655: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:6690: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
@@ -6720,14 +6755,14 @@ if test "$ac_x_libraries" = NO; then
ac_save_LIBS="$LIBS"
LIBS="-l$x_direct_test_library $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 6724 "configure"
+#line 6759 "configure"
#include "confdefs.h"
int main() {
${x_direct_test_function}()
; return 0; }
EOF
-if { (eval echo configure:6731: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6766: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
LIBS="$ac_save_LIBS"
# We can link X programs with no special library path.
@@ -6833,17 +6868,17 @@ else
case "`(uname -sr) 2>/dev/null`" in
"SunOS 5"*)
echo $ac_n "checking whether -R must be followed by a space""... $ac_c" 1>&6
-echo "configure:6837: checking whether -R must be followed by a space" >&5
+echo "configure:6872: checking whether -R must be followed by a space" >&5
ac_xsave_LIBS="$LIBS"; LIBS="$LIBS -R$x_libraries"
cat > conftest.$ac_ext <<EOF
-#line 6840 "configure"
+#line 6875 "configure"
#include "confdefs.h"
int main() {
; return 0; }
EOF
-if { (eval echo configure:6847: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6882: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
ac_R_nospace=yes
else
@@ -6859,14 +6894,14 @@ rm -f conftest*
else
LIBS="$ac_xsave_LIBS -R $x_libraries"
cat > conftest.$ac_ext <<EOF
-#line 6863 "configure"
+#line 6898 "configure"
#include "confdefs.h"
int main() {
; return 0; }
EOF
-if { (eval echo configure:6870: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6905: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
ac_R_space=yes
else
@@ -6898,7 +6933,7 @@ rm -f conftest*
# libraries were built with DECnet support. And karl@cs.umb.edu says
# the Alpha needs dnet_stub (dnet does not exist).
echo $ac_n "checking for dnet_ntoa in -ldnet""... $ac_c" 1>&6
-echo "configure:6902: checking for dnet_ntoa in -ldnet" >&5
+echo "configure:6937: checking for dnet_ntoa in -ldnet" >&5
ac_lib_var=`echo dnet'_'dnet_ntoa | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -6906,7 +6941,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-ldnet $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 6910 "configure"
+#line 6945 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@@ -6917,7 +6952,7 @@ int main() {
dnet_ntoa()
; return 0; }
EOF
-if { (eval echo configure:6921: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6956: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -6939,7 +6974,7 @@ fi
if test $ac_cv_lib_dnet_dnet_ntoa = no; then
echo $ac_n "checking for dnet_ntoa in -ldnet_stub""... $ac_c" 1>&6
-echo "configure:6943: checking for dnet_ntoa in -ldnet_stub" >&5
+echo "configure:6978: checking for dnet_ntoa in -ldnet_stub" >&5
ac_lib_var=`echo dnet_stub'_'dnet_ntoa | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -6947,7 +6982,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-ldnet_stub $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 6951 "configure"
+#line 6986 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@@ -6958,7 +6993,7 @@ int main() {
dnet_ntoa()
; return 0; }
EOF
-if { (eval echo configure:6962: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6997: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -6987,12 +7022,12 @@ fi
# The nsl library prevents programs from opening the X display
# on Irix 5.2, according to dickey@clark.net.
echo $ac_n "checking for gethostbyname""... $ac_c" 1>&6
-echo "configure:6991: checking for gethostbyname" >&5
+echo "configure:7026: checking for gethostbyname" >&5
if eval "test \"`echo '$''{'ac_cv_func_gethostbyname'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 6996 "configure"
+#line 7031 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char gethostbyname(); below. */
@@ -7015,7 +7050,7 @@ gethostbyname();
; return 0; }
EOF
-if { (eval echo configure:7019: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:7054: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_gethostbyname=yes"
else
@@ -7036,7 +7071,7 @@ fi
if test $ac_cv_func_gethostbyname = no; then
echo $ac_n "checking for gethostbyname in -lnsl""... $ac_c" 1>&6
-echo "configure:7040: checking for gethostbyname in -lnsl" >&5
+echo "configure:7075: checking for gethostbyname in -lnsl" >&5
ac_lib_var=`echo nsl'_'gethostbyname | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -7044,7 +7079,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lnsl $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 7048 "configure"
+#line 7083 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@@ -7055,7 +7090,7 @@ int main() {
gethostbyname()
; return 0; }
EOF
-if { (eval echo configure:7059: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:7094: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -7085,12 +7120,12 @@ fi
# -lsocket must be given before -lnsl if both are needed.
# We assume that if connect needs -lnsl, so does gethostbyname.
echo $ac_n "checking for connect""... $ac_c" 1>&6
-echo "configure:7089: checking for connect" >&5
+echo "configure:7124: checking for connect" >&5
if eval "test \"`echo '$''{'ac_cv_func_connect'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 7094 "configure"
+#line 7129 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char connect(); below. */
@@ -7113,7 +7148,7 @@ connect();
; return 0; }
EOF
-if { (eval echo configure:7117: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:7152: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_connect=yes"
else
@@ -7134,7 +7169,7 @@ fi
if test $ac_cv_func_connect = no; then
echo $ac_n "checking for connect in -lsocket""... $ac_c" 1>&6
-echo "configure:7138: checking for connect in -lsocket" >&5
+echo "configure:7173: checking for connect in -lsocket" >&5
ac_lib_var=`echo socket'_'connect | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -7142,7 +7177,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lsocket $X_EXTRA_LIBS $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 7146 "configure"
+#line 7181 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@@ -7153,7 +7188,7 @@ int main() {
connect()
; return 0; }
EOF
-if { (eval echo configure:7157: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:7192: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -7177,12 +7212,12 @@ fi
# gomez@mi.uni-erlangen.de says -lposix is necessary on A/UX.
echo $ac_n "checking for remove""... $ac_c" 1>&6
-echo "configure:7181: checking for remove" >&5
+echo "configure:7216: checking for remove" >&5
if eval "test \"`echo '$''{'ac_cv_func_remove'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 7186 "configure"
+#line 7221 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char remove(); below. */
@@ -7205,7 +7240,7 @@ remove();
; return 0; }
EOF
-if { (eval echo configure:7209: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:7244: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_remove=yes"
else
@@ -7226,7 +7261,7 @@ fi
if test $ac_cv_func_remove = no; then
echo $ac_n "checking for remove in -lposix""... $ac_c" 1>&6
-echo "configure:7230: checking for remove in -lposix" >&5
+echo "configure:7265: checking for remove in -lposix" >&5
ac_lib_var=`echo posix'_'remove | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -7234,7 +7269,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lposix $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 7238 "configure"
+#line 7273 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@@ -7245,7 +7280,7 @@ int main() {
remove()
; return 0; }
EOF
-if { (eval echo configure:7249: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:7284: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -7269,12 +7304,12 @@ fi
# BSDI BSD/OS 2.1 needs -lipc for XOpenDisplay.
echo $ac_n "checking for shmat""... $ac_c" 1>&6
-echo "configure:7273: checking for shmat" >&5
+echo "configure:7308: checking for shmat" >&5
if eval "test \"`echo '$''{'ac_cv_func_shmat'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 7278 "configure"
+#line 7313 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char shmat(); below. */
@@ -7297,7 +7332,7 @@ shmat();
; return 0; }
EOF
-if { (eval echo configure:7301: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:7336: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_shmat=yes"
else
@@ -7318,7 +7353,7 @@ fi
if test $ac_cv_func_shmat = no; then
echo $ac_n "checking for shmat in -lipc""... $ac_c" 1>&6
-echo "configure:7322: checking for shmat in -lipc" >&5
+echo "configure:7357: checking for shmat in -lipc" >&5
ac_lib_var=`echo ipc'_'shmat | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -7326,7 +7361,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lipc $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 7330 "configure"
+#line 7365 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@@ -7337,7 +7372,7 @@ int main() {
shmat()
; return 0; }
EOF
-if { (eval echo configure:7341: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:7376: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -7370,7 +7405,7 @@ fi
# libraries we check for below, so use a different variable.
# --interran@uluru.Stanford.EDU, kb@cs.umb.edu.
echo $ac_n "checking for IceConnectionNumber in -lICE""... $ac_c" 1>&6
-echo "configure:7374: checking for IceConnectionNumber in -lICE" >&5
+echo "configure:7409: checking for IceConnectionNumber in -lICE" >&5
ac_lib_var=`echo ICE'_'IceConnectionNumber | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -7378,7 +7413,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lICE $X_EXTRA_LIBS $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 7382 "configure"
+#line 7417 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@@ -7389,7 +7424,7 @@ int main() {
IceConnectionNumber()
; return 0; }
EOF
-if { (eval echo configure:7393: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:7428: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
diff --git a/libjava/configure.host b/libjava/configure.host
index 5baabd46be1..8f3f3bb9ad2 100644
--- a/libjava/configure.host
+++ b/libjava/configure.host
@@ -65,6 +65,16 @@ CHECKREFSPEC=
# This case statement supports per-CPU defaults.
case "${host}" in
+ arm*-elf | strongarm*-elf | xscale*-elf)
+ with_libffi_default=no
+ PROCESS=Ecos
+ FILE=Posix
+ CHECKREFSPEC=-fcheck-references
+ EXCEPTIONSPEC=
+ enable_java_net_default=no
+ enable_getenv_properties_default=no
+ enable_main_args_default=no
+ ;;
mips-tx39-*|mipstx39-unknown-*)
libgcj_flags="${libgcj_flags} -G 0"
LDFLAGS="$LDFLAGS -Tjmr3904dram.ld"
@@ -117,6 +127,11 @@ case "${host}" in
enable_hash_synchronization_default=yes
slow_pthread_self=yes
;;
+ s390*-*)
+ sysdeps_dir=s390
+ libgcj_interpreter=yes
+ enable_hash_synchronization_default=yes
+ ;;
sparc-*)
;;
ia64-*)
@@ -125,22 +140,10 @@ case "${host}" in
libgcj_interpreter=yes
enable_hash_synchronization_default=yes
;;
- xscale*-elf)
- with_libffi_default=no
- PROCESS=Ecos
- FILE=Posix
- CHECKREFSPEC=-fcheck-references
- EXCEPTIONSPEC=
- enable_java_net_default=no
- enable_getenv_properties_default=no
- enable_main_args_default=no
- ;;
sh-* | sh[34]*-*)
sysdeps_dir=sh
libgcj_flags="${libgcj_flags} -mieee"
libgcj_interpreter=yes
- CHECKREFSPEC=-fcheck-references
- EXCEPTIONSPEC=
enable_hash_synchronization_default=yes
;;
esac
@@ -156,7 +159,8 @@ case "${host}" in
s390*-linux* | \
sparc*-linux* | \
ia64-* | \
- x86_64*-linux*)
+ x86_64*-linux* | \
+ sh-linux* | sh[34]*-linux*)
can_unwind_signal=yes
;;
*-*-darwin*)
diff --git a/libjava/configure.in b/libjava/configure.in
index 752739ba265..868dc1cffde 100644
--- a/libjava/configure.in
+++ b/libjava/configure.in
@@ -226,6 +226,7 @@ case "$TARGET_ECOS" in
PLATFORM=Win32
PLATFORMOBJS=win32.lo
PLATFORMH=win32.h
+ CHECK_FOR_BROKEN_MINGW_LD
;;
*)
PLATFORM=Posix
@@ -444,7 +445,7 @@ AC_LINK_FILES(sysdep/$sysdeps_dir/locks.h, sysdep/locks.h)
HASH_SYNC_SPEC=
# Hash synchronization is only useful with posix threads right now.
-if test "$enable_hash_synchronization" = yes && test "$THREADS" = "posix"; then
+if test "$enable_hash_synchronization" = yes && test "$THREADS" != "none"; then
HASH_SYNC_SPEC=-fhash-synchronization
AC_DEFINE(JV_HASH_SYNCHRONIZATION, 1, [Define if hash synchronization is in use])
fi
@@ -507,7 +508,7 @@ else
AC_CHECK_FUNCS(nl_langinfo setlocale)
AC_CHECK_FUNCS(inet_aton inet_addr, break)
AC_CHECK_FUNCS(inet_pton uname inet_ntoa)
- AC_CHECK_FUNCS(fork execvp pipe sigaction)
+ AC_CHECK_FUNCS(fork execvp pipe sigaction ftruncate)
AC_CHECK_HEADERS(execinfo.h unistd.h dlfcn.h)
AC_CHECK_FUNC(backtrace, [
case "$host" in
@@ -813,7 +814,7 @@ CFLAGS="$save_CFLAGS"
dnl We check for sys/filio.h because Solaris 2.5 defines FIONREAD there.
dnl On that system, sys/ioctl.h will not include sys/filio.h unless
dnl BSD_COMP is defined; just including sys/filio.h is simpler.
-AC_CHECK_HEADERS(unistd.h bstring.h sys/time.h sys/types.h fcntl.h sys/ioctl.h sys/filio.h sys/stat.h sys/select.h sys/socket.h netinet/in.h arpa/inet.h netdb.h pwd.h sys/config.h stdint.h langinfo.h locale.h)
+AC_CHECK_HEADERS(unistd.h bstring.h sys/time.h sys/types.h fcntl.h sys/ioctl.h sys/filio.h sys/stat.h sys/select.h sys/socket.h netinet/in.h arpa/inet.h netdb.h net/if.h pwd.h sys/config.h stdint.h langinfo.h locale.h)
dnl We avoid AC_HEADER_DIRENT since we really only care about dirent.h
dnl for now. If you change this, you also must update natFile.cc.
AC_CHECK_HEADERS(dirent.h)
@@ -920,6 +921,9 @@ case "${host}" in
sparc*-*-linux*)
SIGNAL_HANDLER=include/dwarf2-signal.h
;;
+ sh-*-linux* | sh[[34]]*-*-linux*)
+ SIGNAL_HANDLER=include/dwarf2-signal.h
+ ;;
*mingw*)
SIGNAL_HANDLER=include/win32-signal.h
;;
diff --git a/libjava/defineclass.cc b/libjava/defineclass.cc
index 95e671f42a3..6a250dadda6 100644
--- a/libjava/defineclass.cc
+++ b/libjava/defineclass.cc
@@ -35,7 +35,6 @@ details. */
#include <java/lang/ClassFormatError.h>
#include <java/lang/NoClassDefFoundError.h>
#include <java/lang/ClassCircularityError.h>
-#include <java/lang/ClassNotFoundException.h>
#include <java/lang/IncompatibleClassChangeError.h>
#include <java/lang/reflect/Modifier.h>
diff --git a/libjava/gcj/.cvsignore b/libjava/gcj/.cvsignore
new file mode 100644
index 00000000000..7b7bb5ad25f
--- /dev/null
+++ b/libjava/gcj/.cvsignore
@@ -0,0 +1 @@
+stamp-h2.in
diff --git a/libjava/gcj/javaprims.h b/libjava/gcj/javaprims.h
index 99442c5ca2a..8ed649432a2 100644
--- a/libjava/gcj/javaprims.h
+++ b/libjava/gcj/javaprims.h
@@ -211,6 +211,7 @@ extern "Java"
class UnsupportedOperationException;
class VMClassLoader;
class VMSecurityManager;
+ class VMThrowable;
class VerifyError;
class VirtualMachineError;
class Void;
@@ -229,11 +230,16 @@ extern "Java"
class Array;
class Constructor;
class Field;
+ class InvocationHandler;
class InvocationTargetException;
class Member;
class Method;
class Modifier;
+ class Proxy;
+ class Proxy$ProxyData;
+ class Proxy$ProxyType;
class ReflectPermission;
+ class UndeclaredThrowableException;
};
};
diff --git a/libjava/gij.cc b/libjava/gij.cc
index bb56b112b6d..293f3c30fd8 100644
--- a/libjava/gij.cc
+++ b/libjava/gij.cc
@@ -28,11 +28,15 @@ help ()
printf (" to interpret Java bytecodes, or\n");
printf (" gij -jar [OPTION] ... JARFILE [ARGS] ...\n");
printf (" to execute a jar file\n\n");
+ printf (" --cp LIST set class path\n");
+ printf (" --classpath LIST set class path\n");
printf (" -DVAR=VAL define property VAR with value VAL\n");
printf (" --help print this help, then exit\n");
printf (" --ms=NUMBER set initial heap size\n");
printf (" --mx=NUMBER set maximum heap size\n");
+ printf (" --showversion print version number, then keep going\n");
printf (" --version print version number, then exit\n");
+ printf ("\nOptions can be specified with `-' or `--'.\n");
printf ("\nSee http://gcc.gnu.org/java/ for information on reporting bugs\n");
exit (0);
}
@@ -44,7 +48,6 @@ version ()
printf ("Copyright (C) 2002 Free Software Foundation, Inc.\n");
printf ("This is free software; see the source for copying conditions. There is NO\n");
printf ("warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n");
- exit (0);
}
int
@@ -90,6 +93,11 @@ main (int argc, const char **argv)
if (! strcmp (arg, "-help"))
help ();
else if (! strcmp (arg, "-version"))
+ {
+ version ();
+ exit (0);
+ }
+ else if (! strcmp (arg, "-showversion"))
version ();
/* FIXME: use getopt and avoid the ugliness here.
We at least need to handle the argument in a better way. */
@@ -115,6 +123,15 @@ main (int argc, const char **argv)
goto no_arg;
_Jv_SetMaximumHeapSize (argv[++i]);
}
+ else if (! strcmp (arg, "-cp") || ! strcmp (arg, "-classpath"))
+ {
+ if (i >= argc - 1)
+ goto no_arg;
+ // We set _Jv_Jar_Class_Path. If the user specified `-jar'
+ // then the jar code will override this. This is the
+ // correct behavior.
+ _Jv_Jar_Class_Path = argv[++i];
+ }
else
{
fprintf (stderr, "gij: unrecognized option -- `%s'\n", argv[i]);
diff --git a/libjava/gnu/classpath/Configuration.java.in b/libjava/gnu/classpath/Configuration.java.in
index 4ea692357d1..1002b62bd8b 100644
--- a/libjava/gnu/classpath/Configuration.java.in
+++ b/libjava/gnu/classpath/Configuration.java.in
@@ -51,4 +51,9 @@ public interface Configuration
// For libgcj we never load the JNI libraries.
boolean INIT_LOAD_LIBRARY = false;
+
+ // For libgcj we have native methods for proxy support....
+ boolean HAVE_NATIVE_GET_PROXY_DATA = false;
+ boolean HAVE_NATIVE_GET_PROXY_CLASS = false;
+ boolean HAVE_NATIVE_GENERATE_PROXY_CLASS = false;
}
diff --git a/libjava/gnu/gcj/protocol/core/Connection.java b/libjava/gnu/gcj/protocol/core/Connection.java
index 6513e336214..5bcbb8611c7 100644
--- a/libjava/gnu/gcj/protocol/core/Connection.java
+++ b/libjava/gnu/gcj/protocol/core/Connection.java
@@ -13,6 +13,7 @@ package gnu.gcj.protocol.core;
import gnu.gcj.Core;
import java.net.*;
import java.io.*;
+import java.util.Map;
import java.util.Vector;
import java.util.Hashtable;
import java.util.Enumeration;
@@ -72,6 +73,20 @@ class Connection extends URLConnection
}
// Override default method in URLConnection.
+ public Map getHeaderFields()
+ {
+ try
+ {
+ getHeaders();
+ }
+ catch (IOException x)
+ {
+ return null;
+ }
+ return hdrHash;
+ }
+
+ // Override default method in URLConnection.
public String getHeaderField(int n)
{
try
diff --git a/libjava/gnu/gcj/protocol/file/Connection.java b/libjava/gnu/gcj/protocol/file/Connection.java
index 5510c5d74ea..4fcdb11ed52 100644
--- a/libjava/gnu/gcj/protocol/file/Connection.java
+++ b/libjava/gnu/gcj/protocol/file/Connection.java
@@ -12,6 +12,7 @@ package gnu.gcj.protocol.file;
import java.net.*;
import java.io.*;
+import java.util.Map;
import java.util.Vector;
import java.util.Hashtable;
import java.util.Enumeration;
@@ -96,6 +97,20 @@ class Connection extends URLConnection
}
// Override default method in URLConnection.
+ public Map getHeaderFields()
+ {
+ try
+ {
+ getHeaders();
+ }
+ catch (IOException x)
+ {
+ return null;
+ }
+ return hdrHash;
+ }
+
+ // Override default method in URLConnection.
public String getHeaderField(int n)
{
try
diff --git a/libjava/gnu/gcj/protocol/http/Connection.java b/libjava/gnu/gcj/protocol/http/Connection.java
index 10fbfd66723..caababa6823 100644
--- a/libjava/gnu/gcj/protocol/http/Connection.java
+++ b/libjava/gnu/gcj/protocol/http/Connection.java
@@ -12,6 +12,7 @@ package gnu.gcj.protocol.http;
import java.net.*;
import java.io.*;
+import java.util.Map;
import java.util.Vector;
import java.util.Hashtable;
import java.util.Enumeration;
@@ -168,6 +169,22 @@ class Connection extends HttpURLConnection
}
// Override default method in URLConnection.
+ public Map getHeaderFields()
+ {
+ if (!connected)
+ try
+ {
+ connect();
+ }
+ catch (IOException x)
+ {
+ return null;
+ }
+
+ return hdrHash;
+ }
+
+ // Override default method in URLConnection.
public String getHeaderField(int n)
{
if (!connected)
diff --git a/libjava/gnu/gcj/runtime/NameFinder.java b/libjava/gnu/gcj/runtime/NameFinder.java
new file mode 100644
index 00000000000..1d729d252ac
--- /dev/null
+++ b/libjava/gnu/gcj/runtime/NameFinder.java
@@ -0,0 +1,548 @@
+/* NameFinder.java -- Translates addresses to StackTraceElements.
+ Copyright (C) 2002 Free Software Foundation, Inc.
+
+ 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. */
+
+package gnu.gcj.runtime;
+
+import gnu.gcj.RawData;
+
+import java.lang.StringBuffer;
+
+import java.io.BufferedReader;
+import java.io.BufferedWriter;
+import java.io.InputStreamReader;
+import java.io.OutputStreamWriter;
+import java.io.IOException;
+import java.io.File;
+
+/**
+ * Helper class that translates addresses (represented as longs) to a
+ * StackTraceElement array.
+ *
+ * There are a couple of system properties that can be set to manipulate the
+ * result (all default to true):
+ * <li>
+ * <ul><code>gnu.gcj.runtime.NameFinder.demangle</code>
+ * Whether names should be demangled.</ul>
+ * <ul><code>gnu.gcj.runtime.NameFinder.sanitize</code></ul>
+ * Whether calls to initialize exceptions and starting the runtime system
+ * should be removed from the stack trace. Only done when names are
+ * demangled.</ul>
+ * <ul><code>gnu.gcj.runtime.NameFinder.remove_unknown</code>
+ * Whether calls to unknown functions (class and method names are unknown)
+ * should be removed from the stack trace. Only done when the stack is
+ * sanitized.</ul>
+ * <ul><code>gnu.gcj.runtime.NameFinder.remove_interpreter</code>
+ * Whether runtime interpreter calls (methods in the _Jv_InterpMethod class
+ * and functions starting with 'ffi_') should be removed from the stack
+ * trace. Only done when the stack is sanitized.</ul>
+ * <ul><code>gnu.gcj.runtime.NameFinder.use_addr2line</code>
+ * Whether an external process (addr2line or addr2name.awk) should be used
+ * as fallback to convert the addresses to function names when the runtime
+ * is unable to do it through <code>dladdr</code>.</ul>
+ * </li>
+ *
+ * <code>close()</code> should be called to get rid of all resources.
+ *
+ * This class is used from <code>java.lang.VMThrowable</code>.
+ *
+ * Currently the <code>lookup(long[])</code> method is not thread safe.
+ * It can easily be made thread safe by synchronizing access to all external
+ * processes when used.
+ *
+ * @author Mark Wielaard (mark@klomp.org)
+ */
+public class NameFinder
+{
+ // Set these to false when not needed.
+ private static final boolean demangle
+ = Boolean.valueOf(System.getProperty
+ ("gnu.gcj.runtime.NameFinder.demangle", "true")
+ ).booleanValue();
+ private static final boolean sanitize
+ = Boolean.valueOf(System.getProperty
+ ("gnu.gcj.runtime.NameFinder.sanitize", "true")
+ ).booleanValue();
+ private static final boolean remove_unknown
+ = Boolean.valueOf(System.getProperty
+ ("gnu.gcj.runtime.NameFinder.remove_unknown", "true")
+ ).booleanValue();
+ private static final boolean remove_interpreter
+ = Boolean.valueOf(System.getProperty
+ ("gnu.gcj.runtime.NameFinder.remove_interpreter", "true")
+ ).booleanValue();
+ private static final boolean use_addr2line
+ = Boolean.valueOf(System.getProperty
+ ("gnu.gcj.runtime.NameFinder.use_addr2line", "true")
+ ).booleanValue();
+
+ /**
+ * The name of the currently running executable.
+ */
+ private final String executable;
+
+ /**
+ * Process used for demangling names.
+ */
+ private Process cppfilt;
+
+ private BufferedWriter cppfiltOut;
+ private BufferedReader cppfiltIn;
+
+ /**
+ * Process used for translating addresses to function/file names.
+ */
+ private Process addr2line;
+
+ private BufferedWriter addr2lineOut;
+ private BufferedReader addr2lineIn;
+
+ /**
+ * Creates a new NameFinder. Call close to get rid of any resources
+ * created while using the <code>lookup</code> methods.
+ */
+ public NameFinder()
+ {
+ executable = getExecutable();
+ Runtime runtime = Runtime.getRuntime();
+ if (demangle)
+ {
+ try
+ {
+ String[] exec = new String[] {"c++filt", "-s", "java"};
+ cppfilt = runtime.exec(exec);
+ cppfiltIn = new BufferedReader
+ (new InputStreamReader(cppfilt.getInputStream()));
+ cppfiltOut = new BufferedWriter
+ (new OutputStreamWriter(cppfilt.getOutputStream()));
+ }
+ catch (IOException ioe)
+ {
+ if (cppfilt != null)
+ cppfilt.destroy();
+ cppfilt = null;
+ }
+ }
+
+ if (use_addr2line)
+ {
+ try
+ {
+ String[] exec = new String[] {"addr2line", "-f", "-e", executable};
+ addr2line = runtime.exec(exec);
+ }
+ catch (IOException ioe)
+ {
+ try
+ {
+ String[] exec = new String[] {"addr2name.awk", executable};
+ addr2line = runtime.exec(exec);
+ }
+ catch (IOException ioe2) { addr2line = null; }
+ }
+
+ if (addr2line != null)
+ {
+ try
+ {
+ addr2lineIn = new BufferedReader
+ (new InputStreamReader(addr2line.getInputStream()));
+ addr2lineOut = new BufferedWriter
+ (new OutputStreamWriter(addr2line.getOutputStream()));
+ }
+ catch (IOException ioe)
+ {
+ addr2line.destroy();
+ addr2line = null;
+ }
+ }
+ }
+ }
+
+ /**
+ * Returns the name of the currently running process.
+ */
+ native private static String getExecutable();
+
+ /**
+ * Tries to use dladdr to create the nth StackTraceElement from the given
+ * addresses. Returns null on failure.
+ */
+ native private StackTraceElement dladdrLookup(RawData addrs, int n);
+
+ /**
+ * Returns the nth element from the stack as a hex encoded String.
+ */
+ native private String getAddrAsString(RawData addrs, int n);
+
+ /**
+ * If nth element of stack is an interpreted frame, return the
+ * element representing the method being interpreted.
+ */
+ native private StackTraceElement lookupInterp(RawData addrs, int n);
+
+ /**
+ * Creates the nth StackTraceElement from the given native stacktrace.
+ */
+ private StackTraceElement lookup(RawData addrs, int n)
+ {
+ StackTraceElement result;
+
+ result = lookupInterp(addrs, n);
+ if (result == null)
+ result = dladdrLookup(addrs, n);
+ if (result == null)
+ {
+ String name = null;
+ String file = null;
+
+ String hex = getAddrAsString(addrs, n);
+
+ if (addr2line != null)
+ {
+ try
+ {
+ addr2lineOut.write(hex);
+ addr2lineOut.newLine();
+ addr2lineOut.flush();
+ name = addr2lineIn.readLine();
+ file = addr2lineIn.readLine();
+ }
+ catch (IOException ioe) { addr2line = null; }
+ }
+
+ if (name == null || "??".equals(name))
+ name = hex;
+
+ result = createStackTraceElement(name, file);
+ }
+
+ return result;
+ }
+
+ /**
+ * Given an Throwable and a native stacktrace returns an array of
+ * StackTraceElement containing class, method, file and linenumbers.
+ */
+ public StackTraceElement[] lookup(Throwable t, RawData addrs, int length)
+ {
+ StackTraceElement[] elements = new StackTraceElement[length];
+ for (int i=0; i < length; i++)
+ elements[i] = lookup(addrs, i);
+
+ if (demangle && sanitize)
+ return sanitizeStack(elements, t);
+ else
+ return elements;
+ }
+
+
+ /**
+ * Removes calls to initialize exceptions and the runtime system from
+ * the stack trace including stack frames of which nothing usefull is known.
+ * Throw away the top of the stack till we find the constructor(s)
+ * of this Throwable or at least the contructors of java.lang.Throwable
+ * or the actual fillInStackTrace call.
+ * Also throw away from the top everything before and including a runtime
+ * _Jv_Throw call.
+ */
+ private static StackTraceElement[] sanitizeStack(StackTraceElement[] elements,
+ Throwable t)
+ {
+ StackTraceElement[] stack;
+
+ String className = t.getClass().getName();
+ String consName;
+ int lastDot = className.lastIndexOf('.');
+ if (lastDot == -1)
+ consName = className + '(';
+ else
+ consName = className.substring(lastDot + 1) + '(';
+
+ int unknown = 0;
+ int interpreter = 0;
+ int last_throw = -1;
+ int length = elements.length;
+ int end = length-1;
+ for (int i = 0; i < length; i++)
+ {
+ String CName = elements[i].getClassName();
+ String MName = elements[i].getMethodName();
+ if ((CName == null && MName != null && MName.startsWith("_Jv_Throw"))
+ ||
+ (CName != null
+ && (CName.equals(className)
+ || CName.equals("java.lang.Throwable")
+ || CName.equals("java.lang.VMThrowable"))
+ && MName != null
+ && (MName.startsWith(consName)
+ || MName.startsWith("Throwable(")
+ || MName.startsWith("fillInStackTrace("))))
+ {
+ last_throw = i;
+ // Reset counting of unknown and interpreter frames.
+ unknown = 0;
+ interpreter = 0;
+ }
+ else if (remove_unknown && CName == null
+ && (MName == null || MName.startsWith("0x")))
+ unknown++;
+ else if (remove_interpreter
+ && ((CName == null
+ && MName != null && MName.startsWith("ffi_"))
+ || (CName != null && CName.equals("_Jv_InterpMethod"))))
+ interpreter++;
+ else if ("main(java.lang.String[])".equals(MName))
+ {
+ end = i;
+ break;
+ }
+ }
+ int begin = last_throw+1;
+
+ // Now filter out everything at the start and the end that is not part
+ // of the "normal" user program including any elements that are interpreter
+ // calls or have no usefull information whatsoever.
+ // Unless that means we filter out all info.
+ int nr_elements = end-begin-unknown-interpreter+1;
+ if ((begin > 0 || end < length-1 || unknown > 0 || interpreter > 0)
+ && nr_elements > 0)
+ {
+ stack = new StackTraceElement[nr_elements];
+ int pos =0;
+ for (int i=begin; i<=end; i++)
+ {
+ String MName = elements[i].getMethodName();
+ String CName = elements[i].getClassName();
+ if (remove_unknown && CName == null
+ && (MName == null || MName.startsWith("0x")))
+ ; // Skip unknown frame
+ else if (remove_interpreter
+ && ((CName == null
+ && MName != null && MName.startsWith("ffi_"))
+ || (CName != null && CName.equals("_Jv_InterpMethod"))))
+ ; // Skip interpreter runtime frame
+ else
+ {
+ stack[pos] = elements[i];
+ pos++;
+ }
+ }
+ }
+ else
+ stack = elements;
+
+ return stack;
+ }
+
+ /**
+ * Creates a StackTraceElement given a string and a filename.
+ * Splits the given string into the class and method part.
+ * The string name will be a demangled to a fully qualified java method
+ * string. The string file will be decomposed into a file name and possibly
+ * a line number. The name should never be null, but the file may be if it
+ * is unknown.
+ */
+ private StackTraceElement createStackTraceElement(String name, String file)
+ {
+ if (!demangle)
+ return new StackTraceElement(file, -1, null, name, false);
+
+ String s = demangleName(name);
+ String methodName = s;
+ String className = null;
+ int bracket = s.indexOf('(');
+ if (bracket > 0)
+ {
+ int dot = s.lastIndexOf('.', bracket);
+ if (dot > 0)
+ {
+ className = s.substring(0, dot);
+ methodName = s.substring(dot+1, s.length());
+ }
+ }
+
+ String fileName = file;
+ int line = -1;
+ if (fileName != null)
+ {
+ int colon = file.indexOf(':');
+ if (colon > 0)
+ {
+ fileName = file.substring(0, colon);
+ try
+ {
+ line = Integer.parseInt(file.substring(colon+1, file.length()));
+ }
+ catch (NumberFormatException nfe) { /* ignore */ }
+ }
+
+ if (line == 0)
+ line =-1;
+
+ if ("".equals(fileName) || "??".equals(fileName))
+ fileName = null;
+ else if (fileName != null)
+ {
+ try
+ {
+ fileName = new File(fileName).getCanonicalPath();
+ }
+ catch (IOException ioe) { /* ignore */ }
+ }
+ }
+
+ return new StackTraceElement(fileName, line, className, methodName, false);
+ }
+
+ /**
+ * Demangles the given String if possible. Returns the demangled String or
+ * the original string if demangling is impossible.
+ */
+ private String demangleName(String s)
+ {
+ if (cppfilt != null)
+ {
+ try
+ {
+ cppfiltOut.write(s);
+ cppfiltOut.newLine();
+ cppfiltOut.flush();
+ return cppfiltIn.readLine();
+ }
+ catch (IOException ioe) { cppfilt.destroy(); cppfilt = null; }
+ }
+
+ return s;
+ }
+
+ /**
+ * Returns human readable method name and aguments given a method type
+ * signature as known to the interpreter and a classname.
+ */
+ public static String demangleInterpreterMethod(String m, String cn)
+ {
+ int index = 0;
+ int length = m.length();
+ StringBuffer sb = new StringBuffer(length);
+
+ // Figure out the real method name
+ if (m.startsWith("<init>"))
+ {
+ String className;
+ int i = cn.lastIndexOf('.');
+ if (i < 0)
+ className = cn;
+ else
+ className = cn.substring(i + 1);
+ sb.append(className);
+ index += 7;
+ }
+ else
+ {
+ int i = m.indexOf('(');
+ if (i > 0)
+ {
+ sb.append(m.substring(0,i));
+ index += i + 1;
+ }
+ }
+
+ sb.append('(');
+
+ // Demangle the type arguments
+ int arrayDepth = 0;
+ char c = (index < length) ? m.charAt(index) : ')';
+ while (c != ')')
+ {
+ String type;
+ switch(c)
+ {
+ case 'B':
+ type = "byte";
+ break;
+ case 'C':
+ type = "char";
+ break;
+ case 'D':
+ type = "double";
+ break;
+ case 'F':
+ type = "float";
+ break;
+ case 'I':
+ type = "int";
+ break;
+ case 'J':
+ type = "long";
+ break;
+ case 'S':
+ type = "short";
+ break;
+ case 'Z':
+ type = "boolean";
+ break;
+ case 'L':
+ int i = m.indexOf(';', index);
+ if (i > 0)
+ {
+ type = m.substring(index+1, i);
+ index = i;
+ }
+ else
+ type = "<unknown ref>";
+ break;
+ case '[':
+ type = "";
+ arrayDepth++;
+ break;
+ default:
+ type = "<unknown " + c + '>';
+ }
+ sb.append(type);
+
+ // Handle arrays
+ if (c != '[' && arrayDepth > 0)
+ while (arrayDepth > 0)
+ {
+ sb.append("[]");
+ arrayDepth--;
+ }
+
+ index++;
+ char nc = (index < length) ? m.charAt(index) : ')';
+ if (c != '[' && nc != ')')
+ sb.append(", ");
+ c = nc;
+ }
+
+ // Stop. We are not interested in the return type.
+ sb.append(')');
+ return sb.toString();
+ }
+
+ /**
+ * Releases all resources used by this NameFinder.
+ */
+ public void close()
+ {
+ if (cppfilt != null)
+ cppfilt.destroy();
+
+ if (addr2line != null)
+ addr2line.destroy();
+ }
+
+ /**
+ * Calls close to get rid of all resources.
+ */
+ protected void finalize()
+ {
+ close();
+ }
+}
diff --git a/libjava/gnu/gcj/runtime/natNameFinder.cc b/libjava/gnu/gcj/runtime/natNameFinder.cc
new file mode 100644
index 00000000000..29687cb5bb9
--- /dev/null
+++ b/libjava/gnu/gcj/runtime/natNameFinder.cc
@@ -0,0 +1,113 @@
+// natNameFinder.cc - native helper methods for NameFinder.java
+
+/* Copyright (C) 2002 Free Software Foundation, Inc
+
+ 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. */
+
+/**
+ * @author Mark Wielaard (mark@klomp.org)
+ * Based on the old name-finder.cc by Andrew Haley <aph@cygnus.com>.
+ */
+
+#include <config.h>
+
+#include <gcj/cni.h>
+#include <jvm.h>
+#include <java/lang/String.h>
+#include <java/lang/StackTraceElement.h>
+#include <java/lang/StringBuffer.h>
+#include <java-interp.h>
+
+#include <gnu/gcj/runtime/NameFinder.h>
+
+#ifdef HAVE_DLFCN_H
+#include <dlfcn.h>
+#endif
+
+java::lang::String*
+gnu::gcj::runtime::NameFinder::getExecutable (void)
+{
+ return JvNewStringLatin1 (_Jv_ThisExecutable ());
+}
+
+java::lang::String*
+gnu::gcj::runtime::NameFinder::getAddrAsString(RawData* addrs, jint n)
+{
+ _Jv_frame_info *p = (_Jv_frame_info *) addrs;
+ typedef unsigned word_t __attribute ((mode (word)));
+ word_t w = (word_t) p[n].addr;
+ int digits = sizeof (void *) * 2;
+ char hex[digits+5];
+
+ strcpy (hex, "0x");
+ for (int i = digits - 1; i >= 0; i--)
+ {
+ int digit = w % 16;
+
+ w /= 16;
+ hex[i+2] = digit > 9 ? 'a' + digit - 10 : '0' + digit;
+ }
+ hex [digits+2] = 0;
+
+ return JvNewStringLatin1(hex);
+}
+
+java::lang::StackTraceElement*
+gnu::gcj::runtime::NameFinder::dladdrLookup(RawData* addrs, jint n)
+{
+#if defined (HAVE_DLFCN_H) && defined (HAVE_DLADDR)
+ extern char **_Jv_argv;
+ char name[1024];
+ char file_name[1024];
+ _Jv_frame_info *stack = (_Jv_frame_info *) addrs;
+ void* p = stack[n].addr;
+ Dl_info dl_info;
+
+ if (dladdr (p, &dl_info))
+ {
+ if (dl_info.dli_fname)
+ strncpy (file_name, dl_info.dli_fname, sizeof file_name);
+ if (dl_info.dli_sname)
+ strncpy (name, dl_info.dli_sname, sizeof name);
+
+ /* Don't trust dladdr() if the address is from the main program. */
+ if (dl_info.dli_fname != NULL
+ && dl_info.dli_sname != NULL
+ && (_Jv_argv == NULL || strcmp (file_name, _Jv_argv[0]) != 0))
+ return createStackTraceElement (JvNewStringLatin1 (name),
+ JvNewStringLatin1 (file_name));
+ }
+#endif
+ return NULL;
+}
+
+java::lang::StackTraceElement *
+gnu::gcj::runtime::NameFinder::lookupInterp(RawData* addrs, jint n)
+{
+#ifdef INTERPRETER
+ _Jv_frame_info *stack = (_Jv_frame_info *) addrs;
+ if (stack[n].interp == NULL)
+ return NULL;
+
+ _Jv_InterpMethod *meth
+ = reinterpret_cast<_Jv_InterpMethod *> (stack[n].interp);
+ java::lang::StringBuffer *sb = new java::lang::StringBuffer();
+ sb->append(_Jv_NewStringUtf8Const(meth->self->name));
+ sb->append(_Jv_NewStringUtf8Const(meth->self->signature));
+ // FIXME: source file name and line number can be found from
+ // bytecode debug information. But currently we don't keep that
+ // around.
+ // FIXME: is using the defining class correct here?
+ java::lang::String *className = meth->defining_class->getName();
+ java::lang::String *methodName
+ = demangleInterpreterMethod(sb->toString(), className);
+ return new java::lang::StackTraceElement(NULL, -1,
+ className, methodName, false);
+#else // INTERPRETER
+ return NULL;
+#endif // INTERPRETER
+}
diff --git a/libjava/gnu/java/lang/reflect/TypeSignature.java b/libjava/gnu/java/lang/reflect/TypeSignature.java
index 0344ca3a4af..e9c8861c611 100644
--- a/libjava/gnu/java/lang/reflect/TypeSignature.java
+++ b/libjava/gnu/java/lang/reflect/TypeSignature.java
@@ -1,5 +1,5 @@
/* TypeSignature.java -- Class used to compute type signatures
- Copyright (C) 1998 Free Software Foundation, Inc.
+ Copyright (C) 1998, 2000, 2002 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -7,7 +7,7 @@ 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
@@ -44,230 +44,218 @@ import java.lang.reflect.Member;
import java.lang.reflect.Method;
/**
- This class provides static methods that can be used to compute
- type-signatures of <code>Class</code>s or <code>Member</code>s.
- More specific methods are also provided for computing the
- type-signature of <code>Constructor</code>s and
- <code>Method</code>s. Methods are also provided to go in the
- reverse direction.
-*/
+ * This class provides static methods that can be used to compute
+ * type-signatures of <code>Class</code>s or <code>Member</code>s.
+ * More specific methods are also provided for computing the
+ * type-signature of <code>Constructor</code>s and
+ * <code>Method</code>s. Methods are also provided to go in the
+ * reverse direction.
+ *
+ * @author Eric Blake <ebb9@email.byu.edu>
+ */
public class TypeSignature
{
-
/**
- Returns a <code>String</code> representing the type-encoding of
- CLAZZ. Type-encodings are computed as follows:
+ * Returns a <code>String</code> representing the type-encoding of a class.
+ * The .class file format has different encodings for classes, depending
+ * on whether it must be disambiguated from primitive types or not; hence
+ * the descriptor parameter to choose between them. If you are planning
+ * on decoding primitive types along with classes, then descriptor should
+ * be true for correct results. Type-encodings are computed as follows:
+ *
+ * <pre>
+ * boolean -> "Z"
+ * byte -> "B"
+ * char -> "C"
+ * double -> "D"
+ * float -> "F"
+ * int -> "I"
+ * long -> "J"
+ * short -> "S"
+ * void -> "V"
+ * arrays -> "[" + descriptor format of component type
+ * object -> class format: fully qualified name with '.' replaced by '/'
+ * descriptor format: "L" + class format + ";"
+ * </pre>
+ *
+ * @param type the class name to encode
+ * @param descriptor true to return objects in descriptor format
+ * @return the class name, as it appears in bytecode constant pools
+ * @see #getClassForEncoding(String)
+ */
+ public static String getEncodingOfClass(String type, boolean descriptor)
+ {
+ if (! descriptor || type.charAt(0) == '[')
+ return type.replace('.', '/');
+ if (type.equals("boolean"))
+ return "Z";
+ if (type.equals("byte"))
+ return "B";
+ if (type.equals("short"))
+ return "S";
+ if (type.equals("char"))
+ return "C";
+ if (type.equals("int"))
+ return "I";
+ if (type.equals("long"))
+ return "J";
+ if (type.equals("float"))
+ return "F";
+ if (type.equals("double"))
+ return "D";
+ if (type.equals("void"))
+ return "V";
+ return 'L' + type.replace('.', '/') + ';';
+ }
- <pre>
- boolean -> "Z"
- byte -> "B"
- char -> "C"
- double -> "D"
- float -> "F"
- int -> "I"
- long -> "J"
- short -> "S"
- void -> "V"
- arrays -> "[" + type-encoding of component type
- object -> "L"
- + fully qualified class name with "."'s replaced by "/"'s
- + ";"</pre>
- */
- public static String getEncodingOfClass( Class clazz )
+ /**
+ * Gets the descriptor encoding for a class.
+ *
+ * @param clazz the class to encode
+ * @param descriptor true to return objects in descriptor format
+ * @return the class name, as it appears in bytecode constant pools
+ * @see #getEncodingOfClass(String, boolean)
+ */
+ public static String getEncodingOfClass(Class clazz, boolean descriptor)
{
- if( clazz.isPrimitive() )
- {
- if( clazz == Boolean.TYPE )
- return "Z";
- if( clazz == Byte.TYPE )
- return "B";
- if( clazz == Character.TYPE )
- return "C";
- if( clazz == Double.TYPE )
- return "D";
- if( clazz == Float.TYPE )
- return "F";
- if( clazz == Integer.TYPE )
- return "I";
- if( clazz == Long.TYPE )
- return "J";
- if( clazz == Short.TYPE )
- return "S";
- if( clazz == Void.TYPE )
- return "V";
- else
- throw new RuntimeException( "Unknown primitive class " + clazz );
- }
- else if( clazz.isArray() )
- {
- return '[' + getEncodingOfClass( clazz.getComponentType() );
- }
- else
- {
- String classname = clazz.getName();
- int name_len = classname.length();
- char[] buf = new char[ name_len + 2 ];
- buf[0] = 'L';
- classname.getChars( 0, name_len, buf, 1 );
-
- int i;
- for( i=1; i <= name_len; i++ )
- {
- if( buf[i] == '.' )
- buf[i] = '/';
- }
-
- buf[i] = ';';
- return new String( buf );
- }
+ return getEncodingOfClass(clazz.getName(), descriptor);
}
-
/**
- This function is the inverse of <code>getEncodingOfClass</code>.
+ * Gets the descriptor encoding for a class.
+ *
+ * @param clazz the class to encode
+ * @return the class name, as it appears in bytecode constant pools
+ * @see #getEncodingOfClass(String, boolean)
+ */
+ public static String getEncodingOfClass(Class clazz)
+ {
+ return getEncodingOfClass(clazz.getName(), true);
+ }
- @see getEncodingOfClass
- @exception ClassNotFoundException If class encoded as type_code
- cannot be located.
- */
- public static Class getClassForEncoding( String type_code )
+ /**
+ * This function is the inverse of <code>getEncodingOfClass</code>. This
+ * accepts both object and descriptor formats, but must know which style
+ * of string is being passed in (usually, descriptor should be true). In
+ * descriptor format, "I" is treated as int.class, in object format, it
+ * is treated as a class named I in the unnamed package.
+ *
+ * @param type_code the class name to decode
+ * @param descriptor if the string is in descriptor format
+ * @return the corresponding Class object
+ * @throws ClassNotFoundException if the class cannot be located
+ * @see #getEncodingOfClass(Class, boolean)
+ */
+ public static Class getClassForEncoding(String type_code, boolean descriptor)
throws ClassNotFoundException
{
- if( type_code.equals( "B" ) )
- return Byte.TYPE;
- if( type_code.equals( "C" ) )
- return Character.TYPE;
- if( type_code.equals( "D" ) )
- return Double.TYPE;
- if( type_code.equals( "F" ) )
- return Float.TYPE;
- if( type_code.equals( "I" ) )
- return Integer.TYPE;
- if( type_code.equals( "J" ) )
- return Long.TYPE;
- if( type_code.equals( "S" ) )
- return Short.TYPE;
- if( type_code.equals( "Z" ) )
- return Boolean.TYPE;
- if( type_code.charAt( 0 ) == 'L' )
- {
- return Class.forName(
- type_code.substring( 1, type_code.length() - 1 ).replace( '/', '.' ));
- }
- if( type_code.charAt( 0 ) == '[' )
- {
- int last_bracket = type_code.lastIndexOf( '[' );
- String brackets = type_code.substring( 0, last_bracket + 1 );
- String component = type_code.substring( last_bracket + 1 );
-
-// ??? This is what the Classpath implementation did, but I don't
-// think that it's correct. The JLS says that Class.forName takes the
-// classname of an array element in fully qualified form, whereas this
-// code is tring to strip off the punctuation.
-
-// if( component.charAt( 0 ) == 'L' )
-// component =
-// component.substring( 1, component.length() - 1 ).replace('/', '.');
-
- if( component.charAt( 0 ) == 'L' )
- component = component.replace('/', '.');
-
- return Class.forName( brackets + component );
- }
- else
- throw new ClassNotFoundException( "Type code cannot be parsed as a valid class name" );
+ if (descriptor)
+ {
+ switch (type_code.charAt(0))
+ {
+ case 'B':
+ return byte.class;
+ case 'C':
+ return char.class;
+ case 'D':
+ return double.class;
+ case 'F':
+ return float.class;
+ case 'I':
+ return int.class;
+ case 'J':
+ return long.class;
+ case 'S':
+ return short.class;
+ case 'V':
+ return void.class;
+ case 'Z':
+ return boolean.class;
+ default:
+ throw new ClassNotFoundException("Invalid class name: "
+ + type_code);
+ case 'L':
+ type_code = type_code.substring(1, type_code.length() - 1);
+ // Fallthrough.
+ case '[':
+ }
+ }
+ return Class.forName(type_code.replace('/', '.'));
}
-
/**
- Returns a <code>String</code> representing the type-encoding of
- M. The type-encoding of a method is:
+ * Gets the Class object for a type name.
+ *
+ * @param type_code the class name to decode
+ * @return the corresponding Class object
+ * @throws ClassNotFoundException if the class cannot be located
+ * @see #getClassForEncoding(String, boolean)
+ */
+ public static Class getClassForEncoding(String type_code)
+ throws ClassNotFoundException
+ {
+ return getClassForEncoding(type_code, true);
+ }
- "(" + type-encodings of parameter types + ")"
- + type-encoding of return type
- */
- public static String getEncodingOfMethod( Method m )
+ /**
+ * Returns a <code>String</code> representing the type-encoding of a
+ * method. The type-encoding of a method is:
+ *
+ * "(" + parameter type descriptors + ")" + return type descriptor
+ *
+ * XXX This could be faster if it were implemented natively.
+ *
+ * @param m the method to encode
+ * @return the encoding
+ */
+ public static String getEncodingOfMethod(Method m)
{
- String returnEncoding = getEncodingOfClass( m.getReturnType() );
Class[] paramTypes = m.getParameterTypes();
- String[] paramEncodings = new String[ paramTypes.length ];
-
- String paramEncoding;
- int size = 2; // make room for parens
- for( int i=0; i < paramTypes.length; i++ )
- {
- paramEncoding = getEncodingOfClass( paramTypes[i] );
- size += paramEncoding.length();
- paramEncodings[i] = paramEncoding;
- }
-
- size += returnEncoding.length();
-
- StringBuffer buf = new StringBuffer( size );
- buf.append( '(' );
-
- for( int i=0; i < paramTypes.length; i++ )
- {
- buf.append( paramEncodings[i] );
- }
-
- buf.append( ')' );
- buf.append( returnEncoding );
-
+ StringBuffer buf = new StringBuffer().append('(');
+ for (int i = 0; i < paramTypes.length; i++)
+ buf.append(getEncodingOfClass(paramTypes[i].getName(), true));
+ buf.append(')').append(getEncodingOfClass(m.getReturnType().getName(),
+ true));
return buf.toString();
}
-
/**
- Returns a <code>String</code> representing the type-encoding of
- C. The type-encoding of a method is:
-
- "(" + type-encodings of parameter types + ")V"
- */
- public static String getEncodingOfConstructor( Constructor c )
+ * Returns a <code>String</code> representing the type-encoding of a
+ * constructor. The type-encoding of a method is:
+ *
+ * "(" + parameter type descriptors + ")V"
+ *
+ * XXX This could be faster if it were implemented natively.
+ *
+ * @param c the constructor to encode
+ * @return the encoding
+ */
+ public static String getEncodingOfConstructor(Constructor c)
{
Class[] paramTypes = c.getParameterTypes();
- String[] paramEncodings = new String[ paramTypes.length ];
-
- String paramEncoding;
- int size = 3; // make room for parens and V for return type
- for( int i=0; i < paramTypes.length; i++ )
- {
- paramEncoding = getEncodingOfClass( paramTypes[i] );
- size += paramEncoding.length();
- paramEncodings[i] = paramEncoding;
- }
-
- StringBuffer buf = new StringBuffer( size );
- buf.append( '(' );
-
- for( int i=0; i < paramTypes.length; i++ )
- {
- buf.append( paramEncodings[i] );
- }
-
- buf.append( ")V" );
-
+ StringBuffer buf = new StringBuffer().append('(');
+ for (int i = 0; i < paramTypes.length; i++)
+ buf.append(getEncodingOfClass(paramTypes[i].getName(), true));
+ buf.append(")V");
return buf.toString();
}
-
/**
- Returns a <code>String</code> representing the type-encoding of
- MEM. <code>Constructor</code>s are handled by
- <code>getEncodingOfConstructor</code>. <code>Method</code>s are
- handled by <code>getEncodingOfMethod</code>. <code>Field</code>s
- are handled by returning the encoding of the type of the
- <code>Field</code>.
- */
- public static String getEncodingOfMember( Member mem )
+ * Returns a <code>String</code> representing the type-encoding of a
+ * class member. This appropriately handles Constructors, Methods, and
+ * Fields.
+ *
+ * @param mem the member to encode
+ * @return the encoding
+ */
+ public static String getEncodingOfMember(Member mem)
{
- if( mem instanceof Constructor )
- return getEncodingOfConstructor( (Constructor)mem );
- if( mem instanceof Method )
- return getEncodingOfMethod( (Method)mem );
+ if (mem instanceof Constructor)
+ return getEncodingOfConstructor((Constructor) mem);
+ if (mem instanceof Method)
+ return getEncodingOfMethod((Method) mem);
else // Field
- return getEncodingOfClass( ((Field)mem).getType() );
+ return getEncodingOfClass(((Field) mem).getType().getName(), true);
}
-}
+} // class TypeSignature
diff --git a/libjava/gnu/java/nio/ByteBufferImpl.java b/libjava/gnu/java/nio/ByteBufferImpl.java
new file mode 100644
index 00000000000..54fba2492e1
--- /dev/null
+++ b/libjava/gnu/java/nio/ByteBufferImpl.java
@@ -0,0 +1,193 @@
+/* ByteBufferImpl.java --
+ Copyright (C) 2002 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.nio;
+
+import java.nio.ByteBuffer;
+import java.nio.CharBuffer;
+import java.nio.DoubleBuffer;
+import java.nio.FloatBuffer;
+import java.nio.IntBuffer;
+import java.nio.LongBuffer;
+import java.nio.ShortBuffer;
+
+public final class ByteBufferImpl extends ByteBuffer
+{
+ private byte[] backing_buffer;
+ private int array_offset;
+ private boolean ro;
+
+ public ByteBufferImpl (int cap, int off, int lim)
+ {
+ this.cap = cap;
+ limit (lim);
+ position (off);
+ this.backing_buffer = new byte[cap];
+ }
+
+ public ByteBufferImpl (byte[] array, int off, int lim)
+ {
+ this.cap = array.length;
+ limit (lim);
+ position (off);
+ this.backing_buffer = array;
+ }
+
+ public ByteBufferImpl (ByteBufferImpl copy)
+ {
+ this.cap = copy.capacity ();
+ limit (copy.limit ());
+ position (copy.position ());
+ ro = copy.ro;
+ backing_buffer = copy.backing_buffer;
+ }
+
+ void inc_pos (int toAdd)
+ {
+ position (position () + toAdd);
+ }
+
+ private static native byte[] nio_cast(byte[]copy);
+ private static native byte[] nio_cast(char[]copy);
+ private static native byte[] nio_cast(short[]copy);
+ private static native byte[] nio_cast(long[]copy);
+ private static native byte[] nio_cast(int[]copy);
+ private static native byte[] nio_cast(float[]copy);
+ private static native byte[] nio_cast(double[]copy);
+
+
+ ByteBufferImpl(byte[] copy) { this.backing_buffer = copy != null ? nio_cast(copy) : null; }
+ private static native byte nio_get_Byte(ByteBufferImpl b, int index, int limit);
+ private static native void nio_put_Byte(ByteBufferImpl b, int index, int limit, byte value);
+ public ByteBuffer asByteBuffer() { ByteBufferImpl res = new ByteBufferImpl(backing_buffer); res.limit((limit()*1)/1); return res; }
+
+ ByteBufferImpl(char[] copy) { this.backing_buffer = copy != null ? nio_cast(copy) : null; }
+ private static native char nio_get_Char(ByteBufferImpl b, int index, int limit);
+ private static native void nio_put_Char(ByteBufferImpl b, int index, int limit, char value);
+ public CharBuffer asCharBuffer() { CharBufferImpl res = new CharBufferImpl(backing_buffer); res.limit((limit()*2)/1); return res; }
+
+ ByteBufferImpl(short[] copy) { this.backing_buffer = copy != null ? nio_cast(copy) : null; }
+ private static native short nio_get_Short(ByteBufferImpl b, int index, int limit);
+ private static native void nio_put_Short(ByteBufferImpl b, int index, int limit, short value);
+ public ShortBuffer asShortBuffer() { ShortBufferImpl res = new ShortBufferImpl(backing_buffer); res.limit((limit()*2)/1); return res; }
+
+ ByteBufferImpl(int[] copy) { this.backing_buffer = copy != null ? nio_cast(copy) : null; }
+ private static native int nio_get_Int(ByteBufferImpl b, int index, int limit);
+ private static native void nio_put_Int(ByteBufferImpl b, int index, int limit, int value);
+ public IntBuffer asIntBuffer() { IntBufferImpl res = new IntBufferImpl(backing_buffer); res.limit((limit()*4)/1); return res; }
+
+ ByteBufferImpl(long[] copy) { this.backing_buffer = copy != null ? nio_cast(copy) : null; }
+ private static native long nio_get_Long(ByteBufferImpl b, int index, int limit);
+ private static native void nio_put_Long(ByteBufferImpl b, int index, int limit, long value);
+ public LongBuffer asLongBuffer() { LongBufferImpl res = new LongBufferImpl(backing_buffer); res.limit((limit()*8)/1); return res; }
+
+ ByteBufferImpl(float[] copy) { this.backing_buffer = copy != null ? nio_cast(copy) : null; }
+ private static native float nio_get_Float(ByteBufferImpl b, int index, int limit);
+ private static native void nio_put_Float(ByteBufferImpl b, int index, int limit, float value);
+ public FloatBuffer asFloatBuffer() { FloatBufferImpl res = new FloatBufferImpl(backing_buffer); res.limit((limit()*4)/1); return res; }
+
+ ByteBufferImpl(double[] copy) { this.backing_buffer = copy != null ? nio_cast(copy) : null; }
+ private static native double nio_get_Double(ByteBufferImpl b, int index, int limit);
+ private static native void nio_put_Double(ByteBufferImpl b, int index, int limit, double value);
+ public DoubleBuffer asDoubleBuffer() { DoubleBufferImpl res = new DoubleBufferImpl(backing_buffer); res.limit((limit()*8)/1); return res; }
+
+ public boolean isReadOnly()
+ {
+ return ro;
+ }
+
+ public ByteBuffer slice()
+ {
+ ByteBufferImpl A = new ByteBufferImpl(this);
+ A.array_offset = position();
+ return A;
+ }
+
+ public ByteBuffer duplicate()
+ {
+ return new ByteBufferImpl(this);
+ }
+
+ public ByteBuffer asReadOnlyBuffer()
+ {
+ ByteBufferImpl a = new ByteBufferImpl(this);
+ a.ro = true;
+ return a;
+ }
+
+ public ByteBuffer compact()
+ {
+ return this;
+ }
+
+ public boolean isDirect()
+ {
+ return backing_buffer != null;
+ }
+
+ final public byte get()
+ {
+ byte e = backing_buffer[position()];
+ position(position()+1);
+ return e;
+ }
+
+ final public ByteBuffer put(byte b)
+ {
+ backing_buffer[position()] = b;
+ position(position()+1);
+ return this;
+ }
+
+ final public byte get(int index)
+ {
+ return backing_buffer[index];
+ }
+
+ final public ByteBuffer put(int index, byte b)
+ {
+ backing_buffer[index] = b;
+ return this;
+ }
+
+ final public char getChar() { char a = nio_get_Char(this, position(), limit()); inc_pos(2); return a; } final public ByteBuffer putChar(char value) { nio_put_Char(this, position(), limit(), value); inc_pos(2); return this; } final public char getChar(int index) { char a = nio_get_Char(this, index, limit()); return a; } final public ByteBuffer putChar(int index, char value) { nio_put_Char(this, index, limit(), value); return this; };
+ final public short getShort() { short a = nio_get_Short(this, position(), limit()); inc_pos(2); return a; } final public ByteBuffer putShort(short value) { nio_put_Short(this, position(), limit(), value); inc_pos(2); return this; } final public short getShort(int index) { short a = nio_get_Short(this, index, limit()); return a; } final public ByteBuffer putShort(int index, short value) { nio_put_Short(this, index, limit(), value); return this; };
+ final public int getInt() { int a = nio_get_Int(this, position(), limit()); inc_pos(4); return a; } final public ByteBuffer putInt(int value) { nio_put_Int(this, position(), limit(), value); inc_pos(4); return this; } final public int getInt(int index) { int a = nio_get_Int(this, index, limit()); return a; } final public ByteBuffer putInt(int index, int value) { nio_put_Int(this, index, limit(), value); return this; };
+ final public long getLong() { long a = nio_get_Long(this, position(), limit()); inc_pos(8); return a; } final public ByteBuffer putLong(long value) { nio_put_Long(this, position(), limit(), value); inc_pos(8); return this; } final public long getLong(int index) { long a = nio_get_Long(this, index, limit()); return a; } final public ByteBuffer putLong(int index, long value) { nio_put_Long(this, index, limit(), value); return this; };
+ final public float getFloat() { float a = nio_get_Float(this, position(), limit()); inc_pos(4); return a; } final public ByteBuffer putFloat(float value) { nio_put_Float(this, position(), limit(), value); inc_pos(4); return this; } final public float getFloat(int index) { float a = nio_get_Float(this, index, limit()); return a; } final public ByteBuffer putFloat(int index, float value) { nio_put_Float(this, index, limit(), value); return this; };
+ final public double getDouble() { double a = nio_get_Double(this, position(), limit()); inc_pos(8); return a; } final public ByteBuffer putDouble(double value) { nio_put_Double(this, position(), limit(), value); inc_pos(8); return this; } final public double getDouble(int index) { double a = nio_get_Double(this, index, limit()); return a; } final public ByteBuffer putDouble(int index, double value) { nio_put_Double(this, index, limit(), value); return this; };
+}
diff --git a/libjava/gnu/java/nio/CharBufferImpl.java b/libjava/gnu/java/nio/CharBufferImpl.java
new file mode 100644
index 00000000000..399dd6096b8
--- /dev/null
+++ b/libjava/gnu/java/nio/CharBufferImpl.java
@@ -0,0 +1,212 @@
+/* CharBufferImpl.java --
+ Copyright (C) 2002 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.nio;
+
+import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
+import java.nio.CharBuffer;
+import java.nio.DoubleBuffer;
+import java.nio.FloatBuffer;
+import java.nio.IntBuffer;
+import java.nio.LongBuffer;
+import java.nio.ShortBuffer;
+
+public final class CharBufferImpl extends CharBuffer
+{
+ private boolean ro;
+
+ private ByteOrder endian = ByteOrder.BIG_ENDIAN;
+
+ public CharBufferImpl(int cap, int off, int lim)
+ {
+ this.backing_buffer = new char[cap];
+ this.cap = cap;
+ this.limit(lim);
+ this.position(off);
+ }
+
+ public CharBufferImpl(char[] array, int off, int lim)
+ {
+ this.backing_buffer = array;
+ this.cap = array.length;
+ this.limit(lim);
+ this.position(off);
+ }
+
+ public CharBufferImpl (CharBufferImpl copy)
+ {
+ backing_buffer = copy.backing_buffer;
+ ro = copy.ro;
+ limit (copy.limit());
+ position (copy.position ());
+ }
+
+ void inc_pos (int a)
+ {
+ position (position () + a);
+ }
+
+ CharBufferImpl(byte[] copy) { this.backing_buffer = copy != null ? nio_cast(copy) : null; }
+ private static native byte nio_get_Byte(CharBufferImpl b, int index, int limit);
+ private static native void nio_put_Byte(CharBufferImpl b, int index, int limit, byte value);
+ public ByteBuffer asByteBuffer() { ByteBufferImpl res = new ByteBufferImpl(backing_buffer); res.limit((limit()*1)/2); return res; }
+
+ CharBufferImpl(char[] copy) { this.backing_buffer = copy != null ? nio_cast(copy) : null; }
+ private static native char nio_get_Char(CharBufferImpl b, int index, int limit);
+ private static native void nio_put_Char(CharBufferImpl b, int index, int limit, char value);
+ public CharBuffer asCharBuffer() { CharBufferImpl res = new CharBufferImpl(backing_buffer); res.limit((limit()*2)/2); return res; }
+
+ CharBufferImpl(short[] copy) { this.backing_buffer = copy != null ? nio_cast(copy) : null; }
+ private static native short nio_get_Short(CharBufferImpl b, int index, int limit);
+ private static native void nio_put_Short(CharBufferImpl b, int index, int limit, short value);
+ public ShortBuffer asShortBuffer() { ShortBufferImpl res = new ShortBufferImpl(backing_buffer); res.limit((limit()*2)/2); return res; }
+
+ CharBufferImpl(int[] copy) { this.backing_buffer = copy != null ? nio_cast(copy) : null; }
+ private static native int nio_get_Int(CharBufferImpl b, int index, int limit);
+ private static native void nio_put_Int(CharBufferImpl b, int index, int limit, int value);
+ public IntBuffer asIntBuffer() { IntBufferImpl res = new IntBufferImpl(backing_buffer); res.limit((limit()*4)/2); return res; }
+
+ CharBufferImpl(long[] copy) { this.backing_buffer = copy != null ? nio_cast(copy) : null; }
+ private static native long nio_get_Long(CharBufferImpl b, int index, int limit);
+ private static native void nio_put_Long(CharBufferImpl b, int index, int limit, long value);
+ public LongBuffer asLongBuffer() { LongBufferImpl res = new LongBufferImpl(backing_buffer); res.limit((limit()*8)/2); return res; }
+
+ CharBufferImpl(float[] copy) { this.backing_buffer = copy != null ? nio_cast(copy) : null; }
+ private static native float nio_get_Float(CharBufferImpl b, int index, int limit);
+ private static native void nio_put_Float(CharBufferImpl b, int index, int limit, float value);
+ public FloatBuffer asFloatBuffer() { FloatBufferImpl res = new FloatBufferImpl(backing_buffer); res.limit((limit()*4)/2); return res; }
+
+ CharBufferImpl(double[] copy) { this.backing_buffer = copy != null ? nio_cast(copy) : null; }
+ private static native double nio_get_Double(CharBufferImpl b, int index, int limit);
+ private static native void nio_put_Double(CharBufferImpl b, int index, int limit, double value);
+ public DoubleBuffer asDoubleBuffer() { DoubleBufferImpl res = new DoubleBufferImpl(backing_buffer); res.limit((limit()*8)/2); return res; }
+
+ private static native char[] nio_cast(byte[]copy);
+ private static native char[] nio_cast(char[]copy);
+ private static native char[] nio_cast(short[]copy);
+ private static native char[] nio_cast(long[]copy);
+ private static native char[] nio_cast(int[]copy);
+ private static native char[] nio_cast(float[]copy);
+ private static native char[] nio_cast(double[]copy);
+
+
+ public boolean isReadOnly()
+ {
+ return ro;
+ }
+
+ public CharBuffer slice()
+ {
+ CharBufferImpl buffer = new CharBufferImpl (this);
+ buffer.array_offset = position ();
+ return buffer;
+ }
+
+ public CharBuffer duplicate()
+ {
+ return new CharBufferImpl(this);
+ }
+
+ public CharBuffer asReadOnlyBuffer()
+ {
+ CharBufferImpl a = new CharBufferImpl(this);
+ a.ro = true;
+ return a;
+ }
+
+ public CharBuffer compact()
+ {
+ return this;
+ }
+
+ public boolean isDirect()
+ {
+ return backing_buffer != null;
+ }
+
+ final public CharSequence subSequence (int start, int end)
+ {
+ if (start < 0 ||
+ end > length () ||
+ start > end)
+ throw new IndexOutOfBoundsException ();
+
+ // No support for direct buffers yet.
+ // assert array () != null;
+ return new CharBufferImpl (array (), position () + start,
+ position () + end);
+ }
+
+ final public char get()
+ {
+ char e = backing_buffer[position()];
+ position(position()+1);
+ return e;
+ }
+
+ final public CharBuffer put(char b)
+ {
+ backing_buffer[position()] = b;
+ position(position()+1);
+ return this;
+ }
+
+ final public char getChar() { return get(); } final public CharBuffer putChar(char value) { return put(value); } final public char getChar(int index) { return get(index); } final public CharBuffer putChar(int index, char value) { return put(index, value); };
+ final public short getShort() { short a = nio_get_Short(this, position(), limit()); inc_pos(2); return a; } final public CharBuffer putShort(short value) { nio_put_Short(this, position(), limit(), value); inc_pos(2); return this; } final public short getShort(int index) { short a = nio_get_Short(this, index, limit()); return a; } final public CharBuffer putShort(int index, short value) { nio_put_Short(this, index, limit(), value); return this; };
+ final public int getInt() { int a = nio_get_Int(this, position(), limit()); inc_pos(4); return a; } final public CharBuffer putInt(int value) { nio_put_Int(this, position(), limit(), value); inc_pos(4); return this; } final public int getInt(int index) { int a = nio_get_Int(this, index, limit()); return a; } final public CharBuffer putInt(int index, int value) { nio_put_Int(this, index, limit(), value); return this; };
+ final public long getLong() { long a = nio_get_Long(this, position(), limit()); inc_pos(8); return a; } final public CharBuffer putLong(long value) { nio_put_Long(this, position(), limit(), value); inc_pos(8); return this; } final public long getLong(int index) { long a = nio_get_Long(this, index, limit()); return a; } final public CharBuffer putLong(int index, long value) { nio_put_Long(this, index, limit(), value); return this; };
+ final public float getFloat() { float a = nio_get_Float(this, position(), limit()); inc_pos(4); return a; } final public CharBuffer putFloat(float value) { nio_put_Float(this, position(), limit(), value); inc_pos(4); return this; } final public float getFloat(int index) { float a = nio_get_Float(this, index, limit()); return a; } final public CharBuffer putFloat(int index, float value) { nio_put_Float(this, index, limit(), value); return this; };
+ final public double getDouble() { double a = nio_get_Double(this, position(), limit()); inc_pos(8); return a; } final public CharBuffer putDouble(double value) { nio_put_Double(this, position(), limit(), value); inc_pos(8); return this; } final public double getDouble(int index) { double a = nio_get_Double(this, index, limit()); return a; } final public CharBuffer putDouble(int index, double value) { nio_put_Double(this, index, limit(), value); return this; };
+
+ final public char get(int index)
+ {
+ return backing_buffer[index];
+ }
+
+ final public CharBuffer put(int index, char b)
+ {
+ backing_buffer[index] = b;
+ return this;
+ }
+
+
+ public final ByteOrder order()
+ {
+ return endian;
+ }
+}
diff --git a/libjava/gnu/java/nio/DatagramChannelImpl.java b/libjava/gnu/java/nio/DatagramChannelImpl.java
new file mode 100644
index 00000000000..a1e0be15912
--- /dev/null
+++ b/libjava/gnu/java/nio/DatagramChannelImpl.java
@@ -0,0 +1,112 @@
+/* DatagramChannelImpl.java --
+ Copyright (C) 2002 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.nio;
+
+import java.net.DatagramSocket;
+import java.net.SocketAddress;
+import java.nio.ByteBuffer;
+import java.nio.channels.DatagramChannel;
+import java.nio.channels.spi.SelectorProvider;
+
+public class DatagramChannelImpl extends DatagramChannel
+{
+ int fd;
+
+ protected DatagramChannelImpl (SelectorProvider provider)
+ {
+ super (provider);
+ }
+
+ protected void implCloseSelectableChannel ()
+ {
+ }
+
+ protected void implConfigureBlocking (boolean block)
+ {
+ }
+
+ public int write (ByteBuffer src)
+ {
+ return 0;
+ }
+
+ public long write (ByteBuffer[] srcs, int offset, int length)
+ {
+ return 0;
+ }
+
+ public int read (ByteBuffer dst)
+ {
+ return 0;
+ }
+
+ public DatagramChannel connect (SocketAddress remote)
+ {
+ return null;
+ }
+
+ public DatagramChannel disconnect ()
+ {
+ return null;
+ }
+
+ public boolean isConnected ()
+ {
+ return false;
+ }
+
+ public long read (ByteBuffer[] dsts, int offset, int length)
+ {
+ return 0;
+ }
+
+ public SocketAddress receive (ByteBuffer dst)
+ {
+ return null;
+ }
+
+ public int send (ByteBuffer src, SocketAddress target)
+ {
+ return 0;
+ }
+
+ public DatagramSocket socket ()
+ {
+ return null;
+ }
+}
diff --git a/libjava/gnu/java/nio/DoubleBufferImpl.java b/libjava/gnu/java/nio/DoubleBufferImpl.java
new file mode 100644
index 00000000000..de0e6717fd0
--- /dev/null
+++ b/libjava/gnu/java/nio/DoubleBufferImpl.java
@@ -0,0 +1,190 @@
+/* DoubleBufferImpl.java --
+ Copyright (C) 2002 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.nio;
+
+import java.nio.ByteBuffer;
+import java.nio.CharBuffer;
+import java.nio.DoubleBuffer;
+import java.nio.FloatBuffer;
+import java.nio.IntBuffer;
+import java.nio.LongBuffer;
+import java.nio.ShortBuffer;
+
+public final class DoubleBufferImpl extends DoubleBuffer
+{
+ private int array_offset;
+ private boolean ro;
+
+ public DoubleBufferImpl(int cap, int off, int lim)
+ {
+ this.backing_buffer = new double[cap];
+ this.cap = cap;
+ this.limit(lim);
+ this.position(off);
+ }
+
+ public DoubleBufferImpl(double[] array, int off, int lim)
+ {
+ this.backing_buffer = array;
+ this.cap = array.length;
+ this.limit(lim);
+ this.position(off);
+ }
+
+ public DoubleBufferImpl(DoubleBufferImpl copy)
+ {
+ backing_buffer = copy.backing_buffer;
+ ro = copy.ro;
+ limit(copy.limit());
+ position(copy.position());
+ }
+
+ void inc_pos(int a)
+ {
+ position(position() + a);
+ }
+
+ DoubleBufferImpl(byte[] copy) { this.backing_buffer = copy != null ? nio_cast(copy) : null; }
+ private static native byte nio_get_Byte(DoubleBufferImpl b, int index, int limit);
+ private static native void nio_put_Byte(DoubleBufferImpl b, int index, int limit, byte value);
+ public ByteBuffer asByteBuffer() { ByteBufferImpl res = new ByteBufferImpl(backing_buffer); res.limit((limit()*1)/8); return res; }
+
+ DoubleBufferImpl(char[] copy) { this.backing_buffer = copy != null ? nio_cast(copy) : null; }
+ private static native char nio_get_Char(DoubleBufferImpl b, int index, int limit);
+ private static native void nio_put_Char(DoubleBufferImpl b, int index, int limit, char value);
+ public CharBuffer asCharBuffer() { CharBufferImpl res = new CharBufferImpl(backing_buffer); res.limit((limit()*2)/8); return res; }
+
+ DoubleBufferImpl(short[] copy) { this.backing_buffer = copy != null ? nio_cast(copy) : null; }
+ private static native short nio_get_Short(DoubleBufferImpl b, int index, int limit);
+ private static native void nio_put_Short(DoubleBufferImpl b, int index, int limit, short value);
+ public ShortBuffer asShortBuffer() { ShortBufferImpl res = new ShortBufferImpl(backing_buffer); res.limit((limit()*2)/8); return res; }
+
+ DoubleBufferImpl(int[] copy) { this.backing_buffer = copy != null ? nio_cast(copy) : null; }
+ private static native int nio_get_Int(DoubleBufferImpl b, int index, int limit);
+ private static native void nio_put_Int(DoubleBufferImpl b, int index, int limit, int value);
+ public IntBuffer asIntBuffer() { IntBufferImpl res = new IntBufferImpl(backing_buffer); res.limit((limit()*4)/8); return res; }
+
+ DoubleBufferImpl(long[] copy) { this.backing_buffer = copy != null ? nio_cast(copy) : null; }
+ private static native long nio_get_Long(DoubleBufferImpl b, int index, int limit);
+ private static native void nio_put_Long(DoubleBufferImpl b, int index, int limit, long value);
+ public LongBuffer asLongBuffer() { LongBufferImpl res = new LongBufferImpl(backing_buffer); res.limit((limit()*8)/8); return res; }
+
+ DoubleBufferImpl(float[] copy) { this.backing_buffer = copy != null ? nio_cast(copy) : null; }
+ private static native float nio_get_Float(DoubleBufferImpl b, int index, int limit);
+ private static native void nio_put_Float(DoubleBufferImpl b, int index, int limit, float value);
+ public FloatBuffer asFloatBuffer() { FloatBufferImpl res = new FloatBufferImpl(backing_buffer); res.limit((limit()*4)/8); return res; }
+
+ DoubleBufferImpl(double[] copy) { this.backing_buffer = copy != null ? nio_cast(copy) : null; }
+ private static native double nio_get_Double(DoubleBufferImpl b, int index, int limit);
+ private static native void nio_put_Double(DoubleBufferImpl b, int index, int limit, double value);
+ public DoubleBuffer asDoubleBuffer() { DoubleBufferImpl res = new DoubleBufferImpl(backing_buffer); res.limit((limit()*8)/8); return res; }
+
+ private static native double[] nio_cast(byte[]copy);
+ private static native double[] nio_cast(char[]copy);
+ private static native double[] nio_cast(short[]copy);
+ private static native double[] nio_cast(long[]copy);
+ private static native double[] nio_cast(int[]copy);
+ private static native double[] nio_cast(float[]copy);
+ private static native double[] nio_cast(double[]copy);
+
+ public boolean isReadOnly()
+ {
+ return ro;
+ }
+
+ public DoubleBuffer slice()
+ {
+ DoubleBufferImpl A = new DoubleBufferImpl(this);
+ A.array_offset = position();
+ return A;
+ }
+
+ public DoubleBuffer duplicate()
+ {
+ return new DoubleBufferImpl(this);
+ }
+
+ public DoubleBuffer asReadOnlyBuffer()
+ {
+ DoubleBufferImpl a = new DoubleBufferImpl(this);
+ a.ro = true;
+ return a;
+ }
+
+ public DoubleBuffer compact()
+ {
+ return this;
+ }
+
+ public boolean isDirect()
+ {
+ return backing_buffer != null;
+ }
+
+ final public double get()
+ {
+ double e = backing_buffer[position()];
+ position(position()+1);
+ return e;
+ }
+
+ final public DoubleBuffer put(double b)
+ {
+ backing_buffer[position()] = b;
+ position(position()+1);
+ return this;
+ }
+
+ final public double get(int index)
+ {
+ return backing_buffer[index];
+ }
+
+ final public DoubleBuffer put(int index, double b)
+ {
+ backing_buffer[index] = b;
+ return this;
+ }
+
+ final public char getChar() { char a = nio_get_Char(this, position(), limit()); inc_pos(2); return a; } final public DoubleBuffer putChar(char value) { nio_put_Char(this, position(), limit(), value); inc_pos(2); return this; } final public char getChar(int index) { char a = nio_get_Char(this, index, limit()); return a; } final public DoubleBuffer putChar(int index, char value) { nio_put_Char(this, index, limit(), value); return this; };
+ final public short getShort() { short a = nio_get_Short(this, position(), limit()); inc_pos(2); return a; } final public DoubleBuffer putShort(short value) { nio_put_Short(this, position(), limit(), value); inc_pos(2); return this; } final public short getShort(int index) { short a = nio_get_Short(this, index, limit()); return a; } final public DoubleBuffer putShort(int index, short value) { nio_put_Short(this, index, limit(), value); return this; };
+ final public int getInt() { int a = nio_get_Int(this, position(), limit()); inc_pos(4); return a; } final public DoubleBuffer putInt(int value) { nio_put_Int(this, position(), limit(), value); inc_pos(4); return this; } final public int getInt(int index) { int a = nio_get_Int(this, index, limit()); return a; } final public DoubleBuffer putInt(int index, int value) { nio_put_Int(this, index, limit(), value); return this; };
+ final public long getLong() { long a = nio_get_Long(this, position(), limit()); inc_pos(8); return a; } final public DoubleBuffer putLong(long value) { nio_put_Long(this, position(), limit(), value); inc_pos(8); return this; } final public long getLong(int index) { long a = nio_get_Long(this, index, limit()); return a; } final public DoubleBuffer putLong(int index, long value) { nio_put_Long(this, index, limit(), value); return this; };
+ final public float getFloat() { float a = nio_get_Float(this, position(), limit()); inc_pos(4); return a; } final public DoubleBuffer putFloat(float value) { nio_put_Float(this, position(), limit(), value); inc_pos(4); return this; } final public float getFloat(int index) { float a = nio_get_Float(this, index, limit()); return a; } final public DoubleBuffer putFloat(int index, float value) { nio_put_Float(this, index, limit(), value); return this; };
+ final public double getDouble() { return get(); } final public DoubleBuffer putDouble(double value) { return put(value); } final public double getDouble(int index) { return get(index); } final public DoubleBuffer putDouble(int index, double value) { return put(index, value); };
+}
diff --git a/libjava/gnu/java/nio/FileChannelImpl.java b/libjava/gnu/java/nio/FileChannelImpl.java
new file mode 100644
index 00000000000..26b48e5e51c
--- /dev/null
+++ b/libjava/gnu/java/nio/FileChannelImpl.java
@@ -0,0 +1,234 @@
+/* FileChannelImpl.java --
+ Copyright (C) 2002 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.nio;
+
+import java.io.EOFException;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.RandomAccessFile;
+import java.nio.ByteBuffer;
+import java.nio.MappedByteBuffer;
+import java.nio.channels.FileChannel;
+
+/**
+ * This file is not user visible !
+ * But alas, Java does not have a concept of friendly packages
+ * so this class is public.
+ * Instances of this class are created by invoking getChannel
+ * Upon a Input/Output/RandomAccessFile object.
+ */
+
+public class FileChannelImpl extends FileChannel
+{
+ public long address;
+ public int length;
+ public int fd;
+ public MappedByteBuffer buf;
+ public Object file_obj; // just to keep it live...
+
+ /**
+ * This method came from java.io.RandomAccessFile
+ * It is private there so we will repeat it here.
+ */
+// private native long lengthInternal (int native_fd) throws IOException;
+ private long lengthInternal (int native_fd) throws IOException
+ {
+ return 0;
+ };
+
+ public FileChannelImpl (int fd, Object obj)
+ {
+ this.fd = fd;
+ this.file_obj = obj;
+ }
+
+ public long size () throws IOException
+ {
+ return lengthInternal (fd);
+ }
+
+ protected void implCloseChannel() throws IOException
+ {
+ if (address != 0)
+ {
+ nio_unmmap_file (fd, address, (int) length);
+ }
+
+ // FIXME
+ fd = 0;
+
+ if (file_obj instanceof RandomAccessFile)
+ {
+ RandomAccessFile o = (RandomAccessFile) file_obj;
+ o.close();
+ }
+ else if (file_obj instanceof FileInputStream)
+ {
+ FileInputStream o = (FileInputStream) file_obj;
+ o.close();
+ }
+ else if (file_obj instanceof FileOutputStream)
+ {
+ FileOutputStream o = (FileOutputStream) file_obj;
+ o.close();
+ }
+ }
+
+ public int read (ByteBuffer dst) throws IOException
+ {
+ int w = 0;
+ int s = (int)size();
+
+ if (buf == null)
+ {
+ throw new EOFException("file not mapped");
+ }
+
+ for (int i=0; i<s; i++)
+ {
+ dst.put( buf.get() );
+ }
+
+ return s;
+ }
+
+ public long read (ByteBuffer[] dsts) throws IOException
+ {
+ return read (dsts, 0, dsts.length);
+ }
+
+ public long read (ByteBuffer[] dsts, int offset, int length)
+ throws IOException
+ {
+ long result = 0;
+
+ for (int i = offset; i < offset + length; i++)
+ {
+ result += write (dsts[i]);
+ }
+
+ return result;
+ }
+
+ public int write (ByteBuffer src) throws IOException
+ {
+ int w = 0;
+
+ if (buf == null)
+ {
+ throw new EOFException ("file not mapped");
+ }
+
+ while (src.hasRemaining ())
+ {
+ buf.put (src.get ());
+ w++;
+ }
+
+ return w;
+ }
+
+ public long write(ByteBuffer[] srcs, int offset, int length)
+ throws IOException
+ {
+ long res = 0;
+
+ for (int i = offset;i < offset + length;i++)
+ {
+ res += write (srcs[i]);
+ }
+ return res;
+ }
+
+ public MappedByteBuffer map (FileChannel.MapMode mode, long position,
+ long size)
+ throws IOException
+ {
+// int cmode = mode.m;
+// address = nio_mmap_file (fd, position, size, cmode);
+// length = size;
+// buf = new MappedByteFileBuffer (this);
+// return buf;
+ return null;
+ }
+
+ static MappedByteBuffer create_direct_mapped_buffer (long address,
+ long length)
+ {
+// FileChannelImpl ch = new FileChannelImpl (-1, null);
+// ch.address = address;
+// ch.length = (int) length;
+// ch.buf = new MappedByteFileBuffer (ch);
+// return ch.buf;
+ return null;
+ }
+
+ public long write (ByteBuffer[] srcs)
+ throws IOException
+ {
+ return write (srcs, 0, srcs.length);
+ }
+
+ /**
+ * msync with the disk
+ */
+ public void force (boolean metaData)
+ {
+ nio_msync (fd, address, length);
+ }
+
+// static native long nio_mmap_file (int fd, long pos, int size, int mode);
+
+// static native void nio_unmmap_file (int fd, long address, int size);
+
+// static native void nio_msync (int fd, long address, int length);
+
+ static long nio_mmap_file (int fd, long pos, int size, int mode)
+ {
+ return 0;
+ }
+
+ static void nio_unmmap_file (int fd, long address, int size)
+ {
+ };
+
+ static void nio_msync (int fd, long address, int length)
+ {
+ };
+}
diff --git a/libjava/gnu/java/nio/FloatBufferImpl.java b/libjava/gnu/java/nio/FloatBufferImpl.java
new file mode 100644
index 00000000000..bab47425f1d
--- /dev/null
+++ b/libjava/gnu/java/nio/FloatBufferImpl.java
@@ -0,0 +1,196 @@
+/* FloatBufferImpl.java --
+ Copyright (C) 2002 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.nio;
+
+import java.nio.ByteBuffer;
+import java.nio.CharBuffer;
+import java.nio.DoubleBuffer;
+import java.nio.FloatBuffer;
+import java.nio.IntBuffer;
+import java.nio.LongBuffer;
+import java.nio.ShortBuffer;
+
+public final class FloatBufferImpl extends FloatBuffer
+{
+ private int array_offset;
+ private boolean ro;
+
+ public FloatBufferImpl(int cap, int off, int lim)
+ {
+ this.backing_buffer = new float[cap];
+ this.cap = cap;
+ this.limit(lim);
+ this.position(off);
+ }
+
+ public FloatBufferImpl(float[] array, int off, int lim)
+ {
+ this.backing_buffer = array;
+ this.cap = array.length;
+ this.limit(lim);
+ this.position(off);
+ }
+
+ public FloatBufferImpl(FloatBufferImpl copy)
+ {
+ backing_buffer = copy.backing_buffer;
+ ro = copy.ro;
+ limit(copy.limit());
+ position(copy.position());
+ }
+
+ void inc_pos(int a)
+ {
+ position(position() + a);
+ }
+
+ FloatBufferImpl(byte[] copy) { this.backing_buffer = copy != null ? nio_cast (copy) : null; }
+ private static native byte nio_get_Byte (FloatBufferImpl b, int index, int limit);
+ private static native void nio_put_Byte (FloatBufferImpl b, int index, int limit, byte value);
+
+ public ByteBuffer asByteBuffer()
+ {
+ ByteBufferImpl res = new ByteBufferImpl (backing_buffer);
+ res.limit ((limit () * 1) / 4);
+ return res;
+ }
+
+ FloatBufferImpl(char[] copy) { this.backing_buffer = copy != null ? nio_cast(copy) : null; }
+ private static native char nio_get_Char(FloatBufferImpl b, int index, int limit);
+ private static native void nio_put_Char(FloatBufferImpl b, int index, int limit, char value);
+ public CharBuffer asCharBuffer() { CharBufferImpl res = new CharBufferImpl(backing_buffer); res.limit((limit()*2)/4); return res; }
+
+ FloatBufferImpl(short[] copy) { this.backing_buffer = copy != null ? nio_cast(copy) : null; }
+ private static native short nio_get_Short(FloatBufferImpl b, int index, int limit);
+ private static native void nio_put_Short(FloatBufferImpl b, int index, int limit, short value);
+ public ShortBuffer asShortBuffer() { ShortBufferImpl res = new ShortBufferImpl(backing_buffer); res.limit((limit()*2)/4); return res; }
+
+ FloatBufferImpl(int[] copy) { this.backing_buffer = copy != null ? nio_cast(copy) : null; }
+ private static native int nio_get_Int(FloatBufferImpl b, int index, int limit);
+ private static native void nio_put_Int(FloatBufferImpl b, int index, int limit, int value);
+ public IntBuffer asIntBuffer() { IntBufferImpl res = new IntBufferImpl(backing_buffer); res.limit((limit()*4)/4); return res; }
+
+ FloatBufferImpl(long[] copy) { this.backing_buffer = copy != null ? nio_cast(copy) : null; }
+ private static native long nio_get_Long(FloatBufferImpl b, int index, int limit);
+ private static native void nio_put_Long(FloatBufferImpl b, int index, int limit, long value);
+ public LongBuffer asLongBuffer() { LongBufferImpl res = new LongBufferImpl(backing_buffer); res.limit((limit()*8)/4); return res; }
+
+ FloatBufferImpl(float[] copy) { this.backing_buffer = copy != null ? nio_cast(copy) : null; }
+ private static native float nio_get_Float(FloatBufferImpl b, int index, int limit);
+ private static native void nio_put_Float(FloatBufferImpl b, int index, int limit, float value);
+ public FloatBuffer asFloatBuffer() { FloatBufferImpl res = new FloatBufferImpl(backing_buffer); res.limit((limit()*4)/4); return res; }
+
+ FloatBufferImpl(double[] copy) { this.backing_buffer = copy != null ? nio_cast(copy) : null; }
+ private static native double nio_get_Double(FloatBufferImpl b, int index, int limit);
+ private static native void nio_put_Double(FloatBufferImpl b, int index, int limit, double value);
+ public DoubleBuffer asDoubleBuffer() { DoubleBufferImpl res = new DoubleBufferImpl(backing_buffer); res.limit((limit()*8)/4); return res; }
+
+ private static native float[] nio_cast(byte[]copy);
+ private static native float[] nio_cast(char[]copy);
+ private static native float[] nio_cast(short[]copy);
+ private static native float[] nio_cast(long[]copy);
+ private static native float[] nio_cast(int[]copy);
+ private static native float[] nio_cast(float[]copy);
+ private static native float[] nio_cast(double[]copy);
+
+ public boolean isReadOnly()
+ {
+ return ro;
+ }
+
+ public FloatBuffer slice()
+ {
+ FloatBufferImpl A = new FloatBufferImpl(this);
+ A.array_offset = position();
+ return A;
+ }
+
+ public FloatBuffer duplicate()
+ {
+ return new FloatBufferImpl(this);
+ }
+
+ public FloatBuffer asReadOnlyBuffer()
+ {
+ FloatBufferImpl a = new FloatBufferImpl(this);
+ a.ro = true;
+ return a;
+ }
+
+ public FloatBuffer compact()
+ {
+ return this;
+ }
+
+ public boolean isDirect()
+ {
+ return backing_buffer != null;
+ }
+
+ final public float get()
+ {
+ float e = backing_buffer[position()];
+ position(position()+1);
+ return e;
+ }
+
+ final public FloatBuffer put(float b)
+ {
+ backing_buffer[position()] = b;
+ position(position()+1);
+ return this;
+ }
+
+ final public float get(int index)
+ {
+ return backing_buffer[index];
+ }
+
+ final public FloatBuffer put(int index, float b)
+ {
+ backing_buffer[index] = b;
+ return this;
+ }
+
+ final public char getChar() { char a = nio_get_Char(this, position(), limit()); inc_pos(2); return a; } final public FloatBuffer putChar(char value) { nio_put_Char(this, position(), limit(), value); inc_pos(2); return this; } final public char getChar(int index) { char a = nio_get_Char(this, index, limit()); return a; } final public FloatBuffer putChar(int index, char value) { nio_put_Char(this, index, limit(), value); return this; };
+ final public short getShort() { short a = nio_get_Short(this, position(), limit()); inc_pos(2); return a; } final public FloatBuffer putShort(short value) { nio_put_Short(this, position(), limit(), value); inc_pos(2); return this; } final public short getShort(int index) { short a = nio_get_Short(this, index, limit()); return a; } final public FloatBuffer putShort(int index, short value) { nio_put_Short(this, index, limit(), value); return this; };
+ final public int getInt() { int a = nio_get_Int(this, position(), limit()); inc_pos(4); return a; } final public FloatBuffer putInt(int value) { nio_put_Int(this, position(), limit(), value); inc_pos(4); return this; } final public int getInt(int index) { int a = nio_get_Int(this, index, limit()); return a; } final public FloatBuffer putInt(int index, int value) { nio_put_Int(this, index, limit(), value); return this; };
+ final public long getLong() { long a = nio_get_Long(this, position(), limit()); inc_pos(8); return a; } final public FloatBuffer putLong(long value) { nio_put_Long(this, position(), limit(), value); inc_pos(8); return this; } final public long getLong(int index) { long a = nio_get_Long(this, index, limit()); return a; } final public FloatBuffer putLong(int index, long value) { nio_put_Long(this, index, limit(), value); return this; };
+ final public float getFloat() { return get(); } final public FloatBuffer putFloat(float value) { return put(value); } final public float getFloat(int index) { return get(index); } final public FloatBuffer putFloat(int index, float value) { return put(index, value); };
+ final public double getDouble() { double a = nio_get_Double(this, position(), limit()); inc_pos(8); return a; } final public FloatBuffer putDouble(double value) { nio_put_Double(this, position(), limit(), value); inc_pos(8); return this; } final public double getDouble(int index) { double a = nio_get_Double(this, index, limit()); return a; } final public FloatBuffer putDouble(int index, double value) { nio_put_Double(this, index, limit(), value); return this; };
+}
diff --git a/libjava/gnu/java/nio/IntBufferImpl.java b/libjava/gnu/java/nio/IntBufferImpl.java
new file mode 100644
index 00000000000..cccc418487c
--- /dev/null
+++ b/libjava/gnu/java/nio/IntBufferImpl.java
@@ -0,0 +1,190 @@
+/* IntBufferImpl.java --
+ Copyright (C) 2002 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.nio;
+
+import java.nio.ByteBuffer;
+import java.nio.CharBuffer;
+import java.nio.DoubleBuffer;
+import java.nio.FloatBuffer;
+import java.nio.IntBuffer;
+import java.nio.LongBuffer;
+import java.nio.ShortBuffer;
+
+public final class IntBufferImpl extends IntBuffer
+{
+ private int array_offset;
+ private boolean ro;
+
+ public IntBufferImpl(int cap, int off, int lim)
+ {
+ this.backing_buffer = new int[cap];
+ this.cap = cap;
+ this.limit(lim);
+ this.position(off);
+ }
+
+ public IntBufferImpl(int[] array, int off, int lim)
+ {
+ this.backing_buffer = array;
+ this.cap = array.length;
+ this.limit(lim);
+ this.position(off);
+ }
+
+ public IntBufferImpl(IntBufferImpl copy)
+ {
+ backing_buffer = copy.backing_buffer;
+ ro = copy.ro;
+ limit(copy.limit());
+ position(copy.position());
+ }
+
+ void inc_pos(int a)
+ {
+ position(position() + a);
+ }
+
+ IntBufferImpl(byte[] copy) { this.backing_buffer = copy != null ? nio_cast(copy) : null; }
+ private static native byte nio_get_Byte(IntBufferImpl b, int index, int limit);
+ private static native void nio_put_Byte(IntBufferImpl b, int index, int limit, byte value);
+ public ByteBuffer asByteBuffer() { ByteBufferImpl res = new ByteBufferImpl(backing_buffer); res.limit((limit()*1)/4); return res; }
+
+ IntBufferImpl(char[] copy) { this.backing_buffer = copy != null ? nio_cast(copy) : null; }
+ private static native char nio_get_Char(IntBufferImpl b, int index, int limit);
+ private static native void nio_put_Char(IntBufferImpl b, int index, int limit, char value);
+ public CharBuffer asCharBuffer() { CharBufferImpl res = new CharBufferImpl(backing_buffer); res.limit((limit()*2)/4); return res; }
+
+ IntBufferImpl(short[] copy) { this.backing_buffer = copy != null ? nio_cast(copy) : null; }
+ private static native short nio_get_Short(IntBufferImpl b, int index, int limit);
+ private static native void nio_put_Short(IntBufferImpl b, int index, int limit, short value);
+ public ShortBuffer asShortBuffer() { ShortBufferImpl res = new ShortBufferImpl(backing_buffer); res.limit((limit()*2)/4); return res; }
+
+ IntBufferImpl(int[] copy) { this.backing_buffer = copy != null ? nio_cast(copy) : null; }
+ private static native int nio_get_Int(IntBufferImpl b, int index, int limit);
+ private static native void nio_put_Int(IntBufferImpl b, int index, int limit, int value);
+ public IntBuffer asIntBuffer() { IntBufferImpl res = new IntBufferImpl(backing_buffer); res.limit((limit()*4)/4); return res; }
+
+ IntBufferImpl(long[] copy) { this.backing_buffer = copy != null ? nio_cast(copy) : null; }
+ private static native long nio_get_Long(IntBufferImpl b, int index, int limit);
+ private static native void nio_put_Long(IntBufferImpl b, int index, int limit, long value);
+ public LongBuffer asLongBuffer() { LongBufferImpl res = new LongBufferImpl(backing_buffer); res.limit((limit()*8)/4); return res; }
+
+ IntBufferImpl(float[] copy) { this.backing_buffer = copy != null ? nio_cast(copy) : null; }
+ private static native float nio_get_Float(IntBufferImpl b, int index, int limit);
+ private static native void nio_put_Float(IntBufferImpl b, int index, int limit, float value);
+ public FloatBuffer asFloatBuffer() { FloatBufferImpl res = new FloatBufferImpl(backing_buffer); res.limit((limit()*4)/4); return res; }
+
+ IntBufferImpl(double[] copy) { this.backing_buffer = copy != null ? nio_cast(copy) : null; }
+ private static native double nio_get_Double(IntBufferImpl b, int index, int limit);
+ private static native void nio_put_Double(IntBufferImpl b, int index, int limit, double value);
+ public DoubleBuffer asDoubleBuffer() { DoubleBufferImpl res = new DoubleBufferImpl(backing_buffer); res.limit((limit()*8)/4); return res; }
+
+ private static native int[] nio_cast(byte[]copy);
+ private static native int[] nio_cast(char[]copy);
+ private static native int[] nio_cast(short[]copy);
+ private static native int[] nio_cast(long[]copy);
+ private static native int[] nio_cast(int[]copy);
+ private static native int[] nio_cast(float[]copy);
+ private static native int[] nio_cast(double[]copy);
+
+ public boolean isReadOnly()
+ {
+ return ro;
+ }
+
+ public IntBuffer slice()
+ {
+ IntBufferImpl A = new IntBufferImpl(this);
+ A.array_offset = position();
+ return A;
+ }
+
+ public IntBuffer duplicate()
+ {
+ return new IntBufferImpl(this);
+ }
+
+ public IntBuffer asReadOnlyBuffer()
+ {
+ IntBufferImpl a = new IntBufferImpl(this);
+ a.ro = true;
+ return a;
+ }
+
+ public IntBuffer compact()
+ {
+ return this;
+ }
+
+ public boolean isDirect()
+ {
+ return backing_buffer != null;
+ }
+
+ final public int get()
+ {
+ int e = backing_buffer[position()];
+ position(position()+1);
+ return e;
+ }
+
+ final public IntBuffer put(int b)
+ {
+ backing_buffer[position()] = b;
+ position(position()+1);
+ return this;
+ }
+
+ final public int get(int index)
+ {
+ return backing_buffer[index];
+ }
+
+ final public IntBuffer put(int index, int b)
+ {
+ backing_buffer[index] = b;
+ return this;
+ }
+
+ final public char getChar() { char a = nio_get_Char(this, position(), limit()); inc_pos(2); return a; } final public IntBuffer putChar(char value) { nio_put_Char(this, position(), limit(), value); inc_pos(2); return this; } final public char getChar(int index) { char a = nio_get_Char(this, index, limit()); return a; } final public IntBuffer putChar(int index, char value) { nio_put_Char(this, index, limit(), value); return this; };
+ final public short getShort() { short a = nio_get_Short(this, position(), limit()); inc_pos(2); return a; } final public IntBuffer putShort(short value) { nio_put_Short(this, position(), limit(), value); inc_pos(2); return this; } final public short getShort(int index) { short a = nio_get_Short(this, index, limit()); return a; } final public IntBuffer putShort(int index, short value) { nio_put_Short(this, index, limit(), value); return this; };
+ final public int getInt() { return get(); } final public IntBuffer putInt(int value) { return put(value); } final public int getInt(int index) { return get(index); } final public IntBuffer putInt(int index, int value) { return put(index, value); };
+ final public long getLong() { long a = nio_get_Long(this, position(), limit()); inc_pos(8); return a; } final public IntBuffer putLong(long value) { nio_put_Long(this, position(), limit(), value); inc_pos(8); return this; } final public long getLong(int index) { long a = nio_get_Long(this, index, limit()); return a; } final public IntBuffer putLong(int index, long value) { nio_put_Long(this, index, limit(), value); return this; };
+ final public float getFloat() { float a = nio_get_Float(this, position(), limit()); inc_pos(4); return a; } final public IntBuffer putFloat(float value) { nio_put_Float(this, position(), limit(), value); inc_pos(4); return this; } final public float getFloat(int index) { float a = nio_get_Float(this, index, limit()); return a; } final public IntBuffer putFloat(int index, float value) { nio_put_Float(this, index, limit(), value); return this; };
+ final public double getDouble() { double a = nio_get_Double(this, position(), limit()); inc_pos(8); return a; } final public IntBuffer putDouble(double value) { nio_put_Double(this, position(), limit(), value); inc_pos(8); return this; } final public double getDouble(int index) { double a = nio_get_Double(this, index, limit()); return a; } final public IntBuffer putDouble(int index, double value) { nio_put_Double(this, index, limit(), value); return this; };
+}
diff --git a/libjava/gnu/java/nio/LongBufferImpl.java b/libjava/gnu/java/nio/LongBufferImpl.java
new file mode 100644
index 00000000000..8f29b06939f
--- /dev/null
+++ b/libjava/gnu/java/nio/LongBufferImpl.java
@@ -0,0 +1,190 @@
+/* LongBufferImpl.java --
+ Copyright (C) 2002 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.nio;
+
+import java.nio.ByteBuffer;
+import java.nio.CharBuffer;
+import java.nio.DoubleBuffer;
+import java.nio.FloatBuffer;
+import java.nio.IntBuffer;
+import java.nio.LongBuffer;
+import java.nio.ShortBuffer;
+
+public final class LongBufferImpl extends LongBuffer
+{
+ private int array_offset;
+ private boolean ro;
+
+ public LongBufferImpl(int cap, int off, int lim)
+ {
+ this.backing_buffer = new long[cap];
+ this.cap = cap ;
+ this.limit(lim);
+ this.position(off);
+ }
+
+ public LongBufferImpl(long[] array, int off, int lim)
+ {
+ this.backing_buffer = array;
+ this.cap = array.length;
+ this.limit(lim);
+ this.position(off);
+ }
+
+ public LongBufferImpl(LongBufferImpl copy)
+ {
+ backing_buffer = copy.backing_buffer;
+ ro = copy.ro;
+ limit(copy.limit());
+ position(copy.position());
+ }
+
+ void inc_pos(int a)
+ {
+ position(position() + a);
+ }
+
+ LongBufferImpl(byte[] copy) { this.backing_buffer = copy != null ? nio_cast(copy) : null; }
+ private static native byte nio_get_Byte(LongBufferImpl b, int index, int limit);
+ private static native void nio_put_Byte(LongBufferImpl b, int index, int limit, byte value);
+ public ByteBuffer asByteBuffer() { ByteBufferImpl res = new ByteBufferImpl(backing_buffer); res.limit((limit()*1)/8); return res; }
+
+ LongBufferImpl(char[] copy) { this.backing_buffer = copy != null ? nio_cast(copy) : null; }
+ private static native char nio_get_Char(LongBufferImpl b, int index, int limit);
+ private static native void nio_put_Char(LongBufferImpl b, int index, int limit, char value);
+ public CharBuffer asCharBuffer() { CharBufferImpl res = new CharBufferImpl(backing_buffer); res.limit((limit()*2)/8); return res; }
+
+ LongBufferImpl(short[] copy) { this.backing_buffer = copy != null ? nio_cast(copy) : null; }
+ private static native short nio_get_Short(LongBufferImpl b, int index, int limit);
+ private static native void nio_put_Short(LongBufferImpl b, int index, int limit, short value);
+ public ShortBuffer asShortBuffer() { ShortBufferImpl res = new ShortBufferImpl(backing_buffer); res.limit((limit()*2)/8); return res; }
+
+ LongBufferImpl(int[] copy) { this.backing_buffer = copy != null ? nio_cast(copy) : null; }
+ private static native int nio_get_Int(LongBufferImpl b, int index, int limit);
+ private static native void nio_put_Int(LongBufferImpl b, int index, int limit, int value);
+ public IntBuffer asIntBuffer() { IntBufferImpl res = new IntBufferImpl(backing_buffer); res.limit((limit()*4)/8); return res; }
+
+ LongBufferImpl(long[] copy) { this.backing_buffer = copy != null ? nio_cast(copy) : null; }
+ private static native long nio_get_Long(LongBufferImpl b, int index, int limit);
+ private static native void nio_put_Long(LongBufferImpl b, int index, int limit, long value);
+ public LongBuffer asLongBuffer() { LongBufferImpl res = new LongBufferImpl(backing_buffer); res.limit((limit()*8)/8); return res; }
+
+ LongBufferImpl(float[] copy) { this.backing_buffer = copy != null ? nio_cast(copy) : null; }
+ private static native float nio_get_Float(LongBufferImpl b, int index, int limit);
+ private static native void nio_put_Float(LongBufferImpl b, int index, int limit, float value);
+ public FloatBuffer asFloatBuffer() { FloatBufferImpl res = new FloatBufferImpl(backing_buffer); res.limit((limit()*4)/8); return res; }
+
+ LongBufferImpl(double[] copy) { this.backing_buffer = copy != null ? nio_cast(copy) : null; }
+ private static native double nio_get_Double(LongBufferImpl b, int index, int limit);
+ private static native void nio_put_Double(LongBufferImpl b, int index, int limit, double value);
+ public DoubleBuffer asDoubleBuffer() { DoubleBufferImpl res = new DoubleBufferImpl(backing_buffer); res.limit((limit()*8)/8); return res; }
+
+ private static native long[] nio_cast(byte[]copy);
+ private static native long[] nio_cast(char[]copy);
+ private static native long[] nio_cast(short[]copy);
+ private static native long[] nio_cast(long[]copy);
+ private static native long[] nio_cast(int[]copy);
+ private static native long[] nio_cast(float[]copy);
+ private static native long[] nio_cast(double[]copy);
+
+ public boolean isReadOnly()
+ {
+ return ro;
+ }
+
+ public LongBuffer slice()
+ {
+ LongBufferImpl A = new LongBufferImpl(this);
+ A.array_offset = position();
+ return A;
+ }
+
+ public LongBuffer duplicate()
+ {
+ return new LongBufferImpl(this);
+ }
+
+ public LongBuffer asReadOnlyBuffer()
+ {
+ LongBufferImpl a = new LongBufferImpl(this);
+ a.ro = true;
+ return a;
+ }
+
+ public LongBuffer compact()
+ {
+ return this;
+ }
+
+ public boolean isDirect()
+ {
+ return backing_buffer != null;
+ }
+
+ final public long get()
+ {
+ long e = backing_buffer[position()];
+ position(position()+1);
+ return e;
+ }
+
+ final public LongBuffer put(long b)
+ {
+ backing_buffer[position()] = b;
+ position(position()+1);
+ return this;
+ }
+
+ final public long get(int index)
+ {
+ return backing_buffer[index];
+ }
+
+ final public LongBuffer put(int index, long b)
+ {
+ backing_buffer[index] = b;
+ return this;
+ }
+
+ final public char getChar() { char a = nio_get_Char(this, position(), limit()); inc_pos(2); return a; } final public LongBuffer putChar(char value) { nio_put_Char(this, position(), limit(), value); inc_pos(2); return this; } final public char getChar(int index) { char a = nio_get_Char(this, index, limit()); return a; } final public LongBuffer putChar(int index, char value) { nio_put_Char(this, index, limit(), value); return this; };
+ final public short getShort() { short a = nio_get_Short(this, position(), limit()); inc_pos(2); return a; } final public LongBuffer putShort(short value) { nio_put_Short(this, position(), limit(), value); inc_pos(2); return this; } final public short getShort(int index) { short a = nio_get_Short(this, index, limit()); return a; } final public LongBuffer putShort(int index, short value) { nio_put_Short(this, index, limit(), value); return this; };
+ final public int getInt() { int a = nio_get_Int(this, position(), limit()); inc_pos(4); return a; } final public LongBuffer putInt(int value) { nio_put_Int(this, position(), limit(), value); inc_pos(4); return this; } final public int getInt(int index) { int a = nio_get_Int(this, index, limit()); return a; } final public LongBuffer putInt(int index, int value) { nio_put_Int(this, index, limit(), value); return this; };
+ final public long getLong() { return get(); } final public LongBuffer putLong(long value) { return put(value); } final public long getLong(int index) { return get(index); } final public LongBuffer putLong(int index, long value) { return put(index, value); };
+ final public float getFloat() { float a = nio_get_Float(this, position(), limit()); inc_pos(4); return a; } final public LongBuffer putFloat(float value) { nio_put_Float(this, position(), limit(), value); inc_pos(4); return this; } final public float getFloat(int index) { float a = nio_get_Float(this, index, limit()); return a; } final public LongBuffer putFloat(int index, float value) { nio_put_Float(this, index, limit(), value); return this; };
+ final public double getDouble() { double a = nio_get_Double(this, position(), limit()); inc_pos(8); return a; } final public LongBuffer putDouble(double value) { nio_put_Double(this, position(), limit(), value); inc_pos(8); return this; } final public double getDouble(int index) { double a = nio_get_Double(this, index, limit()); return a; } final public LongBuffer putDouble(int index, double value) { nio_put_Double(this, index, limit(), value); return this; };
+}
diff --git a/libjava/gnu/java/nio/PipeImpl.java b/libjava/gnu/java/nio/PipeImpl.java
new file mode 100644
index 00000000000..77341e7f4a0
--- /dev/null
+++ b/libjava/gnu/java/nio/PipeImpl.java
@@ -0,0 +1,57 @@
+/* PipeImpl.java --
+ Copyright (C) 2002 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.nio;
+
+import java.nio.channels.Pipe;
+
+class PipeImpl extends Pipe
+{
+ public PipeImpl()
+ {
+ }
+
+ public Pipe.SinkChannel sink()
+ {
+ return null;
+ }
+
+ public Pipe.SourceChannel source()
+ {
+ return null;
+ }
+}
diff --git a/libjava/gnu/java/nio/SelectionKeyImpl.java b/libjava/gnu/java/nio/SelectionKeyImpl.java
new file mode 100644
index 00000000000..5763d6880d3
--- /dev/null
+++ b/libjava/gnu/java/nio/SelectionKeyImpl.java
@@ -0,0 +1,91 @@
+/* SelectionKeyImpl.java --
+ Copyright (C) 2002 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.nio;
+
+import java.nio.channels.SelectableChannel;
+import java.nio.channels.SelectionKey;
+import java.nio.channels.Selector;
+import java.nio.channels.spi.AbstractSelectionKey;
+
+public class SelectionKeyImpl extends AbstractSelectionKey
+{
+ int fd;
+ int readyOps;
+ int interestOps;
+ SelectorImpl impl;
+ SelectableChannel ch;
+
+ public SelectionKeyImpl(SelectableChannel ch, SelectorImpl impl, int fd)
+ {
+ this.ch = ch;
+ this.impl = impl;
+ this.fd = fd;
+ }
+
+ public SelectableChannel channel ()
+ {
+ return ch;
+ }
+
+ public int readyOps ()
+ {
+ return readyOps;
+ }
+
+ public SelectionKey readyOps (int ops)
+ {
+ readyOps = ops;
+ return this;
+ }
+
+ public int interestOps ()
+ {
+ return interestOps;
+ }
+
+ public SelectionKey interestOps (int ops)
+ {
+ interestOps = ops;
+ return this;
+ }
+
+ public Selector selector ()
+ {
+ return impl;
+ }
+}
diff --git a/libjava/gnu/java/nio/SelectorImpl.java b/libjava/gnu/java/nio/SelectorImpl.java
new file mode 100644
index 00000000000..0b513f9da52
--- /dev/null
+++ b/libjava/gnu/java/nio/SelectorImpl.java
@@ -0,0 +1,299 @@
+/* SelectorImpl.java --
+ Copyright (C) 2002 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.nio;
+
+import java.nio.channels.ClosedSelectorException;
+import java.nio.channels.SelectableChannel;
+import java.nio.channels.SelectionKey;
+import java.nio.channels.Selector;
+import java.nio.channels.spi.AbstractSelectableChannel;
+import java.nio.channels.spi.AbstractSelector;
+import java.nio.channels.spi.SelectorProvider;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Set;
+
+public class SelectorImpl extends AbstractSelector
+{
+ boolean closed = false;
+ Set keys, selected, canceled;
+
+ public SelectorImpl (SelectorProvider provider)
+ {
+ super (provider);
+
+ keys = new HashSet ();
+ selected = new HashSet ();
+ canceled = new HashSet ();
+ }
+
+ public Set keys ()
+ {
+ return keys;
+ }
+
+ public int selectNow ()
+ {
+ return select (1);
+ }
+
+ public int select ()
+ {
+ return select (-1);
+ }
+
+ // A timeout value of -1 means block forever.
+ private static native int java_do_select (int[] read, int[] write,
+ int[] except, long timeout);
+
+ private int[] getFDsAsArray (int ops)
+ {
+ int[] result;
+ int counter = 0;
+ Iterator it = keys.iterator ();
+
+ // Count the number of file descriptors needed
+ while (it.hasNext ())
+ {
+ SelectionKeyImpl key = (SelectionKeyImpl) it.next ();
+
+ if ((key.interestOps () & ops) != 0)
+ {
+ counter++;
+ }
+ }
+
+ result = new int[counter];
+
+ counter = 0;
+ it = keys.iterator ();
+
+ // Fill the array with the file descriptors
+ while (it.hasNext ())
+ {
+ SelectionKeyImpl key = (SelectionKeyImpl) it.next ();
+
+ if ((key.interestOps () & ops) != 0)
+ {
+ result[counter] = key.fd;
+ counter++;
+ }
+ }
+
+ return result;
+ }
+
+ public int select (long timeout)
+ {
+ if (closed)
+ {
+ throw new ClosedSelectorException ();
+ }
+
+ if (keys == null)
+ {
+ return 0;
+ }
+
+ int ret = 0;
+
+ deregisterCanceledKeys ();
+
+ // Set only keys with the needed interest ops into the arrays.
+ int[] read = getFDsAsArray (SelectionKey.OP_READ | SelectionKey.OP_ACCEPT);
+ int[] write = getFDsAsArray (SelectionKey.OP_WRITE | SelectionKey.OP_CONNECT);
+ int[] except = new int [0]; // FIXME: We dont need to check this yet
+
+ // Call the native select () on all file descriptors.
+ int anzahl = read.length + write.length + except.length;
+ ret = java_do_select (read, write, except, timeout);
+
+ Iterator it = keys.iterator ();
+
+ while (it.hasNext ())
+ {
+ int ops = 0;
+ SelectionKeyImpl key = (SelectionKeyImpl) it.next ();
+
+ // If key is already selected retrieve old ready ops.
+ if (selected.contains (key))
+ {
+ ops = key.readyOps ();
+ }
+
+ // Set new ready read/accept ops
+ for (int i = 0; i < read.length; i++)
+ {
+ if (key.fd == read[i])
+ {
+ if (key.channel () instanceof ServerSocketChannelImpl)
+ {
+ ops = ops | SelectionKey.OP_ACCEPT;
+ }
+ else
+ {
+ ops = ops | SelectionKey.OP_READ;
+ }
+ }
+ }
+
+ // Set new ready write ops
+ for (int i = 0; i < write.length; i++)
+ {
+ if (key.fd == write[i])
+ {
+ ops = ops | SelectionKey.OP_WRITE;
+
+// if (key.channel ().isConnected ())
+// {
+// ops = ops | SelectionKey.OP_WRITE;
+// }
+// else
+// {
+// ops = ops | SelectionKey.OP_CONNECT;
+// }
+ }
+ }
+
+ // FIXME: We dont handle exceptional file descriptors yet.
+
+ // If key is not yet selected add it.
+ if (!selected.contains (key))
+ {
+ add_selected (key);
+ }
+
+ // Set new ready ops
+ key.readyOps (key.interestOps () & ops);
+ }
+
+ deregisterCanceledKeys ();
+ return ret;
+ }
+
+ public Set selectedKeys ()
+ {
+ return selected;
+ }
+
+ public Selector wakeup ()
+ {
+ return null;
+ }
+
+ public void add (SelectionKeyImpl k)
+ {
+ keys.add (k);
+ }
+
+ void add_selected (SelectionKeyImpl k)
+ {
+ selected.add (k);
+ }
+
+ protected void implCloseSelector ()
+ {
+ closed = true;
+ }
+
+ private void deregisterCanceledKeys ()
+ {
+ Iterator it = canceled.iterator ();
+
+ while (it.hasNext ())
+ {
+ keys.remove ((SelectionKeyImpl) it.next ());
+ it.remove ();
+ }
+ }
+
+ protected SelectionKey register (SelectableChannel ch, int ops, Object att)
+ {
+ return register ((AbstractSelectableChannel) ch, ops, att);
+ }
+
+ protected SelectionKey register (AbstractSelectableChannel ch, int ops,
+ Object att)
+ {
+// // filechannel is not selectable ?
+// if (ch instanceof FileChannelImpl)
+// {
+// FileChannelImpl fc = (FileChannelImpl) ch;
+// SelectionKeyImpl impl = new SelectionKeyImpl (ch, this, fc.fd);
+// keys.add (impl);
+// impl.interestOps (ops);
+// impl.attach (att);
+// return impl;
+// }
+// else
+
+ if (ch instanceof SocketChannelImpl)
+ {
+ SocketChannelImpl sc = (SocketChannelImpl) ch;
+ SelectionKeyImpl impl = new SelectionKeyImpl (ch, this, sc.fd);
+ add (impl);
+ impl.interestOps (ops);
+ impl.attach (att);
+ return impl;
+ }
+ else if (ch instanceof DatagramChannelImpl)
+ {
+ DatagramChannelImpl dc = (DatagramChannelImpl) ch;
+ SelectionKeyImpl impl = new SelectionKeyImpl (ch, this, dc.fd);
+ add (impl);
+ impl.interestOps (ops);
+ impl.attach (att);
+ return impl;
+ }
+ else if (ch instanceof ServerSocketChannelImpl)
+ {
+ ServerSocketChannelImpl ssc = (ServerSocketChannelImpl) ch;
+ SelectionKeyImpl impl = new SelectionKeyImpl (ch, this, ssc.fd);
+ add (impl);
+ impl.interestOps (ops);
+ impl.attach (att);
+ return impl;
+ }
+ else
+ {
+ System.err.println ("INTERNAL ERROR, no known channel type");
+ }
+
+ return null;
+ }
+}
diff --git a/libjava/gnu/java/nio/SelectorProviderImpl.java b/libjava/gnu/java/nio/SelectorProviderImpl.java
new file mode 100644
index 00000000000..3fedfc73546
--- /dev/null
+++ b/libjava/gnu/java/nio/SelectorProviderImpl.java
@@ -0,0 +1,77 @@
+/* SelectorProviderImpl.java --
+ Copyright (C) 2002 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.nio;
+
+import java.nio.channels.DatagramChannel;
+import java.nio.channels.Pipe;
+import java.nio.channels.ServerSocketChannel;
+import java.nio.channels.SocketChannel;
+import java.nio.channels.spi.SelectorProvider;
+import java.nio.channels.spi.AbstractSelector;
+
+public class SelectorProviderImpl extends SelectorProvider
+{
+ public SelectorProviderImpl ()
+ {
+ }
+
+ public DatagramChannel openDatagramChannel ()
+ {
+ return new DatagramChannelImpl (this);
+ }
+
+ public Pipe openPipe ()
+ {
+ return new PipeImpl ();
+ }
+
+ public AbstractSelector openSelector ()
+ {
+ return new SelectorImpl (this);
+ }
+
+ public ServerSocketChannel openServerSocketChannel ()
+ {
+ return new ServerSocketChannelImpl (this);
+ }
+
+ public SocketChannel openSocketChannel ()
+ {
+ return new SocketChannelImpl (this);
+ }
+}
diff --git a/libjava/gnu/java/nio/ServerSocketChannelImpl.java b/libjava/gnu/java/nio/ServerSocketChannelImpl.java
new file mode 100644
index 00000000000..4a51f2a4b61
--- /dev/null
+++ b/libjava/gnu/java/nio/ServerSocketChannelImpl.java
@@ -0,0 +1,113 @@
+/* ServerSocketChannelImpl.java --
+ Copyright (C) 2002 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.nio;
+
+import java.io.IOException;
+import java.net.InetSocketAddress;
+import java.net.ServerSocket;
+import java.net.SocketAddress;
+import java.nio.channels.ServerSocketChannel;
+import java.nio.channels.SocketChannel;
+import java.nio.channels.spi.SelectorProvider;
+
+class ServerSocketChannelImpl extends ServerSocketChannel
+{
+ ServerSocket sock_object;
+ int fd;
+// int local_port;
+ boolean blocking = true;
+ boolean connected = false;
+// InetSocketAddress sa;
+
+ private static native int SocketAccept (ServerSocketChannelImpl server,
+ SocketChannelImpl s);
+
+ protected ServerSocketChannelImpl (SelectorProvider provider)
+ {
+ super (provider);
+ fd = SocketChannelImpl.SocketCreate ();
+
+ try
+ {
+ sock_object = new ServerSocket ();
+ }
+ catch (IOException e)
+ {
+ System.err.println ("ServerSocket could not be created.");
+ }
+ }
+
+ public void finalizer()
+ {
+ if (connected)
+ {
+ try
+ {
+ close();
+ }
+ catch (Exception e)
+ {
+ }
+ }
+ }
+
+ protected void implCloseSelectableChannel ()
+ {
+ connected = false;
+ SocketChannelImpl.SocketClose (fd);
+ fd = SocketChannelImpl.SocketCreate ();
+ }
+
+ protected void implConfigureBlocking (boolean block)
+ {
+ blocking = block;
+ }
+
+ public SocketChannel accept ()
+ {
+ SocketChannelImpl result = new SocketChannelImpl (provider ());
+ result.sa = new InetSocketAddress (0);
+ int res = SocketAccept (this,result);
+ return result;
+ }
+
+ public ServerSocket socket ()
+ {
+ return sock_object;
+ }
+}
diff --git a/libjava/gnu/java/nio/ShortBufferImpl.java b/libjava/gnu/java/nio/ShortBufferImpl.java
new file mode 100644
index 00000000000..bccb2d0f65a
--- /dev/null
+++ b/libjava/gnu/java/nio/ShortBufferImpl.java
@@ -0,0 +1,190 @@
+/* ShortBufferImpl.java --
+ Copyright (C) 2002 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.nio;
+
+import java.nio.ByteBuffer;
+import java.nio.CharBuffer;
+import java.nio.DoubleBuffer;
+import java.nio.FloatBuffer;
+import java.nio.IntBuffer;
+import java.nio.LongBuffer;
+import java.nio.ShortBuffer;
+
+public final class ShortBufferImpl extends ShortBuffer
+{
+ private int array_offset;
+ private boolean ro;
+
+ public ShortBufferImpl(int cap, int off, int lim)
+ {
+ this.backing_buffer = new short[cap];
+ this.cap = cap ;
+ this.limit(lim);
+ this.position(off);
+ }
+
+ public ShortBufferImpl(short[] array, int off, int lim)
+ {
+ this.backing_buffer = array;
+ this.cap = array.length;
+ this.limit(lim);
+ this.position(off);
+ }
+
+ public ShortBufferImpl(ShortBufferImpl copy)
+ {
+ backing_buffer = copy.backing_buffer;
+ ro = copy.ro;
+ limit(copy.limit());
+ position(copy.position());
+ }
+
+ void inc_pos(int a)
+ {
+ position(position() + a);
+ }
+
+ ShortBufferImpl(byte[] copy) { this.backing_buffer = copy != null ? nio_cast(copy) : null; }
+ private static native byte nio_get_Byte(ShortBufferImpl b, int index, int limit);
+ private static native void nio_put_Byte(ShortBufferImpl b, int index, int limit, byte value);
+ public ByteBuffer asByteBuffer() { ByteBufferImpl res = new ByteBufferImpl(backing_buffer); res.limit((limit()*1)/2); return res; }
+
+ ShortBufferImpl(char[] copy) { this.backing_buffer = copy != null ? nio_cast(copy) : null; }
+ private static native char nio_get_Char(ShortBufferImpl b, int index, int limit);
+ private static native void nio_put_Char(ShortBufferImpl b, int index, int limit, char value);
+ public CharBuffer asCharBuffer() { CharBufferImpl res = new CharBufferImpl(backing_buffer); res.limit((limit()*2)/2); return res; }
+
+ ShortBufferImpl(short[] copy) { this.backing_buffer = copy != null ? nio_cast(copy) : null; }
+ private static native short nio_get_Short(ShortBufferImpl b, int index, int limit);
+ private static native void nio_put_Short(ShortBufferImpl b, int index, int limit, short value);
+ public ShortBuffer asShortBuffer() { ShortBufferImpl res = new ShortBufferImpl(backing_buffer); res.limit((limit()*2)/2); return res; }
+
+ ShortBufferImpl(int[] copy) { this.backing_buffer = copy != null ? nio_cast(copy) : null; }
+ private static native int nio_get_Int(ShortBufferImpl b, int index, int limit);
+ private static native void nio_put_Int(ShortBufferImpl b, int index, int limit, int value);
+ public IntBuffer asIntBuffer() { IntBufferImpl res = new IntBufferImpl(backing_buffer); res.limit((limit()*4)/2); return res; }
+
+ ShortBufferImpl(long[] copy) { this.backing_buffer = copy != null ? nio_cast(copy) : null; }
+ private static native long nio_get_Long(ShortBufferImpl b, int index, int limit);
+ private static native void nio_put_Long(ShortBufferImpl b, int index, int limit, long value);
+ public LongBuffer asLongBuffer() { LongBufferImpl res = new LongBufferImpl(backing_buffer); res.limit((limit()*8)/2); return res; }
+
+ ShortBufferImpl(float[] copy) { this.backing_buffer = copy != null ? nio_cast(copy) : null; }
+ private static native float nio_get_Float(ShortBufferImpl b, int index, int limit);
+ private static native void nio_put_Float(ShortBufferImpl b, int index, int limit, float value);
+ public FloatBuffer asFloatBuffer() { FloatBufferImpl res = new FloatBufferImpl(backing_buffer); res.limit((limit()*4)/2); return res; }
+
+ ShortBufferImpl(double[] copy) { this.backing_buffer = copy != null ? nio_cast(copy) : null; }
+ private static native double nio_get_Double(ShortBufferImpl b, int index, int limit);
+ private static native void nio_put_Double(ShortBufferImpl b, int index, int limit, double value);
+ public DoubleBuffer asDoubleBuffer() { DoubleBufferImpl res = new DoubleBufferImpl(backing_buffer); res.limit((limit()*8)/2); return res; }
+
+ private static native short[] nio_cast(byte[]copy);
+ private static native short[] nio_cast(char[]copy);
+ private static native short[] nio_cast(short[]copy);
+ private static native short[] nio_cast(long[]copy);
+ private static native short[] nio_cast(int[]copy);
+ private static native short[] nio_cast(float[]copy);
+ private static native short[] nio_cast(double[]copy);
+
+ public boolean isReadOnly()
+ {
+ return ro;
+ }
+
+ public ShortBuffer slice()
+ {
+ ShortBufferImpl a = new ShortBufferImpl(this);
+ a.array_offset = position();
+ return a;
+ }
+
+ public ShortBuffer duplicate()
+ {
+ return new ShortBufferImpl(this);
+ }
+
+ public ShortBuffer asReadOnlyBuffer()
+ {
+ ShortBufferImpl a = new ShortBufferImpl(this);
+ a.ro = true;
+ return a;
+ }
+
+ public ShortBuffer compact()
+ {
+ return this;
+ }
+
+ public boolean isDirect()
+ {
+ return backing_buffer != null;
+ }
+
+ final public short get()
+ {
+ short e = backing_buffer[position()];
+ position(position()+1);
+ return e;
+ }
+
+ final public ShortBuffer put(short b)
+ {
+ backing_buffer[position()] = b;
+ position(position()+1);
+ return this;
+ }
+
+ final public short get(int index)
+ {
+ return backing_buffer[index];
+ }
+
+ final public ShortBuffer put(int index, short b)
+ {
+ backing_buffer[index] = b;
+ return this;
+ }
+
+ final public char getChar() { char a = nio_get_Char(this, position(), limit()); inc_pos(2); return a; } final public ShortBuffer putChar(char value) { nio_put_Char(this, position(), limit(), value); inc_pos(2); return this; } final public char getChar(int index) { char a = nio_get_Char(this, index, limit()); return a; } final public ShortBuffer putChar(int index, char value) { nio_put_Char(this, index, limit(), value); return this; };
+ final public short getShort() { return get(); } final public ShortBuffer putShort(short value) { return put(value); } final public short getShort(int index) { return get(index); } final public ShortBuffer putShort(int index, short value) { return put(index, value); };
+ final public int getInt() { int a = nio_get_Int(this, position(), limit()); inc_pos(4); return a; } final public ShortBuffer putInt(int value) { nio_put_Int(this, position(), limit(), value); inc_pos(4); return this; } final public int getInt(int index) { int a = nio_get_Int(this, index, limit()); return a; } final public ShortBuffer putInt(int index, int value) { nio_put_Int(this, index, limit(), value); return this; };
+ final public long getLong() { long a = nio_get_Long(this, position(), limit()); inc_pos(8); return a; } final public ShortBuffer putLong(long value) { nio_put_Long(this, position(), limit(), value); inc_pos(8); return this; } final public long getLong(int index) { long a = nio_get_Long(this, index, limit()); return a; } final public ShortBuffer putLong(int index, long value) { nio_put_Long(this, index, limit(), value); return this; };
+ final public float getFloat() { float a = nio_get_Float(this, position(), limit()); inc_pos(4); return a; } final public ShortBuffer putFloat(float value) { nio_put_Float(this, position(), limit(), value); inc_pos(4); return this; } final public float getFloat(int index) { float a = nio_get_Float(this, index, limit()); return a; } final public ShortBuffer putFloat(int index, float value) { nio_put_Float(this, index, limit(), value); return this; };
+ final public double getDouble() { double a = nio_get_Double(this, position(), limit()); inc_pos(8); return a; } final public ShortBuffer putDouble(double value) { nio_put_Double(this, position(), limit(), value); inc_pos(8); return this; } final public double getDouble(int index) { double a = nio_get_Double(this, index, limit()); return a; } final public ShortBuffer putDouble(int index, double value) { nio_put_Double(this, index, limit(), value); return this; };
+}
diff --git a/libjava/gnu/java/nio/SocketChannelImpl.java b/libjava/gnu/java/nio/SocketChannelImpl.java
new file mode 100644
index 00000000000..9f2de278d81
--- /dev/null
+++ b/libjava/gnu/java/nio/SocketChannelImpl.java
@@ -0,0 +1,223 @@
+/* SocketChannelImpl.java --
+ Copyright (C) 2002 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.nio;
+
+import java.io.IOException;
+import java.net.InetAddress;
+import java.net.InetSocketAddress;
+import java.net.Socket;
+import java.net.SocketAddress;
+import java.nio.ByteBuffer;
+import java.nio.channels.AlreadyConnectedException;
+import java.nio.channels.SocketChannel;
+import java.nio.channels.spi.SelectorProvider;
+import gnu.classpath.Configuration;
+
+public class SocketChannelImpl extends SocketChannel
+{
+ Socket sock_object;
+ int fd;
+ int local_port;
+ boolean blocking = true;
+ boolean connected = false;
+ InetSocketAddress sa;
+
+ static native int SocketCreate();
+ static native int SocketConnect(int fd, InetAddress addr, int port);
+ static native int SocketBind(int fd, InetAddress addr, int port);
+ static native int SocketListen(int fd, int backlog);
+ static native int SocketAvailable(int fd);
+ static native int SocketClose(int fd);
+ static native int SocketRead(int fd, byte b[], int off, int len);
+ static native int SocketWrite(int fd, byte b[], int off, int len);
+
+ public SocketChannelImpl(SelectorProvider provider)
+ {
+ super(provider);
+ fd = SocketCreate();
+
+ if (fd == -1)
+ {
+ System.err.println("failed to create socket:"+fd);
+ }
+ }
+
+ public void finalizer()
+ {
+ if (connected)
+ {
+ try
+ {
+ close();
+ }
+ catch (Exception e)
+ {
+ }
+ }
+ }
+
+ protected void implCloseSelectableChannel()
+ {
+ connected = false;
+ SocketClose(fd);
+ fd = SocketCreate();
+ }
+
+ protected void implConfigureBlocking(boolean block)
+ {
+ if (blocking == block)
+ return;
+ }
+
+ public boolean connect(SocketAddress remote)
+ throws IOException
+ {
+ if (connected)
+ {
+ throw new AlreadyConnectedException();
+ }
+
+ // ok, lets connect !
+
+ sa = (InetSocketAddress) remote;
+
+ InetAddress addr = sa.getAddress();
+ int port = sa.getPort();
+ int err = SocketConnect(fd, addr, port);
+
+ if (err < 0)
+ {
+ throw new IOException("Connection refused:"+err + ", connect="+err);
+ }
+
+ local_port = err;
+ connected = true;
+ return blocking;
+ }
+
+ public boolean finishConnect()
+ {
+ return false;
+ }
+
+ public boolean isConnected()
+ {
+ return connected;
+ }
+
+ public boolean isConnectionPending()
+ {
+ if (blocking)
+ return true;
+
+ return false;
+ }
+
+ public Socket socket()
+ {
+ if (sock_object != null)
+ {
+ //sock_object.ch = this;
+ }
+
+ return sock_object;
+ }
+
+ public int read(ByteBuffer dst)
+ {
+ int bytes = 0;
+ int len = 1024;
+ byte[]b = new byte[len];
+
+ bytes = SocketRead(fd, b, 0, len);
+ dst.put(b, 0, bytes);
+
+ if (bytes == 0)
+ {
+ // we've hit eof ?
+ return -1;
+ }
+
+ return bytes;
+ }
+
+ public long read(ByteBuffer[] dsts, int offset, int length)
+ {
+ long bytes = 0;
+
+ for (int i=offset; i<length; i++)
+ {
+ bytes += read(dsts[i]);
+ }
+
+ return bytes;
+ }
+
+ public int write(ByteBuffer src)
+ {
+ int bytes = 0;
+ int len = src.position();
+
+ if (src instanceof ByteBufferImpl)
+ {
+ ByteBufferImpl bi = (ByteBufferImpl) src;
+ byte[]b = bi.array();
+ bytes = SocketWrite(fd, b, 0, len);
+ }
+ else
+ {
+ byte[]b = new byte[len];
+ src.get(b, 0, len);
+ bytes = SocketWrite(fd, b, 0, len);
+ }
+
+ return bytes;
+ }
+
+ public long write (ByteBuffer[] srcs, int offset, int length)
+ {
+ long bytes = 0;
+
+ for (int i=offset; i<length; i++)
+ {
+ bytes += write(srcs[i]);
+ }
+
+ return bytes;
+ }
+}
diff --git a/libjava/gnu/java/nio/charset/ISO_8859_1.java b/libjava/gnu/java/nio/charset/ISO_8859_1.java
new file mode 100644
index 00000000000..f29fa260300
--- /dev/null
+++ b/libjava/gnu/java/nio/charset/ISO_8859_1.java
@@ -0,0 +1,132 @@
+/* ISO_8859_1.java --
+ Copyright (C) 2002 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.nio.charset;
+
+import java.nio.ByteBuffer;
+import java.nio.CharBuffer;
+import java.nio.charset.Charset;
+import java.nio.charset.CharsetDecoder;
+import java.nio.charset.CharsetEncoder;
+import java.nio.charset.CoderResult;
+
+/**
+ * ISO-8859-1 charset.
+ *
+ * @author Jesse Rosenstock
+ */
+final class ISO_8859_1 extends Charset
+{
+ ISO_8859_1 ()
+ {
+ super ("ISO-8859-1", new String[]{"ISO-LATIN-1"});
+ }
+
+ public boolean contains (Charset cs)
+ {
+ return cs instanceof US_ASCII || cs instanceof ISO_8859_1;
+ }
+
+ public CharsetDecoder newDecoder ()
+ {
+ return new Decoder (this);
+ }
+
+ public CharsetEncoder newEncoder ()
+ {
+ return new Encoder (this);
+ }
+
+ private static final class Decoder extends CharsetDecoder
+ {
+ private Decoder (Charset cs)
+ {
+ super (cs, 1.0f, 1.0f);
+ }
+
+ protected CoderResult decodeLoop (ByteBuffer in, CharBuffer out)
+ {
+ // TODO: Optimize this in the case in.hasArray() / out.hasArray()
+ while (in.hasRemaining ())
+ {
+ byte b = in.get ();
+
+ if (!out.hasRemaining ())
+ {
+ in.position (in.position () - 1);
+ return CoderResult.OVERFLOW;
+ }
+
+ out.put ((char) (b & 0xFF));
+ }
+
+ return CoderResult.UNDERFLOW;
+ }
+ }
+
+ private static final class Encoder extends CharsetEncoder
+ {
+ private Encoder (Charset cs)
+ {
+ super (cs, 1.0f, 1.0f);
+ }
+
+ protected CoderResult encodeLoop (CharBuffer in, ByteBuffer out)
+ {
+ // TODO: Optimize this in the case in.hasArray() / out.hasArray()
+ while (in.hasRemaining ())
+ {
+ char c = in.get ();
+
+ if (c > 0xFF)
+ {
+ in.position (in.position () - 1);
+ return CoderResult.unmappableForLength (1);
+ }
+ if (!out.hasRemaining ())
+ {
+ in.position (in.position () - 1);
+ return CoderResult.OVERFLOW;
+ }
+
+ out.put ((byte) c);
+ }
+
+ return CoderResult.UNDERFLOW;
+ }
+ }
+}
diff --git a/libjava/gnu/java/nio/charset/Provider.java b/libjava/gnu/java/nio/charset/Provider.java
new file mode 100644
index 00000000000..13f637113e5
--- /dev/null
+++ b/libjava/gnu/java/nio/charset/Provider.java
@@ -0,0 +1,135 @@
+/* Provider.java --
+ Copyright (C) 2002 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.nio.charset;
+
+import java.nio.charset.Charset;
+import java.nio.charset.spi.CharsetProvider;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Iterator;
+
+/**
+ * Charset provider for the required charsets. Used by
+ * {@link Charset#charsetForName} and * {@link Charset#availableCharsets}.
+ *
+ * @author Jesse Rosenstock
+ * @see Charset
+ */
+public final class Provider extends CharsetProvider
+{
+ private static Provider singleton;
+
+ static
+ {
+ synchronized (Provider.class)
+ {
+ singleton = null;
+ }
+ }
+
+ /**
+ * Map from charset name to charset canonical name.
+ */
+ private final HashMap canonicalNames;
+
+ /**
+ * Map from canonical name to Charset.
+ * TODO: We may want to use soft references. We would then need to keep
+ * track of the class name to regenerate the object.
+ */
+ private final HashMap charsets;
+
+ private Provider ()
+ {
+ // FIXME: We might need to make the name comparison case insensitive.
+ // Verify this with the Sun JDK.
+ canonicalNames = new HashMap ();
+ charsets = new HashMap ();
+
+ // US-ASCII aka ISO646-US
+ addCharset (new US_ASCII ());
+
+ // ISO-8859-1 aka ISO-LATIN-1
+ addCharset (new ISO_8859_1 ());
+
+ // UTF-8
+ addCharset (new UTF_8 ());
+
+ // UTF-16BE
+ addCharset (new UTF_16BE ());
+
+ // UTF-16LE
+ addCharset (new UTF_16LE ());
+
+ // UTF-16
+ addCharset (new UTF_16 ());
+ }
+
+ public Iterator charsets ()
+ {
+ return Collections.unmodifiableCollection (charsets.values ())
+ .iterator ();
+ }
+
+ public Charset charsetForName (String charsetName)
+ {
+ return (Charset) charsets.get (canonicalize (charsetName));
+ }
+
+ private Object canonicalize (String charsetName)
+ {
+ Object o = canonicalNames.get (charsetName);
+ return o == null ? charsetName : o;
+ }
+
+ private void addCharset (Charset cs)
+ {
+ String canonicalName = cs.name ();
+ charsets.put (canonicalName, cs);
+
+ for (Iterator i = cs.aliases ().iterator (); i.hasNext (); )
+ canonicalNames.put (i.next (), canonicalName);
+ }
+
+ public static synchronized Provider provider ()
+ {
+ if (singleton == null)
+ singleton = new Provider ();
+ return singleton;
+ }
+}
diff --git a/libjava/gnu/java/nio/charset/US_ASCII.java b/libjava/gnu/java/nio/charset/US_ASCII.java
new file mode 100644
index 00000000000..a1ff2510402
--- /dev/null
+++ b/libjava/gnu/java/nio/charset/US_ASCII.java
@@ -0,0 +1,137 @@
+/* US_ASCII.java --
+ Copyright (C) 2002 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.nio.charset;
+
+import java.nio.ByteBuffer;
+import java.nio.CharBuffer;
+import java.nio.charset.Charset;
+import java.nio.charset.CharsetDecoder;
+import java.nio.charset.CharsetEncoder;
+import java.nio.charset.CoderResult;
+
+/**
+ * US-ASCII charset.
+ *
+ * @author Jesse Rosenstock
+ */
+final class US_ASCII extends Charset
+{
+ US_ASCII ()
+ {
+ super ("US-ASCII", new String[]{"ISO646-US"});
+ }
+
+ public boolean contains (Charset cs)
+ {
+ return cs instanceof US_ASCII;
+ }
+
+ public CharsetDecoder newDecoder ()
+ {
+ return new Decoder (this);
+ }
+
+ public CharsetEncoder newEncoder ()
+ {
+ return new Encoder (this);
+ }
+
+ private static final class Decoder extends CharsetDecoder
+ {
+ private Decoder (Charset cs)
+ {
+ super (cs, 1.0f, 1.0f);
+ }
+
+ protected CoderResult decodeLoop (ByteBuffer in, CharBuffer out)
+ {
+ // TODO: Optimize this in the case in.hasArray() / out.hasArray()
+ while (in.hasRemaining ())
+ {
+ byte b = in.get ();
+
+ if (b < 0)
+ {
+ in.position (in.position () - 1);
+ return CoderResult.malformedForLength (1);
+ }
+ if (!out.hasRemaining ())
+ {
+ in.position (in.position () - 1);
+ return CoderResult.OVERFLOW;
+ }
+
+ out.put ((char) b);
+ }
+
+ return CoderResult.UNDERFLOW;
+ }
+ }
+
+ private static final class Encoder extends CharsetEncoder
+ {
+ private Encoder (Charset cs)
+ {
+ super (cs, 1.0f, 1.0f);
+ }
+
+ protected CoderResult encodeLoop (CharBuffer in, ByteBuffer out)
+ {
+ // TODO: Optimize this in the case in.hasArray() / out.hasArray()
+ while (in.hasRemaining ())
+ {
+ char c = in.get ();
+
+ if (c > Byte.MAX_VALUE)
+ {
+ in.position (in.position () - 1);
+ return CoderResult.unmappableForLength (1);
+ }
+ if (!out.hasRemaining ())
+ {
+ in.position (in.position () - 1);
+ return CoderResult.OVERFLOW;
+ }
+
+ out.put ((byte) c);
+ }
+
+ return CoderResult.UNDERFLOW;
+ }
+ }
+}
diff --git a/libjava/gnu/java/nio/charset/UTF_16.java b/libjava/gnu/java/nio/charset/UTF_16.java
new file mode 100644
index 00000000000..18c9be7f4b2
--- /dev/null
+++ b/libjava/gnu/java/nio/charset/UTF_16.java
@@ -0,0 +1,75 @@
+/* UTF_16.java --
+ Copyright (C) 2002 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.nio.charset;
+
+import java.nio.ByteBuffer;
+import java.nio.CharBuffer;
+import java.nio.charset.Charset;
+import java.nio.charset.CharsetDecoder;
+import java.nio.charset.CharsetEncoder;
+import java.nio.charset.CoderResult;
+
+/**
+ * UTF-16 charset.
+ *
+ * @author Jesse Rosenstock
+ */
+final class UTF_16 extends Charset
+{
+ UTF_16 ()
+ {
+ super ("UTF-16", null);
+ }
+
+ public boolean contains (Charset cs)
+ {
+ return cs instanceof US_ASCII || cs instanceof ISO_8859_1
+ || cs instanceof UTF_8 || cs instanceof UTF_16BE
+ || cs instanceof UTF_16LE || cs instanceof UTF_16;
+ }
+
+ public CharsetDecoder newDecoder ()
+ {
+ return new UTF_16Decoder (this, UTF_16Decoder.UNKNOWN_ENDIAN);
+ }
+
+ public CharsetEncoder newEncoder ()
+ {
+ return new UTF_16Encoder (this, UTF_16Encoder.BIG_ENDIAN, false);
+ }
+}
diff --git a/libjava/gnu/java/nio/charset/UTF_16BE.java b/libjava/gnu/java/nio/charset/UTF_16BE.java
new file mode 100644
index 00000000000..6fb28cdf830
--- /dev/null
+++ b/libjava/gnu/java/nio/charset/UTF_16BE.java
@@ -0,0 +1,75 @@
+/* UTF_16BE.java --
+ Copyright (C) 2002 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.nio.charset;
+
+import java.nio.ByteBuffer;
+import java.nio.CharBuffer;
+import java.nio.charset.Charset;
+import java.nio.charset.CharsetDecoder;
+import java.nio.charset.CharsetEncoder;
+import java.nio.charset.CoderResult;
+
+/**
+ * UTF-16BE charset.
+ *
+ * @author Jesse Rosenstock
+ */
+final class UTF_16BE extends Charset
+{
+ UTF_16BE ()
+ {
+ super ("UTF-16BE", null);
+ }
+
+ public boolean contains (Charset cs)
+ {
+ return cs instanceof US_ASCII || cs instanceof ISO_8859_1
+ || cs instanceof UTF_8 || cs instanceof UTF_16BE
+ || cs instanceof UTF_16LE || cs instanceof UTF_16;
+ }
+
+ public CharsetDecoder newDecoder ()
+ {
+ return new UTF_16Decoder (this, UTF_16Decoder.BIG_ENDIAN);
+ }
+
+ public CharsetEncoder newEncoder ()
+ {
+ return new UTF_16Encoder (this, UTF_16Encoder.BIG_ENDIAN, true);
+ }
+}
diff --git a/libjava/gnu/java/nio/charset/UTF_16Decoder.java b/libjava/gnu/java/nio/charset/UTF_16Decoder.java
new file mode 100644
index 00000000000..c8e474d5741
--- /dev/null
+++ b/libjava/gnu/java/nio/charset/UTF_16Decoder.java
@@ -0,0 +1,169 @@
+/* UTF_16Decoder.java --
+ Copyright (C) 2002 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.nio.charset;
+
+import java.nio.ByteBuffer;
+import java.nio.CharBuffer;
+import java.nio.charset.Charset;
+import java.nio.charset.CharsetDecoder;
+import java.nio.charset.CoderResult;
+
+/**
+ * Decoder for UTF-16, UTF-15LE, and UTF-16BE.
+ *
+ * @author Jesse Rosenstock
+ */
+final class UTF_16Decoder extends CharsetDecoder
+{
+ // byte orders
+ static final int BIG_ENDIAN = 0;
+ static final int LITTLE_ENDIAN = 1;
+ static final int UNKNOWN_ENDIAN = 2;
+
+ private static final char BYTE_ORDER_MARK = '\uFEFF';
+ private static final char REVERSED_BYTE_ORDER_MARK = '\uFFFE';
+
+ private final int originalByteOrder;
+ private int byteOrder;
+
+ UTF_16Decoder (Charset cs, int byteOrder)
+ {
+ super (cs, 0.5f, 1.0f);
+ this.originalByteOrder = byteOrder;
+ this.byteOrder = byteOrder;
+ }
+
+ protected CoderResult decodeLoop (ByteBuffer in, CharBuffer out)
+ {
+ // TODO: Optimize this in the case in.hasArray() / out.hasArray()
+
+ int inPos = in.position ();
+ try
+ {
+ while (in.remaining () >= 2)
+ {
+ byte b1 = in.get ();
+ byte b2 = in.get ();
+
+ // handle byte order mark
+ if (byteOrder == UNKNOWN_ENDIAN)
+ {
+ char c = (char) ((b1 << 8) | b2);
+ if (c == BYTE_ORDER_MARK)
+ {
+ byteOrder = BIG_ENDIAN;
+ inPos += 2;
+ continue;
+ }
+ else if (c == REVERSED_BYTE_ORDER_MARK)
+ {
+ byteOrder = LITTLE_ENDIAN;
+ inPos += 2;
+ continue;
+ }
+ else
+ {
+ // assume big endian, do not consume bytes,
+ // continue with normal processing
+ byteOrder = BIG_ENDIAN;
+ }
+ }
+
+ char c = byteOrder == BIG_ENDIAN ? (char) ((b1 << 8) | b2)
+ : (char) ((b2 << 8) | b1);
+
+ if (0xD800 <= c && c <= 0xDFFF)
+ {
+ // c is a surrogate
+
+ // make sure c is a high surrogate
+ if (c > 0xDBFF)
+ return CoderResult.malformedForLength (2);
+ if (in.remaining () < 2)
+ return CoderResult.UNDERFLOW;
+ byte b3 = in.get ();
+ byte b4 = in.get ();
+ char d = byteOrder == BIG_ENDIAN ? (char) ((b3 << 8) | b4)
+ : (char) ((b4 << 8) | b3);
+ // make sure d is a low surrogate
+ if (d < 0xDC00 || d > 0xDFFF)
+ return CoderResult.malformedForLength (2);
+ out.put (c);
+ out.put (d);
+ inPos += 4;
+ }
+ else
+ {
+ if (!out.hasRemaining ())
+ return CoderResult.UNDERFLOW;
+ out.put (c);
+ inPos += 2;
+ }
+ }
+
+ return CoderResult.UNDERFLOW;
+ }
+ finally
+ {
+ in.position (inPos);
+ }
+ }
+
+ /**
+ * Writes <code>c</code> to <code>out</code> in the byte order
+ * specified by <code>byteOrder</code>.
+ **/
+ private void put (ByteBuffer out, char c)
+ {
+ if (byteOrder == BIG_ENDIAN)
+ {
+ out.put ((byte) (c >> 8));
+ out.put ((byte) (c & 0xFF));
+ }
+ else
+ {
+ out.put ((byte) (c & 0xFF));
+ out.put ((byte) (c >> 8));
+ }
+ }
+
+ protected void implReset ()
+ {
+ byteOrder = originalByteOrder;
+ }
+}
diff --git a/libjava/gnu/java/nio/charset/UTF_16Encoder.java b/libjava/gnu/java/nio/charset/UTF_16Encoder.java
new file mode 100644
index 00000000000..b0cb9ed8ce1
--- /dev/null
+++ b/libjava/gnu/java/nio/charset/UTF_16Encoder.java
@@ -0,0 +1,153 @@
+/* UTF_16Encoder.java --
+ Copyright (C) 2002 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.nio.charset;
+
+import java.nio.ByteBuffer;
+import java.nio.CharBuffer;
+import java.nio.charset.Charset;
+import java.nio.charset.CharsetEncoder;
+import java.nio.charset.CoderResult;
+
+/**
+ * Encoder for UTF-16, UTF-15LE, and UTF-16BE.
+ *
+ * @author Jesse Rosenstock
+ */
+final class UTF_16Encoder extends CharsetEncoder
+{
+ // byte orders
+ static final int BIG_ENDIAN = 0;
+ static final int LITTLE_ENDIAN = 1;
+
+ private static final char BYTE_ORDER_MARK = '\uFEFF';
+
+ private final int byteOrder;
+ private final boolean useByteOrderMark;
+ private boolean needsByteOrderMark;
+
+ UTF_16Encoder (Charset cs, int byteOrder, boolean useByteOrderMark)
+ {
+ super (cs, 2.0f,
+ useByteOrderMark ? 4.0f : 2.0f,
+ byteOrder == BIG_ENDIAN
+ ? new byte[] { (byte) 0xFF, (byte) 0xFD }
+ : new byte[] { (byte) 0xFD, (byte) 0xFF });
+ this.byteOrder = byteOrder;
+ this.useByteOrderMark = useByteOrderMark;
+ this.needsByteOrderMark = useByteOrderMark;
+ }
+
+ protected CoderResult encodeLoop (CharBuffer in, ByteBuffer out)
+ {
+ // TODO: Optimize this in the case in.hasArray() / out.hasArray()
+
+ if (needsByteOrderMark)
+ {
+ if (out.remaining () < 2)
+ return CoderResult.OVERFLOW;
+ put (out, BYTE_ORDER_MARK);
+ needsByteOrderMark = false;
+ }
+
+ int inPos = in.position ();
+ try
+ {
+ while (in.hasRemaining ())
+ {
+ char c = in.get ();
+
+ if (0xD800 <= c && c <= 0xDFFF)
+ {
+ // c is a surrogate
+
+ // make sure c is a high surrogate
+ if (c > 0xDBFF)
+ return CoderResult.malformedForLength (1);
+ if (in.remaining () < 1)
+ return CoderResult.UNDERFLOW;
+ char d = in.get ();
+ // make sure d is a low surrogate
+ if (d < 0xDC00 || d > 0xDFFF)
+ return CoderResult.malformedForLength (1);
+ put (out, c);
+ put (out, d);
+ inPos += 2;
+ }
+ else
+ {
+ if (out.remaining () < 2)
+ return CoderResult.OVERFLOW;
+ put (out, c);
+ inPos++;
+ }
+ }
+
+ return CoderResult.UNDERFLOW;
+ }
+ finally
+ {
+ in.position (inPos);
+ }
+ }
+
+ /**
+ * Writes <code>c</code> to <code>out</code> in the byte order
+ * specified by <code>byteOrder</code>.
+ **/
+ private void put (ByteBuffer out, char c)
+ {
+ if (byteOrder == BIG_ENDIAN)
+ {
+ out.put ((byte) (c >> 8));
+ out.put ((byte) (c & 0xFF));
+ }
+ else
+ {
+ out.put ((byte) (c & 0xFF));
+ out.put ((byte) (c >> 8));
+ }
+ }
+
+ protected void implReset ()
+ {
+ needsByteOrderMark = useByteOrderMark;
+ }
+
+ // TODO: override canEncode(char) and canEncode(CharSequence)
+ // for performance
+}
diff --git a/libjava/gnu/java/nio/charset/UTF_16LE.java b/libjava/gnu/java/nio/charset/UTF_16LE.java
new file mode 100644
index 00000000000..b914ae07273
--- /dev/null
+++ b/libjava/gnu/java/nio/charset/UTF_16LE.java
@@ -0,0 +1,75 @@
+/* UTF_16LE.java --
+ Copyright (C) 2002 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.nio.charset;
+
+import java.nio.ByteBuffer;
+import java.nio.CharBuffer;
+import java.nio.charset.Charset;
+import java.nio.charset.CharsetDecoder;
+import java.nio.charset.CharsetEncoder;
+import java.nio.charset.CoderResult;
+
+/**
+ * UTF-16LE charset.
+ *
+ * @author Jesse Rosenstock
+ */
+final class UTF_16LE extends Charset
+{
+ UTF_16LE ()
+ {
+ super ("UTF-16LE", null);
+ }
+
+ public boolean contains (Charset cs)
+ {
+ return cs instanceof US_ASCII || cs instanceof ISO_8859_1
+ || cs instanceof UTF_8 || cs instanceof UTF_16BE
+ || cs instanceof UTF_16LE || cs instanceof UTF_16;
+ }
+
+ public CharsetDecoder newDecoder ()
+ {
+ return new UTF_16Decoder (this, UTF_16Decoder.LITTLE_ENDIAN);
+ }
+
+ public CharsetEncoder newEncoder ()
+ {
+ return new UTF_16Encoder (this, UTF_16Encoder.LITTLE_ENDIAN, true);
+ }
+}
diff --git a/libjava/gnu/java/nio/charset/UTF_8.java b/libjava/gnu/java/nio/charset/UTF_8.java
new file mode 100644
index 00000000000..aa623b2f2cf
--- /dev/null
+++ b/libjava/gnu/java/nio/charset/UTF_8.java
@@ -0,0 +1,279 @@
+/* UTF_8.java --
+ Copyright (C) 2002 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.nio.charset;
+
+import java.nio.ByteBuffer;
+import java.nio.CharBuffer;
+import java.nio.charset.Charset;
+import java.nio.charset.CharsetDecoder;
+import java.nio.charset.CharsetEncoder;
+import java.nio.charset.CoderResult;
+
+/**
+ * UTF-8 charset.
+ *
+ * <p> UTF-8 references:
+ * <ul>
+ * <li> <a href="http://ietf.org/rfc/rfc2279.txt">RFC 2279</a>
+ * <li> The <a href="http://www.unicode.org/unicode/standard/standard.html">
+ * Unicode standard</a> and
+ * <a href="http://www.unicode.org/versions/corrigendum1.html">
+ * Corrigendum</a>
+ * </ul>
+ *
+ * @author Jesse Rosenstock
+ */
+final class UTF_8 extends Charset
+{
+ UTF_8 ()
+ {
+ super ("UTF-8", null);
+ }
+
+ public boolean contains (Charset cs)
+ {
+ return cs instanceof US_ASCII || cs instanceof ISO_8859_1
+ || cs instanceof UTF_8 || cs instanceof UTF_16BE
+ || cs instanceof UTF_16LE || cs instanceof UTF_16;
+ }
+
+ public CharsetDecoder newDecoder ()
+ {
+ return new Decoder (this);
+ }
+
+ public CharsetEncoder newEncoder ()
+ {
+ return new Encoder (this);
+ }
+
+ private static final class Decoder extends CharsetDecoder
+ {
+ private Decoder (Charset cs)
+ {
+ super (cs, 1.0f, 1.0f);
+ }
+
+ protected CoderResult decodeLoop (ByteBuffer in, CharBuffer out)
+ {
+ // TODO: Optimize this in the case in.hasArray() / out.hasArray()
+ int inPos = 0;
+ try
+ {
+ while (in.hasRemaining ())
+ {
+ char c;
+ byte b1 = in.get ();
+ int highNibble = (b1 >> 4) & 0xF;
+
+ switch (highNibble)
+ {
+ case 0: case 1: case 2: case 3:
+ case 4: case 5: case 6: case 7:
+ if (out.remaining () < 1)
+ return CoderResult.OVERFLOW;
+ out.put ((char) b1);
+ inPos++;
+ break;
+
+ case 0xC: case 0xD:
+ byte b2;
+ if (in.remaining () < 1)
+ return CoderResult.UNDERFLOW;
+ if (out.remaining () < 1)
+ return CoderResult.OVERFLOW;
+ if (!isContinuation (b2 = in.get ()))
+ return CoderResult.malformedForLength (1);
+ c = (char) (((b1 & 0x1F) << 6) | (b2 & 0x3F));
+ // check that we had the shortest encoding
+ if (c <= 0x7F)
+ return CoderResult.malformedForLength (2);
+ out.put (c);
+ inPos += 2;
+ break;
+
+ case 0xE:
+ byte b3;
+ if (in.remaining () < 2)
+ return CoderResult.UNDERFLOW;
+ if (out.remaining () < 1)
+ return CoderResult.OVERFLOW;
+ if (!isContinuation (b2 = in.get ()))
+ return CoderResult.malformedForLength (1);
+ if (!isContinuation (b3 = in.get ()))
+ return CoderResult.malformedForLength (1);
+ c = (char) (((b1 & 0x0F) << 12)
+ | ((b2 & 0x3F) << 6)
+ | (b3 & 0x3F));
+ // check that we had the shortest encoding
+ if (c <= 0x7FF)
+ return CoderResult.malformedForLength (3);
+ out.put (c);
+ inPos += 3;
+ break;
+
+ default:
+ return CoderResult.malformedForLength (1);
+ }
+ }
+
+ return CoderResult.UNDERFLOW;
+ }
+ finally
+ {
+ // In case we did a get(), then encountered an error, reset the
+ // position to before the error. If there was no error, this
+ // will benignly reset the position to the value it already has.
+ in.position (inPos);
+ }
+ }
+
+ private static boolean isContinuation (byte b)
+ {
+ return (b & 0xC0) == 0x80;
+ }
+ }
+
+ private static final class Encoder extends CharsetEncoder
+ {
+ private Encoder (Charset cs)
+ {
+ // According to
+ // http://www-106.ibm.com/developerworks/unicode/library/utfencodingforms/index.html
+ // On average, English takes slightly over one unit per code point.
+ // Most Latin-script languages take about 1.1 bytes. Greek, Russian,
+ // Arabic and Hebrew take about 1.7 bytes, and most others (including
+ // Japanese, Chinese, Korean and Hindi) take about 3 bytes.
+ // We assume we will be dealing with latin scripts, and use 1.1
+ // for averageBytesPerChar.
+ super (cs, 1.1f, 4.0f);
+ }
+
+ protected CoderResult encodeLoop (CharBuffer in, ByteBuffer out)
+ {
+ int inPos = 0;
+ try
+ {
+ // TODO: Optimize this in the case in.hasArray() / out.hasArray()
+ while (in.hasRemaining ())
+ {
+ int remaining = out.remaining ();
+ char c = in.get ();
+
+ // UCS-4 range (hex.) UTF-8 octet sequence (binary)
+ // 0000 0000-0000 007F 0xxxxxxx
+ // 0000 0080-0000 07FF 110xxxxx 10xxxxxx
+ // 0000 0800-0000 FFFF 1110xxxx 10xxxxxx 10xxxxxx
+
+ // Scalar Value UTF-16 byte 1 byte 2 byte 3 byte 4
+ // 0000 0000 0xxx xxxx 0000 0000 0xxx xxxx 0xxx xxxx
+ // 0000 0yyy yyxx xxxx 0000 0yyy yyxx xxxx 110y yyyy 10xx xxxx
+ // zzzz yyyy yyxx xxxx zzzz yyyy yyxx xxxx 1110 zzzz 10yy yyyy 10xx xxxx
+ // u uuuu zzzz yyyy yyxx xxxx 1101 10ww wwzz zzyy 1111 0uuu 10uu zzzz 10yy yyyy 10xx xxxx
+ // + 1101 11yy yyxx xxxx
+ // Note: uuuuu = wwww + 1
+
+ if (c <= 0x7F)
+ {
+ if (remaining < 1)
+ return CoderResult.OVERFLOW;
+ out.put ((byte) c);
+ inPos++;
+ }
+ else if (c <= 0x7FF)
+ {
+ if (remaining < 2)
+ return CoderResult.OVERFLOW;
+ out.put ((byte) (0xC0 | (c >> 6)));
+ out.put ((byte) (0x80 | (c & 0x3F)));
+ inPos++;
+ }
+ else if (0xD800 <= c && c <= 0xDFFF)
+ {
+ if (remaining < 4)
+ return CoderResult.OVERFLOW;
+
+ // we got a low surrogate without a preciding high one
+ if (c > 0xDBFF)
+ return CoderResult.malformedForLength (1);
+
+ // high surrogates
+ if (!in.hasRemaining ())
+ return CoderResult.UNDERFLOW;
+
+ char d = in.get ();
+
+ // make sure d is a low surrogate
+ if (d < 0xDC00 || d > 0xDFFF)
+ return CoderResult.malformedForLength (1);
+
+ // make the 32 bit value
+ // int value2 = (c - 0xD800) * 0x400 + (d - 0xDC00) + 0x10000;
+ int value = (((c & 0x3FF) << 10) | (d & 0x3FF)) + 0x10000;
+ // assert value == value2;
+ out.put ((byte) (0xF0 | (value >> 18)));
+ out.put ((byte) (0x80 | ((value >> 12) & 0x3F)));
+ out.put ((byte) (0x80 | ((value >> 6) & 0x3F)));
+ out.put ((byte) (0x80 | ((value ) & 0x3F)));
+
+ inPos += 2;
+ }
+ else
+ {
+ if (remaining < 3)
+ return CoderResult.OVERFLOW;
+
+ out.put ((byte) (0xE0 | (c >> 12)));
+ out.put ((byte) (0x80 | ((c >> 6) & 0x3F)));
+ out.put ((byte) (0x80 | (c & 0x3F)));
+ inPos++;
+ }
+ }
+
+ return CoderResult.UNDERFLOW;
+ }
+ finally
+ {
+ // In case we did a get(), then encountered an error, reset the
+ // position to before the error. If there was no error, this
+ // will benignly reset the position to the value it already has.
+ in.position (inPos);
+ }
+ }
+ }
+}
diff --git a/libjava/gnu/java/nio/natByteBufferImpl.cc b/libjava/gnu/java/nio/natByteBufferImpl.cc
new file mode 100644
index 00000000000..b98b694e87b
--- /dev/null
+++ b/libjava/gnu/java/nio/natByteBufferImpl.cc
@@ -0,0 +1,125 @@
+#include <config.h>
+
+#include <gcj/cni.h>
+#include <jvm.h>
+
+#include <gnu/java/nio/ByteBufferImpl.h>
+
+JArray<jbyte>*
+gnu::java::nio::ByteBufferImpl::nio_cast(JArray<jbyte>*)
+{
+ return NULL;
+}
+
+JArray<jbyte>*
+gnu::java::nio::ByteBufferImpl::nio_cast(JArray<jshort>*)
+{
+ return NULL;
+}
+
+JArray<jbyte>*
+gnu::java::nio::ByteBufferImpl::nio_cast(JArray<jint>*)
+{
+ return NULL;
+}
+
+JArray<jbyte>*
+gnu::java::nio::ByteBufferImpl::nio_cast(JArray<jlong>*)
+{
+ return NULL;
+}
+
+JArray<jbyte>*
+gnu::java::nio::ByteBufferImpl::nio_cast(JArray<jchar>*)
+{
+ return NULL;
+}
+
+JArray<jbyte>*
+gnu::java::nio::ByteBufferImpl::nio_cast(JArray<jfloat>*)
+{
+ return NULL;
+}
+
+JArray<jbyte>*
+gnu::java::nio::ByteBufferImpl::nio_cast(JArray<jdouble>*)
+{
+ return NULL;
+}
+
+void
+gnu::java::nio::ByteBufferImpl::nio_put_Byte(gnu::java::nio::ByteBufferImpl*, jint, jint, jbyte)
+{
+}
+
+void
+gnu::java::nio::ByteBufferImpl::nio_put_Char(gnu::java::nio::ByteBufferImpl*, jint, jint, jchar)
+{
+}
+
+void
+gnu::java::nio::ByteBufferImpl::nio_put_Short(gnu::java::nio::ByteBufferImpl*, jint, jint, jshort)
+{
+}
+
+void
+gnu::java::nio::ByteBufferImpl::nio_put_Int(gnu::java::nio::ByteBufferImpl*, jint, jint, jint)
+{
+}
+
+void
+gnu::java::nio::ByteBufferImpl::nio_put_Long(gnu::java::nio::ByteBufferImpl*, jint, jint, jlong)
+{
+}
+
+void
+gnu::java::nio::ByteBufferImpl::nio_put_Float(gnu::java::nio::ByteBufferImpl*, jint, jint, jfloat)
+{
+}
+
+void
+gnu::java::nio::ByteBufferImpl::nio_put_Double(gnu::java::nio::ByteBufferImpl*, jint, jint, jdouble)
+{
+}
+
+jbyte
+gnu::java::nio::ByteBufferImpl::nio_get_Byte(gnu::java::nio::ByteBufferImpl*, jint, jint)
+{
+ return 0;
+}
+
+jchar
+gnu::java::nio::ByteBufferImpl::nio_get_Char(gnu::java::nio::ByteBufferImpl*, jint, jint)
+{
+ return ' ';
+}
+
+jshort
+gnu::java::nio::ByteBufferImpl::nio_get_Short(gnu::java::nio::ByteBufferImpl*, jint, jint)
+{
+ return 0;
+}
+
+jint
+gnu::java::nio::ByteBufferImpl::nio_get_Int(gnu::java::nio::ByteBufferImpl*, jint, jint)
+{
+ return 0;
+}
+
+jlong
+gnu::java::nio::ByteBufferImpl::nio_get_Long(gnu::java::nio::ByteBufferImpl*, jint, jint)
+{
+ return 0;
+}
+
+jfloat
+gnu::java::nio::ByteBufferImpl::nio_get_Float(gnu::java::nio::ByteBufferImpl*, jint, jint)
+{
+ return 0.0;
+}
+
+jdouble
+gnu::java::nio::ByteBufferImpl::nio_get_Double(gnu::java::nio::ByteBufferImpl*, jint, jint)
+{
+ return 0.0;
+}
diff --git a/libjava/gnu/java/nio/natCharBufferImpl.cc b/libjava/gnu/java/nio/natCharBufferImpl.cc
new file mode 100644
index 00000000000..2d01a679bfa
--- /dev/null
+++ b/libjava/gnu/java/nio/natCharBufferImpl.cc
@@ -0,0 +1,125 @@
+#include <config.h>
+
+#include <gcj/cni.h>
+#include <jvm.h>
+
+#include <gnu/java/nio/CharBufferImpl.h>
+
+JArray<jchar>*
+gnu::java::nio::CharBufferImpl::nio_cast(JArray<jbyte>*)
+{
+ return NULL;
+}
+
+JArray<jchar>*
+gnu::java::nio::CharBufferImpl::nio_cast(JArray<jshort>*)
+{
+ return NULL;
+}
+
+JArray<jchar>*
+gnu::java::nio::CharBufferImpl::nio_cast(JArray<jint>*)
+{
+ return NULL;
+}
+
+JArray<jchar>*
+gnu::java::nio::CharBufferImpl::nio_cast(JArray<jlong>*)
+{
+ return NULL;
+}
+
+JArray<jchar>*
+gnu::java::nio::CharBufferImpl::nio_cast(JArray<jchar>*)
+{
+ return NULL;
+}
+
+JArray<jchar>*
+gnu::java::nio::CharBufferImpl::nio_cast(JArray<jfloat>*)
+{
+ return NULL;
+}
+
+JArray<jchar>*
+gnu::java::nio::CharBufferImpl::nio_cast(JArray<jdouble>*)
+{
+ return NULL;
+}
+
+void
+gnu::java::nio::CharBufferImpl::nio_put_Byte(gnu::java::nio::CharBufferImpl*, jint, jint, jbyte)
+{
+}
+
+void
+gnu::java::nio::CharBufferImpl::nio_put_Char(gnu::java::nio::CharBufferImpl*, jint, jint, jchar)
+{
+}
+
+void
+gnu::java::nio::CharBufferImpl::nio_put_Short(gnu::java::nio::CharBufferImpl*, jint, jint, jshort)
+{
+}
+
+void
+gnu::java::nio::CharBufferImpl::nio_put_Int(gnu::java::nio::CharBufferImpl*, jint, jint, jint)
+{
+}
+
+void
+gnu::java::nio::CharBufferImpl::nio_put_Long(gnu::java::nio::CharBufferImpl*, jint, jint, jlong)
+{
+}
+
+void
+gnu::java::nio::CharBufferImpl::nio_put_Float(gnu::java::nio::CharBufferImpl*, jint, jint, jfloat)
+{
+}
+
+void
+gnu::java::nio::CharBufferImpl::nio_put_Double(gnu::java::nio::CharBufferImpl*, jint, jint, jdouble)
+{
+}
+
+jbyte
+gnu::java::nio::CharBufferImpl::nio_get_Byte(gnu::java::nio::CharBufferImpl*, jint, jint)
+{
+ return 0;
+}
+
+jchar
+gnu::java::nio::CharBufferImpl::nio_get_Char(gnu::java::nio::CharBufferImpl*, jint, jint)
+{
+ return ' ';
+}
+
+jshort
+gnu::java::nio::CharBufferImpl::nio_get_Short(gnu::java::nio::CharBufferImpl*, jint, jint)
+{
+ return 0;
+}
+
+jint
+gnu::java::nio::CharBufferImpl::nio_get_Int(gnu::java::nio::CharBufferImpl*, jint, jint)
+{
+ return 0;
+}
+
+jlong
+gnu::java::nio::CharBufferImpl::nio_get_Long(gnu::java::nio::CharBufferImpl*, jint, jint)
+{
+ return 0;
+}
+
+jfloat
+gnu::java::nio::CharBufferImpl::nio_get_Float(gnu::java::nio::CharBufferImpl*, jint, jint)
+{
+ return 0.0;
+}
+
+jdouble
+gnu::java::nio::CharBufferImpl::nio_get_Double(gnu::java::nio::CharBufferImpl*, jint, jint)
+{
+ return 0.0;
+}
diff --git a/libjava/gnu/java/nio/natDoubleBufferImpl.cc b/libjava/gnu/java/nio/natDoubleBufferImpl.cc
new file mode 100644
index 00000000000..53bf73db5a6
--- /dev/null
+++ b/libjava/gnu/java/nio/natDoubleBufferImpl.cc
@@ -0,0 +1,125 @@
+#include <config.h>
+
+#include <gcj/cni.h>
+#include <jvm.h>
+
+#include <gnu/java/nio/DoubleBufferImpl.h>
+
+JArray<jdouble>*
+gnu::java::nio::DoubleBufferImpl::nio_cast(JArray<jbyte>*)
+{
+ return NULL;
+}
+
+JArray<jdouble>*
+gnu::java::nio::DoubleBufferImpl::nio_cast(JArray<jshort>*)
+{
+ return NULL;
+}
+
+JArray<jdouble>*
+gnu::java::nio::DoubleBufferImpl::nio_cast(JArray<jint>*)
+{
+ return NULL;
+}
+
+JArray<jdouble>*
+gnu::java::nio::DoubleBufferImpl::nio_cast(JArray<jlong>*)
+{
+ return NULL;
+}
+
+JArray<jdouble>*
+gnu::java::nio::DoubleBufferImpl::nio_cast(JArray<jchar>*)
+{
+ return NULL;
+}
+
+JArray<jdouble>*
+gnu::java::nio::DoubleBufferImpl::nio_cast(JArray<jfloat>*)
+{
+ return NULL;
+}
+
+JArray<jdouble>*
+gnu::java::nio::DoubleBufferImpl::nio_cast(JArray<jdouble>*)
+{
+ return NULL;
+}
+
+void
+gnu::java::nio::DoubleBufferImpl::nio_put_Byte(gnu::java::nio::DoubleBufferImpl*, jint, jint, jbyte)
+{
+}
+
+void
+gnu::java::nio::DoubleBufferImpl::nio_put_Char(gnu::java::nio::DoubleBufferImpl*, jint, jint, jchar)
+{
+}
+
+void
+gnu::java::nio::DoubleBufferImpl::nio_put_Short(gnu::java::nio::DoubleBufferImpl*, jint, jint, jshort)
+{
+}
+
+void
+gnu::java::nio::DoubleBufferImpl::nio_put_Int(gnu::java::nio::DoubleBufferImpl*, jint, jint, jint)
+{
+}
+
+void
+gnu::java::nio::DoubleBufferImpl::nio_put_Long(gnu::java::nio::DoubleBufferImpl*, jint, jint, jlong)
+{
+}
+
+void
+gnu::java::nio::DoubleBufferImpl::nio_put_Float(gnu::java::nio::DoubleBufferImpl*, jint, jint, jfloat)
+{
+}
+
+void
+gnu::java::nio::DoubleBufferImpl::nio_put_Double(gnu::java::nio::DoubleBufferImpl*, jint, jint, jdouble)
+{
+}
+
+jbyte
+gnu::java::nio::DoubleBufferImpl::nio_get_Byte(gnu::java::nio::DoubleBufferImpl*, jint, jint)
+{
+ return 0;
+}
+
+jchar
+gnu::java::nio::DoubleBufferImpl::nio_get_Char(gnu::java::nio::DoubleBufferImpl*, jint, jint)
+{
+ return ' ';
+}
+
+jshort
+gnu::java::nio::DoubleBufferImpl::nio_get_Short(gnu::java::nio::DoubleBufferImpl*, jint, jint)
+{
+ return 0;
+}
+
+jint
+gnu::java::nio::DoubleBufferImpl::nio_get_Int(gnu::java::nio::DoubleBufferImpl*, jint, jint)
+{
+ return 0;
+}
+
+jlong
+gnu::java::nio::DoubleBufferImpl::nio_get_Long(gnu::java::nio::DoubleBufferImpl*, jint, jint)
+{
+ return 0;
+}
+
+jfloat
+gnu::java::nio::DoubleBufferImpl::nio_get_Float(gnu::java::nio::DoubleBufferImpl*, jint, jint)
+{
+ return 0.0;
+}
+
+jdouble
+gnu::java::nio::DoubleBufferImpl::nio_get_Double(gnu::java::nio::DoubleBufferImpl*, jint, jint)
+{
+ return 0.0;
+}
diff --git a/libjava/gnu/java/nio/natFloatBufferImpl.cc b/libjava/gnu/java/nio/natFloatBufferImpl.cc
new file mode 100644
index 00000000000..2462be539f9
--- /dev/null
+++ b/libjava/gnu/java/nio/natFloatBufferImpl.cc
@@ -0,0 +1,125 @@
+#include <config.h>
+
+#include <gcj/cni.h>
+#include <jvm.h>
+
+#include <gnu/java/nio/FloatBufferImpl.h>
+
+JArray<jfloat>*
+gnu::java::nio::FloatBufferImpl::nio_cast(JArray<jbyte>*)
+{
+ return NULL;
+}
+
+JArray<jfloat>*
+gnu::java::nio::FloatBufferImpl::nio_cast(JArray<jshort>*)
+{
+ return NULL;
+}
+
+JArray<jfloat>*
+gnu::java::nio::FloatBufferImpl::nio_cast(JArray<jint>*)
+{
+ return NULL;
+}
+
+JArray<jfloat>*
+gnu::java::nio::FloatBufferImpl::nio_cast(JArray<jlong>*)
+{
+ return NULL;
+}
+
+JArray<jfloat>*
+gnu::java::nio::FloatBufferImpl::nio_cast(JArray<jchar>*)
+{
+ return NULL;
+}
+
+JArray<jfloat>*
+gnu::java::nio::FloatBufferImpl::nio_cast(JArray<jfloat>*)
+{
+ return NULL;
+}
+
+JArray<jfloat>*
+gnu::java::nio::FloatBufferImpl::nio_cast(JArray<jdouble>*)
+{
+ return NULL;
+}
+
+void
+gnu::java::nio::FloatBufferImpl::nio_put_Byte(gnu::java::nio::FloatBufferImpl*, jint, jint, jbyte)
+{
+}
+
+void
+gnu::java::nio::FloatBufferImpl::nio_put_Char(gnu::java::nio::FloatBufferImpl*, jint, jint, jchar)
+{
+}
+
+void
+gnu::java::nio::FloatBufferImpl::nio_put_Short(gnu::java::nio::FloatBufferImpl*, jint, jint, jshort)
+{
+}
+
+void
+gnu::java::nio::FloatBufferImpl::nio_put_Int(gnu::java::nio::FloatBufferImpl*, jint, jint, jint)
+{
+}
+
+void
+gnu::java::nio::FloatBufferImpl::nio_put_Long(gnu::java::nio::FloatBufferImpl*, jint, jint, jlong)
+{
+}
+
+void
+gnu::java::nio::FloatBufferImpl::nio_put_Float(gnu::java::nio::FloatBufferImpl*, jint, jint, jfloat)
+{
+}
+
+void
+gnu::java::nio::FloatBufferImpl::nio_put_Double(gnu::java::nio::FloatBufferImpl*, jint, jint, jdouble)
+{
+}
+
+jbyte
+gnu::java::nio::FloatBufferImpl::nio_get_Byte(gnu::java::nio::FloatBufferImpl*, jint, jint)
+{
+ return 0;
+}
+
+jchar
+gnu::java::nio::FloatBufferImpl::nio_get_Char(gnu::java::nio::FloatBufferImpl*, jint, jint)
+{
+ return ' ';
+}
+
+jshort
+gnu::java::nio::FloatBufferImpl::nio_get_Short(gnu::java::nio::FloatBufferImpl*, jint, jint)
+{
+ return 0;
+}
+
+jint
+gnu::java::nio::FloatBufferImpl::nio_get_Int(gnu::java::nio::FloatBufferImpl*, jint, jint)
+{
+ return 0;
+}
+
+jlong
+gnu::java::nio::FloatBufferImpl::nio_get_Long(gnu::java::nio::FloatBufferImpl*, jint, jint)
+{
+ return 0;
+}
+
+jfloat
+gnu::java::nio::FloatBufferImpl::nio_get_Float(gnu::java::nio::FloatBufferImpl*, jint, jint)
+{
+ return 0.0;
+}
+
+jdouble
+gnu::java::nio::FloatBufferImpl::nio_get_Double(gnu::java::nio::FloatBufferImpl*, jint, jint)
+{
+ return 0.0;
+}
diff --git a/libjava/gnu/java/nio/natIntBufferImpl.cc b/libjava/gnu/java/nio/natIntBufferImpl.cc
new file mode 100644
index 00000000000..6a14653917e
--- /dev/null
+++ b/libjava/gnu/java/nio/natIntBufferImpl.cc
@@ -0,0 +1,125 @@
+#include <config.h>
+
+#include <gcj/cni.h>
+#include <jvm.h>
+
+#include <gnu/java/nio/IntBufferImpl.h>
+
+JArray<jint>*
+gnu::java::nio::IntBufferImpl::nio_cast(JArray<jbyte>*)
+{
+ return NULL;
+}
+
+JArray<jint>*
+gnu::java::nio::IntBufferImpl::nio_cast(JArray<jshort>*)
+{
+ return NULL;
+}
+
+JArray<jint>*
+gnu::java::nio::IntBufferImpl::nio_cast(JArray<jint>*)
+{
+ return NULL;
+}
+
+JArray<jint>*
+gnu::java::nio::IntBufferImpl::nio_cast(JArray<jlong>*)
+{
+ return NULL;
+}
+
+JArray<jint>*
+gnu::java::nio::IntBufferImpl::nio_cast(JArray<jchar>*)
+{
+ return NULL;
+}
+
+JArray<jint>*
+gnu::java::nio::IntBufferImpl::nio_cast(JArray<jfloat>*)
+{
+ return NULL;
+}
+
+JArray<jint>*
+gnu::java::nio::IntBufferImpl::nio_cast(JArray<jdouble>*)
+{
+ return NULL;
+}
+
+void
+gnu::java::nio::IntBufferImpl::nio_put_Byte(gnu::java::nio::IntBufferImpl*, jint, jint, jbyte)
+{
+}
+
+void
+gnu::java::nio::IntBufferImpl::nio_put_Char(gnu::java::nio::IntBufferImpl*, jint, jint, jchar)
+{
+}
+
+void
+gnu::java::nio::IntBufferImpl::nio_put_Short(gnu::java::nio::IntBufferImpl*, jint, jint, jshort)
+{
+}
+
+void
+gnu::java::nio::IntBufferImpl::nio_put_Int(gnu::java::nio::IntBufferImpl*, jint, jint, jint)
+{
+}
+
+void
+gnu::java::nio::IntBufferImpl::nio_put_Long(gnu::java::nio::IntBufferImpl*, jint, jint, jlong)
+{
+}
+
+void
+gnu::java::nio::IntBufferImpl::nio_put_Float(gnu::java::nio::IntBufferImpl*, jint, jint, jfloat)
+{
+}
+
+void
+gnu::java::nio::IntBufferImpl::nio_put_Double(gnu::java::nio::IntBufferImpl*, jint, jint, jdouble)
+{
+}
+
+jbyte
+gnu::java::nio::IntBufferImpl::nio_get_Byte(gnu::java::nio::IntBufferImpl*, jint, jint)
+{
+ return 0;
+}
+
+jchar
+gnu::java::nio::IntBufferImpl::nio_get_Char(gnu::java::nio::IntBufferImpl*, jint, jint)
+{
+ return ' ';
+}
+
+jshort
+gnu::java::nio::IntBufferImpl::nio_get_Short(gnu::java::nio::IntBufferImpl*, jint, jint)
+{
+ return 0;
+}
+
+jint
+gnu::java::nio::IntBufferImpl::nio_get_Int(gnu::java::nio::IntBufferImpl*, jint, jint)
+{
+ return 0;
+}
+
+jlong
+gnu::java::nio::IntBufferImpl::nio_get_Long(gnu::java::nio::IntBufferImpl*, jint, jint)
+{
+ return 0;
+}
+
+jfloat
+gnu::java::nio::IntBufferImpl::nio_get_Float(gnu::java::nio::IntBufferImpl*, jint, jint)
+{
+ return 0.0;
+}
+
+jdouble
+gnu::java::nio::IntBufferImpl::nio_get_Double(gnu::java::nio::IntBufferImpl*, jint, jint)
+{
+ return 0.0;
+}
diff --git a/libjava/gnu/java/nio/natLongBufferImpl.cc b/libjava/gnu/java/nio/natLongBufferImpl.cc
new file mode 100644
index 00000000000..ea21f475c61
--- /dev/null
+++ b/libjava/gnu/java/nio/natLongBufferImpl.cc
@@ -0,0 +1,125 @@
+#include <config.h>
+
+#include <gcj/cni.h>
+#include <jvm.h>
+
+#include <gnu/java/nio/LongBufferImpl.h>
+
+JArray<jlong>*
+gnu::java::nio::LongBufferImpl::nio_cast(JArray<jbyte>*)
+{
+ return NULL;
+}
+
+JArray<jlong>*
+gnu::java::nio::LongBufferImpl::nio_cast(JArray<jshort>*)
+{
+ return NULL;
+}
+
+JArray<jlong>*
+gnu::java::nio::LongBufferImpl::nio_cast(JArray<jint>*)
+{
+ return NULL;
+}
+
+JArray<jlong>*
+gnu::java::nio::LongBufferImpl::nio_cast(JArray<jlong>*)
+{
+ return NULL;
+}
+
+JArray<jlong>*
+gnu::java::nio::LongBufferImpl::nio_cast(JArray<jchar>*)
+{
+ return NULL;
+}
+
+JArray<jlong>*
+gnu::java::nio::LongBufferImpl::nio_cast(JArray<jfloat>*)
+{
+ return NULL;
+}
+
+JArray<jlong>*
+gnu::java::nio::LongBufferImpl::nio_cast(JArray<jdouble>*)
+{
+ return NULL;
+}
+
+void
+gnu::java::nio::LongBufferImpl::nio_put_Byte(gnu::java::nio::LongBufferImpl*, jint, jint, jbyte)
+{
+}
+
+void
+gnu::java::nio::LongBufferImpl::nio_put_Char(gnu::java::nio::LongBufferImpl*, jint, jint, jchar)
+{
+}
+
+void
+gnu::java::nio::LongBufferImpl::nio_put_Short(gnu::java::nio::LongBufferImpl*, jint, jint, jshort)
+{
+}
+
+void
+gnu::java::nio::LongBufferImpl::nio_put_Int(gnu::java::nio::LongBufferImpl*, jint, jint, jint)
+{
+}
+
+void
+gnu::java::nio::LongBufferImpl::nio_put_Long(gnu::java::nio::LongBufferImpl*, jint, jint, jlong)
+{
+}
+
+void
+gnu::java::nio::LongBufferImpl::nio_put_Float(gnu::java::nio::LongBufferImpl*, jint, jint, jfloat)
+{
+}
+
+void
+gnu::java::nio::LongBufferImpl::nio_put_Double(gnu::java::nio::LongBufferImpl*, jint, jint, jdouble)
+{
+}
+
+jbyte
+gnu::java::nio::LongBufferImpl::nio_get_Byte(gnu::java::nio::LongBufferImpl*, jint, jint)
+{
+ return 0;
+}
+
+jchar
+gnu::java::nio::LongBufferImpl::nio_get_Char(gnu::java::nio::LongBufferImpl*, jint, jint)
+{
+ return ' ';
+}
+
+jshort
+gnu::java::nio::LongBufferImpl::nio_get_Short(gnu::java::nio::LongBufferImpl*, jint, jint)
+{
+ return 0;
+}
+
+jint
+gnu::java::nio::LongBufferImpl::nio_get_Int(gnu::java::nio::LongBufferImpl*, jint, jint)
+{
+ return 0;
+}
+
+jlong
+gnu::java::nio::LongBufferImpl::nio_get_Long(gnu::java::nio::LongBufferImpl*, jint, jint)
+{
+ return 0;
+}
+
+jfloat
+gnu::java::nio::LongBufferImpl::nio_get_Float(gnu::java::nio::LongBufferImpl*, jint, jint)
+{
+ return 0.0;
+}
+
+jdouble
+gnu::java::nio::LongBufferImpl::nio_get_Double(gnu::java::nio::LongBufferImpl*, jint, jint)
+{
+ return 0.0;
+}
diff --git a/libjava/gnu/java/nio/natSelectorImpl.cc b/libjava/gnu/java/nio/natSelectorImpl.cc
new file mode 100644
index 00000000000..d7185828d59
--- /dev/null
+++ b/libjava/gnu/java/nio/natSelectorImpl.cc
@@ -0,0 +1,126 @@
+// natSelectorImpl.cc
+
+/* Copyright (C) 2002 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 <config.h>
+#include <platform.h>
+
+#include <errno.h>
+#include <string.h>
+
+#if HAVE_BSTRING_H
+// Needed for bzero, implicitly used by FD_ZERO on IRIX 5.2
+#include <bstring.h>
+#endif
+
+//#include <gcj/cni.h>
+#include <gnu/java/nio/SelectorImpl.h>
+#include <java/io/IOException.h>
+
+void
+helper_put_filedescriptors (jintArray java_fd_array, fd_set& fds, int& max_fd)
+{
+ int counter;
+ jint* java_fds;
+
+ java_fds = elements (java_fd_array);
+
+ for (counter = 0; counter < JvGetArrayLength (java_fd_array); counter++)
+ {
+ FD_SET (java_fds [counter], &fds);
+
+ if (java_fds [counter] > max_fd)
+ {
+ max_fd = java_fds [counter];
+ }
+ }
+}
+
+void
+helper_get_filedescriptors (jintArray& java_fd_array, fd_set fds)
+{
+ int counter;
+ int counter_fds;
+ jint* java_fds;
+ jintArray new_array_fds;
+ jint* new_data_fds;
+
+ counter_fds = 0;
+ java_fds = elements (java_fd_array);
+
+ for (counter = 0; counter < JvGetArrayLength (java_fd_array); counter++)
+ {
+ if (FD_ISSET (java_fds[counter], &fds))
+ {
+ counter_fds++;
+ }
+ }
+
+ new_array_fds = JvNewIntArray (counter_fds);
+ new_data_fds = elements (new_array_fds);
+
+ for (counter = 0; counter < JvGetArrayLength (java_fd_array); counter++)
+ {
+ if (FD_ISSET (java_fds[counter], &fds))
+ {
+ new_data_fds[counter] = java_fds[counter];
+ }
+ }
+
+ java_fd_array = new_array_fds;
+}
+
+jint
+gnu::java::nio::SelectorImpl::java_do_select (jintArray read, jintArray write,
+ jintArray except, jlong timeout)
+{
+ jint result;
+ int max_fd = 0;
+ fd_set read_fds;
+ fd_set write_fds;
+ fd_set except_fds;
+ struct timeval real_time_data;
+ struct timeval *time_data = NULL;
+
+ real_time_data.tv_sec = 0;
+ real_time_data.tv_usec = timeout;
+
+ // If not legal timeout value is given, use NULL.
+ // This means an infinite timeout.
+ if (timeout >= 0)
+ {
+ time_data = &real_time_data;
+ }
+
+ // Reset all fd_set structures
+ FD_ZERO (&read_fds);
+ FD_ZERO (&write_fds);
+ FD_ZERO (&except_fds);
+
+ // Fill the fd_set data structures for the _Jv_select() call.
+ helper_put_filedescriptors (read, read_fds, max_fd);
+ helper_put_filedescriptors (write, write_fds, max_fd);
+ helper_put_filedescriptors (except, except_fds, max_fd);
+
+ // Actually do the select
+ result = _Jv_select (max_fd + 1, &read_fds, &write_fds, &except_fds, time_data);
+
+ if (result < 0)
+ {
+ char* strerr = strerror (errno);
+ throw new ::java::io::IOException (JvNewStringUTF (strerr));
+ }
+
+ // Set the file descriptors according to the values returned from select().
+ helper_get_filedescriptors (read, read_fds);
+ helper_get_filedescriptors (write, write_fds);
+ helper_get_filedescriptors (except, except_fds);
+
+ return result;
+}
diff --git a/libjava/gnu/java/nio/natServerSocketChannelImpl.cc b/libjava/gnu/java/nio/natServerSocketChannelImpl.cc
new file mode 100644
index 00000000000..1f7d7fc6890
--- /dev/null
+++ b/libjava/gnu/java/nio/natServerSocketChannelImpl.cc
@@ -0,0 +1,77 @@
+// natSelectorImpl.cc
+
+/* Copyright (C) 2002 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 <config.h>
+#include <platform.h>
+
+#include <errno.h>
+#include <netinet/in.h>
+
+#include <gcj/cni.h>
+#include <gnu/java/nio/ServerSocketChannelImpl.h>
+#include <gnu/java/nio/SocketChannelImpl.h>
+#include <java/io/IOException.h>
+#include <java/net/InetSocketAddress.h>
+#include <java/net/SocketException.h>
+
+union SockAddr
+{
+ struct sockaddr_in address;
+#ifdef HAVE_INET6
+ struct sockaddr_in6 address6;
+#endif
+};
+
+jint
+gnu::java::nio::ServerSocketChannelImpl::SocketAccept (
+ ServerSocketChannelImpl* socket,
+ SocketChannelImpl* s)
+{
+ union SockAddr u;
+ struct sockaddr *ptr = (struct sockaddr *) &u.address;
+ socklen_t addrlen = sizeof(struct sockaddr);
+/*
+ jbyteArray haddress = socket->sa->getAddress ()->addr;
+ jbyte *bytes = elements (haddress);
+ int len = haddress->length;
+
+ if (len == 4)
+ {
+ u.address.sin_family = AF_INET;
+ memcpy (&u.address.sin_addr, bytes, len);
+ len = sizeof (struct sockaddr_in);
+ u.address.sin_port = htons ( socket->sa->getPort ());
+ }
+#ifdef HAVE_INET6
+ else if (len == 16)
+ {
+ u.address6.sin6_family = AF_INET6;
+ memcpy (&u.address6.sin6_addr, bytes, len);
+ len = sizeof (struct sockaddr_in6);
+ u.address6.sin6_port = htons (socket->sa->getPort ());
+ }
+#endif
+ else
+ throw new ::java::net::SocketException (JvNewStringUTF ("invalid length"));
+*/
+
+ int sock = _Jv_accept (socket->fd, ptr, &addrlen);
+
+ // FIXME: write address/port in ptr into java variables
+
+ if (sock < 0)
+ {
+ char* strerr = strerror (errno);
+ throw new ::java::io::IOException (JvNewStringUTF (strerr));
+ }
+
+ s->fd = sock;
+ return sock;
+}
diff --git a/libjava/gnu/java/nio/natShortBufferImpl.cc b/libjava/gnu/java/nio/natShortBufferImpl.cc
new file mode 100644
index 00000000000..bfcfe28a6e2
--- /dev/null
+++ b/libjava/gnu/java/nio/natShortBufferImpl.cc
@@ -0,0 +1,125 @@
+#include <config.h>
+
+#include <gcj/cni.h>
+#include <jvm.h>
+
+#include <gnu/java/nio/ShortBufferImpl.h>
+
+JArray<jshort>*
+gnu::java::nio::ShortBufferImpl::nio_cast(JArray<jbyte>*)
+{
+ return NULL;
+}
+
+JArray<jshort>*
+gnu::java::nio::ShortBufferImpl::nio_cast(JArray<jshort>*)
+{
+ return NULL;
+}
+
+JArray<jshort>*
+gnu::java::nio::ShortBufferImpl::nio_cast(JArray<jint>*)
+{
+ return NULL;
+}
+
+JArray<jshort>*
+gnu::java::nio::ShortBufferImpl::nio_cast(JArray<jlong>*)
+{
+ return NULL;
+}
+
+JArray<jshort>*
+gnu::java::nio::ShortBufferImpl::nio_cast(JArray<jchar>*)
+{
+ return NULL;
+}
+
+JArray<jshort>*
+gnu::java::nio::ShortBufferImpl::nio_cast(JArray<jfloat>*)
+{
+ return NULL;
+}
+
+JArray<jshort>*
+gnu::java::nio::ShortBufferImpl::nio_cast(JArray<jdouble>*)
+{
+ return NULL;
+}
+
+void
+gnu::java::nio::ShortBufferImpl::nio_put_Byte(gnu::java::nio::ShortBufferImpl*, jint, jint, jbyte)
+{
+}
+
+void
+gnu::java::nio::ShortBufferImpl::nio_put_Char(gnu::java::nio::ShortBufferImpl*, jint, jint, jchar)
+{
+}
+
+void
+gnu::java::nio::ShortBufferImpl::nio_put_Short(gnu::java::nio::ShortBufferImpl*, jint, jint, jshort)
+{
+}
+
+void
+gnu::java::nio::ShortBufferImpl::nio_put_Int(gnu::java::nio::ShortBufferImpl*, jint, jint, jint)
+{
+}
+
+void
+gnu::java::nio::ShortBufferImpl::nio_put_Long(gnu::java::nio::ShortBufferImpl*, jint, jint, jlong)
+{
+}
+
+void
+gnu::java::nio::ShortBufferImpl::nio_put_Float(gnu::java::nio::ShortBufferImpl*, jint, jint, jfloat)
+{
+}
+
+void
+gnu::java::nio::ShortBufferImpl::nio_put_Double(gnu::java::nio::ShortBufferImpl*, jint, jint, jdouble)
+{
+}
+
+jbyte
+gnu::java::nio::ShortBufferImpl::nio_get_Byte(gnu::java::nio::ShortBufferImpl*, jint, jint)
+{
+ return 0;
+}
+
+jchar
+gnu::java::nio::ShortBufferImpl::nio_get_Char(gnu::java::nio::ShortBufferImpl*, jint, jint)
+{
+ return ' ';
+}
+
+jshort
+gnu::java::nio::ShortBufferImpl::nio_get_Short(gnu::java::nio::ShortBufferImpl*, jint, jint)
+{
+ return 0;
+}
+
+jint
+gnu::java::nio::ShortBufferImpl::nio_get_Int(gnu::java::nio::ShortBufferImpl*, jint, jint)
+{
+ return 0;
+}
+
+jlong
+gnu::java::nio::ShortBufferImpl::nio_get_Long(gnu::java::nio::ShortBufferImpl*, jint, jint)
+{
+ return 0;
+}
+
+jfloat
+gnu::java::nio::ShortBufferImpl::nio_get_Float(gnu::java::nio::ShortBufferImpl*, jint, jint)
+{
+ return 0.0;
+}
+
+jdouble
+gnu::java::nio::ShortBufferImpl::nio_get_Double(gnu::java::nio::ShortBufferImpl*, jint, jint)
+{
+ return 0.0;
+}
diff --git a/libjava/gnu/java/nio/natSocketChannelImpl.cc b/libjava/gnu/java/nio/natSocketChannelImpl.cc
new file mode 100644
index 00000000000..4e6c6da3782
--- /dev/null
+++ b/libjava/gnu/java/nio/natSocketChannelImpl.cc
@@ -0,0 +1,130 @@
+// natSelectorImpl.cc
+
+/* Copyright (C) 2002 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 <config.h>
+#include <platform.h>
+
+#include <errno.h>
+
+#include <gcj/cni.h>
+#include <gnu/java/nio/SocketChannelImpl.h>
+#include <java/io/IOException.h>
+#include <java/net/InetAddress.h>
+#include <java/net/SocketException.h>
+
+jint
+gnu::java::nio::SocketChannelImpl::SocketCreate ()
+{
+ int sock = _Jv_socket (AF_INET, SOCK_STREAM, 0);
+
+ if (sock < 0)
+ {
+ char* strerr = strerror (errno);
+ throw new ::java::io::IOException (JvNewStringUTF (strerr));
+ }
+
+ return sock;
+}
+
+jint
+gnu::java::nio::SocketChannelImpl::SocketConnect (jint fd,
+ ::java::net::InetAddress *addr,
+ jint port)
+{
+ int result = _Jv_connect_address (fd, addr, port, addr, port);
+
+ if (result < 0)
+ {
+ char* strerr = strerror (errno);
+ throw new ::java::io::IOException (JvNewStringUTF (strerr));
+ }
+
+ return result;
+}
+
+jint
+gnu::java::nio::SocketChannelImpl::SocketBind (jint fd,
+ ::java::net::InetAddress *addr,
+ jint port)
+{
+ int result = _Jv_bind_address (fd, addr, port);
+
+ if (result < 0)
+ {
+ char* strerr = strerror (errno);
+ throw new ::java::io::IOException (JvNewStringUTF (strerr));
+ }
+
+ return result;
+}
+
+jint
+gnu::java::nio::SocketChannelImpl::SocketListen (jint fd, jint backlog)
+{
+ int result = _Jv_listen (fd, backlog);
+
+ if (result < 0)
+ {
+ char* strerr = strerror (errno);
+ throw new ::java::io::IOException (JvNewStringUTF (strerr));
+ }
+
+ return result;
+}
+
+jint
+gnu::java::nio::SocketChannelImpl::SocketAvailable (jint /*fd*/)
+{
+ throw new ::java::net::SocketException (JvNewStringLatin1 ("SocketAvailable: not implemented"));
+}
+
+jint
+gnu::java::nio::SocketChannelImpl::SocketClose (jint fd)
+{
+ int result = _Jv_close (fd);
+
+ if (result < 0)
+ {
+ char* strerr = strerror (errno);
+ throw new ::java::io::IOException (JvNewStringUTF (strerr));
+ }
+
+ return result;
+}
+
+jint
+gnu::java::nio::SocketChannelImpl::SocketRead (jint fd, jbyteArray data,
+ jint offset, jint length)
+{
+ int result = ::recv (fd, data, offset, length);
+
+ if (result < 0)
+ {
+ char* strerr = strerror (errno);
+ throw new ::java::io::IOException (JvNewStringUTF (strerr));
+ }
+
+ return result;
+}
+
+jint
+gnu::java::nio::SocketChannelImpl::SocketWrite (jint fd, jbyteArray data,
+ jint offset, jint length)
+{
+ int result = ::send (fd, data, offset, length);
+
+ if (result < 0)
+ {
+ char* strerr = strerror (errno);
+ throw new ::java::io::IOException (JvNewStringUTF (strerr));
+ }
+
+ return result;
+}
diff --git a/libjava/gnu/java/rmi/RMIMarshalledObjectInputStream.java b/libjava/gnu/java/rmi/RMIMarshalledObjectInputStream.java
new file mode 100644
index 00000000000..8835280a0e0
--- /dev/null
+++ b/libjava/gnu/java/rmi/RMIMarshalledObjectInputStream.java
@@ -0,0 +1,70 @@
+/* gnu.java.rmi.RMIMarshalledObjectInputStream
+ Copyright (C) 2002 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.rmi;
+
+import gnu.java.rmi.server.RMIObjectInputStream;
+import java.io.ObjectInputStream;
+import java.io.IOException;
+import java.io.ByteArrayInputStream;
+
+/**
+ * This class is only for java.rmi.MarshalledObject to deserialize object from
+ * objBytes and locBytes
+ */
+
+public class RMIMarshalledObjectInputStream extends RMIObjectInputStream
+{
+ private ObjectInputStream locStream;
+
+ public RMIMarshalledObjectInputStream(byte[] objBytes, byte[] locBytes) throws IOException
+ {
+ super(new ByteArrayInputStream(objBytes));
+ if(locBytes != null)
+ locStream = new ObjectInputStream(new ByteArrayInputStream(locBytes));
+ }
+
+ //This method overrides RMIObjectInputStream's
+ protected Object getAnnotation() throws IOException, ClassNotFoundException
+ {
+ if(locStream == null)
+ return null;
+ return locStream.readObject();
+ }
+
+} // End of RMIMarshalledObjectInputStream
diff --git a/libjava/gnu/java/rmi/RMIMarshalledObjectOutputStream.java b/libjava/gnu/java/rmi/RMIMarshalledObjectOutputStream.java
new file mode 100644
index 00000000000..a721fc47194
--- /dev/null
+++ b/libjava/gnu/java/rmi/RMIMarshalledObjectOutputStream.java
@@ -0,0 +1,83 @@
+/* gnu.java.rmi.RMIMarshalledObjectOutputStream
+ Copyright (C) 2002 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.rmi;
+
+import java.io.OutputStream;
+import java.io.ObjectOutputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.rmi.Remote;
+import java.rmi.server.ObjID;
+import java.rmi.server.RemoteStub;
+
+import gnu.java.rmi.server.RMIObjectOutputStream;
+import gnu.java.rmi.server.UnicastServerRef;
+
+/**
+ * This class is only for java.rmi.MarshalledObject to serialize object and
+ * got objBytes and locBytes
+ */
+public class RMIMarshalledObjectOutputStream extends RMIObjectOutputStream
+{
+ private ObjectOutputStream locStream;
+ private ByteArrayOutputStream locBytesStream;
+
+ public RMIMarshalledObjectOutputStream(OutputStream objStream) throws IOException
+ {
+ super(objStream);
+ locBytesStream = new ByteArrayOutputStream(256);
+ locStream = new ObjectOutputStream(locBytesStream);
+ }
+
+ //This method overrides RMIObjectOutputStream's.
+ protected void setAnnotation(String annotation) throws IOException{
+ locStream.writeObject(annotation);
+ }
+
+ public void flush() throws IOException {
+ super.flush();
+ locStream.flush();
+ }
+
+ public byte[] getLocBytes(){
+ return locBytesStream.toByteArray();
+ }
+
+} // End of RMIMarshalledObjectOutputStream
+
diff --git a/libjava/gnu/java/rmi/dgc/DGCImpl.java b/libjava/gnu/java/rmi/dgc/DGCImpl.java
index adca54fda44..4216b6466ba 100644
--- a/libjava/gnu/java/rmi/dgc/DGCImpl.java
+++ b/libjava/gnu/java/rmi/dgc/DGCImpl.java
@@ -1,5 +1,5 @@
/*
- Copyright (c) 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
+ Copyright (c) 1996, 1997, 1998, 1999, 2002 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -46,20 +46,73 @@ import java.rmi.server.UnicastRemoteObject;
import java.rmi.server.RMISocketFactory;
import gnu.java.rmi.server.UnicastServerRef;
+import java.util.Hashtable;
+
+/**
+ * I let DGCImpl to extend UnicastServerRef, but not
+ * UnicastRemoteObject, because UnicastRemoteObject must
+ * exportObject automatically.
+ */
public class DGCImpl
- extends UnicastRemoteObject implements DGC {
+ extends UnicastServerRef implements DGC {
+
+ private static final long LEASE_VALUE = 600000L;
+ // leaseCache caches a LeaseRecord associated with a vmid
+ private Hashtable leaseCache = new Hashtable();
public DGCImpl() throws RemoteException {
- super(new UnicastServerRef(new ObjID(ObjID.DGC_ID), 0, RMISocketFactory.getSocketFactory()));
+ super(new ObjID(ObjID.DGC_ID), 0, RMISocketFactory.getSocketFactory());
}
public Lease dirty(ObjID[] ids, long sequenceNum, Lease lease) throws RemoteException {
- System.out.println("DGCImpl.dirty - not implemented");
+ VMID vmid = lease.getVMID();
+ if (vmid == null)
+ vmid = new VMID();
+ long leaseValue = LEASE_VALUE;
+ //long leaseValue = lease.getValue();
+ lease = new Lease(vmid, leaseValue);
+ synchronized(leaseCache){
+ LeaseRecord lr = (LeaseRecord)leaseCache.get(vmid);
+ if (lr != null)
+ lr.reset(leaseValue);
+ else{
+ lr = new LeaseRecord(vmid, leaseValue);
+ leaseCache.put(vmid, lr);
+ }
+ }
+
return (lease);
}
public void clean(ObjID[] ids, long sequenceNum, VMID vmid, boolean strong) throws RemoteException {
- System.out.println("DGCImpl.clean - not implemented");
+ // Not implemented
}
+
+ /**
+ * LeaseRecord associates a vmid to expireTime.
+ */
+ private static class LeaseRecord{
+ private VMID vmid;
+ private long expireTime;
+
+ LeaseRecord(VMID vmid, long leaseValue){
+ this.vmid = vmid;
+ reset(leaseValue);
+ }
+
+ // reset expireTime
+ void reset(long leaseValue){
+ long l = System.currentTimeMillis();
+ expireTime = l + leaseValue;
+ }
-}
+ boolean isExpired(){
+ long l = System.currentTimeMillis();
+ if ( l > expireTime)
+ return true;
+ return false;
+ }
+
+ } //End of LeaseRecord
+
+} //End of DGCImpl
diff --git a/libjava/gnu/java/rmi/dgc/DGCImpl_Skel.java b/libjava/gnu/java/rmi/dgc/DGCImpl_Skel.java
index fd0f2eec803..545ebc7bdea 100644
--- a/libjava/gnu/java/rmi/dgc/DGCImpl_Skel.java
+++ b/libjava/gnu/java/rmi/dgc/DGCImpl_Skel.java
@@ -1,3 +1,41 @@
+/* DGCImpl_Skel.java
+ Copyright (C) 2002 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. */
+
+
// Skel class generated by rmic - DO NOT EDIT!
package gnu.java.rmi.dgc;
diff --git a/libjava/gnu/java/rmi/dgc/DGCImpl_Stub.java b/libjava/gnu/java/rmi/dgc/DGCImpl_Stub.java
index e611fb227eb..bffde5280cd 100644
--- a/libjava/gnu/java/rmi/dgc/DGCImpl_Stub.java
+++ b/libjava/gnu/java/rmi/dgc/DGCImpl_Stub.java
@@ -1,3 +1,41 @@
+/* DGCImpl_Stub.java
+ Copyright (C) 2002 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. */
+
+
// Stub class generated by rmic - DO NOT EDIT!
package gnu.java.rmi.dgc;
diff --git a/libjava/gnu/java/rmi/registry/RegistryImpl.java b/libjava/gnu/java/rmi/registry/RegistryImpl.java
index fdf4506f32d..007d5a97de9 100644
--- a/libjava/gnu/java/rmi/registry/RegistryImpl.java
+++ b/libjava/gnu/java/rmi/registry/RegistryImpl.java
@@ -64,7 +64,8 @@ public RegistryImpl(int port) throws RemoteException {
public RegistryImpl(int port, RMIClientSocketFactory cf, RMIServerSocketFactory sf) throws RemoteException {
super(new UnicastServerRef(new ObjID(ObjID.REGISTRY_ID), port, sf));
- ((UnicastServerRef)getRef()).exportObject(this);
+ // The following is unnecessary, because UnicastRemoteObject export itself automatically.
+ //((UnicastServerRef)getRef()).exportObject(this);
}
public Remote lookup(String name) throws RemoteException, NotBoundException, AccessException {
diff --git a/libjava/gnu/java/rmi/registry/RegistryImpl_Skel.java b/libjava/gnu/java/rmi/registry/RegistryImpl_Skel.java
index 7ba41c389cb..de6b9e42604 100644
--- a/libjava/gnu/java/rmi/registry/RegistryImpl_Skel.java
+++ b/libjava/gnu/java/rmi/registry/RegistryImpl_Skel.java
@@ -1,3 +1,41 @@
+/* RegistryImpl_Skel.java
+ Copyright (C) 2002 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. */
+
+
// Skel class generated by rmic - DO NOT EDIT!
package gnu.java.rmi.registry;
diff --git a/libjava/gnu/java/rmi/registry/RegistryImpl_Stub.java b/libjava/gnu/java/rmi/registry/RegistryImpl_Stub.java
index bfa755c3fdb..45e10c49050 100644
--- a/libjava/gnu/java/rmi/registry/RegistryImpl_Stub.java
+++ b/libjava/gnu/java/rmi/registry/RegistryImpl_Stub.java
@@ -1,3 +1,41 @@
+/* RegistryImpl_Stub.java
+ Copyright (C) 2002 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. */
+
+
// Stub class generated by rmic - DO NOT EDIT!
package gnu.java.rmi.registry;
@@ -29,7 +67,7 @@ public final class RegistryImpl_Stub
static {
try {
java.rmi.server.RemoteRef.class.getMethod("invoke", new java.lang.Class[] { java.rmi.Remote.class, java.lang.reflect.Method.class, java.lang.Object[].class, long.class });
- useNewInvoke = true;
+ useNewInvoke = false;
$method_bind_0 = gnu.java.rmi.registry.RegistryImpl.class.getMethod("bind", new java.lang.Class[] {java.lang.String.class, java.rmi.Remote.class});
$method_list_1 = gnu.java.rmi.registry.RegistryImpl.class.getMethod("list", new java.lang.Class[] {});
$method_lookup_2 = gnu.java.rmi.registry.RegistryImpl.class.getMethod("lookup", new java.lang.Class[] {java.lang.String.class});
diff --git a/libjava/gnu/java/rmi/server/ConnectionRunnerPool.java b/libjava/gnu/java/rmi/server/ConnectionRunnerPool.java
new file mode 100644
index 00000000000..af7dc0501ae
--- /dev/null
+++ b/libjava/gnu/java/rmi/server/ConnectionRunnerPool.java
@@ -0,0 +1,155 @@
+/* gnu.java.rmi.server.ConnectionRunnerPool
+ Copyright (C) 2002 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.rmi.server;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+
+//Should I generalize this class?
+
+class ConnectionRunnerPool
+{
+
+ public static
+ class ConnectionRunner extends Thread{
+ private UnicastConnection conn;
+ private volatile boolean exiting = false;
+
+ public ConnectionRunner(ThreadGroup group, String id){
+ super(group, id);
+ }
+
+ public synchronized void run(){
+ while(!exiting){
+ if(conn == null)
+ try{
+ wait();
+ }catch(InterruptedException e){
+ continue;
+ }
+ else{
+ conn.run();
+ conn = null;
+ synchronized(ConnectionRunnerPool.class){
+ freelist.add(this);
+ if(freelist.size() == 1)
+ ConnectionRunnerPool.class.notifyAll();
+ }
+ }
+ }
+ }
+
+ public synchronized void dispatch(UnicastConnection conn){
+ this.conn = conn;
+ notify();
+ }
+
+ void exit(){
+ exiting = true;
+ if(conn != null)
+ try{
+ join(500);
+ }catch(InterruptedException e){}
+ interrupt();
+ }
+
+ }
+
+ // Should this value equal to number of CPU?
+ private static int size = 5;
+ private static int max_size = 10;
+
+ private static ArrayList freelist;
+
+ private static ThreadGroup group = new ThreadGroup("pool");
+
+ static {
+ ConnectionRunner[] pools = new ConnectionRunner[size];
+ for(int i = 0; i < pools.length; i++){
+ pools[i] = new ConnectionRunner(group, new Integer(i).toString());
+ pools[i].setContextClassLoader(Thread.currentThread().getContextClassLoader());
+ pools[i].start();
+ }
+ freelist = new ArrayList(Arrays.asList(pools));
+ }
+
+ public static void setSize(int size_){
+ size = size_;
+ }
+
+ public static void setMaxSize(int size){
+ max_size = size;
+ }
+
+ private synchronized static ConnectionRunner getConnectionRunner()
+ {
+ if(freelist.size() == 0){
+ if(size < max_size){
+ ++size;
+ ConnectionRunner a = new ConnectionRunner(group, new Integer(size).toString());
+ a.start();
+ freelist.add(a);
+ }else
+ while(freelist.size() == 0)
+ try{
+ ConnectionRunnerPool.class.wait();
+ }catch(InterruptedException e){}
+ }
+
+ // always let the first in pool most busy or other scheduling plan??
+ ConnectionRunner a = (ConnectionRunner)freelist.get(0);
+ freelist.remove(a);
+ return a;
+ }
+
+ public static void dispatchConnection(UnicastConnection conn)
+ {
+ ConnectionRunner r = getConnectionRunner();
+ r.dispatch(conn);
+ }
+
+ public static void exit()
+ {
+ Thread[] list = new Thread[group.activeCount()];
+ group.enumerate(list);
+ for(int i = 0; i < list.length; i++)
+ ((ConnectionRunner)list[i]).exit();
+ }
+
+}
diff --git a/libjava/gnu/java/rmi/server/RMIHashes.java b/libjava/gnu/java/rmi/server/RMIHashes.java
index 993e5bf1d2b..6e32724d50a 100644
--- a/libjava/gnu/java/rmi/server/RMIHashes.java
+++ b/libjava/gnu/java/rmi/server/RMIHashes.java
@@ -39,13 +39,56 @@ package gnu.java.rmi.server;
import java.lang.reflect.Method;
import java.lang.Class;
-import gnu.java.security.provider.SHA;
+import gnu.java.io.NullOutputStream;
+import gnu.java.lang.reflect.TypeSignature;
+import java.security.MessageDigest;
+import java.security.DigestOutputStream;
+import java.io.DataOutputStream;
+import java.io.ByteArrayOutputStream;
public class RMIHashes
{
+ //There're other places using DigestOutputStream to generate hash in classpath, but I think the way I used
+ //here is more efficient, anyway, you can switch to DigestOutputStream by doing like "//or:" comments say.
+
+ //or:add this statement: private static final NullOutputStream nullOutputStream = new NullOutputStream ();
public static long getMethodHash(Method meth)
{
- return meth.hashCode ();
+ //Object Serialization Spec 8.3
+ try
+ {
+ MessageDigest md = MessageDigest.getInstance ("SHA");
+ //or:remove this statement: DigestOutputStream digest_out = new DigestOutputStream (nullOutputStream, md);
+ ByteArrayOutputStream digest_out = new ByteArrayOutputStream();
+ DataOutputStream data_out = new DataOutputStream (digest_out);
+
+ StringBuffer sbuf = new StringBuffer();
+ sbuf.append(meth.getName());
+ sbuf.append('(');
+ Class params[] = meth.getParameterTypes();
+ for(int i = 0; i < params.length; i++)
+ sbuf.append(TypeSignature.getEncodingOfClass(params[i]));
+ sbuf.append(')');
+ Class rcls = meth.getReturnType();
+ if(rcls != Void.TYPE)
+ sbuf.append(TypeSignature.getEncodingOfClass(rcls));
+ else
+ sbuf.append('V');
+
+ data_out.writeUTF (sbuf.toString());
+ data_out.flush();
+ data_out.close ();
+
+ md.update(digest_out.toByteArray()); //or:remove this statement
+ byte[] sha = md.digest ();
+ long result = 0;
+ int len = sha.length < 8 ? sha.length : 8;
+ for (int i=0; i < len; i++)
+ result += (long)(sha[i] & 0xFF) << (8 * i);
+ return result;
+ }catch(Exception _){
+ return -1L;
+ }
}
public static long getInterfaceHash(Class clazz)
@@ -53,3 +96,4 @@ public class RMIHashes
return clazz.hashCode ();
}
}
+
diff --git a/libjava/gnu/java/rmi/server/RMIObjectInputStream.java b/libjava/gnu/java/rmi/server/RMIObjectInputStream.java
index 70b6c53c304..3e862c3c184 100644
--- a/libjava/gnu/java/rmi/server/RMIObjectInputStream.java
+++ b/libjava/gnu/java/rmi/server/RMIObjectInputStream.java
@@ -1,5 +1,5 @@
/*
- Copyright (c) 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
+ Copyright (c) 1996, 1997, 1998, 1999, 2002 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -44,32 +44,83 @@ import java.io.IOException;
import java.net.URL;
import java.net.MalformedURLException;
import java.rmi.server.RMIClassLoader;
+import java.lang.ClassNotFoundException;
+import java.lang.reflect.Proxy;
public class RMIObjectInputStream
extends ObjectInputStream {
-UnicastConnectionManager manager;
-
-public RMIObjectInputStream(InputStream strm, UnicastConnectionManager man) throws IOException {
+public RMIObjectInputStream(InputStream strm) throws IOException {
super(strm);
- manager = man;
enableResolveObject(true);
}
protected Class resolveClass(ObjectStreamClass desc) throws IOException, ClassNotFoundException {
-//System.out.println("Resolving class: " + desc.getName());
- String annotation = (String)readObject();
- if (annotation == null) {
- return (super.resolveClass(desc));
+ String annotation = (String)getAnnotation();
+
+ try {
+ if(annotation == null)
+ return (RMIClassLoader.loadClass(desc.getName()));
+ else
+ return (RMIClassLoader.loadClass(annotation, desc.getName()));
}
- else {
- try {
- return (RMIClassLoader.loadClass(new URL(annotation), desc.getName()));
- }
- catch (MalformedURLException _) {
- throw new ClassNotFoundException(desc.getName());
- }
+ catch (MalformedURLException _) {
+ throw new ClassNotFoundException(desc.getName());
}
}
+//Separate it for override by MarshalledObject
+protected Object getAnnotation()
+ throws IOException, ClassNotFoundException
+{
+ return readObject();
+}
+
+protected Class resolveProxyClass(String intfs[])
+ throws IOException, ClassNotFoundException
+{
+ String annotation = (String)getAnnotation();
+
+ Class clss[] = new Class[intfs.length];
+ if(annotation == null)
+ clss[0] = RMIClassLoader.loadClass(intfs[0]);
+ else
+ clss[0] = RMIClassLoader.loadClass(annotation, intfs[0]);
+
+ //assume all interfaces can be loaded by the same classloader
+ ClassLoader loader = clss[0].getClassLoader();
+ for (int i = 0; i < intfs.length; i++)
+ clss[i] = Class.forName(intfs[i], false, loader);
+
+ try {
+ return Proxy.getProxyClass(loader, clss);
+ } catch (IllegalArgumentException e) {
+ throw new ClassNotFoundException(null, e);
+ }
+}
+
+protected Object readValue(Class valueClass) throws IOException, ClassNotFoundException {
+ if(valueClass.isPrimitive()){
+ if(valueClass == Boolean.TYPE)
+ return new Boolean(readBoolean());
+ if(valueClass == Byte.TYPE)
+ return new Byte(readByte());
+ if(valueClass == Character.TYPE)
+ return new Character(readChar());
+ if(valueClass == Short.TYPE)
+ return new Short(readShort());
+ if(valueClass == Integer.TYPE)
+ return new Integer(readInt());
+ if(valueClass == Long.TYPE)
+ return new Long(readLong());
+ if(valueClass == Float.TYPE)
+ return new Float(readFloat());
+ if(valueClass == Double.TYPE)
+ return new Double(readDouble());
+ else
+ throw new Error("Unsupported primitive class: " + valueClass);
+ } else
+ return readObject();
+}
+
}
diff --git a/libjava/gnu/java/rmi/server/RMIObjectOutputStream.java b/libjava/gnu/java/rmi/server/RMIObjectOutputStream.java
index d729047b487..97ac88aabc1 100644
--- a/libjava/gnu/java/rmi/server/RMIObjectOutputStream.java
+++ b/libjava/gnu/java/rmi/server/RMIObjectOutputStream.java
@@ -1,5 +1,5 @@
/*
- Copyright (c) 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
+ Copyright (c) 1996, 1997, 1998, 1999, 2002 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -41,17 +41,73 @@ import java.io.ObjectOutputStream;
import java.io.OutputStream;
import java.io.IOException;
import java.rmi.server.RMIClassLoader;
+import java.rmi.Remote;
+import java.rmi.server.RemoteStub;
+import java.rmi.server.ObjID;
public class RMIObjectOutputStream
extends ObjectOutputStream {
public RMIObjectOutputStream(OutputStream strm) throws IOException {
super(strm);
+ enableReplaceObject(true);
+}
+
+//Separate it for override by MarshalledObject
+protected void setAnnotation(String annotation) throws IOException{
+ writeObject(annotation);
}
protected void annotateClass(Class cls) throws IOException {
-//System.out.println("Annotating class: " + cls);
- writeObject(RMIClassLoader.getClassAnnotation(cls));
+ setAnnotation(RMIClassLoader.getClassAnnotation(cls));
+}
+
+protected void annotateProxyClass(Class cls)
+ throws IOException
+{
+ annotateClass(cls);
+}
+
+protected Object replaceObject(Object obj)
+ throws IOException
+{
+ if((obj instanceof Remote) && !(obj instanceof RemoteStub)){
+ UnicastServerRef ref = UnicastServer.getExportedRef((Remote)obj);
+ if (ref != null)
+ return ref.getStub();
+ }
+ return obj;
+}
+
+protected void writeValue(Object value, Class valueClass) throws IOException{
+ if(valueClass.isPrimitive()){
+ if(valueClass == Boolean.TYPE)
+ writeBoolean(((Boolean)value).booleanValue());
+ else
+ if(valueClass == Byte.TYPE)
+ writeByte(((Byte)value).byteValue());
+ else
+ if(valueClass == Character.TYPE)
+ writeChar(((Character)value).charValue());
+ else
+ if(valueClass == Short.TYPE)
+ writeShort(((Short)value).shortValue());
+ else
+ if(valueClass == Integer.TYPE)
+ writeInt(((Integer)value).intValue());
+ else
+ if(valueClass == Long.TYPE)
+ writeLong(((Long)value).longValue());
+ else
+ if(valueClass == Float.TYPE)
+ writeFloat(((Float)value).floatValue());
+ else
+ if(valueClass == Double.TYPE)
+ writeDouble(((Double)value).doubleValue());
+ else
+ throw new Error("Unsupported primitive class: " + valueClass);
+ } else
+ writeObject(value);
}
}
diff --git a/libjava/gnu/java/rmi/server/UnicastConnection.java b/libjava/gnu/java/rmi/server/UnicastConnection.java
index a8951656024..14d28f26c91 100644
--- a/libjava/gnu/java/rmi/server/UnicastConnection.java
+++ b/libjava/gnu/java/rmi/server/UnicastConnection.java
@@ -1,5 +1,5 @@
/*
- Copyright (c) 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
+ Copyright (c) 1996, 1997, 1998, 1999, 2002 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -44,6 +44,8 @@ import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
+import java.io.BufferedInputStream;
+import java.io.BufferedOutputStream;
import java.io.ObjectOutput;
import java.io.ObjectInput;
import java.io.IOException;
@@ -59,15 +61,20 @@ DataOutputStream dout;
ObjectInputStream oin;
ObjectOutputStream oout;
+// reviveTime and expireTime make UnicastConnection pool-able
+long reviveTime = 0;
+long expireTime = Long.MAX_VALUE;
+
UnicastConnection(UnicastConnectionManager man, Socket sock) {
this.manager = man;
this.sock = sock;
}
void acceptConnection() throws IOException {
-//System.out.println("Accepting connection on " + lport);
- din = new DataInputStream(sock.getInputStream());
- dout = new DataOutputStream(sock.getOutputStream());
+//System.out.println("Accepting connection on " + sock);
+ //Use BufferedXXXStream would be more efficient
+ din = new DataInputStream(new BufferedInputStream(sock.getInputStream()));
+ dout = new DataOutputStream(new BufferedOutputStream(sock.getOutputStream()));
int sig = din.readInt();
if (sig != PROTOCOL_HEADER) {
@@ -85,6 +92,7 @@ void acceptConnection() throws IOException {
// Send my hostname and port
dout.writeUTF(manager.serverName);
dout.writeInt(manager.serverPort);
+ dout.flush();
// Read their hostname and port
String rhost = din.readUTF();
@@ -94,15 +102,16 @@ void acceptConnection() throws IOException {
}
void makeConnection(int protocol) throws IOException {
- dout = new DataOutputStream(sock.getOutputStream());
- din = new DataInputStream(sock.getInputStream());
+ //Use BufferedXXXStream would be more efficient
+ din = new DataInputStream(new BufferedInputStream(sock.getInputStream()));
+ dout = new DataOutputStream(new BufferedOutputStream(sock.getOutputStream()));
// Send header
dout.writeInt(PROTOCOL_HEADER);
dout.writeShort(PROTOCOL_VERSION);
dout.writeByte(protocol);
- dout.flush();
-
+ dout.flush();
+
if (protocol != SINGLE_OP_PROTOCOL) {
// Get back ack.
int ack = din.readUnsignedByte();
@@ -117,6 +126,7 @@ void makeConnection(int protocol) throws IOException {
// Send them my endpoint
dout.writeUTF(manager.serverName);
dout.writeInt(manager.serverPort);
+ dout.flush();
}
// Okay, ready to roll ...
}
@@ -131,7 +141,7 @@ DataOutputStream getDataOutputStream() throws IOException {
ObjectInputStream getObjectInputStream() throws IOException {
if (oin == null) {
- oin = new RMIObjectInputStream(din, manager);
+ oin = new RMIObjectInputStream(din);
}
return (oin);
}
@@ -144,29 +154,50 @@ ObjectOutputStream getObjectOutputStream() throws IOException {
}
void disconnect() {
- oin = null;
- oout = null;
try {
- sock.close();
+ if(oout != null)
+ oout.close();
+ sock.close();
}
catch (IOException _) {
- }
+ }
+
+ oin = null;
+ oout = null;
din = null;
dout = null;
sock = null;
}
+public static final long CONNECTION_TIMEOUT = 10000L;
+
+static boolean isExpired(UnicastConnection conn, long l){
+ if (l <= conn.expireTime )
+ return false;
+ return true;
+}
+
+static void resetTime(UnicastConnection conn){
+ long l = System.currentTimeMillis();
+ conn.reviveTime = l;
+ conn.expireTime = l + CONNECTION_TIMEOUT;
+}
+
/**
* We run connects on the server. Dispatch it then discard it.
*/
public void run() {
+ do{
try {
UnicastServer.dispatch(this);
+ //don't discardConnection explicitly, only when
+ // exception happens or the connection's expireTime
+ // comes
+ } catch (Exception e ){
manager.discardConnection(this);
+ break;
}
- catch (Exception e) {
- e.printStackTrace();
- }
+ }while(true);
}
}
diff --git a/libjava/gnu/java/rmi/server/UnicastConnectionManager.java b/libjava/gnu/java/rmi/server/UnicastConnectionManager.java
index fe08ad0814d..d54dcf1d4cd 100644
--- a/libjava/gnu/java/rmi/server/UnicastConnectionManager.java
+++ b/libjava/gnu/java/rmi/server/UnicastConnectionManager.java
@@ -1,5 +1,5 @@
/*
- Copyright (c) 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
+ Copyright (c) 1996, 1997, 1998, 1999, 2002 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -41,48 +41,135 @@ import java.rmi.server.RMISocketFactory;
import java.rmi.server.RMIServerSocketFactory;
import java.rmi.server.RMIClientSocketFactory;
import java.rmi.RemoteException;
-import gnu.java.rmi.server.UnicastConnection;
-import java.util.Hashtable;
-import java.net.Socket;
-import java.net.ServerSocket;
import java.io.IOException;
import java.io.ObjectOutput;
import java.io.ObjectInput;
+import java.io.DataInputStream;
import java.lang.Thread;
import java.lang.Runnable;
import java.net.InetAddress;
+import java.net.Socket;
+import java.net.ServerSocket;
import java.net.UnknownHostException;
+import java.util.ArrayList;
+import java.util.ConcurrentModificationException;
+import java.util.Enumeration;
+import java.util.Hashtable;
+import java.util.Iterator;
+
+import gnu.java.rmi.server.UnicastConnection;
+
public class UnicastConnectionManager
implements Runnable, ProtocolConstants {
private static String localhost;
+// use different maps for server/client type UnicastConnectionManager
private static Hashtable servers = new Hashtable();
+private static Hashtable clients = new Hashtable();
+private ArrayList connections; //client connection pool
-private Thread serverThread;
+// make serverThread volatile for poll
+private volatile Thread serverThread;
private ServerSocket ssock;
String serverName;
int serverPort;
+
+static private Thread scavenger;
+
+// If client and server are in the same VM, serverobj represents server
+Object serverobj;
+
+private static RMISocketFactory defaultSocketFactory = RMISocketFactory.getSocketFactory();
private RMIServerSocketFactory serverFactory;
private RMIClientSocketFactory clientFactory;
+// The following is for debug
+private static int ncsock = 0; //count of client socket
+private static int nssock = 0; //count of server socket
+private static int ncmanager = 0; //count of client manager
+private static int nsmanager = 0; //count of server manager
+
+private static final boolean debug = false;
+
+private static final Object GLOBAL_LOCK = new Object();
+
static {
try {
- localhost = InetAddress.getLocalHost().getHostName();
+ //Use host address instead of host name to avoid name resolving issues
+ //localhost = InetAddress.getLocalHost().getHostName();
+ localhost = InetAddress.getLocalHost().getHostAddress();
}
catch (UnknownHostException _) {
localhost = "localhost";
}
+
+
+}
+
+//Only one scavenger thread running globally
+private static void startScavenger(){
+ scavenger = new Thread(new Runnable(){
+ public void run(){
+ if (debug) System.out.println("************* start scavenger.");
+ boolean liveon = true;
+ while (liveon){
+ // Sleep for the expire timeout
+ try{
+ Thread.sleep(UnicastConnection.CONNECTION_TIMEOUT);
+ }catch(InterruptedException _ie){
+ break;
+ }
+ liveon = false;
+ // Scavenge all clients' connections that're expired
+ Iterator iter = clients.values().iterator();
+ long l = System.currentTimeMillis();
+ try{
+ while(iter.hasNext()){
+ UnicastConnectionManager man = (UnicastConnectionManager)iter.next();
+ ArrayList conns = man.connections;
+ synchronized(conns) { // is the lock a little coarser?
+ for (int last = conns.size() - 1;
+ last >= 0;
+ --last)
+ {
+ UnicastConnection conn = (UnicastConnection)conns.get(last);
+ if (UnicastConnection.isExpired(conn, l)){
+ conns.remove(last);
+ conn.disconnect();
+ conn = null;
+ }else
+ liveon = true; //there're still live connections
+ }
+ }
+ }
+ }catch(ConcurrentModificationException cme) {
+ // handle it lazily
+ liveon = true;
+ }
+ }
+ scavenger = null;
+ if (debug) System.out.println("************* exit scavenger.");
+ }
+ });
+ scavenger.start();
}
+/**
+ * Client UnicastConnectionManager constructor
+ */
private UnicastConnectionManager(String host, int port, RMIClientSocketFactory csf) {
ssock = null;
serverName = host;
serverPort = port;
serverFactory = null;
clientFactory = csf;
+ connections = new ArrayList();
}
+/**
+ * Server UnicastConnectionManager constructor
+ */
private UnicastConnectionManager(int port, RMIServerSocketFactory ssf) {
try {
ssock = ssf.createServerSocket(port);
@@ -110,13 +197,28 @@ private UnicastConnectionManager(int port, RMIServerSocketFactory ssf) {
public static synchronized UnicastConnectionManager getInstance(String host, int port, RMIClientSocketFactory csf) {
//System.out.println("getInstance: " + host + "," + port + "," + csf);
if (csf == null) {
- csf = RMISocketFactory.getSocketFactory();
+ csf = defaultSocketFactory;
}
+ // change host name to host address to avoid name resolving issues
+ try{
+ host = InetAddress.getByName(host).getHostAddress();
+ }catch(Exception _){}
+
TripleKey key = new TripleKey(host, port, csf);
- UnicastConnectionManager man = (UnicastConnectionManager)servers.get(key);
+ UnicastConnectionManager man = (UnicastConnectionManager)clients.get(key);
if (man == null) {
man = new UnicastConnectionManager(host, port, csf);
- servers.put(key, man);
+ if (debug) {
+ ncmanager++;
+ System.out.println("\n\n ====== " + ncmanager + " client managers.\n\n");
+ }
+ clients.put(key, man);
+
+ // Detect if client and server are in the same VM, i.e., their keys are equal
+ UnicastConnectionManager svrman = (UnicastConnectionManager)servers.get(key);
+ if(svrman != null){ // server and client are in the same VM
+ man.serverobj = svrman.serverobj;
+ }
}
return (man);
}
@@ -128,12 +230,16 @@ public static synchronized UnicastConnectionManager getInstance(String host, int
public static synchronized UnicastConnectionManager getInstance(int port, RMIServerSocketFactory ssf) {
//System.out.println("getInstance: " + port + "," + ssf);
if (ssf == null) {
- ssf = RMISocketFactory.getSocketFactory();
+ ssf = defaultSocketFactory;
}
TripleKey key = new TripleKey(localhost, port, ssf);
UnicastConnectionManager man = (UnicastConnectionManager)servers.get(key);
if (man == null) {
man = new UnicastConnectionManager(port, ssf);
+ if (debug) {
+ nsmanager++;
+ System.out.println("\n\n ****** " + nsmanager + " server managers.\n\n");
+ }
// The provided port might not be the set port.
key.port = man.serverPort;
servers.put(key, man);
@@ -158,9 +264,14 @@ public UnicastConnection getConnection() throws IOException {
*/
private UnicastConnection getServerConnection() throws IOException {
Socket sock = ssock.accept();
+ sock.setTcpNoDelay(true); //??
UnicastConnection conn = new UnicastConnection(this, sock);
conn.acceptConnection();
-//System.out.println("Server connection " + conn);
+ if (debug){
+ nssock++;
+ System.out.println("\n\n ****** " + nssock + " server socks.\n\n");
+ }
+ //System.out.println("Server connection " + sock);
return (conn);
}
@@ -168,10 +279,38 @@ private UnicastConnection getServerConnection() throws IOException {
* Make a conection from this client to the server.
*/
private UnicastConnection getClientConnection() throws IOException {
+ ArrayList conns = connections;
+ UnicastConnection conn;
+
+ synchronized(conns) {
+ int nconn = conns.size() - 1;
+
+ // if there're free connections in connection pool
+ if(nconn >= 0) {
+ conn = (UnicastConnection)conns.get(nconn);
+ //Should we check if conn is alive using Ping??
+ conns.remove(nconn);
+
+ // Check if the connection is already expired
+ long l = System.currentTimeMillis();
+ if (!UnicastConnection.isExpired(conn, l)){
+ return conn;
+ }else {
+ conn.disconnect();
+ conn = null;
+ }
+ }
+ }
+
Socket sock = clientFactory.createSocket(serverName, serverPort);
- UnicastConnection conn = new UnicastConnection(this, sock);
+ conn = new UnicastConnection(this, sock);
conn.makeConnection(DEFAULT_PROTOCOL);
-//System.out.println("Client connection " + conn);
+
+ if (debug) {
+ ncsock++;
+ System.out.println("\n\n ====== " + ncsock + " client socks.\n\n");
+ }
+
return (conn);
}
@@ -181,7 +320,19 @@ private UnicastConnection getClientConnection() throws IOException {
*/
public void discardConnection(UnicastConnection conn) {
//System.out.println("Discarding connection " + conn);
+ //conn.disconnect();
+ if (ssock != null) //server connection
conn.disconnect();
+ else {
+ // To client connection, we'd like to return back to pool
+ UnicastConnection.resetTime(conn);
+ //Ensure there're only one scavenger globally
+ synchronized(GLOBAL_LOCK) {
+ connections.add(conn); //borrow this lock to garantee thread safety
+ if (scavenger == null)
+ startScavenger();
+ }
+ }
}
/**
@@ -194,22 +345,40 @@ public void startServer() {
return;
}
serverThread = new Thread(this);
+ // The following is not necessary when java.lang.Thread's constructor do this.
+ // serverThread.setContextClassLoader(Thread.currentThread().getContextClassLoader());
}
serverThread.start();
}
/**
+ * Stop a server on this manager
+ */
+public void stopServer() {
+ synchronized(this) {
+ if(serverThread != null){
+ serverThread = null;
+ try{
+ ssock.close();
+ }catch(Exception _){}
+ }
+ }
+}
+
+/**
* Server thread for connection manager.
*/
public void run() {
- for (;;) {
+ for (;serverThread != null;) { // if serverThread==null, then exit thread
try {
//System.out.println("Waiting for connection on " + serverPort);
UnicastConnection conn = getServerConnection();
- (new Thread(conn)).start();
+ // use a thread pool to improve performance
+ //ConnectionRunnerPool.dispatchConnection(conn);
+ (new Thread(conn)).start();
}
catch (Exception e) {
- e.printStackTrace();
+ e.printStackTrace();
}
}
}
@@ -228,8 +397,9 @@ void write(ObjectOutput out) throws IOException {
static UnicastConnectionManager read(ObjectInput in) throws IOException {
String host = in.readUTF();
int port = in.readInt();
- RMIClientSocketFactory csf = ((RMIObjectInputStream)in).manager.clientFactory;
- return (getInstance(host, port, csf));
+ //RMIClientSocketFactory csf = ((RMIObjectInputStream)in).manager.clientFactory;
+ //return (getInstance(host, port, csf));
+ return (getInstance(host, port, null));
}
}
@@ -262,7 +432,7 @@ public boolean equals(Object obj) {
TripleKey other = (TripleKey)obj;
if (this.host.equals(other.host) &&
this.other == other.other &&
- (this.port == other.port || this.port == 0 || other.port == 0)) {
+ (this.port == other.port /* || this.port == 0 || other.port == 0*/)) {
return (true);
}
}
diff --git a/libjava/gnu/java/rmi/server/UnicastRef.java b/libjava/gnu/java/rmi/server/UnicastRef.java
index 1c5bf577ed9..9ab020db6c3 100644
--- a/libjava/gnu/java/rmi/server/UnicastRef.java
+++ b/libjava/gnu/java/rmi/server/UnicastRef.java
@@ -1,5 +1,5 @@
/*
- Copyright (c) 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
+ Copyright (c) 1996, 1997, 1998, 1999, 2002 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -62,6 +62,8 @@ import java.io.ObjectOutputStream;
import java.io.DataInputStream;
import java.io.DataOutputStream;
+import java.lang.reflect.InvocationTargetException;
+
public class UnicastRef
implements RemoteRef, ProtocolConstants {
@@ -69,9 +71,10 @@ public ObjID objid;
UnicastConnectionManager manager;
/**
- * Used by serialization.
+ * Used by serialization, and let subclass capable of having default constructor
*/
-private UnicastRef() {
+//private
+UnicastRef() {
}
public UnicastRef(ObjID objid, String host, int port, RMIClientSocketFactory csf) {
@@ -84,6 +87,21 @@ public UnicastRef(ObjID objid) {
}
public Object invoke(Remote obj, Method method, Object[] params, long opnum) throws Exception {
+ // Check if client and server are in the same VM, then local call can be used to
+ // replace remote call, but it's somewhat violating remote semantic.
+ Object svrobj = manager.serverobj;
+ if(svrobj != null){
+ //local call
+ Object ret = null;
+ try{
+ ret = method.invoke(svrobj, params);
+ }catch(InvocationTargetException e){
+ throw (Exception)e.getTargetException();
+ }
+ //System.out.println("\n\n ***** local call: " + method + "\nreturn: " + ret + "\n\n");
+ return ret;
+ }
+ //System.out.println("***************** remote call:" + manager.serverPort);
return (invokeCommon(obj, method, params, -1, opnum));
}
@@ -107,16 +125,11 @@ private Object invokeCommon(Remote obj, Method method, Object[] params, int opnu
objid.write(out);
out.writeInt(opnum);
out.writeLong(hash);
- if (params != null) {
- for (int i = 0; i < params.length; i++) {
- if (params[i] instanceof UnicastRemoteObject) {
- out.writeObject(UnicastRemoteObject.exportObject((UnicastRemoteObject)params[i]));
- }
- else {
- out.writeObject(params[i]);
- }
- }
- }
+
+ // must handle primitive class and their wrapper classes
+ Class clss[] = method.getParameterTypes();
+ for(int i = 0; i < clss.length; i++)
+ ((RMIObjectOutputStream)out).writeValue(params[i], clss[i]);
out.flush();
}
@@ -131,23 +144,40 @@ private Object invokeCommon(Remote obj, Method method, Object[] params, int opnu
UID ack;
try {
din = conn.getDataInputStream();
- if (din.readUnsignedByte() != MESSAGE_CALL_ACK) {
- throw new RemoteException("Call not acked");
+
+ if ((returncode = din.readUnsignedByte()) != MESSAGE_CALL_ACK) {
+ conn.disconnect();
+ throw new RemoteException("Call not acked:" + returncode);
}
in = conn.getObjectInputStream();
-
returncode = in.readUnsignedByte();
ack = UID.read(in);
- returnval = in.readObject();
+
+ Class cls = method.getReturnType();
+ if(cls == Void.TYPE){
+ returnval = null;
+ in.readObject();
+ }else
+ returnval = ((RMIObjectInputStream)in).readValue(cls);
+
}
catch (IOException e3) {
+ //for debug: e3.printStackTrace();
throw new RemoteException("call return failed: ", e3);
}
+ /* if DGCAck is necessary??
+ //According to RMI wire protocol, send a DGCAck
+ // to indicate receiving return value
+ dout.writeByte(MESSAGE_DGCACK);
+ ack.write(dout);
+ out.flush();
+ */
+
manager.discardConnection(conn);
- if (returncode != RETURN_ACK) {
+ if (returncode != RETURN_ACK && returnval != null) {
throw (Exception)returnval;
}
@@ -158,7 +188,18 @@ private Object invokeCommon(Remote obj, Method method, Object[] params, int opnu
* @deprecated
*/
public RemoteCall newCall(RemoteObject obj, Operation[] op, int opnum, long hash) throws RemoteException {
- return (new UnicastRemoteCall(obj, opnum, hash));
+ UnicastConnection conn;
+
+ try {
+ conn = manager.getConnection();
+ }
+ catch (IOException e1) {
+ throw new RemoteException("connection failed to host: " + manager.serverName, e1);
+ }
+
+ //obj: useless?
+
+ return (new UnicastRemoteCall(conn, objid, opnum, hash));
}
/**
@@ -166,15 +207,19 @@ public RemoteCall newCall(RemoteObject obj, Operation[] op, int opnum, long hash
*/
public void invoke(RemoteCall call) throws Exception {
UnicastRemoteCall c = (UnicastRemoteCall)call;
- Object ret = invokeCommon((Remote)c.getObject(), (Method)null, c.getArguments(), c.getOpnum(), c.getHash());
- c.setReturnValue(ret);
+ call.executeCall();
}
/**
* @deprecated
*/
public void done(RemoteCall call) throws RemoteException {
- /* Does nothing */
+ UnicastRemoteCall c = (UnicastRemoteCall)call;
+ try{
+ c.done();
+ } catch(IOException e){}
+ UnicastConnection conn = c.getConnection();
+ manager.discardConnection(conn);
}
public void writeExternal(ObjectOutput out) throws IOException {
@@ -183,13 +228,16 @@ public void writeExternal(ObjectOutput out) throws IOException {
}
manager.write(out);
objid.write(out);
- out.writeByte(RETURN_ACK);
+ // This byte is somewhat confusing when interoperating with JDK
+ out.writeByte(0); //RETURN_ACK);
}
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
manager = UnicastConnectionManager.read(in);
objid = ObjID.read(in);
- if (in.readByte() != RETURN_ACK) {
+ byte ack = in.readByte();
+ // This byte is somewhat confusing when interoperating with JDK
+ if (ack != RETURN_ACK && ack != 0/*jdk ack value*/) {
throw new IOException("no ack found");
}
}
diff --git a/libjava/gnu/java/rmi/server/UnicastRemoteCall.java b/libjava/gnu/java/rmi/server/UnicastRemoteCall.java
index 200538d4ae8..734002aaa65 100644
--- a/libjava/gnu/java/rmi/server/UnicastRemoteCall.java
+++ b/libjava/gnu/java/rmi/server/UnicastRemoteCall.java
@@ -38,14 +38,24 @@ exception statement from your version. */
package gnu.java.rmi.server;
import java.lang.Exception;
+import java.io.DataInputStream;
+import java.io.DataOutputStream;
import java.io.IOException;
import java.io.ObjectOutput;
import java.io.ObjectInput;
import java.io.StreamCorruptedException;
import java.rmi.server.RemoteCall;
+import java.rmi.RemoteException;
+import java.rmi.MarshalException;
+import java.rmi.UnmarshalException;
+import java.rmi.server.UID;
+import java.rmi.server.ObjID;
+import java.rmi.server.RemoteObject;
+
import java.util.Vector;
-public class UnicastRemoteCall implements RemoteCall
+public class UnicastRemoteCall
+ implements RemoteCall, ProtocolConstants
{
private UnicastConnection conn;
@@ -56,6 +66,9 @@ public class UnicastRemoteCall implements RemoteCall
private Vector vec;
private int ptr;
+ private ObjectOutput oout;
+ private ObjectInput oin;
+
/**
* Incoming call.
*/
@@ -67,30 +80,71 @@ public class UnicastRemoteCall implements RemoteCall
/**
* Outgoing call.
*/
- UnicastRemoteCall(Object obj, int opnum, long hash)
+ UnicastRemoteCall(UnicastConnection conn, ObjID objid, int opnum, long hash)
+ throws RemoteException
{
- this.object = obj;
+ this.conn = conn;
this.opnum = opnum;
this.hash = hash;
+
+ // signal the call when constructing
+ try
+ {
+ DataOutputStream dout = conn.getDataOutputStream();
+ dout.write(MESSAGE_CALL);
+
+ oout = conn.getObjectOutputStream();
+ objid.write(oout);
+ oout.writeInt(opnum);
+ oout.writeLong(hash);
+ }
+ catch(IOException ex)
+ {
+ throw new MarshalException("Try to write header but failed.", ex);
+ }
}
-
+
+ UnicastConnection getConnection()
+ {
+ return conn;
+ }
+
public ObjectOutput getOutputStream() throws IOException
{
- vec = new Vector();
- return new DummyObjectOutputStream();
+ if (conn != null)
+ {
+ if(oout == null)
+ return (oout = conn.getObjectOutputStream());
+ else
+ return oout;
+ }
+ else
+ {
+ vec = new Vector();
+ return (new DummyObjectOutputStream());
+ }
}
public void releaseOutputStream() throws IOException
{
- // Does nothing.
+ if(oout != null)
+ oout.flush();
}
public ObjectInput getInputStream() throws IOException
{
if (conn != null)
- return conn.getObjectInputStream();
- ptr = 0;
- return new DummyObjectInputStream();
+ {
+ if(oin == null)
+ return (oin = conn.getObjectInputStream());
+ else
+ return oin;
+ }
+ else
+ {
+ ptr = 0;
+ return (new DummyObjectInputStream());
+ }
}
public void releaseInputStream() throws IOException
@@ -104,15 +158,57 @@ public class UnicastRemoteCall implements RemoteCall
vec = new Vector();
return new DummyObjectOutputStream();
}
-
+
public void executeCall() throws Exception
{
- throw new Error("Not implemented");
+ byte returncode;
+ ObjectInput oin;
+ try
+ {
+ releaseOutputStream();
+ DataInputStream din = conn.getDataInputStream();
+ if (din.readByte() != MESSAGE_CALL_ACK)
+ throw new RemoteException("Call not acked");
+
+ oin = getInputStream();
+ returncode = oin.readByte();
+ UID.read(oin);
+ }
+ catch(IOException ex)
+ {
+ throw new UnmarshalException("Try to read header but failed:", ex);
+ }
+
+ //check return code
+ switch(returncode)
+ {
+ case RETURN_ACK: //it's ok
+ return;
+ case RETURN_NACK:
+ Object returnobj;
+ try
+ {
+ returnobj = oin.readObject();
+ }
+ catch(Exception ex2)
+ {
+ throw new UnmarshalException
+ ("Try to read exception object but failed", ex2);
+ }
+
+ if(!(returnobj instanceof Exception))
+ throw new UnmarshalException("Should be Exception type here: "
+ + returnobj);
+ throw (Exception)returnobj;
+
+ default:
+ throw new UnmarshalException("Invalid return code");
+ }
}
public void done() throws IOException
{
- /* Does nothing */
+ // conn.disconnect();
}
Object returnValue()
diff --git a/libjava/gnu/java/rmi/server/UnicastServer.java b/libjava/gnu/java/rmi/server/UnicastServer.java
index d9f5fb71527..baa1ef1aa4a 100644
--- a/libjava/gnu/java/rmi/server/UnicastServer.java
+++ b/libjava/gnu/java/rmi/server/UnicastServer.java
@@ -1,5 +1,5 @@
/*
- Copyright (c) 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
+ Copyright (c) 1996, 1997, 1998, 1999, 2002 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -45,6 +45,7 @@ import java.io.IOException;
import java.net.InetAddress;
import java.util.Hashtable;
import java.net.UnknownHostException;
+import java.rmi.Remote;
import java.rmi.server.ObjID;
import java.rmi.server.UnicastRemoteObject;
import java.rmi.server.UID;
@@ -56,20 +57,36 @@ import gnu.java.rmi.dgc.DGCImpl;
public class UnicastServer
implements ProtocolConstants {
-static private Hashtable objects = new Hashtable();
+static private Hashtable objects = new Hashtable(); //mapping OBJID to server ref
+static private Hashtable refcache = new Hashtable(); //mapping obj itself to server ref
static private DGCImpl dgc;
public static void exportObject(UnicastServerRef obj) {
startDGC();
objects.put(obj.objid, obj);
+ refcache.put(obj.myself, obj);
obj.manager.startServer();
}
+// FIX ME: I haven't handle force parameter
+public static boolean unexportObject(UnicastServerRef obj, boolean force) {
+ objects.remove(obj.objid);
+ refcache.remove(obj.myself);
+ obj.manager.stopServer();
+ return true;
+}
+
+public static UnicastServerRef getExportedRef(Remote remote){
+ return (UnicastServerRef)refcache.get(remote);
+}
+
private static synchronized void startDGC() {
if (dgc == null) {
try {
dgc = new DGCImpl();
- ((UnicastServerRef)dgc.getRef()).exportObject(dgc);
+ // Changed DGCImpl to inherit UnicastServerRef directly
+ //((UnicastServerRef)dgc.getRef()).exportObject(dgc);
+ dgc.exportObject(dgc);
}
catch (RemoteException e) {
e.printStackTrace();
@@ -100,10 +117,14 @@ private static void incomingMessageCall(UnicastConnection conn) throws IOExcepti
UnicastServerRef uref = (UnicastServerRef)objects.get(objid);
Object returnval;
int returncode = RETURN_ACK;
+ // returnval is from Method.invoke(), so we must check the return class to see
+ // if it's primitive type
+ Class returncls = null;
if (uref != null) {
try {
// Dispatch the call to it.
returnval = uref.incomingMessageCall(conn, method, hash);
+ returncls = uref.getMethodReturnType(method, hash);
}
catch (Exception e) {
returnval = e;
@@ -121,7 +142,10 @@ private static void incomingMessageCall(UnicastConnection conn) throws IOExcepti
out.writeByte(returncode);
(new UID()).write(out);
- out.writeObject(returnval);
+ if(returnval != null && returncls != null)
+ ((RMIObjectOutputStream)out).writeValue(returnval, returncls);
+ else
+ out.writeObject(returnval);
out.flush();
}
diff --git a/libjava/gnu/java/rmi/server/UnicastServerRef.java b/libjava/gnu/java/rmi/server/UnicastServerRef.java
index b145089e600..4f64452b124 100644
--- a/libjava/gnu/java/rmi/server/UnicastServerRef.java
+++ b/libjava/gnu/java/rmi/server/UnicastServerRef.java
@@ -1,5 +1,5 @@
/*
- Copyright (c) 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
+ Copyright (c) 1996, 1997, 1998, 1999, 2002 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -63,17 +63,27 @@ import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
import java.util.Hashtable;
public class UnicastServerRef
- extends UnicastRef {
+ extends UnicastRef
+ implements ServerRef{ //SHOULD implement ServerRef
final static private Class[] stubprototype = new Class[] { RemoteRef.class };
-Remote myself;
+Remote myself; //save the remote object itself
private Skeleton skel;
private RemoteStub stub;
-private Hashtable methods;
+private Hashtable methods = new Hashtable();
+
+/**
+ * Used by serialization.
+ */
+UnicastServerRef()
+{
+}
public UnicastServerRef(ObjID id, int port, RMIServerSocketFactory ssf) {
super(id);
@@ -83,6 +93,9 @@ public UnicastServerRef(ObjID id, int port, RMIServerSocketFactory ssf) {
public RemoteStub exportObject(Remote obj) throws RemoteException {
if (myself == null) {
myself = obj;
+ // Save it to server manager, to let client calls in the same VM to issue
+ // local call
+ manager.serverobj = obj;
// Find and install the stub
Class cls = obj.getClass();
@@ -95,7 +108,7 @@ public RemoteStub exportObject(Remote obj) throws RemoteException {
skel = (Skeleton)getHelperClass(cls, "_Skel");
// Build hash of methods which may be called.
- buildMethodHash(obj.getClass());
+ buildMethodHash(obj.getClass(), true);
// Export it.
UnicastServer.exportObject(this);
@@ -104,10 +117,29 @@ public RemoteStub exportObject(Remote obj) throws RemoteException {
return (stub);
}
+public RemoteStub exportObject(Remote remote, Object obj)
+ throws RemoteException
+{
+ //FIX ME
+ return exportObject(remote);
+}
+
+public RemoteStub getStub(){
+ return stub;
+}
+
+
+public boolean unexportObject(Remote obj, boolean force) throws RemoteException {
+ // Remove all hashes of methods which may be called.
+ buildMethodHash(obj.getClass(), false);
+ return UnicastServer.unexportObject(this, force);
+}
+
private Object getHelperClass(Class cls, String type) {
try {
- String classname = cls.getName();
- Class scls = Class.forName(classname + type);
+ String classname = cls.getName();
+ ClassLoader cl = cls.getClassLoader(); //DONT use "Class scls = Class.forName(classname + type);"
+ Class scls = cl.loadClass(classname + type);
if (type.equals("_Stub")) {
try {
// JDK 1.2 stubs
@@ -147,8 +179,7 @@ public String getClientHost() throws ServerNotActiveException {
throw new Error("Not implemented");
}
-private void buildMethodHash(Class cls) {
- methods = new Hashtable();
+private void buildMethodHash(Class cls, boolean build) {
Method[] meths = cls.getMethods();
for (int i = 0; i < meths.length; i++) {
/* Don't need to include any java.xxx related stuff */
@@ -156,11 +187,23 @@ private void buildMethodHash(Class cls) {
continue;
}
long hash = RMIHashes.getMethodHash(meths[i]);
- methods.put(new Long (hash), meths[i]);
+ if(build)
+ methods.put(new Long (hash), meths[i]);
+ else
+ methods.remove(new Long (hash));
//System.out.println("meth = " + meths[i] + ", hash = " + hash);
}
}
+Class getMethodReturnType(int method, long hash) throws Exception
+{
+ if (method == -1) {
+ Method meth = (Method)methods.get(new Long (hash));
+ return meth.getReturnType();
+ }else
+ return null;
+}
+
public Object incomingMessageCall(UnicastConnection conn, int method, long hash) throws Exception {
//System.out.println("method = " + method + ", hash = " + hash);
// If method is -1 then this is JDK 1.2 RMI - so use the hash
@@ -189,7 +232,15 @@ public Object incomingMessageCall(UnicastConnection conn, int method, long hash)
throw t;
}
}
- return (meth.invoke(myself, args));
+ //We must reinterpret the exception thrown by meth.invoke()
+ //return (meth.invoke(myself, args));
+ Object ret = null;
+ try{
+ ret = meth.invoke(myself, args);
+ }catch(InvocationTargetException e){
+ throw (Exception)(e.getTargetException());
+ }
+ return ret;
}
// Otherwise this is JDK 1.1 style RMI - we find the skeleton
// and invoke it using the method number. We wrap up our
diff --git a/libjava/gnu/java/security/provider/MD5.java b/libjava/gnu/java/security/provider/MD5.java
index 9a789dfa2e2..41956fc87e1 100644
--- a/libjava/gnu/java/security/provider/MD5.java
+++ b/libjava/gnu/java/security/provider/MD5.java
@@ -77,7 +77,7 @@ public class MD5 extends MessageDigest implements Cloneable
public int engineGetDigestLength()
{
- return 20;
+ return 16;
}
// Intialize the A,B,C,D needed for the hash
diff --git a/libjava/gnu/java/security/provider/SHA.java b/libjava/gnu/java/security/provider/SHA.java
index 90459466a89..6b8d3ba5c1e 100644
--- a/libjava/gnu/java/security/provider/SHA.java
+++ b/libjava/gnu/java/security/provider/SHA.java
@@ -1,5 +1,5 @@
/* SHA.java -- Class implementing the SHA-1 algorithm as specified in [1].
- Copyright (C) 1999, 2000 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2000, 2002 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -58,7 +58,7 @@ public class SHA extends MessageDigest implements Cloneable
public int engineGetDigestLength()
{
- return 16;
+ return 20;
}
public void engineUpdate (byte b)
diff --git a/libjava/include/.cvsignore b/libjava/include/.cvsignore
new file mode 100644
index 00000000000..4ce50a28902
--- /dev/null
+++ b/libjava/include/.cvsignore
@@ -0,0 +1 @@
+stamp-h1.in
diff --git a/libjava/include/config.h.in b/libjava/include/config.h.in
index 266d6e3032d..cd770f93ac6 100644
--- a/libjava/include/config.h.in
+++ b/libjava/include/config.h.in
@@ -1,4 +1,4 @@
-/* include/config.h.in. Generated automatically from configure.in by autoheader. */
+/* include/config.h.in. Generated automatically from configure.in by autoheader 2.13. */
/* Define if using alloca.c. */
#undef C_ALLOCA
@@ -132,6 +132,7 @@
#undef HAVE_READDIR_R
#undef HAVE_GETHOSTBYNAME_R
#undef HAVE_GETHOSTBYADDR_R
+#undef HAVE_FTRUNCATE
/* Define if you want a bytecode interpreter. */
#undef INTERPRETER
@@ -201,6 +202,9 @@
/* Define if you have the ftime function. */
#undef HAVE_FTIME
+/* Define if you have the ftruncate function. */
+#undef HAVE_FTRUNCATE
+
/* Define if you have the getcwd function. */
#undef HAVE_GETCWD
@@ -339,6 +343,9 @@
/* Define if you have the <locale.h> header file. */
#undef HAVE_LOCALE_H
+/* Define if you have the <net/if.h> header file. */
+#undef HAVE_NET_IF_H
+
/* Define if you have the <netdb.h> header file. */
#undef HAVE_NETDB_H
@@ -387,6 +394,9 @@
/* Define if the compiler is configured for setjmp/longjmp exceptions. */
#undef SJLJ_EXCEPTIONS
+/* Indicate that linker is not able to 8-byte align static data */
+#undef JV_LINKER_CANNOT_8BYTE_ALIGN_STATICS
+
/* Required define if using POSIX threads */
#undef _REENTRANT
diff --git a/libjava/include/java-interp.h b/libjava/include/java-interp.h
index de1d88f452e..e3f96713ce7 100644
--- a/libjava/include/java-interp.h
+++ b/libjava/include/java-interp.h
@@ -13,6 +13,7 @@ details. */
#include <jvm.h>
#include <java-cpool.h>
+#include <gnu/gcj/runtime/NameFinder.h>
#ifdef INTERPRETER
@@ -138,6 +139,7 @@ class _Jv_InterpMethod : public _Jv_MethodBase
friend class _Jv_ClassReader;
friend class _Jv_BytecodeVerifier;
+ friend class gnu::gcj::runtime::NameFinder;
friend void _Jv_PrepareClass(jclass);
};
@@ -205,6 +207,28 @@ public:
}
};
+// A structure of this type is used to link together interpreter
+// invocations on the stack.
+struct _Jv_MethodChain
+{
+ const _Jv_InterpMethod *self;
+ _Jv_MethodChain **ptr;
+ _Jv_MethodChain *next;
+
+ _Jv_MethodChain (const _Jv_InterpMethod *s, _Jv_MethodChain **n)
+ {
+ self = s;
+ ptr = n;
+ next = *n;
+ *n = this;
+ }
+
+ ~_Jv_MethodChain ()
+ {
+ *ptr = next;
+ }
+};
+
#endif /* INTERPRETER */
#endif /* __JAVA_INTERP_H__ */
diff --git a/libjava/include/jni.h b/libjava/include/jni.h
index b5ce334b895..0b98ab2c5c4 100644
--- a/libjava/include/jni.h
+++ b/libjava/include/jni.h
@@ -173,12 +173,27 @@ typedef void *jmethodID;
#define JNI_EDETACHED -2
#define JNI_EVERSION -3
-/* Linkage and calling conventions. This will need updating when we
- support Windows DLLs. */
+/* Linkage and calling conventions. */
+#if defined (_WIN32) || defined (__WIN32__) || defined (WIN32)
+
+#define JNIIMPORT __declspec(dllimport)
+#define JNIEXPORT __declspec(dllexport)
+#define JNICALL __stdcall
+
+#else
+
#define JNIIMPORT
#define JNIEXPORT
#define JNICALL
+#endif /* !( _WIN32 || __WIN32__ || WIN32) */
+
+#ifdef __GCJ_JNI_IMPL__
+#define JNIIMPEXP JNIEXPORT
+#else
+#define JNIIMPEXP JNIIMPORT
+#endif /* ! __GCJ_JNI_IMPL__ */
+
#ifdef __cplusplus
extern "C"
{
@@ -186,14 +201,14 @@ extern "C"
/* These functions might be defined in libraries which we load; the
JNI implementation calls them at the appropriate times. */
-extern jint JNI_OnLoad (JavaVM *, void *);
-extern void JNI_OnUnload (JavaVM *, void *);
+extern JNIEXPORT jint JNICALL JNI_OnLoad (JavaVM *, void *);
+extern JNIEXPORT void JNICALL JNI_OnUnload (JavaVM *, void *);
/* These functions are called by user code to start using the
invocation API. */
-extern jint JNI_GetDefaultJavaVMInitArgs (void *);
-extern jint JNI_CreateJavaVM (JavaVM **, void **, void *);
-extern jint JNI_GetCreatedJavaVMs(JavaVM **, jsize, jsize *);
+extern JNIIMPEXP jint JNICALL JNI_GetDefaultJavaVMInitArgs (void *);
+extern JNIIMPEXP jint JNICALL JNI_CreateJavaVM (JavaVM **, void **, void *);
+extern JNIIMPEXP jint JNICALL JNI_GetCreatedJavaVMs(JavaVM **, jsize, jsize *);
#ifdef __cplusplus
};
@@ -233,419 +248,418 @@ struct JNINativeInterface
_Jv_func reserved2;
_Jv_func reserved3;
- jint (*GetVersion) (JNIEnv *);
- jclass (*DefineClass) (JNIEnv *, jobject,
- const jbyte *, jsize);
- jclass (*FindClass) (JNIEnv *, const char *);
-
- jmethodID (*FromReflectedMethod) (JNIEnv *, jobject);
- jfieldID (*FromReflectedField) (JNIEnv *, jobject);
- jobject (*ToReflectedMethod) (JNIEnv *, jclass, jmethodID,
- jboolean);
-
- jclass (*GetSuperclass) (JNIEnv *, jclass);
- jboolean (*IsAssignableFrom) (JNIEnv *, jclass, jclass);
-
- jobject (*ToReflectedField) (JNIEnv *, jclass, jfieldID,
- jboolean);
-
- jint (*Throw) (JNIEnv *, jthrowable);
- jint (*ThrowNew) (JNIEnv *, jclass, const char *);
- jthrowable (*ExceptionOccurred) (JNIEnv *);
- void (*ExceptionDescribe) (JNIEnv *);
- void (*ExceptionClear) (JNIEnv *);
- void (*FatalError) (JNIEnv *, const char *);
-
- jint (*PushLocalFrame) (JNIEnv *, jint);
- jobject (*PopLocalFrame) (JNIEnv *, jobject);
-
- jobject (*NewGlobalRef) (JNIEnv *, jobject);
- void (*DeleteGlobalRef) (JNIEnv *, jobject);
- void (*DeleteLocalRef) (JNIEnv *, jobject);
- jboolean (*IsSameObject) (JNIEnv *, jobject, jobject);
-
- jobject (*NewLocalRef) (JNIEnv *, jobject);
- jint (*EnsureLocalCapacity) (JNIEnv *, jint);
-
- jobject (*AllocObject) (JNIEnv *, jclass);
- jobject (*NewObject) (JNIEnv *, jclass, jmethodID, ...);
- jobject (*NewObjectV) (JNIEnv *, jclass, jmethodID,
- _Jv_va_list);
- jobject (*NewObjectA) (JNIEnv *, jclass, jmethodID,
- jvalue *);
-
- jclass (*GetObjectClass) (JNIEnv *, jobject);
- jboolean (*IsInstanceOf) (JNIEnv *, jobject, jclass);
- jmethodID (*GetMethodID) (JNIEnv *, jclass, const char *,
- const char *);
-
- jobject (*CallObjectMethod) (JNIEnv *, jobject, jmethodID,
- ...);
- jobject (*CallObjectMethodV) (JNIEnv *, jobject, jmethodID,
- _Jv_va_list);
- jobject (*CallObjectMethodA) (JNIEnv *, jobject, jmethodID,
- jvalue *);
- jboolean (*CallBooleanMethod) (JNIEnv *, jobject, jmethodID,
- ...);
- jboolean (*CallBooleanMethodV) (JNIEnv *, jobject, jmethodID,
- _Jv_va_list);
- jboolean (*CallBooleanMethodA) (JNIEnv *, jobject, jmethodID,
- jvalue *);
- jbyte (*CallByteMethod) (JNIEnv *, jobject, jmethodID,
- ...);
- jbyte (*CallByteMethodV) (JNIEnv *, jobject, jmethodID,
- _Jv_va_list);
- jbyte (*CallByteMethodA) (JNIEnv *, jobject, jmethodID,
- jvalue *);
- jchar (*CallCharMethod) (JNIEnv *, jobject, jmethodID,
- ...);
- jchar (*CallCharMethodV) (JNIEnv *, jobject, jmethodID,
- _Jv_va_list);
- jchar (*CallCharMethodA) (JNIEnv *, jobject, jmethodID,
- jvalue *);
- jshort (*CallShortMethod) (JNIEnv *, jobject, jmethodID,
- ...);
- jshort (*CallShortMethodV) (JNIEnv *, jobject, jmethodID,
- _Jv_va_list);
- jshort (*CallShortMethodA) (JNIEnv *, jobject, jmethodID,
- jvalue *);
- jint (*CallIntMethod) (JNIEnv *, jobject, jmethodID,
- ...);
- jint (*CallIntMethodV) (JNIEnv *, jobject, jmethodID,
- _Jv_va_list);
- jint (*CallIntMethodA) (JNIEnv *, jobject, jmethodID,
- jvalue *);
- jlong (*CallLongMethod) (JNIEnv *, jobject, jmethodID,
- ...);
- jlong (*CallLongMethodV) (JNIEnv *, jobject, jmethodID,
- _Jv_va_list);
- jlong (*CallLongMethodA) (JNIEnv *, jobject, jmethodID,
- jvalue *);
- jfloat (*CallFloatMethod) (JNIEnv *, jobject, jmethodID,
- ...);
- jfloat (*CallFloatMethodV) (JNIEnv *, jobject, jmethodID,
- _Jv_va_list);
- jfloat (*CallFloatMethodA) (JNIEnv *, jobject, jmethodID,
- jvalue *);
- jdouble (*CallDoubleMethod) (JNIEnv *, jobject, jmethodID,
- ...);
- jdouble (*CallDoubleMethodV) (JNIEnv *, jobject, jmethodID,
- _Jv_va_list);
- jdouble (*CallDoubleMethodA) (JNIEnv *, jobject, jmethodID,
- jvalue *);
- void (*CallVoidMethod) (JNIEnv *, jobject, jmethodID,
- ...);
- void (*CallVoidMethodV) (JNIEnv *, jobject, jmethodID,
- _Jv_va_list);
- void (*CallVoidMethodA) (JNIEnv *, jobject, jmethodID,
- jvalue *);
-
- jobject (*CallNonvirtualObjectMethod) (JNIEnv *, jobject, jclass,
- jmethodID, ...);
- jobject (*CallNonvirtualObjectMethodV) (JNIEnv *, jobject, jclass,
- jmethodID, _Jv_va_list);
- jobject (*CallNonvirtualObjectMethodA) (JNIEnv *, jobject, jclass,
- jmethodID, jvalue *);
- jboolean (*CallNonvirtualBooleanMethod) (JNIEnv *, jobject, jclass,
- jmethodID, ...);
- jboolean (*CallNonvirtualBooleanMethodV) (JNIEnv *, jobject, jclass,
- jmethodID, _Jv_va_list);
- jboolean (*CallNonvirtualBooleanMethodA) (JNIEnv *, jobject, jclass,
- jmethodID, jvalue *);
- jbyte (*CallNonvirtualByteMethod) (JNIEnv *, jobject, jclass,
- jmethodID, ...);
- jbyte (*CallNonvirtualByteMethodV) (JNIEnv *, jobject, jclass,
- jmethodID, _Jv_va_list);
- jbyte (*CallNonvirtualByteMethodA) (JNIEnv *, jobject, jclass,
- jmethodID, jvalue *);
- jchar (*CallNonvirtualCharMethod) (JNIEnv *, jobject, jclass,
- jmethodID, ...);
- jchar (*CallNonvirtualCharMethodV) (JNIEnv *, jobject, jclass,
- jmethodID, _Jv_va_list);
- jchar (*CallNonvirtualCharMethodA) (JNIEnv *, jobject, jclass,
- jmethodID, jvalue *);
- jshort (*CallNonvirtualShortMethod) (JNIEnv *, jobject, jclass,
- jmethodID, ...);
- jshort (*CallNonvirtualShortMethodV) (JNIEnv *, jobject, jclass,
- jmethodID, _Jv_va_list);
- jshort (*CallNonvirtualShortMethodA) (JNIEnv *, jobject, jclass,
- jmethodID, jvalue *);
- jint (*CallNonvirtualIntMethod) (JNIEnv *, jobject, jclass,
- jmethodID, ...);
- jint (*CallNonvirtualIntMethodV) (JNIEnv *, jobject, jclass,
- jmethodID, _Jv_va_list);
- jint (*CallNonvirtualIntMethodA) (JNIEnv *, jobject, jclass,
- jmethodID, jvalue *);
- jlong (*CallNonvirtualLongMethod) (JNIEnv *, jobject, jclass,
- jmethodID, ...);
- jlong (*CallNonvirtualLongMethodV) (JNIEnv *, jobject, jclass,
- jmethodID, _Jv_va_list);
- jlong (*CallNonvirtualLongMethodA) (JNIEnv *, jobject, jclass,
- jmethodID, jvalue *);
- jfloat (*CallNonvirtualFloatMethod) (JNIEnv *, jobject, jclass,
- jmethodID, ...);
- jfloat (*CallNonvirtualFloatMethodV) (JNIEnv *, jobject, jclass,
- jmethodID, _Jv_va_list);
- jfloat (*CallNonvirtualFloatMethodA) (JNIEnv *, jobject, jclass,
- jmethodID, jvalue *);
- jdouble (*CallNonvirtualDoubleMethod) (JNIEnv *, jobject, jclass,
- jmethodID, ...);
- jdouble (*CallNonvirtualDoubleMethodV) (JNIEnv *, jobject, jclass,
- jmethodID, _Jv_va_list);
- jdouble (*CallNonvirtualDoubleMethodA) (JNIEnv *, jobject, jclass,
- jmethodID, jvalue *);
- void (*CallNonvirtualVoidMethod) (JNIEnv *, jobject, jclass,
- jmethodID, ...);
- void (*CallNonvirtualVoidMethodV) (JNIEnv *, jobject, jclass,
- jmethodID, _Jv_va_list);
- void (*CallNonvirtualVoidMethodA) (JNIEnv *, jobject, jclass,
- jmethodID, jvalue *);
-
- jfieldID (*GetFieldID) (JNIEnv *, jclass, const char *,
+ jint (JNICALL *GetVersion) (JNIEnv *);
+ jclass (JNICALL *DefineClass) (JNIEnv *, jobject,
+ const jbyte *, jsize);
+ jclass (JNICALL *FindClass) (JNIEnv *, const char *);
+
+ jmethodID (JNICALL *FromReflectedMethod) (JNIEnv *, jobject);
+ jfieldID (JNICALL *FromReflectedField) (JNIEnv *, jobject);
+ jobject (JNICALL *ToReflectedMethod) (JNIEnv *, jclass, jmethodID,
+ jboolean);
+
+ jclass (JNICALL *GetSuperclass) (JNIEnv *, jclass);
+ jboolean (JNICALL *IsAssignableFrom) (JNIEnv *, jclass, jclass);
+
+ jobject (JNICALL *ToReflectedField) (JNIEnv *, jclass, jfieldID,
+ jboolean);
+
+ jint (JNICALL *Throw) (JNIEnv *, jthrowable);
+ jint (JNICALL *ThrowNew) (JNIEnv *, jclass,
+ const char *);
+ jthrowable (JNICALL *ExceptionOccurred) (JNIEnv *);
+ void (JNICALL *ExceptionDescribe) (JNIEnv *);
+ void (JNICALL *ExceptionClear) (JNIEnv *);
+ void (JNICALL *FatalError) (JNIEnv *, const char *);
+
+ jint (JNICALL *PushLocalFrame) (JNIEnv *, jint);
+ jobject (JNICALL *PopLocalFrame) (JNIEnv *, jobject);
+
+ jobject (JNICALL *NewGlobalRef) (JNIEnv *, jobject);
+ void (JNICALL *DeleteGlobalRef) (JNIEnv *, jobject);
+ void (JNICALL *DeleteLocalRef) (JNIEnv *, jobject);
+ jboolean (JNICALL *IsSameObject) (JNIEnv *, jobject,
+ jobject);
+
+ jobject (JNICALL *NewLocalRef) (JNIEnv *, jobject);
+ jint (JNICALL *EnsureLocalCapacity) (JNIEnv *, jint);
+
+ jobject (JNICALL *AllocObject) (JNIEnv *, jclass);
+ jobject (JNICALL *NewObject) (JNIEnv *, jclass,
+ jmethodID, ...);
+ jobject (JNICALL *NewObjectV) (JNIEnv *, jclass,
+ jmethodID, _Jv_va_list);
+ jobject (JNICALL *NewObjectA) (JNIEnv *, jclass,
+ jmethodID, jvalue *);
+
+ jclass (JNICALL *GetObjectClass) (JNIEnv *, jobject);
+ jboolean (JNICALL *IsInstanceOf) (JNIEnv *, jobject, jclass);
+ jmethodID (JNICALL *GetMethodID) (JNIEnv *, jclass,
+ const char *, const char *);
+
+ jobject (JNICALL *CallObjectMethod) (JNIEnv *, jobject, jmethodID, ...);
+ jobject (JNICALL *CallObjectMethodV) (JNIEnv *, jobject, jmethodID,
+ _Jv_va_list);
+ jobject (JNICALL *CallObjectMethodA) (JNIEnv *, jobject, jmethodID,
+ jvalue *);
+ jboolean (JNICALL *CallBooleanMethod) (JNIEnv *, jobject, jmethodID,
+ ...);
+ jboolean (JNICALL *CallBooleanMethodV) (JNIEnv *, jobject, jmethodID,
+ _Jv_va_list);
+ jboolean (JNICALL *CallBooleanMethodA) (JNIEnv *, jobject, jmethodID,
+ jvalue *);
+ jbyte (JNICALL *CallByteMethod) (JNIEnv *, jobject, jmethodID, ...);
+ jbyte (JNICALL *CallByteMethodV) (JNIEnv *, jobject, jmethodID,
+ _Jv_va_list);
+ jbyte (JNICALL *CallByteMethodA) (JNIEnv *, jobject, jmethodID,
+ jvalue *);
+ jchar (JNICALL *CallCharMethod) (JNIEnv *, jobject, jmethodID, ...);
+ jchar (JNICALL *CallCharMethodV) (JNIEnv *, jobject, jmethodID,
+ _Jv_va_list);
+ jchar (JNICALL *CallCharMethodA) (JNIEnv *, jobject, jmethodID,
+ jvalue *);
+ jshort (JNICALL *CallShortMethod) (JNIEnv *, jobject, jmethodID, ...);
+ jshort (JNICALL *CallShortMethodV) (JNIEnv *, jobject, jmethodID,
+ _Jv_va_list);
+ jshort (JNICALL *CallShortMethodA) (JNIEnv *, jobject, jmethodID,
+ jvalue *);
+ jint (JNICALL *CallIntMethod) (JNIEnv *, jobject, jmethodID, ...);
+ jint (JNICALL *CallIntMethodV) (JNIEnv *, jobject, jmethodID,
+ _Jv_va_list);
+ jint (JNICALL *CallIntMethodA) (JNIEnv *, jobject, jmethodID,
+ jvalue *);
+ jlong (JNICALL *CallLongMethod) (JNIEnv *, jobject, jmethodID, ...);
+ jlong (JNICALL *CallLongMethodV) (JNIEnv *, jobject, jmethodID,
+ _Jv_va_list);
+ jlong (JNICALL *CallLongMethodA) (JNIEnv *, jobject, jmethodID,
+ jvalue *);
+ jfloat (JNICALL *CallFloatMethod) (JNIEnv *, jobject, jmethodID, ...);
+ jfloat (JNICALL *CallFloatMethodV) (JNIEnv *, jobject, jmethodID,
+ _Jv_va_list);
+ jfloat (JNICALL *CallFloatMethodA) (JNIEnv *, jobject, jmethodID,
+ jvalue *);
+ jdouble (JNICALL *CallDoubleMethod) (JNIEnv *, jobject, jmethodID, ...);
+ jdouble (JNICALL *CallDoubleMethodV) (JNIEnv *, jobject, jmethodID,
+ _Jv_va_list);
+ jdouble (JNICALL *CallDoubleMethodA) (JNIEnv *, jobject, jmethodID,
+ jvalue *);
+ void (JNICALL *CallVoidMethod) (JNIEnv *, jobject, jmethodID, ...);
+ void (JNICALL *CallVoidMethodV) (JNIEnv *, jobject, jmethodID,
+ _Jv_va_list);
+ void (JNICALL *CallVoidMethodA) (JNIEnv *, jobject, jmethodID,
+ jvalue *);
+
+ jobject (JNICALL *CallNonvirtualObjectMethod) (JNIEnv *, jobject, jclass,
+ jmethodID, ...);
+ jobject (JNICALL *CallNonvirtualObjectMethodV) (JNIEnv *, jobject, jclass,
+ jmethodID, _Jv_va_list);
+ jobject (JNICALL *CallNonvirtualObjectMethodA) (JNIEnv *, jobject, jclass,
+ jmethodID, jvalue *);
+ jboolean (JNICALL *CallNonvirtualBooleanMethod) (JNIEnv *, jobject, jclass,
+ jmethodID, ...);
+ jboolean (JNICALL *CallNonvirtualBooleanMethodV) (JNIEnv *, jobject, jclass,
+ jmethodID, _Jv_va_list);
+ jboolean (JNICALL *CallNonvirtualBooleanMethodA) (JNIEnv *, jobject, jclass,
+ jmethodID, jvalue *);
+ jbyte (JNICALL *CallNonvirtualByteMethod) (JNIEnv *, jobject, jclass,
+ jmethodID, ...);
+ jbyte (JNICALL *CallNonvirtualByteMethodV) (JNIEnv *, jobject, jclass,
+ jmethodID, _Jv_va_list);
+ jbyte (JNICALL *CallNonvirtualByteMethodA) (JNIEnv *, jobject, jclass,
+ jmethodID, jvalue *);
+ jchar (JNICALL *CallNonvirtualCharMethod) (JNIEnv *, jobject, jclass,
+ jmethodID, ...);
+ jchar (JNICALL *CallNonvirtualCharMethodV) (JNIEnv *, jobject, jclass,
+ jmethodID, _Jv_va_list);
+ jchar (JNICALL *CallNonvirtualCharMethodA) (JNIEnv *, jobject, jclass,
+ jmethodID, jvalue *);
+ jshort (JNICALL *CallNonvirtualShortMethod) (JNIEnv *, jobject, jclass,
+ jmethodID, ...);
+ jshort (JNICALL *CallNonvirtualShortMethodV) (JNIEnv *, jobject, jclass,
+ jmethodID, _Jv_va_list);
+ jshort (JNICALL *CallNonvirtualShortMethodA) (JNIEnv *, jobject, jclass,
+ jmethodID, jvalue *);
+ jint (JNICALL *CallNonvirtualIntMethod) (JNIEnv *, jobject, jclass,
+ jmethodID, ...);
+ jint (JNICALL *CallNonvirtualIntMethodV) (JNIEnv *, jobject, jclass,
+ jmethodID, _Jv_va_list);
+ jint (JNICALL *CallNonvirtualIntMethodA) (JNIEnv *, jobject, jclass,
+ jmethodID, jvalue *);
+ jlong (JNICALL *CallNonvirtualLongMethod) (JNIEnv *, jobject, jclass,
+ jmethodID, ...);
+ jlong (JNICALL *CallNonvirtualLongMethodV) (JNIEnv *, jobject, jclass,
+ jmethodID, _Jv_va_list);
+ jlong (JNICALL *CallNonvirtualLongMethodA) (JNIEnv *, jobject, jclass,
+ jmethodID, jvalue *);
+ jfloat (JNICALL *CallNonvirtualFloatMethod) (JNIEnv *, jobject, jclass,
+ jmethodID, ...);
+ jfloat (JNICALL *CallNonvirtualFloatMethodV) (JNIEnv *, jobject, jclass,
+ jmethodID, _Jv_va_list);
+ jfloat (JNICALL *CallNonvirtualFloatMethodA) (JNIEnv *, jobject, jclass,
+ jmethodID, jvalue *);
+ jdouble (JNICALL *CallNonvirtualDoubleMethod) (JNIEnv *, jobject, jclass,
+ jmethodID, ...);
+ jdouble (JNICALL *CallNonvirtualDoubleMethodV) (JNIEnv *, jobject, jclass,
+ jmethodID, _Jv_va_list);
+ jdouble (JNICALL *CallNonvirtualDoubleMethodA) (JNIEnv *, jobject, jclass,
+ jmethodID, jvalue *);
+ void (JNICALL *CallNonvirtualVoidMethod) (JNIEnv *, jobject, jclass,
+ jmethodID, ...);
+ void (JNICALL *CallNonvirtualVoidMethodV) (JNIEnv *, jobject, jclass,
+ jmethodID, _Jv_va_list);
+ void (JNICALL *CallNonvirtualVoidMethodA) (JNIEnv *, jobject, jclass,
+ jmethodID, jvalue *);
+
+ jfieldID (JNICALL *GetFieldID) (JNIEnv *, jclass, const char *,
const char *);
- jobject (*GetObjectField) (JNIEnv *, jobject, jfieldID);
- jboolean (*GetBooleanField) (JNIEnv *, jobject, jfieldID);
- jbyte (*GetByteField) (JNIEnv *, jobject, jfieldID);
- jchar (*GetCharField) (JNIEnv *, jobject, jfieldID);
- jshort (*GetShortField) (JNIEnv *, jobject, jfieldID);
- jint (*GetIntField) (JNIEnv *, jobject, jfieldID);
- jlong (*GetLongField) (JNIEnv *, jobject, jfieldID);
- jfloat (*GetFloatField) (JNIEnv *, jobject, jfieldID);
- jdouble (*GetDoubleField) (JNIEnv *, jobject, jfieldID);
-
- void (*SetObjectField) (JNIEnv *, jobject,
+ jobject (JNICALL *GetObjectField) (JNIEnv *, jobject, jfieldID);
+ jboolean (JNICALL *GetBooleanField) (JNIEnv *, jobject, jfieldID);
+ jbyte (JNICALL *GetByteField) (JNIEnv *, jobject, jfieldID);
+ jchar (JNICALL *GetCharField) (JNIEnv *, jobject, jfieldID);
+ jshort (JNICALL *GetShortField) (JNIEnv *, jobject, jfieldID);
+ jint (JNICALL *GetIntField) (JNIEnv *, jobject, jfieldID);
+ jlong (JNICALL *GetLongField) (JNIEnv *, jobject, jfieldID);
+ jfloat (JNICALL *GetFloatField) (JNIEnv *, jobject, jfieldID);
+ jdouble (JNICALL *GetDoubleField) (JNIEnv *, jobject, jfieldID);
+
+ void (JNICALL *SetObjectField) (JNIEnv *, jobject,
jfieldID, jobject);
- void (*SetBooleanField) (JNIEnv *, jobject,
+ void (JNICALL *SetBooleanField) (JNIEnv *, jobject,
jfieldID, jboolean);
- void (*SetByteField) (JNIEnv *, jobject,
+ void (JNICALL *SetByteField) (JNIEnv *, jobject,
jfieldID, jbyte);
- void (*SetCharField) (JNIEnv *, jobject,
+ void (JNICALL *SetCharField) (JNIEnv *, jobject,
jfieldID, jchar);
- void (*SetShortField) (JNIEnv *, jobject,
+ void (JNICALL *SetShortField) (JNIEnv *, jobject,
jfieldID, jshort);
- void (*SetIntField) (JNIEnv *, jobject,
+ void (JNICALL *SetIntField) (JNIEnv *, jobject,
jfieldID, jint);
- void (*SetLongField) (JNIEnv *, jobject,
+ void (JNICALL *SetLongField) (JNIEnv *, jobject,
jfieldID, jlong);
- void (*SetFloatField) (JNIEnv *, jobject,
+ void (JNICALL *SetFloatField) (JNIEnv *, jobject,
jfieldID, jfloat);
- void (*SetDoubleField) (JNIEnv *, jobject,
+ void (JNICALL *SetDoubleField) (JNIEnv *, jobject,
jfieldID, jdouble);
- jmethodID (*GetStaticMethodID) (JNIEnv *, jclass, const char *,
- const char *);
-
- jobject (*CallStaticObjectMethod) (JNIEnv *, jclass, jmethodID,
- ...);
- jobject (*CallStaticObjectMethodV) (JNIEnv *, jclass, jmethodID,
- _Jv_va_list);
- jobject (*CallStaticObjectMethodA) (JNIEnv *, jclass, jmethodID,
- jvalue *);
- jboolean (*CallStaticBooleanMethod) (JNIEnv *, jclass, jmethodID,
- ...);
- jboolean (*CallStaticBooleanMethodV) (JNIEnv *, jclass, jmethodID,
- _Jv_va_list);
- jboolean (*CallStaticBooleanMethodA) (JNIEnv *, jclass, jmethodID,
- jvalue *);
- jbyte (*CallStaticByteMethod) (JNIEnv *, jclass, jmethodID,
- ...);
- jbyte (*CallStaticByteMethodV) (JNIEnv *, jclass, jmethodID,
- _Jv_va_list);
- jbyte (*CallStaticByteMethodA) (JNIEnv *, jclass, jmethodID,
- jvalue *);
- jchar (*CallStaticCharMethod) (JNIEnv *, jclass, jmethodID,
- ...);
- jchar (*CallStaticCharMethodV) (JNIEnv *, jclass, jmethodID,
- _Jv_va_list);
- jchar (*CallStaticCharMethodA) (JNIEnv *, jclass, jmethodID,
- jvalue *);
- jshort (*CallStaticShortMethod) (JNIEnv *, jclass, jmethodID,
- ...);
- jshort (*CallStaticShortMethodV) (JNIEnv *, jclass, jmethodID,
- _Jv_va_list);
- jshort (*CallStaticShortMethodA) (JNIEnv *, jclass, jmethodID,
- jvalue *);
- jint (*CallStaticIntMethod) (JNIEnv *, jclass, jmethodID,
- ...);
- jint (*CallStaticIntMethodV) (JNIEnv *, jclass, jmethodID,
- _Jv_va_list);
- jint (*CallStaticIntMethodA) (JNIEnv *, jclass, jmethodID,
- jvalue *);
- jlong (*CallStaticLongMethod) (JNIEnv *, jclass, jmethodID,
- ...);
- jlong (*CallStaticLongMethodV) (JNIEnv *, jclass, jmethodID,
- _Jv_va_list);
- jlong (*CallStaticLongMethodA) (JNIEnv *, jclass, jmethodID,
- jvalue *);
- jfloat (*CallStaticFloatMethod) (JNIEnv *, jclass, jmethodID,
- ...);
- jfloat (*CallStaticFloatMethodV) (JNIEnv *, jclass, jmethodID,
- _Jv_va_list);
- jfloat (*CallStaticFloatMethodA) (JNIEnv *, jclass, jmethodID,
- jvalue *);
- jdouble (*CallStaticDoubleMethod) (JNIEnv *, jclass, jmethodID,
- ...);
- jdouble (*CallStaticDoubleMethodV) (JNIEnv *, jclass, jmethodID,
- _Jv_va_list);
- jdouble (*CallStaticDoubleMethodA) (JNIEnv *, jclass, jmethodID,
- jvalue *);
- void (*CallStaticVoidMethod) (JNIEnv *, jclass, jmethodID,
- ...);
- void (*CallStaticVoidMethodV) (JNIEnv *, jclass, jmethodID,
- _Jv_va_list);
- void (*CallStaticVoidMethodA) (JNIEnv *, jclass, jmethodID,
- jvalue *);
-
- jfieldID (*GetStaticFieldID) (JNIEnv *, jclass, const char *,
+ jmethodID (JNICALL *GetStaticMethodID) (JNIEnv *, jclass, const char *,
const char *);
- jobject (*GetStaticObjectField) (JNIEnv *, jclass, jfieldID);
- jboolean (*GetStaticBooleanField) (JNIEnv *, jclass, jfieldID);
- jbyte (*GetStaticByteField) (JNIEnv *, jclass, jfieldID);
- jchar (*GetStaticCharField) (JNIEnv *, jclass, jfieldID);
- jshort (*GetStaticShortField) (JNIEnv *, jclass, jfieldID);
- jint (*GetStaticIntField) (JNIEnv *, jclass, jfieldID);
- jlong (*GetStaticLongField) (JNIEnv *, jclass, jfieldID);
- jfloat (*GetStaticFloatField) (JNIEnv *, jclass, jfieldID);
- jdouble (*GetStaticDoubleField) (JNIEnv *, jclass, jfieldID);
-
- void (*SetStaticObjectField) (JNIEnv *, jclass,
+ jobject (JNICALL *CallStaticObjectMethod) (JNIEnv *, jclass, jmethodID,
+ ...);
+ jobject (JNICALL *CallStaticObjectMethodV) (JNIEnv *, jclass, jmethodID,
+ _Jv_va_list);
+ jobject (JNICALL *CallStaticObjectMethodA) (JNIEnv *, jclass, jmethodID,
+ jvalue *);
+ jboolean (JNICALL *CallStaticBooleanMethod) (JNIEnv *, jclass, jmethodID,
+ ...);
+ jboolean (JNICALL *CallStaticBooleanMethodV) (JNIEnv *, jclass, jmethodID,
+ _Jv_va_list);
+ jboolean (JNICALL *CallStaticBooleanMethodA) (JNIEnv *, jclass, jmethodID,
+ jvalue *);
+ jbyte (JNICALL *CallStaticByteMethod) (JNIEnv *, jclass, jmethodID,
+ ...);
+ jbyte (JNICALL *CallStaticByteMethodV) (JNIEnv *, jclass, jmethodID,
+ _Jv_va_list);
+ jbyte (JNICALL *CallStaticByteMethodA) (JNIEnv *, jclass, jmethodID,
+ jvalue *);
+ jchar (JNICALL *CallStaticCharMethod) (JNIEnv *, jclass, jmethodID,
+ ...);
+ jchar (JNICALL *CallStaticCharMethodV) (JNIEnv *, jclass, jmethodID,
+ _Jv_va_list);
+ jchar (JNICALL *CallStaticCharMethodA) (JNIEnv *, jclass, jmethodID,
+ jvalue *);
+ jshort (JNICALL *CallStaticShortMethod) (JNIEnv *, jclass, jmethodID,
+ ...);
+ jshort (JNICALL *CallStaticShortMethodV) (JNIEnv *, jclass, jmethodID,
+ _Jv_va_list);
+ jshort (JNICALL *CallStaticShortMethodA) (JNIEnv *, jclass, jmethodID,
+ jvalue *);
+ jint (JNICALL *CallStaticIntMethod) (JNIEnv *, jclass, jmethodID,
+ ...);
+ jint (JNICALL *CallStaticIntMethodV) (JNIEnv *, jclass, jmethodID,
+ _Jv_va_list);
+ jint (JNICALL *CallStaticIntMethodA) (JNIEnv *, jclass, jmethodID,
+ jvalue *);
+ jlong (JNICALL *CallStaticLongMethod) (JNIEnv *, jclass, jmethodID,
+ ...);
+ jlong (JNICALL *CallStaticLongMethodV) (JNIEnv *, jclass, jmethodID,
+ _Jv_va_list);
+ jlong (JNICALL *CallStaticLongMethodA) (JNIEnv *, jclass, jmethodID,
+ jvalue *);
+ jfloat (JNICALL *CallStaticFloatMethod) (JNIEnv *, jclass, jmethodID,
+ ...);
+ jfloat (JNICALL *CallStaticFloatMethodV) (JNIEnv *, jclass, jmethodID,
+ _Jv_va_list);
+ jfloat (JNICALL *CallStaticFloatMethodA) (JNIEnv *, jclass, jmethodID,
+ jvalue *);
+ jdouble (JNICALL *CallStaticDoubleMethod) (JNIEnv *, jclass, jmethodID,
+ ...);
+ jdouble (JNICALL *CallStaticDoubleMethodV) (JNIEnv *, jclass, jmethodID,
+ _Jv_va_list);
+ jdouble (JNICALL *CallStaticDoubleMethodA) (JNIEnv *, jclass, jmethodID,
+ jvalue *);
+ void (JNICALL *CallStaticVoidMethod) (JNIEnv *, jclass, jmethodID,
+ ...);
+ void (JNICALL *CallStaticVoidMethodV) (JNIEnv *, jclass, jmethodID,
+ _Jv_va_list);
+ void (JNICALL *CallStaticVoidMethodA) (JNIEnv *, jclass, jmethodID,
+ jvalue *);
+
+ jfieldID (JNICALL *GetStaticFieldID) (JNIEnv *, jclass, const char *,
+ const char *);
+
+ jobject (JNICALL *GetStaticObjectField) (JNIEnv *, jclass, jfieldID);
+ jboolean (JNICALL *GetStaticBooleanField) (JNIEnv *, jclass, jfieldID);
+ jbyte (JNICALL *GetStaticByteField) (JNIEnv *, jclass, jfieldID);
+ jchar (JNICALL *GetStaticCharField) (JNIEnv *, jclass, jfieldID);
+ jshort (JNICALL *GetStaticShortField) (JNIEnv *, jclass, jfieldID);
+ jint (JNICALL *GetStaticIntField) (JNIEnv *, jclass, jfieldID);
+ jlong (JNICALL *GetStaticLongField) (JNIEnv *, jclass, jfieldID);
+ jfloat (JNICALL *GetStaticFloatField) (JNIEnv *, jclass, jfieldID);
+ jdouble (JNICALL *GetStaticDoubleField) (JNIEnv *, jclass, jfieldID);
+
+ void (JNICALL *SetStaticObjectField) (JNIEnv *, jclass,
jfieldID, jobject);
- void (*SetStaticBooleanField) (JNIEnv *, jclass,
+ void (JNICALL *SetStaticBooleanField) (JNIEnv *, jclass,
jfieldID, jboolean);
- void (*SetStaticByteField) (JNIEnv *, jclass,
+ void (JNICALL *SetStaticByteField) (JNIEnv *, jclass,
jfieldID, jbyte);
- void (*SetStaticCharField) (JNIEnv *, jclass,
+ void (JNICALL *SetStaticCharField) (JNIEnv *, jclass,
jfieldID, jchar);
- void (*SetStaticShortField) (JNIEnv *, jclass,
+ void (JNICALL *SetStaticShortField) (JNIEnv *, jclass,
jfieldID, jshort);
- void (*SetStaticIntField) (JNIEnv *, jclass,
+ void (JNICALL *SetStaticIntField) (JNIEnv *, jclass,
jfieldID, jint);
- void (*SetStaticLongField) (JNIEnv *, jclass,
+ void (JNICALL *SetStaticLongField) (JNIEnv *, jclass,
jfieldID, jlong);
- void (*SetStaticFloatField) (JNIEnv *, jclass,
+ void (JNICALL *SetStaticFloatField) (JNIEnv *, jclass,
jfieldID, jfloat);
- void (*SetStaticDoubleField) (JNIEnv *, jclass,
+ void (JNICALL *SetStaticDoubleField) (JNIEnv *, jclass,
jfieldID, jdouble);
- jstring (*NewString) (JNIEnv *, const jchar *, jsize);
- jsize (*GetStringLength) (JNIEnv *, jstring);
- const jchar * (*GetStringChars) (JNIEnv *, jstring, jboolean *);
- void (*ReleaseStringChars) (JNIEnv *, jstring, const jchar *);
- jstring (*NewStringUTF) (JNIEnv *, const char *);
- jsize (*GetStringUTFLength) (JNIEnv *, jstring);
- const char * (*GetStringUTFChars) (JNIEnv *, jstring, jboolean *);
- void (*ReleaseStringUTFChars) (JNIEnv *, jstring, const char *);
- jsize (*GetArrayLength) (JNIEnv *, jarray);
- jarray (*NewObjectArray) (JNIEnv *, jsize, jclass, jobject);
- jobject (*GetObjectArrayElement) (JNIEnv *, jobjectArray, jsize);
- void (*SetObjectArrayElement) (JNIEnv *, jobjectArray, jsize,
- jobject);
-
- jbooleanArray (*NewBooleanArray) (JNIEnv *, jsize);
- jbyteArray (*NewByteArray) (JNIEnv *, jsize);
- jcharArray (*NewCharArray) (JNIEnv *, jsize);
- jshortArray (*NewShortArray) (JNIEnv *, jsize);
- jintArray (*NewIntArray) (JNIEnv *, jsize);
- jlongArray (*NewLongArray) (JNIEnv *, jsize);
- jfloatArray (*NewFloatArray) (JNIEnv *, jsize);
- jdoubleArray (*NewDoubleArray) (JNIEnv *, jsize);
-
- jboolean * (*GetBooleanArrayElements) (JNIEnv *, jbooleanArray,
- jboolean *);
- jbyte * (*GetByteArrayElements) (JNIEnv *, jbyteArray,
- jboolean *);
- jchar * (*GetCharArrayElements) (JNIEnv *, jcharArray,
- jboolean *);
- jshort * (*GetShortArrayElements) (JNIEnv *, jshortArray,
- jboolean *);
- jint * (*GetIntArrayElements) (JNIEnv *, jintArray,
- jboolean *);
- jlong * (*GetLongArrayElements) (JNIEnv *, jlongArray,
- jboolean *);
- jfloat * (*GetFloatArrayElements) (JNIEnv *, jfloatArray,
- jboolean *);
- jdouble * (*GetDoubleArrayElements) (JNIEnv *, jdoubleArray,
- jboolean *);
-
- void (*ReleaseBooleanArrayElements) (JNIEnv *, jbooleanArray,
- jboolean *, jint);
- void (*ReleaseByteArrayElements) (JNIEnv *, jbyteArray,
- jbyte *, jint);
- void (*ReleaseCharArrayElements) (JNIEnv *, jcharArray,
- jchar *, jint);
- void (*ReleaseShortArrayElements) (JNIEnv *, jshortArray,
- jshort *, jint);
- void (*ReleaseIntArrayElements) (JNIEnv *, jintArray,
- jint *, jint);
- void (*ReleaseLongArrayElements) (JNIEnv *, jlongArray,
- jlong *, jint);
- void (*ReleaseFloatArrayElements) (JNIEnv *, jfloatArray,
- jfloat *, jint);
- void (*ReleaseDoubleArrayElements) (JNIEnv *, jdoubleArray,
- jdouble *, jint);
-
- void (*GetBooleanArrayRegion) (JNIEnv *, jbooleanArray,
- jsize, jsize, jboolean *);
- void (*GetByteArrayRegion) (JNIEnv *, jbyteArray,
- jsize, jsize, jbyte *);
- void (*GetCharArrayRegion) (JNIEnv *, jcharArray,
- jsize, jsize, jchar *);
- void (*GetShortArrayRegion) (JNIEnv *, jshortArray,
- jsize, jsize, jshort *);
- void (*GetIntArrayRegion) (JNIEnv *, jintArray,
- jsize, jsize, jint *);
- void (*GetLongArrayRegion) (JNIEnv *, jlongArray,
- jsize, jsize, jlong *);
- void (*GetFloatArrayRegion) (JNIEnv *, jfloatArray,
- jsize, jsize, jfloat *);
- void (*GetDoubleArrayRegion) (JNIEnv *, jdoubleArray,
- jsize, jsize, jdouble *);
-
- void (*SetBooleanArrayRegion) (JNIEnv *, jbooleanArray,
- jsize, jsize, jboolean *);
- void (*SetByteArrayRegion) (JNIEnv *, jbyteArray,
- jsize, jsize, jbyte *);
- void (*SetCharArrayRegion) (JNIEnv *, jcharArray,
- jsize, jsize, jchar *);
- void (*SetShortArrayRegion) (JNIEnv *, jshortArray,
- jsize, jsize, jshort *);
- void (*SetIntArrayRegion) (JNIEnv *, jintArray,
- jsize, jsize, jint *);
- void (*SetLongArrayRegion) (JNIEnv *, jlongArray,
- jsize, jsize, jlong *);
- void (*SetFloatArrayRegion) (JNIEnv *, jfloatArray,
- jsize, jsize, jfloat *);
- void (*SetDoubleArrayRegion) (JNIEnv *, jdoubleArray,
- jsize, jsize, jdouble *);
-
- jint (*RegisterNatives) (JNIEnv *, jclass,
- const JNINativeMethod *, jint);
- jint (*UnregisterNatives) (JNIEnv *, jclass);
- jint (*MonitorEnter) (JNIEnv *, jobject);
- jint (*MonitorExit) (JNIEnv *, jobject);
- jint (*GetJavaVM) (JNIEnv *, JavaVM **);
-
- void (*GetStringRegion) (JNIEnv *, jstring, jsize,
- jsize, jchar *);
- void (*GetStringUTFRegion) (JNIEnv *, jstring, jsize,
- jsize, char *);
-
- void * (*GetPrimitiveArrayCritical) (JNIEnv *, jarray, jboolean *);
- void (*ReleasePrimitiveArrayCritical) (JNIEnv *, jarray, void *, jint);
-
- const jchar * (*GetStringCritical) (JNIEnv *, jstring, jboolean *);
- void (*ReleaseStringCritical) (JNIEnv *, jstring, const jchar *);
-
- jweak (*NewWeakGlobalRef) (JNIEnv *, jobject);
- void (*DeleteWeakGlobalRef) (JNIEnv *, jweak);
-
- jboolean (*ExceptionCheck) (JNIEnv *);
-
- jobject (*NewDirectByteBuffer) (JNIEnv *, void *, jlong);
- void * (*GetDirectBufferAddress) (JNIEnv *, jobject);
- jlong (*GetDirectBufferCapacity) (JNIEnv *, jobject);
+ jstring (JNICALL *NewString) (JNIEnv *, const jchar *, jsize);
+ jsize (JNICALL *GetStringLength) (JNIEnv *, jstring);
+ const jchar * (JNICALL *GetStringChars) (JNIEnv *, jstring, jboolean *);
+ void (JNICALL *ReleaseStringChars) (JNIEnv *, jstring, const jchar *);
+ jstring (JNICALL *NewStringUTF) (JNIEnv *, const char *);
+ jsize (JNICALL *GetStringUTFLength) (JNIEnv *, jstring);
+ const char * (JNICALL *GetStringUTFChars) (JNIEnv *, jstring, jboolean *);
+ void (JNICALL *ReleaseStringUTFChars) (JNIEnv *, jstring, const char *);
+ jsize (JNICALL *GetArrayLength) (JNIEnv *, jarray);
+ jarray (JNICALL *NewObjectArray) (JNIEnv *, jsize, jclass, jobject);
+ jobject (JNICALL *GetObjectArrayElement) (JNIEnv *, jobjectArray, jsize);
+ void (JNICALL *SetObjectArrayElement) (JNIEnv *, jobjectArray, jsize,
+ jobject);
+
+ jbooleanArray (JNICALL *NewBooleanArray) (JNIEnv *, jsize);
+ jbyteArray (JNICALL *NewByteArray) (JNIEnv *, jsize);
+ jcharArray (JNICALL *NewCharArray) (JNIEnv *, jsize);
+ jshortArray (JNICALL *NewShortArray) (JNIEnv *, jsize);
+ jintArray (JNICALL *NewIntArray) (JNIEnv *, jsize);
+ jlongArray (JNICALL *NewLongArray) (JNIEnv *, jsize);
+ jfloatArray (JNICALL *NewFloatArray) (JNIEnv *, jsize);
+ jdoubleArray (JNICALL *NewDoubleArray) (JNIEnv *, jsize);
+
+ jboolean * (JNICALL *GetBooleanArrayElements) (JNIEnv *, jbooleanArray,
+ jboolean *);
+ jbyte * (JNICALL *GetByteArrayElements) (JNIEnv *, jbyteArray,
+ jboolean *);
+ jchar * (JNICALL *GetCharArrayElements) (JNIEnv *, jcharArray,
+ jboolean *);
+ jshort * (JNICALL *GetShortArrayElements) (JNIEnv *, jshortArray,
+ jboolean *);
+ jint * (JNICALL *GetIntArrayElements) (JNIEnv *, jintArray,
+ jboolean *);
+ jlong * (JNICALL *GetLongArrayElements) (JNIEnv *, jlongArray,
+ jboolean *);
+ jfloat * (JNICALL *GetFloatArrayElements) (JNIEnv *, jfloatArray,
+ jboolean *);
+ jdouble * (JNICALL *GetDoubleArrayElements) (JNIEnv *, jdoubleArray,
+ jboolean *);
+
+ void (JNICALL *ReleaseBooleanArrayElements) (JNIEnv *, jbooleanArray,
+ jboolean *, jint);
+ void (JNICALL *ReleaseByteArrayElements) (JNIEnv *, jbyteArray,
+ jbyte *, jint);
+ void (JNICALL *ReleaseCharArrayElements) (JNIEnv *, jcharArray,
+ jchar *, jint);
+ void (JNICALL *ReleaseShortArrayElements) (JNIEnv *, jshortArray,
+ jshort *, jint);
+ void (JNICALL *ReleaseIntArrayElements) (JNIEnv *, jintArray,
+ jint *, jint);
+ void (JNICALL *ReleaseLongArrayElements) (JNIEnv *, jlongArray,
+ jlong *, jint);
+ void (JNICALL *ReleaseFloatArrayElements) (JNIEnv *, jfloatArray,
+ jfloat *, jint);
+ void (JNICALL *ReleaseDoubleArrayElements) (JNIEnv *, jdoubleArray,
+ jdouble *, jint);
+
+ void (JNICALL *GetBooleanArrayRegion) (JNIEnv *, jbooleanArray,
+ jsize, jsize, jboolean *);
+ void (JNICALL *GetByteArrayRegion) (JNIEnv *, jbyteArray,
+ jsize, jsize, jbyte *);
+ void (JNICALL *GetCharArrayRegion) (JNIEnv *, jcharArray,
+ jsize, jsize, jchar *);
+ void (JNICALL *GetShortArrayRegion) (JNIEnv *, jshortArray,
+ jsize, jsize, jshort *);
+ void (JNICALL *GetIntArrayRegion) (JNIEnv *, jintArray,
+ jsize, jsize, jint *);
+ void (JNICALL *GetLongArrayRegion) (JNIEnv *, jlongArray,
+ jsize, jsize, jlong *);
+ void (JNICALL *GetFloatArrayRegion) (JNIEnv *, jfloatArray,
+ jsize, jsize, jfloat *);
+ void (JNICALL *GetDoubleArrayRegion) (JNIEnv *, jdoubleArray,
+ jsize, jsize, jdouble *);
+
+ void (JNICALL *SetBooleanArrayRegion) (JNIEnv *, jbooleanArray,
+ jsize, jsize, jboolean *);
+ void (JNICALL *SetByteArrayRegion) (JNIEnv *, jbyteArray,
+ jsize, jsize, jbyte *);
+ void (JNICALL *SetCharArrayRegion) (JNIEnv *, jcharArray,
+ jsize, jsize, jchar *);
+ void (JNICALL *SetShortArrayRegion) (JNIEnv *, jshortArray,
+ jsize, jsize, jshort *);
+ void (JNICALL *SetIntArrayRegion) (JNIEnv *, jintArray,
+ jsize, jsize, jint *);
+ void (JNICALL *SetLongArrayRegion) (JNIEnv *, jlongArray,
+ jsize, jsize, jlong *);
+ void (JNICALL *SetFloatArrayRegion) (JNIEnv *, jfloatArray,
+ jsize, jsize, jfloat *);
+ void (JNICALL *SetDoubleArrayRegion) (JNIEnv *, jdoubleArray,
+ jsize, jsize, jdouble *);
+
+ jint (JNICALL *RegisterNatives) (JNIEnv *, jclass,
+ const JNINativeMethod *,
+ jint);
+ jint (JNICALL *UnregisterNatives) (JNIEnv *, jclass);
+ jint (JNICALL *MonitorEnter) (JNIEnv *, jobject);
+ jint (JNICALL *MonitorExit) (JNIEnv *, jobject);
+ jint (JNICALL *GetJavaVM) (JNIEnv *, JavaVM **);
+
+ void (JNICALL *GetStringRegion) (JNIEnv *, jstring, jsize,
+ jsize, jchar *);
+ void (JNICALL *GetStringUTFRegion) (JNIEnv *, jstring, jsize,
+ jsize, char *);
+
+ void * (JNICALL *GetPrimitiveArrayCritical) (JNIEnv *, jarray,
+ jboolean *);
+ void (JNICALL *ReleasePrimitiveArrayCritical) (JNIEnv *, jarray, void *,
+ jint);
+
+ const jchar * (JNICALL *GetStringCritical) (JNIEnv *, jstring,
+ jboolean *);
+ void (JNICALL *ReleaseStringCritical) (JNIEnv *, jstring,
+ const jchar *);
+
+ jweak (JNICALL *NewWeakGlobalRef) (JNIEnv *, jobject);
+ void (JNICALL *DeleteWeakGlobalRef) (JNIEnv *, jweak);
+
+ jboolean (JNICALL *ExceptionCheck) (JNIEnv *);
+
+ jobject (JNICALL *NewDirectByteBuffer) (JNIEnv *, void *, jlong);
+ void * (JNICALL *GetDirectBufferAddress) (JNIEnv *, jobject);
+ jlong (JNICALL *GetDirectBufferCapacity) (JNIEnv *, jobject);
};
#ifdef __cplusplus
@@ -1549,11 +1563,11 @@ struct JNIInvokeInterface
_Jv_func reserved1;
_Jv_func reserved2;
- jint (*DestroyJavaVM) (JavaVM *);
- jint (*AttachCurrentThread) (JavaVM *, void **, void *);
- jint (*DetachCurrentThread) (JavaVM *);
- jint (*GetEnv) (JavaVM *, void **, jint);
- jint (*AttachCurrentThreadAsDaemon) (JavaVM *, void **, void *);
+ jint (JNICALL *DestroyJavaVM) (JavaVM *);
+ jint (JNICALL *AttachCurrentThread) (JavaVM *, void **, void *);
+ jint (JNICALL *DetachCurrentThread) (JavaVM *);
+ jint (JNICALL *GetEnv) (JavaVM *, void **, jint);
+ jint (JNICALL *AttachCurrentThreadAsDaemon) (JavaVM *, void **, void *);
};
#ifdef __cplusplus
diff --git a/libjava/include/jvm.h b/libjava/include/jvm.h
index fc3a7f73ecf..e02901de824 100644
--- a/libjava/include/jvm.h
+++ b/libjava/include/jvm.h
@@ -111,6 +111,20 @@ union _Jv_word2
jdouble d;
};
+// An instance of this type is used to represent a single frame in a
+// backtrace. If the interpreter has been built, we also include
+// information about the interpreted method.
+struct _Jv_frame_info
+{
+ // PC value.
+ void *addr;
+#ifdef INTERPRETER
+ // Actually a _Jv_InterpMethod, but we don't want to include
+ // java-interp.h everywhere.
+ void *interp;
+#endif // INTERPRETER
+};
+
/* Extract a character from a Java-style Utf8 string.
* PTR points to the current character.
* LIMIT points to the end of the Utf8 string.
diff --git a/libjava/include/name-finder.h b/libjava/include/name-finder.h
deleted file mode 100644
index 67ae0587fb0..00000000000
--- a/libjava/include/name-finder.h
+++ /dev/null
@@ -1,103 +0,0 @@
-// name-finder.h - Convert addresses to names
-
-/* Copyright (C) 2000, 2002 Free Software Foundation, Inc
-
- 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. */
-
-/**
- * @author Andrew Haley <aph@cygnus.com>
- * @date Jan 6 2000
- */
-
-#include <gcj/cni.h>
-#include <jvm.h>
-
-#include <sys/types.h>
-
-#ifdef HAVE_SYS_WAIT_H
-#include <sys/wait.h>
-#endif
-
-#include <string.h>
-#include <stdio.h>
-
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-
-#include <java/lang/StackTraceElement.h>
-
-/* _Jv_name_finder is a class wrapper around a mechanism that can
- convert addresses of methods to their names and the names of files
- in which they appear. */
-
-class _Jv_name_finder
-{
-public:
- _Jv_name_finder (char *executable);
- ~_Jv_name_finder ()
- {
-#if defined (HAVE_PIPE) && defined (HAVE_FORK)
- myclose (f_pipe[0]);
- myclose (f_pipe[1]);
- myclose (b_pipe[0]);
- myclose (b_pipe[1]);
- if (b_pipe_fd != NULL)
- fclose (b_pipe_fd);
-
- myclose (f2_pipe[0]);
- myclose (f2_pipe[1]);
- myclose (b2_pipe[0]);
- myclose (b2_pipe[1]);
- if (b2_pipe_fd != NULL)
- fclose (b2_pipe_fd);
-
- if (pid >= 0)
- {
- int wstat;
- // We don't care about errors here.
- waitpid (pid, &wstat, 0);
- }
-
- if (pid2 >= 0)
- {
- int wstat;
- // We don't care about errors here.
- waitpid (pid2, &wstat, 0);
- }
-#endif
- }
-
-/* Given a pointer to a function or method, try to convert it into a
- name and the appropriate line and source file. The caller passes
- the code pointer in p.
-
- Returns NULL if the lookup fails. Even if this happens, the field
- hex will have been correctly filled in with the pointer. */
-
- java::lang::StackTraceElement* lookup (void *p);
-
- char hex[sizeof (void *) * 2 + 5];
-
-private:
- void toHex (void *p);
- java::lang::StackTraceElement* createStackTraceElement(char *s, char *f);
-#if defined (HAVE_PIPE) && defined (HAVE_FORK)
- pid_t pid, pid2;
- int f_pipe[2], b_pipe[2], f2_pipe[2], b2_pipe[2];
- FILE *b_pipe_fd, *b2_pipe_fd;
- int demangling_error, lookup_error;
-
- // Close a descriptor only if it has not been closed.
- void myclose (int fd)
- {
- if (fd != -1)
- close (fd);
- }
-
-#endif
-};
diff --git a/libjava/include/posix.h b/libjava/include/posix.h
index 8fa782fc662..4bb1d56810f 100644
--- a/libjava/include/posix.h
+++ b/libjava/include/posix.h
@@ -27,6 +27,10 @@ details. */
#include <sys/select.h>
#endif
+#ifdef HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+#endif
+
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
@@ -36,6 +40,10 @@ details. */
#include <gcj/cni.h>
#include <java/util/Properties.h>
+#ifndef DISABLE_JAVA_NET
+#include <java/net/InetAddress.h>
+#endif
+
extern int _Jv_select (int n, fd_set *, fd_set *, fd_set *, struct timeval *);
extern jlong _Jv_platform_gettimeofday ();
extern void _Jv_platform_initialize (void);
@@ -45,7 +53,66 @@ inline void
_Jv_platform_close_on_exec (jint fd)
{
// Ignore errors.
- fcntl (fd, F_SETFD, FD_CLOEXEC);
+ ::fcntl (fd, F_SETFD, FD_CLOEXEC);
}
+#ifndef DISABLE_JAVA_NET
+
+#ifndef HAVE_SOCKLEN_T
+#define socklen_t int
#endif
+
+static inline int
+_Jv_socket (int domain, int type, int protocol)
+{
+ return ::socket (domain, type, protocol);
+}
+
+inline int
+_Jv_connect (jint fd, sockaddr *ptr, int len)
+{
+ return ::connect (fd, ptr, len);
+}
+
+inline int
+_Jv_close (jint fd)
+{
+ return ::close (fd);
+}
+
+// Avoid macro definitions of bind from system headers, e.g. on
+// Solaris 7 with _XOPEN_SOURCE. FIXME
+inline int
+_Jv_bind (int fd, struct sockaddr *addr, int addrlen)
+{
+ return ::bind (fd, addr, addrlen);
+}
+
+// Same problem with accept on Tru64 UNIX with _POSIX_PII_SOCKET
+inline int
+_Jv_accept (int fd, struct sockaddr *addr, socklen_t *addrlen)
+{
+ return ::accept (fd, addr, addrlen);
+}
+
+inline int
+_Jv_listen (int fd, int backlog)
+{
+ return ::listen (fd, backlog);
+}
+
+inline int
+_Jv_write(int s, void *buf, int len)
+{
+ return ::write (s, buf, len);
+}
+
+inline int
+_Jv_read(int s, void *buf, int len)
+{
+ return ::read (s, buf, len);
+}
+
+#endif /* DISABLE_JAVA_NET */
+
+#endif /* __JV_POSIX_H__ */
diff --git a/libjava/include/win32-threads.h b/libjava/include/win32-threads.h
index 21fdd0e7aa1..e8cf80598c2 100644
--- a/libjava/include/win32-threads.h
+++ b/libjava/include/win32-threads.h
@@ -33,6 +33,14 @@ typedef struct
java::lang::Thread *thread_obj;
} _Jv_Thread_t;
+typedef DWORD _Jv_ThreadId_t;
+
+inline _Jv_ThreadId_t
+_Jv_ThreadSelf (void)
+{
+ return GetCurrentThreadId();
+}
+
typedef void _Jv_ThreadStartFunc (java::lang::Thread *);
//
diff --git a/libjava/include/win32.h b/libjava/include/win32.h
index 8fbe39335d0..62bc0c33cbb 100644
--- a/libjava/include/win32.h
+++ b/libjava/include/win32.h
@@ -16,9 +16,24 @@ details. */
#undef __INSIDE_CYGWIN__
#include <winsock.h>
+#define IP_TOS 3
#include <gcj/cni.h>
#include <java/util/Properties.h>
+#include <io.h>
+
+#ifndef DISBALE_JAVA_NET
+
+// these errors cannot occur on Win32
+#define ENOTCONN 0
+#define ECONNRESET 0
+
+#ifndef ENOPROTOOPT
+#define ENOPROTOOPT 109
+#endif
+
+#endif // DISBALE_JAVA_NET
+
extern void _Jv_platform_initialize (void);
extern void _Jv_platform_initProperties (java::util::Properties*);
extern jlong _Jv_platform_gettimeofday ();
@@ -29,6 +44,58 @@ _Jv_platform_close_on_exec (jint)
// Ignore.
}
+#ifndef DISBALE_JAVA_NET
+
+static inline int
+_Jv_socket (int domain, int type, int protocol)
+{
+ return ::socket (domain, type, protocol);
+}
+
+inline int
+_Jv_connect (jint fd, sockaddr *ptr, int len)
+{
+ return ::connect (fd, ptr, len);
+}
+
+inline int
+_Jv_close (jint fd)
+{
+ return ::closesocket (fd);
+}
+
+inline int
+_Jv_bind (int fd, struct sockaddr *addr, int addrlen)
+{
+ return ::bind (fd, addr, addrlen);
+}
+
+inline int
+_Jv_accept (int fd, struct sockaddr *addr, socklen_t *addrlen)
+{
+ return ::accept (fd, addr, addrlen);
+}
+
+inline int
+_Jv_listen (int fd, int backlog)
+{
+ return ::listen (fd, backlog);
+}
+
+inline int
+_Jv_write(int s, void *buf, int len)
+{
+ return ::send (s, (char*) buf, len, 0);
+}
+
+inline int
+_Jv_read(int s, void *buf, int len)
+{
+ return ::recv (s, (char*) buf, len, 0);
+}
+
+#endif /* DISBALE_JAVA_NET */
+
#define HAVE_BACKTRACE
/* Store up to SIZE return address of the current program state in
diff --git a/libjava/interpret.cc b/libjava/interpret.cc
index e5c40cff150..bc324b13ba9 100644
--- a/libjava/interpret.cc
+++ b/libjava/interpret.cc
@@ -22,7 +22,6 @@ details. */
#include <jvm.h>
#include <java-cpool.h>
#include <java-interp.h>
-// #include <java/lang/fdlibm.h>
#include <java/lang/System.h>
#include <java/lang/String.h>
#include <java/lang/Integer.h>
@@ -36,6 +35,7 @@ details. */
#include <java/lang/NullPointerException.h>
#include <java/lang/ArithmeticException.h>
#include <java/lang/IncompatibleClassChangeError.h>
+#include <java/lang/Thread.h>
#include <java-insns.h>
#include <java-signal.h>
@@ -744,11 +744,28 @@ _Jv_InterpMethod::compile (const void * const *insn_targets)
}
#endif /* DIRECT_THREADED */
+// This function exists so that the stack-tracing code can find the
+// boundaries of the interpreter.
+void
+_Jv_StartOfInterpreter (void)
+{
+}
+
void
_Jv_InterpMethod::run (void *retp, ffi_raw *args)
{
using namespace java::lang::reflect;
+ // FRAME_DESC registers this particular invocation as the top-most
+ // interpreter frame. This lets the stack tracing code (for
+ // Throwable) print information about the method being interpreted
+ // rather than about the interpreter itself. FRAME_DESC has a
+ // destructor so it cleans up automatically when the interpreter
+ // returns.
+ java::lang::Thread *thread = java::lang::Thread::currentThread();
+ _Jv_MethodChain frame_desc (this,
+ (_Jv_MethodChain **) &thread->interp_frame);
+
_Jv_word stack[max_stack];
_Jv_word *sp = stack;
@@ -1866,7 +1883,7 @@ _Jv_InterpMethod::run (void *retp, ffi_raw *args)
insn_iushr:
{
jint shift = (POPI() & 0x1f);
- unsigned long value = POPI();
+ UINT32 value = (UINT32) POPI();
PUSHI ((jint) (value >> shift));
}
NEXT_INSN;
@@ -2778,7 +2795,10 @@ _Jv_InterpMethod::run (void *retp, ffi_raw *args)
sp -= rmeth->stack_item_count;
- NULLCHECK (sp[0].o);
+ // We don't use NULLCHECK here because we can't rely on that
+ // working for <init>. So instead we do an explicit test.
+ if (! sp[0].o)
+ throw new java::lang::NullPointerException;
fun = (void (*)()) rmeth->method->ncode;
@@ -2796,7 +2816,10 @@ _Jv_InterpMethod::run (void *retp, ffi_raw *args)
{
rmeth = (_Jv_ResolvedMethod *) AVAL ();
sp -= rmeth->stack_item_count;
- NULLCHECK (sp[0].o);
+ // We don't use NULLCHECK here because we can't rely on that
+ // working for <init>. So instead we do an explicit test.
+ if (! sp[0].o)
+ throw new java::lang::NullPointerException;
fun = (void (*)()) rmeth->method->ncode;
}
goto perform_invoke;
@@ -3169,6 +3192,13 @@ _Jv_InterpMethod::run (void *retp, ffi_raw *args)
}
}
+// This function exists so that the stack-tracing code can find the
+// boundaries of the interpreter.
+void
+_Jv_EndOfInterpreter (void)
+{
+}
+
static void
throw_internal_error (char *msg)
{
diff --git a/libjava/java/applet/Applet.java b/libjava/java/applet/Applet.java
index 8f9338ffd75..5990c6392da 100644
--- a/libjava/java/applet/Applet.java
+++ b/libjava/java/applet/Applet.java
@@ -1,23 +1,23 @@
/* Applet.java -- Java base applet class
- Copyright (C) 1999 Free Software Foundation, Inc.
-
+ Copyright (C) 1999, 2002 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
@@ -39,269 +39,469 @@ exception statement from your version. */
package java.applet;
import java.awt.Dimension;
+import java.awt.GraphicsEnvironment;
+import java.awt.HeadlessException;
import java.awt.Image;
+import java.awt.Panel;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.net.MalformedURLException;
import java.net.URL;
import java.util.Locale;
+import javax.accessibility.AccessibleContext;
+import javax.accessibility.AccessibleRole;
+import javax.accessibility.AccessibleState;
+import javax.accessibility.AccessibleStateSet;
/**
- * This is the base applet class. An applet is a Java program that
- * runs inside a web browser or other applet viewer in a restricted
- * environment.
- *
- * @author Aaron M. Renn (arenn@urbanophile.com)
- */
-public class Applet extends java.awt.Panel implements java.io.Serializable
+ * This is the base applet class. An applet is a Java program that
+ * runs inside a web browser or other applet viewer in a restricted
+ * environment.
+ *
+ * <p>To be useful, a subclass should override at least start(). Also useful
+ * are init, stop, and destroy for control purposes, and getAppletInfo and
+ * getParameterInfo for descriptive purposes.
+ *
+ * @author Aaron M. Renn <arenn@urbanophile.com>
+ * @author Eric Blake <ebb9@email.byu.edu>
+ * @since 1.0
+ * @status updated to 1.4
+ */
+public class Applet extends Panel
{
- // The applet stub for this applet
- private AppletStub stub;
+ /**
+ * Compatible with JDK 1.0+.
+ */
+ private static final long serialVersionUID = -5836846270535785031L;
+
+ /** The applet stub for this applet. */
+ private transient AppletStub stub;
+
+ /**
+ * The accessibility context for this applet.
+ *
+ * @serial the accessibleContext for this
+ * @since 1.2
+ */
+ private AccessibleContext accessibleContext;
+
+ /**
+ * Default constructor for subclasses.
+ *
+ * @throws HeadlessException if in a headless environment
+ */
+ public Applet()
+ {
+ if (GraphicsEnvironment.isHeadless())
+ throw new HeadlessException();
+ }
+
+ /**
+ * The browser calls this method to set the applet's stub, which is the
+ * low level interface to the browser. Manually setting this to null is
+ * asking for problems down the road.
+ *
+ * @param stub the applet stub for this applet
+ */
+ public final void setStub(AppletStub stub)
+ {
+ this.stub = stub;
+ }
/**
- * Default constructor for subclasses.
- */
- public Applet() {}
+ * Tests whether or not this applet is currently active. An applet is active
+ * just before the browser invokes start(), and becomes inactive just
+ * before the browser invokes stop().
+ *
+ * @return <code>true</code> if this applet is active
+ */
+ public boolean isActive()
+ {
+ return stub.isActive();
+ }
/**
- * Returns the URL of the document this applet is embedded in.
- *
- * @return The URL of the document this applet is embedded in.
- */
+ * Returns the basename URL of the document this applet is embedded in. This
+ * is everything up to the final '/'.
+ *
+ * @return the URL of the document this applet is embedded in
+ * @see #getCodeBase()
+ */
public URL getDocumentBase()
{
- return (stub.getDocumentBase ());
+ return stub.getDocumentBase();
}
/**
- * Returns the URL of the code base for this applet.
- *
- * @return The URL of the code base for this applet.
- */
+ * Returns the URL of the code base for this applet.
+ *
+ * @return the URL of the code base for this applet
+ */
public URL getCodeBase()
{
- return (stub.getCodeBase ());
+ return stub.getCodeBase();
}
/**
- * Returns the value of the specified parameter that was specified in
- * the &lt;APPLET&gt; tag for this applet.
- *
- * @param name The parameter name.
- *
- * @param value The parameter value, or <code>null</code> if the parameter
- * does not exist.
- */
+ * Returns the value of the specified parameter that was specified in
+ * the <code>&lt;APPLET&gt;</code> tag for this applet.
+ *
+ * @param name the parameter name
+ * @return the parameter value, or null if the parameter does not exist
+ * @throws NullPointerException if name is null
+ */
public String getParameter(String name)
{
- return (stub.getParameter (name));
+ return stub.getParameter(name);
}
/**
- * Returns the applet context for this applet.
- *
- * @return The applet context for this applet.
- */
+ * Returns the applet context for this applet.
+ *
+ * @return the applet context for this applet
+ */
public AppletContext getAppletContext()
{
- return (stub.getAppletContext ());
+ return stub.getAppletContext();
}
/**
- * Tests whether or not this applet is currently active.
- *
- * @return <code>true</code> if this applet is active, <code>false</code>
- * otherwise.
- */
- public boolean isActive()
+ * Requests that the applet window for this applet be resized.
+ *
+ * @param width the new width in pixels
+ * @param height the new height in pixels
+ */
+ public void resize(int width, int height)
{
- return (stub.isActive ());
+ stub.appletResize(width, height);
}
/**
- * Requests that the applet window for this applet be resized.
- *
- * @param width The new width in pixels.
- * @param height The new height in pixels.
- */
- public void resize(int width, int height)
+ * Requests that the applet window for this applet be resized.
+ *
+ * @param dim the requested dimensions
+ * @throws NullPointerException if dim is null
+ */
+ public void resize(Dimension dim)
{
- stub.appletResize (width, height);
+ resize(dim.width, dim.height);
}
/**
- * Requests that the applet window for this applet be resized.
- *
- * @param dim The <code>Dimension</code> object with the requested
- * width and height.
- */
- public void resize(Dimension dim)
+ * Displays the specified message in the status window if that window
+ * exists.
+ *
+ * @param message the status message, may be null
+ */
+ public void showStatus(String message)
+ {
+ getAppletContext().showStatus(message);
+ }
+
+ /**
+ * Returns an image from the specified URL. Note that the image is not
+ * actually retrieved until the applet attempts to display it, so this
+ * method returns immediately.
+ *
+ * @param url the URL of the image
+ * @return the retrieved image
+ * @throws NullPointerException if url is null
+ */
+ public Image getImage(URL url)
{
- resize (dim.width, dim.height);
+ return getAppletContext().getImage(url);
}
/**
- * Returns an audio clip from the specified URL.
- *
- * @param url The URL of the audio clip.
- *
- * @return The retrieved audio clip.
- */
+ * Returns an image from the specified absolute URL, and relative path
+ * from that URL. Note that the image is not actually retrieved until the
+ * applet attempts to display it, so this method returns immediately.
+ * This calls <code>getImage(new URL(url, name))</code>, but if building
+ * the new URL fails, this returns null.
+ *
+ * @param url the base URL of the image
+ * @param name the name of the image relative to the URL
+ * @return the retrieved image, or null on failure
+ * @see #getImage(URL)
+ */
+ public Image getImage(URL url, String name)
+ {
+ try
+ {
+ return getImage(new URL(url, name));
+ }
+ catch (MalformedURLException e)
+ {
+ return null;
+ }
+ }
+
+ /**
+ * Returns an audio clip from the specified URL. This clip is not tied to
+ * any particular applet.
+ *
+ * XXX Classpath does not yet implement this.
+ *
+ * @param url the URL of the audio clip
+ * @return the retrieved audio clip
+ * @throws NullPointerException if url is null
+ * @see #getAudioClip(URL)
+ * @since 1.2
+ */
+ public static final AudioClip newAudioClip(URL url)
+ {
+ // This requires an implementation of AudioClip in gnu.java.applet.
+ throw new Error("Not implemented");
+ }
+
+ /**
+ * Returns an audio clip from the specified URL. Note that the clip is not
+ * actually retrieved until the applet attempts to play it, so this method
+ * returns immediately.
+ *
+ * @param url the URL of the audio clip
+ * @return the retrieved audio clip
+ * @throws NullPointerException if url is null
+ */
public AudioClip getAudioClip(URL url)
{
- return (getAppletContext ().getAudioClip (url));
+ return getAppletContext().getAudioClip(url);
}
/**
- * Returns an audio clip from the specified URL and name
- *
- * @param url The base URL of the audio clip.
- * @param name The name of the clip relative to the URL.
- *
- * @return The retrieved audio clip.
- */
+ * Returns an audio clip from the specified absolute URL, and relative path
+ * from that URL. Note that the clip is not actually retrieved until the
+ * applet attempts to play it, so this method returns immediately. This
+ * calls <code>getAudioClip(new URL(url, name))</code>, but if building
+ * the new URL fails, this returns null.
+ *
+ * @param url the base URL of the audio clip
+ * @param name the name of the clip relative to the URL
+ * @return the retrieved audio clip, or null on failure
+ * @see #getAudioClip(URL)
+ */
public AudioClip getAudioClip(URL url, String name)
{
try
{
- return (getAppletContext ().getAudioClip (new URL (url.toExternalForm()
- + name)));
+ return getAudioClip(new URL(url, name));
}
- catch(Exception e)
+ catch (MalformedURLException e)
{
- return (getAudioClip (url));
+ return null;
}
}
/**
- * Loads and plays the audio clip pointed to by the specified URL.
- *
- * @param The URL of the audio clip.
- */
- public void play (URL url)
+ * Returns a descriptive string with applet defined information. The
+ * implementation in this class returns <code>null</code>, so subclasses
+ * must override to return information.
+ *
+ * @return a string describing the author, version, and applet copyright
+ */
+ public String getAppletInfo()
{
- getAudioClip (url).play ();
+ return null;
}
/**
- * Loads and plays the audio clip pointed to by the specified URL.
- *
- * @param The base URL of the audio clip.
- * @param name The name of the audio clip relative to the URL.
- */
- public void play (URL url, String name)
+ * Returns the locale for this applet, if it has been set. If no applet
+ * specific locale has been set, the default locale is returned.
+ *
+ * @return the locale for this applet
+ * @see Component#setLocale(Locale)
+ * @since 1.1
+ */
+ public Locale getLocale()
{
- getAudioClip (url, name).play ();
+ return super.getLocale();
}
/**
- * Returns an image from the specified URL. Note that the image is not
- * actually retrieved until the applet attempts to display it, so this
- * method returns immediately.
- *
- * @param url The URL of the image.
- *
- * @return The retrieved image.
- */
- public Image getImage(URL url)
+ * Returns a list of parameters this applet supports. Each element of
+ * the outer array is an array of three strings with the name of the
+ * parameter, the data type or valid values, and a description. This
+ * method is optional and the default implementation returns null.
+ *
+ * @return the list of parameters supported by this applet
+ */
+ public String[][] getParameterInfo()
{
- return (getAppletContext ().getImage (url));
+ return null;
}
/**
- * Returns an image from the specified URL. Note that the image is not
- * actually retrieved until the applet attempts to display it, so this
- * method returns immediately.
- *
- * @param url The base URL of the image.
- * @param name The name of the image relative to the URL.
- *
- * @return The retrieved image.
- */
- public Image getImage(URL url, String name)
+ * Loads and plays the audio clip pointed to by the specified URL. This does
+ * nothing if the URL does not point to a valid audio clip.
+ *
+ * @param url the URL of the audio clip
+ * @throws NullPointerException if url is null
+ * @see #getAudioClip(URL)
+ */
+ public void play(URL url)
{
+ AudioClip ac = getAudioClip(url);
try
{
- return (getAppletContext ().getImage (new URL (url.toExternalForm()
- + name)));
+ ac.play();
}
- catch(Exception e)
+ catch (Exception ignored)
{
- return (getImage (url));
}
}
/**
- * Returns the locale for this applet, if it has been set. If no applet
- * specific locale has been set, the default locale is returned.
- *
- * @return The locale for this applet.
- */
- public Locale getLocale()
+ * Loads and plays the audio clip pointed to by the specified absolute URL,
+ * and relative path from that URL. This does nothing if the URL cannot be
+ * constructed, or if it does not point to a valid audio clip.
+ *
+ * @param url the base URL of the audio clip
+ * @param name the name of the audio clip relative to the URL
+ * @see #getAudioClip(URL, String)
+ * @see #play(URL)
+ */
+ public void play(URL url, String name)
{
- return (super.getLocale ());
+ try
+ {
+ getAudioClip(url, name).play();
+ }
+ catch (Exception ignored)
+ {
+ }
}
/**
- * Returns a descriptive string with applet defined information. The
- * implementation in this class returns <code>null</code>. Applets who
- * wish to return this information should override.
- *
- * @return A string describing the applet.
- */
- public String getAppletInfo()
+ * This method is called when the applet is first loaded, before start().
+ * The default implementation does nothing; override to do any one-time
+ * initialization.
+ *
+ * @see #start()
+ * @see #stop()
+ * @see #destroy()
+ */
+ public void init()
{
- return (null);
}
/**
- * Returns a list of parameters this applet supports. Each element of
- * the array is a list of three strings with the name of the parameter,
- * the data type or valid values, and a description. This method is
- * optional and the default implementation returns <code>null</code>.
- *
- * @return The list of parameters supported by this applet.
- */
- public String[][] getParameterInfo()
+ * This method is called when the applet should start running. This is
+ * normally each time a web page containing it is loaded. The default
+ * implemention does nothing; override for your applet to be useful.
+ *
+ * @see #init()
+ * @see #stop()
+ * @see #destroy()
+ */
+ public void start()
{
- return (null);
}
/**
- * This method is called when the applet is first loaded. The default
- * implementation does nothing. Applets that wish to do one time
- * initialization should override.
- */
- public void init() {}
+ * This method is called when the applet should stop running. This is
+ * normally when the next web page is loaded. The default implementation
+ * does nothing; override for your applet to stop using resources when
+ * it is no longer visible, but may be restarted soon.
+ *
+ * @see #init()
+ * @see #start()
+ * @see #destroy()
+ */
+ public void stop()
+ {
+ }
/**
- * This method is called when the applet is being unloaded. The default
- * implementation does nothing. Applets that need to clean up resources
- * on exit should override.
- */
- public void destroy() {}
+ * This method is called when the applet is being unloaded. The default
+ * implementation does nothing; override for your applet to clean up
+ * resources on exit.
+ *
+ * @see #init()
+ * @see #start()
+ * @see #stop()
+ */
+ public void destroy()
+ {
+ }
/**
- * This method is called when the applet should start running. This is
- * normally each time a web page containing it is loaded. The default
- * implemention does nothing. Subclasses should override.
- */
- public void start() {}
+ * Gets the AccessibleContext associated with this applet, creating one if
+ * necessary. This always returns an instance of {@link AccessibleApplet}.
+ *
+ * @return the accessibility context of this applet
+ * @since 1.3
+ */
+ public AccessibleContext getAccessibleContext()
+ {
+ if (accessibleContext == null)
+ accessibleContext = new AccessibleApplet();
+ return accessibleContext;
+ }
/**
- * This method is called when the applet should stop running. This is
- * normally when the next web page is loaded. The default implementation
- * does nothing.
- */
- public void stop() {}
+ * Read an applet from an object stream. This checks for a headless
+ * environment, then does the normal read.
+ *
+ * @param s the stream to read from
+ * @throws ClassNotFoundException if a class is not found
+ * @throws IOException if deserialization fails
+ * @throws HeadlessException if this is a headless environment
+ * @see GraphicsEnvironment#isHeadless()
+ * @since 1.4
+ */
+ private void readObject(ObjectInputStream s)
+ throws ClassNotFoundException, IOException
+ {
+ if (GraphicsEnvironment.isHeadless())
+ throw new HeadlessException();
+ s.defaultReadObject();
+ }
/**
- * The browser calls this method to set the applet's stub, which is the
- * low level interface to the browser.
- *
- * @param stub The applet stub for this applet.
- */
- public final void setStub (AppletStub stub)
+ * This class provides accessibility support for Applets, and is the
+ * runtime type returned by {@link #getAccessibleContext()}.
+ *
+ * @author Eric Blake <ebb9@email.byu.edu>
+ * @since 1.3
+ */
+ protected class AccessibleApplet extends AccessibleAWTPanel
{
- this.stub = stub;
- }
+ /**
+ * Compatible with JDK 1.4+.
+ */
+ private static final long serialVersionUID = 8127374778187708896L;
-} // class Applet
+ /**
+ * The default constructor.
+ */
+ protected AccessibleApplet()
+ {
+ }
+ /**
+ * Get the role of this accessible object, a frame.
+ *
+ * @return the role of the object
+ * @see AccessibleRole#FRAME
+ */
+ public AccessibleRole getAccessibleRole()
+ {
+ return AccessibleRole.FRAME;
+ }
+
+ /**
+ * Get the state set of this accessible object. In addition to the default
+ * states of a Component, the applet can also be active.
+ *
+ * @return the role of the object
+ * @see AccessibleState
+ */
+ public AccessibleStateSet getAccessibleStateSet()
+ {
+ AccessibleStateSet s = super.getAccessibleStateSet();
+ if (isActive())
+ s.add(AccessibleState.ACTIVE);
+ return s;
+ }
+ } // class AccessibleApplet
+} // class Applet
diff --git a/libjava/java/applet/AppletContext.java b/libjava/java/applet/AppletContext.java
index 86552abc2f8..13c077074b3 100644
--- a/libjava/java/applet/AppletContext.java
+++ b/libjava/java/applet/AppletContext.java
@@ -1,23 +1,23 @@
-/* AppletContext.java -- Access the applet's runtime environment.
- Copyright (C) 1999 Free Software Foundation, Inc.
-
+/* AppletContext.java -- access the applet's runtime environment
+ Copyright (C) 1999, 2002 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
@@ -39,81 +39,116 @@ exception statement from your version. */
package java.applet;
import java.awt.Image;
+import java.io.InputStream;
+import java.io.IOException;
import java.net.URL;
import java.util.Enumeration;
+import java.util.Iterator;
/**
- * This interface allows an applet access to the browser to retrieve
- * additional data files and display documents. It also allows the
- * applet to find out other applets in the same document.
- *
- * @author Aaron M. Renn (arenn@urbanophile.com)
- */
+ * This interface allows an applet access to the browser to retrieve
+ * additional data files and display documents. It also allows the
+ * applet to find out other applets in the same document.
+ *
+ * @author Aaron M. Renn (arenn@urbanophile.com)
+ * @since 1.0
+ * @status updated to 1.4
+ */
public interface AppletContext
{
/**
- * Returns an audio clip from the specified URL.
- *
- * @param url The URL of the audio clip.
- *
- * @return The retrieved audio clip // FIXME: What happens on error?
- */
+ * Returns an audio clip from the specified URL.
+ *
+ * @param url the URL of the audio clip
+ * @return the retrieved audio clip
+ * @throws NullPointerException if url is null
+ */
AudioClip getAudioClip(URL url);
/**
- * Returns an image from the specified URL. Note that the image is not
- * actually retrieved until the applet attempts to display it, so this
- * method returns immediately.
- *
- * @param url The URL of the image.
- *
- * @return The retrieved image. // FIXME: What happens on eror?
- */
+ * Returns an image from the specified URL. Note that the image is not
+ * actually retrieved until the applet attempts to display it, so this
+ * method returns immediately.
+ *
+ * @param url the absolute URL of the image
+ * @return the retrieved image
+ * @throws NullPointerException if url is null
+ */
Image getImage(URL url);
/**
- * Returns the applet in the document for this object that has the
- * specified name.
- *
- * @param name The applet name.
- *
- * @return The requested applet, or <code>null</code> if an applet with
- * the requested name cannot be found.
- */
+ * Returns the applet in the document for this object that has the
+ * specified name.
+ *
+ * @param name the applet name
+ * @return the requested applet, or <code>null</code> if not found
+ */
Applet getApplet(String name);
/**
- * Returns a list of all the applets in the document for this object.
- *
- * @return A list of all the applets in the document for this object.
- */
+ * Returns a list of all the applets in the document for this object.
+ *
+ * @return a list of all the applets
+ */
Enumeration getApplets();
/**
- * Displays the web page pointed to by the specified URL in the window
- * for this object. This page replaces the document that is currently
- * there.
- *
- * @param url The URL of the web page to load.
- */
+ * Displays the web page pointed to by the specified URL in the window
+ * for this object. This page replaces the document that is currently
+ * there.
+ *
+ * @param url the URL of the web page to load; unspecified on an error
+ */
void showDocument(URL url);
/**
- * Displays the web page pointed to be the sepcified URL in the window
- * with the specified name. The standard names "_top", "_blank",
- * "_parent", and "_self" are allowed.
- *
- * @param url The URL of the web page to load.
- * @param target The target window.
- */
+ * Displays the web page pointed to be the sepcified URL in the window
+ * with the specified name. The standard names "_top", "_blank",
+ * "_parent", and "_self" are allowed. An applet viewer may disregard
+ * this request.
+ *
+ * @param url the URL of the web page to load
+ * @param target the target window
+ */
void showDocument(URL url, String target);
/**
- * Displays the specified message in the status window if that window
- * exists.
- *
- * @param message The status message.
- */
+ * Displays the specified message in the status window if that window
+ * exists.
+ *
+ * @param message the status message, may be null
+ */
void showStatus(String message);
+ /**
+ * Associate a stream to a key for this applet context, possibly replacing
+ * the old value. Stream associations are local to the applet context, for
+ * security purposes.
+ *
+ * @param key the key to associate with
+ * @param stream the stream value to tie to the key, or null to remove
+ * @throws IOException if the stream is too large
+ * @since 1.4
+ */
+ void setStream(String key, InputStream stream) throws IOException;
+
+ /**
+ * Return the stream associated with a given key in this applet context, or
+ * null if nothing is associated. Stream associations are local to the
+ * applet context, for security purposes.
+ *
+ * @param key the key to look up
+ * @return the associated stream, or null
+ * @since 1.4
+ */
+ InputStream getStream(String key);
+
+ /**
+ * Iterate over all keys that have associated streams. Stream associated
+ * are local to the applet context, for security purposes.
+ *
+ * @return an iterator over the association keys
+ * @since 1.4
+ */
+ Iterator getStreamKeys();
} // interface AppletContext
diff --git a/libjava/java/applet/AppletStub.java b/libjava/java/applet/AppletStub.java
index 5ec428a6f2b..7694cc822ef 100644
--- a/libjava/java/applet/AppletStub.java
+++ b/libjava/java/applet/AppletStub.java
@@ -1,23 +1,23 @@
-/* AppletStub.java -- Low level interface to the browser.
- Copyright (C) 1999 Free Software Foundation, Inc.
-
+/* AppletStub.java -- low level interface to the browser
+ Copyright (C) 1999, 2002 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
@@ -40,60 +40,63 @@ package java.applet;
import java.net.URL;
/**
- * This interface is the low level interface between the applet and the
- * browser.
- *
- * @author Aaron M. Renn (arenn@urbanophile.com)
- */
+ * This interface is the low level interface between the applet and the
+ * browser.
+ *
+ * @author Aaron M. Renn (arenn@urbanophile.com)
+ * @see Applet#setStub(AppletStub)
+ * @since 1.0
+ * @status updated to 1.4
+ */
public interface AppletStub
{
/**
- * Returns the URL of the document this applet is embedded in.
- *
- * @return The URL of the document this applet is embedded in.
- */
+ * Tests whether or not this applet is currently active. An applet is active
+ * just before the browser invokes start(), and becomes inactive just
+ * before the browser invokes stop().
+ *
+ * @return <code>true</code> if this applet is active
+ */
+ boolean isActive();
+
+ /**
+ * Returns the basename URL of the document this applet is embedded in. This
+ * is everything up to the final '/'.
+ *
+ * @return the URL of the document this applet is embedded in
+ * @see #getCodeBase()
+ */
URL getDocumentBase();
/**
- * Returns the URL of the code base for this applet.
- *
- * @return The URL of the code base for this applet.
- */
+ * Returns the URL of the code base for this applet.
+ *
+ * @return the URL of the code base for this applet
+ */
URL getCodeBase();
/**
- * Returns the value of the specified parameter that was specified in
- * the &lt;APPLET&gt; tag for this applet.
- *
- * @param name The parameter name.
- *
- * @param value The parameter value, or <code>null</code> if the parameter
- * does not exist.
- */
+ * Returns the value of the specified parameter that was specified in
+ * the <code>&lt;APPLET&gt;</code> tag for this applet.
+ *
+ * @param name the parameter name
+ * @return the parameter value, or null if the parameter does not exist
+ * @throws NullPointerException if name is null
+ */
String getParameter(String name);
/**
- * Returns the applet context for this applet.
- *
- * @return The applet context for this applet.
- */
+ * Returns the applet context for this applet.
+ *
+ * @return the applet context for this applet
+ */
AppletContext getAppletContext();
/**
- * Tests whether or not this applet is currently active.
- *
- * @return <code>true</code> if this applet is active, <code>false</code>
- * otherwise.
- */
- boolean isActive();
-
- /**
- * Requests that the applet window for this applet be resized.
- *
- * @param width The new width in pixels.
- * @param height The new height in pixels.
- */
+ * Requests that the applet window for this applet be resized.
+ *
+ * @param width the new width in pixels
+ * @param height the new height in pixels
+ */
void appletResize(int width, int height);
-
} // interface AppletStub
-
diff --git a/libjava/java/applet/AudioClip.java b/libjava/java/applet/AudioClip.java
index 97cf9008a66..41dd3be2af5 100644
--- a/libjava/java/applet/AudioClip.java
+++ b/libjava/java/applet/AudioClip.java
@@ -1,23 +1,23 @@
-/* AudioClip.java -- Play an audio clip.
- Copyright (C) 1999 Free Software Foundation, Inc.
-
+/* AudioClip.java -- play an audio clip in an applet
+ Copyright (C) 1999, 2002 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
@@ -39,26 +39,29 @@ exception statement from your version. */
package java.applet;
/**
- * This interface provides a simple mechanism for playing audio clips.
- *
- * @author Aaron M. Renn (arenn@urbanophile.com)
- */
+ * This interface provides a simple mechanism for playing audio clips.
+ * If multiple clips are played at once, the browser combines them into a
+ * composite clip.
+ *
+ * @author Aaron M. Renn (arenn@urbanophile.com)
+ * @since 1.0
+ * @status updated to 1.4
+ */
public interface AudioClip
{
/**
- * Plays the audio clip starting from the beginning.
- */
+ * Plays the audio clip starting from the beginning.
+ */
void play();
/**
- * Stops playing this audio clip. There is no mechanism for restarting
- * at the point where the clip is stopped.
- */
+ * Stops playing this audio clip. There is no mechanism for restarting
+ * at the point where the clip is stopped.
+ */
void stop();
/**
- * Plays this audio clip in a continuous loop.
- */
+ * Plays this audio clip in a continuous loop.
+ */
void loop();
-
} // interface AudioClip
diff --git a/libjava/java/awt/BorderLayout.java b/libjava/java/awt/BorderLayout.java
index d1bbd1f235a..930773f0142 100644
--- a/libjava/java/awt/BorderLayout.java
+++ b/libjava/java/awt/BorderLayout.java
@@ -529,80 +529,83 @@ invalidateLayout(Container parent)
public void
layoutContainer(Container target)
{
- Insets i = target.getInsets();
-
- ComponentOrientation orient = target.getComponentOrientation ();
- boolean left_to_right = orient.isLeftToRight ();
-
- Component my_north = north;
- Component my_east = east;
- Component my_south = south;
- Component my_west = west;
-
- // Note that we currently don't handle vertical layouts. Neither
- // does JDK 1.3.
- if (firstLine != null)
- my_north = firstLine;
- if (lastLine != null)
- my_south = lastLine;
- if (firstItem != null)
+ synchronized (target.getTreeLock ())
{
- if (left_to_right)
- my_west = firstItem;
- else
- my_east = firstItem;
+ Insets i = target.getInsets();
+
+ ComponentOrientation orient = target.getComponentOrientation ();
+ boolean left_to_right = orient.isLeftToRight ();
+
+ Component my_north = north;
+ Component my_east = east;
+ Component my_south = south;
+ Component my_west = west;
+
+ // Note that we currently don't handle vertical layouts. Neither
+ // does JDK 1.3.
+ if (firstLine != null)
+ my_north = firstLine;
+ if (lastLine != null)
+ my_south = lastLine;
+ if (firstItem != null)
+ {
+ if (left_to_right)
+ my_west = firstItem;
+ else
+ my_east = firstItem;
+ }
+ if (lastItem != null)
+ {
+ if (left_to_right)
+ my_east = lastItem;
+ else
+ my_west = lastItem;
+ }
+
+ Dimension c = calcCompSize(center, PREF);
+ Dimension n = calcCompSize(my_north, PREF);
+ Dimension s = calcCompSize(my_south, PREF);
+ Dimension e = calcCompSize(my_east, PREF);
+ Dimension w = calcCompSize(my_west, PREF);
+ Dimension t = target.getSize();
+
+ /*
+ <-> hgap <-> hgap
+ +----------------------------+ }
+ |t | } i.top
+ | +----------------------+ | --- y1 }
+ | |n | |
+ | +----------------------+ | } vgap
+ | +---+ +----------+ +---+ | --- y2 } }
+ | |w | |c | |e | | } hh
+ | +---+ +----------+ +---+ | } vgap }
+ | +----------------------+ | --- y3 }
+ | |s | |
+ | +----------------------+ | }
+ | | } i.bottom
+ +----------------------------+ }
+ |x1 |x2 |x3
+ <---------------------->
+ <--> ww <-->
+ i.left i.right
+ */
+
+ int x1 = i.left;
+ int x2 = x1 + w.width + hgap;
+ int x3 = t.width - i.right - e.width;
+ int ww = t.width - i.right - i.left;
+
+ int y1 = i.top;
+ int y2 = y1 + n.height + vgap;
+ int y3 = t.height - i.bottom - s.height;
+ int hh = y3-y2-vgap;
+
+ setBounds(center, x2, y2, x3-x2-hgap, hh);
+ setBounds(my_north, x1, y1, ww, n.height);
+ setBounds(my_south, x1, y3, ww, s.height);
+ setBounds(my_west, x1, y2, w.width, hh);
+ setBounds(my_east, x3, y2, e.width, hh);
}
- if (lastItem != null)
- {
- if (left_to_right)
- my_east = lastItem;
- else
- my_west = lastItem;
- }
-
- Dimension c = calcCompSize(center, PREF);
- Dimension n = calcCompSize(my_north, PREF);
- Dimension s = calcCompSize(my_south, PREF);
- Dimension e = calcCompSize(my_east, PREF);
- Dimension w = calcCompSize(my_west, PREF);
- Dimension t = target.getSize();
-
- /*
- <-> hgap <-> hgap
- +----------------------------+ }
- |t | } i.top
- | +----------------------+ | --- y1 }
- | |n | |
- | +----------------------+ | } vgap
- | +---+ +----------+ +---+ | --- y2 } }
- | |w | |c | |e | | } hh
- | +---+ +----------+ +---+ | } vgap }
- | +----------------------+ | --- y3 }
- | |s | |
- | +----------------------+ | }
- | | } i.bottom
- +----------------------------+ }
- |x1 |x2 |x3
- <---------------------->
- <--> ww <-->
- i.left i.right
- */
-
- int x1 = i.left;
- int x2 = x1 + w.width + hgap;
- int x3 = t.width - i.right - e.width;
- int ww = t.width - i.right - i.left;
-
- int y1 = i.top;
- int y2 = y1 + n.height + vgap;
- int y3 = t.height - i.bottom - s.height;
- int hh = y3-y2-vgap;
-
- setBounds(center, x2, y2, x3-x2-hgap, hh);
- setBounds(my_north, x1, y1, ww, n.height);
- setBounds(my_south, x1, y3, ww, s.height);
- setBounds(my_west, x1, y2, w.width, hh);
- setBounds(my_east, x3, y2, e.width, hh);
}
/*************************************************************************/
@@ -648,59 +651,62 @@ calcCompSize(Component comp, int what)
private Dimension
calcSize(Container target, int what)
{
- Insets ins = target.getInsets();
-
- ComponentOrientation orient = target.getComponentOrientation ();
- boolean left_to_right = orient.isLeftToRight ();
-
- Component my_north = north;
- Component my_east = east;
- Component my_south = south;
- Component my_west = west;
-
- // Note that we currently don't handle vertical layouts. Neither
- // does JDK 1.3.
- if (firstLine != null)
- my_north = firstLine;
- if (lastLine != null)
- my_south = lastLine;
- if (firstItem != null)
+ synchronized (target.getTreeLock ())
{
- if (left_to_right)
- my_west = firstItem;
- else
- my_east = firstItem;
- }
- if (lastItem != null)
- {
- if (left_to_right)
- my_east = lastItem;
- else
- my_west = lastItem;
- }
+ Insets ins = target.getInsets();
+
+ ComponentOrientation orient = target.getComponentOrientation ();
+ boolean left_to_right = orient.isLeftToRight ();
+
+ Component my_north = north;
+ Component my_east = east;
+ Component my_south = south;
+ Component my_west = west;
+
+ // Note that we currently don't handle vertical layouts. Neither
+ // does JDK 1.3.
+ if (firstLine != null)
+ my_north = firstLine;
+ if (lastLine != null)
+ my_south = lastLine;
+ if (firstItem != null)
+ {
+ if (left_to_right)
+ my_west = firstItem;
+ else
+ my_east = firstItem;
+ }
+ if (lastItem != null)
+ {
+ if (left_to_right)
+ my_east = lastItem;
+ else
+ my_west = lastItem;
+ }
- Dimension ndim = calcCompSize(my_north, what);
- Dimension sdim = calcCompSize(my_south, what);
- Dimension edim = calcCompSize(my_east, what);
- Dimension wdim = calcCompSize(my_west, what);
- Dimension cdim = calcCompSize(center, what);
+ Dimension ndim = calcCompSize(my_north, what);
+ Dimension sdim = calcCompSize(my_south, what);
+ Dimension edim = calcCompSize(my_east, what);
+ Dimension wdim = calcCompSize(my_west, what);
+ Dimension cdim = calcCompSize(center, what);
- int width = edim.width + cdim.width + wdim.width + (hgap * 2);
- if (ndim.width > width)
- width = ndim.width;
- if (sdim.width > width)
- width = sdim.width;
+ int width = edim.width + cdim.width + wdim.width + (hgap * 2);
+ if (ndim.width > width)
+ width = ndim.width;
+ if (sdim.width > width)
+ width = sdim.width;
- width += (ins.left + ins.right);
+ width += (ins.left + ins.right);
- int height = edim.height;
- if (cdim.height > height)
- height = cdim.height;
- if (wdim.height > height)
- height = wdim.height;
+ int height = edim.height;
+ if (cdim.height > height)
+ height = cdim.height;
+ if (wdim.height > height)
+ height = wdim.height;
- height += (ndim.height + sdim.height + (vgap * 2) + ins.top + ins.bottom);
+ height += (ndim.height + sdim.height + (vgap * 2) + ins.top + ins.bottom);
- return(new Dimension(width, height));
+ return(new Dimension(width, height));
+ }
}
} // class BorderLayout
diff --git a/libjava/java/awt/CardLayout.java b/libjava/java/awt/CardLayout.java
index 5bdb4acf98d..10ffa2ec6c2 100644
--- a/libjava/java/awt/CardLayout.java
+++ b/libjava/java/awt/CardLayout.java
@@ -53,6 +53,8 @@ import java.io.Serializable;
*/
public class CardLayout implements LayoutManager2, Serializable
{
+ static final long serialVersionUID = -4328196481005934313L;
+
/**
* Initializes a new instance of <code>CardLayout</code> with horizontal
* and vertical gaps of 0.
@@ -163,21 +165,24 @@ public class CardLayout implements LayoutManager2, Serializable
*/
public void layoutContainer (Container parent)
{
- int width = parent.width;
- int height = parent.height;
+ synchronized (parent.getTreeLock ())
+ {
+ int width = parent.width;
+ int height = parent.height;
- Insets ins = parent.getInsets ();
+ Insets ins = parent.getInsets ();
- int num = parent.ncomponents;
- Component[] comps = parent.component;
+ int num = parent.ncomponents;
+ Component[] comps = parent.component;
- int x = ins.left + hgap;
- int y = ins.top + vgap;
- width = width - 2 * hgap - ins.left - ins.right;
- height = height - 2 * vgap - ins.top - ins.bottom;
+ int x = ins.left + hgap;
+ int y = ins.top + vgap;
+ width = width - 2 * hgap - ins.left - ins.right;
+ height = height - 2 * vgap - ins.top - ins.bottom;
- for (int i = 0; i < num; ++i)
- comps[i].setBounds (x, y, width, height);
+ for (int i = 0; i < num; ++i)
+ comps[i].setBounds (x, y, width, height);
+ }
}
/** Get the maximum layout size of the container.
@@ -285,91 +290,97 @@ public class CardLayout implements LayoutManager2, Serializable
private void gotoComponent (Container parent, int what,
Component target)
{
- int num = parent.ncomponents;
- // This is more efficient than calling getComponents().
- Component[] comps = parent.component;
- int choice = -1;
-
- if (what == FIRST)
- choice = 0;
- else if (what == LAST)
- choice = num - 1;
- else if (what >= 0)
- choice = what;
-
- for (int i = 0; i < num; ++i)
+ synchronized (parent.getTreeLock ())
{
- // If TARGET is set then we are looking for a specific
- // component.
- if (target != null)
+ int num = parent.ncomponents;
+ // This is more efficient than calling getComponents().
+ Component[] comps = parent.component;
+ int choice = -1;
+
+ if (what == FIRST)
+ choice = 0;
+ else if (what == LAST)
+ choice = num - 1;
+ else if (what >= 0)
+ choice = what;
+
+ for (int i = 0; i < num; ++i)
{
- if (target == comps[i])
- choice = i;
- }
-
- if (comps[i].isVisible ())
- {
- if (what == NEXT)
- {
- choice = i + 1;
- if (choice == num)
- choice = 0;
- }
- else if (what == PREV)
+ // If TARGET is set then we are looking for a specific
+ // component.
+ if (target != null)
{
- choice = i - 1;
- if (choice < 0)
- choice = num - 1;
+ if (target == comps[i])
+ choice = i;
}
- else if (choice == i)
+
+ if (comps[i].isVisible ())
{
- // Do nothing if we're already looking at the right
- // component.
- return;
+ if (what == NEXT)
+ {
+ choice = i + 1;
+ if (choice == num)
+ choice = 0;
+ }
+ else if (what == PREV)
+ {
+ choice = i - 1;
+ if (choice < 0)
+ choice = num - 1;
+ }
+ else if (choice == i)
+ {
+ // Do nothing if we're already looking at the right
+ // component.
+ return;
+ }
+ comps[i].setVisible (false);
+
+ if (choice >= 0)
+ break;
}
- comps[i].setVisible (false);
-
- if (choice >= 0)
- break;
}
- }
- if (choice >= 0 && choice < num)
- comps[choice].setVisible (true);
+ if (choice >= 0 && choice < num)
+ comps[choice].setVisible (true);
+ }
}
// Compute the size according to WHAT.
private Dimension getSize (Container parent, int what)
{
- int w = 0, h = 0, num = parent.ncomponents;
- Component[] comps = parent.component;
-
- for (int i = 0; i < num; ++i)
+ synchronized (parent.getTreeLock ())
{
- Dimension d;
+ int w = 0, h = 0, num = parent.ncomponents;
+ Component[] comps = parent.component;
- if (what == MIN)
- d = comps[i].getMinimumSize ();
- else if (what == MAX)
- d = comps[i].getMaximumSize ();
- else
- d = comps[i].getPreferredSize ();
+ for (int i = 0; i < num; ++i)
+ {
+ Dimension d;
- w = Math.max (d.width, w);
- h = Math.max (d.height, h);
- }
+ if (what == MIN)
+ d = comps[i].getMinimumSize ();
+ else if (what == MAX)
+ d = comps[i].getMaximumSize ();
+ else
+ d = comps[i].getPreferredSize ();
+
+ w = Math.max (d.width, w);
+ h = Math.max (d.height, h);
+ }
- Insets i = parent.getInsets ();
- w += 2 * hgap + i.right + i.left;
- h += 2 * vgap + i.bottom + i.top;
+ Insets i = parent.getInsets ();
+ w += 2 * hgap + i.right + i.left;
+ h += 2 * vgap + i.bottom + i.top;
- // Handle overflow.
- if (w < 0)
- w = Integer.MAX_VALUE;
- if (h < 0)
- h = Integer.MAX_VALUE;
+ // Handle overflow.
+ if (w < 0)
+ w = Integer.MAX_VALUE;
+ if (h < 0)
+ h = Integer.MAX_VALUE;
- return new Dimension (w, h);
+ return new Dimension (w, h);
+ }
}
/**
diff --git a/libjava/java/awt/Choice.java b/libjava/java/awt/Choice.java
index ab04c21cda5..81a2a31c932 100644
--- a/libjava/java/awt/Choice.java
+++ b/libjava/java/awt/Choice.java
@@ -215,7 +215,7 @@ insert(String item, int index)
*
* @param item The item to remove.
*
- * @param IllegalArgumentException If the specified item doesn't exist.
+ * @exception IllegalArgumentException If the specified item doesn't exist.
*/
public synchronized void
remove(String item)
@@ -234,7 +234,7 @@ remove(String item)
*
* @param index The index of the item to remove.
*
- * @exception ArrayIndexOutOfBoundsException If the index is not valid.
+ * @exception IndexOutOfBoundsException If the index is not valid.
*/
public synchronized void
remove(int index)
@@ -325,7 +325,7 @@ getSelectedIndex()
*
* @param index The index of the row to make selected.
*
- * @param IllegalArgumentException If the specified index is invalid.
+ * @exception IllegalArgumentException If the specified index is invalid.
*/
public synchronized void
select(int index)
diff --git a/libjava/java/awt/Container.java b/libjava/java/awt/Container.java
index c5c7c245606..dd2390d35ba 100644
--- a/libjava/java/awt/Container.java
+++ b/libjava/java/awt/Container.java
@@ -123,9 +123,12 @@ public class Container extends Component
*/
public Component getComponent(int n)
{
- if (n < 0 || n >= ncomponents)
- throw new ArrayIndexOutOfBoundsException("no such component");
- return component[n];
+ synchronized (getTreeLock ())
+ {
+ if (n < 0 || n >= ncomponents)
+ throw new ArrayIndexOutOfBoundsException("no such component");
+ return component[n];
+ }
}
/**
@@ -135,10 +138,13 @@ public class Container extends Component
*/
public Component[] getComponents()
{
- Component[] result = new Component[ncomponents];
- if (ncomponents > 0)
- System.arraycopy(component, 0, result, 0, ncomponents);
- return result;
+ synchronized (getTreeLock ())
+ {
+ Component[] result = new Component[ncomponents];
+ if (ncomponents > 0)
+ System.arraycopy(component, 0, result, 0, ncomponents);
+ return result;
+ }
}
/**
@@ -205,7 +211,7 @@ public class Container extends Component
*
* @return The same component that was added.
*
- * @param throws ArrayIndexOutOfBounds If the specified index is invalid.
+ * @throws ArrayIndexOutOfBounds If the specified index is invalid.
*/
public Component add(Component comp, int index)
{
@@ -236,7 +242,7 @@ public class Container extends Component
* @param index The index in the component list to insert this child
* at, or -1 to add at the end of the list.
*
- * @param throws ArrayIndexOutOfBounds If the specified index is invalid.
+ * @throws ArrayIndexOutOfBounds If the specified index is invalid.
*/
public void add(Component comp, Object constraints, int index)
{
@@ -256,73 +262,76 @@ public class Container extends Component
* @param index The index in the component list to insert this child
* at, or -1 to add at the end of the list.
*
- * @param throws ArrayIndexOutOfBounds If the specified index is invalid.
+ * @throws ArrayIndexOutOfBounds If the specified index is invalid.
*/
protected void addImpl(Component comp, Object constraints, int index)
{
- if (index > ncomponents
- || (index < 0 && index != -1)
- || comp instanceof Window
- || (comp instanceof Container
- && ((Container) comp).isAncestorOf(this)))
- throw new IllegalArgumentException();
-
- // Reparent component, and make sure component is instantiated if
- // we are.
- if (comp.parent != null)
- comp.parent.remove(comp);
- comp.parent = this;
- if (peer != null)
- {
- comp.addNotify();
-
- if (comp.isLightweight())
- enableEvents(comp.eventMask);
- }
-
- invalidate();
-
- if (component == null)
- component = new Component[4]; // FIXME, better initial size?
-
- // This isn't the most efficient implementation. We could do less
- // copying when growing the array. It probably doesn't matter.
- if (ncomponents >= component.length)
- {
- int nl = component.length * 2;
- Component[] c = new Component[nl];
- System.arraycopy(component, 0, c, 0, ncomponents);
- component = c;
- }
- if (index == -1)
- component[ncomponents++] = comp;
- else
- {
- System.arraycopy(component, index, component, index + 1,
- ncomponents - index);
- component[index] = comp;
- ++ncomponents;
- }
-
- // Notify the layout manager.
- if (layoutMgr != null)
+ synchronized (getTreeLock ())
{
- if (layoutMgr instanceof LayoutManager2)
- {
- LayoutManager2 lm2 = (LayoutManager2) layoutMgr;
- lm2.addLayoutComponent(comp, constraints);
- }
- else if (constraints instanceof String)
- layoutMgr.addLayoutComponent((String) constraints, comp);
- else
- layoutMgr.addLayoutComponent(null, comp);
+ if (index > ncomponents
+ || (index < 0 && index != -1)
+ || comp instanceof Window
+ || (comp instanceof Container
+ && ((Container) comp).isAncestorOf(this)))
+ throw new IllegalArgumentException();
+
+ // Reparent component, and make sure component is instantiated if
+ // we are.
+ if (comp.parent != null)
+ comp.parent.remove(comp);
+ comp.parent = this;
+ if (peer != null)
+ {
+ comp.addNotify();
+
+ if (comp.isLightweight())
+ enableEvents(comp.eventMask);
+ }
+
+ invalidate();
+
+ if (component == null)
+ component = new Component[4]; // FIXME, better initial size?
+
+ // This isn't the most efficient implementation. We could do less
+ // copying when growing the array. It probably doesn't matter.
+ if (ncomponents >= component.length)
+ {
+ int nl = component.length * 2;
+ Component[] c = new Component[nl];
+ System.arraycopy(component, 0, c, 0, ncomponents);
+ component = c;
+ }
+ if (index == -1)
+ component[ncomponents++] = comp;
+ else
+ {
+ System.arraycopy(component, index, component, index + 1,
+ ncomponents - index);
+ component[index] = comp;
+ ++ncomponents;
+ }
+
+ // Notify the layout manager.
+ if (layoutMgr != null)
+ {
+ if (layoutMgr instanceof LayoutManager2)
+ {
+ LayoutManager2 lm2 = (LayoutManager2) layoutMgr;
+ lm2.addLayoutComponent(comp, constraints);
+ }
+ else if (constraints instanceof String)
+ layoutMgr.addLayoutComponent((String) constraints, comp);
+ else
+ layoutMgr.addLayoutComponent(null, comp);
+ }
+
+ // Post event to notify of adding the container.
+ ContainerEvent ce = new ContainerEvent(this,
+ ContainerEvent.COMPONENT_ADDED,
+ comp);
+ getToolkit().getSystemEventQueue().postEvent(ce);
}
-
- // Post event to notify of adding the container.
- ContainerEvent ce = new ContainerEvent(this,
- ContainerEvent.COMPONENT_ADDED,
- comp);
- getToolkit().getSystemEventQueue().postEvent(ce);
}
/**
@@ -332,24 +341,27 @@ public class Container extends Component
*/
public void remove(int index)
{
- Component r = component[index];
+ synchronized (getTreeLock ())
+ {
+ Component r = component[index];
- r.removeNotify();
+ r.removeNotify();
- System.arraycopy(component, index + 1, component, index,
- ncomponents - index - 1);
- component[--ncomponents] = null;
+ System.arraycopy(component, index + 1, component, index,
+ ncomponents - index - 1);
+ component[--ncomponents] = null;
- invalidate();
+ invalidate();
- if (layoutMgr != null)
- layoutMgr.removeLayoutComponent(r);
+ if (layoutMgr != null)
+ layoutMgr.removeLayoutComponent(r);
- // Post event to notify of adding the container.
- ContainerEvent ce = new ContainerEvent(this,
- ContainerEvent.COMPONENT_REMOVED,
- r);
- getToolkit().getSystemEventQueue().postEvent(ce);
+ // Post event to notify of adding the container.
+ ContainerEvent ce = new ContainerEvent(this,
+ ContainerEvent.COMPONENT_REMOVED,
+ r);
+ getToolkit().getSystemEventQueue().postEvent(ce);
+ }
}
/**
@@ -359,13 +371,16 @@ public class Container extends Component
*/
public void remove(Component comp)
{
- for (int i = 0; i < ncomponents; ++i)
+ synchronized (getTreeLock ())
{
- if (component[i] == comp)
- {
- remove(i);
- break;
- }
+ for (int i = 0; i < ncomponents; ++i)
+ {
+ if (component[i] == comp)
+ {
+ remove(i);
+ break;
+ }
+ }
}
}
@@ -374,8 +389,11 @@ public class Container extends Component
*/
public void removeAll()
{
- while (ncomponents > 0)
- remove(0);
+ synchronized (getTreeLock ())
+ {
+ while (ncomponents > 0)
+ remove(0);
+ }
}
/**
@@ -433,8 +451,7 @@ public class Container extends Component
*/
public void validate()
{
- // FIXME: use the tree lock?
- synchronized (this)
+ synchronized (getTreeLock ())
{
if (! isValid())
{
@@ -713,7 +730,8 @@ public class Container extends Component
{
if (e instanceof ContainerEvent)
processContainerEvent((ContainerEvent) e);
- else super.processEvent(e);
+ else
+ super.processEvent(e);
}
/**
@@ -764,20 +782,23 @@ public class Container extends Component
*/
public Component getComponentAt(int x, int y)
{
- if (! contains(x, y))
- return null;
- for (int i = 0; i < ncomponents; ++i)
+ synchronized (getTreeLock ())
{
- // Ignore invisible children...
- if (!component[i].isVisible())
- continue;
-
- int x2 = x - component[i].x;
- int y2 = y - component[i].y;
- if (component[i].contains(x2, y2))
- return component[i];
+ if (! contains(x, y))
+ return null;
+ for (int i = 0; i < ncomponents; ++i)
+ {
+ // Ignore invisible children...
+ if (!component[i].isVisible())
+ continue;
+
+ int x2 = x - component[i].x;
+ int y2 = y - component[i].y;
+ if (component[i].contains(x2, y2))
+ return component[i];
+ }
+ return this;
}
- return this;
}
/**
@@ -818,31 +839,34 @@ public class Container extends Component
public Component findComponentAt(int x, int y)
{
- if (! contains(x, y))
- return null;
-
- for (int i = 0; i < ncomponents; ++i)
+ synchronized (getTreeLock ())
{
- // Ignore invisible children...
- if (!component[i].isVisible())
- continue;
-
- int x2 = x - component[i].x;
- int y2 = y - component[i].y;
- // We don't do the contains() check right away because
- // findComponentAt would redundantly do it first thing.
- if (component[i] instanceof Container)
- {
- Container k = (Container) component[i];
- Component r = k.findComponentAt(x2, y2);
- if (r != null)
- return r;
- }
- else if (component[i].contains(x2, y2))
- return component[i];
+ if (! contains(x, y))
+ return null;
+
+ for (int i = 0; i < ncomponents; ++i)
+ {
+ // Ignore invisible children...
+ if (!component[i].isVisible())
+ continue;
+
+ int x2 = x - component[i].x;
+ int y2 = y - component[i].y;
+ // We don't do the contains() check right away because
+ // findComponentAt would redundantly do it first thing.
+ if (component[i] instanceof Container)
+ {
+ Container k = (Container) component[i];
+ Component r = k.findComponentAt(x2, y2);
+ if (r != null)
+ return r;
+ }
+ else if (component[i].contains(x2, y2))
+ return component[i];
+ }
+
+ return this;
}
-
- return this;
}
public Component findComponentAt(Point p)
@@ -868,9 +892,12 @@ public class Container extends Component
*/
public void removeNotify()
{
- for (int i = 0; i < ncomponents; ++i)
- component[i].removeNotify();
- super.removeNotify();
+ synchronized (getTreeLock ())
+ {
+ for (int i = 0; i < ncomponents; ++i)
+ component[i].removeNotify();
+ super.removeNotify();
+ }
}
/**
@@ -880,17 +907,20 @@ public class Container extends Component
* @param component The component to test.
*
* @return <code>true</code> if this container is an ancestor of the
- * specified component, <code>false</code>.
+ * specified component, <code>false</code> otherwise.
*/
public boolean isAncestorOf(Component comp)
{
- while (true)
+ synchronized (getTreeLock ())
{
- if (comp == null)
- return false;
- if (comp == this)
- return true;
- comp = comp.getParent();
+ while (true)
+ {
+ if (comp == null)
+ return false;
+ if (comp == this)
+ return true;
+ comp = comp.getParent();
+ }
}
}
@@ -918,9 +948,12 @@ public class Container extends Component
*/
public void list(PrintStream out, int indent)
{
- super.list(out, indent);
- for (int i = 0; i < ncomponents; ++i)
- component[i].list(out, indent + 2);
+ synchronized (getTreeLock ())
+ {
+ super.list(out, indent);
+ for (int i = 0; i < ncomponents; ++i)
+ component[i].list(out, indent + 2);
+ }
}
/**
@@ -932,9 +965,12 @@ public class Container extends Component
*/
public void list(PrintWriter out, int indent)
{
- super.list(out, indent);
- for (int i = 0; i < ncomponents; ++i)
- component[i].list(out, indent + 2);
+ synchronized (getTreeLock ())
+ {
+ super.list(out, indent);
+ for (int i = 0; i < ncomponents; ++i)
+ component[i].list(out, indent + 2);
+ }
}
public void setFocusTraversalKeys(int id, Set keys)
@@ -1006,16 +1042,17 @@ public class Container extends Component
private void visitChildren(Graphics gfx, GfxVisitor visitor,
boolean lightweightOnly)
{
- // FIXME: do locking
-
- for (int i = 0; i < ncomponents; ++i)
+ synchronized (getTreeLock ())
{
- Component comp = component[i];
- boolean applicable = comp.isVisible()
- && (comp.isLightweight() || !lightweightOnly);
-
- if (applicable)
- visitChild(gfx, visitor, comp);
+ for (int i = 0; i < ncomponents; ++i)
+ {
+ Component comp = component[i];
+ boolean applicable = comp.isVisible()
+ && (comp.isLightweight() || !lightweightOnly);
+
+ if (applicable)
+ visitChild(gfx, visitor, comp);
+ }
}
}
@@ -1061,59 +1098,65 @@ public class Container extends Component
// This is used to implement Component.transferFocus.
Component findNextFocusComponent(Component child)
{
- int start, end;
- if (child != null)
- {
- for (start = 0; start < ncomponents; ++start)
- {
- if (component[start] == child)
- break;
- }
- end = start;
- // This special case lets us be sure to terminate.
- if (end == 0)
- end = ncomponents;
- ++start;
- }
- else
- {
- start = 0;
- end = ncomponents;
- }
-
- for (int j = start; j != end; ++j)
+ synchronized (getTreeLock ())
{
- if (j >= ncomponents)
- {
- // The JCL says that we should wrap here. However, that
- // seems wrong. To me it seems that focus order should be
- // global within in given window. So instead if we reach
- // the end we try to look in our parent, if we have one.
- if (parent != null)
- return parent.findNextFocusComponent(this);
- j -= ncomponents;
- }
- if (component[j] instanceof Container)
- {
- Component c = component[j];
- c = c.findNextFocusComponent(null);
- if (c != null)
- return c;
- }
- else if (component[j].isFocusTraversable())
- return component[j];
+ int start, end;
+ if (child != null)
+ {
+ for (start = 0; start < ncomponents; ++start)
+ {
+ if (component[start] == child)
+ break;
+ }
+ end = start;
+ // This special case lets us be sure to terminate.
+ if (end == 0)
+ end = ncomponents;
+ ++start;
+ }
+ else
+ {
+ start = 0;
+ end = ncomponents;
+ }
+
+ for (int j = start; j != end; ++j)
+ {
+ if (j >= ncomponents)
+ {
+ // The JCL says that we should wrap here. However, that
+ // seems wrong. To me it seems that focus order should be
+ // global within in given window. So instead if we reach
+ // the end we try to look in our parent, if we have one.
+ if (parent != null)
+ return parent.findNextFocusComponent(this);
+ j -= ncomponents;
+ }
+ if (component[j] instanceof Container)
+ {
+ Component c = component[j];
+ c = c.findNextFocusComponent(null);
+ if (c != null)
+ return c;
+ }
+ else if (component[j].isFocusTraversable())
+ return component[j];
+ }
+
+ return null;
}
-
- return null;
}
private void addNotifyContainerChildren()
{
- for (int i = ncomponents; --i >= 0; )
+ synchronized (getTreeLock ())
{
- component[i].addNotify();
- if (component[i].isLightweight())
- enableEvents(component[i].eventMask);
+ for (int i = ncomponents; --i >= 0; )
+ {
+ component[i].addNotify();
+ if (component[i].isLightweight())
+ enableEvents(component[i].eventMask);
+ }
}
}
@@ -1190,12 +1233,15 @@ public class Container extends Component
*/
public int getAccessibleChildrenCount()
{
- int count = 0;
- int i = component == null ? 0 : component.length;
- while (--i >= 0)
- if (component[i] instanceof Accessible)
- count++;
- return count;
+ synchronized (getTreeLock ())
+ {
+ int count = 0;
+ int i = component == null ? 0 : component.length;
+ while (--i >= 0)
+ if (component[i] instanceof Accessible)
+ count++;
+ return count;
+ }
}
/**
@@ -1206,15 +1252,18 @@ public class Container extends Component
*/
public Accessible getAccessibleChild(int i)
{
- if (component == null)
- return null;
- int index = -1;
- while (i >= 0 && ++index < component.length)
- if (component[index] instanceof Accessible)
- i--;
- if (i < 0)
- return (Accessible) component[index];
- return null;
+ synchronized (getTreeLock ())
+ {
+ if (component == null)
+ return null;
+ int index = -1;
+ while (i >= 0 && ++index < component.length)
+ if (component[index] instanceof Accessible)
+ i--;
+ if (i < 0)
+ return (Accessible) component[index];
+ return null;
+ }
}
/**
diff --git a/libjava/java/awt/ContainerOrderFocusTraversalPolicy.java b/libjava/java/awt/ContainerOrderFocusTraversalPolicy.java
index 4c0d94e477d..e3cf31cb111 100644
--- a/libjava/java/awt/ContainerOrderFocusTraversalPolicy.java
+++ b/libjava/java/awt/ContainerOrderFocusTraversalPolicy.java
@@ -46,6 +46,8 @@ import java.io.Serializable;
public class ContainerOrderFocusTraversalPolicy extends FocusTraversalPolicy
implements Serializable
{
+ static final long serialVersionUID = 486933713763926351L;
+
private boolean downCycle = true;
public ContainerOrderFocusTraversalPolicy()
diff --git a/libjava/java/awt/Cursor.java b/libjava/java/awt/Cursor.java
index 2267998a452..5852b8bbf85 100644
--- a/libjava/java/awt/Cursor.java
+++ b/libjava/java/awt/Cursor.java
@@ -44,6 +44,8 @@ package java.awt;
*/
public class Cursor implements java.io.Serializable
{
+ static final long serialVersionUID = 8028237497568985504L;
+
/**
* Constant for the system default cursor type
*/
diff --git a/libjava/java/awt/Event.java b/libjava/java/awt/Event.java
index a020161647a..79be0e8c861 100644
--- a/libjava/java/awt/Event.java
+++ b/libjava/java/awt/Event.java
@@ -45,71 +45,73 @@ package java.awt;
public class Event implements java.io.Serializable
{
- public static final int SHIFT_MASK = 1,
- CTRL_MASK = 2,
- META_MASK = 4,
- ALT_MASK = 8;
-
- public static final int ACTION_EVENT = 1001,
- BACK_SPACE = 8,
- CAPS_LOCK = 1022,
- DELETE = 127,
- DOWN = 1005,
- END = 1001,
- ENTER = 10,
- ESCAPE = 27,
- F1 = 1008,
- F10 = 1017,
- F11 = 1018,
- F12 = 1019,
- F2 = 1009,
- F3 = 1010,
- F4 = 1011,
- F5 = 1012,
- F6 = 1013,
- F7 = 1014,
- F8 = 1015,
- F9 = 1016,
- GOT_FOCUS = 1004,
- HOME = 1000,
- INSERT = 1025,
- KEY_ACTION = 403,
- KEY_ACTION_RELEASE = 404,
- KEY_PRESS = 401,
- KEY_RELEASE = 402,
- LEFT = 1006,
- LIST_DESELECT = 702,
- LIST_SELECT = 701,
- LOAD_FILE = 1002,
- LOST_FOCUS = 1005,
- MOUSE_DOWN = 501,
- MOUSE_DRAG = 506,
- MOUSE_ENTER = 504,
- MOUSE_EXIT = 505,
- MOUSE_MOVE = 503,
- MOUSE_UP = 502,
- NUM_LOCK = 1023,
- PAUSE = 1024,
- PGDN = 1003,
- PGUP = 1002,
- PRINT_SCREEN = 1020,
- RIGHT = 1007,
- SAVE_FILE = 1003,
- SCROLL_ABSOLUTE = 605,
- SCROLL_BEGIN = 606,
- SCROLL_END = 607,
- SCROLL_LINE_DOWN = 602,
- SCROLL_LINE_UP = 601,
- SCROLL_LOCK = 1021,
- SCROLL_PAGE_DOWN = 604,
- SCROLL_PAGE_UP = 603,
- TAB = 9,
- UP = 1004,
- WINDOW_DEICONIFY = 204,
- WINDOW_DESTROY = 201,
- WINDOW_EXPOSE = 202,
- WINDOW_ICONIFY = 203,
- WINDOW_MOVED = 205;
+ static final long serialVersionUID = 5488922509400504703L;
+
+ public static final int SHIFT_MASK = 1;
+ public static final int CTRL_MASK = 2;
+ public static final int META_MASK = 4;
+ public static final int ALT_MASK = 8;
+
+ public static final int ACTION_EVENT = 1001;
+ public static final int BACK_SPACE = 8;
+ public static final int CAPS_LOCK = 1022;
+ public static final int DELETE = 127;
+ public static final int DOWN = 1005;
+ public static final int END = 1001;
+ public static final int ENTER = 10;
+ public static final int ESCAPE = 27;
+ public static final int F1 = 1008;
+ public static final int F10 = 1017;
+ public static final int F11 = 1018;
+ public static final int F12 = 1019;
+ public static final int F2 = 1009;
+ public static final int F3 = 1010;
+ public static final int F4 = 1011;
+ public static final int F5 = 1012;
+ public static final int F6 = 1013;
+ public static final int F7 = 1014;
+ public static final int F8 = 1015;
+ public static final int F9 = 1016;
+ public static final int GOT_FOCUS = 1004;
+ public static final int HOME = 1000;
+ public static final int INSERT = 1025;
+ public static final int KEY_ACTION = 403;
+ public static final int KEY_ACTION_RELEASE = 404;
+ public static final int KEY_PRESS = 401;
+ public static final int KEY_RELEASE = 402;
+ public static final int LEFT = 1006;
+ public static final int LIST_DESELECT = 702;
+ public static final int LIST_SELECT = 701;
+ public static final int LOAD_FILE = 1002;
+ public static final int LOST_FOCUS = 1005;
+ public static final int MOUSE_DOWN = 501;
+ public static final int MOUSE_DRAG = 506;
+ public static final int MOUSE_ENTER = 504;
+ public static final int MOUSE_EXIT = 505;
+ public static final int MOUSE_MOVE = 503;
+ public static final int MOUSE_UP = 502;
+ public static final int NUM_LOCK = 1023;
+ public static final int PAUSE = 1024;
+ public static final int PGDN = 1003;
+ public static final int PGUP = 1002;
+ public static final int PRINT_SCREEN = 1020;
+ public static final int RIGHT = 1007;
+ public static final int SAVE_FILE = 1003;
+ public static final int SCROLL_ABSOLUTE = 605;
+ public static final int SCROLL_BEGIN = 606;
+ public static final int SCROLL_END = 607;
+ public static final int SCROLL_LINE_DOWN = 602;
+ public static final int SCROLL_LINE_UP = 601;
+ public static final int SCROLL_LOCK = 1021;
+ public static final int SCROLL_PAGE_DOWN = 604;
+ public static final int SCROLL_PAGE_UP = 603;
+ public static final int TAB = 9;
+ public static final int UP = 1004;
+ public static final int WINDOW_DEICONIFY = 204;
+ public static final int WINDOW_DESTROY = 201;
+ public static final int WINDOW_EXPOSE = 202;
+ public static final int WINDOW_ICONIFY = 203;
+ public static final int WINDOW_MOVED = 205;
public Object arg;
public int clickCount;
diff --git a/libjava/java/awt/FlowLayout.java b/libjava/java/awt/FlowLayout.java
index e328d63796e..1f9465e4bf9 100644
--- a/libjava/java/awt/FlowLayout.java
+++ b/libjava/java/awt/FlowLayout.java
@@ -150,76 +150,79 @@ public class FlowLayout implements LayoutManager, Serializable
*/
public void layoutContainer (Container parent)
{
- int num = parent.getComponentCount ();
- // This is more efficient than calling getComponents().
- Component[] comps = parent.component;
+ synchronized (parent.getTreeLock ())
+ {
+ int num = parent.getComponentCount ();
+ // This is more efficient than calling getComponents().
+ Component[] comps = parent.component;
- Dimension d = parent.getSize ();
- Insets ins = parent.getInsets ();
+ Dimension d = parent.getSize ();
+ Insets ins = parent.getInsets ();
- ComponentOrientation orient = parent.getComponentOrientation ();
- boolean left_to_right = orient.isLeftToRight ();
+ ComponentOrientation orient = parent.getComponentOrientation ();
+ boolean left_to_right = orient.isLeftToRight ();
- int y = ins.top + vgap;
- int i = 0;
- while (i < num)
- {
- // Find the components which go in the current row.
- int new_w = ins.left + hgap + ins.right;
- int new_h = 0;
- int j;
- boolean found_one = false;
- for (j = i; j < num && ! found_one; ++j)
+ int y = ins.top + vgap;
+ int i = 0;
+ while (i < num)
{
- // Skip invisible items.
- if (! comps[i].visible)
- continue;
-
- Dimension c = comps[i].getPreferredSize ();
-
- int next_w = new_w + hgap + c.width;
- if (next_w <= d.width || ! found_one)
+ // Find the components which go in the current row.
+ int new_w = ins.left + hgap + ins.right;
+ int new_h = 0;
+ int j;
+ boolean found_one = false;
+ for (j = i; j < num && ! found_one; ++j)
{
- new_w = next_w;
- new_h = Math.max (new_h, c.height);
- found_one = true;
+ // Skip invisible items.
+ if (! comps[i].visible)
+ continue;
+
+ Dimension c = comps[i].getPreferredSize ();
+
+ int next_w = new_w + hgap + c.width;
+ if (next_w <= d.width || ! found_one)
+ {
+ new_w = next_w;
+ new_h = Math.max (new_h, c.height);
+ found_one = true;
+ }
+ else
+ {
+ // Must start a new row, and we already found an item
+ break;
+ }
}
- else
- {
- // Must start a new row, and we already found an item
- break;
- }
- }
- // Set the location of each component for this row.
- int x;
+ // Set the location of each component for this row.
+ int x;
- int myalign = align;
- if (align == LEADING)
- myalign = left_to_right ? LEFT : RIGHT;
- else if (align == TRAILING)
- myalign = left_to_right ? RIGHT : LEFT;
+ int myalign = align;
+ if (align == LEADING)
+ myalign = left_to_right ? LEFT : RIGHT;
+ else if (align == TRAILING)
+ myalign = left_to_right ? RIGHT : LEFT;
- if (myalign == LEFT)
- x = ins.left + hgap;
- else if (myalign == CENTER)
- x = (d.width - new_w) / 2;
- else
- x = d.width - new_w;
+ if (myalign == LEFT)
+ x = ins.left + hgap;
+ else if (myalign == CENTER)
+ x = (d.width - new_w) / 2;
+ else
+ x = d.width - new_w;
- for (int k = i; k < j; ++k)
- {
- if (comps[k].visible)
+ for (int k = i; k < j; ++k)
{
- Dimension c = comps[k].getPreferredSize ();
- comps[k].setBounds (x, y, c.width, new_h);
- x += c.width + hgap;
+ if (comps[k].visible)
+ {
+ Dimension c = comps[k].getPreferredSize ();
+ comps[k].setBounds (x, y, c.width, new_h);
+ x += c.width + hgap;
+ }
}
- }
- // Advance to next row.
- i = j;
- y += new_h + vgap;
+ // Advance to next row.
+ i = j;
+ y += new_h + vgap;
+ }
}
}
@@ -304,36 +307,39 @@ public class FlowLayout implements LayoutManager, Serializable
// This method is used to compute the various sizes.
private Dimension getSize (Container parent, boolean is_min)
{
- int w, h, num = parent.getComponentCount ();
- // This is more efficient than calling getComponents().
- Component[] comps = parent.component;
-
- w = 0;
- h = 0;
- for (int i = 0; i < num; ++i)
+ synchronized (parent.getTreeLock ())
{
- if (! comps[i].visible)
- continue;
+ int w, h, num = parent.getComponentCount ();
+ // This is more efficient than calling getComponents().
+ Component[] comps = parent.component;
- // FIXME: can we just directly read the fields in Component?
- // Or will that not work with subclassing?
- Dimension d;
+ w = 0;
+ h = 0;
+ for (int i = 0; i < num; ++i)
+ {
+ if (! comps[i].visible)
+ continue;
- if (is_min)
- d = comps[i].getMinimumSize ();
- else
- d = comps[i].getPreferredSize ();
+ // FIXME: can we just directly read the fields in Component?
+ // Or will that not work with subclassing?
+ Dimension d;
- w += d.width;
- h = Math.max (d.height, h);
- }
+ if (is_min)
+ d = comps[i].getMinimumSize ();
+ else
+ d = comps[i].getPreferredSize ();
- Insets ins = parent.getInsets ();
+ w += d.width;
+ h = Math.max (d.height, h);
+ }
- w += (num + 1) * hgap + ins.left + ins.right;
- h += 2 * vgap + ins.top + ins.bottom;
+ Insets ins = parent.getInsets ();
- return new Dimension (w, h);
+ w += (num + 1) * hgap + ins.left + ins.right;
+ h += 2 * vgap + ins.top + ins.bottom;
+
+ return new Dimension (w, h);
+ }
}
/**
diff --git a/libjava/java/awt/Frame.java b/libjava/java/awt/Frame.java
index cedd1710eb8..a25af9c5546 100644
--- a/libjava/java/awt/Frame.java
+++ b/libjava/java/awt/Frame.java
@@ -60,6 +60,12 @@ public class Frame extends Window implements MenuContainer, Serializable
*/
/**
+ * Constant for the default cursor.
+ * Deprecated. replaced by <code>Cursor.DEFAULT_CURSOR</code> instead.
+ */
+public static final int DEFAULT_CURSOR = Cursor.DEFAULT_CURSOR;
+
+/**
* Constant for a cross-hair cursor.
* @deprecated Use <code>Cursor.CROSSHAIR_CURSOR</code> instead.
*/
@@ -137,6 +143,12 @@ public static final int HAND_CURSOR = Cursor.HAND_CURSOR;
*/
public static final int MOVE_CURSOR = Cursor.MOVE_CURSOR;
+public static final int ICONIFIED = 1;
+public static final int MAXIMIZED_BOTH = 6;
+public static final int MAXIMIZED_HORIZ = 2;
+public static final int MAXIMIZED_VERT = 4;
+public static final int NORMAL = 0;
+
// Serialization version constant
private static final long serialVersionUID = 2673458971256075116L;
diff --git a/libjava/java/awt/GridBagConstraints.java b/libjava/java/awt/GridBagConstraints.java
index dd72a519a8d..57356ad8ef7 100644
--- a/libjava/java/awt/GridBagConstraints.java
+++ b/libjava/java/awt/GridBagConstraints.java
@@ -45,6 +45,8 @@ import java.io.Serializable;
* GridBagLayout layout manager. */
public class GridBagConstraints implements Cloneable, Serializable
{
+ static final long serialVersionUID = -1000070633030801713L;
+
/** Fill in both directions. */
public static final int BOTH = 1;
/** Don't fill. */
diff --git a/libjava/java/awt/GridBagLayout.java b/libjava/java/awt/GridBagLayout.java
index 29e1beac43d..dc2b3c9fd69 100644
--- a/libjava/java/awt/GridBagLayout.java
+++ b/libjava/java/awt/GridBagLayout.java
@@ -40,11 +40,13 @@ package java.awt;
import java.io.Serializable;
/**
- * Stub implementeation.
+ * Stub implementation.
*/
public class GridBagLayout
implements Serializable, LayoutManager2
{
+ static final long serialVersionUID = 8838754796412211005L;
+
public void addLayoutComponent(String name, Component component)
{
}
@@ -89,4 +91,8 @@ public class GridBagLayout
public void invalidateLayout(Container target)
{
}
+
+ public void setConstraints(Component comp, GridBagConstraints constraints)
+ {
+ }
}
diff --git a/libjava/java/awt/GridLayout.java b/libjava/java/awt/GridLayout.java
index 32f1cf8f5f4..a8befc4c0d3 100644
--- a/libjava/java/awt/GridLayout.java
+++ b/libjava/java/awt/GridLayout.java
@@ -58,6 +58,8 @@ import java.io.Serializable;
*/
public class GridLayout implements LayoutManager, Serializable
{
+ static final long serialVersionUID = -7411804673224730901L;
+
/** Add a new component to the layout. This particular implementation
* does nothing.
* @param name The name of the component to add.
@@ -151,62 +153,65 @@ public class GridLayout implements LayoutManager, Serializable
*/
public void layoutContainer (Container parent)
{
- int num = parent.ncomponents;
-
- // There's no point, and handling this would mean adding special
- // cases.
- if (num == 0)
- return;
-
- // This is more efficient than calling getComponents().
- Component[] comps = parent.component;
-
- int real_rows = rows;
- int real_cols = cols;
- if (real_rows == 0)
- real_rows = (num + real_cols - 1) / real_cols;
- else
- real_cols = (num + real_rows - 1) / real_rows;
-
- // We might have less than a single row. In this case we expand
- // to fill.
- if (num < real_cols)
- real_cols = num;
-
- Dimension d = parent.getSize ();
- Insets ins = parent.getInsets ();
-
- // Compute width and height of each cell in the grid.
- int tw = d.width - ins.left - ins.right;
- tw = (tw - (real_cols - 1) * hgap) / real_cols;
- int th = d.height - ins.top - ins.bottom;
- th = (th - (real_rows - 1) * vgap) / real_rows;
-
- // If the cells are too small, still try to do something.
- if (tw < 0)
- tw = 1;
- if (th < 0)
- th = 1;
-
- int x = ins.left;
- int y = ins.top;
- int i = 0;
- int recount = 0;
-
- while (i < num)
+ synchronized (parent.getTreeLock ())
{
- comps[i].setBounds (x, y, tw, th);
+ int num = parent.ncomponents;
- ++i;
- ++recount;
- if (recount == real_cols)
+ // There's no point, and handling this would mean adding special
+ // cases.
+ if (num == 0)
+ return;
+
+ // This is more efficient than calling getComponents().
+ Component[] comps = parent.component;
+
+ int real_rows = rows;
+ int real_cols = cols;
+ if (real_rows == 0)
+ real_rows = (num + real_cols - 1) / real_cols;
+ else
+ real_cols = (num + real_rows - 1) / real_rows;
+
+ // We might have less than a single row. In this case we expand
+ // to fill.
+ if (num < real_cols)
+ real_cols = num;
+
+ Dimension d = parent.getSize ();
+ Insets ins = parent.getInsets ();
+
+ // Compute width and height of each cell in the grid.
+ int tw = d.width - ins.left - ins.right;
+ tw = (tw - (real_cols - 1) * hgap) / real_cols;
+ int th = d.height - ins.top - ins.bottom;
+ th = (th - (real_rows - 1) * vgap) / real_rows;
+
+ // If the cells are too small, still try to do something.
+ if (tw < 0)
+ tw = 1;
+ if (th < 0)
+ th = 1;
+
+ int x = ins.left;
+ int y = ins.top;
+ int i = 0;
+ int recount = 0;
+
+ while (i < num)
{
- recount = 0;
- y += vgap + th;
- x = ins.left;
+ comps[i].setBounds (x, y, tw, th);
+
+ ++i;
+ ++recount;
+ if (recount == real_cols)
+ {
+ recount = 0;
+ y += vgap + th;
+ x = ins.left;
+ }
+ else
+ x += hgap + tw;
}
- else
- x += hgap + tw;
}
}
@@ -243,7 +248,7 @@ public class GridLayout implements LayoutManager, Serializable
*/
public void setColumns (int newCols)
{
- if (cols < 0)
+ if (newCols < 0)
throw new IllegalArgumentException ("number of columns cannot be negative");
if (newCols == 0 && rows == 0)
throw new IllegalArgumentException ("number of rows is already 0");
@@ -269,7 +274,7 @@ public class GridLayout implements LayoutManager, Serializable
*/
public void setRows (int newRows)
{
- if (rows < 0)
+ if (newRows < 0)
throw new IllegalArgumentException ("number of rows cannot be negative");
if (newRows == 0 && cols == 0)
throw new IllegalArgumentException ("number of columns is already 0");
@@ -299,36 +304,39 @@ public class GridLayout implements LayoutManager, Serializable
// This method is used to compute the various sizes.
private Dimension getSize (Container parent, boolean is_min)
{
- int w = 0, h = 0, num = parent.ncomponents;
- // This is more efficient than calling getComponents().
- Component[] comps = parent.component;
-
- for (int i = 0; i < num; ++i)
+ synchronized (parent.getTreeLock ())
{
- Dimension d;
+ int w = 0, h = 0, num = parent.ncomponents;
+ // This is more efficient than calling getComponents().
+ Component[] comps = parent.component;
- if (is_min)
- d = comps[i].getMinimumSize ();
- else
- d = comps[i].getPreferredSize ();
+ for (int i = 0; i < num; ++i)
+ {
+ Dimension d;
- w = Math.max (d.width, w);
- h = Math.max (d.height, h);
- }
+ if (is_min)
+ d = comps[i].getMinimumSize ();
+ else
+ d = comps[i].getPreferredSize ();
- int real_rows = rows;
- int real_cols = cols;
- if (real_rows == 0)
- real_rows = (num + real_cols - 1) / real_cols;
- else
- real_cols = (num + real_rows - 1) / real_rows;
-
- Insets ins = parent.getInsets ();
- // We subtract out an extra gap here because the gaps are only
- // between cells.
- w = ins.left + ins.right + real_cols * (w + hgap) - hgap;
- h = ins.top + ins.bottom + real_rows * (h + vgap) - vgap;
- return new Dimension (w, h);
+ w = Math.max (d.width, w);
+ h = Math.max (d.height, h);
+ }
+
+ int real_rows = rows;
+ int real_cols = cols;
+ if (real_rows == 0)
+ real_rows = (num + real_cols - 1) / real_cols;
+ else
+ real_cols = (num + real_rows - 1) / real_rows;
+
+ Insets ins = parent.getInsets ();
+ // We subtract out an extra gap here because the gaps are only
+ // between cells.
+ w = ins.left + ins.right + real_cols * (w + hgap) - hgap;
+ h = ins.top + ins.bottom + real_rows * (h + vgap) - vgap;
+ return new Dimension (w, h);
+ }
}
/**
diff --git a/libjava/java/awt/List.java b/libjava/java/awt/List.java
index c171b8f285e..f2c6d078832 100644
--- a/libjava/java/awt/List.java
+++ b/libjava/java/awt/List.java
@@ -947,10 +947,10 @@ processEvent(AWTEvent event)
{
if (event instanceof ActionEvent)
processActionEvent((ActionEvent)event);
- if (event instanceof ItemEvent)
+ else if (event instanceof ItemEvent)
processItemEvent((ItemEvent)event);
-
- super.processEvent(event);
+ else
+ super.processEvent(event);
}
/*************************************************************************/
diff --git a/libjava/java/awt/ScrollPane.java b/libjava/java/awt/ScrollPane.java
index 546f8e64d17..e558d0bc23f 100644
--- a/libjava/java/awt/ScrollPane.java
+++ b/libjava/java/awt/ScrollPane.java
@@ -1,5 +1,5 @@
/* ScrollPane.java -- Scrolling window
- Copyright (C) 1999 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -134,9 +134,9 @@ ScrollPane(int scrollbarDisplayPolicy)
{
this.scrollbarDisplayPolicy = scrollbarDisplayPolicy;
- if ((scrollbarDisplayPolicy != SCROLLBARS_ALWAYS) ||
- (scrollbarDisplayPolicy != SCROLLBARS_AS_NEEDED) ||
- (scrollbarDisplayPolicy != SCROLLBARS_NEVER))
+ if (scrollbarDisplayPolicy != SCROLLBARS_ALWAYS
+ && scrollbarDisplayPolicy != SCROLLBARS_AS_NEEDED
+ && scrollbarDisplayPolicy != SCROLLBARS_NEVER)
throw new IllegalArgumentException("Bad scrollbarDisplayPolicy: " +
scrollbarDisplayPolicy);
diff --git a/libjava/java/awt/Toolkit.java b/libjava/java/awt/Toolkit.java
index 7caec22dca9..fb5e020a29e 100644
--- a/libjava/java/awt/Toolkit.java
+++ b/libjava/java/awt/Toolkit.java
@@ -96,11 +96,11 @@ public abstract class Toolkit
{
/** The default toolkit name. */
private static String default_toolkit_name
- = "gnu.java.awt.peer.gtk.GtkToolkit";
+ = "gnu.awt.gtk.GtkToolkit";
/**
* The toolkit in use. Once we load it, we don't ever change it
- * if the awt.toolkit propert is set.
+ * if the awt.toolkit property is set.
*/
private static Toolkit toolkit;
diff --git a/libjava/java/awt/Window.java b/libjava/java/awt/Window.java
index 7064511b2b6..b8befaf0507 100644
--- a/libjava/java/awt/Window.java
+++ b/libjava/java/awt/Window.java
@@ -158,14 +158,13 @@ public class Window extends Container
*/
public void pack()
{
- if (parent != null
- && !parent.isDisplayable())
+ if (parent != null && !parent.isDisplayable())
parent.addNotify();
if (peer == null)
addNotify();
setSize(getPreferredSize());
-
+
validate();
}
@@ -174,9 +173,12 @@ public class Window extends Container
*/
public void show()
{
+ if (parent != null && !parent.isDisplayable())
+ parent.addNotify();
if (peer == null)
addNotify();
+ validate();
super.show();
toFront();
}
@@ -187,6 +189,13 @@ public class Window extends Container
super.hide();
}
+ public boolean isDisplayable()
+ {
+ if (super.isDisplayable())
+ return true;
+ return peer != null;
+ }
+
/**
* Called to free any resource associated with this window.
*/
@@ -479,5 +488,4 @@ public class Window extends Container
if (peer != null) return peer.getGraphicsConfiguration();
return null;
}
-
}
diff --git a/libjava/java/awt/color/ColorSpace.java b/libjava/java/awt/color/ColorSpace.java
index 989513f0dd7..4f68fabcb7b 100644
--- a/libjava/java/awt/color/ColorSpace.java
+++ b/libjava/java/awt/color/ColorSpace.java
@@ -1,4 +1,5 @@
-/* Copyright (C) 2000, 2002 Free Software Foundation
+/* ColorSpace.java -- transforms between color spaces
+ Copyright (C) 2000, 2002 Free Software Foundation
This file is part of GNU Classpath.
@@ -34,25 +35,36 @@ 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 java.awt.color;
+import java.io.Serializable;
+
/**
+ * NEEDS DOCUMENTATION
+ *
* @author Rolf W. Rasmussen <rolfwr@ii.uib.no>
+ * @since 1.2
*/
public abstract class ColorSpace
{
- public static final int TYPE_XYZ = 0;
- public static final int TYPE_Lab = 1;
- public static final int TYPE_Luv = 2;
+ /**
+ * Compatible with JDK 1.2+.
+ */
+ private static final long serialVersionUID = -409452704308689724L;
+
+ public static final int TYPE_XYZ = 0;
+ public static final int TYPE_Lab = 1;
+ public static final int TYPE_Luv = 2;
public static final int TYPE_YCbCr = 3;
- public static final int TYPE_Yxy = 4;
- public static final int TYPE_RGB = 5;
- public static final int TYPE_GRAY = 6;
- public static final int TYPE_HSV = 7;
- public static final int TYPE_HLS = 8;
- public static final int TYPE_CMYK = 9;
+ public static final int TYPE_Yxy = 4;
+ public static final int TYPE_RGB = 5;
+ public static final int TYPE_GRAY = 6;
+ public static final int TYPE_HSV = 7;
+ public static final int TYPE_HLS = 8;
+ public static final int TYPE_CMYK = 9;
// mysterious gap in the enumeration sequenece
- public static final int TYPE_CMY = 11;
+ public static final int TYPE_CMY = 11;
public static final int TYPE_2CLR = 12;
public static final int TYPE_3CLR = 13;
public static final int TYPE_4CLR = 14;
@@ -67,54 +79,64 @@ public abstract class ColorSpace
public static final int TYPE_DCLR = 23;
public static final int TYPE_ECLR = 24;
public static final int TYPE_FCLR = 25;
-
- public static final int CS_sRGB = 1000;
- public static final int CS_CIEXYZ = 1001;
- public static final int CS_PYCC = 1002;
- public static final int CS_GRAY = 1003;
+
+ public static final int CS_sRGB = 1000;
public static final int CS_LINEAR_RGB = 1004;
-
- private static final int CS_BASE = CS_sRGB;
- private static final int CS_END = CS_LINEAR_RGB+1;
+ public static final int CS_CIEXYZ = 1001;
+ public static final int CS_PYCC = 1002;
+ public static final int CS_GRAY = 1003;
+
+ private static final int CS_BASE = CS_sRGB;
+ private static final int CS_END = CS_LINEAR_RGB + 1;
private static final int CS_COUNT = CS_END - CS_BASE;
-
+
// Instances are lazily instantiated
private static final ColorSpace[] INSTANCES = new ColorSpace[CS_COUNT];
- private int type;
- private int numcomponents;
+ /**
+ * @serial
+ */
+ // Visible in subclass.
+ final int type;
+
+ /**
+ * @serial
+ */
+ // Visible in subclass.
+ final int numComponents;
+
protected ColorSpace(int type, int numcomponents)
{
this.type = type;
- this.numcomponents = numcomponents;
+ numComponents = numcomponents;
}
-
+
public static ColorSpace getInstance(int colorspace)
{
if ((colorspace >= CS_BASE) && (colorspace < CS_END))
{
- int instanceIndex = colorspace - CS_BASE;
- if (INSTANCES[instanceIndex] == null)
- {
- ICC_Profile profile = new ICC_Profile(colorspace);
- INSTANCES[instanceIndex] = new ICC_ColorSpace(profile);
- }
- return INSTANCES[instanceIndex];
+ int instanceIndex = colorspace - CS_BASE;
+ if (INSTANCES[instanceIndex] == null)
+ {
+ ICC_Profile profile = new ICC_Profile(colorspace);
+ INSTANCES[instanceIndex] = new ICC_ColorSpace(profile);
+ }
+ return INSTANCES[instanceIndex];
}
throw new IllegalArgumentException("unknown/unsupported colorspace");
}
-
+
public boolean isCS_sRGB()
{
return false;
}
public abstract float[] toRGB(float[] colorvalue);
-
+
public abstract float[] fromRGB(float[] rgbvalue);
-
+
public abstract float[] toCIEXYZ(float[] colorvalue);
-
+
public abstract float[] fromCIEXYZ(float[] colorvalue);
public int getType()
@@ -124,16 +146,31 @@ public abstract class ColorSpace
public int getNumComponents()
{
- return numcomponents;
+ return numComponents;
}
-
+
public String getName(int idx)
{
return "type " + type;
}
-
- public String toString()
+
+ /**
+ * @since 1.4
+ */
+ public float getMinValue(int idx)
+ {
+ if (idx < 0 || idx >= numComponents)
+ throw new IllegalArgumentException();
+ return 0;
+ }
+
+ /**
+ * @since 1.4
+ */
+ public float getMaxValue(int idx)
{
- return getClass().getName() + "[type=" + type + "]";
+ if (idx < 0 || idx >= numComponents)
+ throw new IllegalArgumentException();
+ return 1;
}
-}
+} // class ColorSpace
diff --git a/libjava/java/awt/color/ICC_ColorSpace.java b/libjava/java/awt/color/ICC_ColorSpace.java
index bf5662c9440..1a144dbfbd2 100644
--- a/libjava/java/awt/color/ICC_ColorSpace.java
+++ b/libjava/java/awt/color/ICC_ColorSpace.java
@@ -1,4 +1,5 @@
-/* Copyright (C) 2000, 2002 Free Software Foundation
+/* ICC_ColorSpace.java -- the canonical color space implementation
+ Copyright (C) 2000, 2002 Free Software Foundation
This file is part of GNU Classpath.
@@ -34,25 +35,61 @@ 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 java.awt.color;
/**
+ * NEEDS DOCUMENTATION
+ *
* @author Rolf W. Rasmussen <rolfwr@ii.uib.no>
+ * @since 1.2
*/
public class ICC_ColorSpace extends ColorSpace
{
- private ICC_Profile profile;
+ /**
+ * Compatible with JDK 1.2+.
+ */
+ private static final long serialVersionUID = 3455889114070431483L;
+
+ /**
+ * @serial
+ */
+ private ICC_Profile thisProfile;
+
+ /**
+ * @serial
+ */
+ private float[] minVal;
+
+ /**
+ * @serial
+ */
+ private float[] maxVal;
+
+ /**
+ * @serial
+ */
+ private float[] diffMinMax;
+
+ /**
+ * @serial
+ */
+ private float[] invDiffMinMax;
+
+ /**
+ * @serial
+ */
+ private boolean needScaleInit;
public ICC_ColorSpace(ICC_Profile profile)
{
super(CS_sRGB, profile.getNumComponents());
-
- this.profile = profile;
+ thisProfile = profile;
}
public ICC_Profile getProfile()
{
- return profile;
+ return thisProfile;
}
public float[] toRGB(float[] colorvalue)
@@ -78,4 +115,35 @@ public class ICC_ColorSpace extends ColorSpace
// FIXME: Not implemented
throw new UnsupportedOperationException();
}
-}
+
+ /**
+ * @since 1.4
+ */
+ public float getMinValue(int idx)
+ {
+ if (type == TYPE_Lab && (idx == 1 || idx == 2))
+ return -128;
+ if (idx < 0 || idx >= numComponents)
+ throw new IllegalArgumentException();
+ return 0;
+ }
+
+ /**
+ * @since 1.4
+ */
+ public float getMaxValue(int idx)
+ {
+ if (type == TYPE_XYZ && idx >= 0 && idx <= 2)
+ return 1 + 32767 / 32768f;
+ else if (type == TYPE_Lab)
+ {
+ if (idx == 0)
+ return 100;
+ if (idx == 1 || idx == 2)
+ return 127;
+ }
+ if (idx < 0 || idx >= numComponents)
+ throw new IllegalArgumentException();
+ return 1;
+ }
+} // class ICC_ColorSpace
diff --git a/libjava/java/awt/color/ICC_Profile.java b/libjava/java/awt/color/ICC_Profile.java
index fa8b33440f5..7adaac06472 100644
--- a/libjava/java/awt/color/ICC_Profile.java
+++ b/libjava/java/awt/color/ICC_Profile.java
@@ -1,4 +1,5 @@
-/* Copyright (C) 2000, 2002 Free Software Foundation
+/* ICC_Profile.java -- color space profiling
+ Copyright (C) 2000, 2002 Free Software Foundation
This file is part of GNU Classpath.
@@ -34,25 +35,239 @@ 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 java.awt.color;
-// Currently just a stub.
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.InputStream;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.ObjectStreamException;
+import java.io.OutputStream;
+import java.io.Serializable;
/**
+ * STUBBED
* @author Rolf W. Rasmussen <rolfwr@ii.uib.no>
+ * @since 1.2
*/
-public class ICC_Profile
+public class ICC_Profile implements Serializable
{
- long profileID; // why long?
-
- ICC_Profile(long profileID)
+ /**
+ * Compatible with JDK 1.2+.
+ */
+ private static final long serialVersionUID = -3938515861990936766L;
+
+ public static final int CLASS_INPUT = 0;
+ public static final int CLASS_DISPLAY = 1;
+ public static final int CLASS_OUTPUT = 2;
+ public static final int CLASS_DEVICELINK = 3;
+ public static final int CLASS_COLORSPACECONVERSION = 4;
+ public static final int CLASS_ABSTRACT = 5;
+ public static final int CLASS_NAMEDCOLOR = 6;
+
+ public static final int icSigXYZData = 1482250784;
+ public static final int icSigLabData = 1281450528;
+ public static final int icSigLuvData = 1282766368;
+ public static final int icSigYCbCrData = 1497588338;
+ public static final int icSigYxyData = 1501067552;
+ public static final int icSigRgbData = 1380401696;
+ public static final int icSigGrayData = 1196573017;
+ public static final int icSigHsvData = 1213421088;
+ public static final int icSigHlsData = 1212961568;
+ public static final int icSigCmykData = 1129142603;
+ public static final int icSigCmyData = 1129142560;
+ public static final int icSigSpace2CLR = 843271250;
+ public static final int icSigSpace3CLR = 860048466;
+ public static final int icSigSpace4CLR = 876825682;
+ public static final int icSigSpace5CLR = 893602898;
+ public static final int icSigSpace6CLR = 910380114;
+ public static final int icSigSpace7CLR = 927157330;
+ public static final int icSigSpace8CLR = 943934546;
+ public static final int icSigSpace9CLR = 960711762;
+ public static final int icSigSpaceACLR = 1094929490;
+ public static final int icSigSpaceBCLR = 1111706706;
+ public static final int icSigSpaceCCLR = 1128483922;
+ public static final int icSigSpaceDCLR = 1145261138;
+ public static final int icSigSpaceECLR = 1162038354;
+ public static final int icSigSpaceFCLR = 1178815570;
+
+ public static final int icSigInputClass = 1935896178;
+ public static final int icSigDisplayClass = 1835955314;
+ public static final int icSigOutputClass = 1886549106;
+ public static final int icSigLinkClass = 1818848875;
+ public static final int icSigAbstractClass = 1633842036;
+ public static final int icSigColorSpaceClass = 1936744803;
+ public static final int icSigNamedColorClass = 1852662636;
+
+ public static final int icPerceptual = 0;
+ public static final int icRelativeColorimetric = 1;
+ public static final int icSaturation = 2;
+ public static final int icAbsoluteColorimetric = 3;
+
+ public static final int icSigHead = 1751474532;
+ public static final int icSigAToB0Tag = 1093812784;
+ public static final int icSigAToB1Tag = 1093812785;
+ public static final int icSigAToB2Tag = 1093812786;
+ public static final int icSigBlueColorantTag = 1649957210;
+ public static final int icSigBlueTRCTag = 1649693251;
+ public static final int icSigBToA0Tag = 1110589744;
+ public static final int icSigBToA1Tag = 1110589745;
+ public static final int icSigBToA2Tag = 1110589746;
+ public static final int icSigCalibrationDateTimeTag = 1667329140;
+ public static final int icSigCharTargetTag = 1952543335;
+ public static final int icSigCopyrightTag = 1668313716;
+ public static final int icSigCrdInfoTag = 1668441193;
+ public static final int icSigDeviceMfgDescTag = 1684893284;
+ public static final int icSigDeviceModelDescTag = 1684890724;
+ public static final int icSigDeviceSettingsTag = 1684371059;
+ public static final int icSigGamutTag = 1734438260;
+ public static final int icSigGrayTRCTag = 1800688195;
+ public static final int icSigGreenColorantTag = 1733843290;
+ public static final int icSigGreenTRCTag = 1733579331;
+ public static final int icSigLuminanceTag = 1819635049;
+ public static final int icSigMeasurementTag = 1835360627;
+ public static final int icSigMediaBlackPointTag = 1651208308;
+ public static final int icSigMediaWhitePointTag = 2004119668;
+ public static final int icSigNamedColor2Tag = 1852009522;
+ public static final int icSigOutputResponseTag = 1919251312;
+ public static final int icSigPreview0Tag = 1886545200;
+ public static final int icSigPreview1Tag = 1886545201;
+ public static final int icSigPreview2Tag = 1886545202;
+ public static final int icSigProfileDescriptionTag = 1684370275;
+ public static final int icSigProfileSequenceDescTag = 1886610801;
+ public static final int icSigPs2CRD0Tag = 1886610480;
+ public static final int icSigPs2CRD1Tag = 1886610481;
+ public static final int icSigPs2CRD2Tag = 1886610482;
+ public static final int icSigPs2CRD3Tag = 1886610483;
+ public static final int icSigPs2CSATag = 1886597747;
+ public static final int icSigPs2RenderingIntentTag = 1886597737;
+ public static final int icSigRedColorantTag = 1918392666;
+ public static final int icSigRedTRCTag = 1918128707;
+ public static final int icSigScreeningDescTag = 1935897188;
+ public static final int icSigScreeningTag = 1935897198;
+ public static final int icSigTechnologyTag = 1952801640;
+ public static final int icSigUcrBgTag = 1650877472;
+ public static final int icSigViewingCondDescTag = 1987405156;
+ public static final int icSigViewingConditionsTag = 1986618743;
+ public static final int icSigChromaticityTag = 1667789421;
+
+ public static final int icHdrSize = 0;
+ public static final int icHdrCmmId = 4;
+ public static final int icHdrVersion = 8;
+ public static final int icHdrDeviceClass = 12;
+ public static final int icHdrColorSpace = 16;
+ public static final int icHdrPcs = 20;
+ public static final int icHdrDate = 24;
+ public static final int icHdrMagic = 36;
+ public static final int icHdrPlatform = 40;
+ public static final int icHdrFlags = 44;
+ public static final int icHdrManufacturer = 48;
+ public static final int icHdrModel = 52;
+ public static final int icHdrAttributes = 56;
+ public static final int icHdrRenderingIntent = 64;
+ public static final int icHdrIlluminant = 68;
+ public static final int icHdrCreator = 80;
+
+ public static final int icTagType = 0;
+ public static final int icTagReserved = 4;
+ public static final int icCurveCount = 8;
+ public static final int icCurveData = 12;
+
+ public static final int icXYZNumberX = 8;
+
+ /**
+ * @serial
+ */
+ final int iccProfileSerializedDataVersion = 1;
+
+ transient int profileID;
+
+ ICC_Profile(int profileID)
{
this.profileID = profileID;
}
+ protected void finalize()
+ {
+ // XXX What resources should we free?
+ }
+
+ public static ICC_Profile getInstance(byte[] data)
+ {
+ throw new Error("not implemented");
+ }
+
+ public static ICC_Profile getInstance(int cspace)
+ {
+ return new ICC_Profile(cspace);
+ }
+
+ public static ICC_Profile getInstance(String filename) throws IOException
+ {
+ return getInstance(new FileInputStream(filename));
+ }
+
+ public static ICC_Profile getInstance(InputStream in) throws IOException
+ {
+ throw new Error("not implemented");
+ }
+
+ public int getMajorVersion()
+ {
+ throw new Error("not implemented");
+ }
+
+ public int getMinorVersion()
+ {
+ throw new Error("not implemented");
+ }
+
+ public int getProfileClass()
+ {
+ throw new Error("not implemented");
+ }
+
+ public int getColorSpaceType()
+ {
+ throw new Error("not implemented");
+ }
+
+ public int getPCSType()
+ {
+ throw new Error("not implemented");
+ }
+
+ public void write(String filename) throws IOException
+ {
+ write(new FileOutputStream(filename));
+ }
+
+ public void write(OutputStream out)
+ {
+ throw new Error("not implemented");
+ }
+
+ public byte[] getData()
+ {
+ throw new Error("not implemented");
+ }
+
+ public byte[] getData(int tagSignature)
+ {
+ throw new Error("not implemented");
+ }
+
+ public void setData(int tagSignature, byte[] data)
+ {
+ throw new Error("not implemented");
+ }
+
public int getNumComponents()
{
- switch ((int) profileID)
+ switch (profileID)
{
case ColorSpace.CS_sRGB:
case ColorSpace.CS_LINEAR_RGB:
@@ -60,9 +275,25 @@ public class ICC_Profile
return 3;
case ColorSpace.CS_GRAY:
return 1;
- case ColorSpace.CS_PYCC: // have no clue about this one
+ case ColorSpace.CS_PYCC: // have no clue about this one
default:
throw new UnsupportedOperationException("profile not implemented");
}
}
-}
+
+ protected Object readResolve() throws ObjectStreamException
+ {
+ throw new Error("not implemented");
+ }
+
+ private void readObject(ObjectInputStream s)
+ throws IOException, ClassNotFoundException
+ {
+ throw new Error("not implemented");
+ }
+
+ private void writeObject(ObjectOutputStream s) throws IOException
+ {
+ throw new Error("not implemented");
+ }
+} // class ICC_Profile
diff --git a/libjava/java/awt/color/ICC_ProfileGray.java b/libjava/java/awt/color/ICC_ProfileGray.java
new file mode 100644
index 00000000000..6aed7eefe0f
--- /dev/null
+++ b/libjava/java/awt/color/ICC_ProfileGray.java
@@ -0,0 +1,71 @@
+/* ICC_ProfileGray.java -- the ICC profile for a Gray colorspace
+ Copyright (C) 2002 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 java.awt.color;
+
+/**
+ * STUBBED
+ * @since 1.2
+ */
+public class ICC_ProfileGray extends ICC_Profile
+{
+ /**
+ * Compatible with JDK 1.2+.
+ */
+ private static final long serialVersionUID = -1124721290732002649L;
+
+ ICC_ProfileGray()
+ {
+ super(ColorSpace.CS_GRAY);
+ }
+
+ public float[] getMediaWhitePoint()
+ {
+ return null;
+ }
+
+ public float getGamma()
+ {
+ return 0;
+ }
+
+ public short[] getTRC()
+ {
+ return null;
+ }
+} // class ICC_ProfileGray
diff --git a/libjava/java/awt/color/ICC_ProfileRGB.java b/libjava/java/awt/color/ICC_ProfileRGB.java
new file mode 100644
index 00000000000..aab7578b22e
--- /dev/null
+++ b/libjava/java/awt/color/ICC_ProfileRGB.java
@@ -0,0 +1,80 @@
+/* ICC_ProfileRGB.java -- the ICC profile for a RGB colorspace
+ Copyright (C) 2002 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 java.awt.color;
+
+/**
+ * STUBBED
+ * @since 1.2
+ */
+public class ICC_ProfileRGB extends ICC_Profile
+{
+ /**
+ * Compatible with JDK 1.2+.
+ */
+ private static final long serialVersionUID = 8505067385152579334L;
+
+ public static final int REDCOMPONENT = 0;
+ public static final int GREENCOMPONENT = 1;
+ public static final int BLUECOMPONENT = 2;
+
+ ICC_ProfileRGB()
+ {
+ super(ColorSpace.CS_sRGB);
+ }
+
+ public float[] getMediaWhitePoint()
+ {
+ return null;
+ }
+
+ public float[][] getMatrix()
+ {
+ return null;
+ }
+
+ public float getGamma(int component)
+ {
+ return 0;
+ }
+
+ public short[] getTRC(int component)
+ {
+ return null;
+ }
+} // class ICC_ProfileRGB
diff --git a/libjava/java/awt/datatransfer/DataFlavor.java b/libjava/java/awt/datatransfer/DataFlavor.java
index 3c6b2720e45..85f6ae5d455 100644
--- a/libjava/java/awt/datatransfer/DataFlavor.java
+++ b/libjava/java/awt/datatransfer/DataFlavor.java
@@ -56,6 +56,7 @@ import java.io.UnsupportedEncodingException;
*/
public class DataFlavor implements java.io.Externalizable, Cloneable
{
+ static final long serialVersionUID = 8367026044764648243L;
// FIXME: Serialization: Need to write methods for.
@@ -87,6 +88,8 @@ public static final DataFlavor stringFlavor;
*/
public static final DataFlavor javaFileListFlavor;
+public static final DataFlavor imageFlavor;
+
/**
* This is the MIME type used for transferring a serialized object.
* The representation class is the type of object be deserialized.
@@ -125,6 +128,10 @@ static
"Java File List");
// javaFileListFlavor.mimeType = "application/x-java-file-list";
+
+ imageFlavor
+ = new DataFlavor(java.awt.Image.class,
+ "Java Image");
}
/*************************************************************************/
@@ -498,7 +505,7 @@ setHumanPresentableName(String humanPresentableName)
* @return <code>true</code> if the MIME type is equal to this object's
* MIME type, <code>false</code> otherwise.
*/
-public boolean
+public final boolean
isMimeTypeEqual(String mimeType)
{
// FIXME: Need to handle default attributes and parameters
@@ -861,7 +868,7 @@ getTextPlainUnicodeFlavor()
*
* @since 1.3
*/
-public static final Class
+public final Class
getDefaultRepresentationClass()
{
return(java.io.InputStream.class);
@@ -871,7 +878,7 @@ getDefaultRepresentationClass()
/**
* XXX - Currently returns <code>java.io.InputStream</code>.
*/
-public static final String
+public final String
getDefaultRepresentationClassAsString()
{
return(getDefaultRepresentationClass().getName());
diff --git a/libjava/java/awt/dnd/Autoscroll.java b/libjava/java/awt/dnd/Autoscroll.java
new file mode 100644
index 00000000000..e7d3e28ed32
--- /dev/null
+++ b/libjava/java/awt/dnd/Autoscroll.java
@@ -0,0 +1,67 @@
+/* Autoscroll.java --
+ Copyright (C) 2002 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 java.awt.dnd;
+
+import java.awt.Point;
+import java.awt.Insets;
+
+/**
+ * During DnD operations it is possible that a user may wish to drop the
+ * subject of the operation on a region of a scrollable GUI control that
+ * is not currently visible to the user.
+ *
+ * @author Michael Koch <konqueror@gmx.de>
+ * @since 1.2
+ * @status updated to 1.4
+ */
+public interface Autoscroll
+{
+ /**
+ * This method returns the Insets describing the autoscrolling region or
+ * border relative to the geometry of the implementing Component
+ */
+ public Insets getAutoscrollInsets ();
+
+ /**
+ * Notify the Component to autoscroll
+ *
+ * @param location A Point indicating the location of the cursor that
+ * triggered this operation
+ */
+ public void autoscroll (Point location);
+} // interface Autoscroll
diff --git a/libjava/java/awt/dnd/DragSourceAdapter.java b/libjava/java/awt/dnd/DragSourceAdapter.java
index 55daf41b257..2b2e15541fd 100644
--- a/libjava/java/awt/dnd/DragSourceAdapter.java
+++ b/libjava/java/awt/dnd/DragSourceAdapter.java
@@ -108,7 +108,7 @@ public abstract class DragSourceAdapter
*
* @param e the event
*/
- public void dragExit(DragSourceDragEvent e)
+ public void dragExit(DragSourceEvent e)
{
}
@@ -120,7 +120,7 @@ public abstract class DragSourceAdapter
*
* @param e the event
*/
- public void dragDropEnd(DragSourceDragEvent e)
+ public void dragDropEnd(DragSourceDropEvent e)
{
}
} // class DragSourceAdapter
diff --git a/libjava/java/awt/dnd/DragSourceContext.java b/libjava/java/awt/dnd/DragSourceContext.java
index ff7e88257e9..ca26b941b3e 100644
--- a/libjava/java/awt/dnd/DragSourceContext.java
+++ b/libjava/java/awt/dnd/DragSourceContext.java
@@ -50,6 +50,8 @@ import java.util.TooManyListenersException;
public class DragSourceContext
implements DragSourceListener, DragSourceMotionListener, Serializable
{
+ static final long serialVersionUID = -115407898692194719L;
+
protected static final int DEFAULT = 0;
protected static final int ENTER = 1;
protected static final int OVER = 2;
@@ -111,7 +113,7 @@ public class DragSourceContext
{
}
- public void dragExit(DragSourceDragEvent e)
+ public void dragExit(DragSourceEvent e)
{
}
@@ -119,7 +121,7 @@ public class DragSourceContext
{
}
- public void dragDropEnd(DragSourceDragEvent e)
+ public void dragDropEnd(DragSourceDropEvent e)
{
}
diff --git a/libjava/java/awt/dnd/DragSourceDropEvent.java b/libjava/java/awt/dnd/DragSourceDropEvent.java
new file mode 100644
index 00000000000..4b70d1bf0b0
--- /dev/null
+++ b/libjava/java/awt/dnd/DragSourceDropEvent.java
@@ -0,0 +1,84 @@
+/* DragSourceDragEvent.java --
+ Copyright (C) 2002 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 java.awt.dnd;
+
+/**
+ * @author Michael Koch <konqueror@gmx.de>
+ * @since 1.2
+ *
+ * Written using JDK 1.4.1 Online API
+ * Status: JDK 1.4 complete
+ */
+public class DragSourceDropEvent extends DragSourceEvent
+{
+ private final int dropAction;
+ private final boolean success;
+
+ public DragSourceDropEvent (DragSourceContext context)
+ {
+ super (context);
+ this.dropAction = 0;
+ this.success = false;
+ }
+
+ public DragSourceDropEvent (DragSourceContext context, int dropAction,
+ boolean success)
+ {
+ super (context);
+ this.dropAction = dropAction;
+ this.success = success;
+ }
+
+ public DragSourceDropEvent (DragSourceContext context, int dropAction,
+ boolean success, int x, int y)
+ {
+ super (context, x, y);
+ this.dropAction = dropAction;
+ this.success = success;
+ }
+
+ public int getDropAction()
+ {
+ return dropAction & ((DragSourceContext) source).getSourceActions();
+ }
+
+ public boolean getDropSuccess()
+ {
+ return success;
+ }
+} // class DragSourceDropEvent
diff --git a/libjava/java/awt/dnd/DragSourceListener.java b/libjava/java/awt/dnd/DragSourceListener.java
index 46326418fb9..2022a32ac76 100644
--- a/libjava/java/awt/dnd/DragSourceListener.java
+++ b/libjava/java/awt/dnd/DragSourceListener.java
@@ -83,7 +83,7 @@ public interface DragSourceListener extends EventListener
*
* @param e the drag source drag event
*/
- void dragExit(DragSourceDragEvent e);
+ void dragExit(DragSourceEvent e);
/**
* Called when the drag and drop operation is complete. After this event,
@@ -93,5 +93,5 @@ public interface DragSourceListener extends EventListener
*
* @param e the drag source drag event
*/
- void dragDropEnd(DragSourceDragEvent e);
+ void dragDropEnd(DragSourceDropEvent e);
} // interface DragSourceListener
diff --git a/libjava/java/awt/dnd/DropTarget.java b/libjava/java/awt/dnd/DropTarget.java
index 9ae423438ec..c469605b8b4 100644
--- a/libjava/java/awt/dnd/DropTarget.java
+++ b/libjava/java/awt/dnd/DropTarget.java
@@ -36,5 +36,184 @@ obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package java.awt.dnd;
+
+import java.awt.Point;
+import java.awt.Component;
+import java.awt.datatransfer.FlavorMap;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.util.TooManyListenersException;
+
/** STUB CLASS ONLY */
-public class DropTarget {}
+public class DropTarget
+{
+ protected static class DropTargetAutoScroller
+ implements ActionListener
+ {
+ protected DropTargetAutoScroller (Component c, Point p)
+ {
+ }
+
+ protected void updateLocation (Point newLocn)
+ {
+ }
+
+ protected void stop ()
+ {
+ }
+
+ public void actionPerformed (ActionEvent e)
+ {
+ }
+ }
+
+ /**
+ * FIXME
+ *
+ * @exception HeadlessException FIXME
+ */
+ public DropTarget ()
+ {
+ }
+
+ /**
+ * FIXME
+ *
+ * @exception HeadlessException FIXME
+ */
+ public DropTarget (Component c, DropTargetListener dtl)
+ {
+ }
+
+ /**
+ * FIXME
+ *
+ * @exception HeadlessException FIXME
+ */
+ public DropTarget (Component c, int i, DropTargetListener dtl)
+ {
+ }
+
+ /**
+ * FIXME
+ *
+ * @exception HeadlessException FIXME
+ */
+ public DropTarget (Component c, int i, DropTargetListener dtl, boolean b)
+ {
+ }
+
+ /**
+ * FIXME
+ *
+ * @exception HeadlessException FIXME
+ */
+ public DropTarget (Component c, int i, DropTargetListener dtl, boolean b,
+ FlavorMap fm)
+ {
+ }
+
+ public void setComponent (Component c)
+ {
+ }
+
+ public Component getComponent ()
+ {
+ return null;
+ }
+
+ public void setDefaultActions (int ops)
+ {
+ }
+
+ public int getDefaultActions ()
+ {
+ return 0;
+ }
+
+ public void setActive(boolean isActive)
+ {
+ }
+
+ public boolean isActive()
+ {
+ return false;
+ }
+
+ /**
+ * @exception TooManyListenersException FIXME
+ */
+ public void addDropTargetListener (DropTargetListener dtl)
+ throws TooManyListenersException
+ {
+ }
+
+ public void removeDropTargetListener(DropTargetListener dtl)
+ {
+ }
+
+ public void dragEnter(DropTargetDragEvent dtde)
+ {
+ }
+
+ public void dragOver(DropTargetDragEvent dtde)
+ {
+ }
+
+ public void dropActionChanged(DropTargetDragEvent dtde)
+ {
+ }
+
+ public void dragExit(DropTargetEvent dte)
+ {
+ }
+
+ public void drop(DropTargetDropEvent dtde)
+ {
+ }
+
+ public FlavorMap getFlavorMap()
+ {
+ return null;
+ }
+
+ public void setFlavorMap(FlavorMap fm)
+ {
+ }
+
+ public void addNotify(java.awt.peer.ComponentPeer peer)
+ {
+ }
+
+ public void removeNotify(java.awt.peer.ComponentPeer peer)
+ {
+ }
+
+ public DropTargetContext getDropTargetContext()
+ {
+ return null;
+ }
+
+ protected DropTargetContext createDropTargetContext()
+ {
+ return null;
+ }
+
+ protected DropTarget.DropTargetAutoScroller createDropTargetAutoScroller
+ (Component c, Point p)
+ {
+ return null;
+ }
+
+ protected void initializeAutoscrolling(Point p)
+ {
+ }
+
+ protected void updateAutoscroll(Point dragCursorLocn)
+ {
+ }
+
+ protected void clearAutoscroll()
+ {
+ }
+} // class DropTarget
diff --git a/libjava/java/awt/dnd/DropTargetAdapter.java b/libjava/java/awt/dnd/DropTargetAdapter.java
new file mode 100644
index 00000000000..4ece882121b
--- /dev/null
+++ b/libjava/java/awt/dnd/DropTargetAdapter.java
@@ -0,0 +1,100 @@
+/* DragSourceAdapter.java -- drag-and-drop listener adapter
+ Copyright (C) 2002 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 java.awt.dnd;
+
+/**
+ * This class implements <code>DropTargetListener</code>, and implements all methods
+ * with empty bodies. This allows a listener interested in implementing only
+ * a subset of these interfaces to extend this class and override only the
+ * desired methods.
+ *
+ * @author Michael Koch <konqueror@gmx.de>
+ * @since 1.4
+ * @status updated to 1.4
+ */
+public abstract class DropTargetAdapter
+ implements DropTargetListener
+{
+ /**
+ * Default constructor.
+ */
+ public DropTargetAdapter()
+ {
+ }
+
+ /**
+ * Called when the cursor hotspot enters a drop site which will accept the
+ * drag.
+ *
+ * @param e the event
+ */
+ public void dragEnter (DropTargetDragEvent e)
+ {
+ }
+
+ /**
+ * Called when the cursor hotspot moves inside of a drop site which will
+ * accept the drag.
+ *
+ * @param e the event
+ */
+ public void dragOver (DropTargetDragEvent e)
+ {
+ }
+
+ /**
+ * Called when the user modifies the drop gesture. This is often the case
+ * when additional mouse or key events are received during the drag.
+ *
+ * @param e the event
+ */
+ public void dropActionChanged (DropTargetDragEvent e)
+ {
+ }
+
+ /**
+ * Called when the cursor hotspot moves outside of a drop site which will
+ * accept the drag. This could also happen if the drop site is no longer
+ * active, or no longer accepts the drag.
+ *
+ * @param e the event
+ */
+ public void dragExit(DropTargetEvent e)
+ {
+ }
+} // class DropTargetAdapter
diff --git a/libjava/java/awt/dnd/DropTargetContext.java b/libjava/java/awt/dnd/DropTargetContext.java
new file mode 100644
index 00000000000..86adaade95e
--- /dev/null
+++ b/libjava/java/awt/dnd/DropTargetContext.java
@@ -0,0 +1,176 @@
+/* DropTargetContext.java --
+ Copyright (C) 2002 Free Software Foundation
+
+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 java.awt.dnd;
+
+import java.awt.dnd.peer.DropTargetContextPeer;
+import java.io.Serializable;
+import java.io.IOException;
+import java.awt.Component;
+import java.awt.datatransfer.DataFlavor;
+import java.awt.datatransfer.Transferable;
+import java.awt.datatransfer.UnsupportedFlavorException;
+import java.util.List;
+
+public class DropTargetContext implements Serializable
+{
+ static final long serialVersionUID = -634158968993743371L;
+
+ protected class TransferableProxy implements Transferable
+ {
+ protected boolean isLocal;
+ protected Transferable transferable;
+
+ public DataFlavor[] getTransferDataFlavors ()
+ {
+ // FIXME: implement this
+ return null;
+ }
+
+ public boolean isDataFlavorSupported (DataFlavor flavor)
+ {
+ // FIXME: implement this
+ return false;
+ }
+
+ public Object getTransferData (DataFlavor flavor)
+ throws UnsupportedFlavorException, IOException
+ {
+ // FIXME: implement this
+ return null;
+ }
+ }
+
+ private int targetActions;
+
+ public DropTarget getDropTarget ()
+ {
+ // FIXME: implement this
+ return null;
+ }
+
+ public Component getComponent ()
+ {
+ // FIXME: implement this
+ return null;
+ }
+
+ public void addNotify (java.awt.dnd.peer.DropTargetContextPeer dtcp)
+ {
+ // FIXME: implement this
+ }
+
+ public void removeNotify ()
+ {
+ // FIXME: implement this
+ }
+
+ protected void setTargetActions (int actions)
+ {
+ targetActions = actions;
+ }
+
+ protected int getTargetActions()
+ {
+ return targetActions;
+ }
+
+ /**
+ * FIXME
+ *
+ * @exception InvalidDnDOperationException FIXME
+ */
+ public void dropComplete (boolean success)
+ {
+ // FIXME: implement this
+ }
+
+ protected void acceptDrag (int dragOperation)
+ {
+ // FIXME: implement this
+ }
+
+ protected void rejectDrag ()
+ {
+ // FIXME: implement this
+ }
+
+ protected void acceptDrop (int dropOperation)
+ {
+ // FIXME: implement this
+ }
+
+ protected void rejectDrop ()
+ {
+ // FIXME: implement this
+ }
+
+ protected DataFlavor[] getCurrentDataFlavors ()
+ {
+ // FIXME: implement this
+ return null;
+ }
+
+ protected List getCurrentDataFlavorsAsList ()
+ {
+ // FIXME: implement this
+ return null;
+ }
+
+ protected boolean isDataFlavorSupported (DataFlavor flavor)
+ {
+ // FIXME: implement this
+ return false;
+ }
+
+ /**
+ * FIXME
+ *
+ * @exception InvalidDnDOperationException FIXME
+ */
+ protected Transferable getTransferable() throws InvalidDnDOperationException
+ {
+ // FIXME: implement this
+ return null;
+ }
+
+ protected Transferable createTransferableProxy(Transferable t, boolean local)
+ {
+ // FIXME: implement this
+ return null;
+ }
+} // class DropTargetContext
diff --git a/libjava/java/awt/dnd/DropTargetDragEvent.java b/libjava/java/awt/dnd/DropTargetDragEvent.java
new file mode 100644
index 00000000000..a22ddc8e32a
--- /dev/null
+++ b/libjava/java/awt/dnd/DropTargetDragEvent.java
@@ -0,0 +1,107 @@
+/* DropTargetDragEvent.java --
+ Copyright (C) 2002 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 java.awt.dnd;
+
+import java.util.List;
+import java.awt.Point;
+import java.awt.datatransfer.DataFlavor;
+
+public class DropTargetDragEvent extends DropTargetEvent
+{
+ private final int dropAction;
+ private final int srcActions;
+ private final Point location;
+
+ /**
+ * FIXME
+ *
+ * @exception NullPointerException FIXME
+ */
+ public DropTargetDragEvent (DropTargetContext context, Point location,
+ int dropAction, int srcActions)
+ {
+ super (context);
+ this.dropAction = dropAction;
+ this.srcActions = srcActions;
+ this.location = location;
+ }
+
+ public void acceptDrag (int dragOperation)
+ {
+ // FIXME: implement this
+ }
+
+ public DataFlavor[] getCurrentDataFlavors ()
+ {
+ // FIXME: implement this
+ return null;
+ }
+
+ public List getCurrentDataFlavorsAsList ()
+ {
+ // FIXME: implement this
+ return null;
+ }
+
+ public int getDropAction()
+ {
+ return 0;
+ //return dropAction & ((DropTargetContext) source).getTargetActions();
+ }
+
+ public Point getLocation ()
+ {
+ return location;
+ }
+
+ public int getSourceActions ()
+ {
+ return srcActions;
+ }
+
+ public boolean isDataFlavorSupported (DataFlavor df)
+ {
+ // FIXME: implement this
+ return true;
+ }
+
+ public void rejectDrag ()
+ {
+ // FIXME: implement this
+ }
+} // class DropTargetDragEvent
diff --git a/libjava/java/awt/dnd/DropTargetDropEvent.java b/libjava/java/awt/dnd/DropTargetDropEvent.java
new file mode 100644
index 00000000000..9a14f226302
--- /dev/null
+++ b/libjava/java/awt/dnd/DropTargetDropEvent.java
@@ -0,0 +1,132 @@
+/* DropTargetDropEvent.java --
+ Copyright (C) 2002 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 java.awt.dnd;
+
+import java.awt.Point;
+import java.awt.datatransfer.DataFlavor;
+import java.awt.datatransfer.Transferable;
+import java.util.List;
+
+public class DropTargetDropEvent extends DropTargetEvent
+{
+ private final int dropAction;
+ private final int srcActions;
+ private final Point location;
+ private final boolean isLocal;
+
+ public DropTargetDropEvent (DropTargetContext dtc, Point location,
+ int dropAction, int srcActions)
+ {
+ super (dtc);
+ this.dropAction = dropAction;
+ this.srcActions = srcActions;
+ this.location = location;
+ this.isLocal = false;
+ }
+
+ public DropTargetDropEvent (DropTargetContext dtc, Point location,
+ int dropAction, int srcActions, boolean isLocal)
+ {
+ super (dtc);
+ this.dropAction = dropAction;
+ this.srcActions = srcActions;
+ this.location = location;
+ this.isLocal = isLocal;
+ }
+
+ public Point getLocation ()
+ {
+ return location;
+ }
+
+ public DataFlavor[] getCurrentDataFlavors ()
+ {
+ // FIXME: implement this
+ return null;
+ }
+
+ public List getCurrentDataFlavorsAsList ()
+ {
+ // FIXME: implement this
+ return null;
+ }
+
+ public boolean isDataFlavorSupported (DataFlavor flavor)
+ {
+ // FIXME: implement this
+ return false;
+ }
+
+ public int getSourceActions ()
+ {
+ // FIXME: implement this
+ return 0;
+ }
+
+ public int getDropAction ()
+ {
+ // FIXME: implement this
+ return 0;
+ }
+
+ public Transferable getTransferable ()
+ {
+ // FIXME: implement this
+ return null;
+ }
+
+ public void acceptDrop (int dropAction)
+ {
+ // FIXME: implement this
+ }
+
+ public void rejectDrop ()
+ {
+ // FIXME: implement this
+ }
+
+ public void dropComplete (boolean success)
+ {
+ // FIXME: implement this
+ }
+
+ public boolean isLocalTransfer()
+ {
+ return isLocal;
+ }
+} // class DropTargetDropEvent
diff --git a/libjava/java/awt/dnd/DropTargetEvent.java b/libjava/java/awt/dnd/DropTargetEvent.java
new file mode 100644
index 00000000000..3065c2bc9ec
--- /dev/null
+++ b/libjava/java/awt/dnd/DropTargetEvent.java
@@ -0,0 +1,56 @@
+/* DropTarget.java --
+ Copyright (C) 2002 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 java.awt.dnd;
+
+import java.util.EventObject;
+
+public class DropTargetEvent extends EventObject
+{
+ protected DropTargetContext context;
+
+ public DropTargetEvent (DropTargetContext context)
+ {
+ super (context);
+ this.context = context;
+ }
+
+ public DropTargetContext getDropTargetContext ()
+ {
+ return context;
+ }
+}
diff --git a/libjava/java/awt/dnd/DropTargetListener.java b/libjava/java/awt/dnd/DropTargetListener.java
new file mode 100644
index 00000000000..861aa89140e
--- /dev/null
+++ b/libjava/java/awt/dnd/DropTargetListener.java
@@ -0,0 +1,89 @@
+/* DropTargetListener.java -- listen to events during the drop
+ Copyright (C) 2002 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 java.awt.dnd;
+
+import java.util.EventListener;
+
+/**
+ * @author Michael Koch <konqueror@gmx.de>
+ * @since 1.2
+ * @status updated to 1.4
+ */
+public interface DropTargetListener extends EventListener
+{
+ /**
+ * Called when the cursor hotspot enters a drop site which will accept the
+ * drag.
+ *
+ * @param e the drag source drag event
+ */
+ void dragEnter (DropTargetDragEvent e);
+
+ /**
+ * Called when the cursor hotspot moves inside of a drop site which will
+ * accept the drag.
+ *
+ * @param e the drag source drag event
+ */
+ void dragOver (DropTargetDragEvent e);
+
+ /**
+ * Called when the user modifies the drop gesture. This is often the case
+ * when additional mouse or key events are received during the drag.
+ *
+ * @param e the drag source drag event
+ */
+ void dropActionChanged (DropTargetDragEvent e);
+
+ /**
+ * Called when the cursor hotspot moves outside of a drop site which will
+ * accept the drag. This could also happen if the drop site is no longer
+ * active, or no longer accepts the drag.
+ *
+ * @param e the drag source drag event
+ */
+ void dragExit (DropTargetEvent e);
+
+ /**
+ * FIXME
+ *
+ * @param e the drag source drag event
+ */
+ void drop (DropTargetDropEvent e);
+} // interface DropTargetListener
diff --git a/libjava/java/awt/dnd/MouseDragGestureRecognizer.java b/libjava/java/awt/dnd/MouseDragGestureRecognizer.java
new file mode 100644
index 00000000000..1ef2e6cb483
--- /dev/null
+++ b/libjava/java/awt/dnd/MouseDragGestureRecognizer.java
@@ -0,0 +1,118 @@
+/* MouseDragGestureRecognizer.java --
+ Copyright (C) 2002 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 java.awt.dnd;
+
+import java.awt.Component;
+import java.awt.event.MouseEvent;
+import java.awt.event.MouseListener;
+import java.awt.event.MouseMotionListener;
+
+/**
+ * @author Michael Koch <konqueror@gmx.de>
+ */
+
+public abstract class MouseDragGestureRecognizer
+ extends DragGestureRecognizer
+ implements MouseListener, MouseMotionListener
+{
+ protected MouseDragGestureRecognizer (DragSource ds, Component c, int act,
+ DragGestureListener dgl)
+ {
+ super (ds, c, act, dgl);
+ }
+
+ protected MouseDragGestureRecognizer (DragSource ds, Component c, int act)
+ {
+ super (ds, c, act);
+ }
+
+ protected MouseDragGestureRecognizer (DragSource ds, Component c)
+ {
+ super (ds, c);
+ }
+
+ protected MouseDragGestureRecognizer (DragSource ds)
+ {
+ super (ds);
+ }
+
+ protected void registerListeners ()
+ {
+ // FIXME: implement this
+ }
+
+ protected void unregisterListeners ()
+ {
+ // FIXME: implement this
+ }
+
+ public void mouseClicked (MouseEvent e)
+ {
+ // FIXME: implement this
+ }
+
+ public void mousePressed (MouseEvent e)
+ {
+ // FIXME: implement this
+ }
+
+ public void mouseReleased (MouseEvent e)
+ {
+ // FIXME: implement this
+ }
+
+ public void mouseEntered (MouseEvent e)
+ {
+ // FIXME: implement this
+ }
+
+ public void mouseExited (MouseEvent e)
+ {
+ // FIXME: implement this
+ }
+
+ public void mouseDragged (MouseEvent e)
+ {
+ // FIXME: implement this
+ }
+
+ public void mouseMoved (MouseEvent e)
+ {
+ // FIXME: implement this
+ }
+} // class MouseDragGestureRecognizer
diff --git a/libjava/java/awt/dnd/peer/DropTargetContextPeer.java b/libjava/java/awt/dnd/peer/DropTargetContextPeer.java
new file mode 100644
index 00000000000..ad166d98002
--- /dev/null
+++ b/libjava/java/awt/dnd/peer/DropTargetContextPeer.java
@@ -0,0 +1,45 @@
+/* DropTargetContextPeer.java -- interface for drag-and-drop peers
+ Copyright (C) 2002 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 java.awt.dnd.peer;
+
+/**
+ * @author Michael Koch <konqueror@gmx.de>
+ */
+public interface DropTargetContextPeer
+{
+} // interface DropTargetContextPeer
diff --git a/libjava/java/awt/event/KeyEvent.java b/libjava/java/awt/event/KeyEvent.java
index 33390e48f42..35cac3f1c66 100644
--- a/libjava/java/awt/event/KeyEvent.java
+++ b/libjava/java/awt/event/KeyEvent.java
@@ -754,18 +754,18 @@ public class KeyEvent extends InputEvent
public static final int VK_EURO_SIGN = 516;
/**
- * The virtual key VK_EXCLAMATION_POINT.
+ * The virtual key VK_EXCLAMATION_MARK.
*
* @since 1.2
*/
- public static final int VK_EXCLAMATION_POINT = 517;
+ public static final int VK_EXCLAMATION_MARK = 517;
/**
- * The virtual key VK_INVERTED_EXCLAMATION_POINT.
+ * The virtual key VK_INVERTED_EXCLAMATION_MARK.
*
* @since 1.2
*/
- public static final int VK_INVERTED_EXCLAMATION_POINT = 518;
+ public static final int VK_INVERTED_EXCLAMATION_MARK = 518;
/**
* The virtual key VK_LEFT_PARENTHESIS.
@@ -1410,9 +1410,9 @@ public class KeyEvent extends InputEvent
return "Dollar";
case VK_EURO_SIGN:
return "Euro";
- case VK_EXCLAMATION_POINT:
+ case VK_EXCLAMATION_MARK:
return "Exclamation Mark";
- case VK_INVERTED_EXCLAMATION_POINT:
+ case VK_INVERTED_EXCLAMATION_MARK:
return "Inverted Exclamation Mark";
case VK_LEFT_PARENTHESIS:
return "Left Parenthesis";
diff --git a/libjava/java/awt/font/TextHitInfo.java b/libjava/java/awt/font/TextHitInfo.java
index 295b63478c5..903f1f616b9 100644
--- a/libjava/java/awt/font/TextHitInfo.java
+++ b/libjava/java/awt/font/TextHitInfo.java
@@ -107,4 +107,8 @@ public final class TextHitInfo {
return new TextHitInfo();
}
+ public String toString()
+ {
+ return "";
+ }
}
diff --git a/libjava/java/awt/geom/PathIterator.java b/libjava/java/awt/geom/PathIterator.java
index 871c9a8719b..6cf77d74df2 100644
--- a/libjava/java/awt/geom/PathIterator.java
+++ b/libjava/java/awt/geom/PathIterator.java
@@ -59,24 +59,24 @@ public interface PathIterator
* from the point to infinity (in any direction) crosses an odd number of
* segments.
*/
- int WIND_EVEN_ODD = 0;
+ static final int WIND_EVEN_ODD = 0;
/**
* The non-zero winding mode: a point is internal to the shape if a ray
* from the point to infinity (in any direction) crosses a different number
* of segments headed clockwise than those headed counterclockwise.
*/
- int WIND_NON_ZERO = 1;
+ static final int WIND_NON_ZERO = 1;
/**
* Starts a new subpath. There is no segment from the previous vertex.
*/
- int SEG_MOVETO = 0;
+ static final int SEG_MOVETO = 0;
/**
* The current segment is a line.
*/
- int SEG_LINETO = 1;
+ static final int SEG_LINETO = 1;
/**
* The current segment is a quadratic parametric curve. It is interpolated
@@ -91,7 +91,7 @@ public interface PathIterator
* = n! / (m! * (n-m)!)
* </pre>
*/
- int SEG_QUADTO = 2;
+ static final int SEG_QUADTO = 2;
/**
* The current segment is a cubic parametric curve (more commonly known as
@@ -107,13 +107,13 @@ public interface PathIterator
* = n! / (m! * (n-m)!)
* </pre>
*/
- int SEG_CUBICTO = 3;
+ static final int SEG_CUBICTO = 3;
/**
* The current segment closes a loop by an implicit line to the previous
* SEG_MOVETO coordinate.
*/
- int SEG_CLOSE = 4;
+ static final int SEG_CLOSE = 4;
/**
* Returns the winding rule to determine which points are inside this path.
diff --git a/libjava/java/awt/image/ColorModel.java b/libjava/java/awt/image/ColorModel.java
index 9cbbf4ba317..14a1b2e73b9 100644
--- a/libjava/java/awt/image/ColorModel.java
+++ b/libjava/java/awt/image/ColorModel.java
@@ -424,7 +424,7 @@ public abstract class ColorModel implements Transparency
for (int i=0; i<numComponents; i++)
{
float in = normComponents[normOffset++];
- int out = (int) (in * ((2<<getComponentSize(i)) - 1));
+ int out = (int) (in * ((1<<getComponentSize(i)) - 1));
components[offset++] = out;
}
return components;
@@ -447,7 +447,7 @@ public abstract class ColorModel implements Transparency
for (int i=0; i<numComponents; i++)
{
float in = components[offset++];
- float out = in / ((2<<getComponentSize(i)) - 1);
+ float out = in / ((1<<getComponentSize(i)) - 1);
normComponents[normOffset++] = out;
}
return normComponents;
diff --git a/libjava/java/awt/image/VolatileImage.java b/libjava/java/awt/image/VolatileImage.java
index 7455c2b17be..c1abb3529d4 100644
--- a/libjava/java/awt/image/VolatileImage.java
+++ b/libjava/java/awt/image/VolatileImage.java
@@ -49,7 +49,7 @@ public abstract class VolatileImage extends Image
{
public static final int IMAGE_OK = 0;
public static final int IMAGE_RESTORED = 1;
- public static final int IMAGE_INCOMPLETE = 2;
+ public static final int IMAGE_INCOMPATIBLE = 2;
public VolatileImage()
{
}
diff --git a/libjava/java/awt/image/renderable/RenderableImage.java b/libjava/java/awt/image/renderable/RenderableImage.java
index 0fd4fe5f823..f79442ee5d6 100644
--- a/libjava/java/awt/image/renderable/RenderableImage.java
+++ b/libjava/java/awt/image/renderable/RenderableImage.java
@@ -44,7 +44,7 @@ import java.util.Vector;
public interface RenderableImage
{
- String HINTS_OBSERVED = "HINTS_OBSERVED";
+ static final String HINTS_OBSERVED = "HINTS_OBSERVED";
Vector getSources();
Object getProperty(String name);
String[] getPropertyNames();
diff --git a/libjava/java/awt/peer/ContainerPeer.java b/libjava/java/awt/peer/ContainerPeer.java
index 929dfea14a9..23a8746a7b1 100644
--- a/libjava/java/awt/peer/ContainerPeer.java
+++ b/libjava/java/awt/peer/ContainerPeer.java
@@ -35,18 +35,15 @@ 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 java.awt.peer;
import java.awt.Insets;
public interface ContainerPeer extends ComponentPeer
{
-
-public abstract Insets insets();
-public abstract Insets getInsets();
-public abstract void beginValidate();
-public abstract void endValidate();
-
+ public abstract Insets insets();
+ public abstract Insets getInsets();
+ public abstract void beginValidate();
+ public abstract void endValidate();
} // interface ContainerPeer
diff --git a/libjava/java/beans/BeanInfo.java b/libjava/java/beans/BeanInfo.java
index ef989147115..dcfd78322fc 100644
--- a/libjava/java/beans/BeanInfo.java
+++ b/libjava/java/beans/BeanInfo.java
@@ -74,13 +74,13 @@ package java.beans;
public interface BeanInfo {
/** Use this as a parameter for the getIcon() command to retrieve a certain type of icon. **/
- public static int ICON_COLOR_16x16 = 1;
+ public static final int ICON_COLOR_16x16 = 1;
/** Use this as a parameter for the getIcon() command to retrieve a certain type of icon. **/
- public static int ICON_COLOR_32x32 = 2;
+ public static final int ICON_COLOR_32x32 = 2;
/** Use this as a parameter for the getIcon() command to retrieve a certain type of icon. **/
- public static int ICON_MONO_16x16 = 3;
+ public static final int ICON_MONO_16x16 = 3;
/** Use this as a parameter for the getIcon() command to retrieve a certain type of icon. **/
- public static int ICON_MONO_32x32 = 4;
+ public static final int ICON_MONO_32x32 = 4;
/** Get the general description of this Bean type.
** @return the BeanDescriptor for the Bean, or null if
diff --git a/libjava/java/beans/Introspector.java b/libjava/java/beans/Introspector.java
index fa98c69ae9d..ac9e36721e4 100644
--- a/libjava/java/beans/Introspector.java
+++ b/libjava/java/beans/Introspector.java
@@ -1,5 +1,5 @@
/* java.beans.Introspector
- Copyright (C) 1998 Free Software Foundation, Inc.
+ Copyright (C) 1998, 2002 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -209,6 +209,32 @@ public class Introspector {
}
}
+ /**
+ * Flush all of the Introspector's internal caches.
+ *
+ * @since 1.2
+ */
+ public static void flushCaches()
+ {
+ beanInfoCache.clear();
+ }
+
+ /**
+ * Flush the Introspector's internal cached information for a given
+ * class.
+ *
+ * @param clz the class to be flushed.
+ * @throws NullPointerException if clz is null.
+ * @since 1.2
+ */
+ public static void flushFromCaches(Class clz)
+ {
+ synchronized (clz)
+ {
+ beanInfoCache.remove(clz);
+ }
+ }
+
/**
* Get the BeanInfo for class <CODE>beanClass</CODE>,
* first by looking for explicit information, next by
diff --git a/libjava/java/beans/beancontext/BeanContextChildSupport.java b/libjava/java/beans/beancontext/BeanContextChildSupport.java
index 84373acf5fb..270854b2576 100644
--- a/libjava/java/beans/beancontext/BeanContextChildSupport.java
+++ b/libjava/java/beans/beancontext/BeanContextChildSupport.java
@@ -60,7 +60,11 @@ import java.io.Serializable;
* @see java.beans.beancontext.BeanContextChild
*/
-public class BeanContextChildSupport implements BeanContextChild, BeanContextServicesListener, Serializable {
+public class BeanContextChildSupport
+ implements BeanContextChild, BeanContextServicesListener, Serializable
+{
+ static final long serialVersionUID = 6328947014421475877L;
+
/**
* The peer on which to perform <code>set</code> actions.
* This is here so that this class can be used as a peer.
diff --git a/libjava/java/io/CharArrayWriter.java b/libjava/java/io/CharArrayWriter.java
index 7cf94255b80..6f749b4833c 100644
--- a/libjava/java/io/CharArrayWriter.java
+++ b/libjava/java/io/CharArrayWriter.java
@@ -1,5 +1,5 @@
/* CharArrayWriter.java -- Write chars to a buffer
- Copyright (C) 1998, 1999, 2001 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2001, 2002 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -98,19 +98,13 @@ public class CharArrayWriter extends Writer
*/
public void close ()
{
- closed = true;
}
/**
* This method flushes all buffered chars to the stream.
*/
- public void flush () throws IOException
+ public void flush ()
{
- synchronized (lock)
- {
- if (closed)
- throw new IOException ("Stream closed");
- }
}
/**
@@ -123,9 +117,6 @@ public class CharArrayWriter extends Writer
synchronized (lock)
{
count = 0;
- // Allow this to reopen the stream.
- // FIXME - what does the JDK do?
- closed = false;
}
}
@@ -187,13 +178,10 @@ public class CharArrayWriter extends Writer
*
* @param oneChar The char to be read passed as an int
*/
- public void write (int oneChar) throws IOException
+ public void write (int oneChar)
{
synchronized (lock)
{
- if (closed)
- throw new IOException ("Stream closed");
-
resize (1);
buf[count++] = (char) oneChar;
}
@@ -207,13 +195,10 @@ public class CharArrayWriter extends Writer
* @param offset The index into the buffer to start writing data from
* @param len The number of chars to write
*/
- public void write (char[] buffer, int offset, int len) throws IOException
+ public void write (char[] buffer, int offset, int len)
{
synchronized (lock)
{
- if (closed)
- throw new IOException ("Stream closed");
-
if (len >= 0)
resize (len);
System.arraycopy(buffer, offset, buf, count, len);
@@ -230,13 +215,10 @@ public class CharArrayWriter extends Writer
* @param offset The index into the string to start writing data from
* @param len The number of chars to write
*/
- public void write (String str, int offset, int len) throws IOException
+ public void write (String str, int offset, int len)
{
synchronized (lock)
{
- if (closed)
- throw new IOException ("Stream closed");
-
if (len >= 0)
resize (len);
str.getChars(offset, offset + len, buf, count);
@@ -289,9 +271,4 @@ public class CharArrayWriter extends Writer
* The number of chars that have been written to the buffer
*/
protected int count;
-
- /**
- * True if the stream has been closed.
- */
- private boolean closed;
}
diff --git a/libjava/java/io/DataInputStream.java b/libjava/java/io/DataInputStream.java
index 1223e3e7fe5..52c0c7a7b82 100644
--- a/libjava/java/io/DataInputStream.java
+++ b/libjava/java/io/DataInputStream.java
@@ -734,7 +734,9 @@ public class DataInputStream extends FilterInputStream implements DataInput
static String convertFromUTF(byte[] buf)
throws EOFException, UTFDataFormatException
{
- StringBuffer strbuf = new StringBuffer();
+ // Give StringBuffer an initial estimated size to avoid
+ // enlarge buffer frequently
+ StringBuffer strbuf = new StringBuffer(buf.length/2 + 2);
for (int i = 0; i < buf.length; )
{
diff --git a/libjava/java/io/Externalizable.java b/libjava/java/io/Externalizable.java
index 4e3b1cabca3..83f1b653ec5 100644
--- a/libjava/java/io/Externalizable.java
+++ b/libjava/java/io/Externalizable.java
@@ -62,6 +62,7 @@ package java.io;
*/
public interface Externalizable extends Serializable
{
+ static final long serialVersionUID = -282491828744381764L;
/**
* This method restores an object's state by reading in the instance data
diff --git a/libjava/java/io/FileInputStream.java b/libjava/java/io/FileInputStream.java
index 6a02d2ba862..d7efc26db87 100644
--- a/libjava/java/io/FileInputStream.java
+++ b/libjava/java/io/FileInputStream.java
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998, 1999, 2001 Free Software Foundation
+/* Copyright (C) 1998, 1999, 2001, 2002 Free Software Foundation
This file is part of libgcj.
@@ -8,6 +8,8 @@ details. */
package java.io;
+import java.nio.channels.FileChannel;
+
/**
* @author Warren Levy <warrenl@cygnus.com>
* @date October 28, 1998.
@@ -23,6 +25,8 @@ public class FileInputStream extends InputStream
/* Contains the file descriptor for referencing the actual file. */
private FileDescriptor fd;
+ private FileChannel ch;
+
public FileInputStream(String name) throws FileNotFoundException
{
SecurityManager s = System.getSecurityManager();
@@ -92,4 +96,9 @@ public class FileInputStream extends InputStream
long endPos = fd.seek(n, FileDescriptor.CUR, true);
return endPos - startPos;
}
+
+ public FileChannel getChannel ()
+ {
+ return ch;
+ }
}
diff --git a/libjava/java/io/FileOutputStream.java b/libjava/java/io/FileOutputStream.java
index b592299a355..5ea24e5dfcf 100644
--- a/libjava/java/io/FileOutputStream.java
+++ b/libjava/java/io/FileOutputStream.java
@@ -10,6 +10,8 @@ details. */
package java.io;
+import java.nio.channels.FileChannel;
+
/**
* @author Tom Tromey <tromey@cygnus.com>
* @date September 24, 1998
@@ -93,4 +95,9 @@ public class FileOutputStream extends OutputStream
// Instance variables.
private FileDescriptor fd;
+
+ public FileChannel getChannel ()
+ {
+ return null;
+ }
}
diff --git a/libjava/java/io/FilePermission.java b/libjava/java/io/FilePermission.java
index a8cd3d44a4a..0fc06c91473 100644
--- a/libjava/java/io/FilePermission.java
+++ b/libjava/java/io/FilePermission.java
@@ -41,7 +41,10 @@ package java.io;
import java.security.*;
-public final class FilePermission extends Permission implements Serializable {
+public final class FilePermission extends Permission implements Serializable
+{
+ static final long serialVersionUID = 7930732926638008763L;
+
private static final String CURRENT_DIRECTORY = System.getProperty("user.dir");
private boolean usingPerms = false;
private boolean readPerm = false;
diff --git a/libjava/java/io/ObjectInputStream.java b/libjava/java/io/ObjectInputStream.java
index e1e16f28498..08ce401fad8 100644
--- a/libjava/java/io/ObjectInputStream.java
+++ b/libjava/java/io/ObjectInputStream.java
@@ -1,5 +1,5 @@
/* ObjectInputStream.java -- Class used to read serialized objects
- Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -42,6 +42,7 @@ import gnu.classpath.Configuration;
import java.lang.reflect.Array;
import java.lang.reflect.Modifier;
+import java.lang.reflect.Proxy;
import java.util.Arrays;
import java.util.Hashtable;
import java.util.Vector;
@@ -527,6 +528,32 @@ public class ObjectInputStream extends InputStream
}
+ protected Class resolveProxyClass (String[] intfs)
+ throws IOException, ClassNotFoundException
+ {
+ SecurityManager sm = System.getSecurityManager ();
+
+ if (sm == null)
+ sm = new SecurityManager () {};
+
+ ClassLoader cl = currentClassLoader (sm);
+
+ Class[] clss = new Class[intfs.length];
+ if(cl == null){
+ for (int i = 0; i < intfs.length; i++)
+ clss[i] = Class.forName(intfs[i]);
+ cl = ClassLoader.getSystemClassLoader();
+ }
+ else
+ for (int i = 0; i < intfs.length; i++)
+ clss[i] = cl.loadClass(intfs[i]);
+ try {
+ return Proxy.getProxyClass(cl, clss);
+ } catch (IllegalArgumentException e) {
+ throw new ClassNotFoundException(null, e);
+ }
+ }
+
/**
If <code>enable</code> is <code>true</code> and this object is
trusted, then <code>resolveObject (Object)</code> will be called
diff --git a/libjava/java/io/ObjectStreamConstants.java b/libjava/java/io/ObjectStreamConstants.java
index 111a0f3fa26..980b04de264 100644
--- a/libjava/java/io/ObjectStreamConstants.java
+++ b/libjava/java/io/ObjectStreamConstants.java
@@ -70,7 +70,7 @@ public interface ObjectStreamConstants
final static byte TC_PROXYCLASSDESC = (byte)125; //0x7D
final static byte TC_BASE = TC_NULL;
- final static byte TC_MAX = TC_EXCEPTION;
+ final static byte TC_MAX = TC_PROXYCLASSDESC;
final static int baseWireHandle = 0x7e0000;
diff --git a/libjava/java/io/Serializable.java b/libjava/java/io/Serializable.java
index 2afdff4669b..0d6310ce340 100644
--- a/libjava/java/io/Serializable.java
+++ b/libjava/java/io/Serializable.java
@@ -51,4 +51,5 @@ package java.io;
*/
public interface Serializable
{
+ static final long serialVersionUID = 1196656838076753133L;
} // interface Serializable
diff --git a/libjava/java/io/SerializablePermission.java b/libjava/java/io/SerializablePermission.java
index 12c2d762281..d9dc3dd924a 100644
--- a/libjava/java/io/SerializablePermission.java
+++ b/libjava/java/io/SerializablePermission.java
@@ -61,7 +61,8 @@ import java.security.BasicPermission;
*/
public final class SerializablePermission extends BasicPermission
{
-
+ static final long serialVersionUID = 8537212141160296410L;
+
/*
* Class Variables
*/
diff --git a/libjava/java/io/natFileDescriptorPosix.cc b/libjava/java/io/natFileDescriptorPosix.cc
index 9f4c7c3cb1d..80e6bad97ae 100644
--- a/libjava/java/io/natFileDescriptorPosix.cc
+++ b/libjava/java/io/natFileDescriptorPosix.cc
@@ -195,6 +195,7 @@ java::io::FileDescriptor::setLength (jlong pos)
struct stat sb;
off_t orig;
+#ifdef HAVE_FTRUNCATE
if (::fstat (fd, &sb))
throw new IOException (JvNewStringLatin1 (strerror (errno)));
@@ -219,6 +220,9 @@ java::io::FileDescriptor::setLength (jlong pos)
}
else if (::ftruncate (fd, (off_t) pos))
throw new IOException (JvNewStringLatin1 (strerror (errno)));
+#else /* HAVE_FTRUNCATE */
+ throw new IOException (JvNewStringLatin1 ("FileDescriptor.setLength not implemented"));
+#endif /* HAVE_FTRUNCATE */
}
jint
@@ -289,6 +293,11 @@ java::io::FileDescriptor::read (jbyteArray buffer, jint offset, jint count)
jsize bsize = JvGetArrayLength (buffer);
if (offset < 0 || count < 0 || offset + count > bsize)
throw new java::lang::ArrayIndexOutOfBoundsException;
+
+ // Must return 0 if an attempt is made to read 0 bytes.
+ if (count == 0)
+ return 0;
+
jbyte *bytes = elements (buffer) + offset;
int r = ::read (fd, bytes, count);
if (r == 0)
diff --git a/libjava/java/io/natFileDescriptorWin32.cc b/libjava/java/io/natFileDescriptorWin32.cc
index e004057ef91..4b157f7042c 100644
--- a/libjava/java/io/natFileDescriptorWin32.cc
+++ b/libjava/java/io/natFileDescriptorWin32.cc
@@ -305,6 +305,10 @@ java::io::FileDescriptor::read(jbyteArray buffer, jint offset, jint count)
if (offset < 0 || count < 0 || offset + count > bsize)
throw new java::lang::ArrayIndexOutOfBoundsException;
+ // Must return 0 if an attempt is made to read 0 bytes.
+ if (count == 0)
+ return 0;
+
jbyte *bytes = elements (buffer) + offset;
DWORD read;
diff --git a/libjava/java/io/natFileWin32.cc b/libjava/java/io/natFileWin32.cc
index af955016c4f..ebdaeab1d78 100644
--- a/libjava/java/io/natFileWin32.cc
+++ b/libjava/java/io/natFileWin32.cc
@@ -83,10 +83,13 @@ java::io::File::attr (jint query)
JvAssert (query == MODIFIED || query == LENGTH);
- WIN32_FILE_ATTRIBUTE_DATA info;
- if (! GetFileAttributesEx(buf, GetFileExInfoStandard, &info))
+ WIN32_FIND_DATA info;
+ HANDLE sHandle;
+ if ( ( sHandle = FindFirstFile( buf, &info)) == INVALID_HANDLE_VALUE)
return 0;
-
+
+ FindClose( sHandle);
+
if (query == LENGTH)
return ((long long)info.nFileSizeHigh) << 32 | (unsigned long long)info.nFileSizeLow;
else {
diff --git a/libjava/java/lang/AssertionError.java b/libjava/java/lang/AssertionError.java
index 1ce00aee7af..2bbf81cac97 100644
--- a/libjava/java/lang/AssertionError.java
+++ b/libjava/java/lang/AssertionError.java
@@ -42,7 +42,7 @@ package java.lang;
* An assertion error normally occurs as a result of the <code>assert</code>
* statement added in JDK 1.4, to indicate that an assertion failed. There
* are enough constructors to ensure that
- * <code>new AssertionError(<em>expression</em)</code> will work for all
+ * <code>new AssertionError(<em>expression</em>)</code> will work for all
* espressions, regardless of type, as if the error message were given by
* the string <code>"" + <em>expression</em></code>. This extends Error,
* because you usually do not want to inadvertently trap an assertion failure.
diff --git a/libjava/java/lang/Class.h b/libjava/java/lang/Class.h
index 9eb1a5cac1a..bd2903d47cf 100644
--- a/libjava/java/lang/Class.h
+++ b/libjava/java/lang/Class.h
@@ -19,6 +19,7 @@ details. */
#include <java/net/URL.h>
#include <java/lang/reflect/Modifier.h>
#include <java/security/ProtectionDomain.h>
+#include <java/lang/Package.h>
// We declare these here to avoid including gcj/cni.h.
extern "C" void _Jv_InitClass (jclass klass);
@@ -45,9 +46,10 @@ enum
JV_STATE_LINKED = 9, // Strings interned.
JV_STATE_IN_PROGRESS = 10, // <Clinit> running.
- JV_STATE_DONE = 12, //
- JV_STATE_ERROR = 14 // must be last.
+ JV_STATE_ERROR = 12,
+
+ JV_STATE_DONE = 14 // Must be last.
};
struct _Jv_Field;
@@ -159,6 +161,9 @@ private:
java::lang::reflect::Method *getPrivateMethod (jstring, JArray<jclass> *);
java::security::ProtectionDomain *getProtectionDomain0 ();
+ java::lang::reflect::Method *_getMethod (jstring, JArray<jclass> *);
+ java::lang::reflect::Method *_getDeclaredMethod (jstring, JArray<jclass> *);
+
public:
JArray<java::lang::reflect::Field *> *getFields (void);
@@ -166,7 +171,6 @@ public:
void getSignature (java::lang::StringBuffer *buffer);
static jstring getSignature (JArray<jclass> *, jboolean is_constructor);
- java::lang::reflect::Method *_getMethod (jstring, JArray<jclass> *);
JArray<java::lang::reflect::Method *> *getMethods (void);
inline jint getModifiers (void)
@@ -209,6 +213,8 @@ public:
}
jobject newInstance (void);
+ java::security::ProtectionDomain *getProtectionDomain (void);
+ java::lang::Package *getPackage (void);
jstring toString (void);
jboolean desiredAssertionStatus (void);
@@ -325,8 +331,6 @@ private:
#ifdef INTERPRETER
friend jboolean _Jv_IsInterpretedClass (jclass);
friend void _Jv_InitField (jobject, jclass, _Jv_Field*);
- friend int _Jv_DetermineVTableIndex (jclass, _Jv_Utf8Const *,
- _Jv_Utf8Const*);
friend void _Jv_InitField (jobject, jclass, int);
friend _Jv_word _Jv_ResolvePoolEntry (jclass, int);
friend _Jv_Method *_Jv_SearchMethodInClass (jclass cls, jclass klass,
diff --git a/libjava/java/lang/Class.java b/libjava/java/lang/Class.java
index 12306da8061..cc1cc40f2a4 100644
--- a/libjava/java/lang/Class.java
+++ b/libjava/java/lang/Class.java
@@ -65,9 +65,31 @@ public final class Class implements Serializable
public native Field getDeclaredField (String fieldName)
throws NoSuchFieldException, SecurityException;
public native Field[] getDeclaredFields () throws SecurityException;
- public native Method getDeclaredMethod (String methodName,
- Class[] parameterTypes)
- throws NoSuchMethodException, SecurityException;
+
+ private native Method _getDeclaredMethod (String methodName,
+ Class[] parameterTypes);
+
+ public Method getDeclaredMethod (String methodName, Class[] parameterTypes)
+ throws NoSuchMethodException, SecurityException
+ {
+ SecurityManager sm = System.getSecurityManager();
+ if (sm != null)
+ {
+ sm.checkMemberAccess(this, Member.DECLARED);
+ Package p = getPackage();
+ if (p != null)
+ sm.checkPackageAccess(p.getName());
+ }
+
+ if ("<init>".equals(methodName) || "<clinit>".equals(methodName))
+ throw new NoSuchMethodException(methodName);
+
+ Method m = _getDeclaredMethod(methodName, parameterTypes);
+ if (m == null)
+ throw new NoSuchMethodException (methodName);
+ return m;
+ }
+
public native Method[] getDeclaredMethods () throws SecurityException;
// This is marked as unimplemented in the JCL book.
diff --git a/libjava/java/lang/ClassLoader.java b/libjava/java/lang/ClassLoader.java
index a6faa61b2ed..1b3b310cab3 100644
--- a/libjava/java/lang/ClassLoader.java
+++ b/libjava/java/lang/ClassLoader.java
@@ -177,14 +177,18 @@ public abstract class ClassLoader
if (c == null)
{
- try {
- if (parent != null)
- return parent.loadClass (name, link);
- else
- c = gnu.gcj.runtime.VMClassLoader.instance.findClass (name);
- } catch (ClassNotFoundException ex) {
- /* ignore, we'll try findClass */;
- }
+ try
+ {
+ ClassLoader cl = parent;
+ if (parent == null)
+ cl = gnu.gcj.runtime.VMClassLoader.instance;
+ if (cl != this)
+ c = cl.loadClass (name, link);
+ }
+ catch (ClassNotFoundException ex)
+ {
+ /* ignore, we'll try findClass */;
+ }
}
if (c == null)
@@ -432,17 +436,24 @@ public abstract class ClassLoader
{
synchronized (clazz)
{
- try {
- linkClass0 (clazz);
- } catch (Throwable x) {
- markClassErrorState0 (clazz);
-
- if (x instanceof Error)
- throw (Error)x;
- else
- throw new java.lang.InternalError
- ("unexpected exception during linking: " + x);
- }
+ try
+ {
+ linkClass0 (clazz);
+ }
+ catch (Throwable x)
+ {
+ markClassErrorState0 (clazz);
+
+ if (x instanceof Error)
+ throw (Error)x;
+ else
+ {
+ InternalError e
+ = new InternalError ("unexpected exception during linking");
+ e.initCause (x);
+ throw e;
+ }
+ }
}
}
diff --git a/libjava/java/lang/Double.java b/libjava/java/lang/Double.java
index 22f2b5f524a..199f64ee5b8 100644
--- a/libjava/java/lang/Double.java
+++ b/libjava/java/lang/Double.java
@@ -191,10 +191,7 @@ public final class Double extends Number implements Comparable
*/
public static Double valueOf(String s)
{
- // XXX just call new Double(parseDouble(s));
- if (s == null)
- throw new NullPointerException();
- return new Double(s);
+ return new Double(parseDouble(s));
}
/**
diff --git a/libjava/java/lang/SecurityManager.java b/libjava/java/lang/SecurityManager.java
index 3ae049c403f..e54ebc62f70 100644
--- a/libjava/java/lang/SecurityManager.java
+++ b/libjava/java/lang/SecurityManager.java
@@ -1,5 +1,5 @@
-/* java.lang.SecurityManager
- Copyright (C) 1998, 1999, 2001 Free Software Foundation, Inc.
+/* SecurityManager.java -- security checks for privileged actions
+ Copyright (C) 1998, 1999, 2001, 2002 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -7,7 +7,7 @@ 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
@@ -38,736 +38,999 @@ exception statement from your version. */
package java.lang;
-import java.net.*;
-import java.util.*;
-import java.io.*;
+import java.awt.AWTPermission;
+import java.io.File;
+import java.io.FileDescriptor;
+import java.io.FilePermission;
+import java.lang.reflect.Member;
+import java.net.InetAddress;
+import java.net.SocketPermission;
+import java.security.AllPermission;
+import java.security.Permission;
+import java.security.Security;
+import java.security.SecurityPermission;
+import java.util.PropertyPermission;
/**
- ** SecurityManager is a class you can extend to create
- ** your own Java security policy. By default, there is
- ** no SecurityManager installed in 1.1, which means that
- ** all things are permitted to all people.<P>
- **
- ** The default methods in this class deny all
- ** things to all people.
- **
- ** @author John Keiser
- ** @version 1.1.0, 31 May 1998
- ** @since JDK1.0
- **/
-public class SecurityManager {
- /** Tells whether or not the SecurityManager is currently
- ** performing a security check.
- **/
- protected boolean inCheck;
-
- /** Tells whether or not the SecurityManager is currently
- ** performing a security check.
- **
- ** @return whether or not the SecurityManager is
- ** currently performing a security check.
- **/
- public boolean getInCheck() {
- return inCheck;
- }
+ * SecurityManager is a class you can extend to create your own Java
+ * security policy. By default, there is no SecurityManager installed in
+ * 1.1, which means that all things are permitted to all people. The security
+ * manager, if set, is consulted before doing anything with potentially
+ * dangerous results, and throws a <code>SecurityException</code> if the
+ * action is forbidden.
+ *
+ * <p>A typical check is as follows, just before the dangerous operation:<br>
+ * <pre>
+ * SecurityManager sm = System.getSecurityManager();
+ * if (sm != null)
+ * sm.checkABC(<em>argument</em>, ...);
+ * </pre>
+ * Note that this is thread-safe, by caching the security manager in a local
+ * variable rather than risking a NullPointerException if the mangager is
+ * changed between the check for null and before the permission check.
+ *
+ * <p>The special method <code>checkPermission</code> is a catchall, and
+ * the default implementation calls
+ * <code>AccessController.checkPermission</code>. In fact, all the other
+ * methods default to calling checkPermission.
+ *
+ * <p>Sometimes, the security check needs to happen from a different context,
+ * such as when called from a worker thread. In such cases, use
+ * <code>getSecurityContext</code> to take a snapshot that can be passed
+ * to the worker thread:<br>
+ * <pre>
+ * Object context = null;
+ * SecurityManager sm = System.getSecurityManager();
+ * if (sm != null)
+ * context = sm.getSecurityContext(); // defaults to an AccessControlContext
+ * // now, in worker thread
+ * if (sm != null)
+ * sm.checkPermission(permission, context);
+ * <pre>
+ *
+ * <p>Permissions fall into these categories: File, Socket, Net, Security,
+ * Runtime, Property, AWT, Reflect, and Serializable. Each of these
+ * permissions have a property naming convention, that follows a hierarchical
+ * naming convention, to make it easy to grant or deny several permissions
+ * at once. Some permissions also take a list of permitted actions, such
+ * as "read" or "write", to fine-tune control even more. The permission
+ * <code>java.security.AllPermission</code> grants all permissions.
+ *
+ * <p>The default methods in this class deny all things to all people. You
+ * must explicitly grant permission for anything you want to be legal when
+ * subclassing this class.
+ *
+ * @author John Keiser
+ * @author Eric Blake <ebb9@email.byu.edu>
+ * @see ClassLoader
+ * @see SecurityException
+ * @see #checkTopLevelWindow(Object)
+ * @see System#getSecurityManager()
+ * @see System#setSecurityManager(SecurityManager)
+ * @see AccessController
+ * @see AccessControlContext
+ * @see AccessControlException
+ * @see Permission
+ * @see BasicPermission
+ * @see java.io.FilePermission
+ * @see java.net.SocketPermission
+ * @see java.util.PropertyPermission
+ * @see RuntimePermission
+ * @see java.awt.AWTPermission
+ * @see Policy
+ * @see SecurityPermission
+ * @see ProtectionDomain
+ * @since 1.0
+ * @status still missing 1.4 functionality
+ */
+public class SecurityManager
+{
+ /**
+ * Tells whether or not the SecurityManager is currently performing a
+ * security check.
+ * @deprecated Use {@link #checkPermission(Permission)} instead.
+ */
+ protected boolean inCheck;
- /** Get a list of all the classes currently executing
- ** methods on the Java stack. getClassContext()[0] is
- ** the currently executing method
- ** <STRONG>Spec Note:</STRONG> does not say whether
- ** the stack will include the getClassContext() call or
- ** the one just before it.
- **
- ** @return an array containing all the methods on classes
- ** on the Java execution stack.
- **/
- protected Class[] getClassContext() {
- return VMSecurityManager.getClassContext();
- }
+ /**
+ * Construct a new security manager. There may be a security check, of
+ * <code>RuntimePermission("createSecurityManager")</code>.
+ *
+ * @throws SecurityException if permission is denied
+ */
+ public SecurityManager()
+ {
+ SecurityManager sm = System.getSecurityManager();
+ if (sm != null)
+ sm.checkPermission(new RuntimePermission("createSecurityManager"));
+ }
- /** Find the ClassLoader for the most recent class on the
- ** stack that was loaded by an explicit ClassLoader. If
- ** everything on the stack was loaded by the system
- ** classloader, null is returned.
- **
- ** @return the most recent ClassLoader on the execution
- ** stack.
- **/
- protected ClassLoader currentClassLoader() {
- return VMSecurityManager.currentClassLoader();
- }
+ /**
+ * Tells whether or not the SecurityManager is currently performing a
+ * security check.
+ *
+ * @return true if the SecurityManager is in a security check
+ * @see #inCheck
+ * @deprecated use {@link #checkPermission(Permission)} instead
+ */
+ public boolean getInCheck()
+ {
+ return inCheck;
+ }
- /** Find the most recent class on the stack that was
- ** loaded by an explicit ClassLoader. If everything on
- ** the stack was loaded by the system classloader, null
- ** is returned.
- **
- ** @return the most recent loaded Class on the execution
- ** stack.
- **/
- protected Class currentLoadedClass() {
- Class[] c = getClassContext();
- for(int i=0;i<c.length;i++) {
- if(c[i].getClassLoader() != null) {
- return c[i];
- }
- }
- return null;
- }
+ /**
+ * Get a list of all the classes currently executing methods on the Java
+ * stack. getClassContext()[0] is the currently executing method (ie. the
+ * class that CALLED getClassContext, not SecurityManager).
+ *
+ * @return an array of classes on the Java execution stack
+ */
+ protected Class[] getClassContext()
+ {
+ return VMSecurityManager.getClassContext();
+ }
- /** Get the depth on the execution stack of the most
- ** recent class that was loaded by an explicit
- ** ClassLoader. This can be used as an index into
- ** getClassContext().
- **
- ** @return the index of the most recent loaded Class on
- ** the execution stack.
- **/
- protected int classLoaderDepth() {
- Class[] c = getClassContext();
- for(int i=0;i<c.length;i++) {
- if(c[i].getClassLoader() != null) {
- return i;
- }
- }
- return -1;
- }
+ /**
+ * Find the ClassLoader of the first non-system class on the execution
+ * stack. A non-system class is one whose ClassLoader is not equal to
+ * {@link ClassLoader#getSystemClassLoader()} or its ancestors. This
+ * will return null in three cases:<br><nl>
+ * <li>All methods on the stack are from system classes</li>
+ * <li>All methods on the stack up to the first "privileged" caller, as
+ * created by {@link AccessController.doPrivileged(PrivilegedAction)},
+ * are from system classes</li>
+ * <li>A check of <code>java.security.AllPermission</code> succeeds.</li>
+ * </nl>
+ *
+ * @return the most recent non-system ClassLoader on the execution stack
+ * @deprecated use {@link #checkPermission(Permission)} instead
+ */
+ protected ClassLoader currentClassLoader()
+ {
+ return VMSecurityManager.currentClassLoader();
+ }
- /** Tell whether there is a class loaded with an explicit
- ** ClassLoader on the stack.
- **
- ** @return whether there is a class loaded with an
- ** explicit ClassLoader on the stack.
- **/
- protected boolean inClassLoader() {
- return classLoaderDepth() != -1;
- }
+ /**
+ * Find the first non-system class on the execution stack. A non-system
+ * class is one whose ClassLoader is not equal to
+ * {@link ClassLoader#getSystemClassLoader()} or its ancestors. This
+ * will return null in three cases:<br><nl>
+ * <li>All methods on the stack are from system classes</li>
+ * <li>All methods on the stack up to the first "privileged" caller, as
+ * created by {@link AccessController.doPrivileged(PrivilegedAction)},
+ * are from system classes</li>
+ * <li>A check of <code>java.security.AllPermission</code> succeeds.</li>
+ * </nl>
+ *
+ * @return the most recent non-system Class on the execution stack
+ * @deprecated use {@link #checkPermission(Permission)} instead
+ */
+ protected Class currentLoadedClass()
+ {
+ Class[] c = getClassContext();
+ for (int i = 0; i < c.length; i++)
+ if (c[i].getClassLoader() != null)
+ return c[i];
+ return null;
+ }
+ /**
+ * Get the depth of a particular class on the execution stack.
+ *
+ * @param className the fully-qualified name to search for
+ * @return the index of the class on the stack, or -1
+ * @deprecated use {@link #checkPermission(Permission)} instead
+ */
+ protected int classDepth(String className)
+ {
+ Class[] c = getClassContext();
+ for (int i = 0; i < c.length; i++)
+ if (className.equals(c[i].getName()))
+ return i;
+ return -1;
+ }
- /** Get the depth of a particular class on the execution
- ** stack.
- **
- ** @param className the fully-qualified name of the class
- ** to search for on the stack.
- ** @return the index of the class on the stack, or -1 if
- ** the class is not on the stack.
- **/
- protected int classDepth(String className) {
- Class[] c = getClassContext();
- for(int i=0;i<c.length;i++) {
- if(className.equals(c[i].getName())) {
- return i;
- }
- }
- return -1;
- }
+ /**
+ * Get the depth on the execution stack of the most recent non-system class.
+ * A non-system class is one whose ClassLoader is not equal to
+ * {@link ClassLoader#getSystemClassLoader()} or its ancestors. This
+ * will return -1 in three cases:<br><nl>
+ * <li>All methods on the stack are from system classes</li>
+ * <li>All methods on the stack up to the first "privileged" caller, as
+ * created by {@link AccessController.doPrivileged(PrivilegedAction)},
+ * are from system classes</li>
+ * <li>A check of <code>java.security.AllPermission</code> succeeds.</li>
+ * </nl>
+ *
+ * @return the index of the most recent non-system Class on the stack
+ * @deprecated use {@link #checkPermission(Permission)} instead
+ */
+ protected int classLoaderDepth()
+ {
+ Class[] c = getClassContext();
+ for (int i = 0; i < c.length; i++)
+ if (c[i].getClassLoader() != null)
+ return i;
+ return -1;
+ }
- /** Tell whether the specified class is on the execution
- ** stack.
- **
- ** @param className the fully-qualified name of the class
- ** to search for on the stack.
- ** @return whether the specified class is on the
- ** execution stack.
- **/
- protected boolean inClass(String className) {
- return classDepth(className) != -1;
- }
+ /**
+ * Tell whether the specified class is on the execution stack.
+ *
+ * @param className the fully-qualified name of the class to find
+ * @return whether the specified class is on the execution stack
+ * @deprecated use {@link #checkPermission(Permission)} instead
+ */
+ protected boolean inClass(String className)
+ {
+ return classDepth(className) != -1;
+ }
- /** Get an implementation-dependent Object that contains
- ** enough information about the current environment to be
- ** able to perform standard security checks later. This
- ** is used by trusted methods that need to verify that
- ** their callers have sufficient access to perform
- ** certain operations.<P>
- **
- ** Currently the only methods that use this are checkRead()
- ** and checkConnect().
- **
- ** @see checkConnect(java.lang.String,int,java.lang.Object)
- ** @see checkRead(java.lang.String,java.lang.Object)
- **/
- public Object getSecurityContext() {
- return new SecurityContext(getClassContext());
- }
+ /**
+ * Tell whether there is a class loaded with an explicit ClassLoader on
+ * the stack.
+ *
+ * @return whether a class with an explicit ClassLoader is on the stack
+ * @deprecated use {@link #checkPermission(Permission)} instead
+ */
+ protected boolean inClassLoader()
+ {
+ return classLoaderDepth() != -1;
+ }
- /** Check if the current thread is allowed to create a
- ** ClassLoader.<P>
- **
- ** This method is called from ClassLoader.ClassLoader(),
- ** in other words, whenever a ClassLoader is created.<P>
- **
- ** SecurityManager's implementation always denies access.
- **
- ** @exception SecurityException if the operation is not
- ** permitted.
- ** @see java.lang.ClassLoader#ClassLoader()
- **/
- public void checkCreateClassLoader() {
- throw new SecurityException("Cannot create new ClassLoaders.");
- }
+ /**
+ * Get an implementation-dependent Object that contains enough information
+ * about the current environment to be able to perform standard security
+ * checks later. This is used by trusted methods that need to verify that
+ * their callers have sufficient access to perform certain operations.
+ *
+ * <p>Currently the only methods that use this are checkRead() and
+ * checkConnect(). The default implementation returns an
+ * <code>AccessControlContext</code>.
+ *
+ * @return a security context
+ * @see #checkConnect(String, int, Object)
+ * @see #checkRead(String, Object)
+ * @see AccessControlContext
+ * @see AccessController#getContext()
+ */
+ public Object getSecurityContext()
+ {
+ // XXX Should be: return AccessController.getContext();
+ return new SecurityContext(getClassContext());
+ }
- /** Check if the current thread is allowed to modify this
- ** other Thread.<P>
- **
- ** Called by Thread.stop(), suspend(), resume(), and
- ** interrupt(), destroy(), setPriority(), setName() and
- ** setDaemon().<P>
- **
- ** SecurityManager's implementation always denies access.
- **
- ** @param g the Thread to check against
- ** @exception SecurityException if the operation is not
- ** permitted.
- ** @see java.lang.Thread#stop()
- ** @see java.lang.Thread#suspend()
- ** @see java.lang.Thread#resume()
- ** @see java.lang.Thread#interrupt()
- ** @see java.lang.Thread#destroy()
- ** @see java.lang.Thread#setPriority(int)
- ** @see java.lang.Thread#setName(java.lang.String)
- ** @see java.lang.Thread#setDaemon(boolean)
- **/
- public void checkAccess(Thread t) {
- throw new SecurityException("Cannot modify Threads.");
- }
+ /**
+ * Check if the current thread is allowed to perform an operation that
+ * requires the specified <code>Permission</code>. This defaults to
+ * <code>AccessController.checkPermission</code>.
+ *
+ * @param perm the <code>Permission</code> required
+ * @throws SecurityException if permission is denied
+ * @throws NullPointerException if perm is null
+ * @since 1.2
+ */
+ public void checkPermission(Permission perm)
+ {
+ // XXX Should be: AccessController.checkPermission(perm);
+ throw new SecurityException("Operation not allowed");
+ }
- /** Check if the current thread is allowed to modify this
- ** ThreadGroup.<P>
- **
- ** Called by Thread.Thread() (to add a thread to the
- ** ThreadGroup), ThreadGroup.ThreadGroup() (to add this
- ** ThreadGroup to a parent), ThreadGroup.stop(),
- ** suspend(), resume(), interrupt(), destroy(),
- ** setDaemon(), and setMaxPriority().<P>
- **
- ** SecurityManager's implementation always denies access.
- **
- ** @param g the ThreadGroup to check against
- ** @exception SecurityException if the operation is not
- ** permitted.
- ** @see java.lang.Thread#Thread()
- ** @see java.lang.ThreadGroup#ThreadGroup()
- ** @see java.lang.ThreadGroup#stop()
- ** @see java.lang.ThreadGroup#suspend()
- ** @see java.lang.ThreadGroup#resume()
- ** @see java.lang.ThreadGroup#interrupt()
- ** @see java.lang.ThreadGroup#setDaemon(boolean)
- ** @see java.lang.ThreadGroup#setMaxPriority(int)
- **/
- public void checkAccess(ThreadGroup g) {
- throw new SecurityException("Cannot modify ThreadGroups.");
- }
+ /**
+ * Check if the current thread is allowed to perform an operation that
+ * requires the specified <code>Permission</code>. This is done in a
+ * context previously returned by <code>getSecurityContext()</code>. The
+ * default implementation expects context to be an AccessControlContext,
+ * and it calls <code>AccessControlContext.checkPermission(perm)</code>.
+ *
+ * @param perm the <code>Permission</code> required
+ * @param context a security context
+ * @throws SecurityException if permission is denied, or if context is
+ * not an AccessControlContext
+ * @throws NullPointerException if perm is null
+ * @see #getSecurityContext()
+ * @see AccessControlContext#checkPermission(Permission)
+ * @since 1.2
+ */
+ public void checkPermission(Permission perm, Object context)
+ {
+ // XXX Should be:
+ // if (! (context instanceof AccessControlContext))
+ // throw new SecurityException("Missing context");
+ // ((AccessControlContext) context).checkPermission(perm);
+ throw new SecurityException("Operation not allowed");
+ }
- /** Check if the current thread is allowed to exit the
- ** JVM with the given status.<P>
- **
- ** This method is called from Runtime.exit().<P>
- **
- ** SecurityManager's implementation always denies access.
- **
- ** @param status the status to exit with
- ** @exception SecurityException if the operation is not
- ** permitted.
- ** @see java.lang.Runtime#exit()
- ** @see java.lang.Runtime#exit(int)
- **/
- public void checkExit(int status) {
- throw new SecurityException("Cannot exit JVM.");
- }
+ /**
+ * Check if the current thread is allowed to create a ClassLoader. This
+ * method is called from ClassLoader.ClassLoader(), and checks
+ * <code>RuntimePermission("createClassLoader")</code>. If you override
+ * this, you should call <code>super.checkCreateClassLoader()</code> rather
+ * than throwing an exception.
+ *
+ * @throws SecurityException if permission is denied
+ * @see ClassLoader#ClassLoader()
+ */
+ public void checkCreateClassLoader()
+ {
+ checkPermission(new RuntimePermission("createClassLoader"));
+ }
- /** Check if the current thread is allowed to execute the
- ** given program.<P>
- **
- ** This method is called from Runtime.exec().<P>
- **
- ** SecurityManager's implementation always denies access.
- **
- ** @param program the name of the program to exec
- ** @exception SecurityException if the operation is not
- ** permitted.
- ** @see java.lang.Runtime#exec(java.lang.String[],java.lang.String[])
- **/
- public void checkExec(String program) {
- throw new SecurityException("Cannot execute programs.");
- }
+ /**
+ * Check if the current thread is allowed to modify another Thread. This is
+ * called by Thread.stop(), suspend(), resume(), interrupt(), destroy(),
+ * setPriority(), setName(), and setDaemon(). The default implementation
+ * checks <code>RuntimePermission("modifyThread") on system threads (ie.
+ * threads in ThreadGroup with a null parent), and returns silently on
+ * other threads.
+ *
+ * <p>If you override this, you must do two things. First, call
+ * <code>super.checkAccess(t)</code>, to make sure you are not relaxing
+ * requirements. Second, if the calling thread has
+ * <code>RuntimePermission("modifyThread")</code>, return silently, so that
+ * core classes (the Classpath library!) can modify any thread.
+ *
+ * @param t the other Thread to check
+ * @throws SecurityException if permission is denied
+ * @throws NullPointerException if t is null
+ * @see Thread#stop()
+ * @see Thread#suspend()
+ * @see Thread#resume()
+ * @see Thread#setPriority(int)
+ * @see Thread#setName(String)
+ * @see Thread#setDaemon(boolean)
+ */
+ public void checkAccess(Thread t)
+ {
+ if (t.group != null && t.group.getParent() != null)
+ checkPermission(new RuntimePermission("modifyThread"));
+ }
- /** Check if the current thread is allowed to link in the
- ** given native library.<P>
- **
- ** This method is called from Runtime.load() (and hence,
- ** by loadLibrary() as well).<P>
- **
- ** SecurityManager's implementation always denies access.
- **
- ** @param filename the full name of the library to load
- ** @exception SecurityException if the operation is not
- ** permitted.
- ** @see java.lang.Runtime#load(java.lang.String)
- **/
- public void checkLink(String filename) {
- throw new SecurityException("Cannot link native libraries.");
- }
+ /**
+ * Check if the current thread is allowed to modify a ThreadGroup. This is
+ * called by Thread.Thread() (to add a thread to the ThreadGroup),
+ * ThreadGroup.ThreadGroup() (to add this ThreadGroup to a parent),
+ * ThreadGroup.stop(), suspend(), resume(), interrupt(), destroy(),
+ * setDaemon(), and setMaxPriority(). The default implementation
+ * checks <code>RuntimePermission("modifyThread") on the system group (ie.
+ * the one with a null parent), and returns silently on other groups.
+ *
+ * <p>If you override this, you must do two things. First, call
+ * <code>super.checkAccess(t)</code>, to make sure you are not relaxing
+ * requirements. Second, if the calling thread has
+ * <code>RuntimePermission("modifyThreadGroup")</code>, return silently,
+ * so that core classes (the Classpath library!) can modify any thread.
+ *
+ * @param g the ThreadGroup to check
+ * @throws SecurityException if permission is denied
+ * @throws NullPointerException if g is null
+ * @see Thread#Thread()
+ * @see ThreadGroup#ThreadGroup()
+ * @see ThreadGroup#stop()
+ * @see ThreadGroup#suspend()
+ * @see ThreadGroup#resume()
+ * @see ThreadGroup#interrupt()
+ * @see ThreadGroup#setDaemon(boolean)
+ * @see ThreadGroup#setMaxPriority(int)
+ */
+ public void checkAccess(ThreadGroup g)
+ {
+ if (g.getParent() != null)
+ checkPermission(new RuntimePermission("modifyThreadGroup"));
+ }
- /** Check if the current thread is allowed to read the
- ** given file using the FileDescriptor.<P>
- **
- ** This method is called from
- ** FileInputStream.FileInputStream().<P>
- **
- ** SecurityManager's implementation always denies access.
- **
- ** @param desc the FileDescriptor representing the file
- ** to access
- ** @exception SecurityException if the operation is not
- ** permitted.
- ** @see java.io.FileInputStream#FileInputStream(java.io.FileDescriptor)
- **/
- public void checkRead(FileDescriptor desc) {
- throw new SecurityException("Cannot read files via file descriptors.");
- }
+ /**
+ * Check if the current thread is allowed to exit the JVM with the given
+ * status. This method is called from Runtime.exit() and Runtime.halt().
+ * The default implementation checks
+ * <code>RuntimePermission("exitVM")</code>. If you override this, call
+ * <code>super.checkExit</code> rather than throwing an exception.
+ *
+ * @param status the status to exit with
+ * @throws SecurityException if permission is denied
+ * @see Runtime#exit(int)
+ * @see Runtime#halt(int)
+ */
+ public void checkExit(int status)
+ {
+ checkPermission(new RuntimePermission("exitVM"));
+ }
- /** Check if the current thread is allowed to read the
- ** given file.<P>
- **
- ** This method is called from
- ** FileInputStream.FileInputStream(),
- ** RandomAccessFile.RandomAccessFile(), File.exists(),
- ** canRead(), isFile(), isDirectory(), lastModified(),
- ** length() and list().<P>
- **
- ** SecurityManager's implementation always denies access.
- **
- ** @param filename the full name of the file to access
- ** @exception SecurityException if the operation is not
- ** permitted.
- ** @see java.io.File
- ** @see java.io.FileInputStream#FileInputStream(java.lang.String)
- ** @see java.io.RandomAccessFile#RandomAccessFile(java.lang.String)
- **/
- public void checkRead(String filename) {
- throw new SecurityException("Cannot read files via file names.");
- }
+ /**
+ * Check if the current thread is allowed to execute the given program. This
+ * method is called from Runtime.exec(). If the name is an absolute path,
+ * the default implementation checks
+ * <code>FilePermission(program, "execute")</code>, otherwise it checks
+ * <code>FilePermission("&lt;&lt;ALL FILES&gt;&gt;", "execute")</code>. If
+ * you override this, call <code>super.checkExec</code> rather than
+ * throwing an exception.
+ *
+ * @param program the name of the program to exec
+ * @throws SecurityException if permission is denied
+ * @throws NullPointerException if program is null
+ * @see Runtime#exec(String[], String[], File)
+ */
+ public void checkExec(String program)
+ {
+ if (! program.equals(new File(program).getAbsolutePath()))
+ program = "<<ALL FILES>>";
+ checkPermission(new FilePermission(program, "execute"));
+ }
- /** Check if the current thread is allowed to read the
- ** given file. using the given SecurityContext.<P>
- **
- ** I know of no core class that calls this method.<P>
- **
- ** SecurityManager's implementation always denies access.
- **
- ** @param filename the full name of the file to access
- ** @param securityContext the Security Context to
- ** determine access for.
- ** @exception SecurityException if the operation is not
- ** permitted.
- **/
- public void checkRead(String filename, Object securityContext) {
- throw new SecurityException("Cannot read files via file names.");
- }
+ /**
+ * Check if the current thread is allowed to link in the given native
+ * library. This method is called from Runtime.load() (and hence, by
+ * loadLibrary() as well). The default implementation checks
+ * <code>RuntimePermission("loadLibrary." + filename)</code>. If you
+ * override this, call <code>super.checkLink</code> rather than throwing
+ * an exception.
+ *
+ * @param filename the full name of the library to load
+ * @throws SecurityException if permission is denied
+ * @throws NullPointerException if filename is null
+ * @see Runtime#load(String)
+ */
+ public void checkLink(String filename)
+ {
+ // Use the toString() hack to do the null check.
+ checkPermission(new RuntimePermission("loadLibrary."
+ + filename.toString()));
+ }
- /** Check if the current thread is allowed to write to the
- ** given file using the FileDescriptor.<P>
- **
- ** This method is called from
- ** FileOutputStream.FileOutputStream().<P>
- **
- ** SecurityManager's implementation always denies access.
- **
- ** @param desc the FileDescriptor representing the file
- ** to access
- ** @exception SecurityException if the operation is not
- ** permitted.
- ** @see java.io.FileOutputStream#FileOutputStream(java.io.FileDescriptor)
- **/
- public void checkWrite(FileDescriptor desc) {
- throw new SecurityException("Cannot write files via file descriptors.");
- }
+ /**
+ * Check if the current thread is allowed to read the given file using the
+ * FileDescriptor. This method is called from
+ * FileInputStream.FileInputStream(). The default implementation checks
+ * <code>RuntimePermission("readFileDescriptor")</code>. If you override
+ * this, call <code>super.checkRead</code> rather than throwing an
+ * exception.
+ *
+ * @param desc the FileDescriptor representing the file to access
+ * @throws SecurityException if permission is denied
+ * @throws NullPointerException if desc is null
+ * @see FileInputStream#FileInputStream(FileDescriptor)
+ */
+ public void checkRead(FileDescriptor desc)
+ {
+ if (desc == null)
+ throw new NullPointerException();
+ checkPermission(new RuntimePermission("readFileDescriptor"));
+ }
- /** Check if the current thread is allowed to write to the
- ** given file.<P>
- **
- ** This method is called from
- ** FileOutputStream.FileOutputStream(),
- ** RandomAccessFile.RandomAccessFile(),
- ** File.canWrite(), mkdir(), and renameTo().<P>
- **
- ** SecurityManager's implementation always denies access.
- **
- ** @param filename the full name of the file to access
- ** @exception SecurityException if the operation is not
- ** permitted.
- ** @see java.io.File#canWrite()
- ** @see java.io.File#mkdir()
- ** @see java.io.File#renameTo()
- ** @see java.io.FileOutputStream#FileOutputStream(java.lang.String)
- ** @see java.io.RandomAccessFile#RandomAccessFile(java.lang.String)
- **/
- public void checkWrite(String filename) {
- throw new SecurityException("Cannot write files via file names.");
- }
+ /**
+ * Check if the current thread is allowed to read the given file. This
+ * method is called from FileInputStream.FileInputStream(),
+ * RandomAccessFile.RandomAccessFile(), File.exists(), canRead(), isFile(),
+ * isDirectory(), lastModified(), length() and list(). The default
+ * implementation checks <code>FilePermission(filename, "read")</code>. If
+ * you override this, call <code>super.checkRead</code> rather than
+ * throwing an exception.
+ *
+ * @param filename the full name of the file to access
+ * @throws SecurityException if permission is denied
+ * @throws NullPointerException if filename is null
+ * @see File
+ * @see FileInputStream#FileInputStream(String)
+ * @see RandomAccessFile#RandomAccessFile(String)
+ */
+ public void checkRead(String filename)
+ {
+ checkPermission(new FilePermission(filename, "read"));
+ }
- /** Check if the current thread is allowed to delete the
- ** given file.<P>
- **
- ** This method is called from File.delete().<P>
- **
- ** SecurityManager's implementation always denies access.
- **
- ** @param filename the full name of the file to delete
- ** @exception SecurityException if th operation is not
- ** permitted.
- ** @see java.io.File#delete()
- **/
- public void checkDelete(String filename) {
- throw new SecurityException("Cannot delete files.");
- }
+ /**
+ * Check if the current thread is allowed to read the given file. using the
+ * given security context. The context must be a result of a previous call
+ * to <code>getSecurityContext()</code>. The default implementation checks
+ * <code>AccessControlContext.checkPermission(new FilePermission(filename,
+ * "read"))</code>. If you override this, call <code>super.checkRead</code>
+ * rather than throwing an exception.
+ *
+ * @param filename the full name of the file to access
+ * @param context the context to determine access for
+ * @throws SecurityException if permission is denied, or if context is
+ * not an AccessControlContext
+ * @throws NullPointerException if filename is null
+ * @see #getSecurityContext()
+ * @see AccessControlContext#checkPermission(Permission)
+ */
+ public void checkRead(String filename, Object context)
+ {
+ // XXX Should be:
+ // if (! (context instanceof AccessControlContext))
+ // throw new SecurityException("Missing context");
+ // AccessControlContext ac = (AccessControlContext) context;
+ // ac.checkPermission(new FilePermission(filename, "read"));
+ throw new SecurityException("Cannot read files via file names.");
+ }
- /** Check if the current thread is allowed to connect to a
- ** given host on a given port.<P>
- **
- ** This method is called from Socket.Socket().
- **
- ** SecurityManager's implementation always denies access.
- **
- ** @param host the host to connect to
- ** @param port the port to connect on
- ** @exception SecurityException if the operation is not
- ** permitted
- ** @see java.net.Socket#Socket()
- **/
- public void checkConnect(String host, int port) {
- throw new SecurityException("Cannot make network connections.");
- }
+ /**
+ * Check if the current thread is allowed to write the given file using the
+ * FileDescriptor. This method is called from
+ * FileOutputStream.FileOutputStream(). The default implementation checks
+ * <code>RuntimePermission("writeFileDescriptor")</code>. If you override
+ * this, call <code>super.checkWrite</code> rather than throwing an
+ * exception.
+ *
+ * @param desc the FileDescriptor representing the file to access
+ * @throws SecurityException if permission is denied
+ * @throws NullPointerException if desc is null
+ * @see FileOutputStream#FileOutputStream(FileDescriptor)
+ */
+ public void checkWrite(FileDescriptor desc)
+ {
+ if (desc == null)
+ throw new NullPointerException();
+ checkPermission(new RuntimePermission("writeFileDescriptor"));
+ }
- /** Check if the current thread is allowed to connect to a
- ** given host on a given port using a specific security
- ** context to determine access.<P>
- **
- ** This method is not called in the 1.1 core classes.<P>
- **
- ** SecurityManager's implementation always denies access.
- **
- ** @param host the host to connect to
- ** @param port the port to connect on
- ** @param securityContext the security context to
- ** determine access with
- ** @exception SecurityException if the operation is not
- ** permitted
- **/
- public void checkConnect(String host, int port, Object securityContext) {
- throw new SecurityException("Cannot make network connections.");
- }
+ /**
+ * Check if the current thread is allowed to write the given file. This
+ * method is called from FileOutputStream.FileOutputStream(),
+ * RandomAccessFile.RandomAccessFile(), File.canWrite(), mkdir(), and
+ * renameTo(). The default implementation checks
+ * <code>FilePermission(filename, "write")</code>. If you override this,
+ * call <code>super.checkWrite</code> rather than throwing an exception.
+ *
+ * @param filename the full name of the file to access
+ * @throws SecurityException if permission is denied
+ * @throws NullPointerException if filename is null
+ * @see File
+ * @see File#canWrite()
+ * @see File#mkdir()
+ * @see File#renameTo()
+ * @see FileOutputStream#FileOutputStream(String)
+ * @see RandomAccessFile#RandomAccessFile(String)
+ */
+ public void checkWrite(String filename)
+ {
+ checkPermission(new FilePermission(filename, "write"));
+ }
- /** Check if the current thread is allowed to listen to a
- ** specific port for data.<P>
- **
- ** This method is called by ServerSocket.ServerSocket().<P>
- **
- ** SecurityManager's implementation always denies access.
- **
- ** @param port the port to listen on
- ** @exception SecurityException if the operation is not
- ** permitted
- ** @see java.net.ServerSocket#ServerSocket(int)
- **/
- public void checkListen(int port) {
- throw new SecurityException("Cannot listen for connections.");
- }
+ /**
+ * Check if the current thread is allowed to delete the given file. This
+ * method is called from File.delete(). The default implementation checks
+ * <code>FilePermission(filename, "delete")</code>. If you override this,
+ * call <code>super.checkDelete</code> rather than throwing an exception.
+ *
+ * @param filename the full name of the file to delete
+ * @throws SecurityException if permission is denied
+ * @throws NullPointerException if filename is null
+ * @see File#delete()
+ */
+ public void checkDelete(String filename)
+ {
+ checkPermission(new FilePermission(filename, "delete"));
+ }
- /** Check if the current thread is allowed to accept a
- ** connection from a particular host on a particular
- ** port.<P>
- **
- ** This method is called by ServerSocket.implAccept().<P>
- **
- ** SecurityManager's implementation always denies access.
- **
- ** @param host the host which wishes to connect
- ** @param port the port the connection will be on
- ** @exception SecurityException if the operation is not
- ** permitted
- ** @see java.net.ServerSocket#accept()
- **/
- public void checkAccept(String host, int port) {
- throw new SecurityException("Cannot accept connections.");
- }
+ /**
+ * Check if the current thread is allowed to connect to a given host on a
+ * given port. This method is called from Socket.Socket(). A port number
+ * of -1 indicates the caller is attempting to determine an IP address, so
+ * the default implementation checks
+ * <code>SocketPermission(host, "resolve")</code>. Otherwise, the default
+ * implementation checks
+ * <code>SocketPermission(host + ":" + port, "connect")</code>. If you
+ * override this, call <code>super.checkConnect</code> rather than throwing
+ * an exception.
+ *
+ * @param host the host to connect to
+ * @param port the port to connect on
+ * @throws SecurityException if permission is denied
+ * @throws NullPointerException if host is null
+ * @see Socket#Socket()
+ */
+ public void checkConnect(String host, int port)
+ {
+ if (port == -1)
+ checkPermission(new SocketPermission(host, "resolve"));
+ else
+ // Use the toString() hack to do the null check.
+ checkPermission(new SocketPermission(host.toString() + ":" + port,
+ "connect"));
+ }
- /** Check if the current thread is allowed to read and
- ** write multicast to a particular address.<P>
- **
- ** SecurityManager's implementation always denies access.
- **
- ** @XXX where is it called?
- **
- ** @param addr the address to multicast to.
- ** @exception SecurityException if the operation is not
- ** permitted.
- **/
- public void checkMulticast(InetAddress addr) {
- throw new SecurityException("Cannot read or write multicast.");
- }
+ /**
+ * Check if the current thread is allowed to connect to a given host on a
+ * given port, using the given security context. The context must be a
+ * result of a previous call to <code>getSecurityContext</code>. A port
+ * number of -1 indicates the caller is attempting to determine an IP
+ * address, so the default implementation checks
+ * <code>AccessControlContext.checkPermission(new SocketPermission(host,
+ * "resolve"))</code>. Otherwise, the default implementation checks
+ * <code>AccessControlContext.checkPermission(new SocketPermission(host
+ * + ":" + port, "connect"))</code>. If you override this, call
+ * <code>super.checkConnect</code> rather than throwing an exception.
+ *
+ * @param host the host to connect to
+ * @param port the port to connect on
+ * @param context the context to determine access for
+ * @throws SecurityException if permission is denied, or if context is
+ * not an AccessControlContext
+ * @throws NullPointerException if host is null
+ * @see #getSecurityContext()
+ * @see AccessControlContext#checkPermission(Permission)
+ */
+ public void checkConnect(String host, int port, Object securityContext)
+ {
+ // XXX Should be:
+ // if (! (context instanceof AccessControlContext))
+ // throw new SecurityException("Missing context");
+ // AccessControlContext ac = (AccessControlContext) context;
+ // if (port == -1)
+ // ac.checkPermission(new SocketPermission(host, "resolve"));
+ // else
+ // // Use the toString() hack to do the null check.
+ // ac.checkPermission(new SocketPermission(host.toString + ":" +port,
+ // "connect"));
+ throw new SecurityException("Cannot make network connections.");
+ }
- /** Check if the current thread is allowed to read and
- ** write multicast to a particular address with a
- ** particular ttl value.<P>
- **
- ** SecurityManager's implementation always denies access.<P>
- **
- ** @XXX where is it called?
- **
- ** @XXX what the hell is ttl? Expand abbreviation.
- **
- ** @param addr the address to multicast to.
- ** @param ttl the ttl value to use
- ** @exception SecurityException if the operation is not
- ** permitted.
- **/
- public void checkMulticast(InetAddress addr, byte ttl) {
- throw new SecurityException("Cannot read or write multicast.");
- }
+ /**
+ * Check if the current thread is allowed to listen to a specific port for
+ * data. This method is called by ServerSocket.ServerSocket(). The default
+ * implementation checks
+ * <code>SocketPermission("localhost:" + (port == 0 ? "1024-" : "" + port),
+ * "listen")</code>. If you override this, call
+ * <code>super.checkListen</code> rather than throwing an exception.
+ *
+ * @param port the port to listen on
+ * @throws SecurityException if permission is denied
+ * @see ServerSocket#ServerSocket(int)
+ */
+ public void checkListen(int port)
+ {
+ checkPermission(new SocketPermission("localhost:"
+ + (port == 0 ? "1024-" : "" +port),
+ "listen"));
+ }
- /**
- ** Check if the current thread is allowed to perform an
- ** operation that requires the specified <code>Permission</code>.
- **
- ** @param perm The <code>Permission</code> required.
- ** @exception SecurityException If the operation is not allowed.
- **/
- public void checkPermission(java.security.Permission perm) {
- throw new SecurityException("Operation not allowed");
- }
+ /**
+ * Check if the current thread is allowed to accept a connection from a
+ * particular host on a particular port. This method is called by
+ * ServerSocket.implAccept(). The default implementation checks
+ * <code>SocketPermission(host + ":" + port, "accept")</code>. If you
+ * override this, call <code>super.checkAccept</code> rather than throwing
+ * an exception.
+ *
+ * @param host the host which wishes to connect
+ * @param port the port the connection will be on
+ * @throws SecurityException if permission is denied
+ * @throws NullPointerException if host is null
+ * @see ServerSocket#accept()
+ */
+ public void checkAccept(String host, int port)
+ {
+ // Use the toString() hack to do the null check.
+ checkPermission(new SocketPermission(host.toString() + ":" + port,
+ "accept"));
+ }
- /**
- ** Check if the current thread is allowed to perform an
- ** operation that requires the specified <code>Permission</code>.
- **
- ** @param perm The <code>Permission</code> required.
- ** @param context A security context
- ** @exception SecurityException If the operation is not allowed.
- ** @since 1.2
- **/
- public void checkPermission(java.security.Permission perm,
- Object context) {
- throw new SecurityException("Operation not allowed");
- }
+ /**
+ * Check if the current thread is allowed to read and write multicast to
+ * a particular address. The default implementation checks
+ * <code>SocketPermission(addr.getHostAddress(), "accept,connect")</code>.
+ * If you override this, call <code>super.checkMulticast</code> rather than
+ * throwing an exception.
+ *
+ * @param addr the address to multicast to
+ * @throws SecurityException if permission is denied
+ * @throws NullPointerException if host is null
+ * @since 1.1
+ */
+ public void checkMulticast(InetAddress addr)
+ {
+ checkPermission(new SocketPermission(addr.getHostAddress(),
+ "accept,connect"));
+ }
- /** Check if the current thread is allowed to read or
- ** write all the system properties at once.<P>
- **
- ** This method is called by System.getProperties()
- ** and setProperties().<P>
- **
- ** SecurityManager's implementation always denies access.
- **
- ** @exception SecurityException if the operation is not
- ** permitted.
- ** @see java.lang.System#getProperties()
- ** @see java.lang.System#setProperties(java.util.Properties)
- **/
- public void checkPropertiesAccess() {
- throw new SecurityException("Cannot access all system properties at once.");
- }
+ /**
+ *Check if the current thread is allowed to read and write multicast to
+ * a particular address with a particular ttl (time-to-live) value. The
+ * default implementation ignores ttl, and checks
+ * <code>SocketPermission(addr.getHostAddress(), "accept,connect")</code>.
+ * If you override this, call <code>super.checkMulticast</code> rather than
+ * throwing an exception.
+ *
+ * @param addr the address to multicast to
+ * @param ttl value in use for multicast send
+ * @throws SecurityException if permission is denied
+ * @throws NullPointerException if host is null
+ * @since 1.1
+ * @deprecated use {@link #checkPermission(Permission)} instead
+ */
+ public void checkMulticast(InetAddress addr, byte ttl)
+ {
+ checkPermission(new SocketPermission(addr.getHostAddress(),
+ "accept,connect"));
+ }
- /** Check if the current thread is allowed to read or
- ** write a particular system property.<P>
- **
- ** This method is called by System.getProperty() and
- ** setProperty().<P>
- **
- ** SecurityManager's implementation always denies access.
- **
- ** @exception SecurityException is the operation is not
- ** permitted.
- ** @see java.lang.System#getProperty(java.lang.String)
- ** @see java.lang.System#setProperty(java.lang.String,java.lang.String)
- **/
- public void checkPropertyAccess(String name) {
- throw new SecurityException("Cannot access individual system properties.");
- }
+ /**
+ * Check if the current thread is allowed to read or write all the system
+ * properties at once. This method is called by System.getProperties()
+ * and setProperties(). The default implementation checks
+ * <code>PropertyPermission("*", "read,write")</code>. If you override
+ * this, call <code>super.checkPropertiesAccess</code> rather than
+ * throwing an exception.
+ *
+ * @throws SecurityException if permission is denied
+ * @see System#getProperties()
+ * @see System#setProperties(Properties)
+ */
+ public void checkPropertiesAccess()
+ {
+ checkPermission(new PropertyPermission("*", "read,write"));
+ }
- /** Check if the current thread is allowed to create a
- ** top-level window. If it is not, the operation should
- ** still go through, but some sort of nonremovable
- ** warning should be placed on the window to show that it
- ** is untrusted.<P>
- **
- ** This method is called by Window.Window().<P>
- **
- ** SecurityManager's implementation always denies access.
- **
- ** @param window the window to create
- ** @see java.awt.Window#Window(java.awt.Frame)
- **/
- public boolean checkTopLevelWindow(Object window) {
- return false;
- }
+ /**
+ * Check if the current thread is allowed to read a particular system
+ * property (writes are checked directly via checkPermission). This method
+ * is called by System.getProperty() and setProperty(). The default
+ * implementation checks <code>PropertyPermission(key, "read")</code>. If
+ * you override this, call <code>super.checkPropertyAccess</code> rather
+ * than throwing an exception.
+ *
+ * @throws SecurityException if permission is denied
+ * @throws NullPointerException if key is null
+ * @throws IllegalArgumentException if key is ""
+ * @see System#getProperty(String)
+ */
+ public void checkPropertyAccess(String key)
+ {
+ checkPermission(new PropertyPermission(key, "read"));
+ }
- /** Check if the current thread is allowed to create a
- ** print job.<P>
- **
- ** This method is called by Toolkit.getPrintJob(). (I
- ** assume so, at least, it just don't say nothing about
- ** it in the spec.)<P>
- **
- ** SecurityManager's implementation always denies access.
- **
- ** @exception SecurityException if the operation is not
- ** permitted.
- ** @see java.awt.Toolkit.getPrintJob(java.awt.Frame,java.lang.String,java.util.Properties)
- **/
- public void checkPrintJobAccess() {
- throw new SecurityException("Cannot create print jobs.");
- }
+ /**
+ * Check if the current thread is allowed to create a top-level window. If
+ * it is not, the operation should still go through, but some sort of
+ * nonremovable warning should be placed on the window to show that it
+ * is untrusted. This method is called by Window.Window(). The default
+ * implementation checks
+ * <code>AWTPermission("showWindowWithoutWarningBanner")</code>, and returns
+ * true if no exception was thrown. If you override this, use
+ * <code>return super.checkTopLevelWindow</code> rather than returning
+ * false.
+ *
+ * @param window the window to create
+ * @return true if there is permission to show the window without warning
+ * @throws NullPointerException if window is null
+ * @see Window#Window(Frame)
+ */
+ public boolean checkTopLevelWindow(Object window)
+ {
+ if (window == null)
+ throw new NullPointerException();
+ try
+ {
+ checkPermission(new AWTPermission("showWindowWithoutWarningBanner"));
+ return true;
+ }
+ catch (SecurityException e)
+ {
+ return false;
+ }
+ }
- /** Check if the current thread is allowed to use the
- ** system clipboard.<P>
- **
- ** This method is called by Toolkit.getSystemClipboard().
- ** (I assume.)<P>
- **
- ** SecurityManager's implementation always denies access.
- **
- ** @exception SecurityException if the operation is not
- ** permitted.
- ** @see java.awt.Toolkit#getSystemClipboard()
- **/
- public void checkSystemClipboardAccess() {
- throw new SecurityException("Cannot access the system clipboard.");
- }
+ /**
+ * Check if the current thread is allowed to create a print job. This
+ * method is called by Toolkit.getPrintJob(). The default implementation
+ * checks <code>RuntimePermission("queuePrintJob")</code>. If you override
+ * this, call <code>super.checkPrintJobAccess</code> rather than throwing
+ * an exception.
+ *
+ * @throws SecurityException if permission is denied
+ * @see Toolkit#getPrintJob(Frame, String, Properties)
+ * @since 1.1
+ */
+ public void checkPrintJobAccess()
+ {
+ checkPermission(new RuntimePermission("queuePrintJob"));
+ }
- /** Check if the current thread is allowed to use the AWT
- ** event queue.<P>
- **
- ** This method is called by Toolkit.getSystemEventQueue().<P>
- **
- ** SecurityManager's implementation always denies access.
- **
- ** @exception SecurityException if the operation is not
- ** permitted.
- ** @see java.awt.Toolkit#getSystemEventQueue()
- **/
- public void checkAwtEventQueueAccess() {
- throw new SecurityException("Cannot access the AWT event queue.");
- }
+ /**
+ * Check if the current thread is allowed to use the system clipboard. This
+ * method is called by Toolkit.getSystemClipboard(). The default
+ * implementation checks <code>AWTPermission("accessClipboard")</code>. If
+ * you override this, call <code>super.checkSystemClipboardAccess</code>
+ * rather than throwing an exception.
+ *
+ * @throws SecurityException if permission is denied
+ * @see Toolkit#getSystemClipboard()
+ * @since 1.1
+ */
+ public void checkSystemClipboardAccess()
+ {
+ checkPermission(new AWTPermission("accessClipboard"));
+ }
- /** Check if the current thread is allowed to access the
- ** specified package at all.<P>
- **
- ** This method is called by ClassLoader.loadClass() in
- ** user-created ClassLoaders.<P>
- **
- ** SecurityManager's implementation always denies access.
- **
- ** @param packageName the package name to check access to
- ** @exception SecurityException if the operation is not
- ** permitted.
- ** @see java.lang.ClassLoader#loadClass(java.lang.String,boolean)
- **/
- public void checkPackageAccess(String packageName) {
- throw new SecurityException("Cannot access packages via the ClassLoader.");
- }
+ /**
+ * Check if the current thread is allowed to use the AWT event queue. This
+ * method is called by Toolkit.getSystemEventQueue(). The default
+ * implementation checks <code>AWTPermission("accessEventQueue")</code>.
+ * you override this, call <code>super.checkAwtEventQueueAccess</code>
+ * rather than throwing an exception.
+ *
+ * @throws SecurityException if permission is denied
+ * @see Toolkit#getSystemEventQueue()
+ * @since 1.1
+ */
+ public void checkAwtEventQueueAccess()
+ {
+ // Should be: checkPermission(new AWTPermission("accessEventQueue"));
+ throw new SecurityException("Cannot access the AWT event queue.");
+ }
- /** Check if the current thread is allowed to define
- ** classes the specified package. If the class already
- ** created, though, ClassLoader.loadClass() can still
- ** return the Class if checkPackageAccess() checks out.<P>
- **
- ** This method is called by ClassLoader.loadClass() in
- ** user-created ClassLoaders.<P>
- **
- ** SecurityManager's implementation always denies access.
- **
- ** @param packageName the package name to check access to
- ** @exception SecurityException if the operation is not
- ** permitted.
- ** @see java.lang.ClassLoader#loadClass(java.lang.String,boolean)
- **/
- public void checkPackageDefinition(String packageName) {
- throw new SecurityException("Cannot load classes into any packages via the ClassLoader.");
- }
+ /**
+ * Check if the current thread is allowed to access the specified package
+ * at all. This method is called by ClassLoader.loadClass() in user-created
+ * ClassLoaders. The default implementation gets a list of all restricted
+ * packages, via <code>Security.getProperty("package.access")</code>. Then,
+ * if packageName starts with or equals any restricted package, it checks
+ * <code>RuntimePermission("accessClassInPackage." + packageName)</code>.
+ * If you override this, you should call
+ * <code>super.checkPackageAccess</code> before doing anything else.
+ *
+ * @param packageName the package name to check access to
+ * @throws SecurityException if permission is denied
+ * @throws NullPointerException if packageName is null
+ * @see ClassLoader#loadClass(String, boolean)
+ * @see Security#getProperty(String)
+ */
+ public void checkPackageAccess(String packageName)
+ {
+ checkPackageList(packageName, "access", "accessClassInPackage.");
+ }
- /** Check if the current thread is allowed to set the
- ** current socket factory.<P>
- **
- ** This method is called by Socket.setSocketImplFactory(),
- ** ServerSocket.setSocketFactory(), and
- ** URL.setURLStreamHandlerFactory().<P>
- **
- ** SecurityManager's implementation always denies access.
- **
- ** @exception SecurityException if the operation is not
- ** permitted.
- ** @see java.net.Socket#setSocketImplFactory(java.net.SocketImplFactory)
- ** @see java.net.ServerSocket#setSocketFactory(java.net.SocketImplFactory)
- ** @see java.net.URL#setURLStreamHandlerFactory(java.net.URLStreamHandlerFactory)
- **/
- public void checkSetFactory() {
- throw new SecurityException("Cannot set the socket factory.");
- }
+ /**
+ * Check if the current thread is allowed to define a class into the
+ * specified package. This method is called by ClassLoader.loadClass() in
+ * user-created ClassLoaders. The default implementation gets a list of all
+ * restricted packages, via
+ * <code>Security.getProperty("package.definition")</code>. Then, if
+ * packageName starts with or equals any restricted package, it checks
+ * <code>RuntimePermission("defineClassInPackage." + packageName)</code>.
+ * If you override this, you should call
+ * <code>super.checkPackageDefinition</code> before doing anything else.
+ *
+ * @param packageName the package name to check access to
+ * @throws SecurityException if permission is denied
+ * @throws NullPointerException if packageName is null
+ * @see ClassLoader#loadClass(String, boolean)
+ * @see Security#getProperty(String)
+ */
+ public void checkPackageDefinition(String packageName)
+ {
+ checkPackageList(packageName, "definition", "defineClassInPackage.");
+ }
- /** Check if the current thread is allowed to get certain
- ** types of Methods, Fields and Constructors from a Class
- ** object.<P>
- **
- ** This method is called by Class.getMethod[s](),
- ** Class.getField[s](), Class.getConstructor[s],
- ** Class.getDeclaredMethod[s](),
- ** Class.getDeclaredField[s](), and
- ** Class.getDeclaredConstructor[s]().<P>
- **
- ** SecurityManager's implementation always denies access.
- **
- ** @param c the Class to check
- ** @param memberType the type of members to check
- ** against, either Member.DECLARED or
- ** Member.PUBLIC.
- ** @exception SecurityException if the operation is not
- ** permitted.
- ** @see java.lang.Class
- ** @see java.lang.reflect.Member#DECLARED
- ** @see java.lang.reflect.Member#PUBLIC
- **/
- public void checkMemberAccess(Class c, int memberType) {
- throw new SecurityException("Cannot access members of classes.");
- }
+ /**
+ * Check if the current thread is allowed to set the current socket factory.
+ * This method is called by Socket.setSocketImplFactory(),
+ * ServerSocket.setSocketFactory(), and URL.setURLStreamHandlerFactory().
+ * The default implementation checks
+ * <code>RuntimePermission("setFactory")</code>. If you override this, call
+ * <code>super.checkSetFactory</code> rather than throwing an exception.
+ *
+ * @throws SecurityException if permission is denied
+ * @see Socket#setSocketImplFactory(SocketImplFactory)
+ * @see ServerSocket#setSocketFactory(SocketImplFactory)
+ * @see URL#setURLStreamHandlerFactory(URLStreamHandlerFactory)
+ */
+ public void checkSetFactory()
+ {
+ checkPermission(new RuntimePermission("setFactory"));
+ }
- /** Test whether a particular security action may be
- ** taken.
- ** @param action the desired action to take
- ** @exception SecurityException if the action is denied.
- ** @XXX I have no idea what actions must be tested
- ** or where.
- **/
- public void checkSecurityAccess(String action) {
- checkPermission (new java.security.SecurityPermission (action));
- }
+ /**
+ * Check if the current thread is allowed to get certain types of Methods,
+ * Fields and Constructors from a Class object. This method is called by
+ * Class.getMethod[s](), Class.getField[s](), Class.getConstructor[s],
+ * Class.getDeclaredMethod[s](), Class.getDeclaredField[s](), and
+ * Class.getDeclaredConstructor[s](). The default implementation allows
+ * PUBLIC access, and access to classes defined by the same classloader as
+ * the code performing the reflection. Otherwise, it checks
+ * <code>RuntimePermission("accessDeclaredMembers")</code>. If you override
+ * this, do not call <code>super.checkMemberAccess</code>, as this would
+ * mess up the stack depth check that determines the ClassLoader requesting
+ * the access.
+ *
+ * @param c the Class to check
+ * @param memberType either DECLARED or PUBLIC
+ * @throws SecurityException if permission is denied, including when
+ * memberType is not DECLARED or PUBLIC
+ * @throws NullPointerException if c is null
+ * @see Class
+ * @see Member#DECLARED
+ * @see Member#PUBLIC
+ * @since 1.1
+ */
+ public void checkMemberAccess(Class c, int memberType)
+ {
+ if (c == null)
+ throw new NullPointerException();
+ if (memberType == Member.PUBLIC)
+ return;
+ // XXX Allow access to classes created by same classloader before next
+ // check.
+ checkPermission(new RuntimePermission("accessDeclaredMembers"));
+ }
- /** Get the ThreadGroup that a new Thread should belong
- ** to by default.<P>
- **
- ** Called by Thread.Thread().<P>
- **
- ** SecurityManager's implementation just uses the
- ** ThreadGroup of the current Thread.<P>
- **
- ** <STRONG>Spec Note:</STRONG> it is not clear whether
- ** the new Thread is guaranteed to pass the
- ** checkAccessThreadGroup() test when using this
- ** ThreadGroup. I presume so.
- **
- ** @return the ThreadGroup to put the new Thread into.
- **/
- public ThreadGroup getThreadGroup() {
- return Thread.currentThread().getThreadGroup();
- }
+ /**
+ * Test whether a particular security action may be taken. The default
+ * implementation checks <code>SecurityPermission(action)</code>. If you
+ * override this, call <code>super.checkSecurityAccess</code> rather than
+ * throwing an exception.
+ *
+ * @param action the desired action to take
+ * @throws SecurityException if permission is denied
+ * @throws NullPointerException if action is null
+ * @throws IllegalArgumentException if action is ""
+ * @since 1.1
+ */
+ public void checkSecurityAccess(String action)
+ {
+ checkPermission(new SecurityPermission(action));
+ }
- public SecurityManager () {
- if (System.getSecurityManager () != null)
- throw new SecurityException ();
- }
-}
+ /**
+ * Get the ThreadGroup that a new Thread should belong to by default. Called
+ * by Thread.Thread(). The default implementation returns the current
+ * ThreadGroup of the current Thread. <STRONG>Spec Note:</STRONG> it is not
+ * clear whether the new Thread is guaranteed to pass the
+ * checkAccessThreadGroup() test when using this ThreadGroup, but I presume
+ * so.
+ *
+ * @return the ThreadGroup to put the new Thread into
+ * @since 1.1
+ */
+ public ThreadGroup getThreadGroup()
+ {
+ return Thread.currentThread().getThreadGroup();
+ }
+
+ /**
+ * Helper that checks a comma-separated list of restricted packages, from
+ * <code>Security.getProperty("package.definition")</code>, for the given
+ * package access permission. If packageName starts with or equals any
+ * restricted package, it checks
+ * <code>RuntimePermission(permission + packageName)</code>.
+ *
+ * @param packageName the package name to check access to
+ * @param restriction the list of restrictions, after "package."
+ * @param permission the base permission, including the '.'
+ * @throws SecurityException if permission is denied
+ * @throws NullPointerException if packageName is null
+ * @see #checkPackageAccess(String)
+ * @see #checkPackageDefinition(String)
+ */
+ void checkPackageList(String packageName, String restriction,
+ String permission)
+ {
+ // Use the toString() hack to do the null check.
+ Permission p = new RuntimePermission(permission + packageName.toString());
+ String list = Security.getProperty("package." + restriction);
+ if (list == null)
+ return;
+ while (! "".equals(packageName))
+ {
+ for (int index = list.indexOf(packageName);
+ index != -1; index = list.indexOf(packageName, index + 1))
+ {
+ int packageNameCount = packageName.length();
+ if (index + packageNameCount == list.length()
+ || list.charAt(index + packageNameCount) == ',')
+ {
+ checkPermission(p);
+ return;
+ }
+ }
+ int index = packageName.lastIndexOf('.');
+ packageName = index < 0 ? "" : packageName.substring(0, index);
+ }
+ }
+} // class SecurityManager
+// XXX This class is unnecessary.
class SecurityContext {
Class[] classes;
SecurityContext(Class[] classes) {
diff --git a/libjava/java/lang/Thread.java b/libjava/java/lang/Thread.java
index af5b95f14c6..18af8292126 100644
--- a/libjava/java/lang/Thread.java
+++ b/libjava/java/lang/Thread.java
@@ -10,6 +10,8 @@ details. */
package java.lang;
+import gnu.gcj.RawData;
+
/**
* @author Tom Tromey <tromey@cygnus.com>
* @date August 24, 1998
@@ -135,7 +137,7 @@ public class Thread implements Runnable
public final void setDaemon (boolean status)
{
checkAccess ();
- if (isAlive ())
+ if (!startable_flag)
throw new IllegalThreadStateException ();
daemon_flag = status;
}
@@ -311,6 +313,9 @@ public class Thread implements Runnable
private boolean startable_flag;
private ClassLoader context_class_loader;
+ // This describes the top-most interpreter frame for this thread.
+ RawData interp_frame;
+
// Our native data - points to an instance of struct natThread.
private Object data;
}
diff --git a/libjava/java/lang/Throwable.java b/libjava/java/lang/Throwable.java
index 56c9d542a50..62db8fd0d2d 100644
--- a/libjava/java/lang/Throwable.java
+++ b/libjava/java/lang/Throwable.java
@@ -1,5 +1,4 @@
-/* java.lang.Throwable -- Reference implementation of root class for
- all Exceptions and Errors
+/* java.lang.Throwable -- Root class for all Exceptions and Errors
Copyright (C) 1998, 1999, 2002 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -47,17 +46,6 @@ import java.io.IOException;
import java.io.OutputStream;
/**
- * @author Tom Tromey <tromey@cygnus.com>
- * @date October 30, 1998
- */
-
-/* Written using "Java Class Libraries", 2nd edition, ISBN 0-201-31002-3
- * "The Java Language Specification", ISBN 0-201-63451-1
- * Status: Sufficient for compiled code, but methods applicable to
- * bytecode not implemented. JDK 1.1.
- */
-
-/**
* Throwable is the superclass of all exceptions that can be raised.
*
* <p>There are two special cases: {@link Error} and {@link RuntimeException}:
@@ -116,7 +104,7 @@ import java.io.OutputStream;
* @author Tom Tromey
* @author Eric Blake <ebb9@email.byu.edu>
* @since 1.0
- * @status still missing 1.4 functionality
+ * @status updated to 1.4
*/
public class Throwable implements Serializable
{
@@ -130,7 +118,7 @@ public class Throwable implements Serializable
*
* @serial specific details about the exception, may be null
*/
- private String detailMessage;
+ private final String detailMessage;
/**
* The cause of the throwable, including null for an unknown or non-chained
@@ -171,7 +159,7 @@ public class Throwable implements Serializable
public Throwable(String message)
{
fillInStackTrace();
- detailMessage = message;
+ detailMessage = message;
}
/**
@@ -374,11 +362,11 @@ public class Throwable implements Serializable
*/
public void printStackTrace(PrintStream s)
{
- printStackTrace(new PrintWriter(s));
+ s.print(stackTraceString());
}
/**
- * <p>Prints the exception, the detailed message and the stack trace
+ * Prints the exception, the detailed message and the stack trace
* associated with this Throwable to the given <code>PrintWriter</code>.
* The actual output written is implemention specific. Use the result of
* <code>getStackTrace()</code> when more precise information is needed.
@@ -409,72 +397,88 @@ public class Throwable implements Serializable
*/
public void printStackTrace (PrintWriter pw)
{
- // First line
- pw.println(toString());
+ pw.print(stackTraceString());
+ }
+
+ private static final String nl = System.getProperty("line.separator");
+ // Create whole stack trace in a stringbuffer so we don't have to print
+ // it line by line. This prevents printing multiple stack traces from
+ // different threads to get mixed up when written to the same PrintWriter.
+ private String stackTraceString()
+ {
+ StringBuffer sb = new StringBuffer();
- // The stacktrace
+ // Main stacktrace
StackTraceElement[] stack = getStackTrace();
- if (stack == null || stack.length == 0)
- {
- pw.println(" <<No stacktrace available>>");
- return;
- }
- else
- {
- for (int i = 0; i < stack.length; i++)
- pw.println(" at " + stack[i]);
- }
+ stackTraceStringBuffer(sb, this.toString(), stack, 0);
// The cause(s)
Throwable cause = getCause();
while (cause != null)
{
- // Cause first line
- pw.println("Caused by: " + cause);
+ // Cause start first line
+ sb.append("Caused by: ");
// Cause stacktrace
StackTraceElement[] parentStack = stack;
stack = cause.getStackTrace();
- if (stack == null || stack.length == 0)
- {
- pw.println(" <<No stacktrace available>>");
- }
- else if (parentStack == null || parentStack.length == 0)
- {
- for (int i = 0; i < stack.length; i++)
- pw.println(" at " + stack[i]);
- }
+ if (parentStack == null || parentStack.length == 0)
+ stackTraceStringBuffer(sb, cause.toString(), stack, 0);
else
{
- boolean equal = false; // Is rest of stack equal to parent frame?
- for (int i = 0; i < stack.length && ! equal; i++)
+ int equal = 0; // Count how many of the last stack frames are equal
+ int frame = stack.length-1;
+ int parentFrame = parentStack.length-1;
+ while (frame > 0 && parentFrame > 0)
{
- // Check if we already printed the rest of the stack
- // since it was the tail of the parent stack
- int remaining = stack.length - i;
- int element = i;
- int parentElement = parentStack.length - remaining;
- equal = parentElement >= 0
- && parentElement < parentStack.length; // be optimistic
- while (equal && element < stack.length)
+ if (stack[frame].equals(parentStack[parentFrame]))
{
- if (stack[element].equals(parentStack[parentElement]))
- {
- element++;
- parentElement++;
- }
- else
- equal = false;
+ equal++;
+ frame--;
+ parentFrame--;
}
- // Print stacktrace element or indicate the rest is equal
- if (! equal)
- pw.println(" at " + stack[i]);
else
- pw.println(" ..." + remaining + " more");
+ break;
}
+ stackTraceStringBuffer(sb, cause.toString(), stack, equal);
}
cause = cause.getCause();
}
+
+ return sb.toString();
+ }
+
+ // Adds to the given StringBuffer a line containing the name and
+ // all stacktrace elements minus the last equal ones.
+ private static void stackTraceStringBuffer(StringBuffer sb, String name,
+ StackTraceElement[] stack, int equal)
+ {
+ // (finish) first line
+ sb.append(name);
+ sb.append(nl);
+
+ // The stacktrace
+ if (stack == null || stack.length == 0)
+ {
+ sb.append(" <<No stacktrace available>>");
+ sb.append(nl);
+ }
+ else
+ {
+ for (int i = 0; i < stack.length-equal; i++)
+ {
+ sb.append(" at ");
+ sb.append(stack[i] == null ? "<<Unknown>>" : stack[i].toString());
+ sb.append(nl);
+ }
+ if (equal > 0)
+ {
+ sb.append(" ...");
+ sb.append(equal);
+ sb.append(" more");
+ sb.append(nl);
+ }
+ }
}
/**
@@ -483,7 +487,13 @@ public class Throwable implements Serializable
* @return this same throwable
* @see #printStackTrace()
*/
- public native Throwable fillInStackTrace();
+ public Throwable fillInStackTrace()
+ {
+ vmState = VMThrowable.fillInStackTrace(this);
+ stackTrace = null; // Should be regenerated when used.
+
+ return this;
+ }
/**
* Provides access to the information printed in {@link #printStackTrace()}.
@@ -499,7 +509,13 @@ public class Throwable implements Serializable
public StackTraceElement[] getStackTrace()
{
if (stackTrace == null)
- stackTrace = getStackTrace0();
+ if (vmState == null)
+ stackTrace = new StackTraceElement[0];
+ else
+ {
+ stackTrace = vmState.getStackTrace(this);
+ vmState = null; // No longer needed
+ }
return stackTrace;
}
@@ -508,6 +524,10 @@ public class Throwable implements Serializable
* Change the stack trace manually. This method is designed for remote
* procedure calls, which intend to alter the stack trace before or after
* serialization according to the context of the remote call.
+ * <p>
+ * The contents of the given stacktrace is copied so changes to the
+ * original array do not change the stack trace elements of this
+ * throwable.
*
* @param stackTrace the new trace to use
* @throws NullPointerException if stackTrace is null or has null elements
@@ -515,15 +535,23 @@ public class Throwable implements Serializable
*/
public void setStackTrace(StackTraceElement[] stackTrace)
{
- for (int i = stackTrace.length; --i >= 0; )
- if (stackTrace[i] == null)
- throw new NullPointerException();
- this.stackTrace = stackTrace;
- }
+ int i = stackTrace.length;
+ StackTraceElement[] st = new StackTraceElement[i];
- private native final StackTraceElement[] getStackTrace0 ();
+ while (--i >= 0)
+ {
+ st[i] = stackTrace[i];
+ if (st[i] == null)
+ throw new NullPointerException("Element " + i + " null");
+ }
+
+ this.stackTrace = st;
+ }
- // Setting this flag to false prevents fillInStackTrace() from running.
- static boolean trace_enabled = true;
- private transient byte stackTraceBytes[];
+ /**
+ * VM state when fillInStackTrace was called.
+ * Used by getStackTrace() to get an array of StackTraceElements.
+ * Cleared when no longer needed.
+ */
+ private transient VMThrowable vmState;
}
diff --git a/libjava/java/lang/VMClassLoader.java b/libjava/java/lang/VMClassLoader.java
index 445272b1bba..11b75548e53 100644
--- a/libjava/java/lang/VMClassLoader.java
+++ b/libjava/java/lang/VMClassLoader.java
@@ -43,10 +43,10 @@ class VMClassLoader {
* @return the class that was defined.
* @exception ClassFormatError if the byte array is not in proper classfile format.
*/
- // Not yet needed for libgcj.
-// final static native Class defineClass(ClassLoader cl, String name,
-// byte[] data, int offset, int len) throws ClassFormatError;
-
+ final static native Class defineClass(ClassLoader cl, String name,
+ byte[] data, int offset, int len)
+ throws ClassFormatError;
+
/**
* Helper to resolve all references to other classes from this class.
* @param c the class to resolve.
diff --git a/libjava/java/lang/VMThrowable.java b/libjava/java/lang/VMThrowable.java
new file mode 100644
index 00000000000..0a2c9229649
--- /dev/null
+++ b/libjava/java/lang/VMThrowable.java
@@ -0,0 +1,97 @@
+/* java.lang.VMThrowable -- VM support methods for Throwable.
+ Copyright (C) 1998, 1999, 2002 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 java.lang;
+
+import gnu.gcj.runtime.NameFinder;
+
+/**
+ * VM dependant state and support methods Throwabele.
+ * It is deliberately package local and final and should only be accessed
+ * by the Throwable class.
+ * <p>
+ * This is the version used by libgcj (http://gcc.gnu.org/java/).
+ *
+ * @author Mark Wielaard (mark@klomp.org)
+ */
+final class VMThrowable
+{
+ private gnu.gcj.RawData stackTraceAddrs;
+ private int length;
+
+ /**
+ * Private contructor, create VMThrowables with fillInStackTrace();
+ */
+ private VMThrowable() { }
+
+ /**
+ * Fill in the stack trace with the current execution stack.
+ * Called by <code>Throwable.fillInStackTrace()</code> to get the state of
+ * the VM. Can return null when the VM does not support caputing the VM
+ * execution state.
+ *
+ * @return a new VMThrowable containing the current execution stack trace.
+ * @see Throwable#fillInStackTrace()
+ */
+ static native VMThrowable fillInStackTrace(Throwable t);
+
+ /**
+ * Returns an <code>StackTraceElement</code> array based on the execution
+ * state of the VM as captured by <code>fillInStackTrace</code>.
+ * Called by <code>Throwable.getStackTrace()</code>.
+ *
+ * @return a non-null but possible zero length array of StackTraceElement.
+ * @see Throwable#getStackTrace()
+ */
+ StackTraceElement[] getStackTrace(Throwable t)
+ {
+ StackTraceElement[] result;
+ if (stackTraceAddrs != null)
+ {
+ NameFinder nameFinder = new NameFinder();
+ result = nameFinder.lookup(t, stackTraceAddrs, length);
+ nameFinder.close();
+ }
+ else
+ result = new StackTraceElement[0];
+
+ return result;
+ }
+
+ // Setting this flag to false prevents fillInStackTrace() from running.
+ static boolean trace_enabled = true;
+}
diff --git a/libjava/java/lang/natClass.cc b/libjava/java/lang/natClass.cc
index 43b79adc9b6..fb412f224b9 100644
--- a/libjava/java/lang/natClass.cc
+++ b/libjava/java/lang/natClass.cc
@@ -315,8 +315,8 @@ java::lang::Class::getSignature (JArray<jclass> *param_types,
}
java::lang::reflect::Method *
-java::lang::Class::getDeclaredMethod (jstring name,
- JArray<jclass> *param_types)
+java::lang::Class::_getDeclaredMethod (jstring name,
+ JArray<jclass> *param_types)
{
jstring partial_sig = getSignature (param_types, false);
jint p_len = partial_sig->length();
@@ -324,7 +324,6 @@ java::lang::Class::getDeclaredMethod (jstring name,
int i = isPrimitive () ? 0 : method_count;
while (--i >= 0)
{
- // FIXME: access checks.
if (_Jv_equalUtf8Consts (methods[i].name, utf_name)
&& _Jv_equaln (methods[i].signature, partial_sig, p_len))
{
@@ -336,7 +335,7 @@ java::lang::Class::getDeclaredMethod (jstring name,
return rmethod;
}
}
- throw new java::lang::NoSuchMethodException;
+ return NULL;
}
JArray<java::lang::reflect::Method *> *
@@ -742,9 +741,7 @@ java::lang::Class::initializeClass (void)
wait ();
// Steps 3 & 4.
- if (state == JV_STATE_DONE
- || state == JV_STATE_IN_PROGRESS
- || thread == self)
+ if (state == JV_STATE_DONE || state == JV_STATE_IN_PROGRESS)
{
_Jv_MonitorExit (this);
return;
@@ -754,7 +751,7 @@ java::lang::Class::initializeClass (void)
if (state == JV_STATE_ERROR)
{
_Jv_MonitorExit (this);
- throw new java::lang::NoClassDefFoundError;
+ throw new java::lang::NoClassDefFoundError (getName());
}
// Step 6.
@@ -1046,7 +1043,12 @@ _Jv_CheckArrayStore (jobject arr, jobject obj)
jclass obj_class = JV_CLASS (obj);
if (__builtin_expect
(! _Jv_IsAssignableFrom (elt_class, obj_class), false))
- throw new java::lang::ArrayStoreException;
+ throw new java::lang::ArrayStoreException
+ ((new java::lang::StringBuffer
+ (JvNewStringUTF("Cannot store ")))->append
+ (obj_class->getName())->append
+ (JvNewStringUTF(" in array of type "))->append
+ (elt_class->getName())->toString());
}
}
diff --git a/libjava/java/lang/natClassLoader.cc b/libjava/java/lang/natClassLoader.cc
index 9c83d593ebb..8bff16997b9 100644
--- a/libjava/java/lang/natClassLoader.cc
+++ b/libjava/java/lang/natClassLoader.cc
@@ -171,6 +171,16 @@ java::lang::ClassLoader::markClassErrorState0 (java::lang::Class *klass)
}
jclass
+java::lang::VMClassLoader::defineClass (java::lang::ClassLoader *cl,
+ jstring name,
+ jbyteArray data,
+ jint offset,
+ jint length)
+{
+ return cl->defineClass (name, data, offset, length);
+}
+
+jclass
java::lang::VMClassLoader::getPrimitiveClass (jchar type)
{
char sig[2];
@@ -194,7 +204,14 @@ gnu::gcj::runtime::VMClassLoader::findClass (jstring name)
// by `lib-gnu-pkg.so' and `lib-gnu.so'. If loading one of
// these causes the class to appear in the cache, then use it.
java::lang::StringBuffer *sb = new java::lang::StringBuffer (JvNewStringLatin1("lib-"));
- jstring so_base_name = (sb->append (name)->toString ())->replace ('.', '-');
+ // Skip inner classes
+ jstring cn;
+ jint ci = name->indexOf('$');
+ if (ci == -1)
+ cn = name;
+ else
+ cn = name->substring (0, ci);
+ jstring so_base_name = (sb->append (cn)->toString ())->replace ('.', '-');
// Compare against `3' because that is the length of "lib".
while (! klass && so_base_name && so_base_name->length() > 3)
@@ -260,7 +277,7 @@ _Jv_PrepareCompiledClass (jclass klass)
if (! found)
{
jstring str = _Jv_NewStringUTF (name->data);
- throw new java::lang::ClassNotFoundException (str);
+ throw new java::lang::NoClassDefFoundError (str);
}
pool->data[index].clazz = found;
@@ -269,6 +286,7 @@ _Jv_PrepareCompiledClass (jclass klass)
else if (pool->tags[index] == JV_CONSTANT_String)
{
jstring str;
+
str = _Jv_NewStringUtf8Const (pool->data[index].utf8);
pool->data[index].o = str;
pool->tags[index] |= JV_CONSTANT_ResolvedFlag;
diff --git a/libjava/java/lang/natObject.cc b/libjava/java/lang/natObject.cc
index 4cf26bf751c..4c2fd6cab03 100644
--- a/libjava/java/lang/natObject.cc
+++ b/libjava/java/lang/natObject.cc
@@ -305,9 +305,9 @@ _Jv_MonitorExit (jobject obj)
#include <assert.h>
#include <limits.h>
#include <unistd.h> // for usleep, sysconf.
-#include <sched.h> // for sched_yield.
#include <gcj/javaprims.h>
#include <sysdep/locks.h>
+#include <java/lang/Thread.h>
// Try to determine whether we are on a multiprocessor, i.e. whether
// spinning may be profitable.
@@ -525,14 +525,14 @@ spin(unsigned n)
}
else if (n < yield_limit)
{
- sched_yield();
+ _Jv_ThreadYield();
}
else
{
unsigned duration = MIN_SLEEP_USECS << (n - yield_limit);
if (n >= 15 + yield_limit || duration > MAX_SLEEP_USECS)
- duration = MAX_SLEEP_USECS;
- usleep(duration);
+ duration = MAX_SLEEP_USECS;
+ java::lang::Thread::sleep(0, duration);
}
}
@@ -574,7 +574,15 @@ static void
heavy_lock_obj_finalization_proc (void *obj, void *cd)
{
heavy_lock *hl = (heavy_lock *)cd;
+
+// This only addresses misalignment of statics, not heap objects. It
+// works only because registering statics for finalization is a noop,
+// no matter what the least significant bits are.
+#ifdef JV_LINKER_CANNOT_8BYTE_ALIGN_STATICS
+ obj_addr_t addr = (obj_addr_t)obj & ~((obj_addr_t)0x7);
+#else
obj_addr_t addr = (obj_addr_t)obj;
+#endif
hash_entry *he = light_locks + JV_SYNC_HASH(addr);
obj_addr_t he_address = (he -> address & ~LOCKED);
@@ -753,7 +761,11 @@ get_heavy(obj_addr_t addr, hash_entry *he)
void
_Jv_MonitorEnter (jobject obj)
{
+#ifdef JV_LINKER_CANNOT_8BYTE_ALIGN_STATICS
+ obj_addr_t addr = (obj_addr_t)obj & ~((obj_addr_t)FLAGS);
+#else
obj_addr_t addr = (obj_addr_t)obj;
+#endif
obj_addr_t address;
unsigned hash = JV_SYNC_HASH(addr);
hash_entry * he = light_locks + hash;
@@ -898,7 +910,11 @@ retry:
void
_Jv_MonitorExit (jobject obj)
{
+#ifdef JV_LINKER_CANNOT_8BYTE_ALIGN_STATICS
+ obj_addr_t addr = (obj_addr_t)obj & ~((obj_addr_t)FLAGS);
+#else
obj_addr_t addr = (obj_addr_t)obj;
+#endif
_Jv_ThreadId_t self = _Jv_ThreadSelf();
unsigned hash = JV_SYNC_HASH(addr);
hash_entry * he = light_locks + hash;
@@ -1078,7 +1094,11 @@ retry:
void
java::lang::Object::wait (jlong timeout, jint nanos)
{
+#ifdef JV_LINKER_CANNOT_8BYTE_ALIGN_STATICS
+ obj_addr_t addr = (obj_addr_t)this & ~((obj_addr_t)FLAGS);
+#else
obj_addr_t addr = (obj_addr_t)this;
+#endif
_Jv_ThreadId_t self = _Jv_ThreadSelf();
unsigned hash = JV_SYNC_HASH(addr);
hash_entry * he = light_locks + hash;
@@ -1155,7 +1175,11 @@ retry:
void
java::lang::Object::notify (void)
{
+#ifdef JV_LINKER_CANNOT_8BYTE_ALIGN_STATICS
+ obj_addr_t addr = (obj_addr_t)this & ~((obj_addr_t)FLAGS);
+#else
obj_addr_t addr = (obj_addr_t)this;
+#endif
_Jv_ThreadId_t self = _Jv_ThreadSelf();
unsigned hash = JV_SYNC_HASH(addr);
hash_entry * he = light_locks + hash;
@@ -1200,7 +1224,11 @@ retry:
void
java::lang::Object::notifyAll (void)
{
+#ifdef JV_LINKER_CANNOT_8BYTE_ALIGN_STATICS
+ obj_addr_t addr = (obj_addr_t)this & ~((obj_addr_t)FLAGS);
+#else
obj_addr_t addr = (obj_addr_t)this;
+#endif
_Jv_ThreadId_t self = _Jv_ThreadSelf();
unsigned hash = JV_SYNC_HASH(addr);
hash_entry * he = light_locks + hash;
diff --git a/libjava/java/lang/natRuntime.cc b/libjava/java/lang/natRuntime.cc
index 18ec2321475..6737dbcbbfa 100644
--- a/libjava/java/lang/natRuntime.cc
+++ b/libjava/java/lang/natRuntime.cc
@@ -102,14 +102,26 @@ _Jv_FindSymbolInExecutable (const char *symname)
return NULL;
}
+void
+_Jv_SetDLLSearchPath (const char *path)
+{
+ lt_dlsetsearchpath (path);
+}
+
#else
void *
-_Jv_FindSymbolInExecutable (const char *symname)
+_Jv_FindSymbolInExecutable (const char *)
{
return NULL;
}
+void
+_Jv_SetDLLSearchPath (const char *)
+{
+ // Nothing.
+}
+
#endif /* USE_LTDL */
@@ -368,7 +380,8 @@ java::lang::Runtime::insertSystemProperties (java::util::Properties *newprops)
// nothing else when installing gcj. Plus, people are free to
// redefine `java.home' with `-D' if necessary.
SET ("java.home", PREFIX);
-
+ SET ("gnu.classpath.home", PREFIX);
+
SET ("file.encoding", default_file_encoding);
#ifdef HAVE_UNAME
@@ -533,8 +546,30 @@ java::lang::Runtime::insertSystemProperties (java::util::Properties *newprops)
sb->toString ());
}
+ // The name used to invoke this process (argv[0] in C).
+ SET ("gnu.gcj.progname", _Jv_ThisExecutable());
+
// Allow platform specific settings and overrides.
_Jv_platform_initProperties (newprops);
+
+ // If java.library.path is set, tell libltdl so we search the new
+ // directories as well. FIXME: does this work properly on Windows?
+ String *path = newprops->getProperty(JvNewStringLatin1("java.library.path"));
+ if (path)
+ {
+ char *val = (char *) _Jv_Malloc (JvGetStringUTFLength (path) + 1);
+ jsize total = JvGetStringUTFRegion (path, 0, path->length(), val);
+ val[total] = '\0';
+ _Jv_SetDLLSearchPath (val);
+ _Jv_Free (val);
+ }
+ else
+ {
+ // Set a value for user code to see.
+ // FIXME: JDK sets this to the actual path used, including
+ // LD_LIBRARY_PATH, etc.
+ SET ("java.library.path", "");
+ }
}
java::lang::Process *
diff --git a/libjava/java/lang/natThrowable.cc b/libjava/java/lang/natThrowable.cc
deleted file mode 100644
index c2f7d1b8d8d..00000000000
--- a/libjava/java/lang/natThrowable.cc
+++ /dev/null
@@ -1,99 +0,0 @@
-// natThrowable.cc - Superclass for all exceptions.
-
-/* Copyright (C) 2000 Free Software Foundation, Inc
-
- 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. */
-
-/**
- * @author Andrew Haley <aph@cygnus.com>
- * @date Jan 6 2000
- */
-
-#include <config.h>
-
-#include <string.h>
-
-#include <gcj/cni.h>
-#include <jvm.h>
-#include <java/lang/Object.h>
-#include <java-threads.h>
-#include <java/lang/Throwable.h>
-#include <java/lang/StackTraceElement.h>
-#include <java/io/PrintStream.h>
-#include <java/io/PrintWriter.h>
-#include <java/io/IOException.h>
-
-#include <sys/types.h>
-
-#include <stdlib.h>
-#include <stdio.h>
-
-#include <unistd.h>
-
-#ifdef HAVE_EXECINFO_H
-#include <execinfo.h>
-#endif
-
-#include <name-finder.h>
-
-/* FIXME: size of the stack trace is limited to 128 elements. It's
- undoubtedly sensible to limit the stack trace, but 128 is rather
- arbitrary. It may be better to configure this. */
-
-java::lang::Throwable *
-java::lang::Throwable::fillInStackTrace (void)
-{
- if (! trace_enabled)
- return this;
-#if defined (HAVE_BACKTRACE)
- void *p[128];
-
- // We subtract 1 from the number of elements because we don't want
- // to include the call to fillInStackTrace in the trace.
- int n = backtrace (p, 128) - 1;
-
- if (n > 0)
- {
- // We copy the array below to deal with alignment issues.
- stackTraceBytes = JvNewByteArray (n * sizeof p[0]);
- memcpy (elements (stackTraceBytes), p+1, (n * sizeof p[0]));
- }
-
-#endif
-
- return this;
-}
-
-JArray<java::lang::StackTraceElement*> *
-java::lang::Throwable::getStackTrace0 ()
-{
-#ifdef HAVE_BACKTRACE
- if (!stackTraceBytes)
- return NULL;
-
- int depth = stackTraceBytes->length / sizeof (void *);
- void *p[depth];
- // This memcpy is esential; it ensures that the array of void* is
- // correctly aligned.
- memcpy (p, elements (stackTraceBytes), sizeof p);
-
- JArray<java::lang::StackTraceElement*> *result;
- java::lang::StackTraceElement** el;
- result = reinterpret_cast <JArray<java::lang::StackTraceElement *>*>
- (JvNewObjectArray (depth, &java::lang::StackTraceElement::class$, NULL));
- el = elements (result);
-
- _Jv_name_finder finder (_Jv_ThisExecutable ());
-
- for (int i = 0; i < depth; i++)
- el[i] = finder.lookup (p[i]);
-
- return result;
-#else
- return NULL;
-#endif /* HAVE_BACKTRACE */
-}
diff --git a/libjava/java/lang/natVMThrowable.cc b/libjava/java/lang/natVMThrowable.cc
new file mode 100644
index 00000000000..c1b030d4288
--- /dev/null
+++ b/libjava/java/lang/natVMThrowable.cc
@@ -0,0 +1,97 @@
+// natVMThrowable.cc - native helper methods for Throwable
+
+/* Copyright (C) 2000, 2002 Free Software Foundation, Inc
+
+ 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. */
+
+/**
+ * @author Andrew Haley <aph@cygnus.com>
+ * @author Mark Wielaard <mark@klomp.org>
+ *
+ * Native helper methods for VM specific Throwable support.
+ */
+
+#include <config.h>
+
+#include <string.h>
+
+#include <jvm.h>
+#include <gcj/cni.h>
+#include <gnu/gcj/RawData.h>
+#include <java/lang/Object.h>
+#include <java-threads.h>
+#include <java/lang/Throwable.h>
+#include <java/lang/VMThrowable.h>
+#include <java/lang/Thread.h>
+#include <java-interp.h>
+
+#include <sys/types.h>
+
+#include <stdlib.h>
+
+#include <unistd.h>
+
+#ifdef HAVE_EXECINFO_H
+#include <execinfo.h>
+#endif
+
+/* FIXME: size of the stack trace is limited to 128 elements. It's
+ undoubtedly sensible to limit the stack trace, but 128 is rather
+ arbitrary. It may be better to configure this. */
+
+java::lang::VMThrowable *
+java::lang::VMThrowable::fillInStackTrace (java::lang::Throwable*)
+{
+ if (! trace_enabled)
+ return NULL;
+#if defined (HAVE_BACKTRACE)
+ VMThrowable* state = new VMThrowable;
+ void *p[128];
+
+ // We subtract 1 from the number of elements because we don't want
+ // to include the calls to fillInStackTrace in the trace.
+ int n = backtrace (p, 128) - 1;
+
+ _Jv_frame_info *addrs;
+ if (n > 0)
+ {
+#ifdef INTERPRETER
+ extern void _Jv_StartOfInterpreter (void);
+ extern void _Jv_EndOfInterpreter (void);
+
+ java::lang::Thread *thread = java::lang::Thread::currentThread();
+ _Jv_MethodChain *interp_frame
+ = (thread ? reinterpret_cast<_Jv_MethodChain *> (thread->interp_frame)
+ : NULL);
+#endif // INTERPRETER
+
+ state->length = n;
+ int len = n;
+ addrs = (_Jv_frame_info *) _Jv_Malloc (n * sizeof (_Jv_frame_info));
+ for (n = 0; n < len; n++)
+ {
+ addrs[n].addr = p[n];
+#ifdef INTERPRETER
+ if (p[n] >= &_Jv_StartOfInterpreter && p[n] <= &_Jv_EndOfInterpreter)
+ {
+ addrs[n].interp = (void *) interp_frame->self;
+ interp_frame = interp_frame->next;
+ }
+ else
+ addrs[n].interp = 0;
+#endif // INTERPRETER
+ }
+ }
+ else
+ addrs = NULL;
+
+ state->stackTraceAddrs = reinterpret_cast<gnu::gcj::RawData *> (addrs);
+
+ return state;
+#endif
+ return NULL;
+}
diff --git a/libjava/java/lang/ref/Reference.java b/libjava/java/lang/ref/Reference.java
index b0fad39d91f..b02a4ed5775 100644
--- a/libjava/java/lang/ref/Reference.java
+++ b/libjava/java/lang/ref/Reference.java
@@ -1,5 +1,5 @@
/* java.lang.ref.Reference
- Copyright (C) 1999 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -185,7 +185,7 @@ public abstract class Reference
*/
public boolean enqueue()
{
- if (queue != null)
+ if (queue != null && nextOnQueue == null)
{
queue.enqueue(this);
queue = null;
diff --git a/libjava/java/lang/ref/natReference.cc b/libjava/java/lang/ref/natReference.cc
index 5743349caaf..64262f900cb 100644
--- a/libjava/java/lang/ref/natReference.cc
+++ b/libjava/java/lang/ref/natReference.cc
@@ -1,6 +1,6 @@
// natReference.cc - Native code for References
-/* Copyright (C) 2001 Free Software Foundation
+/* Copyright (C) 2001, 2002 Free Software Foundation
This file is part of libgcj.
@@ -165,7 +165,8 @@ add_to_hash (java::lang::ref::Reference *the_reference)
if (3 * hash_count >= 2 * hash_size)
rehash ();
- jobject referent = the_reference->referent;
+ // Use `copy' here because the `referent' field has been cleared.
+ jobject referent = the_reference->copy;
object_list *item = find_slot (referent);
if (item->reference == NULL)
{
@@ -197,7 +198,7 @@ add_to_hash (java::lang::ref::Reference *the_reference)
link = &iter->next;
iter = *link;
}
- n->next = (*link) ? (*link)->next : NULL;
+ n->next = *link;
*link = n;
}
@@ -249,13 +250,7 @@ finalize_referred_to_object (jobject obj)
// If the copy is already NULL then the user must have
// called Reference.clear().
if (ref->copy != NULL)
- {
- if (w == PHANTOM)
- ref->referent = ref->copy;
- else
- ref->copy = NULL;
- ref->enqueue ();
- }
+ ref->enqueue ();
object_list *next = head->next;
_Jv_Free (head);
diff --git a/libjava/java/lang/reflect/InvocationHandler.java b/libjava/java/lang/reflect/InvocationHandler.java
new file mode 100644
index 00000000000..91907e280c7
--- /dev/null
+++ b/libjava/java/lang/reflect/InvocationHandler.java
@@ -0,0 +1,136 @@
+/* java.lang.reflect.InvocationHandler - dynamically executes methods in
+ proxy instances
+ Copyright (C) 2001 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 java.lang.reflect;
+
+/**
+ * This interface defines an invocation handler. Suppose you are using
+ * reflection, and found a method that requires that its parameter
+ * be an object of a given interface. You want to call this method,
+ * but have no idea what classes implement that interface. So, you can
+ * create a {@link Proxy} instance, a convenient way to dynamically
+ * generate a class that meets all the necessary properties of that
+ * interface. But in order for the proxy instance to do any good, it
+ * needs to know what to do when interface methods are invoked! So,
+ * this interface is basically a cool wrapper that provides runtime
+ * code generation needed by proxy instances.<p>
+ *
+ * While this interface was designed for use by Proxy, it will also
+ * work on any object in general.<p>
+ *
+ * Hints for implementing this class:<br>
+ * <ul>
+ * <li>Don't forget that Object.equals, Object.hashCode, and
+ * Object.toString will call this handler. In particular,
+ * a naive call to proxy.equals, proxy.hashCode, or proxy.toString
+ * will put you in an infinite loop. And remember that string
+ * concatenation also invokes toString.</li>
+ * <li>Obey the contract of the Method object you are handling, or
+ * the proxy instance will be forced to throw a
+ * {@link NullPointerException}, {@link ClassCastException},
+ * or {@link UndeclaredThrowableException}.</li>
+ * <li>Be prepared to wrap/unwrap primitives as necessary.</li>
+ * <li>The Method object may be owned by a different interface than
+ * what was actually used as the qualifying type of the method
+ * invocation in the Java source code. This means that it might
+ * not always be safe to throw an exception listed as belonging
+ * to the method's throws clause.</li>
+ * </ul>
+ *
+ * <p><small>For a fun time, create an InvocationHandler that handles the
+ * methods of a proxy instance of the InvocationHandler interface!</small>
+ *
+ * @see Proxy
+ * @see UndeclaredThrowableException
+ *
+ * @author Eric Blake <ebb9@email.byu.edu>
+ * @since 1.3
+ * @status updated to 1.4
+ */
+public interface InvocationHandler
+{
+ /**
+ * When a method is invoked on a proxy instance, it is wrapped and
+ * this method is called instead, so that you may decide at runtime
+ * how the original method should behave.
+ *
+ * @param proxy the instance that the wrapped method should be
+ * invoked on. When this method is called by a Proxy object,
+ * `proxy' will be an instance of {@link Proxy}, and oddly enough,
+ * <code>Proxy.getInvocationHandler(proxy)</code> will return
+ * <code>this</code>!
+ * @param method the reflected method to invoke on the proxy.
+ * When this method is called by a Proxy object, 'method'
+ * will be the reflection object owned by the declaring
+ * class or interface, which may be a supertype of the
+ * interfaces the proxy directly implements.
+ * @param args the arguments passed to the original method, or
+ * <code>null</code> if the method takes no arguments.
+ * (But also be prepared to handle a 0-length array).
+ * Arguments of primitive type, such as <code>boolean</code>
+ * or <code>int</code>, are wrapped in the appropriate
+ * class such as {@link Boolean} or {@link Integer}.
+ * @return whatever is necessary to return from the wrapped method.
+ * If the wrapped method is <code>void</code>, the proxy
+ * instance will ignore it. If the wrapped method returns
+ * a primitive, this must be the correct wrapper type whose value
+ * is exactly assignable to the appropriate type (no widening
+ * will be performed); a null object in this case causes a
+ * {@link NullPointerException}. In all remaining cases, if
+ * the returned object is not assignment compatible to the
+ * declared type of the original method, the proxy instance
+ * will generate a {@link ClassCastException}.
+ * @throws Throwable this interface is listed as throwing anything,
+ * but the implementation should only throw unchecked
+ * exceptions and exceptions listed in the throws clause of
+ * all methods being overridden by the proxy instance. If
+ * something is thrown that is not compatible with the throws
+ * clause of all overridden methods, the proxy instance will
+ * wrap the exception in an UndeclaredThrowableException.
+ * Note that an exception listed in the throws clause of the
+ * `method' parameter might not be declared in additional
+ * interfaces also implemented by the proxy object.
+ *
+ * @see Proxy
+ * @see UndeclaredThrowableException
+ */
+ Object invoke(Object proxy, Method method, Object[] args)
+ throws Throwable;
+
+}
diff --git a/libjava/java/lang/reflect/Proxy.java b/libjava/java/lang/reflect/Proxy.java
new file mode 100644
index 00000000000..82cf3722263
--- /dev/null
+++ b/libjava/java/lang/reflect/Proxy.java
@@ -0,0 +1,1624 @@
+/* Proxy.java -- build a proxy class that implements reflected interfaces
+ Copyright (C) 2001, 2002 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 java.lang.reflect;
+
+import java.io.Serializable;
+import java.security.ProtectionDomain;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.Set;
+import java.util.HashSet;
+import java.util.Iterator;
+import gnu.classpath.Configuration;
+import gnu.java.lang.reflect.TypeSignature;
+
+/**
+ * This class allows you to dynamically create an instance of any (or
+ * even multiple) interfaces by reflection, and decide at runtime
+ * how that instance will behave by giving it an appropriate
+ * {@link InvocationHandler}. Proxy classes serialize specially, so
+ * that the proxy object can be reused between VMs, without requiring
+ * a persistent copy of the generated class code.
+ *
+ * <h3>Creation</h3>
+ * To create a proxy for some interface Foo:
+ *
+ * <pre>
+ * InvocationHandler handler = new MyInvocationHandler(...);
+ * Class proxyClass = Proxy.getProxyClass(
+ * Foo.class.getClassLoader(), new Class[] { Foo.class });
+ * Foo f = (Foo) proxyClass
+ * .getConstructor(new Class[] { InvocationHandler.class })
+ * .newInstance(new Object[] { handler });
+ * </pre>
+ * or more simply:
+ * <pre>
+ * Foo f = (Foo) Proxy.newProxyInstance(Foo.class.getClassLoader(),
+ * new Class[] { Foo.class },
+ * handler);
+ * </pre>
+ *
+ * <h3>Dynamic Proxy Classes</h3>
+ * A dynamic proxy class is created at runtime, and has the following
+ * properties:
+ * <ul>
+ * <li>The class is <code>public</code> and <code>final</code>,
+ * and is neither <code>abstract</code> nor an inner class.</li>
+ * <li>The class has no canonical name (there is no formula you can use
+ * to determine or generate its name), but begins with the
+ * sequence "$Proxy". Abuse this knowledge at your own peril.
+ * (For now, '$' in user identifiers is legal, but it may not
+ * be that way forever. You weren't using '$' in your
+ * identifiers, were you?)</li>
+ * <li>The class extends Proxy, and explicitly implements all the
+ * interfaces specified at creation, in order (this is important
+ * for determining how method invocation is resolved). Note that
+ * a proxy class implements {@link Serializable}, at least
+ * implicitly, since Proxy does, but true serial behavior
+ * depends on using a serializable invocation handler as well.</li>
+ * <li>If at least one interface is non-public, the proxy class
+ * will be in the same package. Otherwise, the package is
+ * unspecified. This will work even if the package is sealed
+ * from user-generated classes, because Proxy classes are
+ * generated by a trusted source. Meanwhile, the proxy class
+ * belongs to the classloader you designated.</li>
+ * <li>Reflection works as expected: {@link Class#getInterfaces()} and
+ * {@link Class#getMethods()} work as they do on normal classes.</li>
+ * <li>The method {@link #isProxyClass()} will distinguish between
+ * true proxy classes and user extensions of this class. It only
+ * returns true for classes created by {@link #getProxyClass}.</li>
+ * <li>The {@link ProtectionDomain} of a proxy class is the same as for
+ * bootstrap classes, such as Object or Proxy, since it is created by
+ * a trusted source. This protection domain will typically be granted
+ * {@link java.security.AllPermission}. But this is not a security
+ * risk, since there are adequate permissions on reflection, which is
+ * the only way to create an instance of the proxy class.</li>
+ * <li>The proxy class contains a single constructor, which takes as
+ * its only argument an {@link InvocationHandler}. The method
+ * {@link #newInstance} is shorthand to do the necessary
+ * reflection.</li>
+ * </ul>
+ *
+ * <h3>Proxy Instances</h3>
+ * A proxy instance is an instance of a proxy class. It has the
+ * following properties, many of which follow from the properties of a
+ * proxy class listed above:
+ * <ul>
+ * <li>For a proxy class with Foo listed as one of its interfaces, the
+ * expression <code>proxy instanceof Foo</code> will return true,
+ * and the expression <code>(Foo) proxy</code> will succeed without
+ * a {@link ClassCastException}.</li>
+ * <li>Each proxy instance has an invocation handler, which can be
+ * accessed by {@link #getInvocationHandler(Object)}. Any call
+ * to an interface method, including {@link Object#hashcode()},
+ * {@link Object#equals(Object)}, or {@link Object#toString()},
+ * but excluding the public final methods of Object, will be
+ * encoded and passed to the {@link InvocationHandler#invoke}
+ * method of this handler.</li>
+ * </ul>
+ *
+ * <h3>Inheritance Issues</h3>
+ * A proxy class may inherit a method from more than one interface.
+ * The order in which interfaces are listed matters, because it determines
+ * which reflected {@link Method} object will be passed to the invocation
+ * handler. This means that the dynamically generated class cannot
+ * determine through which interface a method is being invoked.<p>
+ *
+ * In short, if a method is declared in Object (namely, hashCode,
+ * equals, or toString), then Object will be used; otherwise, the
+ * leftmost interface that inherits or declares a method will be used,
+ * even if it has a more permissive throws clause than what the proxy
+ * class is allowed. Thus, in the invocation handler, it is not always
+ * safe to assume that every class listed in the throws clause of the
+ * passed Method object can safely be thrown; fortunately, the Proxy
+ * instance is robust enough to wrap all illegal checked exceptions in
+ * {@link UndeclaredThrowableException}.
+ *
+ * @see InvocationHandler
+ * @see UndeclaredThrowableException
+ * @see Class
+ * @author Eric Blake <ebb9@email.byu.edu>
+ * @since 1.3
+ * @status updated to 1.4, except for the use of ProtectionDomain
+ */
+public class Proxy implements Serializable
+{
+ /**
+ * Compatible with JDK 1.3+.
+ */
+ private static final long serialVersionUID = -2222568056686623797L;
+
+ /**
+ * Map of ProxyType to proxy class.
+ *
+ * @XXX This prevents proxy classes from being garbage collected.
+ * java.util.WeakHashSet is not appropriate, because that collects the
+ * keys, but we are interested in collecting the elements.
+ */
+ private static final Map proxyClasses = new HashMap();
+
+ /**
+ * The invocation handler for this proxy instance. For Proxy, this
+ * field is unused, but it appears here in order to be serialized in all
+ * proxy classes.
+ *
+ * <em>NOTE</em>: This implementation is more secure for proxy classes
+ * than what Sun specifies. Sun does not require h to be immutable, but
+ * this means you could change h after the fact by reflection. However,
+ * by making h immutable, we may break non-proxy classes which extend
+ * Proxy.
+ * @serial invocation handler associated with this proxy instance
+ */
+ protected final InvocationHandler h;
+
+ /**
+ * Constructs a new Proxy from a subclass (usually a proxy class),
+ * with the specified invocation handler.
+ *
+ * <em>NOTE</em>: This throws a NullPointerException if you attempt
+ * to create a proxy instance with a null handler using reflection.
+ * This behavior is not yet specified by Sun; see Sun Bug 4487672.
+ *
+ * @param handler the invocation handler, may be null if the subclass
+ * is not a proxy class
+ * @throws NullPointerException if handler is null and this is a proxy
+ * instance
+ */
+ protected Proxy(InvocationHandler handler)
+ {
+ if (handler == null && isProxyClass(getClass()))
+ throw new NullPointerException("invalid handler");
+ h = handler;
+ }
+
+ /**
+ * Returns the proxy {@link Class} for the given ClassLoader and array
+ * of interfaces, dynamically generating it if necessary.
+ *
+ * There are several restrictions on this method, the violation of
+ * which will result in an IllegalArgumentException or
+ * NullPointerException:
+ * <ul>
+ * <li>All objects in `interfaces' must represent distinct interfaces.
+ * Classes, primitive types, null, and duplicates are forbidden.</li>
+ * <li>The interfaces must be visible in the specified ClassLoader.
+ * In other words, for each interface i:
+ * <code>Class.forName(i.getName(), false, loader) == i</code>
+ * must be true.</li>
+ * <li>All non-public interfaces (if any) must reside in the same
+ * package, or the proxy class would be non-instantiable. If
+ * there are no non-public interfaces, the package of the proxy
+ * class is unspecified.</li>
+ * <li>All interfaces must be compatible - if two declare a method
+ * with the same name and parameters, the return type must be
+ * the same and the throws clause of the proxy class will be
+ * the maximal subset of subclasses of the throws clauses for
+ * each method that is overridden.</li>
+ * <li>VM constraints limit the number of interfaces a proxy class
+ * may directly implement (however, the indirect inheritance
+ * of {@link Serializable} does not count against this limit).
+ * Even though most VMs can theoretically have 65535
+ * superinterfaces for a class, the actual limit is smaller
+ * because a class's constant pool is limited to 65535 entries,
+ * and not all entries can be interfaces.</li>
+ * </ul><p>
+ *
+ * Note that different orders of interfaces produce distinct classes.
+ *
+ * @param loader the class loader to define the proxy class in; null
+ * implies the bootstrap class loader
+ * @param interfaces the array of interfaces the proxy class implements,
+ * may be empty, but not null
+ * @return the Class object of the proxy class
+ * @throws IllegalArgumentException if the constraints above were
+ * violated, except for problems with null
+ * @throws NullPointerException if `interfaces' is null or contains
+ * a null entry
+ */
+ // synchronized so that we aren't trying to build the same class
+ // simultaneously in two threads
+ public static synchronized Class getProxyClass(ClassLoader loader,
+ Class[] interfaces)
+ {
+ interfaces = (Class[]) interfaces.clone();
+ ProxyType pt = new ProxyType(loader, interfaces);
+ Class clazz = (Class) proxyClasses.get(pt);
+ if (clazz == null)
+ {
+ if (Configuration.HAVE_NATIVE_GET_PROXY_CLASS)
+ clazz = getProxyClass0(loader, interfaces);
+ else
+ {
+ ProxyData data = (Configuration.HAVE_NATIVE_GET_PROXY_DATA
+ ? getProxyData0(loader, interfaces)
+ : ProxyData.getProxyData(pt));
+
+ // FIXME workaround for bug in gcj 3.0.x
+ // Not needed with the latest gcj from cvs
+ //clazz = (Configuration.HAVE_NATIVE_GENERATE_PROXY_CLASS
+ // ? generateProxyClass0(loader, data)
+ // : new ClassFactory(data).generate(loader));
+ if (Configuration.HAVE_NATIVE_GENERATE_PROXY_CLASS)
+ clazz = generateProxyClass0(loader, data);
+ else
+ {
+ ClassFactory cf = new ClassFactory(data);
+ clazz = cf.generate(loader);
+ }
+ }
+
+ Object check = proxyClasses.put(pt, clazz);
+ // assert check == null && clazz != null;
+ if (check != null || clazz == null)
+ throw new InternalError(/*"Fatal flaw in getProxyClass"*/);
+ }
+ return clazz;
+ }
+
+ /**
+ * Combines several methods into one. This is equivalent to:
+ * <pre>
+ * Proxy.getProxyClass(loader, interfaces)
+ * .getConstructor(new Class[] {InvocationHandler.class})
+ * .newInstance(new Object[] {handler});
+ * </pre>
+ * except that it will not fail with the normal problems caused
+ * by reflection. It can still fail for the same reasons documented
+ * in getProxyClass, or if handler is null.
+ *
+ * @param loader the class loader to define the proxy class in; null
+ * implies the bootstrap class loader
+ * @param interfaces the array of interfaces the proxy class implements,
+ * may be empty, but not null
+ * @param handler the invocation handler, may not be null
+ * @return a proxy instance implementing the specified interfaces
+ * @throws IllegalArgumentException if the constraints for getProxyClass
+ * were violated, except for problems with null
+ * @throws NullPointerException if `interfaces' is null or contains
+ * a null entry, or if handler is null
+ * @see #getProxyClass(ClassLoader, Class[])
+ * @see Class#getConstructor(Class[])
+ * @see Constructor#newInstance(Object[])
+ */
+ public static Object newProxyInstance(ClassLoader loader,
+ Class[] interfaces,
+ InvocationHandler handler)
+ {
+ try
+ {
+ // getProxyClass() and Proxy() throw the necessary exceptions
+ return getProxyClass(loader, interfaces)
+ .getConstructor(new Class[] {InvocationHandler.class})
+ .newInstance(new Object[] {handler});
+ }
+ catch (RuntimeException e)
+ {
+ // Let IllegalArgumentException, NullPointerException escape.
+ // assert e instanceof IllegalArgumentException
+ // || e instanceof NullPointerException;
+ throw e;
+ }
+ catch (InvocationTargetException e)
+ {
+ // Let wrapped NullPointerException escape.
+ // assert e.getTargetException() instanceof NullPointerException
+ throw (NullPointerException) e.getCause();
+ }
+ catch (Exception e)
+ {
+ // Covers InstantiationException, IllegalAccessException,
+ // NoSuchMethodException, none of which should be generated
+ // if the proxy class was generated correctly.
+ // assert false;
+ throw (Error) new InternalError("Unexpected: " + e).initCause(e);
+ }
+ }
+
+ /**
+ * Returns true if and only if the Class object is a dynamically created
+ * proxy class (created by <code>getProxyClass</code> or by the
+ * syntactic sugar of <code>newProxyInstance</code>).
+ *
+ * <p>This check is secure (in other words, it is not simply
+ * <code>clazz.getSuperclass() == Proxy.class</code>), it will not
+ * be spoofed by non-proxy classes that extend Proxy.
+ *
+ * @param clazz the class to check, must not be null
+ * @return true if the class represents a proxy class
+ * @throws NullPointerException if clazz is null
+ */
+ // This is synchronized on the off chance that another thread is
+ // trying to add a class to the map at the same time we read it.
+ public static synchronized boolean isProxyClass(Class clazz)
+ {
+ if (! Proxy.class.isAssignableFrom(clazz))
+ return false;
+ // This is a linear search, even though we could do an O(1) search
+ // using new ProxyType(clazz.getClassLoader(), clazz.getInterfaces()).
+ return proxyClasses.containsValue(clazz);
+ }
+
+ /**
+ * Returns the invocation handler for the given proxy instance.<p>
+ *
+ * <em>NOTE</em>: We guarantee a non-null result if successful,
+ * but Sun allows the creation of a proxy instance with a null
+ * handler. See the comments for {@link #Proxy(InvocationHandler)}.
+ *
+ * @param proxy the proxy instance, must not be null
+ * @return the invocation handler, guaranteed non-null.
+ * @throws IllegalArgumentException if
+ * <code>Proxy.isProxyClass(proxy.getClass())</code> returns false.
+ * @throws NullPointerException if proxy is null
+ */
+ public static InvocationHandler getInvocationHandler(Object proxy)
+ {
+ if (! isProxyClass(proxy.getClass()))
+ throw new IllegalArgumentException("not a proxy instance");
+ return ((Proxy) proxy).h;
+ }
+
+ /**
+ * Optional native method to replace (and speed up) the pure Java
+ * implementation of getProxyClass. Only needed if
+ * Configuration.HAVE_NATIVE_GET_PROXY_CLASS is true, this does the
+ * work of both getProxyData0 and generateProxyClass0 with no
+ * intermediate form in Java. The native code may safely assume that
+ * this class must be created, and does not already exist.
+ *
+ * @param loader the class loader to define the proxy class in; null
+ * implies the bootstrap class loader
+ * @param interfaces the interfaces the class will extend
+ * @return the generated proxy class
+ * @throws IllegalArgumentException if the constraints for getProxyClass
+ * were violated, except for problems with null
+ * @throws NullPointerException if `interfaces' is null or contains
+ * a null entry, or if handler is null
+ * @see Configuration#HAVE_NATIVE_GET_PROXY_CLASS
+ * @see #getProxyClass(ClassLoader, Class[])
+ * @see #getProxyData0(ClassLoader, Class[])
+ * @see #generateProxyClass0(ProxyData)
+ */
+ private static native Class getProxyClass0(ClassLoader loader,
+ Class[] interfaces);
+
+ /**
+ * Optional native method to replace (and speed up) the pure Java
+ * implementation of getProxyData. Only needed if
+ * Configuration.HAVE_NATIVE_GET_PROXY_DATA is true. The native code
+ * may safely assume that a new ProxyData object must be created which
+ * does not duplicate any existing ones.
+ *
+ * @param loader the class loader to define the proxy class in; null
+ * implies the bootstrap class loader
+ * @param interfaces the interfaces the class will extend
+ * @return all data that is required to make this proxy class
+ * @throws IllegalArgumentException if the constraints for getProxyClass
+ * were violated, except for problems with null
+ * @throws NullPointerException if `interfaces' is null or contains
+ * a null entry, or if handler is null
+ * @see Configuration.HAVE_NATIVE_GET_PROXY_DATA
+ * @see #getProxyClass(ClassLoader, Class[])
+ * @see #getProxyClass0(ClassLoader, Class[])
+ * @see ProxyType#getProxyData()
+ */
+ private static native ProxyData getProxyData0(ClassLoader loader,
+ Class[] interfaces);
+
+ /**
+ * Optional native method to replace (and speed up) the pure Java
+ * implementation of generateProxyClass. Only needed if
+ * Configuration.HAVE_NATIVE_GENERATE_PROXY_CLASS is true. The native
+ * code may safely assume that a new Class must be created, and that
+ * the ProxyData object does not describe any existing class.
+ *
+ * @param loader the class loader to define the proxy class in; null
+ * implies the bootstrap class loader
+ * @param data the struct of information to convert to a Class. This
+ * has already been verified for all problems except exceeding
+ * VM limitations
+ * @return the newly generated class
+ * @throws IllegalArgumentException if VM limitations are exceeded
+ * @see #getProxyClass(ClassLoader, Class[])
+ * @see #getProxyClass0(ClassLoader, Class[])
+ * @see ProxyData#generateProxyClass(ClassLoader)
+ */
+ private static native Class generateProxyClass0(ClassLoader loader,
+ ProxyData data);
+
+ /**
+ * Helper class for mapping unique ClassLoader and interface combinations
+ * to proxy classes.
+ *
+ * @author Eric Blake <ebb9@email.byu.edu>
+ */
+ private static final class ProxyType
+ {
+ /**
+ * Store the class loader (may be null)
+ */
+ final ClassLoader loader;
+
+ /**
+ * Store the interfaces (never null, all elements are interfaces)
+ */
+ final Class[] interfaces;
+
+ /**
+ * Construct the helper object.
+ *
+ * @param loader the class loader to define the proxy class in; null
+ * implies the bootstrap class loader
+ * @param interfaces an array of interfaces
+ */
+ ProxyType(ClassLoader loader, Class[] interfaces)
+ {
+ if (loader == null)
+ loader = ClassLoader.getSystemClassLoader();
+ this.loader = loader;
+ this.interfaces = interfaces;
+ }
+
+ /**
+ * Calculates the hash code.
+ *
+ * @return a combination of the classloader and interfaces hashcodes.
+ */
+ public int hashCode()
+ {
+ //loader is always not null
+ int hash = loader.hashCode();
+ for (int i = 0; i < interfaces.length; i++)
+ hash = hash * 31 + interfaces[i].hashCode();
+ return hash;
+ }
+
+ // A more comprehensive comparison of two arrays,
+ // ignore array element order, and
+ // ignore redundant elements
+ private static boolean sameTypes(Class arr1[], Class arr2[]) {
+ if (arr1.length == 1 && arr2.length == 1) {
+ return arr1[0] == arr2[0];
+ }
+
+ // total occurrance of elements of arr1 in arr2
+ int total_occ_of_arr1_in_arr2 = 0;
+ each_type:
+ for (int i = arr1.length; --i >= 0; )
+ {
+ Class t = arr1[i];
+ for (int j = i; --j >= 0; )
+ {
+ if (t == arr1[j])
+ { //found duplicate type
+ continue each_type;
+ }
+ }
+
+ // count c(a unique element of arr1)'s
+ // occurrences in arr2
+ int occ_in_arr2 = 0;
+ for (int j = arr2.length; --j >= 0; )
+ {
+ if (t == arr2[j])
+ {
+ ++occ_in_arr2;
+ }
+ }
+ if (occ_in_arr2 == 0)
+ { // t does not occur in arr2
+ return false;
+ }
+
+ total_occ_of_arr1_in_arr2 += occ_in_arr2;
+ }
+ // now, each element of arr2 must have been visited
+ return total_occ_of_arr1_in_arr2 == arr2.length;
+ }
+
+ /**
+ * Calculates equality.
+ *
+ * @param the object to compare to
+ * @return true if it is a ProxyType with same data
+ */
+ public boolean equals(Object other)
+ {
+ ProxyType pt = (ProxyType) other;
+ if (loader != pt.loader || interfaces.length != pt.interfaces.length)
+ return false;
+ return sameTypes(interfaces, pt.interfaces);
+ }
+ } // class ProxyType
+
+ /**
+ * Helper class which allows hashing of a method name and signature
+ * without worrying about return type, declaring class, or throws clause,
+ * and which reduces the maximally common throws clause between two methods
+ *
+ * @author Eric Blake <ebb9@email.byu.edu>
+ */
+ private static final class ProxySignature
+ {
+ /**
+ * The core signatures which all Proxy instances handle.
+ */
+ static final HashMap coreMethods = new HashMap();
+ static
+ {
+ try
+ {
+ ProxySignature sig
+ = new ProxySignature(Object.class
+ .getMethod("equals",
+ new Class[] {Object.class}));
+ coreMethods.put(sig, sig);
+ sig = new ProxySignature(Object.class.getMethod("hashCode", null));
+ coreMethods.put(sig, sig);
+ sig = new ProxySignature(Object.class.getMethod("toString", null));
+ coreMethods.put(sig, sig);
+ }
+ catch (Exception e)
+ {
+ // assert false;
+ throw (Error) new InternalError("Unexpected: " + e).initCause(e);
+ }
+ }
+
+ /**
+ * The underlying Method object, never null
+ */
+ final Method method;
+
+ /**
+ * The set of compatible thrown exceptions, may be empty
+ */
+ final Set exceptions = new HashSet();
+
+ /**
+ * Construct a signature
+ *
+ * @param method the Method this signature is based on, never null
+ */
+ ProxySignature(Method method)
+ {
+ this.method = method;
+ Class[] exc = method.getExceptionTypes();
+ int i = exc.length;
+ while (--i >= 0)
+ {
+ // discard unchecked exceptions
+ if (Error.class.isAssignableFrom(exc[i])
+ || RuntimeException.class.isAssignableFrom(exc[i]))
+ continue;
+ exceptions.add(exc[i]);
+ }
+ }
+
+ /**
+ * Given a method, make sure it's return type is identical
+ * to this, and adjust this signature's throws clause appropriately
+ *
+ * @param other the signature to merge in
+ * @throws IllegalArgumentException if the return types conflict
+ */
+ void checkCompatibility(ProxySignature other)
+ {
+ if (method.getReturnType() != other.method.getReturnType())
+ throw new IllegalArgumentException("incompatible return types: "
+ + method + ", " + other.method);
+
+ // if you can think of a more efficient way than this O(n^2) search,
+ // implement it!
+ int size1 = exceptions.size();
+ int size2 = other.exceptions.size();
+ boolean[] valid1 = new boolean[size1];
+ boolean[] valid2 = new boolean[size2];
+ Iterator itr = exceptions.iterator();
+ int pos = size1;
+ while (--pos >= 0)
+ {
+ Class c1 = (Class) itr.next();
+ Iterator itr2 = other.exceptions.iterator();
+ int pos2 = size2;
+ while (--pos2 >= 0)
+ {
+ Class c2 = (Class) itr2.next();
+ if (c2.isAssignableFrom(c1))
+ valid1[pos] = true;
+ if (c1.isAssignableFrom(c2))
+ valid2[pos2] = true;
+ }
+ }
+ pos = size1;
+ itr = exceptions.iterator();
+ while (--pos >= 0)
+ {
+ itr.next();
+ if (! valid1[pos])
+ itr.remove();
+ }
+ pos = size2;
+ itr = other.exceptions.iterator();
+ while (--pos >= 0)
+ {
+ itr.next();
+ if (! valid2[pos])
+ itr.remove();
+ }
+ exceptions.addAll(other.exceptions);
+ }
+
+ /**
+ * Calculates the hash code.
+ *
+ * @return a combination of name and parameter types
+ */
+ public int hashCode()
+ {
+ int hash = method.getName().hashCode();
+ Class[] types = method.getParameterTypes();
+ for (int i = 0; i < types.length; i++)
+ hash = hash * 31 + types[i].hashCode();
+ return hash;
+ }
+
+ /**
+ * Calculates equality.
+ *
+ * @param the object to compare to
+ * @return true if it is a ProxySignature with same data
+ */
+ public boolean equals(Object other)
+ {
+ ProxySignature ps = (ProxySignature) other;
+ Class[] types1 = method.getParameterTypes();
+ Class[] types2 = ps.method.getParameterTypes();
+ if (! method.getName().equals(ps.method.getName())
+ || types1.length != types2.length)
+ return false;
+ int i = types1.length;
+ while (--i >= 0)
+ if (types1[i] != types2[i])
+ return false;
+ return true;
+ }
+ } // class ProxySignature
+
+ /**
+ * A flat representation of all data needed to generate bytecode/instantiate
+ * a proxy class. This is basically a struct.
+ *
+ * @author Eric Blake <ebb9@email.byu.edu>
+ */
+ private static final class ProxyData
+ {
+ /**
+ * The package this class is in. Possibly null, meaning the unnamed
+ * package.
+ */
+ Package pack;
+
+ /**
+ * The interfaces this class implements. Non-null, but possibly empty.
+ */
+ Class[] interfaces;
+
+ /**
+ * The Method objects this class must pass as the second argument to
+ * invoke (also useful for determining what methods this class has).
+ * Non-null, non-empty (includes at least Object.hashCode, Object.equals,
+ * and Object.toString).
+ */
+ Method[] methods;
+
+ /**
+ * The exceptions that do not need to be wrapped in
+ * UndeclaredThrowableException. exceptions[i] is the same as, or a
+ * subset of subclasses, of methods[i].getExceptionTypes(), depending on
+ * compatible throws clauses with multiple inheritance. It is unspecified
+ * if these lists include or exclude subclasses of Error and
+ * RuntimeException, but excluding them is harmless and generates a
+ * smaller class.
+ */
+ Class[][] exceptions;
+
+ /**
+ * For unique id's
+ */
+ private static int count = 0;
+
+ /**
+ * The id of this proxy class
+ */
+ final int id = count++;
+
+ /**
+ * Construct a ProxyData with uninitialized data members.
+ */
+ ProxyData()
+ {
+ }
+
+ /**
+ * Verifies that the arguments are legal, and sets up remaining data
+ * This should only be called when a class must be generated, as
+ * it is expensive.
+ *
+ * @param pt the ProxyType to convert to ProxyData
+ * @return the flattened, verified ProxyData structure for use in
+ * class generation
+ * @throws IllegalArgumentException if `interfaces' contains
+ * non-interfaces or incompatible combinations, and verify is true
+ * @throws NullPointerException if interfaces is null or contains null
+ */
+ static ProxyData getProxyData(ProxyType pt)
+ {
+ Map method_set = (Map) ProxySignature.coreMethods.clone();
+ boolean in_package = false; // true if we encounter non-public interface
+
+ ProxyData data = new ProxyData();
+ data.interfaces = pt.interfaces;
+
+ // if interfaces is too large, we croak later on when the constant
+ // pool overflows
+ int i = data.interfaces.length;
+ while (--i >= 0)
+ {
+ Class inter = data.interfaces[i];
+ if (! inter.isInterface())
+ throw new IllegalArgumentException("not an interface: " + inter);
+ try
+ {
+ if (Class.forName(inter.getName(), false, pt.loader) != inter)
+ throw new IllegalArgumentException("not accessible in "
+ + "classloader: " + inter);
+ }
+ catch (ClassNotFoundException e)
+ {
+ throw new IllegalArgumentException("not accessible in "
+ + "classloader: " + inter);
+ }
+ if (! Modifier.isPublic(inter.getModifiers()))
+ if (in_package)
+ {
+ Package p = inter.getPackage();
+ if (data.pack != inter.getPackage())
+ throw new IllegalArgumentException("non-public interfaces "
+ + "from different "
+ + "packages");
+ }
+ else
+ {
+ in_package = true;
+ data.pack = inter.getPackage();
+ }
+ for (int j = i-1; j >= 0; j--)
+ if (data.interfaces[j] == inter)
+ throw new IllegalArgumentException("duplicate interface: "
+ + inter);
+ Method[] methods = inter.getMethods();
+ int j = methods.length;
+ while (--j >= 0)
+ {
+ ProxySignature sig = new ProxySignature(methods[j]);
+ ProxySignature old = (ProxySignature) method_set.put(sig, sig);
+ if (old != null)
+ sig.checkCompatibility(old);
+ }
+ }
+
+ i = method_set.size();
+ data.methods = new Method[i];
+ data.exceptions = new Class[i][];
+ Iterator itr = method_set.values().iterator();
+ while (--i >= 0)
+ {
+ ProxySignature sig = (ProxySignature) itr.next();
+ data.methods[i] = sig.method;
+ data.exceptions[i] = (Class[]) sig.exceptions
+ .toArray(new Class[sig.exceptions.size()]);
+ }
+ return data;
+ }
+ } // class ProxyData
+
+ /**
+ * Does all the work of building a class. By making this a nested class,
+ * this code is not loaded in memory if the VM has a native
+ * implementation instead.
+ *
+ * @author Eric Blake <ebb9@email.byu.edu>
+ */
+ private static final class ClassFactory
+ {
+ /** Constants for assisting the compilation */
+ private static final byte POOL = 0;
+ private static final byte FIELD = 1;
+ private static final byte METHOD = 2;
+ private static final byte INTERFACE = 3;
+ private static final String CTOR_SIG
+ = "(Ljava/lang/reflect/InvocationHandler;)V";
+ private static final String INVOKE_SIG = "(Ljava/lang/Object;"
+ + "Ljava/lang/reflect/Method;[Ljava/lang/Object;)Ljava/lang/Object;";
+
+ /** Bytecodes for insertion in the class definition byte[] */
+ private static final char ACONST_NULL = 1;
+ private static final char ICONST_0 = 3;
+ private static final char BIPUSH = 16;
+ private static final char SIPUSH = 17;
+ private static final char ILOAD = 21;
+ private static final char ILOAD_0 = 26;
+ private static final char ALOAD_0 = 42;
+ private static final char ALOAD_1 = 43;
+ private static final char AALOAD = 50;
+ private static final char AASTORE = 83;
+ private static final char DUP = 89;
+ private static final char DUP_X1 = 90;
+ private static final char SWAP = 95;
+ private static final char IRETURN = 172;
+ private static final char LRETURN = 173;
+ private static final char FRETURN = 174;
+ private static final char DRETURN = 175;
+ private static final char ARETURN = 176;
+ private static final char RETURN = 177;
+ private static final char GETSTATIC = 178;
+ private static final char GETFIELD = 180;
+ private static final char INVOKEVIRTUAL = 182;
+ private static final char INVOKESPECIAL = 183;
+ private static final char INVOKESTATIC = 184;
+ private static final char INVOKEINTERFACE = 185;
+ private static final char NEW = 187;
+ private static final char ANEWARRAY = 189;
+ private static final char ATHROW = 191;
+ private static final char CHECKCAST = 192;
+
+ // Implementation note: we use StringBuffers to hold the byte data, since
+ // they automatically grow. However, we only use the low 8 bits of
+ // every char in the array, so we are using twice the necessary memory
+ // for the ease StringBuffer provides.
+
+ /** The constant pool. */
+ private final StringBuffer pool = new StringBuffer();
+ /** The rest of the class data. */
+ private final StringBuffer stream = new StringBuffer();
+
+ /** Map of strings to byte sequences, to minimize size of pool. */
+ private final Map poolEntries = new HashMap();
+
+ /** The VM name of this proxy class. */
+ private final String qualName;
+
+ /**
+ * The Method objects the proxy class refers to when calling the
+ * invocation handler.
+ */
+ private final Method[] methods;
+
+ /**
+ * Initializes the buffers with the bytecode contents for a proxy class.
+ *
+ * @param data the remainder of the class data
+ * @throws IllegalArgumentException if anything else goes wrong this
+ * late in the game; as far as I can tell, this will only happen
+ * if the constant pool overflows, which is possible even when
+ * the user doesn't exceed the 65535 interface limit
+ */
+ ClassFactory(ProxyData data)
+ {
+ methods = data.methods;
+
+ // magic = 0xcafebabe
+ // minor_version = 0
+ // major_version = 46
+ // constant_pool_count: place-holder for now
+ pool.append("\u00ca\u00fe\u00ba\u00be\0\0\0\56\0\0");
+ // constant_pool[], filled in as we go
+
+ // access_flags
+ putU2(Modifier.SUPER | Modifier.FINAL | Modifier.PUBLIC);
+ // this_class
+ qualName = ((data.pack == null ? "" : data.pack.getName() + '.')
+ + "$Proxy" + data.id);
+ putU2(classInfo(TypeSignature.getEncodingOfClass(qualName, false)));
+ // super_class
+ putU2(classInfo("java/lang/reflect/Proxy"));
+
+ // interfaces_count
+ putU2(data.interfaces.length);
+ // interfaces[]
+ for (int i = 0; i < data.interfaces.length; i++)
+ putU2(classInfo(data.interfaces[i]));
+
+ // Recall that Proxy classes serialize specially, so we do not need
+ // to worry about a <clinit> method for this field. Instead, we
+ // just assign it by reflection after the class is successfully loaded.
+ // fields_count - private static Method[] m;
+ putU2(1);
+ // fields[]
+ // m.access_flags
+ putU2(Modifier.PRIVATE | Modifier.STATIC);
+ // m.name_index
+ putU2(utf8Info("m"));
+ // m.descriptor_index
+ putU2(utf8Info("[Ljava/lang/reflect/Method;"));
+ // m.attributes_count
+ putU2(0);
+ // m.attributes[]
+
+ // methods_count - # handler methods, plus <init>
+ putU2(methods.length + 1);
+ // methods[]
+ // <init>.access_flags
+ putU2(Modifier.PUBLIC);
+ // <init>.name_index
+ putU2(utf8Info("<init>"));
+ // <init>.descriptor_index
+ putU2(utf8Info(CTOR_SIG));
+ // <init>.attributes_count - only Code is needed
+ putU2(1);
+ // <init>.Code.attribute_name_index
+ putU2(utf8Info("Code"));
+ // <init>.Code.attribute_length = 18
+ // <init>.Code.info:
+ // $Proxynn(InvocationHandler h) { super(h); }
+ // <init>.Code.max_stack = 2
+ // <init>.Code.max_locals = 2
+ // <init>.Code.code_length = 6
+ // <init>.Code.code[]
+ stream.append("\0\0\0\22\0\2\0\2\0\0\0\6" + ALOAD_0 + ALOAD_1
+ + INVOKESPECIAL);
+ putU2(refInfo(METHOD, "java/lang/reflect/Proxy", "<init>", CTOR_SIG));
+ // <init>.Code.exception_table_length = 0
+ // <init>.Code.exception_table[]
+ // <init>.Code.attributes_count = 0
+ // <init>.Code.attributes[]
+ stream.append(RETURN + "\0\0\0\0");
+
+ for (int i = methods.length - 1; i >= 0; i--)
+ emitMethod(i, data.exceptions[i]);
+
+ // attributes_count
+ putU2(0);
+ // attributes[] - empty; omit SourceFile attribute
+ // XXX should we mark this with a Synthetic attribute?
+ }
+
+ /**
+ * Produce the bytecode for a single method.
+ *
+ * @param i the index of the method we are building
+ * @param e the exceptions possible for the method
+ */
+ private void emitMethod(int i, Class[] e)
+ {
+ // First, we precalculate the method length and other information.
+
+ Method m = methods[i];
+ Class[] paramtypes = m.getParameterTypes();
+ int wrap_overhead = 0; // max words taken by wrapped primitive
+ int param_count = 1; // 1 for this
+ int code_length = 16; // aload_0, getfield, aload_0, getstatic, const,
+ // aaload, const/aconst_null, invokeinterface
+ if (i > 5)
+ {
+ if (i > Byte.MAX_VALUE)
+ code_length += 2; // sipush
+ else
+ code_length++; // bipush
+ }
+ if (paramtypes.length > 0)
+ {
+ code_length += 3; // anewarray
+ if (paramtypes.length > Byte.MAX_VALUE)
+ code_length += 2; // sipush
+ else if (paramtypes.length > 5)
+ code_length++; // bipush
+ for (int j = 0; j < paramtypes.length; j++)
+ {
+ code_length += 4; // dup, const, load, store
+ Class type = paramtypes[j];
+ if (j > 5)
+ {
+ if (j > Byte.MAX_VALUE)
+ code_length += 2; // sipush
+ else
+ code_length++; // bipush
+ }
+ if (param_count >= 4)
+ code_length++; // 2-byte load
+ param_count++;
+ if (type.isPrimitive())
+ {
+ code_length += 7; // new, dup, invokespecial
+ if (type == long.class || type == double.class)
+ {
+ wrap_overhead = 3;
+ param_count++;
+ }
+ else if (wrap_overhead < 2)
+ wrap_overhead = 2;
+ }
+ }
+ }
+ int end_pc = code_length;
+ Class ret_type = m.getReturnType();
+ if (ret_type == void.class)
+ code_length++; // return
+ else if (ret_type.isPrimitive())
+ code_length += 7; // cast, invokevirtual, return
+ else
+ code_length += 4; // cast, return
+ int exception_count = 0;
+ boolean throws_throwable = false;
+ for (int j = 0; j < e.length; j++)
+ if (e[j] == Throwable.class)
+ {
+ throws_throwable = true;
+ break;
+ }
+ if (! throws_throwable)
+ {
+ exception_count = e.length + 3; // Throwable, Error, RuntimeException
+ code_length += 9; // new, dup_x1, swap, invokespecial, athrow
+ }
+ int handler_pc = code_length - 1;
+ StringBuffer signature = new StringBuffer("(");
+ for (int j = 0; j < paramtypes.length; j++)
+ signature.append(TypeSignature.getEncodingOfClass(paramtypes[j]));
+ signature.append(")").append(TypeSignature.getEncodingOfClass(ret_type));
+
+ // Now we have enough information to emit the method.
+
+ // handler.access_flags
+ putU2(Modifier.PUBLIC | Modifier.FINAL);
+ // handler.name_index
+ putU2(utf8Info(m.getName()));
+ // handler.descriptor_index
+ putU2(utf8Info(signature.toString()));
+ // handler.attributes_count - Code is necessary, Exceptions possible
+ putU2(e.length > 0 ? 2 : 1);
+
+ // handler.Code.info:
+ // type name(args) {
+ // try {
+ // return (type) h.invoke(this, methods[i], new Object[] {args});
+ // } catch (<declared Exceptions> e) {
+ // throw e;
+ // } catch (Throwable t) {
+ // throw new UndeclaredThrowableException(t);
+ // }
+ // }
+ // Special cases:
+ // if arg_n is primitive, wrap it
+ // if method throws Throwable, try-catch is not needed
+ // if method returns void, return statement not needed
+ // if method returns primitive, unwrap it
+ // save space by sharing code for all the declared handlers
+
+ // handler.Code.attribute_name_index
+ putU2(utf8Info("Code"));
+ // handler.Code.attribute_length
+ putU4(12 + code_length + 8 * exception_count);
+ // handler.Code.max_stack
+ putU2(param_count == 1 ? 4 : 7 + wrap_overhead);
+ // handler.Code.max_locals
+ putU2(param_count);
+ // handler.Code.code_length
+ putU4(code_length);
+ // handler.Code.code[]
+ putU1(ALOAD_0);
+ putU1(GETFIELD);
+ putU2(refInfo(FIELD, "java/lang/reflect/Proxy", "h",
+ "Ljava/lang/reflect/InvocationHandler;"));
+ putU1(ALOAD_0);
+ putU1(GETSTATIC);
+ putU2(refInfo(FIELD, TypeSignature.getEncodingOfClass(qualName, false),
+ "m", "[Ljava/lang/reflect/Method;"));
+ putConst(i);
+ putU1(AALOAD);
+ if (paramtypes.length > 0)
+ {
+ putConst(paramtypes.length);
+ putU1(ANEWARRAY);
+ putU2(classInfo("java/lang/Object"));
+ param_count = 1;
+ for (int j = 0; j < paramtypes.length; j++, param_count++)
+ {
+ putU1(DUP);
+ putConst(j);
+ if (paramtypes[j].isPrimitive())
+ {
+ putU1(NEW);
+ putU2(classInfo(wrapper(paramtypes[j])));
+ putU1(DUP);
+ }
+ putLoad(param_count, paramtypes[j]);
+ if (paramtypes[j].isPrimitive())
+ {
+ putU1(INVOKESPECIAL);
+ putU2(refInfo(METHOD, wrapper(paramtypes[j]), "<init>",
+ '(' + (TypeSignature
+ .getEncodingOfClass(paramtypes[j])
+ + ")V")));
+ if (paramtypes[j] == long.class
+ || paramtypes[j] == double.class)
+ param_count++;
+ }
+ putU1(AASTORE);
+ }
+ }
+ else
+ putU1(ACONST_NULL);
+ putU1(INVOKEINTERFACE);
+ putU2(refInfo(INTERFACE, "java/lang/reflect/InvocationHandler",
+ "invoke", INVOKE_SIG));
+ putU1(4); // InvocationHandler, this, Method, Object[]
+ putU1(0);
+ if (ret_type == void.class)
+ putU1(RETURN);
+ else if (ret_type.isPrimitive())
+ {
+ putU1(CHECKCAST);
+ putU2(classInfo(wrapper(ret_type)));
+ putU1(INVOKEVIRTUAL);
+ putU2(refInfo(METHOD, wrapper(ret_type),
+ ret_type.getName() + "Value",
+ "()" + TypeSignature.getEncodingOfClass(ret_type)));
+ if (ret_type == long.class)
+ putU1(LRETURN);
+ else if (ret_type == float.class)
+ putU1(FRETURN);
+ else if (ret_type == double.class)
+ putU1(DRETURN);
+ else
+ putU1(IRETURN);
+ }
+ else
+ {
+ putU1(CHECKCAST);
+ putU2(classInfo(ret_type));
+ putU1(ARETURN);
+ }
+ if (! throws_throwable)
+ {
+ putU1(NEW);
+ putU2(classInfo("java/lang/reflect/UndeclaredThrowableException"));
+ putU1(DUP_X1);
+ putU1(SWAP);
+ putU1(INVOKESPECIAL);
+ putU2(refInfo(METHOD,
+ "java/lang/reflect/UndeclaredThrowableException",
+ "<init>", "(Ljava/lang/Throwable;)V"));
+ putU1(ATHROW);
+ }
+
+ // handler.Code.exception_table_length
+ putU2(exception_count);
+ // handler.Code.exception_table[]
+ if (! throws_throwable)
+ {
+ // handler.Code.exception_table.start_pc
+ putU2(0);
+ // handler.Code.exception_table.end_pc
+ putU2(end_pc);
+ // handler.Code.exception_table.handler_pc
+ putU2(handler_pc);
+ // handler.Code.exception_table.catch_type
+ putU2(classInfo("java/lang/Error"));
+ // handler.Code.exception_table.start_pc
+ putU2(0);
+ // handler.Code.exception_table.end_pc
+ putU2(end_pc);
+ // handler.Code.exception_table.handler_pc
+ putU2(handler_pc);
+ // handler.Code.exception_table.catch_type
+ putU2(classInfo("java/lang/RuntimeException"));
+ for (int j = 0; j < e.length; j++)
+ {
+ // handler.Code.exception_table.start_pc
+ putU2(0);
+ // handler.Code.exception_table.end_pc
+ putU2(end_pc);
+ // handler.Code.exception_table.handler_pc
+ putU2(handler_pc);
+ // handler.Code.exception_table.catch_type
+ putU2(classInfo(e[j]));
+ }
+ // handler.Code.exception_table.start_pc
+ putU2(0);
+ // handler.Code.exception_table.end_pc
+ putU2(end_pc);
+ // handler.Code.exception_table.handler_pc -
+ // -8 for undeclared handler, which falls thru to normal one
+ putU2(handler_pc - 8);
+ // handler.Code.exception_table.catch_type
+ putU2(0);
+ }
+ // handler.Code.attributes_count
+ putU2(0);
+ // handler.Code.attributes[]
+
+ if (e.length > 0)
+ {
+ // handler.Exceptions.attribute_name_index
+ putU2(utf8Info("Exceptions"));
+ // handler.Exceptions.attribute_length
+ putU4(2 * e.length + 2);
+ // handler.Exceptions.number_of_exceptions
+ putU2(e.length);
+ // handler.Exceptions.exception_index_table[]
+ for (int j = 0; j < e.length; j++)
+ putU2(classInfo(e[j]));
+ }
+ }
+
+ /**
+ * Creates the Class object that corresponds to the bytecode buffers
+ * built when this object was constructed.
+ *
+ * @param loader the class loader to define the proxy class in; null
+ * implies the bootstrap class loader
+ * @return the proxy class Class object
+ */
+ final Class generate(ClassLoader loader)
+ {
+ byte[] bytecode = new byte[pool.length() + stream.length()];
+ // More efficient to bypass calling charAt() repetitively.
+ char[] c = pool.toString().toCharArray();
+ int i = c.length;
+ while (--i >= 0)
+ bytecode[i] = (byte) c[i];
+ c = stream.toString().toCharArray();
+ i = c.length;
+ int j = bytecode.length;
+ while (i > 0)
+ bytecode[--j] = (byte) c[--i];
+
+ // Patch the constant pool size, which we left at 0 earlier.
+ int count = poolEntries.size() + 1;
+ bytecode[8] = (byte) (count >> 8);
+ bytecode[9] = (byte) count;
+
+ try
+ {
+ // XXX Do we require more native support here?
+
+ // XXX Security hole - it is possible for another thread to grab the
+ // VMClassLoader.defineClass Method object, and abuse it while we
+ // have temporarily made it accessible. Do we need to add some
+ // synchronization lock to prevent user reflection while we use it?
+
+ // XXX This is waiting on VM support for protection domains.
+
+ Class vmClassLoader = Class.forName("java.lang.VMClassLoader");
+ Class[] types = {ClassLoader.class, String.class,
+ byte[].class, int.class, int.class,
+ /* ProtectionDomain.class */ };
+ Method m = vmClassLoader.getDeclaredMethod("defineClass", types);
+
+ // Bypass the security check of setAccessible(true), since this
+ // is trusted code. But note the comment above about the security
+ // risk of doing this outside a synchronized block.
+ m.flag = true;
+ Object[] args = {loader, qualName, bytecode, new Integer(0),
+ new Integer(bytecode.length),
+ /* Object.class.getProtectionDomain() */ };
+ Class clazz = (Class) m.invoke(null, args);
+ m.flag = false;
+
+ // Finally, initialize the m field of the proxy class, before
+ // returning it.
+
+ // No security risk here, since clazz has not been exposed yet,
+ // so user code cannot grab the same reflection object.
+ Field f = clazz.getDeclaredField("m");
+ f.flag = true;
+ // we can share the array, because it is not publicized
+ f.set(null, methods);
+ f.flag = false;
+
+ return clazz;
+ }
+ catch (Throwable e)
+ {
+ // assert false;
+ throw (Error) new InternalError("Unexpected: " + e).initCause(e);
+ }
+ }
+
+ /**
+ * Put a single byte on the stream.
+ *
+ * @param i the information to add (only lowest 8 bits are used)
+ */
+ private void putU1(int i)
+ {
+ stream.append((char) i);
+ }
+
+ /**
+ * Put two bytes on the stream.
+ *
+ * @param i the information to add (only lowest 16 bits are used)
+ */
+ private void putU2(int i)
+ {
+ stream.append((char) (i >> 8)).append((char) i);
+ }
+
+ /**
+ * Put four bytes on the stream.
+ *
+ * @param i the information to add (treated as unsigned)
+ */
+ private void putU4(int i)
+ {
+ stream.append((char) (i >> 24)).append((char) (i >> 16));
+ stream.append((char) (i >> 8)).append((char) i);
+ }
+
+ /**
+ * Put bytecode to load a constant integer on the stream. This only
+ * needs to work for values less than Short.MAX_VALUE.
+ *
+ * @param i the int to add
+ */
+ private void putConst(int i)
+ {
+ if (i >= -1 && i <= 5)
+ putU1(ICONST_0 + i);
+ else if (i >= Byte.MIN_VALUE && i <= Byte.MAX_VALUE)
+ {
+ putU1(BIPUSH);
+ putU1(i);
+ }
+ else
+ {
+ putU1(SIPUSH);
+ putU2(i);
+ }
+ }
+
+ /**
+ * Put bytecode to load a given local variable on the stream.
+ *
+ * @param i the slot to load
+ * @param type the base type of the load
+ */
+ private void putLoad(int i, Class type)
+ {
+ int offset = 0;
+ if (type == long.class)
+ offset = 1;
+ else if (type == float.class)
+ offset = 2;
+ else if (type == double.class)
+ offset = 3;
+ else if (! type.isPrimitive())
+ offset = 4;
+ if (i < 4)
+ putU1(ILOAD_0 + 4 * offset + i);
+ else
+ {
+ putU1(ILOAD + offset);
+ putU1(i);
+ }
+ }
+
+ /**
+ * Given a primitive type, return its wrapper class name.
+ *
+ * @param clazz the primitive type (but not void.class)
+ * @return the internal form of the wrapper class name
+ */
+ private String wrapper(Class clazz)
+ {
+ if (clazz == boolean.class)
+ return "java/lang/Boolean";
+ if (clazz == byte.class)
+ return "java/lang/Byte";
+ if (clazz == short.class)
+ return "java/lang/Short";
+ if (clazz == char.class)
+ return "java/lang/Character";
+ if (clazz == int.class)
+ return "java/lang/Integer";
+ if (clazz == long.class)
+ return "java/lang/Long";
+ if (clazz == float.class)
+ return "java/lang/Float";
+ if (clazz == double.class)
+ return "java/lang/Double";
+ // assert false;
+ return null;
+ }
+
+ /**
+ * Returns the entry of this String in the Constant pool, adding it
+ * if necessary.
+ *
+ * @param str the String to resolve
+ * @return the index of the String in the constant pool
+ */
+ private char utf8Info(String str)
+ {
+ String utf8 = toUtf8(str);
+ int len = utf8.length();
+ return poolIndex("\1" + (char) (len >> 8) + (char) (len & 0xff) + utf8);
+ }
+
+ /**
+ * Returns the entry of the appropriate class info structure in the
+ * Constant pool, adding it if necessary.
+ *
+ * @param name the class name, in internal form
+ * @return the index of the ClassInfo in the constant pool
+ */
+ private char classInfo(String name)
+ {
+ char index = utf8Info(name);
+ char[] c = {7, (char) (index >> 8), (char) (index & 0xff)};
+ return poolIndex(new String(c));
+ }
+
+ /**
+ * Returns the entry of the appropriate class info structure in the
+ * Constant pool, adding it if necessary.
+ *
+ * @param clazz the class type
+ * @return the index of the ClassInfo in the constant pool
+ */
+ private char classInfo(Class clazz)
+ {
+ return classInfo(TypeSignature.getEncodingOfClass(clazz.getName(),
+ false));
+ }
+
+ /**
+ * Returns the entry of the appropriate fieldref, methodref, or
+ * interfacemethodref info structure in the Constant pool, adding it
+ * if necessary.
+ *
+ * @param structure FIELD, METHOD, or INTERFACE
+ * @param clazz the class name, in internal form
+ * @param name the simple reference name
+ * @param type the type of the reference
+ * @return the index of the appropriate Info structure in the constant pool
+ */
+ private char refInfo(byte structure, String clazz, String name,
+ String type)
+ {
+ char cindex = classInfo(clazz);
+ char ntindex = nameAndTypeInfo(name, type);
+ // relies on FIELD == 1, METHOD == 2, INTERFACE == 3
+ char[] c = {(char) (structure + 8),
+ (char) (cindex >> 8), (char) (cindex & 0xff),
+ (char) (ntindex >> 8), (char) (ntindex & 0xff)};
+ return poolIndex(new String(c));
+ }
+
+ /**
+ * Returns the entry of the appropriate nameAndTyperef info structure
+ * in the Constant pool, adding it if necessary.
+ *
+ * @param name the simple name
+ * @param type the reference type
+ * @return the index of the NameAndTypeInfo structure in the constant pool
+ */
+ private char nameAndTypeInfo(String name, String type)
+ {
+ char nindex = utf8Info(name);
+ char tindex = utf8Info(type);
+ char[] c = {12, (char) (nindex >> 8), (char) (nindex & 0xff),
+ (char) (tindex >> 8), (char) (tindex & 0xff)};
+ return poolIndex(new String(c));
+ }
+
+ /**
+ * Converts a regular string to a UTF8 string, where the upper byte
+ * of every char is 0, and '\\u0000' is not in the string. This is
+ * basically to use a String as a fancy byte[], and while it is less
+ * efficient in memory use, it is easier for hashing.
+ *
+ * @param str the original, in straight unicode
+ * @return a modified string, in UTF8 format in the low bytes
+ */
+ private String toUtf8(String str)
+ {
+ final char[] ca = str.toCharArray();
+ final int len = ca.length;
+
+ // Avoid object creation, if str is already fits UTF8.
+ int i;
+ for (i = 0; i < len; i++)
+ if (ca[i] == 0 || ca[i] > '\u007f')
+ break;
+ if (i == len)
+ return str;
+
+ final StringBuffer sb = new StringBuffer(str);
+ sb.setLength(i);
+ for ( ; i < len; i++)
+ {
+ final char c = ca[i];
+ if (c > 0 && c <= '\u007f')
+ sb.append(c);
+ else if (c <= '\u07ff') // includes '\0'
+ {
+ sb.append((char) (0xc0 | (c >> 6)));
+ sb.append((char) (0x80 | (c & 0x6f)));
+ }
+ else
+ {
+ sb.append((char) (0xe0 | (c >> 12)));
+ sb.append((char) (0x80 | ((c >> 6) & 0x6f)));
+ sb.append((char) (0x80 | (c & 0x6f)));
+ }
+ }
+ return sb.toString();
+ }
+
+ /**
+ * Returns the location of a byte sequence (conveniently wrapped in
+ * a String with all characters between \u0001 and \u00ff inclusive)
+ * in the constant pool, adding it if necessary.
+ *
+ * @param sequence the byte sequence to look for
+ * @return the index of the sequence
+ * @throws IllegalArgumentException if this would make the constant
+ * pool overflow
+ */
+ private char poolIndex(String sequence)
+ {
+ Integer i = (Integer) poolEntries.get(sequence);
+ if (i == null)
+ {
+ // pool starts at index 1
+ int size = poolEntries.size() + 1;
+ if (size >= 65535)
+ throw new IllegalArgumentException("exceeds VM limitations");
+ i = new Integer(size);
+ poolEntries.put(sequence, i);
+ pool.append(sequence);
+ }
+ return (char) i.intValue();
+ }
+ } // class ClassFactory
+}
diff --git a/libjava/java/lang/reflect/UndeclaredThrowableException.java b/libjava/java/lang/reflect/UndeclaredThrowableException.java
new file mode 100644
index 00000000000..d9596922beb
--- /dev/null
+++ b/libjava/java/lang/reflect/UndeclaredThrowableException.java
@@ -0,0 +1,128 @@
+/* UndeclaredThrowableException.java -- wraps an undeclared checked exception
+ thrown by a Proxy invocation handler
+ Copyright (C) 2001, 2002 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 java.lang.reflect;
+
+/**
+ * This exception class is thrown by a {@link Proxy} instance if
+ * the {@link InvocationHandler#invoke(Object, Method, Object[]) invoke}
+ * method of that instance's InvocationHandler attempts to throw an
+ * exception that not declared by the throws clauses of all of the
+ * interface methods that the proxy instance is implementing.
+ *
+ * <p>When thrown by Proxy, this class will always wrap a checked
+ * exception, never {@link Error} or {@link RuntimeException},
+ * which are unchecked.
+ *
+ * @author Eric Blake <ebb9@email.byu.edu>
+ * @see Proxy
+ * @see InvocationHandler
+ * @since 1.3
+ * @status updated to 1.4
+ */
+public class UndeclaredThrowableException extends RuntimeException
+{
+ /**
+ * Compatible with JDK 1.3+.
+ */
+ private static final long serialVersionUID = 330127114055056639L;
+
+ /**
+ * The immutable exception that this wraps. This field is redundant
+ * with {@link Throwable#cause}, but is necessary for serial compatibility.
+ *
+ * @serial the chained exception
+ */
+ private final Throwable undeclaredThrowable;
+
+ /**
+ * Wraps the given checked exception into a RuntimeException, with no
+ * detail message. {@link Throwable#initCause(Throwable)} will fail
+ * on this instance.
+ *
+ * @param cause the undeclared throwable that caused this exception,
+ * may be null
+ */
+ public UndeclaredThrowableException(Throwable cause)
+ {
+ this(cause, null);
+ }
+
+ /**
+ * Wraps the given checked exception into a RuntimeException, with the
+ * specified detail message. {@link Throwable#initCause(Throwable)} will
+ * fail on this instance.
+ *
+ * @param cause the undeclared throwable that caused this exception,
+ * may be null
+ * @param message the message, may be null
+ */
+ public UndeclaredThrowableException(Throwable cause, String message)
+ {
+ super(message, cause);
+ undeclaredThrowable = cause;
+ }
+
+ /**
+ * Returns the cause of this exception. If this exception was created
+ * by a {@link Proxy} instance, it will be a non-null checked
+ * exception. This method pre-dates exception chaining, and is now
+ * simply a longer way to call <code>getCause()</code>.
+ *
+ * @return the cause of this exception, may be null
+ * @see #getCause()
+ */
+ public Throwable getUndeclaredThrowable()
+ {
+ return undeclaredThrowable;
+ }
+
+ /**
+ * Returns the cause of this exception. If this exception was created
+ * by a {@link Proxy} instance, it will be a non-null checked
+ * exception.
+ *
+ * @return the cause of this exception, may be null
+ * @since 1.4
+ */
+ public Throwable getCause()
+ {
+ return undeclaredThrowable;
+ }
+}
diff --git a/libjava/java/lang/reflect/natConstructor.cc b/libjava/java/lang/reflect/natConstructor.cc
index 1103d777bf7..7f90b1243e4 100644
--- a/libjava/java/lang/reflect/natConstructor.cc
+++ b/libjava/java/lang/reflect/natConstructor.cc
@@ -1,6 +1,6 @@
// natConstructor.cc - Native code for Constructor class.
-/* Copyright (C) 1999, 2000, 2001 Free Software Foundation
+/* Copyright (C) 1999, 2000, 2001, 2002 Free Software Foundation
This file is part of libgcj.
@@ -50,6 +50,8 @@ java::lang::reflect::Constructor::newInstance (jobjectArray args)
if (Modifier::isAbstract (declaringClass->getModifiers()))
throw new InstantiationException;
+ _Jv_InitClass (declaringClass);
+
jmethodID meth = _Jv_FromReflectedConstructor (this);
// In the constructor case the return type is the type of the
// constructor.
diff --git a/libjava/java/lang/reflect/natField.cc b/libjava/java/lang/reflect/natField.cc
index b10b5f5a65a..93e27a280ce 100644
--- a/libjava/java/lang/reflect/natField.cc
+++ b/libjava/java/lang/reflect/natField.cc
@@ -168,81 +168,73 @@ getDouble (jclass cls, void* addr)
jboolean
java::lang::reflect::Field::getBoolean (jclass caller, jobject obj)
{
- jfieldID fld = _Jv_FromReflectedField (this);
- return ::getBoolean (fld->type, getAddr (this, caller, obj));
+ return ::getBoolean (this->getType(), getAddr (this, caller, obj));
}
jchar
java::lang::reflect::Field::getChar (jclass caller, jobject obj)
{
- jfieldID fld = _Jv_FromReflectedField (this);
- return ::getChar (fld->type, getAddr (this, caller, obj));
+ return ::getChar (this->getType(), getAddr (this, caller, obj));
}
jbyte
java::lang::reflect::Field::getByte (jclass caller, jobject obj)
{
- jfieldID fld = _Jv_FromReflectedField (this);
- return ::getByte (fld->type, getAddr (this, caller, obj));
+ return ::getByte (this->getType(), getAddr (this, caller, obj));
}
jshort
java::lang::reflect::Field::getShort (jclass caller, jobject obj)
{
- jfieldID fld = _Jv_FromReflectedField (this);
- return ::getShort (fld->type, getAddr (this, caller, obj));
+ return ::getShort (this->getType(), getAddr (this, caller, obj));
}
jint
java::lang::reflect::Field::getInt (jclass caller, jobject obj)
{
- jfieldID fld = _Jv_FromReflectedField (this);
- return ::getInt (fld->type, getAddr (this, caller, obj));
+ return ::getInt (this->getType(), getAddr (this, caller, obj));
}
jlong
java::lang::reflect::Field::getLong (jclass caller, jobject obj)
{
- jfieldID fld = _Jv_FromReflectedField (this);
- return ::getLong (fld->type, getAddr (this, caller, obj));
+ return ::getLong (this->getType(), getAddr (this, caller, obj));
}
jfloat
java::lang::reflect::Field::getFloat (jclass caller, jobject obj)
{
- jfieldID fld = _Jv_FromReflectedField (this);
- return ::getFloat (fld->type, getAddr (this, caller, obj));
+ return ::getFloat (this->getType(), getAddr (this, caller, obj));
}
jdouble
java::lang::reflect::Field::getDouble (jclass caller, jobject obj)
{
- jfieldID fld = _Jv_FromReflectedField (this);
- return ::getDouble (fld->type, getAddr (this, caller, obj));
+ return ::getDouble (this->getType(), getAddr (this, caller, obj));
}
jobject
java::lang::reflect::Field::get (jclass caller, jobject obj)
{
- jfieldID fld = _Jv_FromReflectedField (this);
+ jclass type = this->getType();
void* addr = getAddr (this, caller, obj);
- if (! fld->type->isPrimitive ())
+ if (! type->isPrimitive ())
return * (jobject*) addr;
- if (fld->type == JvPrimClass (double))
+ if (type == JvPrimClass (double))
return new java::lang::Double (* (jdouble*) addr);
- if (fld->type == JvPrimClass (float))
+ if (type == JvPrimClass (float))
return new java::lang::Float (* (jfloat*) addr);
- if (fld->type == JvPrimClass (long))
+ if (type == JvPrimClass (long))
return new java::lang::Long (* (jlong*) addr);
- if (fld->type == JvPrimClass (int))
+ if (type == JvPrimClass (int))
return new java::lang::Integer (* (jint*) addr);
- if (fld->type == JvPrimClass (short))
+ if (type == JvPrimClass (short))
return new java::lang::Short (* (jshort*) addr);
- if (fld->type == JvPrimClass (byte))
+ if (type == JvPrimClass (byte))
return new java::lang::Byte (* (jbyte*) addr);
- if (fld->type == JvPrimClass (char))
+ if (type == JvPrimClass (char))
return new java::lang::Character (* (jchar*) addr);
- if (fld->type == JvPrimClass (boolean))
+ if (type == JvPrimClass (boolean))
{
_Jv_InitClass (&java::lang::Boolean::class$);
if (* (jboolean*) addr)
@@ -376,56 +368,48 @@ setDouble (jclass type, void *addr, jdouble value)
void
java::lang::reflect::Field::setBoolean (jclass caller, jobject obj, jboolean b)
{
- jfieldID fld = _Jv_FromReflectedField (this);
- ::setBoolean (fld->type, setAddr (this, caller, obj), b);
+ ::setBoolean (this->getType(), setAddr (this, caller, obj), b);
}
void
java::lang::reflect::Field::setChar (jclass caller, jobject obj, jchar c)
{
- jfieldID fld = _Jv_FromReflectedField (this);
- ::setChar (fld->type, setAddr (this, caller, obj), c);
+ ::setChar (this->getType(), setAddr (this, caller, obj), c);
}
void
java::lang::reflect::Field::setByte (jclass caller, jobject obj, jbyte b)
{
- jfieldID fld = _Jv_FromReflectedField (this);
- ::setByte (fld->type, setAddr (this, caller, obj), b);
+ ::setByte (this->getType(), setAddr (this, caller, obj), b);
}
void
java::lang::reflect::Field::setShort (jclass caller, jobject obj, jshort s)
{
- jfieldID fld = _Jv_FromReflectedField (this);
- ::setShort (fld->type, setAddr (this, caller, obj), s);
+ ::setShort (this->getType(), setAddr (this, caller, obj), s);
}
void
java::lang::reflect::Field::setInt (jclass caller, jobject obj, jint i)
{
- jfieldID fld = _Jv_FromReflectedField (this);
- ::setInt (fld->type, setAddr (this, caller, obj), i);
+ ::setInt (this->getType(), setAddr (this, caller, obj), i);
}
void
java::lang::reflect::Field::setLong (jclass caller, jobject obj, jlong l)
{
- jfieldID fld = _Jv_FromReflectedField (this);
- ::setLong (fld->type, setAddr (this, caller, obj), l);
+ ::setLong (this->getType(), setAddr (this, caller, obj), l);
}
void
java::lang::reflect::Field::setFloat (jclass caller, jobject obj, jfloat f)
{
- jfieldID fld = _Jv_FromReflectedField (this);
- ::setFloat (fld->type, setAddr (this, caller, obj), f);
+ ::setFloat (this->getType(), setAddr (this, caller, obj), f);
}
void
java::lang::reflect::Field::setDouble (jclass caller, jobject obj, jdouble d)
{
- jfieldID fld = _Jv_FromReflectedField (this);
- ::setDouble (fld->type, setAddr (this, caller, obj), d);
+ ::setDouble (this->getType(), setAddr (this, caller, obj), d);
}
void
diff --git a/libjava/java/lang/reflect/natMethod.cc b/libjava/java/lang/reflect/natMethod.cc
index 8e3b7b2140d..9b697d25024 100644
--- a/libjava/java/lang/reflect/natMethod.cc
+++ b/libjava/java/lang/reflect/natMethod.cc
@@ -156,6 +156,13 @@ java::lang::reflect::Method::invoke (jobject obj, jobjectArray args)
// of the object.
meth = _Jv_LookupDeclaredMethod (k, meth->name, meth->signature);
}
+ else
+ {
+ // We have to initialize a static class. It is safe to do this
+ // here and not in _Jv_CallAnyMethodA because JNI initializes a
+ // class whenever a method lookup is done.
+ _Jv_InitClass (declaringClass);
+ }
return _Jv_CallAnyMethodA (obj, return_type, meth, false,
parameter_types, args);
@@ -195,13 +202,12 @@ java::lang::reflect::Method::getType ()
}
exception_types
- = (JArray<jclass> *) JvNewObjectArray (count,
- &java::lang::Class::class$,
+ = (JArray<jclass> *) JvNewObjectArray (count, &java::lang::Class::class$,
NULL);
jclass *elts = elements (exception_types);
for (int i = 0; i < count; ++i)
- elts[i] = _Jv_FindClassFromSignature (method->throws[i]->data,
- declaringClass->getClassLoader ());
+ elts[i] = _Jv_FindClass (method->throws[i],
+ declaringClass->getClassLoader ());
}
void
@@ -405,8 +411,6 @@ _Jv_CallAnyMethodA (jobject obj,
p += tsize;
}
- // FIXME: initialize class here.
-
using namespace java::lang;
using namespace java::lang::reflect;
diff --git a/libjava/java/lang/reflect/natProxy.cc b/libjava/java/lang/reflect/natProxy.cc
new file mode 100644
index 00000000000..1a24858fa78
--- /dev/null
+++ b/libjava/java/lang/reflect/natProxy.cc
@@ -0,0 +1,38 @@
+// natProxy.cc - Native code for Proxy class.
+
+/* Copyright (C) 2002 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 <config.h>
+
+#include <gcj/cni.h>
+#include <jvm.h>
+
+#include <java/lang/Class.h>
+#include <java/lang/ClassLoader.h>
+#include <java/lang/reflect/Proxy.h>
+#include <java/lang/reflect/Proxy$ProxyData.h>
+
+::java::lang::Class *
+java::lang::reflect::Proxy::getProxyClass0 (::java::lang::ClassLoader *, JArray< ::java::lang::Class *> *)
+{
+ return 0;
+}
+
+::java::lang::reflect::Proxy$ProxyData *
+java::lang::reflect::Proxy::getProxyData0 (::java::lang::ClassLoader *, JArray< ::java::lang::Class *> *)
+{
+ return 0;
+}
+
+::java::lang::Class *
+java::lang::reflect::Proxy::generateProxyClass0 (::java::lang::ClassLoader *,
+ ::java::lang::reflect::Proxy$ProxyData *)
+{
+ return 0;
+}
diff --git a/libjava/java/net/Authenticator.java b/libjava/java/net/Authenticator.java
index f6ad9dd27b0..e1e322b3bb1 100644
--- a/libjava/java/net/Authenticator.java
+++ b/libjava/java/net/Authenticator.java
@@ -150,7 +150,7 @@ setDefault(Authenticator def_auth)
* @param port The port requesting authentication
* @param protocol The protocol requesting authentication
* @param prompt The prompt to display to the user when requesting
- authentication info
+ * authentication info
* @param scheme The authentication scheme in use
*
* @return A <code>PasswordAuthentication</code> object with the user's
@@ -169,8 +169,33 @@ requestPasswordAuthentication(InetAddress addr, int port, String protocol,
}
/**
- * @since 1.4
- */
+ * This method is called whenever a username and password for a given
+ * network operation is required. First, a security check is made to see
+ * if the caller has the "requestPasswordAuthentication"
+ * permission. If not, the method thows an exception. If there is no
+ * default <code>Authenticator</code> object, the method then returns
+ * <code>null</code>. Otherwise, the default authenticators's instance
+ * variables are initialized and it's <code>getPasswordAuthentication</code>
+ * method is called to get the actual authentication information to return.
+ * This method is the preferred one as it can be used with hostname
+ * when addr is unknown.
+ *
+ * @param host The hostname requesting authentication
+ * @param addr The address requesting authentication
+ * @param port The port requesting authentication
+ * @param protocol The protocol requesting authentication
+ * @param prompt The prompt to display to the user when requesting
+ * authentication info
+ * @param scheme The authentication scheme in use
+ *
+ * @return A <code>PasswordAuthentication</code> object with the user's
+ * authentication info.
+ *
+ * @exception SecurityException If the caller does not have permission to
+ * perform this operation
+ *
+ * @since 1.4
+ */
public static PasswordAuthentication
requestPasswordAuthentication(String host, InetAddress addr, int port,
String protocol, String prompt, String scheme)
@@ -194,6 +219,9 @@ requestPasswordAuthentication(String host, InetAddress addr, int port,
}
/**
+ * Returns the hostname of the host or proxy requesting authorization,
+ * or null if not available.
+ *
* @since 1.4
*/
protected final String getRequestingHost()
diff --git a/libjava/java/net/BindException.java b/libjava/java/net/BindException.java
index 3d11c4a4b04..cfc36b312f6 100644
--- a/libjava/java/net/BindException.java
+++ b/libjava/java/net/BindException.java
@@ -43,6 +43,7 @@ package java.net;
*
* @author Aaron M. Renn <arenn@urbanophile.com>
* @author Warren Levy <warrenl@cygnus.com>
+ * @since 1.1
* @status updated to 1.4
*/
public class BindException extends SocketException
diff --git a/libjava/java/net/DatagramPacket.java b/libjava/java/net/DatagramPacket.java
index a2482f9237f..7ca6c51a22b 100644
--- a/libjava/java/net/DatagramPacket.java
+++ b/libjava/java/net/DatagramPacket.java
@@ -44,67 +44,66 @@ package java.net;
*/
/**
- * This class models a packet of data that is to be sent across the network
- * using a connectionless protocol such as UDP. It contains the data
- * to be send, as well as the destination address and port. Note that
- * datagram packets can arrive in any order and are not guaranteed to be
- * delivered at all.
- * <p>
- * This class can also be used for receiving data from the network.
- * <p>
- * Note that for all method below where the buffer length passed by the
- * caller cannot exceed the actually length of the byte array passed as
- * the buffer, if this condition is not true, then the method silently
- * reduces the length value to maximum allowable value.
- *
- * Written using on-line Java Platform 1.2 API Specification, as well
- * as "The Java Class Libraries", 2nd edition (Addison-Wesley, 1998).
- * Status: Believed complete and correct.
- *
- * @author Warren Levy <warrenl@cygnus.com>
- * @author Aarom M. Renn (arenn@urbanophile.com) (Documentation comments)
- * @date April 28, 1999.
- */
-
+ * This class models a packet of data that is to be sent across the network
+ * using a connectionless protocol such as UDP. It contains the data
+ * to be send, as well as the destination address and port. Note that
+ * datagram packets can arrive in any order and are not guaranteed to be
+ * delivered at all.
+ * <p>
+ * This class can also be used for receiving data from the network.
+ * <p>
+ * Note that for all method below where the buffer length passed by the
+ * caller cannot exceed the actually length of the byte array passed as
+ * the buffer, if this condition is not true, then the method silently
+ * reduces the length value to maximum allowable value.
+ *
+ * Written using on-line Java Platform 1.2 API Specification, as well
+ * as "The Java Class Libraries", 2nd edition (Addison-Wesley, 1998).
+ * Status: Believed complete and correct.
+ *
+ * @author Warren Levy <warrenl@cygnus.com>
+ * @author Aarom M. Renn (arenn@urbanophile.com) (Documentation comments)
+ * @date April 28, 1999.
+ */
public final class DatagramPacket
{
-/**
- * The data buffer to send
- */
+ /**
+ * The data buffer to send
+ */
private byte[] buffer;
-/**
- * This is the offset into the buffer to start sending from or receiving to.
- */
+ /**
+ * This is the offset into the buffer to start sending from or receiving to.
+ */
private int offset;
-/**
- * The length of the data buffer to send
- */
+ /**
+ * The length of the data buffer to send
+ */
private int length;
-/**
- * The address to which the packet should be sent or from which it
- * was received
- */
+ /**
+ * The address to which the packet should be sent or from which it
+ * was received
+ */
private InetAddress address;
-/**
- * The port to which the packet should be sent or from which it was
- * was received.
- */
+ /**
+ * The port to which the packet should be sent or from which it was
+ * was received.
+ */
private int port;
-/**
- * This method initializes a new instance of <code>DatagramPacket</code>
- * which has the specified buffer, offset, and length.
- *
- * @param buf The buffer for holding the incoming datagram.
- * @param offset The offset into the buffer to start writing.
- * @param length The maximum number of bytes to read.
- *
- * @since Java 1.2
- */
+ /**
+ * This method initializes a new instance of <code>DatagramPacket</code>
+ * which has the specified buffer, offset, and length.
+ *
+ * @param buf The buffer for holding the incoming datagram.
+ * @param offset The offset into the buffer to start writing.
+ * @param length The maximum number of bytes to read.
+ *
+ * @since 1.2
+ */
public DatagramPacket(byte[] buf, int offset, int length)
{
if (buf == null)
@@ -124,30 +123,30 @@ public final class DatagramPacket
this.port = -1;
}
-/**
- * Initializes a new instance of <code>DatagramPacket</code> for
- * receiving packets from the network.
- *
- * @param buf A buffer for storing the returned packet data
- * @param length The length of the buffer (must be <= buf.length)
- */
+ /**
+ * Initializes a new instance of <code>DatagramPacket</code> for
+ * receiving packets from the network.
+ *
+ * @param buf A buffer for storing the returned packet data
+ * @param length The length of the buffer (must be <= buf.length)
+ */
public DatagramPacket(byte[] buf, int length)
{
this(buf, 0, length);
}
-/**
- * Initializes a new instance of <code>DatagramPacket</code> for
- * transmitting packets across the network.
- *
- * @param buf A buffer containing the data to send
- * @param offset The offset into the buffer to start writing from.
- * @param len The length of the buffer (must be <= buf.length)
- * @param addr The address to send to
- * @param port The port to send to
- *
- * @since Java 1.2
- */
+ /**
+ * Initializes a new instance of <code>DatagramPacket</code> for
+ * transmitting packets across the network.
+ *
+ * @param buf A buffer containing the data to send
+ * @param offset The offset into the buffer to start writing from.
+ * @param len The length of the buffer (must be <= buf.length)
+ * @param addr The address to send to
+ * @param port The port to send to
+ *
+ * @since 1.2
+ */
public DatagramPacket(byte[] buf, int offset, int length,
InetAddress address, int port)
{
@@ -172,86 +171,130 @@ public final class DatagramPacket
this.port = port;
}
-/**
- * Initializes a new instance of <code>DatagramPacket</code> for
- * transmitting packets across the network.
- *
- * @param buf A buffer containing the data to send
- * @param length The length of the buffer (must be <= buf.length)
- * @param address The address to send to
- * @param port The port to send to
- */
+ /**
+ * Initializes a new instance of <code>DatagramPacket</code> for
+ * transmitting packets across the network.
+ *
+ * @param buf A buffer containing the data to send
+ * @param length The length of the buffer (must be <= buf.length)
+ * @param address The address to send to
+ * @param port The port to send to
+ */
public DatagramPacket(byte[] buf, int length, InetAddress address, int port)
{
this(buf, 0, length, address, port);
}
-/**
- * Returns the address that this packet is being sent to or, if it was used
- * to receive a packet, the address that is was received from. If the
- * constructor that doesn not take an address was used to create this object
- * and no packet was actually read into this object, then this method
- * returns <code>null</code>.
- *
- * @return The address for this packet.
- */
+ /**
+ * Initializes a new instance of <code>DatagramPacket</code> for
+ * transmitting packets across the network.
+ *
+ * @param buf A buffer containing the data to send
+ * @param offset The offset into the buffer to start writing from.
+ * @param length The length of the buffer (must be <= buf.length)
+ * @param address The socket address to send to
+ *
+ * @exception SocketException If an error occurs
+ * @exception IllegalArgumentException If address type is not supported
+ *
+ * @since 1.4
+ */
+ public DatagramPacket(byte[] buf, int offset, int length,
+ SocketAddress address)
+ throws SocketException
+ {
+ this(buf, offset, length, ((InetSocketAddress)address).getAddress(),
+ ((InetSocketAddress)address).getPort());
+ }
+
+ /**
+ * Initializes a new instance of <code>DatagramPacket</code> for
+ * transmitting packets across the network.
+ *
+ * @param buf A buffer containing the data to send
+ * @param length The length of the buffer (must be <= buf.length)
+ * @param address The socket address to send to
+ *
+ * @exception SocketException If an error occurs
+ * @exception IllegalArgumentException If address type is not supported
+ *
+ * @since 1.4
+ */
+ public DatagramPacket(byte[] buf, int length, SocketAddress address)
+ throws SocketException
+ {
+ this(buf, 0, length, ((InetSocketAddress)address).getAddress(),
+ ((InetSocketAddress)address).getPort());
+ }
+
+ /**
+ * Returns the address that this packet is being sent to or, if it was used
+ * to receive a packet, the address that is was received from. If the
+ * constructor that doesn not take an address was used to create this object
+ * and no packet was actually read into this object, then this method
+ * returns <code>null</code>.
+ *
+ * @return The address for this packet.
+ */
public synchronized InetAddress getAddress()
{
return address;
}
-/**
- * Returns the port number this packet is being sent to or, if it was used
- * to receive a packet, the port that it was received from. If the
- * constructor that doesn not take an address was used to create this object
- * and no packet was actually read into this object, then this method
- * will return 0.
- *
- * @return The port number for this packet
- */
+ /**
+ * Returns the port number this packet is being sent to or, if it was used
+ * to receive a packet, the port that it was received from. If the
+ * constructor that doesn not take an address was used to create this object
+ * and no packet was actually read into this object, then this method
+ * will return 0.
+ *
+ * @return The port number for this packet
+ */
public synchronized int getPort()
{
return port;
}
-/**
- * Returns the data buffer for this packet
- *
- * @return This packet's data buffer
- */
+ /**
+ * Returns the data buffer for this packet
+ *
+ * @return This packet's data buffer
+ */
public synchronized byte[] getData()
{
return buffer;
}
-/**
- * This method returns the current offset value into the data buffer
- * where data will be sent from.
- *
- * @return The buffer offset.
- *
- * @since Java 1.2
- */
+ /**
+ * This method returns the current offset value into the data buffer
+ * where data will be sent from.
+ *
+ * @return The buffer offset.
+ *
+ * @since 1.2
+ */
public synchronized int getOffset()
{
return offset;
}
-/**
- * Returns the length of the data in the buffer
- *
- * @return The length of the data
- */
+ /**
+ * Returns the length of the data in the buffer
+ *
+ * @return The length of the data
+ */
public synchronized int getLength()
{
return length;
}
-/**
- * This sets the address to which the data packet will be transmitted.
- *
- * @param addr The destination address
- */
+ /**
+ * This sets the address to which the data packet will be transmitted.
+ *
+ * @param addr The destination address
+ *
+ * @since 1.1
+ */
public synchronized void setAddress(InetAddress iaddr)
{
if (iaddr == null)
@@ -260,11 +303,13 @@ public final class DatagramPacket
address = iaddr;
}
-/**
- * This sets the port to which the data packet will be transmitted.
- *
- * @param port The destination port
- */
+ /**
+ * This sets the port to which the data packet will be transmitted.
+ *
+ * @param port The destination port
+ *
+ * @since 1.1
+ */
public synchronized void setPort(int iport)
{
if (iport < 0 || iport > 65535)
@@ -273,11 +318,47 @@ public final class DatagramPacket
port = iport;
}
-/**
- * Sets the data buffer for this packet.
- *
- * @param buf The new buffer for this packet
- */
+ /**
+ * Sets the address of the remote host this package will be sent
+ *
+ * @param address The socket address of the remove host
+ *
+ * @exception IllegalArgumentException If address type is not supported
+ *
+ * @since 1.4
+ */
+ public void setSocketAddress(SocketAddress address)
+ throws IllegalArgumentException
+ {
+ if (address == null) throw new IllegalArgumentException();
+
+ InetSocketAddress tmp = (InetSocketAddress)address;
+ this.address = tmp.getAddress();
+ this.port = tmp.getPort();
+ }
+
+ /**
+ * Gets the socket address of the host this packet
+ * will be sent to/is coming from
+ *
+ * @return The socket address of the remote host
+ *
+ * @since 1.4
+ */
+ public SocketAddress getSocketAddress()
+ {
+ return new InetSocketAddress (address, port);
+ }
+
+ /**
+ * Sets the data buffer for this packet.
+ *
+ * @param buf The new buffer for this packet
+ *
+ * @exception NullPointerException If the argument is null
+ *
+ * @since 1.1
+ */
public synchronized void setData(byte[] buf)
{
// This form of setData requires setLength to be called separately
@@ -288,15 +369,17 @@ public final class DatagramPacket
buffer = buf;
}
-/**
- * This method sets the data buffer for the packet.
- *
- * @param buf The byte array containing the data for this packet.
- * @param offset The offset into the buffer to start reading data from.
- * @param length The number of bytes of data in the buffer.
- *
- * @since Java 1.2
- */
+ /**
+ * This method sets the data buffer for the packet.
+ *
+ * @param buf The byte array containing the data for this packet.
+ * @param offset The offset into the buffer to start reading data from.
+ * @param length The number of bytes of data in the buffer.
+ *
+ * @exception NullPointerException If the argument is null
+ *
+ * @since 1.2
+ */
public synchronized void setData(byte[] buf, int offset, int length)
{
// This form of setData must be used if offset is to be changed.
@@ -316,11 +399,16 @@ public final class DatagramPacket
this.length = length;
}
-/**
- * Sets the length of the data in the buffer.
- *
- * @param length The new length. (Where len <= buf.length)
- */
+ /**
+ * Sets the length of the data in the buffer.
+ *
+ * @param length The new length. (Where len &lt;= buf.length)
+ *
+ * @exception IllegalArgumentException If the length is negative or
+ * if the length is greater than the packet's data buffer length
+ *
+ * @since 1.1
+ */
public synchronized void setLength(int length)
{
if (length < 0)
diff --git a/libjava/java/net/DatagramSocket.java b/libjava/java/net/DatagramSocket.java
index 064e8e78983..b2f2ca11ce3 100644
--- a/libjava/java/net/DatagramSocket.java
+++ b/libjava/java/net/DatagramSocket.java
@@ -1,6 +1,6 @@
// DatagramSocket.java
-/* Copyright (C) 1999, 2000 Free Software Foundation
+/* Copyright (C) 1999, 2000, 2002 Free Software Foundation
This file is part of libgcj.
@@ -9,7 +9,10 @@ Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
details. */
package java.net;
+
import java.io.IOException;
+import java.nio.channels.DatagramChannel;
+import java.nio.channels.IllegalBlockingModeException;
/**
* @author Warren Levy <warrenl@cygnus.com>
@@ -24,18 +27,87 @@ import java.io.IOException;
public class DatagramSocket
{
+ /**
+ * This is the user DatagramSocketImplFactory for this class. If this
+ * variable is null, a default factory is used.
+ */
+ static DatagramSocketImplFactory factory;
+
DatagramSocketImpl impl;
+ DatagramChannel ch;
+
+ private InetAddress remoteAddress;
+ private int remotePort;
+
+ /**
+ * Creates a DatagramSocket
+ *
+ * @exception SocketException If an error occurs
+ * @exception SecurityException If a security manager exists and
+ * its checkListen method doesn't allow the operation
+ */
public DatagramSocket() throws SocketException
{
this(0, null);
}
+ /**
+ * Creates a DatagramSocket from a specified DatagramSocketImpl instance
+ *
+ * @param impl The DatagramSocketImpl the socket will be created from
+ *
+ * @since 1.4
+ */
+ protected DatagramSocket (DatagramSocketImpl impl)
+ {
+ this.impl = impl;
+ this.remoteAddress = null;
+ this.remotePort = -1;
+ }
+
+ /**
+ * Creates a datagram socket that is bound to a given socket address
+ *
+ * @param bindaddr The socket address to bind to
+ *
+ * @exception SocketException If an error occurs
+ * @exception SecurityException If a security manager exists and
+ * its checkListen method doesn't allow the operation
+ *
+ * @since 1.4
+ */
+ public DatagramSocket (SocketAddress bindaddr)
+ throws SocketException
+ {
+ this (((InetSocketAddress) bindaddr).getPort (),
+ ((InetSocketAddress) bindaddr).getAddress ());
+ }
+
+ /**
+ * Creates a datagram socket that is bound to a specific port
+ *
+ * @param port The port number to bind to
+ *
+ * @exception SocketException If an error occurs
+ * @exception SecurityException If a security manager exists and
+ * its checkListen method doesn't allow the operation
+ */
public DatagramSocket(int port) throws SocketException
{
this(port, null);
}
+ /**
+ * Creates a datagram socket that is bound to a specific port/inet address
+ *
+ * @param port The port number to bind to
+ * @param laddr The local address to bind to
+ *
+ * @exception SocketException If an error occurs
+ * @exception SecurityException If a security manager exists and
+ * its checkListen method doesn't allow the operation
+ */
public DatagramSocket(int port, InetAddress laddr) throws SocketException
{
if (port < 0 || port > 65535)
@@ -67,16 +139,75 @@ public class DatagramSocket
impl.setOption(SocketOptions.SO_REUSEADDR, new Boolean(true));
impl.bind(port, laddr == null ? InetAddress.ANY_IF : laddr);
+
+ remoteAddress = null;
+ remotePort = -1;
}
+ /**
+ * Binds the socket to the given socket addres
+ *
+ * @param address The socket address to bind to
+ *
+ * @exception SocketException If an error occurs
+ * @exception SecurityException If a security manager exists and
+ * its checkListen method doesn't allow the operation
+ * @exception IllegalArgumentException If address type is not supported
+ *
+ * @since 1.4
+ */
+ public void bind (SocketAddress address)
+ throws SocketException
+ {
+ if (! (address instanceof InetSocketAddress))
+ throw new IllegalArgumentException ();
+
+ InetSocketAddress tmp = (InetSocketAddress) address;
+
+ SecurityManager s = System.getSecurityManager ();
+ if (s != null)
+ s.checkListen(tmp.getPort ());
+
+ impl.bind (tmp.getPort (), tmp.getAddress ());
+ }
+
+ /**
+ * Closes the datagram socket
+ */
public void close()
{
impl.close();
+ remoteAddress = null;
+ remotePort = -1;
}
+ /**
+ * Checks if the datagram socket is closed
+ *
+ * @since 1.4
+ */
+ public boolean isClosed()
+ {
+ return !impl.getFileDescriptor().valid();
+ }
+
+ /**
+ * Gets a datagram channel assoziated with the socket
+ *
+ * @since 1.4
+ */
+ public DatagramChannel getChannel()
+ {
+ return ch;
+ }
+
+ /**
+ * Returns the local address of the datagram socket
+ *
+ * @since 1.1
+ */
public InetAddress getLocalAddress()
{
- SecurityManager s = System.getSecurityManager();
// FIXME: JCL p. 510 says this should call checkConnect. But what
// string should be used as the hostname? Maybe this is just a side
// effect of calling InetAddress.getLocalHost.
@@ -112,13 +243,33 @@ public class DatagramSocket
}
}
+ /**
+ * Returns the local port this socket uses
+ *
+ * @return The local port number
+ */
public int getLocalPort()
{
+ if (!isBound ())
+ return -1;
+
return impl.getLocalPort();
}
+ /**
+ * Gets the SO_TIMEOUT value
+ *
+ * @return The current timeout in milliseconds
+ *
+ * @exception SocketException If an error occurs
+ *
+ * @since 1.1
+ */
public synchronized int getSoTimeout() throws SocketException
{
+ if (impl == null)
+ throw new SocketException ("Cannot initialize Socket implementation");
+
Object timeout = impl.getOption(SocketOptions.SO_TIMEOUT);
if (timeout instanceof Integer)
return ((Integer)timeout).intValue();
@@ -126,32 +277,94 @@ public class DatagramSocket
return 0;
}
+ /**
+ * Receive a datagram packet
+ *
+ * @param p The datagram packet to put the incoming data into
+ *
+ * @exception IOException If an error occurs
+ * @exception SocketTimeoutException If setSoTimeout was previously called
+ * and the timeout has expired
+ * @exception PortUnreachableException If the socket is connected to a
+ * currently unreachable destination. Note, there is no guarantee that the
+ * exception will be thrown
+ * @exception IllegalBlockingModeException If this socket has an associated
+ * channel, and the channel is in non-blocking mode
+ * @exception SecurityException If a security manager exists and its
+ * checkAccept ethod doesn't allow the receive
+ */
public synchronized void receive(DatagramPacket p) throws IOException
{
- SecurityManager s = System.getSecurityManager();
- if (s != null)
- s.checkAccept(p.getAddress().getHostAddress(), p.getPort());
+ if (impl == null)
+ throw new IOException ("Cannot initialize Socket implementation");
+
+ if (remoteAddress != null && remoteAddress.isMulticastAddress ())
+ throw new IOException (
+ "Socket connected to a multicast address my not receive");
+
+ if (ch != null && !ch.isBlocking ())
+ throw new IllegalBlockingModeException ();
impl.receive(p);
+
+ SecurityManager s = System.getSecurityManager();
+ if (s != null && isConnected ())
+ s.checkAccept (p.getAddress().getHostName (), p.getPort ());
}
+ /**
+ * Sends a datagram packet
+ *
+ * @param p The datagram packet to send
+ *
+ * @exception IOException If an error occurs
+ * @exception SecurityException If a security manager exists and its
+ * checkMulticast or checkConnect method doesn't allow the send
+ * @exception PortUnreachableException If the socket is connected to a
+ * currently unreachable destination. Note, there is no guarantee that the
+ * exception will be thrown
+ * @exception IllegalBlockingModeException If this socket has an associated
+ * channel, and the channel is in non-blocking mode
+ */
public void send(DatagramPacket p) throws IOException
{
// JDK1.2: Don't do security checks if socket is connected; see jdk1.2 api.
SecurityManager s = System.getSecurityManager();
- if (s != null)
+ if (s != null && !isConnected ())
+ {
+ InetAddress addr = p.getAddress();
+ if (addr.isMulticastAddress())
+ s.checkMulticast(addr);
+ else
+ s.checkConnect(addr.getHostAddress(), p.getPort());
+ }
+
+ if (isConnected ())
{
- InetAddress addr = p.getAddress();
- if (addr.isMulticastAddress())
- s.checkMulticast(addr);
- else
- s.checkConnect(addr.getHostAddress(), p.getPort());
+ if (p.getAddress () != null && (remoteAddress != p.getAddress () ||
+ remotePort != p.getPort ()))
+ throw new IllegalArgumentException (
+ "DatagramPacket address does not match remote address" );
}
+
+ // FIXME: if this is a subclass of MulticastSocket,
+ // use getTimeToLive for TTL val.
+
+ if (ch != null && !ch.isBlocking ())
+ throw new IllegalBlockingModeException ();
- // FIXME: if this is a subclass of MulticastSocket, use getTTL for TTL val.
impl.send(p);
}
+ /**
+ * Sets a new value for SO_TIMEOUT
+ *
+ * @param timeout The timeout in milliseconds
+ *
+ * @exception SocketException If an error occurs
+ *
+ * @since 1.1
+ */
public synchronized void setSoTimeout(int timeout) throws SocketException
{
if (timeout < 0)
@@ -160,25 +373,160 @@ public class DatagramSocket
impl.setOption(SocketOptions.SO_TIMEOUT, new Integer(timeout));
}
- // JDK1.2
- // public void connect(InetAddress address, int port)
- // {
- // }
+ /**
+ * Connects the datagrem socket to a specified address/port
+ *
+ * @param address The address to connect to
+ * @param port The port to connect to
+ *
+ * @exception SocketException If an error occurs
+ * @exception IllegalArgumentException If address is null
+ * or the port number is illegal
+ * @exception SecurityException If the caller is not allowed to send
+ * datagrams to and receive datagrams from the address and port
+ *
+ * @since 1.2
+ */
+ public void connect(InetAddress address, int port)
+ throws SocketException
+ {
+ if (address == null)
+ throw new IllegalArgumentException ("Address may not be null");
+
+ if (port < 1 || port > 65535)
+ throw new IllegalArgumentException ("Port number is illegal");
+
+ SecurityManager s = System.getSecurityManager();
+ if (s != null)
+ s.checkAccept(address.getHostName (), port);
+
+ impl.connect (address, port);
+
+ remoteAddress = address;
+ remotePort = port;
+ }
+
+ /**
+ * Connects the datagram socket to a specified socket address.
+ *
+ * @param address The socket address to connect to
+ *
+ * @exception SocketException If an error occurs
+ * @exception IllegalArgumentException If address type is not supported
+ *
+ * @since 1.4
+ */
+ public void connect (SocketAddress address) throws SocketException
+ {
+ if ( !(address instanceof InetSocketAddress) )
+ throw new IllegalArgumentException (
+ "SocketAddress is not InetSocketAddress");
+
+ InetSocketAddress tmp = (InetSocketAddress) address;
+ connect( tmp.getAddress(), tmp.getPort());
+ }
+
+ /**
+ * Disconnects the datagram socket
+ *
+ * @since 1.2
+ */
+ public void disconnect()
+ {
+ impl.disconnect();
+ }
+
+ /**
+ * Returns the binding state of the socket
+ *
+ * @since 1.4
+ */
+ public boolean isBound()
+ {
+ try
+ {
+ Object bindaddr = impl.getOption (SocketOptions.SO_BINDADDR);
+ }
+ catch (SocketException e)
+ {
+ return false;
+ }
- // JDK1.2
- // public void disconnect()
- // {
- // }
+ return true;
+ }
- // JDK1.2
- // public InetAddress getInetAddress()
- // {
- // }
+ /**
+ * Returns the connection state of the socket
+ *
+ * @since 1.4
+ */
+ public boolean isConnected()
+ {
+ return remoteAddress != null;
+ }
+
+ /**
+ * Returns the InetAddress the socket is connected to
+ * or null if the socket is not connected
+ *
+ * @since 1.2
+ */
+ public InetAddress getInetAddress()
+ {
+ if (!isConnected ())
+ return null;
- // JDK1.2
- // public int getPort()
- // {
- // }
+ return remoteAddress;
+ }
+
+ /**
+ * Returns the port number the socket is connected to or -1 if not connected
+ *
+ * @since 1.2
+ */
+ public int getPort()
+ {
+ if (!isConnected ())
+ return -1;
+
+ return remotePort;
+ }
+
+ /**
+ * Returns the SocketAddress of the host this socket is conneted to
+ * or null if this socket is not connected
+ *
+ * @since 1.4
+ */
+ public SocketAddress getRemoteSocketAddress()
+ {
+ if (!isConnected ())
+ return null;
+
+ return new InetSocketAddress (remoteAddress, remotePort);
+ }
+
+ /**
+ * Returns the local SocketAddress this socket is bound to
+ * or null if it is not bound
+ *
+ * @since 1.4
+ */
+ public SocketAddress getLocalSocketAddress()
+ {
+ InetAddress addr;
+
+ try
+ {
+ addr = (InetAddress) impl.getOption (SocketOptions.SO_BINDADDR);
+ }
+ catch (SocketException e)
+ {
+ return null;
+ }
+
+ return new InetSocketAddress (addr, impl.localPort);
+ }
/**
* This method returns the value of the system level socket option
@@ -193,6 +541,9 @@ public class DatagramSocket
*/
public int getReceiveBufferSize() throws SocketException
{
+ if (impl == null)
+ throw new SocketException ("Cannot initialize Socket implementation");
+
Object obj = impl.getOption(SocketOptions.SO_RCVBUF);
if (obj instanceof Integer)
@@ -202,6 +553,126 @@ public class DatagramSocket
}
/**
+ * Enables/Disables SO_REUSEADDR
+ *
+ * @param on Whether or not to have SO_REUSEADDR turned on
+ *
+ * @exception SocketException If an error occurs
+ *
+ * @since 1.4
+ */
+ public void setReuseAddress(boolean on) throws SocketException
+ {
+ if (impl == null)
+ throw new SocketException ("Cannot initialize Socket implementation");
+
+ impl.setOption (SocketOptions.SO_REUSEADDR, new Boolean (on));
+ }
+
+ /**
+ * Checks if SO_REUSEADDR is enabled
+ *
+ * @exception SocketException If an error occurs
+ *
+ * @since 1.4
+ */
+ public boolean getReuseAddress() throws SocketException
+ {
+ if (impl == null)
+ throw new SocketException ("Cannot initialize Socket implementation");
+
+ Object obj = impl.getOption (SocketOptions.SO_REUSEADDR);
+
+ if (obj instanceof Boolean)
+ return(((Boolean) obj).booleanValue ());
+ else
+ throw new SocketException ("Unexpected type");
+ }
+
+ /**
+ * Enables/Disables SO_BROADCAST
+ *
+ * @param on Whether or not to have SO_BROADCAST turned on
+ *
+ * @exception SocketException If an error occurs
+ *
+ * @since 1.4
+ */
+ public void setBroadcast(boolean on) throws SocketException
+ {
+ if (impl == null)
+ throw new SocketException ("Cannot initialize Socket implementation");
+
+ impl.setOption (SocketOptions.SO_BROADCAST, new Boolean (on));
+ }
+
+ /**
+ * Checks if SO_BROADCAST is enabled
+ *
+ * @exception SocketException If an error occurs
+ *
+ * @since 1.4
+ */
+ public boolean getBroadcast() throws SocketException
+ {
+ if (impl == null)
+ throw new SocketException ("Cannot initialize Socket implementation");
+
+ Object obj = impl.getOption (SocketOptions.SO_BROADCAST);
+
+ if (obj instanceof Boolean)
+ return ((Boolean) obj).booleanValue ();
+ else
+ throw new SocketException ("Unexpected type");
+ }
+
+ /**
+ * Sets the traffic class value
+ *
+ * @param tc The traffic class
+ *
+ * @exception SocketException If an error occurs
+ * @exception IllegalArgumentException If tc value is illegal
+ *
+ * @see DatagramSocket:getTrafficClass
+ *
+ * @since 1.4
+ */
+ public void setTrafficClass(int tc)
+ throws SocketException
+ {
+ if (impl == null)
+ throw new SocketException ("Cannot initialize Socket implementation");
+
+ if (tc < 0 || tc > 255)
+ throw new IllegalArgumentException();
+
+ impl.setOption (SocketOptions.IP_TOS, new Integer (tc));
+ }
+
+ /**
+ * Returns the current traffic class
+ *
+ * @see DatagramSocket:setTrafficClass
+ *
+ * @exception SocketException If an error occurs
+ *
+ * @since 1.4
+ */
+ public int getTrafficClass() throws SocketException
+ {
+ if (impl == null)
+ throw new SocketException( "Cannot initialize Socket implementation");
+
+ Object obj = impl.getOption(SocketOptions.IP_TOS);
+
+ if (obj instanceof Integer)
+ return ((Integer) obj).intValue ();
+ else
+ throw new SocketException ("Unexpected type");
+ }
+
+ /**
* This method returns the value of the system level socket option
* SO_SNDBUF, which is used by the operating system to tune buffer
* sizes for data transfers.
@@ -214,6 +685,9 @@ public class DatagramSocket
*/
public int getSendBufferSize() throws SocketException
{
+ if (impl == null)
+ throw new SocketException ("Cannot initialize Socket implementation");
+
Object obj = impl.getOption(SocketOptions.SO_SNDBUF);
if (obj instanceof Integer)
@@ -230,11 +704,15 @@ public class DatagramSocket
* @param size The new receive buffer size.
*
* @exception SocketException If an error occurs.
+ * @exception IllegalArgumentException If size is 0 or negative
*
* @since 1.2
*/
public void setReceiveBufferSize(int size) throws SocketException
{
+ if (impl == null)
+ throw new SocketException ("Cannot initialize Socket implementation");
+
if (size < 0)
throw new IllegalArgumentException("Buffer size is less than 0");
@@ -249,6 +727,7 @@ public class DatagramSocket
* @param size The new send buffer size.
*
* @exception SocketException If an error occurs.
+ * @exception IllegalArgumentException If size is 0 or negative
*
* @since 1.2
*/
@@ -259,4 +738,27 @@ public class DatagramSocket
impl.setOption(SocketOptions.SO_SNDBUF, new Integer(size));
}
+
+ /**
+ * Sets the datagram socket implementation factory for the application
+ *
+ * @param fac The factory to set
+ *
+ * @exception IOException If an error occurs
+ * @exception SocketException If the factory is already defined
+ * @exception SecurityException If a security manager exists and its
+ * checkSetFactory method doesn't allow the operation
+ */
+ public static void setDatagramSocketImplFactory
+ (DatagramSocketImplFactory fac) throws IOException
+ {
+ if (factory != null)
+ throw new SocketException ("DatagramSocketImplFactory already defined");
+
+ SecurityManager sm = System.getSecurityManager();
+ if (sm != null)
+ sm.checkSetFactory();
+
+ factory = fac;
+ }
}
diff --git a/libjava/java/net/DatagramSocketImpl.java b/libjava/java/net/DatagramSocketImpl.java
index e929e5006ff..5a0aa3e4acd 100644
--- a/libjava/java/net/DatagramSocketImpl.java
+++ b/libjava/java/net/DatagramSocketImpl.java
@@ -53,6 +53,7 @@ import java.io.FileDescriptor;
*
* @author Aaron M. Renn (arenn@urbanophile.com)
* @author Warren Levy <warrenl@cygnus.com>
+ * @since 1.1
*/
public abstract class DatagramSocketImpl implements SocketOptions
{
@@ -107,16 +108,39 @@ public abstract class DatagramSocketImpl implements SocketOptions
* @return The port number of the sender of the packet
*
* @exception IOException If an error occurs
+ * @exception PortUnreachableException May be thrown if the socket is
+ * connected to a currently unreachable destination. Note, there is no
+ * guarantee that the exception will be thrown.
*/
protected abstract int peek(InetAddress i) throws IOException;
/**
+ * Takes a peek at the next packet received. This packet is not consumed.
+ * With the next peekData/receive operation this packet will be read again.
+ *
+ * @param p The DatagramPacket to fill in with the data sent.
+ *
+ * @return The port number of the sender of the packet.
+ *
+ * @exception IOException If an error occurs
+ * @exception PortUnreachableException May be thrown if the socket is
+ * connected to a currently unreachable destination. Note, there is no
+ * guarantee that the exception will be thrown.
+ *
+ * @since 1.4
+ */
+ protected abstract int peekData (DatagramPacket p) throws IOException;
+
+ /**
* Transmits the specified packet of data to the network. The destination
* host and port should be encoded in the packet.
*
* @param p The packet to send
*
* @exception IOException If an error occurs
+ * @exception PortUnreachableException May be thrown if the socket is
+ * connected to a currently unreachable destination. Note, there is no
+ * guarantee that the exception will be thrown.
*/
protected abstract void send(DatagramPacket p) throws IOException;
@@ -128,10 +152,38 @@ public abstract class DatagramSocketImpl implements SocketOptions
* @param p A place to store the incoming packet.
*
* @exception IOException If an error occurs
+ * @exception PortUnreachableException May be thrown if the socket is
+ * connected to a currently unreachable destination. Note, there is no
+ * guarantee that the exception will be thrown.
*/
protected abstract void receive(DatagramPacket p) throws IOException;
/**
+ * Connects the socket to a host specified by address and port.
+ *
+ * @param address The InetAddress of the host to connect to
+ * @param port The port number of the host to connect to
+ *
+ * @exception SocketException If an error occurs
+ *
+ * @since 1.4
+ */
+ protected void connect (InetAddress address, int port) throws SocketException
+ {
+ // This method has to be overwritten by real implementations
+ }
+
+ /**
+ * Disconnects the socket.
+ *
+ * @since 1.4
+ */
+ protected void disconnect ()
+ {
+ // This method has to be overwritten by real implementations
+ }
+
+ /**
* Sets the Time to Live (TTL) setting on this socket to the specified
* value. <b>Use <code>setTimeToLive(int)</code></b> instead.
*
@@ -188,6 +240,35 @@ public abstract class DatagramSocketImpl implements SocketOptions
protected abstract void leave(InetAddress inetaddr) throws IOException;
/**
+ * Causes this socket to join the specified multicast group on a specified
+ * device
+ *
+ * @param mcastaddr The address to leave
+ * @param netIf The specified network interface to join the group at
+ *
+ * @exception IOException If an error occurs
+ *
+ * @since 1.4
+ */
+ protected abstract void joinGroup (SocketAddress mcastaddr,
+ NetworkInterface netIf)
+ throws IOException;
+
+ /**
+ * Leaves a multicast group
+ *
+ * @param mcastaddr The address to join
+ * @param netIf The specified network interface to leave the group at
+ *
+ * @exception IOException If an error occurs
+ *
+ * @since 1.4
+ */
+ protected abstract void leaveGroup (SocketAddress mcastaddr,
+ NetworkInterface netIf)
+ throws IOException;
+
+ /**
* Returns the FileDescriptor for this socket
*/
protected FileDescriptor getFileDescriptor()
@@ -207,7 +288,7 @@ public abstract class DatagramSocketImpl implements SocketOptions
* Sets the specified option on a socket to the passed in object. For
* options that take an integer argument, the passed in object is an
* <code>Integer</code>. For options that are set to on or off, the
- * value passed will be a <code>Boolean</code>. The <code>option_id</code>
+ * value passed will be a <code>Boolean</code>. The <code>option_id</code>
* parameter is one of the defined constants in the superinterface.
*
* @param option_id The identifier of the option
@@ -220,9 +301,9 @@ public abstract class DatagramSocketImpl implements SocketOptions
throws SocketException;
/**
- * Returns the current setting of the specified option. The
- * <code>Object</code> returned will be an <code>Integer</code> for options
- * that have integer values. For options that are set to on or off, a
+ * Returns the current setting of the specified option. The
+ * <code>Object</code> returned will be an <code>Integer</code> for options
+ * that have integer values. For options that are set to on or off, a
* <code>Boolean</code> will be returned. The <code>option_id</code>
* is one of the defined constants in the superinterface.
*
diff --git a/libjava/java/net/DatagramSocketImplFactory.java b/libjava/java/net/DatagramSocketImplFactory.java
new file mode 100644
index 00000000000..60fe838458b
--- /dev/null
+++ b/libjava/java/net/DatagramSocketImplFactory.java
@@ -0,0 +1,59 @@
+/* DatagramSocketImplFactory.java
+ Copyright (C) 2002 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 java.net;
+
+/** Written using on-line Java Platform 1.4 API Specification.
+ * Status: Believed complete and correct.
+ */
+
+/**
+ * This interface defines one method which returns a DatagramSocketImpl object.
+ * This should not be needed by ordinary applications.
+ *
+ * @author Michael Koch <konqueror@gmx.de>
+ * @since 1.3
+ */
+public interface DatagramSocketImplFactory
+{
+ /**
+ * This method returns an instance of the DatagramSocketImpl object
+ *
+ * @return A DatagramSocketImpl object
+ */
+ DatagramSocketImpl createDatagramSocketImpl();
+} // interface DatagramSocketImplFactory
diff --git a/libjava/java/net/FileNameMap.java b/libjava/java/net/FileNameMap.java
index e29c81265fa..538dbe8e19a 100644
--- a/libjava/java/net/FileNameMap.java
+++ b/libjava/java/net/FileNameMap.java
@@ -50,6 +50,7 @@ package java.net;
*
* @author Aaron M. Renn (arenn@urbanophile.com)
* @author Warren Levy <warrenl@cygnus.com>
+ * @since 1.1
*/
public interface FileNameMap
{
diff --git a/libjava/java/net/HttpURLConnection.java b/libjava/java/net/HttpURLConnection.java
index 84e9468dfc2..e914b190203 100644
--- a/libjava/java/net/HttpURLConnection.java
+++ b/libjava/java/net/HttpURLConnection.java
@@ -1,92 +1,354 @@
// HttpURLConnection.java - Subclass of communications links using
// Hypertext Transfer Protocol.
-/* Copyright (C) 1999, 2000 Free Software Foundation
+/* Copyright (C) 1998, 1999, 2000, 2002 Free Software Foundation
- This file is part of libgcj.
+This file is part of GNU Classpath.
-This software is copyrighted work licensed under the terms of the
-Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
-details. */
+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 java.net;
import java.io.*;
+import java.security.Permission;
-/**
- * @author Warren Levy <warrenl@cygnus.com>
- * @date March 29, 1999.
- */
-
-/**
+/*
* Written using on-line Java Platform 1.2 API Specification, as well
* as "The Java Class Libraries", 2nd edition (Addison-Wesley, 1998).
* Status: Believed complete and correct.
*/
+/**
+ * This class provides a common abstract implementation for those
+ * URL connection classes that will connect using the HTTP protocol.
+ * In addition to the functionality provided by the URLConnection
+ * class, it defines constants for HTTP return code values and
+ * methods for setting the HTTP request method and determining whether
+ * or not to follow redirects.
+ *
+ * @since 1.1
+ *
+ * @author Warren Levy (warrenl@cygnus.com)
+ * @author Aaron M. Renn (arenn@urbanophile.com)
+ */
public abstract class HttpURLConnection extends URLConnection
{
/* HTTP Success Response Codes */
+
+ /**
+ * Indicates that the client may continue with its request. This value
+ * is specified as part of RFC 2068 but was not included in Sun's JDK, so
+ * beware of using this value
+ */
+ static final int HTTP_CONTINUE = 100;
+
+ /**
+ * Indicates the request succeeded.
+ */
public static final int HTTP_OK = 200;
+
+ /**
+ * The requested resource has been created.
+ */
public static final int HTTP_CREATED = 201;
+
+ /**
+ * The request has been accepted for processing but has not completed.
+ * There is no guarantee that the requested action will actually ever
+ * be completed succesfully, but everything is ok so far.
+ */
public static final int HTTP_ACCEPTED = 202;
+
+ /**
+ * The meta-information returned in the header is not the actual data
+ * from the original server, but may be from a local or other copy.
+ * Normally this still indicates a successful completion.
+ */
public static final int HTTP_NOT_AUTHORITATIVE = 203;
+
+ /**
+ * The server performed the request, but there is no data to send
+ * back. This indicates that the user's display should not be changed.
+ */
public static final int HTTP_NO_CONTENT = 204;
+
+ /**
+ * The server performed the request, but there is no data to sent back,
+ * however, the user's display should be "reset" to clear out any form
+ * fields entered.
+ */
public static final int HTTP_RESET = 205;
+
+ /**
+ * The server completed the partial GET request for the resource.
+ */
public static final int HTTP_PARTIAL = 206;
+
/* HTTP Redirection Response Codes */
- public static final int HTTP_MULT_CHOICE = 300;
- public static final int HTTP_MOVED_PERM = 301;
- public static final int HTTP_MOVED_TEMP = 302;
- public static final int HTTP_SEE_OTHER = 303;
- public static final int HTTP_NOT_MODIFIED = 304;
- public static final int HTTP_USE_PROXY = 305;
+ /**
+ * There is a list of choices available for the requested resource.
+ */
+ public static final int HTTP_MULT_CHOICE = 300;
+
+ /**
+ * The resource has been permanently moved to a new location.
+ */
+ public static final int HTTP_MOVED_PERM = 301;
+
+ /**
+ * The resource requested has been temporarily moved to a new location.
+ */
+ public static final int HTTP_MOVED_TEMP = 302;
+
+ /**
+ * The response to the request issued is available at another location.
+ */
+ public static final int HTTP_SEE_OTHER = 303;
+
+ /**
+ * The document has not been modified since the criteria specified in
+ * a conditional GET.
+ */
+ public static final int HTTP_NOT_MODIFIED = 304;
+
+
/* HTTP Client Error Response Codes */
- public static final int HTTP_BAD_REQUEST = 400;
- public static final int HTTP_UNAUTHORIZED = 401;
- public static final int HTTP_PAYMENT_REQUIRED = 402;
- public static final int HTTP_FORBIDDEN = 403;
- public static final int HTTP_NOT_FOUND = 404;
- public static final int HTTP_BAD_METHOD = 405;
- public static final int HTTP_NOT_ACCEPTABLE = 406;
- public static final int HTTP_PROXY_AUTH = 407;
- public static final int HTTP_CLIENT_TIMEOUT = 408;
- public static final int HTTP_CONFLICT = 409;
- public static final int HTTP_GONE = 410;
- public static final int HTTP_LENGTH_REQUIRED = 411;
- public static final int HTTP_PRECON_FAILED = 412;
- public static final int HTTP_ENTITY_TOO_LARGE = 413;
- public static final int HTTP_REQ_TOO_LONG = 414;
- public static final int HTTP_UNSUPPORTED_TYPE = 415;
+
+ /**
+ * The request was misformed or could not be understood.
+ */
+ public static final int HTTP_BAD_REQUEST = 400;
+
+ /**
+ * The request made requires user authorization. Try again with
+ * a correct authentication header.
+ */
+ public static final int HTTP_UNAUTHORIZED = 401;
+
+ /**
+ * Code reserved for future use - I hope way in the future.
+ */
+ public static final int HTTP_PAYMENT_REQUIRED = 402;
+
+ /**
+ * There is no permission to access the requested resource.
+ */
+ public static final int HTTP_FORBIDDEN = 403;
+
+ /**
+ * The requested resource was not found.
+ */
+ public static final int HTTP_NOT_FOUND = 404;
+
+ /**
+ * The specified request method is not allowed for this resource.
+ */
+ public static final int HTTP_BAD_METHOD = 405;
+
+ /**
+ * Based on the input headers sent, the resource returned in response
+ * to the request would not be acceptable to the client.
+ */
+ public static final int HTTP_NOT_ACCEPTABLE = 406;
+
+ /**
+ * The client must authenticate with a proxy prior to attempting this
+ * request.
+ */
+ public static final int HTTP_PROXY_AUTH = 407;
+
+ /**
+ * The request timed out.
+ */
+ public static final int HTTP_CLIENT_TIMEOUT = 408;
+
+ /**
+ * There is a conflict between the current state of the resource and the
+ * requested action.
+ */
+ public static final int HTTP_CONFLICT = 409;
+
+ /**
+ * The requested resource is no longer available. This ususally indicates
+ * a permanent condition.
+ */
+ public static final int HTTP_GONE = 410;
+
+ /**
+ * A Content-Length header is required for this request, but was not
+ * supplied.
+ */
+ public static final int HTTP_LENGTH_REQUIRED = 411;
+
+ /**
+ * A client specified pre-condition was not met on the server.
+ */
+ public static final int HTTP_PRECON_FAILED = 412;
+
+ /**
+ * The request sent was too large for the server to handle.
+ */
+ public static final int HTTP_ENTITY_TOO_LARGE = 413;
+
+ /**
+ * The name of the resource specified was too long.
+ */
+ public static final int HTTP_REQ_TOO_LONG = 414;
+
+ /**
+ * The request is in a format not supported by the requested resource.
+ */
+ public static final int HTTP_UNSUPPORTED_TYPE = 415;
+
/* HTTP Server Error Response Codes */
- public static final int HTTP_SERVER_ERROR = 500;
- public static final int HTTP_INTERNAL_ERROR = 501;
- public static final int HTTP_BAD_GATEWAY = 502;
- public static final int HTTP_UNAVAILABLE = 503;
- public static final int HTTP_GATEWAY_TIMEOUT = 504;
- public static final int HTTP_VERSION = 505;
- static boolean followRedirects = true;
+ /**
+ * This error code indicates that some sort of server error occurred.
+ */
+ public static final int HTTP_SERVER_ERROR = 500;
+
+ /**
+ * The server encountered an unexpected error (such as a CGI script crash)
+ * that prevents the request from being fulfilled.
+ */
+ public static final int HTTP_INTERNAL_ERROR = 500;
+
+ /**
+ * The server does not support the requested functionality.
+ * @since 1.3
+ */
+ static final int HTTP_NOT_IMPLEMENTED = 501;
+
+ /**
+ * The proxy encountered a bad response from the server it was proxy-ing for
+ */
+ public static final int HTTP_BAD_GATEWAY = 502;
+
+ /**
+ * The HTTP service is not availalble, such as because it is overloaded
+ * and does not want additional requests.
+ */
+ public static final int HTTP_UNAVAILABLE = 503;
+
+ /**
+ * The proxy timed out getting a reply from the remote server it was
+ * proxy-ing for.
+ */
+ public static final int HTTP_GATEWAY_TIMEOUT = 504;
+ /**
+ * This server does not support the protocol version requested.
+ */
+ public static final int HTTP_VERSION = 505;
+
+ // Non-HTTP response static variables
+
+ /**
+ * Flag to indicate whether or not redirects should be automatically
+ * followed by default.
+ */
+ private static boolean followRedirects = true;
+
+ /**
+ * This is a list of valid request methods, separated by "|" characters.
+ */
+ private static String valid_methods
+ = "|GET|POST|HEAD|OPTIONS|PUT|DELETE|TRACE|";
+
+ // Instance Variables
+
+ /**
+ * The requested method in use for this connection. Default is GET.
+ */
protected String method = "GET";
+
+ /**
+ * The response code received from the server
+ */
protected int responseCode = -1;
- protected String responseMessage;
+
+ /**
+ * The response message string received from the server.
+ */
+ protected String responseMessage = null;
+
+ /**
+ * If this instance should follow redirect requests.
+ */
protected boolean instanceFollowRedirects = followRedirects;
+ /**
+ * Whether we alreadt got a valid response code for this connection.
+ * Used by <code>getResponceCode()</code> and
+ * <code>getResponseMessage()</code>.
+ */
private boolean gotResponseVals = false;
+ /**
+ * Create an HttpURLConnection for the specified URL
+ *
+ * @param url The URL to create this connection for.
+ */
protected HttpURLConnection(URL url)
{
super(url);
}
-
+
+ /**
+ * Closes the connection to the server.
+ */
public abstract void disconnect();
+ /**
+ * Returns a boolean indicating whether or not this connection is going
+ * through a proxy
+ *
+ * @return true if through a proxy, false otherwise
+ */
public abstract boolean usingProxy();
+ /**
+ * Sets whether HTTP redirects (requests with response code 3xx) should be
+ * automatically followed by this class. True by default
+ *
+ * @param set true if redirects should be followed, false otherwis.
+ *
+ * @exception SecurityException If a security manager exists and its
+ * checkSetFactory method doesn't allow the operation
+ */
public static void setFollowRedirects(boolean set)
{
// Throw an exception if an extant security mgr precludes
@@ -98,30 +360,74 @@ public abstract class HttpURLConnection extends URLConnection
followRedirects = set;
}
+ /**
+ * Returns a boolean indicating whether or not HTTP redirects will
+ * automatically be followed or not.
+ *
+ * @return true if redirects will be followed, false otherwise
+ */
public static boolean getFollowRedirects()
{
return followRedirects;
}
+ /**
+ * Returns the value of this HttpURLConnection's instanceFollowRedirects
+ * field
+ */
+ public boolean getInstanceFollowRedirects ()
+ {
+ return instanceFollowRedirects;
+ }
+
+ /**
+ * Sets the value of this HttpURLConnection's instanceFollowRedirects field
+ */
+ public void setInstanceFollowRedirects (boolean follow)
+ {
+ instanceFollowRedirects = follow;
+ }
+
+ /**
+ * Set the method for the URL request, one of:
+ * GET POST HEAD OPTIONS PUT DELETE TRACE are legal
+ *
+ * @exception ProtocolException If the method cannot be reset or if the
+ * requested method isn't valid for HTTP
+ */
public void setRequestMethod(String method) throws ProtocolException
{
if (connected)
throw new ProtocolException("Already connected");
- if (method.equals("GET") || method.equals("POST") ||
- method.equals("HEAD") || method.equals("OPTIONS") ||
- method.equals("PUT") || method.equals("DELETE") ||
- method.equals("TRACE"))
+ method = method.toUpperCase();
+ if (valid_methods.indexOf("|" + method + "|") != -1)
this.method = method;
else
- throw new ProtocolException("Invalid HTTP request method");
+ throw new ProtocolException("Invalid HTTP request method: " + method);
+
}
+ /**
+ * The request method currently in use for this connection.
+ *
+ * @return The request method
+ */
public String getRequestMethod()
{
return method;
}
+ /**
+ * Gets the status code from an HTTP response message, or -1 if
+ * the response code could not be determined.
+ * Note that all valid response codes have class variables
+ * defined for them in this class.
+ *
+ * @return The response code
+ *
+ * @exception IOException If an error occurs
+ */
public int getResponseCode() throws IOException
{
if (!gotResponseVals)
@@ -129,6 +435,15 @@ public abstract class HttpURLConnection extends URLConnection
return responseCode;
}
+ /**
+ * Gets the HTTP response message, if any, returned along with the
+ * response code from a server. Null if no response message was set
+ * or an error occured while connecting.
+ *
+ * @return The response message
+ *
+ * @exception IOException If an error occurs
+ */
public String getResponseMessage() throws IOException
{
if (!gotResponseVals)
@@ -172,11 +487,80 @@ public abstract class HttpURLConnection extends URLConnection
}
}
- // TODO12: public Permission getPermission() throws IOException
- // {
- // }
+ /**
+ * Returns a permission object representing the permission necessary to make
+ * the connection represented by this object
+ *
+ * @exception IOException If an error occurs
+ */
+ public Permission getPermission() throws IOException
+ {
+ URL url = getURL();
+ String host = url.getHost();
+ int port = url.getPort();
+ if (port == -1)
+ port = 80;
+
+ host = host + ":" + port;
+
+ return new SocketPermission(host, "connect");
+ }
+
+ /**
+ * This method allows the caller to retrieve any data that might have
+ * been sent despite the fact that an error occurred. For example, the
+ * HTML page sent along with a 404 File Not Found error. If the socket
+ * is not connected, or if no error occurred or no data was returned,
+ * this method returns <code>null</code>.
+ *
+ * @return An <code>InputStream</code> for reading error data.
+ */
+ public InputStream getErrorStream ()
+ {
+ if (!connected)
+ return(null);
+
+ int code;
+ try
+ {
+ code = getResponseCode();
+ }
+ catch(IOException e)
+ {
+ code = -1;
+ }
+
+ if (code == -1)
+ return(null);
+
+ if (((code/100) != 4) || ((code/100) != 5))
+ return(null);
+
+ try
+ {
+ PushbackInputStream pbis = new PushbackInputStream(getInputStream());
+
+ int i = pbis.read();
+ if (i == -1)
+ return(null);
+
+ pbis.unread(i);
+ return(pbis);
+ }
+ catch(IOException e)
+ {
+ return(null);
+ }
+ }
- // TODO12: public InputStream getErrorStream()
- // {
- // }
+ /**
+ * Returns the value of the named field parsed as date
+ */
+ public long getHeaderFieldDate (String key, long value)
+ {
+ // FIXME: implement this correctly
+ // http://www.w3.org/Protocols/HTTP-NG/ng-notes.txt
+
+ return super.getHeaderFieldDate (key, value);
+ }
}
diff --git a/libjava/java/net/Inet4Address.java b/libjava/java/net/Inet4Address.java
new file mode 100644
index 00000000000..c635c671d0e
--- /dev/null
+++ b/libjava/java/net/Inet4Address.java
@@ -0,0 +1,275 @@
+/* Inet4Address.java
+ Copyright (C) 2002 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 java.net;
+
+import java.io.IOException;
+import java.io.ObjectStreamException;
+
+/**
+ * @author Michael Koch
+ * @date August 3, 2002.
+ */
+
+/*
+ * Written using on-line Java Platform 1.4 API Specification and
+ * RFC 1884 (http://www.ietf.org/rfc/rfc1884.txt),
+ * RFC 1918 (http://www.ietf.org/rfc/rfc1918.txt),
+ * RFC 2365 (http://www.ietf.org/rfc/rfc2365.txt)
+ * Status: Believed complete and correct.
+ */
+
+public final class Inet4Address extends InetAddress
+{
+ static final long serialVersionUID = 7615067291688066509L;
+
+ /**
+ * needed for serialization
+ */
+ private Object writeReplace () throws ObjectStreamException
+ {
+ return new InetAddress (addr, hostName);
+ }
+
+ /**
+ * Creates a Inet4Address
+ *
+ * @param addr The IP address
+ * @param host The Hostname
+ */
+ protected Inet4Address(byte[] addr, String host)
+ {
+ super (addr, host);
+ }
+
+ /**
+ * Checks if the address is a multicast address
+ *
+ * @since 1.1
+ */
+ public boolean isMulticastAddress ()
+ {
+ return (addr [0] & 0xF0) == 0xE0;
+ }
+
+ /**
+ * Checks if this address is a loopback address
+ */
+ public boolean isLoopbackAddress ()
+ {
+ return addr [0] == 0x7F;
+ }
+
+ /**
+ * Checks if this address is a wildcard address
+ *
+ * @since 1.4
+ */
+ public boolean isAnyLocalAddress ()
+ {
+ byte[] anylocal = { 0, 0, 0, 0 };
+
+ return addr == anylocal;
+ }
+
+ /**
+ * Checks if this address is a link local address
+ *
+ * @since 1.4
+ */
+ public boolean isLinkLocalAddress ()
+ {
+ // XXX: This seems to not exist with IPv4 addresses
+ return false;
+ }
+
+ /**
+ * Checks if this address is a site local address
+ *
+ * @since 1.4
+ */
+ public boolean isSiteLocalAddress ()
+ {
+ // 10.0.0.0/8
+ if (addr [0] == 0x0A)
+ return true;
+
+ // XXX: Suns JDK 1.4.1 (on Linux) seems to have a bug here:
+ // it says 172.16.0.0 - 172.255.255.255 are site local addresses
+ //
+ // 172.16.0.0/12
+ if (addr [0] == 0xAC && (addr [1] & 0xF0) == 0x01)
+ return true;
+
+ // 192.168.0.0/16
+ if (addr [0] == 0xC0 && addr [1] == 0xA8)
+ return true;
+
+ // XXX: Do we need to check more addresses here ?
+ return false;
+ }
+
+ /**
+ * Checks if this multicast address has global scope
+ *
+ * @since 1.4
+ */
+ public boolean isMCGlobal ()
+ {
+ // XXX: This seems to net exist with IPv4 addresses
+ return false;
+ }
+
+ /**
+ * Checks if this multicast address has node scope
+ *
+ * @since 1.4
+ */
+ public boolean isMCNodeLocal ()
+ {
+ // XXX: This seems to net exist with IPv4 addresses
+ return false;
+ }
+
+ /**
+ * Checks if this multicast address has link scope
+ *
+ * @since 1.4
+ */
+ public boolean isMCLinkLocal ()
+ {
+ if (!isMulticastAddress ())
+ return false;
+
+ return (addr [0] == 0xE0)
+ && (addr [1] == 0x00)
+ && (addr [2] == 0x00);
+ }
+
+ /**
+ * Checks if this multicast address has site scope
+ *
+ * @since 1.4
+ */
+ public boolean isMCSiteLocal ()
+ {
+ // XXX: This seems to net exist with IPv4 addresses
+ return false;
+ }
+
+ /**
+ * Checks if this multicast address has organization scope
+ *
+ * @since 1.4
+ */
+ public boolean isMCOrgLocal ()
+ {
+ // XXX: This seems to net exist with IPv4 addresses
+ return false;
+ }
+
+ /**
+ * Returns the address of the current instance
+ */
+ public byte[] getAddress ()
+ {
+ return addr;
+ }
+
+ /**
+ * Returns the address as string
+ *
+ * @since 1.0.2
+ */
+ public String getHostAddress ()
+ {
+ StringBuffer sbuf = new StringBuffer (40);
+ int len = addr.length;
+ int i = 0;
+
+ for ( ; ; )
+ {
+ sbuf.append (addr [i] & 0xFF);
+ i++;
+
+ if (i == len)
+ break;
+
+ sbuf.append ('.');
+ }
+
+ return sbuf.toString ();
+ }
+
+ /**
+ * Computes the hashcode of the instance
+ */
+ public int hashCode ()
+ {
+ int hash = 0;
+ int len = addr.length;
+ int i = len > 4 ? len - 4 : 0;
+
+ for ( ; i < len; i++)
+ hash = (hash << 8) | (addr [i] & 0xFF);
+
+ return hash;
+ }
+
+ /**
+ * Compare the current Inet4Address instance with obj
+ *
+ * @param obj Object to compare with
+ */
+ public boolean equals (Object obj)
+ {
+ if (obj == null || ! (obj instanceof InetAddress))
+ return false;
+
+ byte[] addr1 = addr;
+ byte[] addr2 = ((InetAddress) obj).addr;
+
+ if (addr1.length != addr2.length)
+ return false;
+
+ for (int i = addr1.length; --i >= 0; )
+ if (addr1 [i] != addr2 [i])
+ return false;
+
+ return true;
+ }
+} // class Inet4Address
diff --git a/libjava/java/net/Inet6Address.java b/libjava/java/net/Inet6Address.java
new file mode 100644
index 00000000000..8d3c0c3af44
--- /dev/null
+++ b/libjava/java/net/Inet6Address.java
@@ -0,0 +1,272 @@
+/* Inet6Address.java
+ Copyright (C) 2002 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 java.net;
+
+import java.io.IOException;
+
+/**
+ * @author Michael Koch
+ * @date August 3, 2002.
+ */
+
+/*
+ * Written using on-line Java Platform 1.4 API Specification and
+ * RFC 1884 (http://www.ietf.org/rfc/rfc1884.txt)
+ * Status: Believed complete and correct.
+ */
+
+public final class Inet6Address extends InetAddress
+{
+ static final long serialVersionUID = 6880410070516793377L;
+
+ /**
+ * Needed for serialization
+ */
+ byte[] ipaddress;
+
+ /**
+ * Create an Inet6Address object
+ *
+ * @param addr The IP address
+ * @param host The hostname
+ */
+ protected Inet6Address (byte[] addr, String host)
+ {
+ super (addr, host);
+ this.ipaddress = addr;
+ }
+
+ /**
+ * Utility routine to check if the InetAddress is an IP multicast address
+ *
+ * @since 1.1
+ */
+ public boolean isMulticastAddress ()
+ {
+ return ipaddress [0] == 0xFF;
+ }
+
+ /**
+ * Utility routine to check if the InetAddress in a wildcard address
+ *
+ * @since 1.4
+ */
+ public boolean isAnyLocalAddress ()
+ {
+ byte[] anylocal = { 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0 };
+
+ return ipaddress == anylocal;
+ }
+
+ /**
+ * Utility routine to check if the InetAddress is a loopback address
+ *
+ * @since 1.4
+ */
+ public boolean isLoopbackAddress ()
+ {
+ byte[] loopback = { 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 1 };
+
+ return ipaddress == loopback;
+ }
+
+ /**
+ * Utility routine to check if the InetAddress is an link local address
+ *
+ * @since 1.4
+ */
+ public boolean isLinkLocalAddress ()
+ {
+ return ipaddress [0] == 0xFA;
+ }
+
+ /**
+ * Utility routine to check if the InetAddress is a site local address
+ *
+ * @since 1.4
+ */
+ public boolean isSiteLocalAddress ()
+ {
+ return ipaddress [0] == 0xFB;
+ }
+
+ /**
+ * Utility routine to check if the multicast address has global scope
+ *
+ * @since 1.4
+ */
+ public boolean isMCGlobal ()
+ {
+ if (!isMulticastAddress ())
+ return false;
+
+ return (ipaddress [1] & 0x0F) == 0xE;
+ }
+
+ /**
+ * Utility routine to check if the multicast address has node scope
+ *
+ * @since 1.4
+ */
+ public boolean isMCNodeLocal ()
+ {
+ if (!isMulticastAddress ())
+ return false;
+
+ return (ipaddress [1] & 0x0F) == 0x1;
+ }
+
+ /**
+ * Utility routine to check if the multicast address has link scope
+ *
+ * @since 1.4
+ */
+ public boolean isMCLinkLocal ()
+ {
+ if (!isMulticastAddress ())
+ return false;
+
+ return (ipaddress [1] & 0x0F) == 0x2;
+ }
+
+ /**
+ * Utility routine to check if the multicast address has site scope
+ *
+ * @since 1.4
+ */
+ public boolean isMCSiteLocal ()
+ {
+ if (!isMulticastAddress ())
+ return false;
+
+ return (ipaddress [1] & 0x0F) == 0x5;
+ }
+
+ /**
+ * Utility routine to check if the multicast address has organization scope
+ *
+ * @since 1.4
+ */
+ public boolean isMCOrgLocal ()
+ {
+ if (!isMulticastAddress ())
+ return false;
+
+ return (ipaddress [1] & 0x0F) == 0x8;
+ }
+
+ /**
+ * Returns the raw IP address of this InetAddress object. The result is in
+ * network byte order: the highest order byte of the address is i
+ * n getAddress()[0]
+ */
+ public byte[] getAddress ()
+ {
+ return ipaddress;
+ }
+
+ /**
+ * Returns the IP address string in textual presentation
+ */
+ public String getHostAddress ()
+ {
+ StringBuffer sbuf = new StringBuffer (40);
+
+ for (int i = 0; i < 16; i += 2)
+ {
+ int x = ((ipaddress [i] & 0xFF) << 8) | (ipaddress [i + 1] & 0xFF);
+ boolean empty = sbuf.length () == 0;
+
+ if (empty)
+ {
+ if (i > 0)
+ sbuf.append ("::");
+ }
+ else
+ sbuf.append (':');
+
+ if (x != 0 || i >= 14)
+ sbuf.append (Integer.toHexString (x));
+ }
+
+ return sbuf.toString ();
+ }
+
+ /**
+ * Returns a hashcode for this IP address
+ */
+ public int hashCode ()
+ {
+ return super.hashCode ();
+ }
+
+ /**
+ * Compares this object against the specified object
+ */
+ public boolean equals (Object obj)
+ {
+ if (obj == null || ! (obj instanceof Inet6Address))
+ return false;
+
+ Inet6Address tmp = (Inet6Address) obj;
+
+ return super.equals (tmp)
+ && this.ipaddress == tmp.ipaddress;
+ }
+
+ /**
+ * Utility routine to check if the InetAddress is an
+ * IPv4 compatible IPv6 address
+ *
+ * @since 1.4
+ */
+ public boolean isIPv4CompatibleAddress ()
+ {
+ if (ipaddress [0] != 0x00 || ipaddress [1] != 0x00 ||
+ ipaddress [2] != 0x00 || ipaddress [3] != 0x00 ||
+ ipaddress [4] != 0x00 || ipaddress [5] != 0x00 ||
+ ipaddress [6] != 0x00 || ipaddress [7] != 0x00 ||
+ ipaddress [8] != 0x00 || ipaddress [9] != 0x00 ||
+ ipaddress [10] != 0x00 || ipaddress [11] != 0x00)
+ return false;
+
+ return true;
+ }
+}
diff --git a/libjava/java/net/InetAddress.java b/libjava/java/net/InetAddress.java
index 49bc3105fb1..c15c0f6dc41 100644
--- a/libjava/java/net/InetAddress.java
+++ b/libjava/java/net/InetAddress.java
@@ -9,9 +9,12 @@ Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
details. */
package java.net;
+
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.IOException;
+import java.io.Serializable;
+import java.io.ObjectStreamException;
/**
* @author Per Bothner
@@ -23,9 +26,11 @@ import java.io.IOException;
* as "The Java Class Libraries", 2nd edition (Addison-Wesley, 1998).
* (The latter turns out to have some errors ...)
* Status: Believed complete and correct.
+ *
+ * @specnote This class is not final since JK 1.4
*/
-public final class InetAddress implements java.io.Serializable
+public class InetAddress implements Serializable
{
// The Serialized Form specifies that an int 'address' is saved/restored.
// This class uses a byte array internally so we'll just do the conversion
@@ -41,6 +46,14 @@ public final class InetAddress implements java.io.Serializable
int family;
private static final long serialVersionUID = 3286316764910316507L;
+ /**
+ * Needed for serialization
+ */
+ private void readResolve () throws ObjectStreamException
+ {
+ // FIXME: implement this
+ }
+
private void readObject(ObjectInputStream ois)
throws IOException, ClassNotFoundException
{
@@ -78,6 +91,11 @@ public final class InetAddress implements java.io.Serializable
family = getFamily (address);
}
+ /**
+ * Utility routine to check if the InetAddress is an IP multicast address
+ *
+ * @since 1.1
+ */
public boolean isMulticastAddress ()
{
int len = addr.length;
@@ -88,13 +106,188 @@ public final class InetAddress implements java.io.Serializable
return false;
}
+ /**
+ * Utility routine to check if the InetAddress in a wildcard address
+ *
+ * @since 1.4
+ */
+ public boolean isAnyLocalAddress ()
+ {
+ // This is the IPv4 implementation.
+ // Any class derived from InetAddress should override this.
+ return addr == zeros;
+ }
+
+ /**
+ * Utility routine to check if the InetAddress is a loopback address
+ *
+ * @since 1.4
+ */
+ public boolean isLoopbackAddress ()
+ {
+ // This is the IPv4 implementation.
+ // Any class derived from InetAddress should override this.
+
+ return addr[0] == 0x7F;
+ }
+
+ /**
+ * Utility routine to check if InetAddress is a link local address
+ *
+ * @since 1.4
+ */
+ public boolean isLinkLocalAddress ()
+ {
+ // This is the IPv4 implementation.
+ // Any class derived from InetAddress should override this.
+
+ // XXX: This seems to not exist with IPv4 addresses
+ return false;
+ }
+
+ /**
+ * Utility routine to check if InetAddress is a site local address
+ *
+ * @since 1.4
+ */
+ public boolean isSiteLocalAddress ()
+ {
+ // This is the IPv4 implementation.
+ // Any class derived from InetAddress should override this.
+
+ // 10.0.0.0/8
+ if (addr[0] == 0x0A)
+ return true;
+
+ // XXX: Suns JDK 1.4.1 (on Linux) seems to have a bug here:
+ // it says 172.16.0.0 - 172.255.255.255 are site local addresses
+
+ // 172.16.0.0/12
+ if (addr[0] == 0xAC && (addr[1] & 0xF0) == 0x01)
+ return true;
+
+ // 192.168.0.0/16
+ if (addr[0] == 0xC0 && addr[1] == 0xA8)
+ return true;
+
+ // XXX: Do we need to check more addresses here ?
+ return false;
+ }
+
+ /**
+ * Utility routine to check if InetAddress is a global multicast address
+ *
+ * @since 1.4
+ */
+ public boolean isMCGlobal ()
+ {
+ // This is the IPv4 implementation.
+ // Any class derived from InetAddress should override this.
+
+ // XXX: This seems to not exist with IPv4 addresses
+ return false;
+ }
+
+ /**
+ * Utility reoutine to check if InetAddress is a node local multicast address
+ *
+ * @since 1.4
+ */
+ public boolean isMCNodeLocal ()
+ {
+ // This is the IPv4 implementation.
+ // Any class derived from InetAddress should override this.
+
+ // XXX: This seems to not exist with IPv4 addresses
+ return false;
+ }
+
+ /**
+ * Utility reoutine to check if InetAddress is a link local multicast address
+ *
+ * @since 1.4
+ */
+ public boolean isMCLinkLocal ()
+ {
+ // This is the IPv4 implementation.
+ // Any class derived from InetAddress should override this.
+
+ if (!isMulticastAddress ())
+ return false;
+
+ return (addr[0] == 0xE0
+ && addr[1] == 0x00
+ && addr[2] == 0x00);
+ }
+
+ /**
+ * Utility reoutine to check if InetAddress is a site local multicast address
+ *
+ * @since 1.4
+ */
+ public boolean isMCSiteLocal ()
+ {
+ // This is the IPv4 implementation.
+ // Any class derived from InetAddress should override this.
+
+ // XXX: This seems to not exist with IPv4 addresses
+ return false;
+ }
+
+ /**
+ * Utility reoutine to check if InetAddress is a organization local
+ * multicast address
+ *
+ * @since 1.4
+ */
+ public boolean isMCOrgLocal ()
+ {
+ // This is the IPv4 implementation.
+ // Any class derived from InetAddress should override this.
+
+ // XXX: This seems to not exist with IPv4 addresses
+ return false;
+ }
+
+ /**
+ * Returns the hostname represented by this InetAddress
+ */
public String getHostName ()
{
if (hostName == null)
lookup (null, this, false);
+
return hostName;
}
+ /**
+ * Returns the canonical hostname represented by this InetAddress
+ *
+ * @since 1.4
+ */
+ public String getCanonicalHostName ()
+ {
+ SecurityManager sm = System.getSecurityManager ();
+ if (sm != null)
+ {
+ try
+ {
+ sm.checkConnect (hostName, -1);
+ }
+ catch (SecurityException e)
+ {
+ return getHostAddress ();
+ }
+ }
+
+ // Try to find the FDQN now
+ InetAddress address = new InetAddress (getAddress (), null);
+ return address.getHostName ();
+ }
+
+ /**
+ * Returns the IP address of this InetAddress as array of bytes
+ */
public byte[] getAddress ()
{
// An experiment shows that JDK1.2 returns a different byte array each
@@ -125,6 +318,11 @@ public final class InetAddress implements java.io.Serializable
}
}
+ /**
+ * Returns the IP address as string
+ *
+ * @since 1.0.2
+ */
public String getHostAddress ()
{
StringBuffer sbuf = new StringBuffer(40);
@@ -167,9 +365,13 @@ public final class InetAddress implements java.io.Serializable
break;
sbuf.append('.');
}
+
return sbuf.toString();
}
+ /**
+ * Returns a hashcode of the InetAddress
+ */
public int hashCode()
{
// There hashing algorithm is not specified, but a simple experiment
@@ -182,15 +384,19 @@ public final class InetAddress implements java.io.Serializable
return hash;
}
+ /**
+ * Compares the InetAddress object with another one.
+ */
public boolean equals (Object obj)
{
if (obj == null || ! (obj instanceof InetAddress))
return false;
+
// "The Java Class Libraries" 2nd edition says "If a machine has
// multiple names instances of InetAddress for different name of
// that same machine are not equal. This is because they have
// different host names." This violates the description in the
- // JDK 1.2 API documentation. A little experiementation
+ // JDK 1.2 API documentation. A little experimentation
// shows that the latter is correct.
byte[] addr1 = addr;
byte[] addr2 = ((InetAddress) obj).addr;
@@ -202,45 +408,151 @@ public final class InetAddress implements java.io.Serializable
return true;
}
+ /**
+ * Returns then <code>InetAddress</code> as string
+ */
public String toString()
{
- return getHostName()+'/'+getHostAddress();
+ String hostname = getHostName ();
+
+ if (hostname == "")
+ hostname = getHostAddress ();
+
+ return hostname + '/' + getHostAddress ();
+ }
+
+ /**
+ * Returns an InetAddress object given the raw IP address.
+ *
+ * The argument is in network byte order: the highest order byte of the
+ * address is in getAddress()[0].
+ *
+ * @param addr The IP address to create the InetAddress object from
+ *
+ * @exception UnknownHostException If IP address has illegal length
+ *
+ * @since 1.4
+ */
+ public static InetAddress getByAddress(byte[] addr)
+ throws UnknownHostException
+ {
+ if (addr.length != 4 && addr.length != 16)
+ throw new UnknownHostException ("IP address has illegal length");
+
+ if (addr.length == 4)
+ return new Inet4Address (addr, null);
+
+ return new Inet6Address (addr, null);
}
+ /**
+ * Creates an InetAddress based on the provided host name and IP address.
+ * No name service is checked for the validity of the address.
+ *
+ * @param host The hostname of the InetAddress object to create
+ * @param addr The IP address to create the InetAddress object from
+ *
+ * @exception UnknownHostException If IP address is of illegal length
+ *
+ * @since 1.4
+ */
+ public static InetAddress getByAddress (String host, byte[] addr)
+ throws UnknownHostException
+ {
+ if (addr.length == 4)
+ return new Inet4Address (addr, host);
+
+ if (addr.length == 16)
+ return new Inet6Address (addr, host);
+
+ throw new UnknownHostException ("IP address has illegal length");
+ }
+
/** If host is a valid numeric IP address, return the numeric address.
* Otherwise, return null. */
private static native byte[] aton (String host);
- private static native InetAddress[] lookup
- (String hostname, InetAddress addr, boolean all);
+ private static native InetAddress[] lookup (String hostname,
+ InetAddress addr, boolean all);
- public static InetAddress getByName (String host)
+ /**
+ * Determines the IP address of a host, given the host's name.
+ *
+ * @exception UnknownHostException If no IP address for the host could
+ * be found
+ * @exception SecurityException If a security manager exists and its
+ * checkConnect method doesn't allow the operation
+ */
+ public static InetAddress getByName (String hostname)
throws UnknownHostException
{
- if (host == null)
+ SecurityManager sm = System.getSecurityManager();
+ if (sm != null)
+ sm.checkConnect (hostname, -1);
+
+ // Default to current host if necessary
+ if (hostname == null)
return getLocalHost();
- byte[] address = aton(host);
+
+ // Assume that the host string is an IP address
+ byte[] address = aton (hostname);
if (address != null)
- return new InetAddress(address, null);
- InetAddress iaddr = new InetAddress(null, host);
- lookup(host, iaddr, false);
- return iaddr;
+ {
+ if (address.length == 4)
+ return new Inet4Address (address, null);
+ else if (address.length == 16)
+ {
+ if ((address[10] == 0xFF) && (address[11] == 0xFF))
+ {
+ byte[] ip4addr = new byte[4];
+ ip4addr[0] = address[12];
+ ip4addr[1] = address[13];
+ ip4addr[2] = address[14];
+ ip4addr[3] = address[15];
+ return new Inet4Address (ip4addr, null);
+ }
+ return new Inet6Address (address, null);
+ }
+ else
+ throw new UnknownHostException ("Address has invalid length");
+ }
+
+ // Try to resolve the host by DNS
+ InetAddress[] addresses = getAllByName (hostname);
+ return addresses[0];
}
- public static InetAddress[] getAllByName (String host)
+ /**
+ * Given the name of a host, returns an array of its IP addresses,
+ * based on the configured name service on the system.
+ *
+ * @exception UnknownHostException If no IP address for the host could
+ * be found
+ * @exception SecurityException If a security manager exists and its
+ * checkConnect method doesn't allow the operation
+ */
+ public static InetAddress[] getAllByName (String hostname)
throws UnknownHostException
{
- byte[] address = aton(host);
+ SecurityManager sm = System.getSecurityManager();
+ if (sm != null)
+ sm.checkConnect(hostname, -1);
+
+ // Check if hostname is an IP address
+ byte[] address = aton (hostname);
if (address != null)
{
InetAddress[] result = new InetAddress[1];
result[0] = new InetAddress(address, null);
return result;
}
- return lookup(host, null, true);
+
+ // Try to resolve the hostname by DNS
+ return lookup (hostname, null, true);
}
static final byte[] zeros = {0,0,0,0};
+
/* dummy InetAddress, used to bind socket to any (all) network interfaces */
static final InetAddress ANY_IF = new InetAddress(zeros, null);
@@ -250,6 +562,12 @@ public final class InetAddress implements java.io.Serializable
private static InetAddress localhost = null;
+ /**
+ * Returns the local host
+ *
+ * @exception UnknownHostException If no IP address for the host could
+ * be found
+ */
public static InetAddress getLocalHost() throws UnknownHostException
{
SecurityManager s = System.getSecurityManager();
diff --git a/libjava/java/net/InetSocketAddress.java b/libjava/java/net/InetSocketAddress.java
index c542b800225..1b740dcc507 100644
--- a/libjava/java/net/InetSocketAddress.java
+++ b/libjava/java/net/InetSocketAddress.java
@@ -41,88 +41,155 @@ package java.net;
* InetSocketAddress instances represent socket addresses
* in the java.nio package. They encapsulate a InetAddress and
* a port number.
+ *
+ * @since 1.4
*/
public class InetSocketAddress extends SocketAddress
{
- InetAddress addr;
- int port;
+ String hostname;
+ InetAddress addr;
+ int port;
- public InetSocketAddress(InetAddress addr, int port)
- {
- this.addr = addr;
- this.port = port;
- }
-
- public InetSocketAddress(int port)
- {
- this.port = port;
- try {
- this.addr = InetAddress.getLocalHost();
- } catch (Exception e) {
- }
- }
-
-
- public InetSocketAddress(String hostname, int port)
- {
- this.port = port;
- try {
- this.addr = InetAddress.getByName(hostname);
- } catch (Exception e) {
- }
- }
+ /**
+ * Constructs an InetSocketAddress instance.
+ *
+ * @param addr Address of the socket
+ * @param port Port if the socket
+ *
+ * @exception IllegalArgumentException If the port number is illegel
+ */
+ public InetSocketAddress(InetAddress addr, int port)
+ throws IllegalArgumentException
+ {
+ if (port < 0 || port > 65535)
+ throw new IllegalArgumentException();
+
+ this.addr = addr;
+ this.port = port;
+ this.hostname = addr.getHostName ();
+ }
+
+ /**
+ * Constructs an InetSocketAddress instance.
+ *
+ * @param port Port if the socket
+ *
+ * @exception IllegalArgumentException If the port number is illegal
+ */
+ public InetSocketAddress(int port)
+ throws IllegalArgumentException
+ {
+ if (port < 0 || port > 65535)
+ throw new IllegalArgumentException();
+
+ this.port = port;
+
+ try
+ {
+ byte[] any = { 0, 0, 0, 0 };
+ this.addr = InetAddress.getByAddress (any);
+ this.hostname = "0.0.0.0";
+ }
+ catch (UnknownHostException e)
+ {
+ this.addr = null;
+ this.hostname = "";
+ }
+ }
+
+
+ /**
+ * Constructs an InetSocketAddress instance.
+ *
+ * @param addr Address of the socket
+ * @param port Port if the socket
+ *
+ * @exception IllegalArgumentException If the port number is illegal
+ */
+ public InetSocketAddress(String hostname, int port)
+ throws IllegalArgumentException
+ {
+ if (port < 0 || port > 65535)
+ throw new IllegalArgumentException();
+
+ this.port = port;
+ this.hostname = hostname;
+
+ try
+ {
+ this.addr = InetAddress.getByName(hostname);
+ }
+ catch (Exception e) // UnknownHostException, SecurityException
+ {
+ this.addr = null;
+ }
+ }
- /**
- * Test if obj is a InetSocketAddress and
- * has the same address & port
- */
- public boolean equals(Object obj)
- {
- if (obj instanceof InetSocketAddress)
- {
- InetSocketAddress a = (InetSocketAddress) obj;
- return addr.equals(a.addr) && a.port == port;
- }
- return false;
- }
-
- public InetAddress getAddress()
- {
- return addr;
- }
-
- public String getHostName()
- {
- return addr.getHostName();
- }
-
- public int getPort()
- {
- return port;
- }
+ /**
+ * Test if obj is a <code>InetSocketAddress</code> and
+ * has the same address and port
+ */
+ public final boolean equals (Object obj)
+ {
+ // InetSocketAddress objects are equal when addr and port are equal.
+ // The hostname may differ.
+
+ if (obj instanceof InetSocketAddress)
+ {
+ InetSocketAddress a = (InetSocketAddress) obj;
+ return addr.equals(a.addr) && a.port == port;
+ }
+
+ return false;
+ }
+
+ /**
+ * Returns the <code>InetAddress</code> or
+ * <code>null</code> if its unresolved
+ */
+ public final InetAddress getAddress()
+ {
+ return addr;
+ }
+
+ /**
+ * Returns <code>hostname</code>
+ */
+ public final String getHostName()
+ {
+ return hostname;
+ }
+
+ /**
+ * Returns the <code>port</code>
+ */
+ public final int getPort()
+ {
+ return port;
+ }
- /**
- * TODO: see what sun does here.
- */
- public int hashCode()
- {
- return port + addr.hashCode();
- }
-
- /**
- * TODO: see what sun does here.
- */
- public boolean isUnresolved()
- {
- return addr == null;
- }
+ /**
+ * Returns the hashcode of the <code>InetSocketAddress</code>
+ */
+ public final int hashCode()
+ {
+ return port + addr.hashCode();
+ }
+
+ /**
+ * Checks wether the address has been resolved or not
+ */
+ public final boolean isUnresolved()
+ {
+ return addr == null;
+ }
- /**
- * TODO: see what sun does here.
- */
- public String toString()
- {
- return "SA:"+addr+":"+port;
- }
+ /**
+ * Returns the <code>InetSocketAddress</code> as string
+ */
+ public String toString()
+ {
+ return addr + ":" + port;
+ }
}
diff --git a/libjava/java/net/JarURLConnection.java b/libjava/java/net/JarURLConnection.java
index 60adfcd9c61..a90c7f33037 100644
--- a/libjava/java/net/JarURLConnection.java
+++ b/libjava/java/net/JarURLConnection.java
@@ -1,4 +1,4 @@
-/* Copyright (C) 1999, 2000 Free Software Foundation
+/* Copyright (C) 1999, 2000, 2002 Free Software Foundation
This file is part of libgcj.
@@ -12,11 +12,14 @@ import java.net.*;
import java.io.*;
import java.util.jar.*;
import java.util.zip.*;
+import java.util.Map;
import java.util.Vector;
import java.util.Hashtable;
+import java.security.cert.Certificate;
/**
* @author Kresten Krab Thorup <krab@gnu.org>
+ * @since 1.2
* @date Aug 10, 1999.
*/
@@ -31,7 +34,7 @@ public abstract class JarURLConnection extends URLConnection
* either case this describes just the jar file itself. */
protected URLConnection jarFileURLConnection;
- // If this is a connection to a jar file element this is set, otherwose null.
+ // If this is a connection to a jar file element this is set, otherwise null.
private final String element;
// Cached JarURLConnection's
@@ -47,7 +50,14 @@ public abstract class JarURLConnection extends URLConnection
return element;
}
- public JarURLConnection(URL url)
+ /**
+ * Creates a new JarURLConnection
+ *
+ * @exception MalformedURLException If url is invalid
+ *
+ * @specnote This constructor is protected since JDK 1.4
+ */
+ protected JarURLConnection(URL url)
throws MalformedURLException
{
super(url);
@@ -103,7 +113,8 @@ public abstract class JarURLConnection extends URLConnection
{
// This is a JarURLConnection for the entire jar file.
- InputStream jar_is = new BufferedInputStream(jarFileURLConnection.getInputStream ());
+ InputStream jar_is = new BufferedInputStream(
+ jarFileURLConnection.getInputStream ());
return new JarInputStream(jar_is);
}
@@ -128,7 +139,8 @@ public abstract class JarURLConnection extends URLConnection
else
{
// If the jar file is not local, ...
- JarInputStream zis = new JarInputStream(jarFileURLConnection.getInputStream ());
+ JarInputStream zis = new JarInputStream(
+ jarFileURLConnection.getInputStream ());
// This is hideous, we're doing a linear search...
for (ZipEntry ent = zis.getNextEntry ();
@@ -148,7 +160,12 @@ public abstract class JarURLConnection extends URLConnection
return null;
}
- public JarEntry getJarEntry () throws java.io.IOException
+ /**
+ * Return the JAR entry object for this connection, if any
+ *
+ * @exception IOException If an error occurs
+ */
+ public JarEntry getJarEntry () throws IOException
{
JarFile jarfile = null;
@@ -162,14 +179,15 @@ public abstract class JarURLConnection extends URLConnection
{
jarfile = getJarFile ();
}
- catch (java.io.IOException x)
+ catch (IOException x)
{
/* ignore */
}
if (jarfile == null)
{
- JarInputStream zis = new JarInputStream(jarFileURLConnection.getInputStream ());
+ JarInputStream zis = new JarInputStream(
+ jarFileURLConnection.getInputStream ());
// This is hideous, we're doing a linear search for the thing...
for (ZipEntry ent = zis.getNextEntry ();
@@ -191,7 +209,12 @@ public abstract class JarURLConnection extends URLConnection
return null;
}
- public abstract JarFile getJarFile() throws java.io.IOException;
+ /**
+ * Return the JAR file for this connection
+ *
+ * @exception IOException If an error occurs
+ */
+ public abstract JarFile getJarFile() throws IOException;
// Steal and borrow from protocol/file/Connection.java
@@ -215,6 +238,20 @@ public abstract class JarURLConnection extends URLConnection
}
// Override default method in URLConnection.
+ public Map getHeaderFields()
+ {
+ try
+ {
+ getHeaders();
+ }
+ catch (IOException x)
+ {
+ return null;
+ }
+ return hdrHash;
+ }
+
+ // Override default method in URLConnection.
public String getHeaderField(int n)
{
try
@@ -300,4 +337,51 @@ public abstract class JarURLConnection extends URLConnection
hdrHash.put(key.toLowerCase(), Long.toString(len));
}
+ /**
+ * Returns an array of Certificate objects for the jar file entry specified
+ * by this URL or null if there are none
+ *
+ * @return A Certificate array
+ *
+ * @exception IOException If an error occurs
+ */
+ public Certificate[] getCertificates() throws IOException
+ {
+ return getJarEntry().getCertificates();
+ }
+
+ /**
+ * Returns the main Attributes for the JAR file for this connection
+ *
+ * @exception IOException If an error occurs
+ */
+ public Attributes getMainAttributes () throws IOException
+ {
+ return getManifest ().getMainAttributes ();
+ }
+
+ /**
+ * Return the Attributes object for this connection if the URL for it points
+ * to a JAR file entry, null otherwise
+ *
+ * @exception IOException If an error occurs
+ */
+ public Attributes getAttributes () throws IOException
+ {
+ // FIXME: implement this
+ return null;
+ }
+
+ /**
+ * Returns the Manifest for this connection, or null if none
+ *
+ * @exception IOException If an error occurs
+ */
+ public Manifest getManifest () throws IOException
+ {
+ JarFile file = getJarFile ();
+
+ // FIXME: implement this
+ return null;
+ }
}
diff --git a/libjava/java/net/MulticastSocket.java b/libjava/java/net/MulticastSocket.java
index 4528de1ebed..2700ebee511 100644
--- a/libjava/java/net/MulticastSocket.java
+++ b/libjava/java/net/MulticastSocket.java
@@ -38,82 +38,105 @@ exception statement from your version. */
package java.net;
import java.io.IOException;
+import java.util.Enumeration;
-/*
+/**
* Written using on-line Java Platform 1.2 API Specification, as well
* as "The Java Class Libraries", 2nd edition (Addison-Wesley, 1998).
* Status: Believed complete and correct.
*/
/**
- * This class models a multicast UDP socket. A multicast address is a
- * class D internet address (one whose most significant bits are 1110).
- * A multicast group consists of a multicast address and a well known
- * port number. All members of the group listening on that address and
- * port will receive all the broadcasts to the group.
- * <p>
- * Please note that applets are not allowed to use multicast sockets
- *
- * Written using on-line Java Platform 1.2 API Specification, as well
- * as "The Java Class Libraries", 2nd edition (Addison-Wesley, 1998).
- * Status: Believed complete and correct.
- *
- * @author Warren Levy <warrenl@cygnus.com>
- * @author Aaron M. Renn (arenn@urbanophile.com) (Documentation comments)
- * @date May 18, 1999.
- */
+ * This class models a multicast UDP socket. A multicast address is a
+ * class D internet address (one whose most significant bits are 1110).
+ * A multicast group consists of a multicast address and a well known
+ * port number. All members of the group listening on that address and
+ * port will receive all the broadcasts to the group.
+ * <p>
+ * Please note that applets are not allowed to use multicast sockets
+ *
+ * Written using on-line Java Platform 1.2 API Specification, as well
+ * as "The Java Class Libraries", 2nd edition (Addison-Wesley, 1998).
+ * Status: Believed complete and correct.
+ *
+ * @author Warren Levy <warrenl@cygnus.com>
+ * @author Aaron M. Renn (arenn@urbanophile.com) (Documentation comments)
+ * @since 1.1
+ * @date May 18, 1999.
+ */
public class MulticastSocket extends DatagramSocket
{
// FIXME: the local addr bound to the multicast socket can be reused;
// unlike unicast sockets. It binds to any available network interface.
// See p.1159 JCL book.
-/**
- * Create a MulticastSocket that this not bound to any address
- *
- * @exception IOException If an error occurs
- */
+ /**
+ * Create a MulticastSocket that this not bound to any address
+ *
+ * @exception IOException If an error occurs
+ * @exception SecurityException If a security manager exists and its
+ * checkListen method doesn't allow the operation
+ */
public MulticastSocket() throws IOException
{
super(0, null);
}
-/**
- * Create a multicast socket bound to the specified port
- *
- * @param The port to bind to
- *
- * @exception IOException If an error occurs
- */
+ /**
+ * Create a multicast socket bound to the specified port
+ *
+ * @param port The port to bind to
+ *
+ * @exception IOException If an error occurs
+ * @exception SecurityException If a security manager exists and its
+ * checkListen method doesn't allow the operation
+ */
public MulticastSocket(int port) throws IOException
{
super(port, null);
}
-/**
- * Returns the interface being used for multicast packets
- *
- * @return The multicast interface
- *
- * @exception SocketException If an error occurs
- */
+ /**
+ * Create a multicast socket bound to the specified SocketAddress.
+ *
+ * @param address The SocketAddress the multicast socket will be bound to
+ *
+ * @exception IOException If an error occurs
+ * @exception SecurityException If a security manager exists and its
+ * checkListen method doesn't allow the operation
+ *
+ * @since 1.4
+ */
+ public MulticastSocket(SocketAddress address) throws IOException
+ {
+ super(address);
+ }
+
+ /**
+ * Returns the interface being used for multicast packets
+ *
+ * @return The multicast interface
+ *
+ * @exception SocketException If an error occurs
+ */
public InetAddress getInterface() throws SocketException
{
- // FIXME: Is it possible that an InetAddress wasn't returned from getOption?
return (InetAddress) impl.getOption(SocketOptions.IP_MULTICAST_IF);
}
-/**
- * Returns the current value of the "Time to Live" option. This is the
- * number of hops a packet can make before it "expires". This method id
- * deprecated. Use <code>getTimeToLive</code> instead.
- *
- * @return The TTL value
- *
- * @exception IOException If an error occurs
- *
- * @deprecated Replaced by getTimeToLive() in Java 1.2
- */
+ /**
+ * Returns the current value of the "Time to Live" option. This is the
+ * number of hops a packet can make before it "expires". This method id
+ * deprecated. Use <code>getTimeToLive</code> instead.
+ *
+ * @return The TTL value
+ *
+ * @exception IOException If an error occurs
+ *
+ * @deprecated 1.2 Replaced by getTimeToLive()
+ *
+ * @see Multicastsocket:getTimeToLive
+ */
public byte getTTL() throws IOException
{
// Use getTTL here rather than getTimeToLive in case we're using an impl
@@ -122,43 +145,137 @@ public class MulticastSocket extends DatagramSocket
return impl.getTTL();
}
-/**
- * Returns the current value of the "Time to Live" option. This is the
- * number of hops a packet can make before it "expires".
- *
- * @return The TTL value
- *
- * @exception IOException If an error occurs
- *
- * @since Java 1.2
- */
+ /**
+ * Returns the current value of the "Time to Live" option. This is the
+ * number of hops a packet can make before it "expires".
+ *
+ * @return The TTL value
+ *
+ * @exception IOException If an error occurs
+ *
+ * @since 1.2
+ */
public int getTimeToLive() throws IOException
{
return impl.getTimeToLive();
}
-/**
- * Sets the interface to use for multicast packets.
- *
- * @param addr The new interface to use
- *
- * @exception SocketException If an error occurs
- */
+ /**
+ * Sets the interface to use for sending multicast packets.
+ *
+ * @param inf The new interface to use
+ *
+ * @exception SocketException If an error occurs
+ */
public void setInterface(InetAddress inf) throws SocketException
{
impl.setOption(SocketOptions.IP_MULTICAST_IF, inf);
}
-/**
- * Sets the "Time to Live" value for a socket. The value must be between
- * 1 and 255.
- *
- * @param ttl The new TTL value
- *
- * @exception IOException If an error occurs
- *
- * @deprecated Replaced by <code>setTimeToLive</code> in Java 1.2
- */
+ /**
+ * Sets the local network interface used to send multicast messages
+ *
+ * @param netIF The local network interface used to send multicast messages
+ *
+ * @exception SocketException If an error occurs
+ *
+ * @see MulticastSocket:getNetworkInterface
+ *
+ * @since 1.4
+ */
+ public void setNetworkInterface(NetworkInterface netIf)
+ throws SocketException
+ {
+ if (impl == null)
+ throw new SocketException (
+ "MulticastSocket: Cant access socket implementation");
+
+ Enumeration e = netIf.getInetAddresses ();
+
+ if (!e.hasMoreElements ())
+ throw new SocketException ("MulticastSocket: Error");
+
+ InetAddress address = (InetAddress) e.nextElement ();
+ impl.setOption (SocketOptions.IP_MULTICAST_IF, address);
+ }
+
+ /**
+ * Gets the local network interface which is used to send multicast messages
+ *
+ * @return The local network interface to send multicast messages
+ *
+ * @exception SocketException If an error occurs
+ *
+ * @see MulticastSocket:setNetworkInterface
+ *
+ * @since 1.4
+ */
+ public NetworkInterface getNetworkInterface()
+ throws SocketException
+ {
+ if (impl == null)
+ throw new SocketException (
+ "MulticastSocket: Cant access socket implementation");
+
+ InetAddress address =
+ (InetAddress) impl.getOption (SocketOptions.IP_MULTICAST_IF);
+ NetworkInterface netIf = NetworkInterface.getByInetAddress (address);
+
+ return netIf;
+ }
+
+ /**
+ * Disable/Enable local loopback of multicast packets. The option is used by
+ * the platform's networking code as a hint for setting whether multicast
+ * data will be looped back to the local socket.
+ *
+ * Because this option is a hint, applications that want to verify what
+ * loopback mode is set to should call #getLoopbackMode
+ *
+ * @param disable True to disable loopback mode
+ *
+ * @exception SocketException If an error occurs
+ *
+ * @since 1.4
+ */
+ public void setLoopbackMode(boolean disable) throws SocketException
+ {
+ if (impl == null)
+ throw new SocketException (
+ "MulticastSocket: Cant access socket implementation");
+
+ impl.setOption (SocketOptions.IP_MULTICAST_LOOP, new Boolean (disable));
+ }
+
+ /**
+ * Checks if local loopback mode is enabled or not
+ *
+ * @exception SocketException If an error occurs
+ *
+ * @since 1.4
+ */
+ public boolean getLoopbackMode() throws SocketException
+ {
+ Object obj = impl.getOption (SocketOptions.IP_MULTICAST_LOOP);
+
+ if (obj instanceof Boolean)
+ return ((Boolean) obj).booleanValue ();
+ else
+ throw new SocketException ("Unexpected type");
+ }
+
+ /**
+ * Sets the "Time to Live" value for a socket. The value must be between
+ * 1 and 255.
+ *
+ * @param ttl The new TTL value
+ *
+ * @exception IOException If an error occurs
+ *
+ * @deprecated 1.2 Replaced by <code>setTimeToLive</code>
+ *
+ * @see MulticastSocket:setTimeToLive
+ */
public void setTTL(byte ttl) throws IOException
{
// Use setTTL here rather than setTimeToLive in case we're using an impl
@@ -167,16 +284,16 @@ public class MulticastSocket extends DatagramSocket
impl.setTTL(ttl);
}
-/**
- * Sets the "Time to Live" value for a socket. The value must be between
- * 1 and 255.
- *
- * @param ttl The new TTL value
- *
- * @exception IOException If an error occurs
- *
- * @since Java 1.2
- */
+ /**
+ * Sets the "Time to Live" value for a socket. The value must be between
+ * 1 and 255.
+ *
+ * @param ttl The new TTL value
+ *
+ * @exception IOException If an error occurs
+ *
+ * @since 1.2
+ */
public void setTimeToLive(int ttl) throws IOException
{
if (ttl <= 0 || ttl > 255)
@@ -185,13 +302,15 @@ public class MulticastSocket extends DatagramSocket
impl.setTimeToLive(ttl);
}
-/**
- * Joins the specified mulitcast group.
- *
- * @param addr The address of the group to join
- *
- * @exception IOException If an error occurs
- */
+ /**
+ * Joins the specified mulitcast group.
+ *
+ * @param addr The address of the group to join
+ *
+ * @exception IOException If an error occurs
+ * @exception SecurityException If a security manager exists and its
+ * checkMulticast method doesn't allow the operation
+ */
public void joinGroup(InetAddress mcastaddr) throws IOException
{
if (! mcastaddr.isMulticastAddress())
@@ -204,13 +323,15 @@ public class MulticastSocket extends DatagramSocket
impl.join(mcastaddr);
}
-/**
- * Leaves the specified multicast group
- *
- * @param addr The address of the group to leave
- *
- * @exception IOException If an error occurs
- */
+ /**
+ * Leaves the specified multicast group
+ *
+ * @param addr The address of the group to leave
+ *
+ * @exception IOException If an error occurs
+ * @exception SecurityException If a security manager exists and its
+ * checkMulticast method doesn't allow the operation
+ */
public void leaveGroup(InetAddress mcastaddr) throws IOException
{
if (! mcastaddr.isMulticastAddress())
@@ -223,16 +344,86 @@ public class MulticastSocket extends DatagramSocket
impl.leave(mcastaddr);
}
-/**
- * Sends a packet of data to a multicast address with a TTL that is
- * different from the default TTL on this socket. The default TTL for
- * the socket is not changed.
- *
- * @param packet The packet of data to send
- * @param ttl The TTL for this packet
- *
- * @exception IOException If an error occurs
- */
+ /**
+ * Joins the specified mulitcast group on a specified interface.
+ *
+ * @param mcastaddr The multicast address to join
+ * @param netIf The local network interface to receive the multicast
+ * messages on or null to defer the interface set by #setInterface or
+ * #setNetworkInterface
+ *
+ * @exception IOException If an error occurs
+ * @exception IllegalArgumentException If address type is not supported
+ * @exception SecurityException If a security manager exists and its
+ * checkMulticast method doesn't allow the operation
+ *
+ * @see MulticastSocket:setInterface
+ * @see MulticastSocket:setNetworkInterface
+ *
+ * @since 1.4
+ */
+ public void joinGroup(SocketAddress mcastaddr, NetworkInterface netIf)
+ throws IOException
+ {
+ if (! (mcastaddr instanceof InetSocketAddress))
+ throw new IllegalArgumentException ("SocketAddress type not supported");
+
+ InetSocketAddress tmp = (InetSocketAddress) mcastaddr;
+
+ if (! tmp.getAddress ().isMulticastAddress ())
+ throw new IOException ("Not a Multicast address");
+
+ SecurityManager s = System.getSecurityManager ();
+ if (s != null)
+ s.checkMulticast (tmp.getAddress ());
+
+ impl.joinGroup (mcastaddr, netIf);
+ }
+
+ /**
+ * Leaves the specified mulitcast group on a specified interface.
+ *
+ * @param mcastaddr The multicast address to leave
+ * @param netIf The local networki interface or null to defer to the
+ * interface set by setInterface or setNetworkInterface
+ *
+ * @exception IOException If an error occurs
+ * @exception IllegalArgumentException If address type is not supported
+ * @exception SecurityException If a security manager exists and its
+ * checkMulticast method doesn't allow the operation
+ *
+ * @see MulticastSocket:setInterface
+ * @see MulticastSocket:setNetworkInterface
+ *
+ * @since 1.4
+ */
+ public void leaveGroup(SocketAddress mcastaddr, NetworkInterface netIf)
+ throws IOException
+ {
+ InetSocketAddress tmp = (InetSocketAddress) mcastaddr;
+
+ if (! tmp.getAddress ().isMulticastAddress ())
+ throw new IOException ("Not a Multicast address");
+
+ SecurityManager s = System.getSecurityManager ();
+ if (s != null)
+ s.checkMulticast (tmp.getAddress ());
+
+ impl.leaveGroup (mcastaddr, netIf);
+ }
+
+ /**
+ * Sends a packet of data to a multicast address with a TTL that is
+ * different from the default TTL on this socket. The default TTL for
+ * the socket is not changed.
+ *
+ * @param packet The packet of data to send
+ * @param ttl The TTL for this packet
+ *
+ * @exception IOException If an error occurs
+ * @exception SecurityException If a security manager exists and its
+ * checkConnect or checkMulticast method doesn't allow the operation
+ */
public synchronized void send(DatagramPacket p, byte ttl) throws IOException
{
SecurityManager s = System.getSecurityManager();
diff --git a/libjava/java/net/NetPermission.java b/libjava/java/net/NetPermission.java
index 14732dea49c..f5b625a0d6f 100644
--- a/libjava/java/net/NetPermission.java
+++ b/libjava/java/net/NetPermission.java
@@ -50,6 +50,8 @@ import java.security.BasicPermission;
public final class NetPermission extends BasicPermission
implements java.io.Serializable
{
+ static final long serialVersionUID = -8343910153355041693L;
+
/**
* Initializes a new instance of <code>NetPermission</code> with the
* specified name.
diff --git a/libjava/java/net/NetworkInterface.java b/libjava/java/net/NetworkInterface.java
new file mode 100644
index 00000000000..60a7d764cbc
--- /dev/null
+++ b/libjava/java/net/NetworkInterface.java
@@ -0,0 +1,237 @@
+/* NetworkInterface.java
+ Copyright (C) 2002 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 java.net;
+
+import java.util.Enumeration;
+import java.util.Vector;
+
+/**
+ * @author Michael Koch <konqueror@gmx.de>
+ * @since 1.4
+ */
+public final class NetworkInterface
+{
+ private static Vector networkInterfaces;
+
+ private String name;
+
+ private Vector inetAddresses;
+
+ private NetworkInterface (String name, InetAddress address)
+ {
+ this.name = name;
+ this.inetAddresses = new Vector (1, 1);
+ this.inetAddresses.add (address);
+ }
+
+ private native static Vector getRealNetworkInterfaces ()
+ throws SocketException;
+
+ /**
+ * Returns the name of the network interface
+ */
+ public String getName ()
+ {
+ return name;
+ }
+
+ /**
+ * Returns all available addresses of the network interface
+ *
+ * If a @see SecurityManager is available all addresses are checked
+ * with @see SecurityManager::checkConnect() if they are available.
+ * Only InetAddresses are returned where the security manager doesn't
+ * thrown an exception.
+ *
+ * @return An enumeration of all addresses.
+ */
+ public Enumeration getInetAddresses ()
+ {
+ SecurityManager s = System.getSecurityManager ();
+
+ if (s == null)
+ return inetAddresses.elements ();
+
+ Vector tmpInetAddresses = new Vector (1, 1);
+
+ for (Enumeration addresses = inetAddresses.elements ();
+ addresses.hasMoreElements (); )
+ {
+ InetAddress addr = (InetAddress) addresses.nextElement ();
+ try
+ {
+ s.checkConnect (addr.getHostAddress (), 58000);
+ tmpInetAddresses.add (addr);
+ }
+ catch (SecurityException e)
+ {
+ }
+ }
+
+ return tmpInetAddresses.elements ();
+ }
+
+ /**
+ * Returns the display name of the interface
+ */
+ public String getDisplayName ()
+ {
+ return name;
+ }
+
+ /**
+ * Returns an network interface by name
+ *
+ * @param name The name of the interface to return
+ *
+ * @exception SocketException If an error occurs
+ * @exception NullPointerException If the specified name is null
+ */
+ public static NetworkInterface getByName (String name)
+ throws SocketException
+ {
+ if (networkInterfaces == null)
+ networkInterfaces = getRealNetworkInterfaces ();
+
+ for (Enumeration e = networkInterfaces.elements ();
+ e.hasMoreElements (); )
+ {
+ NetworkInterface tmp = (NetworkInterface) e.nextElement ();
+
+ if (name.equals (tmp.getName ()))
+ return tmp;
+ }
+
+ throw new SocketException ("no network interface with this name exists");
+ }
+
+ /**
+ * Return a network interface by its address
+ *
+ * @param addr The address of the interface to return
+ *
+ * @exception SocketException If an error occurs
+ * @exception NullPointerException If the specified addess is null
+ */
+ public static NetworkInterface getByInetAddress (InetAddress addr)
+ throws SocketException
+ {
+ if (networkInterfaces == null)
+ networkInterfaces = getRealNetworkInterfaces ();
+
+ for (Enumeration interfaces = networkInterfaces.elements ();
+ interfaces.hasMoreElements (); )
+ {
+ NetworkInterface tmp = (NetworkInterface) interfaces.nextElement ();
+
+ for (Enumeration addresses = tmp.inetAddresses.elements ();
+ addresses.hasMoreElements (); )
+ {
+ if (addr.equals ((InetAddress) addresses.nextElement ()))
+ return tmp;
+ }
+ }
+
+ throw new SocketException (
+ "no network interface is bound to such an IP address");
+ }
+
+ /**
+ * Return an Enumeration of all available network interfaces
+ *
+ * @exception SocketException If an error occurs
+ */
+ public static Enumeration getNetworkInterfaces ()
+ throws SocketException
+ {
+ if (networkInterfaces == null)
+ networkInterfaces = getRealNetworkInterfaces ();
+
+ Enumeration tmp = networkInterfaces.elements ();
+ if (tmp.hasMoreElements ())
+ return tmp;
+
+ return null;
+ }
+
+ /**
+ * Checks if the current instance is equal to obj
+ *
+ * @param obj The object to compare with
+ */
+ public boolean equals (Object obj)
+ {
+ if (!(obj instanceof NetworkInterface))
+ return false;
+
+ NetworkInterface tmp = (NetworkInterface) obj;
+ return name.equals (tmp.name) &&
+ inetAddresses.equals (tmp.inetAddresses);
+ }
+
+ /**
+ * Returns the hashcode of the current instance
+ */
+ public int hashCode ()
+ {
+ // FIXME: hash correctly
+ return name.hashCode () + inetAddresses.hashCode ();
+ }
+
+ /**
+ * Returns a string representation of the interface
+ */
+ public String toString ()
+ {
+ // FIXME: check if this is correct
+ String result;
+ String separator = System.getProperty ("line.separator");
+
+ result = "name: " + getDisplayName () + " (" + getName () +
+ ") addresses:" + separator;
+
+ for (Enumeration e = inetAddresses.elements ();
+ e.hasMoreElements (); )
+ {
+ InetAddress address = (InetAddress) e.nextElement ();
+ result += address.toString () + separator;
+ }
+
+ return result;
+ }
+} // class NetworkInterface
diff --git a/libjava/java/net/PasswordAuthentication.java b/libjava/java/net/PasswordAuthentication.java
index e6d87a5431c..0c4faa54398 100644
--- a/libjava/java/net/PasswordAuthentication.java
+++ b/libjava/java/net/PasswordAuthentication.java
@@ -41,6 +41,7 @@ package java.net;
* This class serves a container for username/password pairs.
*
* @author Aaron M. Renn (arenn@urbanophile.com)
+ * @since 1.2
*/
public final class PasswordAuthentication
{
diff --git a/libjava/java/net/PlainDatagramSocketImpl.java b/libjava/java/net/PlainDatagramSocketImpl.java
index 55ea468dadc..118021d189f 100644
--- a/libjava/java/net/PlainDatagramSocketImpl.java
+++ b/libjava/java/net/PlainDatagramSocketImpl.java
@@ -1,6 +1,6 @@
// PlainDatagramSocketImpl.java - Implementation of DatagramSocketImpl.
-/* Copyright (C) 1999 Free Software Foundation
+/* Copyright (C) 1999, 2002 Free Software Foundation
This file is part of libgcj.
@@ -29,11 +29,17 @@ class PlainDatagramSocketImpl extends DatagramSocketImpl
static final int _Jv_TCP_NODELAY_ = SocketOptions.TCP_NODELAY,
_Jv_SO_BINDADDR_ = SocketOptions.SO_BINDADDR,
_Jv_SO_REUSEADDR_ = SocketOptions.SO_REUSEADDR,
- _Jv_IP_MULTICAST_IF_ = SocketOptions.IP_MULTICAST_IF,
+ _Jv_SO_BROADCAST_ = SocketOptions.SO_BROADCAST,
+ _Jv_SO_OOBINLINE_ = SocketOptions.SO_OOBINLINE,
+ _Jv_IP_MULTICAST_IF_ = SocketOptions.IP_MULTICAST_IF,
+ _Jv_IP_MULTICAST_IF2_ = SocketOptions.IP_MULTICAST_IF2,
+ _Jv_IP_MULTICAST_LOOP_ = SocketOptions.IP_MULTICAST_LOOP,
+ _Jv_IP_TOS_ = SocketOptions.IP_TOS,
_Jv_SO_LINGER_ = SocketOptions.SO_LINGER,
_Jv_SO_TIMEOUT_ = SocketOptions.SO_TIMEOUT,
_Jv_SO_SNDBUF_ = SocketOptions.SO_SNDBUF,
- _Jv_SO_RCVBUF_ = SocketOptions.SO_RCVBUF;
+ _Jv_SO_RCVBUF_ = SocketOptions.SO_RCVBUF,
+ _Jv_SO_KEEPALIVE_ = SocketOptions.SO_KEEPALIVE;
int fnum = -1;
@@ -57,16 +63,20 @@ class PlainDatagramSocketImpl extends DatagramSocketImpl
protected native void bind(int lport, InetAddress laddr)
throws SocketException;
+ protected native void connect (InetAddress i, int port)
+ throws SocketException;
+ protected native void disconnect ();
protected native void create() throws SocketException;
protected native int peek(InetAddress i) throws IOException;
+ protected native int peekData (DatagramPacket dp) throws IOException;
protected native void setTimeToLive(int ttl) throws IOException;
protected native int getTimeToLive() throws IOException;
protected native void send(DatagramPacket p) throws IOException;
protected native void receive(DatagramPacket p) throws IOException;
public native void setOption(int optID, Object value) throws SocketException;
public native Object getOption(int optID) throws SocketException;
- private native void mcastGrp(InetAddress inetaddr, boolean join)
- throws IOException;
+ private native void mcastGrp(InetAddress inetaddr, NetworkInterface netIf,
+ boolean join) throws IOException;
protected native void close();
// Deprecated in JDK 1.2.
@@ -83,12 +93,24 @@ class PlainDatagramSocketImpl extends DatagramSocketImpl
protected void join(InetAddress inetaddr) throws IOException
{
- mcastGrp(inetaddr, true);
+ mcastGrp(inetaddr, null, true);
}
protected void leave(InetAddress inetaddr) throws IOException
{
- mcastGrp(inetaddr, false);
+ mcastGrp(inetaddr, null, false);
+ }
+
+ protected void joinGroup (SocketAddress mcastaddr, NetworkInterface netIf)
+ throws IOException
+ {
+ mcastGrp(((InetSocketAddress)mcastaddr).getAddress(), netIf, true);
+ }
+
+ protected void leaveGroup (SocketAddress mcastaddr, NetworkInterface netIf)
+ throws IOException
+ {
+ mcastGrp(((InetSocketAddress)mcastaddr).getAddress(), netIf, false);
}
protected void finalize() throws Throwable
diff --git a/libjava/java/net/PlainSocketImpl.java b/libjava/java/net/PlainSocketImpl.java
index 354d652a5bf..788795d4c6a 100644
--- a/libjava/java/net/PlainSocketImpl.java
+++ b/libjava/java/net/PlainSocketImpl.java
@@ -9,8 +9,10 @@ Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
details. */
package java.net;
-import java.io.*;
+import java.io.InputStream;
+import java.io.IOException;
+import java.io.OutputStream;
/**
* The standard GCJ socket implementation.
@@ -28,11 +30,17 @@ class PlainSocketImpl extends SocketImpl
static final int _Jv_TCP_NODELAY_ = SocketOptions.TCP_NODELAY,
_Jv_SO_BINDADDR_ = SocketOptions.SO_BINDADDR,
_Jv_SO_REUSEADDR_ = SocketOptions.SO_REUSEADDR,
- _Jv_IP_MULTICAST_IF_ = SocketOptions.IP_MULTICAST_IF,
+ _Jv_SO_BROADCAST_ = SocketOptions.SO_BROADCAST,
+ _Jv_SO_OOBINLINE_ = SocketOptions.SO_OOBINLINE,
+ _Jv_IP_MULTICAST_IF_ = SocketOptions.IP_MULTICAST_IF,
+ _Jv_IP_MULTICAST_IF2_ = SocketOptions.IP_MULTICAST_IF2,
+ _Jv_IP_MULTICAST_LOOP_ = SocketOptions.IP_MULTICAST_LOOP,
+ _Jv_IP_TOS_ = SocketOptions.IP_TOS,
_Jv_SO_LINGER_ = SocketOptions.SO_LINGER,
_Jv_SO_TIMEOUT_ = SocketOptions.SO_TIMEOUT,
_Jv_SO_SNDBUF_ = SocketOptions.SO_SNDBUF,
- _Jv_SO_RCVBUF_ = SocketOptions.SO_RCVBUF;
+ _Jv_SO_RCVBUF_ = SocketOptions.SO_RCVBUF,
+ _Jv_SO_KEEPALIVE_ = SocketOptions.SO_KEEPALIVE;
/**
* The OS file handle representing the socket.
@@ -53,14 +61,23 @@ class PlainSocketImpl extends SocketImpl
public native Object getOption(int optID) throws SocketException;
+ public native void shutdownInput () throws IOException;
+
+ public native void shutdownOutput () throws IOException;
+
protected native void create (boolean stream) throws IOException;
protected void connect (String host, int port) throws IOException
{
- connect(InetAddress.getByName(host), port);
+ connect (new InetSocketAddress (InetAddress.getByName(host), port), 0);
+ }
+
+ protected void connect (InetAddress host, int port) throws IOException
+ {
+ connect (new InetSocketAddress (host, port), 0);
}
- protected native void connect (InetAddress host, int port)
+ protected native void connect (SocketAddress addr, int timeout)
throws IOException;
protected native void bind (InetAddress host, int port) throws IOException;
@@ -78,6 +95,8 @@ class PlainSocketImpl extends SocketImpl
protected native void close () throws IOException;
+ protected native void sendUrgentData(int data)
+ throws IOException;
// Stream handling.
diff --git a/libjava/java/net/ServerSocket.java b/libjava/java/net/ServerSocket.java
index f383c448e94..62917b6a8a5 100644
--- a/libjava/java/net/ServerSocket.java
+++ b/libjava/java/net/ServerSocket.java
@@ -38,6 +38,8 @@ exception statement from your version. */
package java.net;
import java.io.IOException;
+import java.nio.channels.IllegalBlockingModeException;
+import java.nio.channels.ServerSocketChannel;
/* Written using on-line Java Platform 1.2 API Specification.
* Status: I believe all methods are implemented.
@@ -49,7 +51,7 @@ import java.io.IOException;
* listens for and accepts connections. At that point the client and
* server sockets are ready to communicate with one another utilizing
* whatever application layer protocol they desire.
- * <p>
+ *
* As with the <code>Socket</code> class, most instance methods of this class
* simply redirect their calls to an implementation class.
*
@@ -58,16 +60,11 @@ import java.io.IOException;
*/
public class ServerSocket
{
-
- // Class Variables
-
/**
* This is the user defined SocketImplFactory, if one is supplied
*/
private static SocketImplFactory factory;
- // Instance Variables
-
/**
* This is the SocketImp object to which most instance methods in this
* class are redirected
@@ -75,14 +72,26 @@ public class ServerSocket
private SocketImpl impl;
/**
- * Private constructor that simply sets the implementation.
+ * ServerSocketChannel of this ServerSocket. This channel only exists
+ * when the socket is created by ServerSocketChannel.open().
*/
- private ServerSocket()
+ private ServerSocketChannel ch;
+
+ /**
+ * Constructor that simply sets the implementation.
+ *
+ * @exception IOException If an error occurs
+ *
+ * @specnote This constructor is public since JDK 1.4
+ */
+ public ServerSocket() throws IOException
{
if (factory != null)
impl = factory.createSocketImpl();
else
impl = new PlainSocketImpl();
+
+ impl.create(true);
}
/**
@@ -93,9 +102,11 @@ public class ServerSocket
* @param port The port number to bind to
*
* @exception IOException If an error occurs
+ * @exception SecurityException If a security manager exists and its
+ * checkListen method doesn't allow the operation
*/
public ServerSocket (int port)
- throws java.io.IOException
+ throws IOException
{
this(port, 50);
}
@@ -110,9 +121,11 @@ public class ServerSocket
* @param backlog The length of the pending connection queue
*
* @exception IOException If an error occurs
+ * @exception SecurityException If a security manager exists and its
+ * checkListen method doesn't allow the operation
*/
public ServerSocket (int port, int backlog)
- throws java.io.IOException
+ throws IOException
{
this(port, backlog, null);
}
@@ -129,11 +142,16 @@ public class ServerSocket
* @param bindAddr The address to bind to, or null to bind to all addresses
*
* @exception IOException If an error occurs
+ * @exception SecurityException If a security manager exists and its
+ * checkListen method doesn't allow the operation
+ *
+ * @since 1.1
*/
public ServerSocket (int port, int backlog, InetAddress bindAddr)
- throws java.io.IOException
+ throws IOException
{
this();
+
if (impl == null)
throw new IOException("Cannot initialize Socket implementation");
@@ -150,13 +168,69 @@ public class ServerSocket
}
/**
+ * Binds the server socket to a specified socket address
+ *
+ * @param endpoint The socket address to bind to
+ *
+ * @exception IOException If an error occurs
+ * @exception IllegalArgumentException If address type is not supported
+ * @exception SecurityException If a security manager exists and its
+ * checkListen method doesn't allow the operation
+ *
+ * @since 1.4
+ */
+ public void bind (SocketAddress endpoint)
+ throws IOException
+ {
+ bind (endpoint, 50);
+ }
+
+ /**
+ * Binds the server socket to a specified socket address
+ *
+ * @param endpoint The socket address to bind to
+ * @param backlog The length of the pending connection queue
+ *
+ * @exception IOException If an error occurs
+ * @exception IllegalArgumentException If address type is not supported
+ * @exception SecurityException If a security manager exists and its
+ * checkListen method doesn't allow the operation
+ *
+ * @since 1.4
+ */
+ public void bind (SocketAddress endpoint, int backlog) throws IOException
+ {
+ if (impl == null)
+ throw new IOException ("Cannot initialize Socket implementation");
+
+ if (! (endpoint instanceof InetSocketAddress))
+ throw new IllegalArgumentException ("Address type not supported");
+
+ InetSocketAddress tmp = (InetSocketAddress) endpoint;
+
+ SecurityManager s = System.getSecurityManager ();
+ if (s != null)
+ s.checkListen (tmp.getPort ());
+
+ impl.bind (tmp.getAddress (), tmp.getPort ());
+ impl.listen(backlog);
+ }
+
+ /**
* This method returns the local address to which this socket is bound
*
* @return The socket's local address
*/
public InetAddress getInetAddress()
{
- return impl.getInetAddress();
+ try
+ {
+ return (InetAddress) impl.getOption (SocketOptions.SO_BINDADDR);
+ }
+ catch (SocketException e)
+ {
+ return null;
+ }
}
/**
@@ -170,14 +244,42 @@ public class ServerSocket
}
/**
+ * Returns the local socket address
+ *
+ * @since 1.4
+ */
+ public SocketAddress getLocalSocketAddress()
+ {
+ InetAddress addr = getInetAddress();
+
+ if (addr != null)
+ return new InetSocketAddress (getInetAddress(), getLocalPort());
+
+ return null;
+ }
+
+ /**
* Accepts a new connection and returns a connected <code>Socket</code>
* instance representing that connection. This method will block until a
* connection is available.
*
* @exception IOException If an error occurs
+ * @exception SecurityException If a security manager exists and its
+ * checkListen method doesn't allow the operation
+ * @exception IllegalBlockingModeException If this socket has an associated
+ * channel, and the channel is in non-blocking mode
+ * @exception SocketTimeoutException If a timeout was previously set with
+ * setSoTimeout and the timeout has been reached
*/
- public Socket accept () throws IOException
+ public Socket accept () throws IOException
{
+ if (impl == null)
+ throw new IOException ("Cannot initialize Socket implementation");
+
+ SecurityManager sm = System.getSecurityManager ();
+ if (sm != null)
+ sm.checkListen (impl.getLocalPort ());
+
Socket s = new Socket();
implAccept (s);
@@ -192,9 +294,17 @@ public class ServerSocket
* @param socket The socket that is used for the accepted connection
*
* @exception IOException If an error occurs
+ * @exception IllegalBlockingModeException If this socket has an associated
+ * channel, and the channel is in non-blocking mode
+ *
+ * @since 1.1
*/
- protected final void implAccept (Socket s) throws IOException
+ protected final void implAccept (Socket s)
+ throws IOException
{
+ if (ch != null && !ch.isBlocking())
+ throw new IllegalBlockingModeException();
+
impl.accept(s.impl);
}
@@ -209,6 +319,50 @@ public class ServerSocket
}
/**
+ * Returns the unique ServerSocketChannel object
+ * associated with this socket, if any.
+ *
+ * The socket only has a ServerSocketChannel if its created
+ * by ServerSocketChannel.open.
+ *
+ * @since 1.4
+ */
+ public ServerSocketChannel getChannel()
+ {
+ return ch;
+ }
+
+ /**
+ * Returns true then the socket is bound, otherwise false
+ *
+ * @since 1.4
+ */
+ public boolean isBound()
+ {
+ try
+ {
+ Object bindaddr = impl.getOption (SocketOptions.SO_BINDADDR);
+ }
+ catch (SocketException e)
+ {
+ return false;
+ }
+
+ return true;
+ }
+
+ /**
+ * Returns true if the socket is closed, otherwise false
+ *
+ * @since 1.4
+ */
+ public boolean isClosed()
+ {
+ // FIXME: implement this
+ return false;
+ }
+
+ /**
* Sets the value of SO_TIMEOUT. A value of 0 implies that SO_TIMEOUT is
* disabled (ie, operations never time out). This is the number of
* milliseconds a socket operation can block before an
@@ -216,7 +370,9 @@ public class ServerSocket
*
* @param timeout The new SO_TIMEOUT value
*
- * @exception IOException If an error occurs
+ * @exception SocketException If an error occurs
+ *
+ * @since 1.1
*/
public void setSoTimeout (int timeout) throws SocketException
{
@@ -235,6 +391,8 @@ public class ServerSocket
* @return The value of SO_TIMEOUT
*
* @exception IOException If an error occurs
+ *
+ * @since 1.1
*/
public int getSoTimeout () throws IOException
{
@@ -247,13 +405,99 @@ public class ServerSocket
}
/**
+ * Enables/Disables the SO_REUSEADDR option
+ *
+ * @exception SocketException If an error occurs
+ *
+ * @since 1.4
+ */
+ public void setReuseAddress (boolean on)
+ throws SocketException
+ {
+ if (impl == null)
+ throw new SocketException ("Cannot initialize Socket implementation");
+
+ impl.setOption (SocketOptions.SO_REUSEADDR, new Boolean (on));
+ }
+
+ /**
+ * Checks if the SO_REUSEADDR option is enabled
+ *
+ * @exception SocketException If an error occurs
+ *
+ * @since 1.4
+ */
+ public boolean getReuseAddress()
+ throws SocketException
+ {
+ if (impl == null)
+ throw new SocketException ("Cannot initialize Socket implementation");
+
+ Object reuseaddr = impl.getOption (SocketOptions.SO_REUSEADDR);
+
+ if (!(reuseaddr instanceof Boolean))
+ throw new SocketException ("Internal Error");
+
+ return ((Boolean) reuseaddr).booleanValue ();
+ }
+
+ /**
+ * This method sets the value for the system level socket option
+ * SO_RCVBUF to the specified value. Note that valid values for this
+ * option are specific to a given operating system.
+ *
+ * @param size The new receive buffer size.
+ *
+ * @exception SocketException If an error occurs or Socket is not connected
+ * @exception IllegalArgumentException If size is 0 or negative
+ *
+ * @since 1.4
+ */
+ public void setReceiveBufferSize (int size)
+ throws SocketException
+ {
+ if (impl == null)
+ throw new SocketException ("Not connected");
+
+ if (size <= 0)
+ throw new IllegalArgumentException ("SO_RCVBUF value must be > 0");
+
+ impl.setOption (SocketOptions.SO_RCVBUF, new Integer (size));
+ }
+
+ /**
+ * This method returns the value of the system level socket option
+ * SO_RCVBUF, which is used by the operating system to tune buffer
+ * sizes for data transfers.
+ *
+ * @return The receive buffer size.
+ *
+ * @exception SocketException If an error occurs or Socket is not connected
+ *
+ * @since 1.4
+ */
+ public int getReceiveBufferSize ()
+ throws SocketException
+ {
+ if (impl == null)
+ throw new SocketException ("Not connected");
+
+ Object buf = impl.getOption (SocketOptions.SO_RCVBUF);
+
+ if (!(buf instanceof Integer))
+ throw new SocketException ("Internal Error: Unexpected type");
+
+ return ((Integer) buf).intValue ();
+ }
+
+ /**
* Returns the value of this socket as a <code>String</code>.
*
* @return This socket represented as a <code>String</code>.
*/
public String toString ()
{
- return "ServerSocket " + impl.toString();
+ return "ServerSocket" + impl.toString();
}
// Class methods
diff --git a/libjava/java/net/Socket.java b/libjava/java/net/Socket.java
index aa929b0b683..b900801a16b 100644
--- a/libjava/java/net/Socket.java
+++ b/libjava/java/net/Socket.java
@@ -38,6 +38,8 @@ exception statement from your version. */
package java.net;
import java.io.*;
+import java.nio.channels.SocketChannel;
+import java.nio.channels.IllegalBlockingModeException;
/* Written using on-line Java Platform 1.2 API Specification.
* Status: I believe all methods are implemented.
@@ -78,19 +80,29 @@ public class Socket
*/
SocketImpl impl;
+ private boolean inputShutdown;
+ private boolean outputShutdown;
+
+ SocketChannel ch; // this field must have been set if created by SocketChannel
+
// Constructors
/**
* Initializes a new instance of <code>Socket</code> object without
* connecting to a remote host. This useful for subclasses of socket that
* might want this behavior.
+ *
+ * @specnote This constructor is public since JDK 1.4
*/
- protected Socket ()
+ public Socket ()
{
if (factory != null)
impl = factory.createSocketImpl();
else
impl = new PlainSocketImpl();
+
+ inputShutdown = false;
+ outputShutdown = false;
}
/**
@@ -112,6 +124,8 @@ public class Socket
protected Socket (SocketImpl impl) throws SocketException
{
this.impl = impl;
+ this.inputShutdown = false;
+ this.outputShutdown = false;
}
/**
@@ -124,6 +138,8 @@ public class Socket
* @exception UnknownHostException If the hostname cannot be resolved to a
* network address.
* @exception IOException If an error occurs
+ * @exception SecurityException If a security manager exists and its
+ * checkConnect method doesn't allow the operation
*/
public Socket (String host, int port)
throws UnknownHostException, IOException
@@ -139,6 +155,8 @@ public class Socket
* @param port The port number to connect to
*
* @exception IOException If an error occurs
+ * @exception SecurityException If a security manager exists and its
+ * checkConnect method doesn't allow the operation
*/
public Socket (InetAddress address, int port)
throws IOException
@@ -178,6 +196,8 @@ public class Socket
* @param localPort The local port to connect to
*
* @exception IOException If an error occurs
+ * @exception SecurityException If a security manager exists and its
+ * checkConnect method doesn't allow the operation
*/
public Socket (InetAddress address, int port,
InetAddress localAddr, int localPort) throws IOException
@@ -197,6 +217,8 @@ public class Socket
* for a datagram socket
*
* @exception IOException If an error occurs
+ * @exception SecurityException If a security manager exists and its
+ * checkConnect method doesn't allow the operation
*
* @deprecated Use the <code>DatagramSocket</code> class to create
* datagram oriented sockets.
@@ -218,6 +240,8 @@ public class Socket
* <code>false</code> to create a datagram socket.
*
* @exception IOException If an error occurs
+ * @exception SecurityException If a security manager exists and its
+ * checkConnect method doesn't allow the operation
*
* @deprecated Use the <code>DatagramSocket</code> class to create
* datagram oriented sockets.
@@ -241,11 +265,16 @@ public class Socket
* @param stream true for a stream socket, false for a datagram socket
*
* @exception IOException If an error occurs
+ * @exception SecurityException If a security manager exists and its
+ * checkConnect method doesn't allow the operation
*/
private Socket(InetAddress raddr, int rport, InetAddress laddr, int lport,
boolean stream) throws IOException
{
this();
+ this.inputShutdown = false;
+ this.outputShutdown = false;
+
if (impl == null)
throw new IOException("Cannot initialize Socket implementation");
@@ -266,6 +295,78 @@ public class Socket
}
/**
+ * Binds the socket to the givent local address/port
+ *
+ * @param bindpoint The address/port to bind to
+ *
+ * @exception IOException If an error occurs
+ * @exception SecurityException If a security manager exists and its
+ * checkConnect method doesn't allow the operation
+ * @exception IllegalArgumentException If the address type is not supported
+ *
+ * @since 1.4
+ */
+ public void bind (SocketAddress bindpoint) throws IOException
+ {
+ if ( !(bindpoint instanceof InetSocketAddress))
+ throw new IllegalArgumentException ();
+
+ InetSocketAddress tmp = (InetSocketAddress) bindpoint;
+ impl.bind (tmp.getAddress(), tmp.getPort());
+ }
+
+ /**
+ * Connects the socket with a remote address.
+ *
+ * @param endpoint The address to connect to
+ *
+ * @exception IOException If an error occurs
+ * @exception IllegalArgumentException If the addess type is not supported
+ * @exception IllegalBlockingModeException If this socket has an associated
+ * channel, and the channel is in non-blocking mode
+ *
+ * @since 1.4
+ */
+ public void connect (SocketAddress endpoint)
+ throws IOException
+ {
+ if (! (endpoint instanceof InetSocketAddress))
+ throw new IllegalArgumentException ("Address type not supported");
+
+ if (ch != null && !ch.isBlocking ())
+ throw new IllegalBlockingModeException ();
+
+ impl.connect (endpoint, 0);
+ }
+
+ /**
+ * Connects the socket with a remote address. A timeout of zero is
+ * interpreted as an infinite timeout. The connection will then block
+ * until established or an error occurs.
+ *
+ * @param endpoint The address to connect to
+ *
+ * @exception IOException If an error occurs
+ * @exception IllegalArgumentException If the address type is not supported
+ * @exception IllegalBlockingModeException If this socket has an associated
+ * channel, and the channel is in non-blocking mode
+ * @exception SocketTimeoutException If the timeout is reached
+ *
+ * @since 1.4
+ */
+ public void connect (SocketAddress endpoint, int timeout)
+ throws IOException
+ {
+ if (! (endpoint instanceof InetSocketAddress))
+ throw new IllegalArgumentException ("Address type not supported");
+
+ if (ch != null && !ch.isBlocking ())
+ throw new IllegalBlockingModeException ();
+
+ impl.connect (endpoint, timeout);
+ }
+
+ /**
* Returns the address of the remote end of the socket. If this socket
* is not connected, then <code>null</code> is returned.
*
@@ -344,6 +445,36 @@ public class Socket
}
/**
+ * If the socket is already bound this returns the local SocketAddress,
+ * otherwise null
+ *
+ * @since 1.4
+ */
+ public SocketAddress getLocalSocketAddress()
+ {
+ InetAddress addr = getLocalAddress ();
+
+ if (addr == null)
+ return null;
+
+ return new InetSocketAddress (addr, impl.getLocalPort());
+ }
+
+ /**
+ * If the socket is already connected this returns the remote SocketAddress,
+ * otherwise null
+ *
+ * @since 1.4
+ */
+ public SocketAddress getRemoteSocketAddress()
+ {
+ if (!isConnected ())
+ return null;
+
+ return new InetSocketAddress (impl.getInetAddress (), impl.getPort ());
+ }
+
+ /**
* Returns an InputStream for reading from this socket.
*
* @return The InputStream object
@@ -424,6 +555,7 @@ public class Socket
* SO_LINGER not set.
*
* @exception SocketException If an error occurs or Socket not connected
+ * @exception IllegalArgumentException If linger is negative
*/
public void setSoLinger(boolean on, int linger) throws SocketException
{
@@ -473,6 +605,58 @@ public class Socket
}
/**
+ * Sends urgent data through the socket
+ *
+ * @param data The data to send.
+ * Only the lowest eight bits of data are sent
+ *
+ * @exception IOException If an error occurs
+ *
+ * @since 1.4
+ */
+ public void sendUrgentData (int data) throws IOException
+ {
+ impl.sendUrgentData (data);
+ }
+
+ /**
+ * Enables/disables the SO_OOBINLINE option
+ *
+ * @param on True if SO_OOBLINE should be enabled
+ *
+ * @exception SocketException If an error occurs
+ *
+ * @since 1.4
+ */
+ public void setOOBInline (boolean on) throws SocketException
+ {
+ if (impl == null)
+ throw new SocketException("Not connected");
+
+ impl.setOption(SocketOptions.SO_OOBINLINE, new Boolean(on));
+ }
+
+ /**
+ * Returns the current setting of the SO_OOBINLINE option for this socket
+ *
+ * @exception SocketException If an error occurs
+ *
+ * @since 1.4
+ */
+ public boolean getOOBInline () throws SocketException
+ {
+ if (impl == null)
+ throw new SocketException("Not connected");
+
+ Object buf = impl.getOption(SocketOptions.SO_OOBINLINE);
+
+ if (buf instanceof Boolean)
+ return(((Boolean)buf).booleanValue());
+ else
+ throw new SocketException("Internal Error: Unexpected type");
+ }
+
+ /**
* Sets the value of the SO_TIMEOUT option on the socket. If this value
* is set, and an read/write is performed that does not complete within
* the timeout period, a short count is returned (or an EWOULDBLOCK signal
@@ -533,8 +717,9 @@ public class Socket
* @param size The new send buffer size.
*
* @exception SocketException If an error occurs or Socket not connected
+ * @exception IllegalArgumentException If size is 0 or negative
*
- * @since Java 1.2
+ * @since 1.2
*/
public void setSendBufferSize (int size) throws SocketException
{
@@ -556,7 +741,7 @@ public class Socket
*
* @exception SocketException If an error occurs or socket not connected
*
- * @since Java 1.2
+ * @since 1.2
*/
public int getSendBufferSize () throws SocketException
{
@@ -579,8 +764,9 @@ public class Socket
* @param size The new receive buffer size.
*
* @exception SocketException If an error occurs or Socket is not connected
+ * @exception IllegalArgumentException If size is 0 or negative
*
- * @since Java 1.2
+ * @since 1.2
*/
public void setReceiveBufferSize (int size) throws SocketException
{
@@ -602,7 +788,7 @@ public class Socket
*
* @exception SocketException If an error occurs or Socket is not connected
*
- * @since Java 1.2
+ * @since 1.2
*/
public int getReceiveBufferSize () throws SocketException
{
@@ -618,6 +804,47 @@ public class Socket
}
/**
+ * This method sets the value for the socket level socket option
+ * SO_KEEPALIVE.
+ *
+ * @param on True if SO_KEEPALIVE should be enabled
+ *
+ * @exception SocketException If an error occurs or Socket is not connected
+ *
+ * @since Java 1.3
+ */
+ public void setKeepAlive (boolean on) throws SocketException
+ {
+ if (impl == null)
+ throw new SocketException("Not connected");
+
+ impl.setOption(SocketOptions.SO_KEEPALIVE, new Boolean(on));
+ }
+
+ /**
+ * This method returns the value of the socket level socket option
+ * SO_KEEPALIVE.
+ *
+ * @return The setting
+ *
+ * @exception SocketException If an error occurs or Socket is not connected
+ *
+ * @since Java 1.3
+ */
+ public boolean getKeepAlive () throws SocketException
+ {
+ if (impl == null)
+ throw new SocketException("Not connected");
+
+ Object buf = impl.getOption(SocketOptions.SO_KEEPALIVE);
+
+ if (buf instanceof Boolean)
+ return(((Boolean)buf).booleanValue());
+ else
+ throw new SocketException("Internal Error: Unexpected type");
+ }
+
+ /**
* Closes the socket.
*
* @exception IOException If an error occurs
@@ -667,4 +894,161 @@ public class Socket
factory = fac;
}
+
+ /**
+ * Closes the input side of the socket stream.
+ *
+ * @exception IOException If an error occurs.
+ */
+ public void shutdownInput() throws IOException
+ {
+ if (impl != null)
+ impl.shutdownInput();
+
+ inputShutdown = true;
+ }
+
+ /**
+ * Closes the output side of the socket stream.
+ *
+ * @exception IOException If an error occurs.
+ */
+ public void shutdownOutput() throws IOException
+ {
+ if (impl != null)
+ impl.shutdownOutput();
+
+ outputShutdown = true;
+ }
+
+ /**
+ * Returns the socket channel associated with this socket.
+ *
+ * It returns null if no associated socket exists.
+ */
+ public SocketChannel getChannel()
+ {
+ return ch;
+ }
+
+ /**
+ * Checks if the SO_REUSEADDR option is enabled
+ *
+ * @exception SocketException If an error occurs
+ *
+ * @since 1.4
+ */
+ public boolean getReuseAddress () throws SocketException
+ {
+ if (impl == null)
+ throw new SocketException ("Cannot initialize Socket implementation");
+
+ Object reuseaddr = impl.getOption (SocketOptions.SO_REUSEADDR);
+
+ if (!(reuseaddr instanceof Boolean))
+ throw new SocketException ("Internal Error");
+
+ return ((Boolean) reuseaddr).booleanValue ();
+ }
+
+ /**
+ * Enables/Disables the SO_REUSEADDR option
+ *
+ * @exception SocketException If an error occurs
+ *
+ * @since 1.4
+ */
+ public void setReuseAddress (boolean on) throws SocketException
+ {
+ if (impl == null)
+ throw new SocketException ("Cannot initialize Socket implementation");
+
+ impl.setOption (SocketOptions.SO_REUSEADDR, new Boolean (on));
+ }
+
+ /**
+ * Returns the current traffic class
+ *
+ * @exception SocketException If an error occurs
+ *
+ * @see Socket:setTrafficClass
+ *
+ * @since 1.4
+ */
+ public int getTrafficClass () throws SocketException
+ {
+ if (impl == null)
+ throw new SocketException ("Cannot initialize Socket implementation");
+
+ Object obj = impl.getOption(SocketOptions.IP_TOS);
+
+ if (obj instanceof Integer)
+ return ((Integer) obj).intValue ();
+ else
+ throw new SocketException ("Unexpected type");
+ }
+
+ /**
+ * Sets the traffic class value
+ *
+ * @param tc The traffic class
+ *
+ * @exception SocketException If an error occurs
+ * @exception IllegalArgumentException If tc value is illegal
+ *
+ * @see Socket:getTrafficClass
+ *
+ * @since 1.4
+ */
+ public void setTrafficClass (int tc) throws SocketException
+ {
+ if (impl == null)
+ throw new SocketException ("Cannot initialize Socket implementation");
+
+ if (tc < 0 || tc > 255)
+ throw new IllegalArgumentException();
+
+ impl.setOption (SocketOptions.IP_TOS, new Integer (tc));
+ }
+
+ /**
+ * Checks if the socket is connected
+ */
+ public boolean isConnected ()
+ {
+ return impl.getInetAddress () != null;
+ }
+
+ /**
+ * Checks if the socket is already bound.
+ */
+ public boolean isBound ()
+ {
+ return getLocalAddress () != null;
+ }
+
+ /**
+ * Checks if the socket is closed.
+ */
+ public boolean isClosed ()
+ {
+ // FIXME: implement this.
+ return false;
+ }
+
+ /**
+ * Checks if the socket's input stream is shutdown
+ */
+ public boolean isInputShutdown ()
+ {
+ return inputShutdown;
+ }
+
+ /**
+ * Checks if the socket's output stream is shutdown
+ */
+ public boolean isOutputShutdown ()
+ {
+ return outputShutdown;
+ }
}
diff --git a/libjava/java/net/SocketAddress.java b/libjava/java/net/SocketAddress.java
index d37020b8e71..370049d6fdc 100644
--- a/libjava/java/net/SocketAddress.java
+++ b/libjava/java/net/SocketAddress.java
@@ -37,18 +37,23 @@ exception statement from your version. */
package java.net;
-import java.io.*;
+import java.io.Serializable;
/**
* Abstract base class for InetSocketAddress.
* InetSocketAddress is to my knowledge the only derived
* class. [Ronald]
+ *
+ * @since 1.4
*/
-
public abstract class SocketAddress implements Serializable
{
- public SocketAddress()
- {
- }
+ static final long serialVersionUID = 5215720748342549866L;
+
+ /**
+ * Initializes the socket address.
+ */
+ public SocketAddress()
+ {
+ }
}
-
diff --git a/libjava/java/net/SocketImpl.java b/libjava/java/net/SocketImpl.java
index fb5a60ca520..795e7139bee 100644
--- a/libjava/java/net/SocketImpl.java
+++ b/libjava/java/net/SocketImpl.java
@@ -95,6 +95,8 @@ public abstract class SocketImpl implements SocketOptions
* if the stream parameter is false.
*
* @param stream true for a stream socket, false for a datagram socket
+ *
+ * @exception IOException If an error occurs
*/
protected abstract void create(boolean stream) throws IOException;
@@ -120,6 +122,21 @@ public abstract class SocketImpl implements SocketOptions
throws IOException;
/**
+ * Connects to the socket to the host specified in address. This
+ * method blocks until successful connected or the timeout occurs.
+ * A timeout of zero means no timout.
+ *
+ * @param address Data of remote host
+ * @param timeout time to wait to stop connecting
+ *
+ * @exception IOException If an error occurs
+ *
+ * @since 1.4
+ */
+ protected abstract void connect(SocketAddress address, int timeout)
+ throws IOException;
+
+ /**
* Binds to the specified port on the specified addr. Note that this addr
* must represent a local IP address.
* <p>
@@ -215,6 +232,31 @@ public abstract class SocketImpl implements SocketOptions
protected int getPort() { return port; }
/**
+ * Returns true or false when this socket supports sending urgent data
+ * or not.
+ *
+ * @since 1.4
+ */
+ protected boolean supportsUrgentData()
+ {
+ // This method has to be overwritten by socket classes that support
+ // sending urgend data.
+ return false;
+ }
+
+ /**
+ * Sends one byte of urgent data to the socket.
+ *
+ * @param data The byte to send, the low eight bits of it
+ *
+ * @exception IOException If an error occurs
+ *
+ * @since 1.4
+ */
+ protected abstract void sendUrgentData(int data)
+ throws IOException;
+
+ /**
* Returns the local port this socket is bound to
*
* @return The local port
@@ -264,4 +306,20 @@ public abstract class SocketImpl implements SocketOptions
* @XXX This redeclaration from SocketOptions is a workaround to a gcj bug.
*/
public abstract Object getOption(int option_id) throws SocketException;
+
+ /**
+ * Shut down the input side of this socket. Subsequent reads will
+ * return end-of-file.
+ *
+ * @exception IOException if an error occurs
+ */
+ protected abstract void shutdownInput () throws IOException;
+
+ /**
+ * Shut down the output side of this socket. Subsequent writes will
+ * fail with an IOException.
+ *
+ * @exception IOException if an error occurs
+ */
+ protected abstract void shutdownOutput () throws IOException;
}
diff --git a/libjava/java/net/SocketOptions.java b/libjava/java/net/SocketOptions.java
index 7dcba2a67a6..f62afef9aab 100644
--- a/libjava/java/net/SocketOptions.java
+++ b/libjava/java/net/SocketOptions.java
@@ -1,5 +1,5 @@
/* SocketOptions.java -- Implements options for sockets (duh!)
- Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -43,104 +43,125 @@ package java.net;
*/
/**
- * This interface is used by <code>SocketImpl</code> and
- * <code>DatagramSocketImpl</code> to implement options
- * on sockets.
- *
- * @since 1.2
- *
- * @author Aaron M. Renn (arenn@urbanophile.com)
- * @author Warren Levy <warrenl@cygnus.com>
- */
+ * This interface is used by <code>SocketImpl</code> and
+ * <code>DatagramSocketImpl</code> to implement options
+ * on sockets.
+ *
+ * @since 1.2
+ *
+ * @author Aaron M. Renn (arenn@urbanophile.com)
+ * @author Warren Levy <warrenl@cygnus.com>
+ * @status should be completely JDK 1.4 compatible
+ */
public interface SocketOptions
{
-
-/*************************************************************************/
-
-/*
- * Static Variables
- */
-
-/**
- * Option id for the SO_LINGER value
- */
-static final int SO_LINGER = 0x80; // 128
-
-/**
- * Option id for the SO_TIMEOUT value
- */
-static final int SO_TIMEOUT = 0x1006; // 4102
-
-/**
- * Retrieve the local address to which the socket is bound.
- */
-static final int SO_BINDADDR = 0x0F; // 15
-
-/**
- * Option id for the send buffer size
- * @since 1.2
- */
-static final int SO_SNDBUF = 0x1001; // 4097
-
-/**
- * Option id for the receive buffer size
- * @since 1.2
- */
-static final int SO_RCVBUF = 0x1002; // 4098
-
-/**
- * Sets the SO_REUSEADDR parameter on a socket
- */
-static final int SO_REUSEADDR = 0x04; // 4
-
-/**
- * Option id for the TCP_NODELAY value
- */
-static final int TCP_NODELAY = 0x01; // 1
-
-/**
- * Options id for the IP_MULTICAST_IF value
- */
-static final int IP_MULTICAST_IF = 0x10; // 16
-
-/*************************************************************************/
-
-/*
- * Interface Methods
- */
-
-/**
- * Sets the specified option on a socket to the passed in object. For
- * options that take an integer argument, the passed in object is an
- * <code>Integer</code>. For options that are set to on or off, the
- * value passed will be a <code>Boolean</code>. The <code>option_id</code>
- * parameter is one of the defined constants in this interface.
- *
- * @param option_id The identifier of the option
- * @param val The value to set the option to
- *
- * @exception SocketException If an error occurs
- */
-void
-setOption(int option_id, Object val) throws SocketException;
-
-/*************************************************************************/
-
-/**
- * Returns the current setting of the specified option. The
- * <code>Object</code> returned will be an <code>Integer</code> for options
- * that have integer values. For options that are set to on or off, a
- * <code>Boolean</code> will be returned. The <code>option_id</code>
- * is one of the defined constants in this interface.
- *
- * @param option_id The option identifier
- *
- * @return The current value of the option
- *
- * @exception SocketException If an error occurs
- */
-Object
-getOption(int option_id) throws SocketException;
+ /**
+ * Option id for the SO_KEEPALIVE value
+ * @since 1.3
+ */
+ static final int SO_KEEPALIVE = 0x8;
+
+ /**
+ * Option id for the SO_LINGER value
+ */
+ static final int SO_LINGER = 0x80; // 128
+
+ /**
+ * Option id for the SO_TIMEOUT value
+ */
+ static final int SO_TIMEOUT = 0x1006; // 4102
+
+ /**
+ * Retrieve the local address to which the socket is bound.
+ */
+ static final int SO_BINDADDR = 0x0F; // 15
+
+ /**
+ * Option id for the send buffer size
+ * @since 1.2
+ */
+ static final int SO_SNDBUF = 0x1001; // 4097
+
+ /**
+ * Option id for the receive buffer size
+ * @since 1.2
+ */
+ static final int SO_RCVBUF = 0x1002; // 4098
+
+ /**
+ * Sets the SO_REUSEADDR parameter on a socket
+ */
+ static final int SO_REUSEADDR = 0x04; // 4
+
+ /**
+ * Sets SO_BROADCAST for a socket
+ * @since 1.4
+ */
+ static final int SO_BROADCAST = 0x20; // 32
+
+ /**
+ * Sets SO_OOBINLINE for a socket
+ * @since 1.4
+ */
+ static final int SO_OOBINLINE = 0x1003; // 4099
+
+ /**
+ * Option id for the TCP_NODELAY value
+ */
+ static final int TCP_NODELAY = 0x01; // 1
+
+ /**
+ * Options id for the IP_MULTICAST_IF value
+ */
+ static final int IP_MULTICAST_IF = 0x10; // 16
+
+ /**
+ * same as above
+ * @since 1.4
+ */
+ static final int IP_MULTICAST_IF2 = 0x1F; // 31
+
+ /**
+ * This option enables or disables local loopback of multicast datagrams.
+ * @since 1.4
+ */
+ static final int IP_MULTICAST_LOOP = 0x12; // 18
+
+ /**
+ * This option sets the type-of-service or traffic class field in the
+ * IP header for a TCP or UDP socket.
+ * @since 1.4
+ */
+ static final int IP_TOS = 0x03; // 3
+
+ /**
+ * Sets the specified option on a socket to the passed in object. For
+ * options that take an integer argument, the passed in object is an
+ * <code>Integer</code>. For options that are set to on or off, the
+ * value passed will be a <code>Boolean</code>. The <code>option_id</code>
+ * parameter is one of the defined constants in this interface.
+ *
+ * @param option_id The identifier of the option
+ * @param val The value to set the option to
+ *
+ * @exception SocketException If an error occurs
+ */
+ void setOption(int option_id, Object val) throws SocketException;
+
+ /**
+ * Returns the current setting of the specified option. The
+ * <code>Object</code> returned will be an <code>Integer</code> for options
+ * that have integer values. For options that are set to on or off, a
+ * <code>Boolean</code> will be returned. The <code>option_id</code>
+ * is one of the defined constants in this interface.
+ *
+ * @param option_id The option identifier
+ *
+ * @return The current value of the option
+ *
+ * @exception SocketException If an error occurs
+ */
+ Object getOption(int option_id) throws SocketException;
} // interface SocketOptions
diff --git a/libjava/java/net/SocketPermission.java b/libjava/java/net/SocketPermission.java
index 8aa453e5f17..0f41395f36a 100644
--- a/libjava/java/net/SocketPermission.java
+++ b/libjava/java/net/SocketPermission.java
@@ -37,6 +37,7 @@ exception statement from your version. */
package java.net;
+import java.io.Serializable;
import java.security.Permission;
import java.security.PermissionCollection;
@@ -87,7 +88,8 @@ import java.security.PermissionCollection;
* SocketPermission("www.urbanophile.com:80", "connect,accept");
* Can connect to or accept connections from www.urbanophile.com on port 80
* SocketPermission("localhost:1024-", "listen,accept,connect");
- * Can connect to, accept from, an listen on any local port number 1024 and up.
+ * Can connect to, accept from, an listen on any local port number 1024
+ * and up.
* SocketPermission("*.edu", "connect");
* Can connect to any host in the edu domain
* SocketPermission("197.197.20.1", "accept");
@@ -99,8 +101,9 @@ import java.security.PermissionCollection;
* @author Aaron M. Renn (arenn@urbanophile.com)
*/
public final class SocketPermission extends Permission
- implements java.io.Serializable
+ implements Serializable
{
+ static final long serialVersionUID = -7204263841984476862L;
// FIXME: Needs serialization work, including readObject/writeObject methods.
/**
@@ -118,7 +121,7 @@ public final class SocketPermission extends Permission
* specified host/port combination and actions string.
*
* @param hostport The hostname/port number combination
- * @param perms The actions string
+ * @param actions The actions string
*/
public SocketPermission(String hostport, String actions)
{
@@ -241,7 +244,8 @@ public final class SocketPermission extends Permission
* <p><ul>
* <li>The argument's hostname or IP address is equal to this object's.
* <li>The argument's canonical hostname is equal to this object's.
- * <li>The argument's canonical name matches this domains hostname with wildcards
+ * <li>The argument's canonical name matches this domains hostname with
+ * wildcards
* </ul>
*
* @param perm The Permission to check against
diff --git a/libjava/java/net/URI.java b/libjava/java/net/URI.java
new file mode 100644
index 00000000000..e84ac5d0cd6
--- /dev/null
+++ b/libjava/java/net/URI.java
@@ -0,0 +1,433 @@
+/* URI.java - An URI class
+ Copyright (C) 2002 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 java.net;
+
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.Serializable;
+
+/**
+ * @author Michael Koch <konqueror@gmx.de>
+ * @since 1.4
+ */
+public final class URI
+ implements Comparable, Serializable
+{
+ static final long serialVersionUID = -6052424284110960213L;
+
+ String string;
+ private String scheme;
+ private String schemeSpecificPart;
+ private String authority;
+ private String userInfo;
+ private String host;
+ private int port;
+ private String path;
+ private String query;
+ private String fragment;
+
+ private void readObject (ObjectInputStream is)
+ throws ClassNotFoundException, IOException
+ {
+ }
+
+ private void writeObject (ObjectOutputStream is)
+ throws IOException
+ {
+ }
+
+ private void parseURI (String str)
+ throws URISyntaxException
+ {
+ }
+
+ /**
+ * Creates an URI from the given string
+ *
+ * @param str The string to create the URI from
+ *
+ * @exception URISyntaxException If the given string violates RFC 2396
+ * @exception NullPointerException If str is null
+ */
+ public URI (String str)
+ throws URISyntaxException
+ {
+ }
+
+ /**
+ * Create an URI from the given components
+ *
+ * @param scheme The scheme name
+ * @param userInfo The username and authorization info
+ * @param host The hostname
+ * @param port The port number
+ * @param path The path
+ * @param query The query
+ * @param fragment The fragment
+ *
+ * @exception URISyntaxException If the given string violates RFC 2396
+ */
+ public URI (String scheme, String userInfo, String host, int port,
+ String path, String query, String fragment)
+ throws URISyntaxException
+ {
+ }
+
+ /**
+ * Create an URI from the given components
+ *
+ * @param scheme The scheme name
+ * @param authority The authority
+ * @param path The apth
+ * @param query The query
+ * @param fragment The fragmen
+ *
+ * @exception URISyntaxException If the given string violates RFC 2396
+ */
+ public URI (String scheme, String authority, String path, String query,
+ String fragment)
+ throws URISyntaxException
+ {
+ }
+
+ /**
+ * Create an URI from the given components
+ *
+ * @param scheme The scheme name
+ * @param host The hostname
+ * @param path The path
+ * @param fragment The fragment
+ *
+ * @exception URISyntaxException If the given string violates RFC 2396
+ */
+ public URI (String scheme, String host, String path, String fragment)
+ throws URISyntaxException
+ {
+ }
+
+ /**
+ * Create an URI from the given components
+ *
+ * @param scheme The scheme name
+ * @param ssp The scheme specific part
+ * @param fragment The fragment
+ *
+ * @exception URISyntaxException If the given string violates RFC 2396
+ */
+ public URI (String scheme, String ssp, String fragment)
+ throws URISyntaxException
+ {
+ }
+
+ /**
+ * Create an URI from the given string
+ *
+ * @param str The string to create the URI from
+ *
+ * @exception IllegalArgumentException If the given string violates RFC 2396
+ * @exception NullPointerException If str is null
+ */
+ public static URI create (String str)
+ throws IllegalArgumentException, URISyntaxException
+ {
+ return null;
+ }
+
+ /**
+ * Attempts to parse this URI's authority component, if defined,
+ * into user-information, host, and port components
+ *
+ * @exception URISyntaxException If the given string violates RFC 2396
+ */
+ public URI parseServerAuthority ()
+ throws URISyntaxException
+ {
+ return null;
+ }
+
+ /**
+ * Returns a normalizes versions of the URI
+ */
+ public URI normalize ()
+ {
+ return null;
+ }
+
+ /**
+ * Resolves the given URI against this URI
+ *
+ * @param uri The URI to resolve against this URI
+ *
+ * @return The resulting URI
+ *
+ * @exception NullPointerException If uri is null
+ */
+ public URI resolve (URI uri)
+ {
+ return null;
+ }
+
+ /**
+ * Resolves the given URI string against this URI
+ *
+ * @param str The URI as string to resolve against this URI
+ *
+ * @return The resulting URI
+ *
+ * @exception IllegalArgumentException If the given URI string
+ * violates RFC 2396
+ * @exception NullPointerException If uri is null
+ */
+ public URI resolve (String str)
+ throws IllegalArgumentException
+ {
+ return null;
+ }
+
+ /**
+ * Relativizes the given URI against this URI
+ *
+ * @param uri The URI to relativize this URI
+ *
+ * @return The resulting URI
+ *
+ * @exception NullPointerException If uri is null
+ */
+ public URI relativize (URI uri)
+ {
+ return null;
+ }
+
+ /**
+ * Creates an URL from an URI
+ *
+ * @exception MalformedURLException If a protocol handler for the URL could
+ * not be found, or if some other error occurred while constructing the URL
+ * @exception IllegalArgumentException If the URI is not absolute
+ */
+ public URL toURL ()
+ throws IllegalArgumentException, MalformedURLException
+ {
+ return null;
+ }
+
+ /**
+ * Returns the scheme of the URI
+ */
+ public String getScheme ()
+ {
+ return scheme;
+ }
+
+ /**
+ * Tells whether this URI is absolute or not
+ */
+ public boolean isAbsolute ()
+ {
+ return false;
+ }
+
+ /**
+ * Tell whether this URI is opaque or not
+ */
+ public boolean isOpaque ()
+ {
+ return false;
+ }
+
+ /**
+ * Returns the raw scheme specific part of this URI.
+ * The scheme-specific part is never undefined, though it may be empty
+ */
+ public String getRawSchemeSpecificPart ()
+ {
+ return null;
+ }
+
+ /**
+ * Returns the decoded scheme specific part of this URI.
+ */
+ public String getSchemeSpecificPart ()
+ {
+ return null;
+ }
+
+ /**
+ * Returns the rae authority part of this URI
+ */
+ public String getRawAuthority ()
+ {
+ return authority;
+ }
+
+ /**
+ * Returns the decoded authority part of this URI
+ */
+ public String getAuthority ()
+ {
+ return null;
+ }
+
+ /**
+ * Returns the raw user info part of this URI
+ */
+ public String getRawUserInfo ()
+ {
+ return userInfo;
+ }
+
+ /**
+ * Returns the decoded user info part of this URI
+ */
+ public String getUserInfo ()
+ {
+ return null;
+ }
+
+ /**
+ * Returns the hostname of the URI
+ */
+ public String getHost ()
+ {
+ return host;
+ }
+
+ /**
+ * Returns the port number of the URI
+ */
+ public int getPort ()
+ {
+ return port;
+ }
+
+ /**
+ * Returns the raw path part of this URI
+ */
+ public String getRawPath ()
+ {
+ return path;
+ }
+
+ /**
+ * Returns the path of the URI
+ */
+ public String getPath ()
+ {
+ return null;
+ }
+
+ /**
+ * Returns the raw query part of this URI
+ */
+ public String getRawQuery ()
+ {
+ return query;
+ }
+
+ /**
+ * Returns the query of the URI
+ */
+ public String getQuery ()
+ {
+ return null;
+ }
+
+ /**
+ * Return the raw fragment part of this URI
+ */
+ public String getRawFragment ()
+ {
+ return fragment;
+ }
+
+ /**
+ * Returns the fragment of the URI
+ */
+ public String getFragment ()
+ {
+ return null;
+ }
+
+ /**
+ * Compares the URI with a given object
+ *
+ * @param obj The obj to compare the URI with
+ */
+ public boolean equals(Object obj)
+ {
+ return false;
+ }
+
+ /**
+ * Computes the hascode of the URI
+ */
+ public int hashCode ()
+ {
+ return 0;
+ }
+
+ /**
+ * Compare the URI with another object that must be an URI too
+ *
+ * @param obj This object to compare this URI with
+ *
+ * @exception ClassCastException If given object ist not an URI
+ */
+ public int compareTo (Object obj)
+ throws ClassCastException
+ {
+ return 0;
+ }
+
+ /**
+ * Returns the URI as string
+ */
+ public String toString ()
+ {
+ return "";
+ }
+
+ /**
+ * Returns the URI as US-ASCII string
+ */
+ public String toASCIIString ()
+ {
+ return "";
+ }
+}
diff --git a/libjava/java/net/URL.java b/libjava/java/net/URL.java
index a3e9d784cef..98e7d5f7c31 100644
--- a/libjava/java/net/URL.java
+++ b/libjava/java/net/URL.java
@@ -1,86 +1,252 @@
-// URL.java - A Uniform Resource Locator.
+/* URL.java -- Uniform Resource Locator Class
+ Copyright (C) 1998, 1999, 2000, 2002 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. */
-/* Copyright (C) 1999, 2000, 2002 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. */
package java.net;
-import java.io.*;
+import java.io.InputStream;
+import java.io.IOException;
+import java.io.Serializable;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
import java.util.Hashtable;
import java.util.StringTokenizer;
-/**
- * @author Warren Levy <warrenl@cygnus.com>
- * @date March 4, 1999.
- */
-/**
+/*
* Written using on-line Java Platform 1.2 API Specification, as well
* as "The Java Class Libraries", 2nd edition (Addison-Wesley, 1998).
* Status: Believed complete and correct.
*/
+/**
+ * This final class represents an Internet Uniform Resource Locator (URL).
+ * For details on the syntax of URL's and what they can be used for,
+ * refer to RFC 1738, available from <a
+ * href="http://ds.internic.net/rfcs/rfc1738.txt">http://ds.internic.net/rfcs/rfc1738.txt</a>
+ * <p>
+ * There are a great many protocols supported by URL's such as "http",
+ * "ftp", and "file". This object can handle any arbitrary URL for which
+ * a URLStreamHandler object can be written. Default protocol handlers
+ * are provided for the "http" and "ftp" protocols. Additional protocols
+ * handler implementations may be provided in the future. In any case,
+ * an application or applet can install its own protocol handlers that
+ * can be "chained" with other protocol hanlders in the system to extend
+ * the base functionality provided with this class. (Note, however, that
+ * unsigned applets cannot access properties by default or install their
+ * own protocol handlers).
+ * <p>
+ * This chaining is done via the system property java.protocol.handler.pkgs
+ * If this property is set, it is assumed to be a "|" separated list of
+ * package names in which to attempt locating protocol handlers. The
+ * protocol handler is searched for by appending the string
+ * ".<protocol>.Handler" to each packed in the list until a hander is found.
+ * If a protocol handler is not found in this list of packages, or if the
+ * property does not exist, then the default protocol handler of
+ * "gnu.java.net.<protocol>.Handler" is tried. If this is
+ * unsuccessful, a MalformedURLException is thrown.
+ * <p>
+ * All of the constructor methods of URL attempt to load a protocol
+ * handler and so any needed protocol handlers must be installed when
+ * the URL is constructed.
+ * <p>
+ * Here is an example of how URL searches for protocol handlers. Assume
+ * the value of java.protocol.handler.pkgs is "com.foo|com.bar" and the
+ * URL is "news://comp.lang.java.programmer". URL would looking the
+ * following places for protocol handlers:
+ * <p><pre>
+ * com.foo.news.Handler
+ * com.bar.news.Handler
+ * gnu.java.net.news.Handler
+ * </pre><p>
+ * If the protocol handler is not found in any of those locations, a
+ * MalformedURLException would be thrown.
+ * <p>
+ * Please note that a protocol handler must be a subclass of
+ * URLStreamHandler.
+ *
+ * @author Aaron M. Renn (arenn@urbanophile.com)
+ * @author Warren Levy <warrenl@cygnus.com>
+ *
+ * @see URLStreamHandler
+ */
public final class URL implements Serializable
{
+ /**
+ * The name of the protocol for this URL.
+ * The protocol is always stored in lower case.
+ */
private String protocol;
+
+ /**
+ * The "authority" portion of the URL.
+ */
+ private String authority;
+
+ /**
+ * The hostname or IP address of this protocol.
+ * This includes a possible user. For example <code>joe@some.host.net</code>.
+ */
private String host;
+
+ /**
+ * The port number of this protocol or -1 if the port number used is
+ * the default for this protocol.
+ */
private int port = -1; // Initialize for constructor using context.
+
+ /**
+ * The "file" portion of the URL. It is defined as <code>path[?query]</code>.
+ */
private String file;
+
+ /**
+ * The anchor portion of the URL.
+ */
private String ref;
+
+ /**
+ * This is the hashCode for this URL
+ */
private int hashCode = 0;
+
+ /**
+ * The protocol handler in use for this URL
+ */
transient private URLStreamHandler handler;
+
+ /**
+ * This a table where we cache protocol handlers to avoid the overhead
+ * of looking them up each time.
+ */
private static Hashtable handlers = new Hashtable();
+
+ /**
+ * If an application installs its own protocol handler factory, this is
+ * where we keep track of it.
+ */
private static URLStreamHandlerFactory factory;
private static final long serialVersionUID = -7627629688361524110L;
+ /**
+ * Constructs a URL and loads a protocol handler for the values passed as
+ * arguments.
+ *
+ * @param protocol The protocol for this URL ("http", "ftp", etc)
+ * @param host The hostname or IP address to connect to
+ * @param port The port number to use, or -1 to use the protocol's
+ * default port
+ * @param file The "file" portion of the URL.
+ *
+ * @exception MalformedURLException If a protocol handler cannot be loaded or
+ * a parse error occurs.
+ */
public URL(String protocol, String host, int port, String file)
throws MalformedURLException
{
this(protocol, host, port, file, null);
}
+ /**
+ * Constructs a URL and loads a protocol handler for the values passed in
+ * as arugments. Uses the default port for the protocol.
+ *
+ * @param protocol The protocol for this URL ("http", "ftp", etc)
+ * @param host The hostname or IP address for this URL
+ * @param file The "file" portion of this URL.
+ *
+ * @exception MalformedURLException If a protocol handler cannot be loaded or
+ * a parse error occurs.
+ */
public URL(String protocol, String host, String file)
throws MalformedURLException
{
this(protocol, host, -1, file, null);
}
- // JDK1.2
+
+ /**
+ * This method initializes a new instance of <code>URL</code> with the
+ * specified protocol, host, port, and file. Additionally, this method
+ * allows the caller to specify a protocol handler to use instead of
+ * the default. If this handler is specified, the caller must have
+ * the "specifyStreamHandler" permission (see <code>NetPermission</code>)
+ * or a <code>SecurityException</code> will be thrown.
+ *
+ * @param protocol The protocol for this URL ("http", "ftp", etc)
+ * @param host The hostname or IP address to connect to
+ * @param port The port number to use, or -1 to use the protocol's default
+ * port
+ * @param file The "file" portion of the URL.
+ * @param handler The protocol handler to use with this URL.
+ *
+ * @exception MalformedURLException If no protocol handler can be loaded
+ * for the specified protocol.
+ * @exception SecurityException If the <code>SecurityManager</code> exists
+ * and does not allow the caller to specify its own protocol handler.
+ *
+ * @since 1.2
+ */
public URL(String protocol, String host, int port, String file,
URLStreamHandler handler) throws MalformedURLException
{
if (protocol == null)
throw new MalformedURLException("null protocol");
- this.protocol = protocol;
+ this.protocol = protocol.toLowerCase();
if (handler != null)
{
- // TODO12: Need SecurityManager.checkPermission and
- // TODO12: java.net.NetPermission from JDK 1.2 to be implemented.
- // Throw an exception if an extant security mgr precludes
- // specifying a StreamHandler.
- //
- // SecurityManager s = System.getSecurityManager();
- // if (s != null)
- // s.checkPermission(NetPermission("specifyStreamHandler"));
+ SecurityManager s = System.getSecurityManager();
+ if (s != null)
+ s.checkPermission (new NetPermission ("specifyStreamHandler"));
this.handler = handler;
}
else
- this.handler = setURLStreamHandler(protocol);
+ this.handler = getURLStreamHandler(protocol);
if (this.handler == null)
- throw new MalformedURLException("Protocol handler not found: " + protocol);
+ throw new MalformedURLException (
+ "Protocol handler not found: " + protocol);
this.host = host;
-
this.port = port;
+ this.authority = null;
int hashAt = file.indexOf('#');
if (hashAt < 0)
@@ -96,17 +262,72 @@ public final class URL implements Serializable
hashCode = hashCode(); // Used for serialization.
}
+ /**
+ * Initializes a URL from a complete string specification such as
+ * "http://www.urbanophile.com/arenn/". First the protocol name is parsed
+ * out of the string. Then a handler is located for that protocol and
+ * the parseURL() method of that protocol handler is used to parse the
+ * remaining fields.
+ *
+ * @param spec The complete String representation of a URL
+ *
+ * @exception MalformedURLException If a protocol handler cannot be found
+ * or the URL cannot be parsed
+ */
public URL(String spec) throws MalformedURLException
{
this((URL) null, spec, (URLStreamHandler) null);
}
+ /*
+ * This method parses a String representation of a URL within the
+ * context of an existing URL. Principally this means that any
+ * fields not present the URL are inheritied from the context URL.
+ * This allows relative URL's to be easily constructed. If the
+ * context argument is null, then a complete URL must be specified
+ * in the URL string. If the protocol parsed out of the URL is
+ * different from the context URL's protocol, then then URL String
+ * is also expected to be a complete URL.
+ *
+ * @param context The context on which to parse the specification
+ * @param spec The string to parse an URL
+ *
+ * @exception MalformedURLException If a protocol handler cannot be found
+ * for the URL cannot be parsed
+ */
public URL(URL context, String spec) throws MalformedURLException
{
this(context, spec, (URLStreamHandler) null);
}
- // JDK1.2
+ /**
+ * Creates an URL from given arguments
+ * This method parses a String representation of a URL within the
+ * context of an existing URL. Principally this means that any fields
+ * not present the URL are inheritied from the context URL. This allows
+ * relative URL's to be easily constructed. If the context argument is
+ * null, then a complete URL must be specified in the URL string.
+ * If the protocol parsed out of the URL is different
+ * from the context URL's protocol, then then URL String is also
+ * expected to be a complete URL.
+ * <p>
+ * Additionally, this method allows the caller to specify a protocol handler
+ * to use instead of the default. If this handler is specified, the caller
+ * must have the "specifyStreamHandler" permission
+ * (see <code>NetPermission</code>) or a <code>SecurityException</code>
+ * will be thrown.
+ *
+ * @param context The context in which to parse the specification
+ * @param spec The string to parse as an URL
+ * @param handler The stream handler for the URL
+ *
+ * @exception MalformedURLException If a protocol handler cannot be found
+ * or the URL cannot be parsed
+ * @exception SecurityException If the <code>SecurityManager</code> exists
+ * and does not allow the caller to specify its own protocol handler.
+ *
+ * @since 1.2
+ */
public URL(URL context, String spec, URLStreamHandler handler)
throws MalformedURLException
{
@@ -135,13 +356,14 @@ public final class URL implements Serializable
(colon < (slash = spec.indexOf('/')) || slash < 0))
{
// Protocol specified in spec string.
- protocol = spec.substring(0, colon);
+ protocol = spec.substring(0, colon).toLowerCase();
if (context != null && context.protocol.equals(protocol))
{
// The 1.2 doc specifically says these are copied to the new URL.
host = context.host;
port = context.port;
file = context.file;
+ authority = context.authority;
}
}
else if (context != null)
@@ -153,6 +375,7 @@ public final class URL implements Serializable
host = context.host;
port = context.port;
file = context.file;
+ authority = context.authority;
}
else // Protocol NOT specified in spec. and no context available.
throw new
@@ -160,22 +383,18 @@ public final class URL implements Serializable
if (handler != null)
{
- // TODO12: Need SecurityManager.checkPermission and
- // TODO12: java.net.NetPermission from JDK 1.2 to be implemented.
- // Throw an exception if an extant security mgr precludes
- // specifying a StreamHandler.
- //
- // SecurityManager s = System.getSecurityManager();
- // if (s != null)
- // s.checkPermission(NetPermission("specifyStreamHandler"));
+ SecurityManager s = System.getSecurityManager ();
+ if (s != null)
+ s.checkPermission (new NetPermission ("specifyStreamHandler"));
this.handler = handler;
}
else
- this.handler = setURLStreamHandler(protocol);
+ this.handler = getURLStreamHandler(protocol);
if (this.handler == null)
- throw new MalformedURLException("Protocol handler not found: " + protocol);
+ throw new MalformedURLException("Protocol handler not found: "
+ + protocol);
// JDK 1.2 doc for parseURL specifically states that any '#' ref
// is to be excluded by passing the 'limit' as the indexOf the '#'
@@ -189,100 +408,220 @@ public final class URL implements Serializable
hashCode = hashCode(); // Used for serialization.
}
+ /**
+ * Test another URL for equality with this one. This will be true only if
+ * the argument is non-null and all of the fields in the URL's match
+ * exactly (ie, protocol, host, port, file, and ref). Overrides
+ * Object.equals(), implemented by calling the equals method of the handler.
+ *
+ * @param url The URL to compare with
+ *
+ * @return true if the URL is equal, false otherwise
+ */
public boolean equals(Object obj)
{
if (obj == null || ! (obj instanceof URL))
return false;
URL uObj = (URL) obj;
-
- // This comparison is very conservative. It assumes that any
- // field can be null.
- return (port == uObj.port
- && ((protocol == null && uObj.protocol == null)
- || (protocol != null && protocol.equals(uObj.protocol)))
- && ((host == null && uObj.host == null)
- || (host != null && host.equals(uObj.host)))
- && ((file == null && uObj.file == null)
- || (file != null && file.equals(uObj.file)))
- && ((ref == null && uObj.ref == null)
- || (ref != null && ref.equals(uObj.ref))));
+
+ return handler.equals (this, uObj);
}
+ /**
+ * Returns the contents of this URL as an object by first opening a
+ * connection, then calling the getContent() method against the connection
+ *
+ * @return A content object for this URL
+ * @exception IOException If opening the connection or getting the
+ * content fails.
+ *
+ * @since 1.3
+ */
public final Object getContent() throws IOException
{
return openConnection().getContent();
}
+ /**
+ * Gets the contents of this URL
+ *
+ * @exception IOException If an error occurs
+ */
+ public final Object getContent (Class[] classes) throws IOException
+ {
+ // FIXME: implement this
+ return getContent();
+ }
+
+ /**
+ * Returns the file portion of the URL.
+ * Defined as <code>path[?query]</code>.
+ * Returns the empty string if there is no file portion.
+ */
public String getFile()
{
- return file;
+ return file == null ? "" : file;
}
+ /**
+ * Returns the path of the URL. This is the part of the file before any '?'
+ * character.
+ *
+ * @since 1.3
+ */
public String getPath()
{
int quest = file.indexOf('?');
return quest < 0 ? file : file.substring(0, quest);
}
+ /**
+ * Returns the authority of the URL
+ *
+ * @since 1.3
+ */
+ public String getAuthority()
+ {
+ return authority;
+ }
+
+ /**
+ * Returns the host of the URL
+ */
public String getHost()
{
- return host;
+ int at = (host == null) ? -1 : host.indexOf('@');
+ return at < 0 ? host : host.substring(at + 1, host.length());
}
+ /**
+ * Returns the port number of this URL or -1 if the default port number is
+ * being used.
+ *
+ * @return The port number
+ *
+ * @see #getDefaultPort()
+ */
public int getPort()
{
return port;
}
+ /**
+ * Returns the default port of the URL. If the StreamHandler for the URL
+ * protocol does not define a default port it returns -1.
+ */
+ public int getDefaultPort()
+ {
+ return handler.getDefaultPort();
+ }
+
+ /**
+ * Returns the protocol of the URL
+ */
public String getProtocol()
{
return protocol;
}
+ /**
+ * Returns the ref (sometimes called the "# reference" or "anchor") portion
+ * of the URL.
+ *
+ * @return The ref
+ */
public String getRef()
{
return ref;
}
- public int hashCode()
+ /**
+ * Returns the user information of the URL. This is the part of the host
+ * name before the '@'.
+ *
+ * @return the user at a particular host or null when no user defined.
+ */
+ public String getUserInfo ()
+ {
+ int at = host.indexOf('@');
+ return at < 0 ? null : host.substring(0, at);
+ }
+
+ /**
+ * Returns the query of the URL. This is the part of the file before the
+ * '?'.
+ *
+ * @ return the query part of the file, or null when there is no query part.
+ */
+ public String getQuery ()
{
- // JCL book says this is computed using (only) the hashcodes of the
- // protocol, host and file fields. Empirical evidence indicates this
- // is probably XOR in JDK 1.1. In JDK 1.2 it seems to be a sum including
- // the port.
- //
- // JDK 1.2 online doc infers that host could be null because it
- // explicitly states that file cannot be null but is silent on host.
- // A simple example with protocol "http" (hashcode 3213448), host null,
- // file "/" (hashcode 47) produced a hashcode (3213494) which appeared
- // to be the sum of the two hashcodes plus the port. Another example
- // using "/index.html" for file bore this out; as well as "#" for file
- // (which was reduced to "" with a hashcode of zero). A "" host also
- // causes the port number and the two hashcodes to be summed.
+ int quest = file.indexOf('?');
+ return quest < 0 ? null : file.substring(quest + 1, file.length());
+ }
+ /**
+ * Returns a hashcode computed by the URLStreamHandler of this URL
+ */
+ public int hashCode()
+ {
if (hashCode != 0)
return hashCode; // Use cached value if available.
else
- return (protocol.hashCode() + ((host == null) ? 0 : host.hashCode()) +
- port + file.hashCode());
+ return handler.hashCode (this);
}
+ /**
+ * Returns a URLConnection object that represents a connection to the remote
+ * object referred to by the URL. The URLConnection is created by calling the
+ * openConnection() method of the protocol handler
+ *
+ * @return A URLConnection for this URL
+ * @exception IOException If an error occurs
+ */
public URLConnection openConnection() throws IOException
{
return handler.openConnection(this);
}
+ /**
+ * Opens a connection to this URL and returns an InputStream for reading
+ * from that connection
+ *
+ * @exception IOException If an error occurs
+ */
public final InputStream openStream() throws IOException
{
return openConnection().getInputStream();
}
+ /**
+ * Tests whether or not another URL refers to the same "file" as this one.
+ * This will be true if and only if the passed object is not null, is a
+ * URL, and matches all fields but the ref (ie, protocol, host, port,
+ * and file);
+ *
+ * @param url The URL object to test with
+ *
+ * @return true if URL matches this URL's file, false otherwise
+ */
public boolean sameFile(URL other)
{
return handler.sameFile(this, other);
}
+ /**
+ * Sets the specified fields of the URL. This is not a public method so
+ * that only URLStreamHandlers can modify URL fields. This might be called
+ * by the <code>parseURL()</code> method in that class. URLs are otherwise
+ * constant.
+ *
+ * @param protocol The protocol name for this URL
+ * @param host The hostname or IP address for this URL
+ * @param port The port number of this URL
+ * @param file The "file" portion of this URL.
+ * @param ref The anchor portion of this URL.
+ */
protected void set(String protocol, String host, int port, String file,
String ref)
{
@@ -290,8 +629,9 @@ public final class URL implements Serializable
// invalid protocol. It will cause the handler to be set to null
// thus overriding a valid handler. Callers of this method should
// be aware of this.
- this.handler = setURLStreamHandler(protocol);
- this.protocol = protocol;
+ this.handler = getURLStreamHandler(protocol);
+ this.protocol = protocol.toLowerCase();
+ this.authority = null;
this.port = port;
this.host = host;
this.file = file;
@@ -299,6 +639,47 @@ public final class URL implements Serializable
hashCode = hashCode(); // Used for serialization.
}
+ /**
+ * Sets the specified fields of the URL. This is not a public method so
+ * that only URLStreamHandlers can modify URL fields. URLs are otherwise
+ * constant.
+ *
+ * @since 1.3
+ */
+ protected void set(String protocol, String host, int port,
+ String authority, String userInfo,
+ String path, String query, String ref)
+ {
+ // TBD: Theoretically, a poorly written StreamHandler could pass an
+ // invalid protocol. It will cause the handler to be set to null
+ // thus overriding a valid handler. Callers of this method should
+ // be aware of this.
+ this.handler = getURLStreamHandler(protocol);
+ this.protocol = protocol.toLowerCase();
+ if (userInfo == null)
+ this.host = host;
+ else
+ this.host = userInfo + "@" + host;
+ this.port = port;
+ if (query == null)
+ this.file = path;
+ else
+ this.file = path + "?" + query;
+ this.ref = ref;
+ hashCode = hashCode(); // Used for serialization.
+ }
+
+ /**
+ * Sets the URLStreamHandlerFactory for this class. This factory is
+ * responsible for returning the appropriate protocol handler for
+ * a given URL.
+ *
+ * @param fac The URLStreamHandlerFactory class to use
+ *
+ * @exception Error If the factory is alread set.
+ * @exception SecurityException If a security manager exists and its
+ * checkSetFactory method doesn't allow the operation
+ */
public static synchronized void
setURLStreamHandlerFactory(URLStreamHandlerFactory fac)
{
@@ -313,19 +694,33 @@ public final class URL implements Serializable
factory = fac;
}
+ /**
+ * Returns a String representing this URL. The String returned is
+ * created by calling the protocol handler's toExternalForm() method.
+ *
+ * @return A string for this URL
+ */
public String toExternalForm()
{
// Identical to toString().
return handler.toExternalForm(this);
}
+ /**
+ * Returns a String representing this URL. Identical to toExternalForm().
+ * The value returned is created by the protocol handler's
+ * toExternalForm method. Overrides Object.toString()
+ *
+ * @return A string for this URL
+ */
public String toString()
{
// Identical to toExternalForm().
return handler.toExternalForm(this);
}
- private URLStreamHandler setURLStreamHandler(String protocol)
+ private static synchronized URLStreamHandler
+ getURLStreamHandler(String protocol)
{
URLStreamHandler handler;
@@ -345,7 +740,7 @@ public final class URL implements Serializable
// This is an interesting case. It's tempting to think that we
// could call Class.forName ("gnu.gcj.protocol.file.Handler") to
// get the appropriate class. Unfortunately, if we do that the
- // program will never terminate, because setURLStreamHandler is
+ // program will never terminate, because getURLStreamHandler is
// eventually called by Class.forName.
//
// Treating "file" as a special case is the minimum that will
@@ -400,7 +795,7 @@ public final class URL implements Serializable
throws IOException, ClassNotFoundException
{
ois.defaultReadObject();
- this.handler = setURLStreamHandler(protocol);
+ this.handler = getURLStreamHandler(protocol);
if (this.handler == null)
throw new IOException("Handler for protocol " + protocol + " not found");
}
diff --git a/libjava/java/net/URLClassLoader.java b/libjava/java/net/URLClassLoader.java
index eeec8821316..5e059cf9cb6 100644
--- a/libjava/java/net/URLClassLoader.java
+++ b/libjava/java/net/URLClassLoader.java
@@ -1,4 +1,4 @@
-/* Copyright (C) 1999, 2000 Free Software Foundation
+/* Copyright (C) 1999, 2000, 2002 Free Software Foundation
This file is part of libgcj.
@@ -12,8 +12,15 @@ import java.io.*;
import java.util.jar.*;
import java.util.Enumeration;
import java.util.Vector;
-
-public class URLClassLoader extends ClassLoader
+import java.security.CodeSource;
+import java.security.SecureClassLoader;
+import java.security.PermissionCollection;
+import java.security.cert.Certificate;
+
+/**
+ * @since 1.2
+ */
+public class URLClassLoader extends SecureClassLoader
{
// The URLStreamHandlerFactory
URLStreamHandlerFactory factory = null;
@@ -33,11 +40,23 @@ public class URLClassLoader extends ClassLoader
return null;
}
+ /**
+ * Createa a new URL class loader object
+ *
+ * @exception SecurityException If a security manager exists and its
+ * checkCreateClassLoader method doesn't allow creation of a class loader
+ */
public URLClassLoader (URL[] urls)
{
this (urls, null, null);
}
-
+
+ /**
+ * Createa a new URL class loader object
+ *
+ * @exception SecurityException If a security manager exists and its
+ * checkCreateClassLoader method doesn't allow creation of a class loader
+ */
public URLClassLoader (URL[] urls, ClassLoader parent)
{
this (urls, parent, null);
@@ -93,11 +112,21 @@ public class URLClassLoader extends ClassLoader
info.addElement (conn);
}
+ /**
+ * Createa a new URL class loader object
+ *
+ * @exception SecurityException If a security manager exists and its
+ * checkCreateClassLoader method doesn't allow creation of a class loader
+ */
public URLClassLoader (URL[] urls, ClassLoader parent,
URLStreamHandlerFactory fac)
{
super (parent);
+ SecurityManager s = System.getSecurityManager();
+ if (s != null)
+ s.checkCreateClassLoader();
+
factory = fac;
if (urls == null || urls.length == 0)
@@ -112,7 +141,7 @@ public class URLClassLoader extends ClassLoader
for (int i = 0; i < urls.length; i++)
{
- // Convert a Jar File URL into a Jar URL is possible.
+ // Convert a Jar File URL into a Jar URL if possible.
URL u = jarFileize(urls[i]);
path.addElement (u);
@@ -143,7 +172,13 @@ public class URLClassLoader extends ClassLoader
path.copyInto (urls);
return urls;
}
-
+
+ /**
+ * Returns an Enumeration of URLs representing all of the resources on the
+ * URL search path having the specified name
+ *
+ * @exception IOException If an error occurs
+ */
public Enumeration findResources (String name)
{
Vector results = new Vector ();
@@ -158,7 +193,8 @@ public class URLClassLoader extends ClassLoader
if (conn != null)
{
if (conn.getJarFile().getJarEntry (name) != null)
- results.addElement (new URL(u, name, getHandler0 (u.getProtocol())));
+ results.addElement (new URL(u, name,
+ getHandler0 (u.getProtocol())));
}
else
{
@@ -216,7 +252,12 @@ public class URLClassLoader extends ClassLoader
return null;
}
- // and finally, we can implement our class loader functionality.
+ /**
+ * Finds and loads the class with the specified name from the
+ * URL search path
+ *
+ * @exception ClassNotFoundException If the class could not be found
+ */
protected Class findClass (String name)
throws ClassNotFoundException
{
@@ -225,12 +266,12 @@ public class URLClassLoader extends ClassLoader
try
{
- URL u = getResource (name.replace ('.', '/') + ".class");
+ URL url = getResource (name.replace ('.', '/') + ".class");
- if (u == null)
+ if (url == null)
throw new ClassNotFoundException (name);
- URLConnection connection = u.openConnection ();
+ URLConnection connection = url.openConnection ();
InputStream is = connection.getInputStream ();
int len = connection.getContentLength ();
@@ -247,12 +288,171 @@ public class URLClassLoader extends ClassLoader
off += c;
}
- return defineClass (name, data, 0, len);
+ // Now construct the CodeSource (if loaded from a jar file)
+ CodeSource source = null;
+ if (url.getProtocol().equals("jar"))
+ {
+ Certificate[] certificates =
+ ((JarURLConnection) connection).getCertificates();
+ String u = url.toExternalForm ();
+ u = u.substring (4); //skip "jar:"
+ int i = u.indexOf ('!');
+ if (i >= 0)
+ u = u.substring (0, i);
+ url = new URL(u);
+
+ source = new CodeSource(url, certificates);
+ }
+ else if (url.getProtocol().equals("file"))
+ {
+ try
+ {
+ String u = url.toExternalForm();
+ // Skip "file:" and then get canonical directory name.
+ File f = new File(u.substring(5));
+ f = f.getCanonicalFile();
+ url = new URL("file", "", f.getParent());
+ source = new CodeSource (url, null);
+ }
+ catch (IOException ignore)
+ {
+ }
+ }
+
+ return defineClass (name, data, 0, len, source);
}
catch (java.io.IOException x)
{
throw new ClassNotFoundException(name);
}
}
-}
+ /**
+ * Defines a Package based on the given name and the supplied manifest
+ * information. The manifest indicates the tile, version and
+ * vendor information of the specification and implementation and wheter the
+ * package is sealed. If the Manifest indicates that the package is sealed
+ * then the Package will be sealed with respect to the supplied URL.
+ *
+ * @exception IllegalArgumentException If this package name already exists
+ * in this class loader
+ * @param name The name of the package
+ * @param manifest The manifest describing the specification,
+ * implementation and sealing details of the package
+ * @param url the code source url to seal the package
+ * @return the defined Package
+ */
+ protected Package definePackage(String name, Manifest manifest, URL url)
+ throws IllegalArgumentException
+ {
+ Attributes attr = manifest.getMainAttributes();
+ String specTitle =
+ attr.getValue(Attributes.Name.SPECIFICATION_TITLE);
+ String specVersion =
+ attr.getValue(Attributes.Name.SPECIFICATION_VERSION);
+ String specVendor =
+ attr.getValue(Attributes.Name.SPECIFICATION_VENDOR);
+ String implTitle =
+ attr.getValue(Attributes.Name.IMPLEMENTATION_TITLE);
+ String implVersion =
+ attr.getValue(Attributes.Name.IMPLEMENTATION_VERSION);
+ String implVendor =
+ attr.getValue(Attributes.Name.IMPLEMENTATION_VENDOR);
+
+ // Look if the Manifest indicates that this package is sealed
+ // XXX - most likely not completely correct!
+ // Shouldn't we also check the sealed attribute of the complete jar?
+ // http://java.sun.com/products/jdk/1.3/docs/guide/extensions/spec.html#bundled
+ // But how do we get that jar manifest here?
+ String sealed = attr.getValue(Attributes.Name.SEALED);
+ if ("false".equals(sealed))
+ {
+ // Make sure that the URL is null so the package is not
+ // sealed.
+ url = null;
+ }
+
+ return definePackage(name, specTitle, specVersion, specVendor,
+ implTitle, implVersion, implVendor, url);
+ }
+
+ /**
+ * Returns the permissions needed to access a particular code source.
+ * These permissions includes those returned by
+ * <CODE>SecureClassLoader.getPermissions</CODE> and the actual permissions
+ * to access the objects referenced by the URL of the code source.
+ * The extra permissions added depend on the protocol and file portion of
+ * the URL in the code source. If the URL has the "file" protocol ends with
+ * a / character then it must be a directory and a file Permission to read
+ * everthing in that directory and all subdirectories is added. If the URL
+ * had the "file" protocol and doesn't end with a / character then it must
+ * be a normal file and a file permission to read that file is added. If the
+ * URL has any other protocol then a socket permission to connect and accept
+ * connections from the host portion of the URL is added.
+ * @param source The codesource that needs the permissions to be accessed
+ * @return the collection of permissions needed to access the code resource
+ * @see SecureClassLoader.getPermissions()
+ */
+ protected PermissionCollection getPermissions(CodeSource source)
+ {
+ // XXX - This implementation does exactly as the Javadoc describes.
+ // But maybe we should/could use URLConnection.getPermissions()?
+
+ // First get the permissions that would normally be granted
+ PermissionCollection permissions = super.getPermissions(source);
+
+ // Now add the any extra permissions depending on the URL location
+ URL url = source.getLocation();
+ String protocol = url.getProtocol();
+ if (protocol.equals("file"))
+ {
+ String file = url.getFile();
+ // If the file end in / it must be an directory
+ if (file.endsWith("/"))
+ {
+ // Grant permission to read everything in that directory and
+ // all subdirectories
+ permissions.add(new FilePermission(file + "-", "read"));
+ }
+ else
+ {
+ // It is a 'normal' file
+ // Grant permission to access that file
+ permissions.add(new FilePermission(file, "read"));
+ }
+ }
+ else
+ {
+ // Grant permission to connect to and accept connections from host
+ String host = url.getHost();
+ permissions.add(new SocketPermission(host, "connect,accept"));
+ }
+
+ return permissions;
+ }
+
+ /**
+ * Creates a new instance of a URLClassLoader that gets classes from the
+ * supplied URLs. This class loader will have as parent the standard
+ * system class loader.
+ * @param urls the initial URLs used to resolve classes and resources
+ */
+ public static URLClassLoader newInstance(URL[] urls) throws
+ SecurityException
+ {
+ return new URLClassLoader(urls);
+ }
+
+ /**
+ * Creates a new instance of a URLClassLoader that gets classes from the
+ * supplied URLs and with the supplied loader as parent class loader.
+ * @param urls the initial URLs used to resolve classes and resources
+ * @param parent the parent class loader
+ */
+ public static URLClassLoader newInstance(URL[] urls,
+ ClassLoader parent)
+ throws SecurityException
+ {
+ return new URLClassLoader(urls, parent);
+ }
+}
diff --git a/libjava/java/net/URLConnection.java b/libjava/java/net/URLConnection.java
index 8f8cf5ed575..0b39fe88ea6 100644
--- a/libjava/java/net/URLConnection.java
+++ b/libjava/java/net/URLConnection.java
@@ -17,7 +17,10 @@ import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;
import java.util.Hashtable;
+import java.util.Map;
import java.util.StringTokenizer;
+import java.security.Permission;
+import java.security.AllPermission;
import gnu.gcj.io.MimeTypes;
/**
@@ -29,7 +32,7 @@ import gnu.gcj.io.MimeTypes;
* Written using on-line Java Platform 1.2 API Specification, as well
* as "The Java Class Libraries", 2nd edition (Addison-Wesley, 1998).
* Status: One guessContentTypeFrom... methods not implemented.
- * getContent method assumes content type from response; see comment there.
+ * getContent method assumes content type from response; see comment there.
*/
public abstract class URLConnection
@@ -51,6 +54,14 @@ public abstract class URLConnection
private static SimpleDateFormat dateFormat1, dateFormat2, dateFormat3;
private static boolean dateformats_initialized = false;
+ /**
+ * Creates a URL connection to a given URL. A real connection is not made.
+ * Use #connect to do this.
+ *
+ * @param url The Object to create the URL connection to
+ *
+ * @see URLConnection:connect
+ */
protected URLConnection(URL url)
{
this.url = url;
@@ -58,55 +69,112 @@ public abstract class URLConnection
useCaches = defaultUseCaches;
}
+ /**
+ * Creates a real connection to the object references by the URL given
+ * to the constructor
+ *
+ * @exception IOException If an error occurs
+ */
public abstract void connect() throws IOException;
+ /**
+ * Returns ths URL to the object.
+ */
public URL getURL()
{
return url;
}
+ /**
+ * Returns the value of the content-length header field
+ */
public int getContentLength()
{
return getHeaderFieldInt("content-length", -1);
}
+ /**
+ * Returns the value of the content-type header field
+ */
public String getContentType()
{
return getHeaderField("content-type");
}
+ /**
+ * Returns the value of the content-encoding header field
+ */
public String getContentEncoding()
{
return getHeaderField("content-encoding");
}
+ /**
+ * Returns the value of the expires header field
+ */
public long getExpiration()
{
return getHeaderFieldDate("expiration", 0L);
}
+ /**
+ * Returns the value of the date header field
+ */
public long getDate()
{
return getHeaderFieldDate("date", 0L);
}
+ /**
+ * Returns the value of the last-modified header field
+ */
public long getLastModified()
{
return getHeaderFieldDate("last-modified", 0L);
}
- public String getHeaderField(int n)
+ /**
+ * Returns the value of the n-th header field
+ *
+ * @param num The number of the header field
+ */
+ public String getHeaderField(int num)
{
// Subclasses for specific protocols override this.
return null;
}
+ /**
+ * Returns the value of the header filed specified by name
+ *
+ * @param name The name of the header field
+ */
public String getHeaderField(String name)
{
// Subclasses for specific protocols override this.
return null;
}
+ /**
+ * Returns a map of all sent header fields
+ *
+ * @since 1.4
+ */
+ public Map getHeaderFields()
+ {
+ // Subclasses for specific protocols override this.
+ return null;
+ }
+
+ /**
+ * Returns the value of the header filed name as int.
+ *
+ * @param name The name of the header field
+ * @param val The default value
+ *
+ * @return Returns the value of the header filed or the default value
+ * if the field is missing or malformed
+ */
public int getHeaderFieldInt(String name, int val)
{
String str = getHeaderField(name);
@@ -122,6 +190,16 @@ public abstract class URLConnection
return val;
}
+ /**
+ * Returns the value of a header field parsed as date. The result is then
+ * number of milliseconds since January 1st, 1970 GMT.
+ *
+ * @param name The name of the header field
+ * @param val The dafault date
+ *
+ * @return Returns the date value of the header filed or the default value
+ * if the field is missing or malformed
+ */
public long getHeaderFieldDate(String name, long val)
{
if (! dateformats_initialized)
@@ -140,12 +218,24 @@ public abstract class URLConnection
return val;
}
- public String getHeaderFieldKey(int n)
+ /**
+ * Returns the key of the n-th header field
+ *
+ * @param num The number of the header field
+ */
+ public String getHeaderFieldKey(int num)
{
// Subclasses for specific protocols override this.
return null;
}
+ /**
+ * Retrieves the content of this URLConnection
+ *
+ * @exception IOException If an error occurs
+ * @exception UnknownServiceException If the protocol does not support the
+ * content type
+ */
public Object getContent() throws IOException
{
// FIXME: Doc indicates that other criteria should be applied as
@@ -160,12 +250,39 @@ public abstract class URLConnection
return contentHandler.getContent(this);
}
-// TODO12: public Permission getPermission() throws IOException
-// {
-// // Subclasses may override this.
-// return java.security.AllPermission;
-// }
+ /**
+ * Retrieves the content of this URLConnection
+ *
+ * @exception IOException If an error occurs
+ * @exception UnknownServiceException If the protocol does not support the
+ * content type
+ */
+ public Object getContent(Class[] classes) throws IOException
+ {
+ // FIXME: implement this
+ return getContent ();
+ }
+ /**
+ * Returns a permission object representing the permission necessary to make
+ * the connection represented by this object. This method returns null if no
+ * permission is required to make the connection.
+ *
+ * @exception IOException If the computation of the permission requires
+ * network or file I/O and an exception occurs while computing it
+ */
+ public Permission getPermission() throws IOException
+ {
+ // Subclasses may override this.
+ return new java.security.AllPermission();
+ }
+
+ /**
+ * Returns the input stream of the URL connection
+ *
+ * @exception IOException If an error occurs
+ * @exception UnknownServiceException If the protocol does not support input
+ */
public InputStream getInputStream() throws IOException
{
// Subclasses for specific protocols override this.
@@ -173,6 +290,12 @@ public abstract class URLConnection
" does not support input.");
}
+ /**
+ * Returns the output stream of the URL connection
+ *
+ * @exception IOException If an error occurs
+ * @exception UnknownServiceException If the protocol does not support output
+ */
public OutputStream getOutputStream() throws IOException
{
// Subclasses for specific protocols override this.
@@ -180,122 +303,291 @@ public abstract class URLConnection
" does not support output.");
}
+ /**
+ * Returns a string representation of the URL connection object
+ */
public String toString()
{
return this.getClass().getName() + ":" + url.toString();
}
+ /**
+ * Sets tha value of the doInput field.
+ *
+ * @param doinput The new value of the doInput field
+ *
+ * @exception IllegalStateException If already connected
+ */
public void setDoInput(boolean doinput)
{
if (connected)
- throw new IllegalAccessError("Already connected");
+ throw new IllegalStateException ("Already connected");
doInput = doinput;
}
+ /**
+ * Returns the current value of the doInput field
+ */
public boolean getDoInput()
{
return doInput;
}
+ /**
+ * Sets the value of the doOutput field
+ *
+ * @param dooutput The new value of the doOutput field
+ *
+ * @exception IllegalStateException If already connected
+ */
public void setDoOutput(boolean dooutput)
{
if (connected)
- throw new IllegalAccessError("Already connected");
+ throw new IllegalStateException ("Already connected");
doOutput = dooutput;
}
+ /**
+ * Returns the current value of the doOutput field
+ */
public boolean getDoOutput()
{
return doOutput;
}
- public void setAllowUserInteraction(boolean allowuserinteraction)
+ /**
+ * Sets a new value to the allowUserInteraction field
+ *
+ * @param allowed The new value
+ *
+ * @exception IllegalStateException If already connected
+ */
+ public void setAllowUserInteraction(boolean allowed)
{
if (connected)
- throw new IllegalAccessError("Already connected");
+ throw new IllegalStateException ("Already connected");
- allowUserInteraction = allowuserinteraction;
+ allowUserInteraction = allowed;
}
+ /**
+ * Returns the current value of the allowUserInteraction field
+ */
public boolean getAllowUserInteraction()
{
return allowUserInteraction;
}
- public static void
- setDefaultAllowUserInteraction(boolean defaultallowuserinteraction)
+ /**
+ * Sets the default value if the allowUserInteraction field
+ *
+ * @param allowed The new default value
+ */
+ public static void setDefaultAllowUserInteraction(boolean allowed)
{
- defaultAllowUserInteraction = defaultallowuserinteraction;
+ defaultAllowUserInteraction = allowed;
}
+ /**
+ * Returns the default value of the allowUserInteraction field
+ */
public static boolean getDefaultAllowUserInteraction()
{
return defaultAllowUserInteraction;
}
+ /**
+ * Sets a new value to the useCaches field
+ *
+ * @param usecaches The new value
+ *
+ * @exception IllegalStateException If already connected
+ */
public void setUseCaches(boolean usecaches)
{
if (connected)
- throw new IllegalAccessError("Already connected");
+ throw new IllegalStateException ("Already connected");
useCaches = usecaches;
}
+ /**
+ * The current value of the useCaches field
+ */
public boolean getUseCaches()
{
return useCaches;
}
+ /**
+ * Sets the value of the ifModifiedSince field
+ *
+ * @param ifmodifiedsince The new value in milliseconds
+ * since January 1, 1970 GMT
+ *
+ * @exception IllegalStateException If already connected
+ */
public void setIfModifiedSince(long ifmodifiedsince)
{
if (connected)
- throw new IllegalAccessError("Already connected");
+ throw new IllegalStateException ("Already connected");
ifModifiedSince = ifmodifiedsince;
}
+ /**
+ * Returns the current value of the ifModifiedSince field
+ */
public long getIfModifiedSince()
{
return ifModifiedSince;
}
+ /**
+ * Returns the default value of the useCaches field
+ */
public boolean getDefaultUseCaches()
{
return defaultUseCaches;
}
+ /**
+ * Sets the default value of the useCaches field
+ *
+ * @param defaultusecaches The new default value
+ */
public void setDefaultUseCaches(boolean defaultusecaches)
{
defaultUseCaches = defaultusecaches;
}
+ /**
+ * Sets a property specified by key to value.
+ *
+ * @param key Key of the property to set
+ * @param value Value of the Property to set
+ *
+ * @exception IllegalStateException If already connected
+ * @exception NullPointerException If key is null
+ *
+ * @see URLConnection:getRequestProperty(String key)
+ * @see URLConnection:addRequestProperty(String key, String value)
+ */
public void setRequestProperty(String key, String value)
{
+ if (connected)
+ throw new IllegalStateException ("Already connected");
+
// Do nothing unless overridden by subclasses that support setting
// header fields in the request.
}
+ /**
+ * Sets a property specified by key to value. If the property key already
+ * is assigned to a value it does nothing.
+ *
+ * @param key Key of the property to add
+ * @param value Value of the Property to add
+ *
+ * @exception IllegalStateException If already connected
+ * @exception NullPointerException If key is null
+ *
+ * @see URLConnection:getRequestProperty(String key)
+ * @see URLConnection:setRequestProperty(String key, String value)
+ *
+ * @since 1.4
+ */
+ public void addRequestProperty(String key, String value)
+ {
+ if (connected)
+ throw new IllegalStateException ("Already connected");
+
+ if (getRequestProperty (key) == null)
+ {
+ setRequestProperty (key, value);
+ }
+ }
+
+ /**
+ * Returns a property value specified by key.
+ *
+ * @param key Key of the property to return
+ *
+ * @exception IllegalStateException If already connected
+ *
+ * @see URLConnection:setRequestProperty(String key, String value)
+ * @see URLConnection:addRequestProperty(String key, String value)
+ *
+ * @return Value of the property.
+ */
public String getRequestProperty(String key)
{
+ if (connected)
+ throw new IllegalStateException ("Already connected");
+
// Overridden by subclasses that support reading header fields from the
// request.
return null;
}
+ /**
+ * Returns a map that contains all properties of the request
+ *
+ * @exception IllegalStateException If already connected
+ *
+ * @return The map of properties
+ */
+ public Map getRequestProperties()
+ {
+ // Overridden by subclasses that support reading header fields from the
+ // request.
+ return null;
+ }
+
+ /**
+ * Defines a default request property
+ *
+ * @param key The key of the property
+ * @param value The value of the property
+ *
+ * @deprecated 1.3 The method setRequestProperty should be used instead
+ *
+ * @see URLConnection:setRequestProperty
+ */
public static void setDefaultRequestProperty(String key, String value)
{
// Do nothing unless overridden by subclasses that support setting
// default request properties.
}
+ /**
+ * Returns the value of a default request property
+ *
+ * @param key The key of the default property
+ *
+ * @return The value of the default property or null if not available
+ *
+ * @deprecated 1.3 The method getRequestProperty should be used instead
+ *
+ * @see URLConnection:getRequestProperty
+ */
public static String getDefaultRequestProperty(String key)
{
// Overridden by subclasses that support default request properties.
return null;
}
+ /**
+ * Sets a ContentHandlerFactory
+ *
+ * @param fac The ContentHandlerFactory
+ *
+ * @exception Error If the factory has already been defined
+ * @exception SecurityException If a security manager exists and its
+ * checkSetFactory method doesn't allow the operation
+ */
public static void setContentHandlerFactory(ContentHandlerFactory fac)
{
if (factory != null)
@@ -309,7 +601,15 @@ public abstract class URLConnection
factory = fac;
}
- protected static String guessContentTypeFromName(String fname)
+ /**
+ * Tries to determine the content type of an object, based on the
+ * specified file name
+ *
+ * @param fname The filename to guess the content type from
+ *
+ * @specnote public since JDK 1.4
+ */
+ public static String guessContentTypeFromName(String fname)
{
int dot = fname.lastIndexOf (".");
@@ -329,20 +629,43 @@ public abstract class URLConnection
return(type);
}
-// TODO: public static String guessContentTypeFromStream(InputStream is)
-// throws IOException
-// {
-// }
-
-// TODO12: protected void parseURL(URL u, String spec, int start, int limit)
+ /**
+ * Tries to guess the content type of an object, based on the characters
+ * at the beginning of then input stream
+ *
+ * @param is The input stream to guess from
+ *
+ * @exception IOException If an error occurs
+ */
+ public static String guessContentTypeFromStream(InputStream is)
+ throws IOException
+ {
+ is.mark(1024);
+ // FIXME: Implement this. Use system mimetype informations (like "file").
+ is.reset();
+ return null;
+ }
- // JDK1.2
+ /**
+ * Returns a filename map (a mimetable)
+ *
+ * @since 1.2
+ */
public static FileNameMap getFileNameMap()
{
return fileNameMap;
}
- // JDK1.2
+ /**
+ * Sets a FileNameMap
+ *
+ * @param map The new FileNameMap
+ *
+ * @exception SecurityException If a security manager exists and its
+ * checkSetFactory method doesn't allow the operation
+ *
+ * @since 1.2
+ */
public static void setFileNameMap(FileNameMap map)
{
// Throw an exception if an extant security mgr precludes
diff --git a/libjava/java/net/URLDecoder.java b/libjava/java/net/URLDecoder.java
index 3c15802d427..36747409983 100644
--- a/libjava/java/net/URLDecoder.java
+++ b/libjava/java/net/URLDecoder.java
@@ -39,38 +39,45 @@ package java.net;
import java.io.UnsupportedEncodingException;
- /**
- * This utility class contains static methods that converts a
- * string encoded in the x-www-form-urlencoded format to the original
- * text. The x-www-form-urlencoded format replaces certain disallowed
- * characters with encoded equivalents. All upper case and lower case
- * letters in the US alphabet remain as is, the space character (' ')
- * is replaced with '+' sign, and all other characters are converted to a
- * "%XX" format where XX is the hexadecimal representation of that character
- * in a given character encoding (default is "UTF-8").
- * <p>
- * This method is very useful for decoding strings sent to CGI scripts
- *
- * Written using on-line Java Platform 1.2/1.4 API Specification.
- * Status: Believed complete and correct.
- *
- * @since 1.2
- *
- * @author Warren Levy <warrenl@cygnus.com>
- * @author Aaron M. Renn (arenn@urbanophile.com) (documentation comments)
- * @author Mark Wielaard (mark@klomp.org)
- */
+/**
+ * This utility class contains static methods that converts a
+ * string encoded in the x-www-form-urlencoded format to the original
+ * text. The x-www-form-urlencoded format replaces certain disallowed
+ * characters with encoded equivalents. All upper case and lower case
+ * letters in the US alphabet remain as is, the space character (' ')
+ * is replaced with '+' sign, and all other characters are converted to a
+ * "%XX" format where XX is the hexadecimal representation of that character
+ * in a given character encoding (default is "UTF-8").
+ * <p>
+ * This method is very useful for decoding strings sent to CGI scripts
+ *
+ * Written using on-line Java Platform 1.2/1.4 API Specification.
+ * Status: Believed complete and correct.
+ *
+ * @since 1.2
+ *
+ * @author Warren Levy <warrenl@cygnus.com>
+ * @author Aaron M. Renn (arenn@urbanophile.com) (documentation comments)
+ * @author Mark Wielaard (mark@klomp.org)
+ */
public class URLDecoder
{
- /**
- * This method translates the passed in string from x-www-form-urlencoded
- * format using the default encoding "UTF-8" to decode the hex encoded
- * unsafe characters.
- *
- * @param s the String to convert
- *
- * @return the converted String
- */
+ /**
+ * Public contructor. Note that this class has only static methods.
+ */
+ public URLDecoder ()
+ {
+ }
+
+ /**
+ * This method translates the passed in string from x-www-form-urlencoded
+ * format using the default encoding "UTF-8" to decode the hex encoded
+ * unsafe characters.
+ *
+ * @param s the String to convert
+ *
+ * @return the converted String
+ */
public static String decode(String s)
{
try
@@ -84,30 +91,31 @@ public class URLDecoder
}
}
- /**
- * This method translates the passed in string from x-www-form-urlencoded
- * format using the given character encoding to decode the hex encoded
- * unsafe characters.
- * <p>
- * This implementation will decode the string even if it contains
- * unsafe characters (characters that should have been encoded) or if the
- * two characters following a % do not represent a hex encoded byte.
- * In those cases the unsafe character or the % character will be added
- * verbatim to the decoded result.
- *
- * @param s the String to convert
- * @param encoding the character encoding to use the decode the hex encoded
- * unsafe characters
- *
- * @return the converted String
- *
- * @since 1.4
- */
+ /**
+ * This method translates the passed in string from x-www-form-urlencoded
+ * format using the given character encoding to decode the hex encoded
+ * unsafe characters.
+ *
+ * This implementation will decode the string even if it contains
+ * unsafe characters (characters that should have been encoded) or if the
+ * two characters following a % do not represent a hex encoded byte.
+ * In those cases the unsafe character or the % character will be added
+ * verbatim to the decoded result.
+ *
+ * @param s the String to convert
+ * @param encoding the character encoding to use the decode the hex encoded
+ * unsafe characters
+ *
+ * @return the converted String
+ *
+ * @exception UnsupportedEncodingException If the named encoding is not
+ * supported
+ *
+ * @since 1.4
+ */
public static String decode(String s, String encoding)
throws UnsupportedEncodingException
{
- StringBuffer result = new StringBuffer();
-
// First convert all '+' characters to spaces.
String str = s.replace('+', ' ');
@@ -116,6 +124,7 @@ public class URLDecoder
int start = 0;
byte[] bytes = null;
int length = str.length();
+ StringBuffer result = new StringBuffer(length);
while ((i = str.indexOf('%', start)) >= 0)
{
// Add all non-encoded characters to the result buffer
diff --git a/libjava/java/net/URLEncoder.java b/libjava/java/net/URLEncoder.java
index e3b6b63d049..0f106e820de 100644
--- a/libjava/java/net/URLEncoder.java
+++ b/libjava/java/net/URLEncoder.java
@@ -1,5 +1,5 @@
/* URLEncoder.java -- Class to convert strings to a properly encoded URL
- Copyright (C) 1998, 1999, 2001 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2001, 2002 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -39,7 +39,7 @@ package java.net;
import java.io.UnsupportedEncodingException;
-/**
+/*
* Written using on-line Java Platform 1.2/1.4 API Specification, as well
* as "The Java Class Libraries", 2nd edition (Addison-Wesley, 1998).
* Status: Believed complete and correct.
@@ -94,16 +94,19 @@ public class URLEncoder
*
* @return The converted String
*
+ * @exception UnsupportedEncodingException If the named encoding is not
+ * supported
+ *
* @since 1.4
*/
public static String encode(String s, String encoding)
throws UnsupportedEncodingException
{
- StringBuffer result = new StringBuffer();
int length = s.length();
int start = 0;
int i = 0;
+ StringBuffer result = new StringBuffer(length);
while (true)
{
while ( i < length && isSafe(s.charAt(i)) )
diff --git a/libjava/java/net/URLStreamHandler.java b/libjava/java/net/URLStreamHandler.java
index bb3d8e802e1..128a0d2d3da 100644
--- a/libjava/java/net/URLStreamHandler.java
+++ b/libjava/java/net/URLStreamHandler.java
@@ -1,42 +1,131 @@
-// URLStreamHandler.java - Superclass of all stream protocol handlers.
+/* URLStreamHandler.java -- Abstract superclass for all protocol handlers
+ Copyright (C) 1998, 1999, 2002 Free Software Foundation, Inc.
-/* Copyright (C) 1999, 2002 Free Software Foundation
+This file is part of GNU Classpath.
- This file is part of libgcj.
+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. */
-This software is copyrighted work licensed under the terms of the
-Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
-details. */
package java.net;
-/**
- * @author Warren Levy <warrenl@cygnus.com>
- * @date March 4, 1999.
- */
+import java.io.IOException;
-/**
+/*
* Written using on-line Java Platform 1.2 API Specification, as well
* as "The Java Class Libraries", 2nd edition (Addison-Wesley, 1998).
* Status: Believed complete and correct.
*/
+/**
+ * This class is the superclass of all URL protocol handlers. The URL
+ * class loads the appropriate protocol handler to establish a connection
+ * to a (possibly) remote service (eg, "http", "ftp") and to do protocol
+ * specific parsing of URL's. Refer to the URL class documentation for
+ * details on how that class locates and loads protocol handlers.
+ * <p>
+ * A protocol handler implementation should override the openConnection()
+ * method, and optionally override the parseURL() and toExternalForm()
+ * methods if necessary. (The default implementations will parse/write all
+ * URL's in the same form as http URL's). A protocol specific subclass
+ * of URLConnection will most likely need to be created as well.
+ * <p>
+ * Note that the instance methods in this class are called as if they
+ * were static methods. That is, a URL object to act on is passed with
+ * every call rather than the caller assuming the URL is stored in an
+ * instance variable of the "this" object.
+ * <p>
+ * The methods in this class are protected and accessible only to subclasses.
+ * URLStreamConnection objects are intended for use by the URL class only,
+ * not by other classes (unless those classes are implementing protocols).
+ *
+ * @author Aaron M. Renn (arenn@urbanophile.com)
+ * @author Warren Levy (warrenl@cygnus.com)
+ *
+ * @see URL
+ */
public abstract class URLStreamHandler
{
+ /**
+ * Creates a URLStreamHander
+ */
+ public URLStreamHandler ()
+ {
+ }
+
+ /**
+ * Returns a URLConnection for the passed in URL. Note that this should
+ * not actually create the connection to the (possibly) remote host, but
+ * rather simply return a URLConnection object. The connect() method of
+ * URL connection is used to establish the actual connection, possibly
+ * after the caller sets up various connection options.
+ *
+ * @param url The URL to get a connection object for
+ *
+ * @return A URLConnection object for the given URL
+ *
+ * @exception IOException If an error occurs
+ */
protected abstract URLConnection openConnection(URL u)
- throws java.io.IOException;
+ throws IOException;
- protected void parseURL(URL u, String spec, int start, int limit)
+ /**
+ * This method parses the string passed in as a URL and set's the
+ * instance data fields in the URL object passed in to the various values
+ * parsed out of the string. The start parameter is the position to start
+ * scanning the string. This is usually the position after the ":" which
+ * terminates the protocol name. The end parameter is the position to
+ * stop scanning. This will be either the end of the String, or the
+ * position of the "#" character, which separates the "file" portion of
+ * the URL from the "anchor" portion.
+ * <p>
+ * This method assumes URL's are formatted like http protocol URL's, so
+ * subclasses that implement protocols with URL's the follow a different
+ * syntax should override this method. The lone exception is that if
+ * the protocol name set in the URL is "file", this method will accept
+ * a an empty hostname (i.e., "file:///"), which is legal for that protocol
+ *
+ * @param url The URL object in which to store the results
+ * @param spec The String-ized URL to parse
+ * @param start The position in the string to start scanning from
+ * @param end The position in the string to stop scanning
+ */
+ protected void parseURL(URL url, String spec, int start, int end)
{
- String host = u.getHost();
- int port = u.getPort();
- String file = u.getFile();
+ String host = url.getHost();
+ int port = url.getPort();
+ String file = url.getFile();
+ String ref = url.getRef();
- /* TBD: The JDK 1.2 doc specifically says that limit is the position
- * to stop parsing at and that it will be either the end of the string
- * or the position of '#'; thus the doc infers that this method does
- * not set the ref.
- */
if (spec.regionMatches (start, "//", 0, 2))
{
int hostEnd;
@@ -47,7 +136,7 @@ public abstract class URLStreamHandler
if (slash >= 0)
hostEnd = slash;
else
- hostEnd = limit;
+ hostEnd = end;
host = spec.substring (start, hostEnd);
@@ -76,28 +165,46 @@ public abstract class URLStreamHandler
else if (host == null)
host = "";
- if (start < limit && spec.charAt(start) == '/')
- {
- // This is an absolute path name; ignore any file context.
- file = spec.substring(start, limit);
- }
- else if (file == null || file.length() <= 0)
+ if (file == null || file.length() == 0
+ || (start < end && spec.charAt(start) == '/'))
{
// No file context available; just spec for file.
- file = spec.substring(start, limit);
- }
- else if (start < limit)
+ // Or this is an absolute path name; ignore any file context.
+ file = spec.substring(start, end);
+ ref = null;
+ }
+ else if (start < end)
{
// Context is available, but only override it if there is a new file.
file = file.substring(0, file.lastIndexOf('/'))
- + '/' + spec.substring(start, limit);
+ + '/' + spec.substring(start, end);
+ ref = null;
+ }
+
+ if (ref == null)
+ {
+ // Normally there should be no '#' in the file part,
+ // but we are nice.
+ int hash = file.indexOf('#');
+ if (hash != -1)
+ {
+ ref = file.substring(hash + 1, file.length());
+ file = file.substring(0, hash);
+ }
}
- u.set(u.getProtocol(), host, port, file, u.getRef());
+ // XXX - Classpath used to call PlatformHelper.toCanonicalForm() on
+ // the file part. It seems like overhead, but supposedly there is some
+ // benefit in windows based systems (it also lowercased the string).
+
+ setURL(url, url.getProtocol(), host, port, file, ref);
}
private static String canonicalizeFilename(String file)
{
+ // XXX - GNU Classpath has an implementation that might be more appropriate
+ // for Windows based systems (gnu.java.io.PlatformHelper.toCanonicalForm)
+
int index;
// Replace "/./" with "/". This probably isn't very efficient in
@@ -119,7 +226,15 @@ public abstract class URLStreamHandler
return file;
}
- public boolean sameFile(URL url1, URL url2)
+ /**
+ * Compares two URLs, excluding the fragment component
+ *
+ * @param url1 The first url
+ * @param url2 The second url to compare with the first
+ *
+ * @specnote Now protected
+ */
+ protected boolean sameFile(URL url1, URL url2)
{
if (url1 == url2)
return true;
@@ -143,40 +258,193 @@ public abstract class URLStreamHandler
return true;
}
+ /**
+ * This methods sets the instance variables representing the various fields
+ * of the URL to the values passed in.
+ *
+ * @param u The URL to modify
+ * @param protocol The protocol to set
+ * @param host The host name to et
+ * @param port The port number to set
+ * @param file The filename to set
+ * @param ref The reference
+ *
+ * @exception SecurityException If the protocol handler of the URL is
+ * different from this one
+ *
+ * @deprecated 1.2 Please use
+ * #setURL(URL,String,String,int,String,String,String,String);
+ */
protected void setURL(URL u, String protocol, String host, int port,
String file, String ref)
{
u.set(protocol, host, port, file, ref);
}
+ /**
+ * Sets the fields of the URL argument to the indicated values
+ *
+ * @param u The URL to modify
+ * @param protocol The protocol to set
+ * @param host The host name to set
+ * @param port The port number to set
+ * @param authority The authority to set
+ * @param userInfo The user information to set
+ * @param path The path/filename to set
+ * @param query The query part to set
+ * @param ref The reference
+ *
+ * @exception SecurityException If the protocol handler of the URL is
+ * different from this one
+ */
+ protected void setURL(URL u, String protocol, String host, int port,
+ String authority, String userInfo, String path,
+ String query, String ref)
+ {
+ u.set(protocol, host, port, authority, userInfo, path, query, ref);
+ }
+
+ /**
+ * Provides the default equals calculation. May be overidden by handlers for
+ * other protocols that have different requirements for equals(). This method
+ * requires that none of its arguments is null. This is guaranteed by the
+ * fact that it is only called by java.net.URL class.
+ *
+ * @param url1 An URL object
+ * @param url2 An URL object
+ */
+ protected boolean equals (URL url1, URL url2)
+ {
+ // This comparison is very conservative. It assumes that any
+ // field can be null.
+ return (url1.getPort () == url2.getPort ()
+ && ((url1.getProtocol () == null && url2.getProtocol () == null)
+ || (url1.getProtocol () != null
+ && url1.getProtocol ().equals (url2.getProtocol ())))
+ && ((url1.getUserInfo () == null && url2.getUserInfo () == null)
+ || (url1.getUserInfo () != null
+ && url1.getUserInfo ().equals(url2.getUserInfo ())))
+ && ((url1.getAuthority () == null && url2.getAuthority () == null)
+ || (url1.getAuthority () != null
+ && url1.getAuthority ().equals(url2.getAuthority ())))
+ && ((url1.getHost () == null && url2.getHost () == null)
+ || (url1.getHost () != null
+ && url1.getHost ().equals(url2.getHost ())))
+ && ((url1.getPath () == null && url2.getPath () == null)
+ || (url1.getPath () != null
+ && url1.getPath ().equals (url2.getPath ())))
+ && ((url1.getQuery () == null && url2.getQuery () == null)
+ || (url1.getQuery () != null
+ && url1.getQuery ().equals(url2.getQuery ())))
+ && ((url1.getRef () == null && url2.getRef () == null)
+ || (url1.getRef () != null
+ && url1.getRef ().equals(url2.getRef ()))));
+ }
+
+ /**
+ * Compares the host components of two URLs.
+ *
+ * @exception UnknownHostException If an unknown host is found
+ */
+ protected boolean hostsEqual (URL url1, URL url2)
+ throws UnknownHostException
+ {
+ InetAddress addr1 = InetAddress.getByName (url1.getHost ());
+ InetAddress addr2 = InetAddress.getByName (url2.getHost ());
+
+ return addr1.equals (addr2);
+ }
+
+ /**
+ * Get the IP address of our host. An empty host field or a DNS failure will
+ * result in a null return.
+ */
+ protected InetAddress getHostAddress (URL url)
+ {
+ String hostname = url.getHost ();
+
+ if (hostname == "")
+ return null;
+
+ try
+ {
+ return InetAddress.getByName (hostname);
+ }
+ catch (UnknownHostException e)
+ {
+ return null;
+ }
+ }
+
+ /**
+ * Returns the default port for a URL parsed by this handler. This method is
+ * meant to be overidden by handlers with default port numbers.
+ */
+ protected int getDefaultPort ()
+ {
+ return -1;
+ }
+
+ /**
+ * Provides the default hash calculation. May be overidden by handlers for
+ * other protocols that have different requirements for hashCode calculation.
+ */
+ protected int hashCode (URL url)
+ {
+ return url.getProtocol ().hashCode () +
+ ((url.getHost () == null) ? 0 : url.getHost ().hashCode ()) +
+ url.getFile ().hashCode() +
+ url.getPort ();
+ }
+
+ /**
+ * This method converts a URL object into a String. This method creates
+ * Strings in the mold of http URL's, so protocol handlers which use URL's
+ * that have a different syntax should override this method
+ *
+ * @param url The URL object to convert
+ */
protected String toExternalForm(URL u)
{
- String resStr, host, file, ref;
+ String protocol, host, file, ref;
int port;
- resStr = u.getProtocol() + ":";
+ protocol = u.getProtocol();
+
+ // JDK 1.2 online doc infers that host could be null because it
+ // explicitly states that file cannot be null, but is silent on host.
host = u.getHost();
+ if (host == null)
+ host = "";
+
port = u.getPort();
file = u.getFile();
ref = u.getRef();
- // JDK 1.2 online doc infers that host could be null because it
- // explicitly states that file cannot be null, but is silent on host.
- //
+ // Guess a reasonable size for the string buffer so we have to resize
+ // at most once.
+ int size = protocol.length() + host.length() + file.length() + 24;
+ StringBuffer sb = new StringBuffer(size);
+
+ sb.append(protocol);
+ sb.append(':');
+
+ if (host.length() != 0)
+ sb.append("//").append(host);
+
// Note that this produces different results from JDK 1.2 as JDK 1.2
// ignores a non-default port if host is null or "". That is inconsistent
// with the spec since the result of this method is spec'ed so it can be
// used to construct a new URL that is equivalent to the original.
- if (host == null)
- host = "";
- if (port >= 0 || ! (host.length() == 0))
- resStr = resStr + "//" + host + (port < 0 ? "" : ":" + port);
+ boolean port_needed = port >= 0 && port != getDefaultPort();
+ if (port_needed)
+ sb.append(':').append(port);
- resStr = resStr + file;
+ sb.append(file);
if (ref != null)
- resStr = resStr + "#" + ref;
+ sb.append('#').append(ref);
- return resStr;
+ return sb.toString();
}
}
diff --git a/libjava/java/net/natInetAddress.cc b/libjava/java/net/natInetAddress.cc
index 15e5db732a2..c0083714287 100644
--- a/libjava/java/net/natInetAddress.cc
+++ b/libjava/java/net/natInetAddress.cc
@@ -121,7 +121,7 @@ java::net::InetAddress::aton (jstring host)
#endif
#if defined (HAVE_INET_PTON) && defined (HAVE_INET6)
char inet6_addr[16];
- if (len == 0 && inet_pton (AF_INET6, hostname, inet6_addr) > 0)
+ if (len != 0 && inet_pton (AF_INET6, hostname, inet6_addr) > 0)
{
bytes = inet6_addr;
blen = 16;
diff --git a/libjava/java/net/natNetworkInterface.cc b/libjava/java/net/natNetworkInterface.cc
new file mode 100644
index 00000000000..65bcf16a2c5
--- /dev/null
+++ b/libjava/java/net/natNetworkInterface.cc
@@ -0,0 +1,144 @@
+// natNetworkInterface.cc
+
+/* Copyright (C) 2002 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 <config.h>
+#include <platform.h>
+
+#ifdef WIN32
+
+#include <windows.h>
+#include <winsock.h>
+#undef STRICT
+
+#else /* WIN32 */
+
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#include <string.h>
+#include <errno.h>
+#include <stdlib.h>
+
+#include <sys/param.h>
+#include <sys/types.h>
+#ifdef HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+#ifdef HAVE_ARPA_INET_H
+#include <arpa/inet.h>
+#endif
+#ifdef HAVE_NETDB_H
+#include <netdb.h>
+#endif
+#ifdef HAVE_SYS_IOCTL_H
+#define BSD_COMP /* Get FIONREAD on Solaris2. */
+#include <sys/ioctl.h>
+#endif
+#ifdef HAVE_NET_IF_H
+#include <net/if.h>
+#endif
+
+#endif /* WIN32 */
+
+#include <gcj/cni.h>
+#include <jvm.h>
+#include <java/net/NetworkInterface.h>
+#include <java/net/Inet4Address.h>
+#include <java/net/SocketException.h>
+#include <java/util/Vector.h>
+
+#ifdef DISABLE_JAVA_NET
+
+::java::util::Vector*
+java::net::NetworkInterface::getRealNetworkInterfaces ()
+{
+ ::java::util::Vector* ht = new ::java::util::Vector();
+ return ht;
+}
+
+#else /* DISABLE_JAVA_NET */
+
+::java::util::Vector*
+java::net::NetworkInterface::getRealNetworkInterfaces ()
+{
+#ifdef WIN32
+ throw new ::java::net::SocketException;
+#else
+ int fd;
+ int num_interfaces = 0;
+ struct ifconf if_data;
+ struct ifreq* if_record;
+ ::java::util::Vector* ht = new ::java::util::Vector ();
+
+ if_data.ifc_len = 0;
+ if_data.ifc_buf = NULL;
+
+ // Open a (random) socket to have a file descriptor for the ioctl calls.
+ fd = _Jv_socket (PF_INET, SOCK_DGRAM, htons (IPPROTO_IP));
+
+ if (fd < 0)
+ throw new ::java::net::SocketException;
+
+ // Get all interfaces. If not enough buffers are available try it
+ // with a bigger buffer size.
+ do
+ {
+ num_interfaces += 16;
+
+ if_data.ifc_len = sizeof (struct ifreq) * num_interfaces;
+ if_data.ifc_buf =
+ (char*) _Jv_Realloc (if_data.ifc_buf, if_data.ifc_len);
+
+ // Try to get all local interfaces.
+ if (::ioctl (fd, SIOCGIFCONF, &if_data) < 0)
+ throw new java::net::SocketException;
+ }
+ while (if_data.ifc_len >= (sizeof (struct ifreq) * num_interfaces));
+
+ // Get addresses of all interfaces.
+ if_record = if_data.ifc_req;
+
+ for (int n = 0; n < if_data.ifc_len; n += sizeof (struct ifreq))
+ {
+ struct ifreq ifr;
+
+ memset (&ifr, 0, sizeof (ifr));
+ strcpy (ifr.ifr_name, if_record->ifr_name);
+
+ // Try to get the IPv4-address of the local interface
+ if (::ioctl (fd, SIOCGIFADDR, &ifr) < 0)
+ throw new java::net::SocketException;
+
+ int len = 4;
+ struct sockaddr_in sa = *((sockaddr_in*) &(ifr.ifr_addr));
+
+ jbyteArray baddr = JvNewByteArray (len);
+ memcpy (elements (baddr), &(sa.sin_addr), len);
+ jstring if_name = JvNewStringLatin1 (if_record->ifr_name);
+ Inet4Address* address =
+ new java::net::Inet4Address (baddr, JvNewStringLatin1 (""));
+ ht->add (new NetworkInterface (if_name, address));
+ if_record++;
+ }
+
+#ifdef HAVE_INET6
+ // FIXME: read /proc/net/if_inet6 (on Linux 2.4)
+#endif
+
+ _Jv_Free (if_data.ifc_buf);
+
+ if (fd >= 0)
+ _Jv_close (fd);
+
+ return ht;
+#endif /* WIN32 */
+}
+
+#endif // DISABLE_JAVA_NET //
diff --git a/libjava/java/net/natPlainDatagramSocketImpl.cc b/libjava/java/net/natPlainDatagramSocketImpl.cc
index 2375bdbae4e..5546061c503 100644
--- a/libjava/java/net/natPlainDatagramSocketImpl.cc
+++ b/libjava/java/net/natPlainDatagramSocketImpl.cc
@@ -7,26 +7,15 @@ Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
details. */
#include <config.h>
-
#include <platform.h>
#ifdef WIN32
+
#include <errno.h>
#include <string.h>
-#ifndef ENOPROTOOPT
-#define ENOPROTOOPT 109
-#endif
-
-static inline int
-close(int s)
-{
- return closesocket(s);
-}
#else /* WIN32 */
-#ifdef HAVE_SYS_SOCKET_H
-#include <sys/socket.h>
-#endif
+
#ifdef HAVE_NETINET_IN_H
#include <netinet/in.h>
#endif
@@ -35,6 +24,7 @@ close(int s)
#endif
#include <errno.h>
#include <string.h>
+
#endif /* WIN32 */
#if HAVE_BSTRING_H
@@ -42,20 +32,6 @@ close(int s)
#include <bstring.h>
#endif
-#ifndef DISABLE_JAVA_NET
-// Avoid macro definitions of bind from system headers, e.g. on
-// Solaris 7 with _XOPEN_SOURCE. FIXME
-static inline int
-_Jv_bind (int fd, struct sockaddr *addr, int addrlen)
-{
- return ::bind (fd, addr, addrlen);
-}
-#endif /* DISABLE_JAVA_NET */
-
-#ifdef bind
-#undef bind
-#endif
-
#include <gcj/cni.h>
#include <java/io/IOException.h>
#include <java/io/InterruptedIOException.h>
@@ -63,7 +39,9 @@ _Jv_bind (int fd, struct sockaddr *addr, int addrlen)
#include <java/net/SocketException.h>
#include <java/net/PlainDatagramSocketImpl.h>
#include <java/net/InetAddress.h>
+#include <java/net/NetworkInterface.h>
#include <java/net/DatagramPacket.h>
+#include <java/net/PortUnreachableException.h>
#include <java/lang/InternalError.h>
#include <java/lang/Object.h>
#include <java/lang/Boolean.h>
@@ -85,6 +63,20 @@ java::net::PlainDatagramSocketImpl::bind (jint, java::net::InetAddress *)
JvNewStringLatin1 ("DatagramSocketImpl.bind: unimplemented"));
}
+void
+java::net::PlainDatagramSocketImpl::connect (java::net::InetAddress *, jint)
+{
+ throw new SocketException (
+ JvNewStringLatin1 ("DatagramSocketImpl.connect: unimplemented"));
+}
+
+void
+java::net::PlainDatagramSocketImpl::disconnect ()
+{
+ throw new SocketException (
+ JvNewStringLatin1 ("DatagramSocketImpl.disconnect: unimplemented"));
+}
+
jint
java::net::PlainDatagramSocketImpl::peek (java::net::InetAddress *)
{
@@ -92,6 +84,13 @@ java::net::PlainDatagramSocketImpl::peek (java::net::InetAddress *)
JvNewStringLatin1 ("DatagramSocketImpl.peek: unimplemented"));
}
+jint
+java::net::PlainDatagramSocketImpl::peekData(java::net::DatagramPacket *)
+{
+ throw new java::io::IOException (
+ JvNewStringLatin1 ("DatagramSocketImpl.peekData: unimplemented"));
+}
+
void
java::net::PlainDatagramSocketImpl::close ()
{
@@ -129,6 +128,7 @@ java::net::PlainDatagramSocketImpl::getTimeToLive ()
void
java::net::PlainDatagramSocketImpl::mcastGrp (java::net::InetAddress *,
+ java::net::NetworkInterface *,
jboolean)
{
throw new java::io::IOException (
@@ -151,9 +151,6 @@ java::net::PlainDatagramSocketImpl::getOption (jint)
#else /* DISABLE_JAVA_NET */
-#ifndef HAVE_SOCKLEN_T
-typedef int socklen_t;
-#endif
union SockAddr
{
@@ -188,7 +185,8 @@ union InAddr
void
java::net::PlainDatagramSocketImpl::create ()
{
- int sock = ::socket (AF_INET, SOCK_DGRAM, 0);
+ int sock = _Jv_socket (AF_INET, SOCK_DGRAM, 0);
+
if (sock < 0)
{
char* strerr = strerror (errno);
@@ -216,10 +214,12 @@ java::net::PlainDatagramSocketImpl::bind (jint lport,
if (len == 4)
{
u.address.sin_family = AF_INET;
+
if (host != NULL)
- memcpy (&u.address.sin_addr, bytes, len);
+ memcpy (&u.address.sin_addr, bytes, len);
else
- u.address.sin_addr.s_addr = htonl (INADDR_ANY);
+ u.address.sin_addr.s_addr = htonl (INADDR_ANY);
+
len = sizeof (struct sockaddr_in);
u.address.sin_port = htons (lport);
}
@@ -238,24 +238,42 @@ java::net::PlainDatagramSocketImpl::bind (jint lport,
if (_Jv_bind (fnum, ptr, len) == 0)
{
socklen_t addrlen = sizeof(u);
+
if (lport != 0)
localPort = lport;
else if (::getsockname (fnum, (sockaddr*) &u, &addrlen) == 0)
localPort = ntohs (u.address.sin_port);
else
goto error;
+
/* Allow broadcast by default. */
int broadcast = 1;
if (::setsockopt (fnum, SOL_SOCKET, SO_BROADCAST, (char *) &broadcast,
sizeof (broadcast)) != 0)
goto error;
+
return;
}
+
error:
char* strerr = strerror (errno);
throw new java::net::BindException (JvNewStringUTF (strerr));
}
+void
+java::net::PlainDatagramSocketImpl::connect (java::net::InetAddress *, jint)
+{
+ throw new ::java::lang::InternalError (JvNewStringLatin1 (
+ "PlainDatagramSocketImpl::connect: not implemented yet"));
+}
+
+void
+java::net::PlainDatagramSocketImpl::disconnect ()
+{
+ throw new ::java::lang::InternalError (JvNewStringLatin1 (
+ "PlainDatagramSocketImpl::disconnect: not implemented yet"));
+}
+
jint
java::net::PlainDatagramSocketImpl::peek (java::net::InetAddress *i)
{
@@ -291,6 +309,77 @@ java::net::PlainDatagramSocketImpl::peek (java::net::InetAddress *i)
return rport;
error:
char* strerr = strerror (errno);
+
+ if (errno == ECONNREFUSED)
+ throw new PortUnreachableException (JvNewStringUTF (strerr));
+
+ throw new java::io::IOException (JvNewStringUTF (strerr));
+}
+
+jint
+java::net::PlainDatagramSocketImpl::peekData(java::net::DatagramPacket *p)
+{
+ // FIXME: Deal with Multicast and if the socket is connected.
+ union SockAddr u;
+ socklen_t addrlen = sizeof(u);
+ jbyte *dbytes = elements (p->getData());
+ ssize_t retlen = 0;
+
+// FIXME: implement timeout support for Win32
+#ifndef WIN32
+ // Do timeouts via select since SO_RCVTIMEO is not always available.
+ if (timeout > 0 && fnum >= 0 && fnum < FD_SETSIZE)
+ {
+ fd_set rset;
+ struct timeval tv;
+ FD_ZERO(&rset);
+ FD_SET(fnum, &rset);
+ tv.tv_sec = timeout / 1000;
+ tv.tv_usec = (timeout % 1000) * 1000;
+ int retval;
+ if ((retval = _Jv_select (fnum + 1, &rset, NULL, NULL, &tv)) < 0)
+ goto error;
+ else if (retval == 0)
+ throw new java::io::InterruptedIOException ();
+ }
+#endif /* WIN32 */
+
+ retlen =
+ ::recvfrom (fnum, (char *) dbytes, p->getLength(), MSG_PEEK, (sockaddr*) &u,
+ &addrlen);
+ if (retlen < 0)
+ goto error;
+ // FIXME: Deal with Multicast addressing and if the socket is connected.
+ jbyteArray raddr;
+ jint rport;
+ if (u.address.sin_family == AF_INET)
+ {
+ raddr = JvNewByteArray (4);
+ memcpy (elements (raddr), &u.address.sin_addr, 4);
+ rport = ntohs (u.address.sin_port);
+ }
+#ifdef HAVE_INET6
+ else if (u.address.sin_family == AF_INET6)
+ {
+ raddr = JvNewByteArray (16);
+ memcpy (elements (raddr), &u.address6.sin6_addr, 16);
+ rport = ntohs (u.address6.sin6_port);
+ }
+#endif
+ else
+ throw new java::net::SocketException (JvNewStringUTF ("invalid family"));
+
+ p->setAddress (new InetAddress (raddr, NULL));
+ p->setPort (rport);
+ p->setLength ((jint) retlen);
+ return rport;
+
+ error:
+ char* strerr = strerror (errno);
+
+ if (errno == ECONNREFUSED)
+ throw new PortUnreachableException (JvNewStringUTF (strerr));
+
throw new java::io::IOException (JvNewStringUTF (strerr));
}
@@ -303,7 +392,7 @@ java::net::PlainDatagramSocketImpl::close ()
// The method isn't declared to throw anything, so we disregard
// the return value.
- ::close (fnum);
+ _Jv_close (fnum);
fnum = -1;
timeout = 0;
}
@@ -342,6 +431,10 @@ java::net::PlainDatagramSocketImpl::send (java::net::DatagramPacket *p)
return;
char* strerr = strerror (errno);
+
+ if (errno == ECONNREFUSED)
+ throw new PortUnreachableException (JvNewStringUTF (strerr));
+
throw new java::io::IOException (JvNewStringUTF (strerr));
}
@@ -367,9 +460,9 @@ java::net::PlainDatagramSocketImpl::receive (java::net::DatagramPacket *p)
tv.tv_usec = (timeout % 1000) * 1000;
int retval;
if ((retval = _Jv_select (fnum + 1, &rset, NULL, NULL, &tv)) < 0)
- goto error;
+ goto error;
else if (retval == 0)
- throw new java::io::InterruptedIOException ();
+ throw new java::io::InterruptedIOException ();
}
#endif /* WIN32 */
@@ -402,8 +495,13 @@ java::net::PlainDatagramSocketImpl::receive (java::net::DatagramPacket *p)
p->setPort (rport);
p->setLength ((jint) retlen);
return;
+
error:
char* strerr = strerror (errno);
+
+ if (errno == ECONNREFUSED)
+ throw new PortUnreachableException (JvNewStringUTF (strerr));
+
throw new java::io::IOException (JvNewStringUTF (strerr));
}
@@ -413,6 +511,7 @@ java::net::PlainDatagramSocketImpl::setTimeToLive (jint ttl)
// Assumes IPPROTO_IP rather than IPPROTO_IPV6 since socket created is IPv4.
char val = (char) ttl;
socklen_t val_len = sizeof(val);
+
if (::setsockopt (fnum, IPPROTO_IP, IP_MULTICAST_TTL, &val, val_len) == 0)
return;
@@ -426,6 +525,7 @@ java::net::PlainDatagramSocketImpl::getTimeToLive ()
// Assumes IPPROTO_IP rather than IPPROTO_IPV6 since socket created is IPv4.
char val;
socklen_t val_len = sizeof(val);
+
if (::getsockopt (fnum, IPPROTO_IP, IP_MULTICAST_TTL, &val, &val_len) == 0)
return ((int) val) & 0xFF;
@@ -435,8 +535,11 @@ java::net::PlainDatagramSocketImpl::getTimeToLive ()
void
java::net::PlainDatagramSocketImpl::mcastGrp (java::net::InetAddress *inetaddr,
+ java::net::NetworkInterface *,
jboolean join)
{
+ // FIXME: implement use of NetworkInterface
+
union McastReq u;
jbyteArray haddress = inetaddr->addr;
jbyte *bytes = elements (haddress);
@@ -524,6 +627,22 @@ java::net::PlainDatagramSocketImpl::setOption (jint optID,
throw new java::net::SocketException (
JvNewStringUTF ("SO_LINGER not valid for UDP"));
return;
+ case _Jv_SO_KEEPALIVE_ :
+ throw new java::net::SocketException (
+ JvNewStringUTF ("SO_KEEPALIVE not valid for UDP"));
+ return;
+
+ case _Jv_SO_BROADCAST_ :
+ if (::setsockopt (fnum, SOL_SOCKET, SO_BROADCAST, (char *) &val,
+ val_len) != 0)
+ goto error;
+ break;
+
+ case _Jv_SO_OOBINLINE_ :
+ throw new java::net::SocketException (
+ JvNewStringUTF ("SO_OOBINLINE: not valid for UDP"));
+ break;
+
case _Jv_SO_SNDBUF_ :
case _Jv_SO_RCVBUF_ :
#if defined(SO_SNDBUF) && defined(SO_RCVBUF)
@@ -587,6 +706,23 @@ java::net::PlainDatagramSocketImpl::setOption (jint optID,
if (::setsockopt (fnum, level, opname, ptr, len) != 0)
goto error;
return;
+
+ case _Jv_IP_MULTICAST_IF2_ :
+ throw new java::net::SocketException (
+ JvNewStringUTF ("IP_MULTICAST_IF2: not yet implemented"));
+ break;
+
+ case _Jv_IP_MULTICAST_LOOP_ :
+ throw new java::net::SocketException (
+ JvNewStringUTF ("IP_MULTICAST_LOOP: not yet implemented"));
+ break;
+
+ case _Jv_IP_TOS_ :
+ if (::setsockopt (fnum, SOL_SOCKET, IP_TOS, (char *) &val,
+ val_len) != 0)
+ goto error;
+ return;
+
case _Jv_SO_TIMEOUT_ :
timeout = val;
return;
@@ -613,11 +749,26 @@ java::net::PlainDatagramSocketImpl::getOption (jint optID)
throw new java::net::SocketException (
JvNewStringUTF ("TCP_NODELAY not valid for UDP"));
break;
-
case _Jv_SO_LINGER_ :
throw new java::net::SocketException (
JvNewStringUTF ("SO_LINGER not valid for UDP"));
break;
+ case _Jv_SO_KEEPALIVE_ :
+ throw new java::net::SocketException (
+ JvNewStringUTF ("SO_KEEPALIVE not valid for UDP"));
+ break;
+
+ case _Jv_SO_BROADCAST_ :
+ if (::getsockopt (fnum, SOL_SOCKET, SO_BROADCAST, (char *) &val,
+ &val_len) != 0)
+ goto error;
+ return new java::lang::Boolean (val != 0);
+
+ case _Jv_SO_OOBINLINE_ :
+ throw new java::net::SocketException (
+ JvNewStringUTF ("SO_OOBINLINE not valid for UDP"));
+ break;
+
case _Jv_SO_RCVBUF_ :
case _Jv_SO_SNDBUF_ :
#if defined(SO_SNDBUF) && defined(SO_RCVBUF)
@@ -652,7 +803,8 @@ java::net::PlainDatagramSocketImpl::getOption (jint optID)
}
#endif
else
- throw new java::net::SocketException (JvNewStringUTF ("invalid family"));
+ throw new java::net::SocketException (
+ JvNewStringUTF ("invalid family"));
localAddress = new java::net::InetAddress (laddr, NULL);
}
return localAddress;
@@ -690,6 +842,24 @@ java::net::PlainDatagramSocketImpl::getOption (jint optID)
case _Jv_SO_TIMEOUT_ :
return new java::lang::Integer (timeout);
break;
+
+ case _Jv_IP_MULTICAST_IF2_ :
+ throw new java::net::SocketException (
+ JvNewStringUTF ("IP_MULTICAST_IF2: not yet implemented"));
+ break;
+
+ case _Jv_IP_MULTICAST_LOOP_ :
+ if (::getsockopt (fnum, SOL_SOCKET, IP_MULTICAST_LOOP, (char *) &val,
+ &val_len) != 0)
+ goto error;
+ return new java::lang::Boolean (val != 0);
+
+ case _Jv_IP_TOS_ :
+ if (::getsockopt (fnum, SOL_SOCKET, IP_TOS, (char *) &val,
+ &val_len) != 0)
+ goto error;
+ return new java::lang::Integer (val);
+
default :
errno = ENOPROTOOPT;
}
diff --git a/libjava/java/net/natPlainSocketImpl.cc b/libjava/java/net/natPlainSocketImpl.cc
index 4a75e980073..114c2102ac5 100644
--- a/libjava/java/net/natPlainSocketImpl.cc
+++ b/libjava/java/net/natPlainSocketImpl.cc
@@ -10,7 +10,9 @@ details. */
#include <platform.h>
#ifndef DISABLE_JAVA_NET
+
#ifdef WIN32
+
#include <windows.h>
#include <winsock.h>
#include <errno.h>
@@ -22,12 +24,6 @@ details. */
// These functions make the Win32 socket API look more POSIXy
static inline int
-close(int s)
-{
- return closesocket(s);
-}
-
-static inline int
write(int s, void *buf, int len)
{
return send(s, (char*)buf, len, 0);
@@ -40,11 +36,6 @@ read(int s, void *buf, int len)
}
// these errors cannot occur on Win32
-#define ENOTCONN 0
-#define ECONNRESET 0
-#ifndef ENOPROTOOPT
-#define ENOPROTOOPT 109
-#endif
#else /* WIN32 */
#ifdef HAVE_SYS_IOCTL_H
@@ -57,7 +48,6 @@ read(int s, void *buf, int len)
#include <sys/filio.h>
#endif
-#include <sys/socket.h>
#include <netinet/in.h>
#include <netinet/tcp.h>
#include <errno.h>
@@ -71,46 +61,6 @@ read(int s, void *buf, int len)
#include <bstring.h>
#endif
-#ifndef HAVE_SOCKLEN_T
-typedef int socklen_t;
-#endif
-
-#ifndef DISABLE_JAVA_NET
-
-// Avoid macro definitions of bind, connect from system headers, e.g. on
-// Solaris 7 with _XOPEN_SOURCE. FIXME
-static inline int
-_Jv_bind (int fd, struct sockaddr *addr, int addrlen)
-{
- return ::bind (fd, addr, addrlen);
-}
-
-#ifdef bind
-#undef bind
-#endif
-
-static inline int
-_Jv_connect (int fd, struct sockaddr *addr, int addrlen)
-{
- return ::connect (fd, addr, addrlen);
-}
-
-#ifdef connect
-#undef connect
-#endif
-
-// Same problem with accept on Tru64 UNIX with _POSIX_PII_SOCKET
-static inline int
-_Jv_accept (int fd, struct sockaddr *addr, socklen_t *addrlen)
-{
- return ::accept (fd, addr, addrlen);
-}
-
-#ifdef accept
-#undef accept
-#endif
-
-#endif /* DISABLE_JAVA_NET */
#include <gcj/cni.h>
#include <gcj/javaprims.h>
@@ -120,7 +70,9 @@ _Jv_accept (int fd, struct sockaddr *addr, socklen_t *addrlen)
#include <java/net/ConnectException.h>
#include <java/net/PlainSocketImpl.h>
#include <java/net/InetAddress.h>
+#include <java/net/InetSocketAddress.h>
#include <java/net/SocketException.h>
+#include <java/net/SocketTimeoutException.h>
#include <java/lang/InternalError.h>
#include <java/lang/Object.h>
#include <java/lang/Boolean.h>
@@ -148,7 +100,7 @@ java::net::PlainSocketImpl::bind (java::net::InetAddress *, jint)
}
void
-java::net::PlainSocketImpl::connect (java::net::InetAddress *, jint)
+java::net::PlainSocketImpl::connect (java::net::SocketAddress *, jint)
{
throw new ConnectException (
JvNewStringLatin1 ("SocketImpl.connect: unimplemented"));
@@ -210,6 +162,13 @@ java::net::PlainSocketImpl::write(jbyteArray b, jint offset, jint len)
JvNewStringLatin1 ("SocketImpl.write: unimplemented"));
}
+void
+java::net::PlainSocketImpl::sendUrgentData(jint data)
+{
+ throw new SocketException (
+ JvNewStringLatin1 ("SocketImpl.sendUrgentData: unimplemented"));
+}
+
jint
java::net::PlainSocketImpl::available(void)
{
@@ -224,6 +183,20 @@ java::net::PlainSocketImpl::close(void)
JvNewStringLatin1 ("SocketImpl.close: unimplemented"));
}
+void
+java::net::PlainSocketImpl::shutdownInput (void)
+{
+ throw new SocketException (
+ JvNewStringLatin1 ("SocketImpl.shutdownInput: unimplemented"));
+}
+
+void
+java::net::PlainSocketImpl::shutdownOutput (void)
+{
+ throw new SocketException (
+ JvNewStringLatin1 ("SocketImpl.shutdownOutput: unimplemented"));
+}
+
#else /* DISABLE_JAVA_NET */
union SockAddr
@@ -237,7 +210,8 @@ union SockAddr
void
java::net::PlainSocketImpl::create (jboolean stream)
{
- int sock = ::socket (AF_INET, stream ? SOCK_STREAM : SOCK_DGRAM, 0);
+ int sock = _Jv_socket (AF_INET, stream ? SOCK_STREAM : SOCK_DGRAM, 0);
+
if (sock < 0)
{
char* strerr = strerror (errno);
@@ -264,10 +238,12 @@ java::net::PlainSocketImpl::bind (java::net::InetAddress *host, jint lport)
if (len == 4)
{
u.address.sin_family = AF_INET;
+
if (host != NULL)
memcpy (&u.address.sin_addr, bytes, len);
else
- u.address.sin_addr.s_addr = htonl (INADDR_ANY);
+ u.address.sin_addr.s_addr = htonl (INADDR_ANY);
+
len = sizeof (struct sockaddr_in);
u.address.sin_port = htons (lport);
}
@@ -290,22 +266,30 @@ java::net::PlainSocketImpl::bind (java::net::InetAddress *host, jint lport)
{
address = host;
socklen_t addrlen = sizeof(u);
+
if (lport != 0)
localport = lport;
else if (::getsockname (fnum, (sockaddr*) &u, &addrlen) == 0)
localport = ntohs (u.address.sin_port);
else
goto error;
+
return;
}
+
error:
char* strerr = strerror (errno);
throw new java::net::BindException (JvNewStringUTF (strerr));
}
void
-java::net::PlainSocketImpl::connect (java::net::InetAddress *host, jint rport)
+java::net::PlainSocketImpl::connect (java::net::SocketAddress *addr,
+ jint timeout)
{
+ java::net::InetSocketAddress *tmp = (java::net::InetSocketAddress*) addr;
+ java::net::InetAddress *host = tmp->getAddress();
+ jint rport = tmp->getPort();
+
union SockAddr u;
socklen_t addrlen = sizeof(u);
jbyteArray haddress = host->addr;
@@ -331,19 +315,51 @@ java::net::PlainSocketImpl::connect (java::net::InetAddress *host, jint rport)
else
throw new java::net::SocketException (JvNewStringUTF ("invalid length"));
- if (_Jv_connect (fnum, ptr, len) != 0)
- goto error;
+// FIXME: implement timeout support for Win32
+#ifndef WIN32
+ if (timeout > 0)
+ {
+ int flags = ::fcntl (fnum, F_GETFL);
+ ::fcntl (fnum, F_SETFL, flags | O_NONBLOCK);
+
+ if ((_Jv_connect (fnum, ptr, len) != 0) && (errno != EINPROGRESS))
+ goto error;
+
+ fd_set rset;
+ struct timeval tv;
+ FD_ZERO(&rset);
+ FD_SET(fnum, &rset);
+ tv.tv_sec = timeout / 1000;
+ tv.tv_usec = (timeout % 1000) * 1000;
+ int retval;
+
+ if ((retval = _Jv_select (fnum + 1, &rset, NULL, NULL, &tv)) < 0)
+ goto error;
+ else if (retval == 0)
+ throw new java::net::SocketTimeoutException
+ (JvNewStringUTF ("Connect timed out"));
+ }
+ else
+#endif
+ {
+ if (_Jv_connect (fnum, ptr, len) != 0)
+ goto error;
+ }
+
address = host;
port = rport;
+
// A bind may not have been done on this socket; if so, set localport now.
if (localport == 0)
{
if (::getsockname (fnum, (sockaddr*) &u, &addrlen) == 0)
- localport = ntohs (u.address.sin_port);
+ localport = ntohs (u.address.sin_port);
else
- goto error;
+ goto error;
}
+
return;
+
error:
char* strerr = strerror (errno);
throw new java::net::ConnectException (JvNewStringUTF (strerr));
@@ -379,14 +395,15 @@ java::net::PlainSocketImpl::accept (java::net::PlainSocketImpl *s)
tv.tv_usec = (timeout % 1000) * 1000;
int retval;
if ((retval = _Jv_select (fnum + 1, &rset, NULL, NULL, &tv)) < 0)
- goto error;
+ goto error;
else if (retval == 0)
- throw new java::io::InterruptedIOException (
- JvNewStringUTF("Accept timed out"));
+ throw new java::io::InterruptedIOException (
+ JvNewStringUTF("Accept timed out"));
}
#endif /* WIN32 */
new_socket = _Jv_accept (fnum, (sockaddr*) &u, &addrlen);
+
if (new_socket < 0)
goto error;
@@ -416,6 +433,7 @@ java::net::PlainSocketImpl::accept (java::net::PlainSocketImpl *s)
s->address = new InetAddress (raddr, NULL);
s->port = rport;
return;
+
error:
char* strerr = strerror (errno);
throw new java::io::IOException (JvNewStringUTF (strerr));
@@ -429,14 +447,14 @@ java::net::PlainSocketImpl::close()
JvSynchronize sync (this);
// should we use shutdown here? how would that effect so_linger?
- int res = ::close (fnum);
+ int res = _Jv_close (fnum);
if (res == -1)
{
// These three errors are not errors according to tests performed
// on the reference implementation.
if (errno != ENOTCONN && errno != ECONNRESET && errno != EBADF)
- throw new java::io::IOException (JvNewStringUTF (strerror (errno)));
+ throw new java::io::IOException (JvNewStringUTF (strerror (errno)));
}
// Safe place to reset the file pointer.
fnum = -1;
@@ -452,22 +470,22 @@ java::net::PlainSocketImpl::write(jint b)
while (r != 1)
{
- r = ::write (fnum, &d, 1);
+ r = _Jv_write (fnum, &d, 1);
if (r == -1)
- {
- if (java::lang::Thread::interrupted())
- {
- java::io::InterruptedIOException *iioe
- = new java::io::InterruptedIOException
- (JvNewStringLatin1 (strerror (errno)));
- iioe->bytesTransferred = 0;
- throw iioe;
- }
- // Some errors should not cause exceptions.
- if (errno != ENOTCONN && errno != ECONNRESET && errno != EBADF)
- throw new java::io::IOException (JvNewStringUTF (strerror (errno)));
- break;
- }
+ {
+ if (java::lang::Thread::interrupted())
+ {
+ java::io::InterruptedIOException *iioe
+ = new java::io::InterruptedIOException
+ (JvNewStringLatin1 (strerror (errno)));
+ iioe->bytesTransferred = 0;
+ throw iioe;
+ }
+ // Some errors should not cause exceptions.
+ if (errno != ENOTCONN && errno != ECONNRESET && errno != EBADF)
+ throw new java::io::IOException (JvNewStringUTF (strerror (errno)));
+ break;
+ }
}
}
@@ -482,30 +500,39 @@ java::net::PlainSocketImpl::write(jbyteArray b, jint offset, jint len)
jbyte *bytes = elements (b) + offset;
int written = 0;
+
while (len > 0)
{
- int r = ::write (fnum, bytes, len);
+ int r = _Jv_write (fnum, bytes, len);
+
if (r == -1)
{
- if (java::lang::Thread::interrupted())
- {
- java::io::InterruptedIOException *iioe
- = new java::io::InterruptedIOException
- (JvNewStringLatin1 (strerror (errno)));
- iioe->bytesTransferred = written;
- throw iioe;
- }
- // Some errors should not cause exceptions.
- if (errno != ENOTCONN && errno != ECONNRESET && errno != EBADF)
- throw new java::io::IOException (JvNewStringUTF (strerror (errno)));
- break;
- }
+ if (java::lang::Thread::interrupted())
+ {
+ java::io::InterruptedIOException *iioe
+ = new java::io::InterruptedIOException
+ (JvNewStringLatin1 (strerror (errno)));
+ iioe->bytesTransferred = written;
+ throw iioe;
+ }
+ // Some errors should not cause exceptions.
+ if (errno != ENOTCONN && errno != ECONNRESET && errno != EBADF)
+ throw new java::io::IOException (JvNewStringUTF (strerror (errno)));
+ break;
+ }
+
written += r;
len -= r;
bytes += r;
}
}
+void
+java::net::PlainSocketImpl::sendUrgentData (jint)
+{
+ throw new SocketException (JvNewStringLatin1 (
+ "PlainSocketImpl: sending of urgent data not supported by this socket"));
+}
// Read a single byte from the socket.
jint
@@ -517,36 +544,38 @@ java::net::PlainSocketImpl::read(void)
#ifndef WIN32
// Do timeouts via select.
if (timeout > 0 && fnum >= 0 && fnum < FD_SETSIZE)
- {
- // Create the file descriptor set.
- fd_set read_fds;
- FD_ZERO (&read_fds);
- FD_SET (fnum,&read_fds);
- // Create the timeout struct based on our internal timeout value.
- struct timeval timeout_value;
- timeout_value.tv_sec = timeout / 1000;
- timeout_value.tv_usec = (timeout % 1000) * 1000;
- // Select on the fds.
- int sel_retval = _Jv_select (fnum + 1, &read_fds, NULL, NULL, &timeout_value);
- // If select returns 0 we've waited without getting data...
- // that means we've timed out.
- if (sel_retval == 0)
- throw new java::io::InterruptedIOException
- (JvNewStringUTF ("read timed out") );
- // If select returns ok we know we either got signalled or read some data...
- // either way we need to try to read.
- }
+ {
+ // Create the file descriptor set.
+ fd_set read_fds;
+ FD_ZERO (&read_fds);
+ FD_SET (fnum,&read_fds);
+ // Create the timeout struct based on our internal timeout value.
+ struct timeval timeout_value;
+ timeout_value.tv_sec = timeout / 1000;
+ timeout_value.tv_usec = (timeout % 1000) * 1000;
+ // Select on the fds.
+ int sel_retval =
+ _Jv_select (fnum + 1, &read_fds, NULL, NULL, &timeout_value);
+ // If select returns 0 we've waited without getting data...
+ // that means we've timed out.
+ if (sel_retval == 0)
+ throw new java::io::InterruptedIOException
+ (JvNewStringUTF ("read timed out") );
+ // If select returns ok we know we either got signalled or read some data...
+ // either way we need to try to read.
+ }
#endif /* WIN32 */
- int r = ::read (fnum, &b, 1);
+ int r = _Jv_read (fnum, &b, 1);
if (r == 0)
return -1;
+
if (java::lang::Thread::interrupted())
{
java::io::InterruptedIOException *iioe =
- new java::io::InterruptedIOException
- (JvNewStringUTF("read interrupted"));
+ new java::io::InterruptedIOException
+ (JvNewStringUTF("read interrupted"));
iioe->bytesTransferred = r == -1 ? 0 : r;
throw iioe;
}
@@ -554,10 +583,12 @@ java::net::PlainSocketImpl::read(void)
{
// Some errors cause us to return end of stream...
if (errno == ENOTCONN)
- return -1;
+ return -1;
+
// Other errors need to be signalled.
throw new java::io::IOException (JvNewStringUTF (strerror (errno)));
}
+
return b & 0xFF;
}
@@ -567,49 +598,55 @@ java::net::PlainSocketImpl::read(jbyteArray buffer, jint offset, jint count)
{
if (! buffer)
throw new java::lang::NullPointerException;
+
jsize bsize = JvGetArrayLength (buffer);
+
if (offset < 0 || count < 0 || offset + count > bsize)
throw new java::lang::ArrayIndexOutOfBoundsException;
+
jbyte *bytes = elements (buffer) + offset;
// FIXME: implement timeout support for Win32
#ifndef WIN32
// Do timeouts via select.
if (timeout > 0 && fnum >= 0 && fnum < FD_SETSIZE)
- {
- // Create the file descriptor set.
- fd_set read_fds;
- FD_ZERO (&read_fds);
- FD_SET (fnum, &read_fds);
- // Create the timeout struct based on our internal timeout value.
- struct timeval timeout_value;
- timeout_value.tv_sec = timeout / 1000;
- timeout_value.tv_usec =(timeout % 1000) * 1000;
- // Select on the fds.
- int sel_retval = _Jv_select (fnum + 1, &read_fds, NULL, NULL, &timeout_value);
- // We're only interested in the 0 return.
- // error returns still require us to try to read
- // the socket to see what happened.
- if (sel_retval == 0)
- {
- java::io::InterruptedIOException *iioe =
- new java::io::InterruptedIOException
- (JvNewStringUTF ("read interrupted"));
- iioe->bytesTransferred = 0;
- throw iioe;
- }
- }
+ {
+ // Create the file descriptor set.
+ fd_set read_fds;
+ FD_ZERO (&read_fds);
+ FD_SET (fnum, &read_fds);
+ // Create the timeout struct based on our internal timeout value.
+ struct timeval timeout_value;
+ timeout_value.tv_sec = timeout / 1000;
+ timeout_value.tv_usec =(timeout % 1000) * 1000;
+ // Select on the fds.
+ int sel_retval =
+ _Jv_select (fnum + 1, &read_fds, NULL, NULL, &timeout_value);
+ // We're only interested in the 0 return.
+ // error returns still require us to try to read
+ // the socket to see what happened.
+ if (sel_retval == 0)
+ {
+ java::io::InterruptedIOException *iioe =
+ new java::io::InterruptedIOException
+ (JvNewStringUTF ("read interrupted"));
+ iioe->bytesTransferred = 0;
+ throw iioe;
+ }
+ }
#endif
// Read the socket.
int r = ::recv (fnum, (char *) bytes, count, 0);
+
if (r == 0)
return -1;
+
if (java::lang::Thread::interrupted())
{
java::io::InterruptedIOException *iioe =
- new java::io::InterruptedIOException
- (JvNewStringUTF ("read interrupted"));
+ new java::io::InterruptedIOException
+ (JvNewStringUTF ("read interrupted"));
iioe->bytesTransferred = r == -1 ? 0 : r;
throw iioe;
}
@@ -617,10 +654,12 @@ java::net::PlainSocketImpl::read(jbyteArray buffer, jint offset, jint count)
{
// Some errors cause us to return end of stream...
if (errno == ENOTCONN)
- return -1;
+ return -1;
+
// Other errors need to be signalled.
throw new java::io::IOException (JvNewStringUTF (strerror (errno)));
}
+
return r;
}
@@ -635,6 +674,7 @@ java::net::PlainSocketImpl::available(void)
#if defined(FIONREAD)
r = ::ioctl (fnum, FIONREAD, &num);
+
if (r == -1 && errno == ENOTTY)
{
// If the ioctl doesn't work, we don't care.
@@ -655,34 +695,32 @@ java::net::PlainSocketImpl::available(void)
{
posix_error:
throw new java::io::IOException(JvNewStringUTF(strerror(errno)));
-
}
// If we didn't get anything we can use select.
#if defined(HAVE_SELECT)
if (! num_set)
- if (! num_set && fnum >= 0 && fnum < FD_SETSIZE)
- {
- fd_set rd;
- FD_ZERO (&rd);
- FD_SET (fnum, &rd);
- struct timeval tv;
- tv.tv_sec = 0;
- tv.tv_usec = 0;
- r = _Jv_select (fnum + 1, &rd, NULL, NULL, &tv);
- if(r == -1)
- goto posix_error;
- num = r == 0 ? 0 : 1;
- }
+ if (! num_set && fnum >= 0 && fnum < FD_SETSIZE)
+ {
+ fd_set rd;
+ FD_ZERO (&rd);
+ FD_SET (fnum, &rd);
+ struct timeval tv;
+ tv.tv_sec = 0;
+ tv.tv_usec = 0;
+ r = _Jv_select (fnum + 1, &rd, NULL, NULL, &tv);
+ if(r == -1)
+ goto posix_error;
+ num = r == 0 ? 0 : 1;
+ }
#endif /* HAVE_SELECT */
return (jint) num;
#else
throw new java::io::IOException (JvNewStringUTF ("unimplemented"));
#endif
- }
-
+}
void
java::net::PlainSocketImpl::setOption (jint optID, java::lang::Object *value)
@@ -701,10 +739,10 @@ java::net::PlainSocketImpl::setOption (jint optID, java::lang::Object *value)
val = 1;
else
{
- if (optID == _Jv_SO_LINGER_)
- val = -1;
- else
- val = 0;
+ if (optID == _Jv_SO_LINGER_)
+ val = -1;
+ else
+ val = 0;
}
}
else if (_Jv_IsInstanceOf (value, &java::lang::Integer::class$))
@@ -715,7 +753,8 @@ java::net::PlainSocketImpl::setOption (jint optID, java::lang::Object *value)
}
else
{
- throw new java::lang::IllegalArgumentException (JvNewStringLatin1 ("`value' must be Boolean or Integer"));
+ throw new java::lang::IllegalArgumentException (
+ JvNewStringLatin1 ("`value' must be Boolean or Integer"));
}
switch (optID)
@@ -723,53 +762,94 @@ java::net::PlainSocketImpl::setOption (jint optID, java::lang::Object *value)
case _Jv_TCP_NODELAY_ :
#ifdef TCP_NODELAY
if (::setsockopt (fnum, IPPROTO_TCP, TCP_NODELAY, (char *) &val,
- val_len) != 0)
- goto error;
+ val_len) != 0)
+ goto error;
#else
- throw new java::lang::InternalError (
- JvNewStringUTF ("TCP_NODELAY not supported"));
+ throw new java::lang::InternalError
+ (JvNewStringUTF ("TCP_NODELAY not supported"));
#endif /* TCP_NODELAY */
return;
+
+ case _Jv_SO_KEEPALIVE_ :
+ if (::setsockopt (fnum, SOL_SOCKET, SO_KEEPALIVE, (char *) &val,
+ val_len) != 0)
+ goto error;
+ break;
+
+ case _Jv_SO_BROADCAST_ :
+ throw new java::net::SocketException
+ (JvNewStringUTF ("SO_BROADCAST not valid for TCP"));
+ break;
+
+ case _Jv_SO_OOBINLINE_ :
+ if (::setsockopt (fnum, SOL_SOCKET, SO_OOBINLINE, (char *) &val,
+ val_len) != 0)
+ goto error;
+ break;
+
case _Jv_SO_LINGER_ :
#ifdef SO_LINGER
struct linger l_val;
l_val.l_onoff = (val != -1);
l_val.l_linger = val;
+
if (::setsockopt (fnum, SOL_SOCKET, SO_LINGER, (char *) &l_val,
- sizeof(l_val)) != 0)
- goto error;
+ sizeof(l_val)) != 0)
+ goto error;
#else
throw new java::lang::InternalError (
JvNewStringUTF ("SO_LINGER not supported"));
#endif /* SO_LINGER */
return;
+
case _Jv_SO_SNDBUF_ :
case _Jv_SO_RCVBUF_ :
#if defined(SO_SNDBUF) && defined(SO_RCVBUF)
int opt;
optID == _Jv_SO_SNDBUF_ ? opt = SO_SNDBUF : opt = SO_RCVBUF;
if (::setsockopt (fnum, SOL_SOCKET, opt, (char *) &val, val_len) != 0)
- goto error;
+ goto error;
#else
throw new java::lang::InternalError (
JvNewStringUTF ("SO_RCVBUF/SO_SNDBUF not supported"));
#endif
return;
+
case _Jv_SO_BINDADDR_ :
throw new java::net::SocketException (
JvNewStringUTF ("SO_BINDADDR: read only option"));
return;
+
case _Jv_IP_MULTICAST_IF_ :
throw new java::net::SocketException (
JvNewStringUTF ("IP_MULTICAST_IF: not valid for TCP"));
return;
+
+ case _Jv_IP_MULTICAST_IF2_ :
+ throw new java::net::SocketException (
+ JvNewStringUTF ("IP_MULTICAST_IF2: not valid for TCP"));
+ break;
+
+ case _Jv_IP_MULTICAST_LOOP_ :
+ throw new java::net::SocketException (
+ JvNewStringUTF ("IP_MULTICAST_LOOP: not valid for TCP"));
+ break;
+
+ case _Jv_IP_TOS_ :
+ if (::setsockopt (fnum, SOL_SOCKET, IP_TOS, (char *) &val,
+ val_len) != 0)
+ goto error;
+ break;
+
case _Jv_SO_REUSEADDR_ :
throw new java::net::SocketException (
JvNewStringUTF ("SO_REUSEADDR: not valid for TCP"));
return;
+
case _Jv_SO_TIMEOUT_ :
- timeout = val;
+ timeout = val;
return;
+
default :
errno = ENOPROTOOPT;
}
@@ -792,85 +872,129 @@ java::net::PlainSocketImpl::getOption (jint optID)
switch (optID)
{
#ifdef TCP_NODELAY
- case _Jv_TCP_NODELAY_ :
- if (::getsockopt (fnum, IPPROTO_TCP, TCP_NODELAY, (char *) &val,
- &val_len) != 0)
- goto error;
- else
- return new java::lang::Boolean (val != 0);
+ case _Jv_TCP_NODELAY_ :
+ if (::getsockopt (fnum, IPPROTO_TCP, TCP_NODELAY, (char *) &val,
+ &val_len) != 0)
+ goto error;
+ else
+ return new java::lang::Boolean (val != 0);
#else
- throw new java::lang::InternalError (
- JvNewStringUTF ("TCP_NODELAY not supported"));
+ throw new java::lang::InternalError
+ (JvNewStringUTF ("TCP_NODELAY not supported"));
#endif
- break;
-
- case _Jv_SO_LINGER_ :
+ break;
+
+ case _Jv_SO_LINGER_ :
#ifdef SO_LINGER
- if (::getsockopt (fnum, SOL_SOCKET, SO_LINGER, (char *) &l_val,
- &l_val_len) != 0)
- goto error;
- if (l_val.l_onoff)
- return new java::lang::Integer (l_val.l_linger);
- else
- return new java::lang::Boolean ((__java_boolean)false);
+ if (::getsockopt (fnum, SOL_SOCKET, SO_LINGER, (char *) &l_val,
+ &l_val_len) != 0)
+ goto error;
+
+ if (l_val.l_onoff)
+ return new java::lang::Integer (l_val.l_linger);
+ else
+ return new java::lang::Boolean ((jboolean)false);
#else
- throw new java::lang::InternalError (
- JvNewStringUTF ("SO_LINGER not supported"));
+ throw new java::lang::InternalError
+ (JvNewStringUTF ("SO_LINGER not supported"));
#endif
- break;
- case _Jv_SO_RCVBUF_ :
- case _Jv_SO_SNDBUF_ :
+ break;
+
+ case _Jv_SO_KEEPALIVE_ :
+ if (::getsockopt (fnum, SOL_SOCKET, SO_KEEPALIVE, (char *) &val,
+ &val_len) != 0)
+ goto error;
+ else
+ return new java::lang::Boolean (val != 0);
+
+ case _Jv_SO_BROADCAST_ :
+ if (::getsockopt (fnum, SOL_SOCKET, SO_BROADCAST, (char *) &val,
+ &val_len) != 0)
+ goto error;
+ return new java::lang::Boolean ((jboolean)val);
+
+ case _Jv_SO_OOBINLINE_ :
+ if (::getsockopt (fnum, SOL_SOCKET, SO_OOBINLINE, (char *) &val,
+ &val_len) != 0)
+ goto error;
+ return new java::lang::Boolean ((jboolean)val);
+
+ case _Jv_SO_RCVBUF_ :
+ case _Jv_SO_SNDBUF_ :
#if defined(SO_SNDBUF) && defined(SO_RCVBUF)
- int opt;
- optID == _Jv_SO_SNDBUF_ ? opt = SO_SNDBUF : opt = SO_RCVBUF;
- if (::getsockopt (fnum, SOL_SOCKET, opt, (char *) &val, &val_len) != 0)
- goto error;
- else
- return new java::lang::Integer (val);
+ int opt;
+ optID == _Jv_SO_SNDBUF_ ? opt = SO_SNDBUF : opt = SO_RCVBUF;
+ if (::getsockopt (fnum, SOL_SOCKET, opt, (char *) &val, &val_len) != 0)
+ goto error;
+ else
+ return new java::lang::Integer (val);
#else
- throw new java::lang::InternalError (
- JvNewStringUTF ("SO_RCVBUF/SO_SNDBUF not supported"));
+ throw new java::lang::InternalError
+ (JvNewStringUTF ("SO_RCVBUF/SO_SNDBUF not supported"));
#endif
- break;
- case _Jv_SO_BINDADDR_:
- // cache the local address
- if (localAddress == NULL)
- {
- jbyteArray laddr;
- if (::getsockname (fnum, (sockaddr*) &u, &addrlen) != 0)
- goto error;
- if (u.address.sin_family == AF_INET)
- {
- laddr = JvNewByteArray (4);
- memcpy (elements (laddr), &u.address.sin_addr, 4);
- }
+ break;
+ case _Jv_SO_BINDADDR_:
+ // cache the local address
+ if (localAddress == NULL)
+ {
+ jbyteArray laddr;
+
+ if (::getsockname (fnum, (sockaddr*) &u, &addrlen) != 0)
+ goto error;
+
+ if (u.address.sin_family == AF_INET)
+ {
+ laddr = JvNewByteArray (4);
+ memcpy (elements (laddr), &u.address.sin_addr, 4);
+ }
#ifdef HAVE_INET6
- else if (u.address.sin_family == AF_INET6)
- {
- laddr = JvNewByteArray (16);
- memcpy (elements (laddr), &u.address6.sin6_addr, 16);
- }
+ else if (u.address.sin_family == AF_INET6)
+ {
+ laddr = JvNewByteArray (16);
+ memcpy (elements (laddr), &u.address6.sin6_addr, 16);
+ }
#endif
- else
- throw
- new java::net::SocketException (JvNewStringUTF ("invalid family"));
- localAddress = new java::net::InetAddress (laddr, NULL);
- }
- return localAddress;
- break;
- case _Jv_IP_MULTICAST_IF_ :
- throw new java::net::SocketException (
- JvNewStringUTF ("IP_MULTICAST_IF: not valid for TCP"));
- break;
- case _Jv_SO_REUSEADDR_ :
- throw new java::net::SocketException (
- JvNewStringUTF ("SO_REUSEADDR: not valid for TCP"));
- break;
- case _Jv_SO_TIMEOUT_ :
- return new java::lang::Integer (timeout);
- break;
- default :
- errno = ENOPROTOOPT;
+ else
+ throw new java::net::SocketException
+ (JvNewStringUTF ("invalid family"));
+ localAddress = new java::net::InetAddress (laddr, NULL);
+ }
+
+ return localAddress;
+ break;
+ case _Jv_IP_MULTICAST_IF_ :
+ throw new java::net::SocketException
+ (JvNewStringUTF ("IP_MULTICAST_IF: not valid for TCP"));
+ break;
+
+ case _Jv_IP_MULTICAST_IF2_ :
+ throw new java::net::SocketException
+ (JvNewStringUTF ("IP_MULTICAST_IF2: not valid for TCP"));
+ break;
+
+ case _Jv_IP_MULTICAST_LOOP_ :
+ throw new java::net::SocketException
+ (JvNewStringUTF ("IP_MULTICAST_LOOP: not valid for TCP"));
+ break;
+
+ case _Jv_IP_TOS_ :
+ if (::getsockopt (fnum, SOL_SOCKET, IP_TOS, (char *) &val,
+ &val_len) != 0)
+ goto error;
+ return new java::lang::Integer (val);
+ break;
+
+ case _Jv_SO_REUSEADDR_ :
+ throw new java::net::SocketException
+ (JvNewStringUTF ("SO_REUSEADDR: not valid for TCP"));
+ break;
+
+ case _Jv_SO_TIMEOUT_ :
+ return new java::lang::Integer (timeout);
+ break;
+
+ default :
+ errno = ENOPROTOOPT;
}
error:
@@ -878,4 +1002,18 @@ java::net::PlainSocketImpl::getOption (jint optID)
throw new java::net::SocketException (JvNewStringUTF (strerr));
}
+void
+java::net::PlainSocketImpl::shutdownInput (void)
+{
+ if (::shutdown (fnum, 0))
+ throw new SocketException (JvNewStringUTF (strerror (errno)));
+}
+
+void
+java::net::PlainSocketImpl::shutdownOutput (void)
+{
+ if (::shutdown (fnum, 1))
+ throw new SocketException (JvNewStringUTF (strerror (errno)));
+}
+
#endif /* DISABLE_JAVA_NET */
diff --git a/libjava/java/nio/Buffer.java b/libjava/java/nio/Buffer.java
new file mode 100644
index 00000000000..9474fb453f0
--- /dev/null
+++ b/libjava/java/nio/Buffer.java
@@ -0,0 +1,193 @@
+/* Buffer.java --
+ Copyright (C) 2002 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 java.nio;
+
+public abstract class Buffer
+{
+ int cap = 0;
+ int limit = 0;
+ int pos = 0;
+ int mark = -1;
+
+ /**
+ * Retrieves the capacity of the buffer.
+ */
+ public final int capacity ()
+ {
+ return cap;
+ }
+
+ /**
+ * Clears the buffer.
+ */
+ public final Buffer clear ()
+ {
+ limit = cap;
+ pos = 0;
+ mark = -1;
+ return this;
+ }
+
+ /**
+ * Flips the buffer.
+ */
+ public final Buffer flip ()
+ {
+ limit = pos;
+ pos = 0;
+ mark = -1;
+ return this;
+ }
+
+ /**
+ * Tells whether the buffer has remaining data to read or not.
+ */
+ public final boolean hasRemaining ()
+ {
+ return limit > pos;
+ }
+
+ /**
+ * Tells whether this buffer is read only or not.
+ */
+ public abstract boolean isReadOnly ();
+
+ /**
+ * Retrieves the current limit of the buffer.
+ */
+ public final int limit ()
+ {
+ return limit;
+ }
+
+ /**
+ * Sets this buffer's limit.
+ *
+ * @param newLimit The new limit value; must be non-negative and no larger
+ * than this buffer's capacity.
+ *
+ * @exception IllegalArgumentException If the preconditions on newLimit
+ * do not hold.
+ */
+ public final Buffer limit (int newLimit)
+ {
+ if ((newLimit < 0) || (newLimit > cap))
+ throw new IllegalArgumentException ();
+
+ if (newLimit <= mark)
+ mark = -1;
+
+ if (pos > newLimit)
+ pos = newLimit - 1;
+
+ limit = newLimit;
+ return this;
+ }
+
+ /**
+ * Sets this buffer's mark at its position.
+ */
+ public final Buffer mark ()
+ {
+ mark = pos;
+ return this;
+ }
+
+ /**
+ * Retrieves the current position of this buffer.
+ */
+ public final int position ()
+ {
+ return pos;
+ }
+
+ /**
+ * Sets this buffer's position. If the mark is defined and larger than the
+ * new position then it is discarded.
+ *
+ * @param newPosition The new position value; must be non-negative and no
+ * larger than the current limit.
+ *
+ * @exception IllegalArgumentException If the preconditions on newPosition
+ * do not hold
+ */
+ public final Buffer position (int newPosition)
+ {
+ if ((newPosition < 0) || (newPosition > limit))
+ throw new IllegalArgumentException ();
+
+ if (newPosition <= mark)
+ mark = -1;
+
+ pos = newPosition;
+ return this;
+ }
+
+ /**
+ * Returns the number of elements between the current position and the limit.
+ */
+ public final int remaining()
+ {
+ return limit - pos;
+ }
+
+ /**
+ * Resets this buffer's position to the previously-marked position.
+ *
+ * @exception InvalidMarkException If the mark has not been set.
+ */
+ public final Buffer reset()
+ {
+ if (mark == -1)
+ throw new InvalidMarkException ();
+
+ pos = mark;
+ return this;
+ }
+
+ /**
+ * Rewinds this buffer. The position is set to zero and the mark
+ * is discarded.
+ */
+ public final Buffer rewind()
+ {
+ pos = 0;
+ mark = -1;
+ return this;
+ }
+}
diff --git a/libjava/java/nio/BufferOverflowException.java b/libjava/java/nio/BufferOverflowException.java
new file mode 100644
index 00000000000..68dcd541dec
--- /dev/null
+++ b/libjava/java/nio/BufferOverflowException.java
@@ -0,0 +1,51 @@
+/* BufferOverflowException.java --
+ Copyright (C) 2002 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 java.nio;
+
+/**
+ * @since 1.4
+ */
+public class BufferOverflowException extends RuntimeException
+{
+ /**
+ * Creates the exception
+ */
+ public BufferOverflowException ()
+ {
+ }
+}
diff --git a/libjava/java/nio/BufferUnderflowException.java b/libjava/java/nio/BufferUnderflowException.java
new file mode 100644
index 00000000000..2ff1bc40bea
--- /dev/null
+++ b/libjava/java/nio/BufferUnderflowException.java
@@ -0,0 +1,51 @@
+/* BufferUnderflowException.java --
+ Copyright (C) 2002 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 java.nio;
+
+/**
+ * @since 1.4
+ */
+public class BufferUnderflowException extends RuntimeException
+{
+ /**
+ * Creates the exception
+ */
+ public BufferUnderflowException ()
+ {
+ }
+}
diff --git a/libjava/java/nio/ByteBuffer.java b/libjava/java/nio/ByteBuffer.java
new file mode 100644
index 00000000000..874943a8757
--- /dev/null
+++ b/libjava/java/nio/ByteBuffer.java
@@ -0,0 +1,79 @@
+/* ByteBuffer.java --
+ Copyright (C) 2002 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 java.nio;
+
+public abstract class ByteBuffer extends Buffer
+{
+ public static ByteBuffer allocate (int capacity)
+ {
+ return null;
+ }
+
+ final public static ByteBuffer wrap (byte[] array, int offset, int length)
+ {
+ return null;
+ }
+
+ final public static ByteBuffer wrap (byte[] array)
+ {
+ return wrap (array, 0, array.length);
+ }
+
+ final public ByteBuffer put (ByteBuffer src)
+ {
+ while (src.hasRemaining ())
+ put (src.get ());
+
+ return this;
+ }
+
+ final public ByteBuffer put (byte[] src, int offset, int length)
+ {
+ for (int i = offset; i < offset + length; i++)
+ put (src [i]);
+ return this;
+ }
+ public final ByteBuffer put (byte[] src)
+ {
+ return put (src, 0, src.length);
+ }
+
+ public abstract byte get ();
+
+ public abstract ByteBuffer put (byte b);
+}
diff --git a/libjava/java/nio/ByteOrder.java b/libjava/java/nio/ByteOrder.java
new file mode 100644
index 00000000000..010fa29d0b6
--- /dev/null
+++ b/libjava/java/nio/ByteOrder.java
@@ -0,0 +1,60 @@
+/* ByteOrder.java --
+ Copyright (C) 2002 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 java.nio;
+
+
+public final class ByteOrder
+{
+ public static final ByteOrder BIG_ENDIAN = new ByteOrder();
+ public static final ByteOrder LITTLE_ENDIAN = new ByteOrder();
+
+ public static ByteOrder nativeOrder()
+ {
+ return BIG_ENDIAN;
+ }
+
+ public String toString()
+ {
+ return this == BIG_ENDIAN ? "BIG_ENDIAN" : "LITTLE_ENDIAN";
+ }
+
+ // This class can only be instantiated here.
+ private ByteOrder ()
+ {
+ }
+}
diff --git a/libjava/java/nio/CharBuffer.java b/libjava/java/nio/CharBuffer.java
new file mode 100644
index 00000000000..2a21ef93ff5
--- /dev/null
+++ b/libjava/java/nio/CharBuffer.java
@@ -0,0 +1,291 @@
+/* CharBuffer.java --
+ Copyright (C) 2002 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 java.nio;
+
+public abstract class CharBuffer extends Buffer
+{
+ private ByteOrder endian = ByteOrder.BIG_ENDIAN;
+
+ protected char [] backing_buffer;
+
+ public static CharBuffer allocate (int capacity)
+ {
+ return null;
+ }
+
+ /**
+ * @exception IndexOutOfBoundsException If the preconditions on the offset
+ * and length parameters do not hold
+ */
+ final public static CharBuffer wrap (char[] array, int offset, int length)
+ {
+ if ((offset < 0) ||
+ (offset > array.length) ||
+ (length < 0) ||
+ (length > (array.length - offset)))
+ throw new IndexOutOfBoundsException ();
+
+ return null;
+ }
+
+ final public static CharBuffer wrap (CharSequence a)
+ {
+ return wrap (a, 0, a.length ());
+ }
+
+ /**
+ * @exception IndexOutOfBoundsException If the preconditions on the offset
+ * and length parameters do not hold
+ */
+ final public static CharBuffer wrap (CharSequence a, int offset, int length)
+ {
+ char [] buffer = new char [length];
+
+ for (int i = offset; i < length; i++)
+ {
+ buffer [i] = a.charAt (i);
+ }
+
+ return wrap (buffer, 0, length);
+ }
+
+ final public static CharBuffer wrap (char[] array)
+ {
+ return wrap (array, 0, array.length);
+ }
+
+ /**
+ * @exception BufferUnderflowException FIXME
+ * @exception IndexOutOfBoundsException If the preconditions on the offset
+ * and length parameters do not hold
+ */
+ final public CharBuffer get (char[] dst, int offset, int length)
+ {
+ for (int i = offset; i < offset + length; i++)
+ {
+ dst [i] = get ();
+ }
+ return this;
+ }
+
+ /**
+ * @exception BufferUnderflowException FIXME
+ */
+ final public CharBuffer get (char[] dst)
+ {
+ return get (dst, 0, dst.length);
+ }
+
+ /**
+ * @exception BufferOverflowException FIXME
+ * @exception IllegalArgumentException FIXME
+ * @exception ReadOnlyBufferException FIXME
+ */
+ final public CharBuffer put (CharBuffer src)
+ {
+ while (src.hasRemaining ())
+ put (src.get ());
+
+ return this;
+ }
+
+ /**
+ * @exception BufferOverflowException FIXME
+ * @exception IndexOutOfBoundsException If the preconditions on the offset
+ * and length parameters do not hold
+ * @exception ReadOnlyBufferException FIXME
+ */
+ final public CharBuffer put (char[] src, int offset, int length)
+ {
+ for (int i = offset; i < offset + length; i++)
+ put (src [i]);
+
+ return this;
+ }
+
+ /**
+ * @exception BufferOverflowException FIXME
+ * @exception ReadOnlyBufferException FIXME
+ */
+ public final CharBuffer put (char[] src)
+ {
+ return put (src, 0, src.length);
+ }
+
+ public final boolean hasArray ()
+ {
+ return backing_buffer != null;
+ }
+
+ /**
+ * @exception ReadOnlyBufferException FIXME
+ * @exception UnsupportedOperationException FIXME
+ */
+ public final char[] array ()
+ {
+ return backing_buffer;
+ }
+
+ /**
+ * @exception ReadOnlyBufferException FIXME
+ * @exception UnsupportedOperationException FIXME
+ */
+ public final int arrayOffset ()
+ {
+ return 0;
+ }
+
+ public int hashCode ()
+ {
+ return super.hashCode ();
+ }
+
+ public boolean equals (Object obj)
+ {
+ if (obj instanceof CharBuffer)
+ return compareTo (obj) == 0;
+
+ return false;
+ }
+
+ /**
+ * @exception ClassCastException FIXME
+ */
+ public int compareTo(Object obj)
+ {
+ CharBuffer a = (CharBuffer) obj;
+
+ if (a.remaining () != remaining ())
+ return 1;
+
+ if (! hasArray () || ! a.hasArray ())
+ return 1;
+
+ int r = remaining ();
+ int i1 = pos;
+ int i2 = a.pos;
+
+ for (int i = 0; i < r; i++)
+ {
+ int t = (int) (get (i1)- a.get (i2));
+
+ if (t != 0)
+ return (int) t;
+ }
+ return 0;
+ }
+
+ /**
+ * @exception BufferUnderflowException FIXME
+ */
+ public abstract char get ();
+
+ /**
+ * @exception BufferOverflowException FIXME
+ * @exception ReadOnlyBufferException FIXME
+ */
+ public abstract CharBuffer put (char b);
+
+ /**
+ * @exception IndexOutOfBoundsException FIXME
+ */
+ public abstract char get (int index);
+
+ /**
+ * @exception IndexOutOfBoundsException FIXME
+ * @exception ReadOnlyBufferException FIXME
+ */
+ public abstract CharBuffer put (int index, char b);
+
+ /**
+ * @exception ReadOnlyBufferException FIXME
+ */
+ public abstract CharBuffer compact ();
+
+ public abstract boolean isDirect ();
+
+ public abstract CharBuffer slice ();
+
+ public abstract CharBuffer duplicate ();
+
+ public abstract CharBuffer asReadOnlyBuffer ();
+
+ public String toString ()
+ {
+ return "";
+ }
+
+ public final int length ()
+ {
+ return 0;
+ }
+
+ public abstract ByteOrder order ();
+
+ /**
+ * @exception IndexOutOfBoundsException FIXME
+ */
+ public abstract CharSequence subSequence (int start, int length);
+
+ /**
+ * @exception BufferOverflowException FIXME
+ * @exception IndexOutOfBoundsException FIXME
+ * @exception ReadOnlyBufferException FIXME
+ */
+ public CharBuffer put (String str, int start, int length)
+ {
+ return null;
+ }
+
+ /**
+ * @exception BufferOverflowException FIXME
+ * @exception ReadOnlyBufferException FIXME
+ */
+ public final CharBuffer put (String str)
+ {
+ return null;
+ }
+
+ /**
+ * @exception IndexOutOfBoundsException FIXME
+ */
+ public final char charAt (int index)
+ {
+ return ' ';
+ }
+}
diff --git a/libjava/java/nio/DoubleBuffer.java b/libjava/java/nio/DoubleBuffer.java
new file mode 100644
index 00000000000..7059b6e2430
--- /dev/null
+++ b/libjava/java/nio/DoubleBuffer.java
@@ -0,0 +1,225 @@
+/* DoubleBuffer.java --
+ Copyright (C) 2002 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 java.nio;
+
+import gnu.java.nio.DoubleBufferImpl;
+
+public abstract class DoubleBuffer extends Buffer
+{
+ private ByteOrder endian = ByteOrder.BIG_ENDIAN;
+ protected double [] backing_buffer;
+
+ public static DoubleBuffer allocateDirect(int capacity)
+ {
+ return new DoubleBufferImpl(capacity, 0, capacity);
+ }
+
+ public static DoubleBuffer allocate(int capacity)
+ {
+ return new DoubleBufferImpl(capacity, 0, capacity);
+ }
+
+ final public static DoubleBuffer wrap (double[] array, int offset, int length)
+ {
+ return new DoubleBufferImpl(array, offset, length);
+ }
+
+ final public static DoubleBuffer wrap(String a)
+ {
+ int len = a.length();
+ double[] buffer = new double[len];
+
+ for (int i=0;i<len;i++)
+ {
+ buffer[i] = (double) a.charAt(i);
+ }
+
+ return wrap(buffer, 0, len);
+ }
+
+ final public static DoubleBuffer wrap(double[] array)
+ {
+ return wrap(array, 0, array.length);
+ }
+
+ final public DoubleBuffer get (double[] dst, int offset, int length)
+ {
+ for (int i = offset; i < offset + length; i++)
+ {
+ dst[i] = get();
+ }
+
+ return this;
+ }
+
+ final public DoubleBuffer get(double[] dst)
+ {
+ return get(dst, 0, dst.length);
+ }
+
+ final public DoubleBuffer put(DoubleBuffer src)
+ {
+ while (src.hasRemaining())
+ put(src.get());
+
+ return this;
+ }
+
+ final public DoubleBuffer put (double[] src, int offset, int length)
+ {
+ for (int i = offset; i < offset + length; i++)
+ put(src[i]);
+
+ return this;
+ }
+
+ public final DoubleBuffer put(double[] src)
+ {
+ return put(src, 0, src.length);
+ }
+
+ public final boolean hasArray()
+ {
+ return (backing_buffer != null);
+ }
+
+ public final double[] array()
+ {
+ return backing_buffer;
+ }
+
+ public final int arrayOffset()
+ {
+ return 0;
+ }
+
+ public int hashCode()
+ {
+ return super.hashCode();
+ }
+
+ public boolean equals(Object obj)
+ {
+ if (obj instanceof DoubleBuffer)
+ {
+ return compareTo(obj) == 0;
+ }
+
+ return false;
+ }
+
+ public int compareTo(Object ob)
+ {
+ DoubleBuffer a = (DoubleBuffer) ob;
+
+ if (a.remaining() != remaining())
+ return 1;
+
+ if (! hasArray() ||
+ ! a.hasArray())
+ {
+ return 1;
+ }
+
+ int r = remaining();
+ int i1 = position ();
+ int i2 = a.position ();
+
+ for (int i=0;i<r;i++)
+ {
+ int t = (int) (get(i1)- a.get(i2));
+ if (t != 0)
+ {
+ return (int) t;
+ }
+ }
+
+ return 0;
+ }
+
+ public final ByteOrder order()
+ {
+ return endian;
+ }
+
+ public final DoubleBuffer order(ByteOrder bo)
+ {
+ endian = bo;
+ return this;
+ }
+
+ public abstract double get();
+ public abstract DoubleBuffer put (double b);
+ public abstract double get(int index);
+ public abstract DoubleBuffer put(int index, double b);
+ public abstract DoubleBuffer compact();
+ public abstract boolean isDirect();
+ public abstract DoubleBuffer slice();
+ public abstract DoubleBuffer duplicate();
+ public abstract DoubleBuffer asReadOnlyBuffer();
+ public abstract ShortBuffer asShortBuffer();
+ public abstract CharBuffer asCharBuffer();
+ public abstract IntBuffer asIntBuffer();
+ public abstract LongBuffer asLongBuffer();
+ public abstract FloatBuffer asFloatBuffer();
+ public abstract DoubleBuffer asDoubleBuffer();
+ public abstract char getChar();
+ public abstract DoubleBuffer putChar(char value);
+ public abstract char getChar(int index);
+ public abstract DoubleBuffer putChar(int index, char value);
+ public abstract short getShort();
+ public abstract DoubleBuffer putShort(short value);
+ public abstract short getShort(int index);
+ public abstract DoubleBuffer putShort(int index, short value);
+ public abstract int getInt();
+ public abstract DoubleBuffer putInt(int value);
+ public abstract int getInt(int index);
+ public abstract DoubleBuffer putInt(int index, int value);
+ public abstract long getLong();
+ public abstract DoubleBuffer putLong(long value);
+ public abstract long getLong(int index);
+ public abstract DoubleBuffer putLong(int index, long value);
+ public abstract float getFloat();
+ public abstract DoubleBuffer putFloat(float value);
+ public abstract float getFloat(int index);
+ public abstract DoubleBuffer putFloat(int index, float value);
+ public abstract double getDouble();
+ public abstract DoubleBuffer putDouble(double value);
+ public abstract double getDouble(int index);
+ public abstract DoubleBuffer putDouble(int index, double value);
+}
diff --git a/libjava/java/nio/FloatBuffer.java b/libjava/java/nio/FloatBuffer.java
new file mode 100644
index 00000000000..f06ef187791
--- /dev/null
+++ b/libjava/java/nio/FloatBuffer.java
@@ -0,0 +1,224 @@
+/* FloatBuffer.java --
+ Copyright (C) 2002 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 java.nio;
+
+import gnu.java.nio.FloatBufferImpl;
+
+public abstract class FloatBuffer extends Buffer
+{
+ private ByteOrder endian = ByteOrder.BIG_ENDIAN;
+ protected float [] backing_buffer;
+
+ public static FloatBuffer allocateDirect(int capacity)
+ {
+ return new FloatBufferImpl (capacity, 0, capacity);
+ }
+
+ public static FloatBuffer allocate(int capacity)
+ {
+ return new FloatBufferImpl (capacity, 0, capacity);
+ }
+
+ final public static FloatBuffer wrap(float[] array, int offset, int length)
+ {
+ return new FloatBufferImpl(array, offset, length);
+ }
+
+ final public static FloatBuffer wrap(String a)
+ {
+ int len = a.length();
+ float[] buffer = new float[len];
+
+ for (int i=0;i<len;i++)
+ {
+ buffer[i] = (float) a.charAt(i);
+ }
+
+ return wrap(buffer, 0, len);
+ }
+
+ final public static FloatBuffer wrap(float[] array)
+ {
+ return wrap(array, 0, array.length);
+ }
+
+ final public FloatBuffer get(float[] dst, int offset, int length)
+ {
+ for (int i = offset; i < offset + length; i++)
+ {
+ dst[i] = get();
+ }
+
+ return this;
+ }
+
+ final public FloatBuffer get(float[] dst)
+ {
+ return get(dst, 0, dst.length);
+ }
+
+ final public FloatBuffer put(FloatBuffer src)
+ {
+ while (src.hasRemaining())
+ put(src.get());
+
+ return this;
+ }
+
+ final public FloatBuffer put(float[] src, int offset, int length)
+ {
+ for (int i = offset; i < offset + length; i++)
+ put(src[i]);
+
+ return this;
+ }
+
+ public final FloatBuffer put(float[] src)
+ {
+ return put(src, 0, src.length);
+ }
+
+ public final boolean hasArray()
+ {
+ return (backing_buffer != null);
+ }
+
+ public final float[] array()
+ {
+ return backing_buffer;
+ }
+
+ public final int arrayOffset()
+ {
+ return 0;
+ }
+
+ public int hashCode()
+ {
+ return super.hashCode();
+ }
+
+ public boolean equals(Object obj)
+ {
+ if (obj instanceof FloatBuffer)
+ {
+ return compareTo(obj) == 0;
+ }
+ return false;
+ }
+
+ public int compareTo(Object ob)
+ {
+ FloatBuffer a = (FloatBuffer) ob;
+
+ if (a.remaining() != remaining())
+ return 1;
+
+ if (! hasArray() ||
+ ! a.hasArray())
+ {
+ return 1;
+ }
+
+ int r = remaining();
+ int i1 = position ();
+ int i2 = a.position ();
+
+ for (int i=0;i<r;i++)
+ {
+ int t = (int) (get(i1)- a.get(i2));
+ if (t != 0)
+ {
+ return (int) t;
+ }
+ }
+
+ return 0;
+ }
+
+ public final ByteOrder order()
+ {
+ return endian;
+ }
+
+ public final FloatBuffer order(ByteOrder bo)
+ {
+ endian = bo;
+ return this;
+ }
+
+ public abstract float get();
+ public abstract java.nio. FloatBuffer put(float b);
+ public abstract float get(int index);
+ public abstract java.nio. FloatBuffer put(int index, float b);
+ public abstract FloatBuffer compact();
+ public abstract boolean isDirect();
+ public abstract FloatBuffer slice();
+ public abstract FloatBuffer duplicate();
+ public abstract FloatBuffer asReadOnlyBuffer();
+ public abstract ShortBuffer asShortBuffer();
+ public abstract CharBuffer asCharBuffer();
+ public abstract IntBuffer asIntBuffer();
+ public abstract LongBuffer asLongBuffer();
+ public abstract FloatBuffer asFloatBuffer();
+ public abstract DoubleBuffer asDoubleBuffer();
+ public abstract char getChar();
+ public abstract FloatBuffer putChar(char value);
+ public abstract char getChar(int index);
+ public abstract FloatBuffer putChar(int index, char value);
+ public abstract short getShort();
+ public abstract FloatBuffer putShort(short value);
+ public abstract short getShort(int index);
+ public abstract FloatBuffer putShort(int index, short value);
+ public abstract int getInt();
+ public abstract FloatBuffer putInt(int value);
+ public abstract int getInt(int index);
+ public abstract FloatBuffer putInt(int index, int value);
+ public abstract long getLong();
+ public abstract FloatBuffer putLong(long value);
+ public abstract long getLong(int index);
+ public abstract FloatBuffer putLong(int index, long value);
+ public abstract float getFloat();
+ public abstract FloatBuffer putFloat(float value);
+ public abstract float getFloat(int index);
+ public abstract FloatBuffer putFloat(int index, float value);
+ public abstract double getDouble();
+ public abstract FloatBuffer putDouble(double value);
+ public abstract double getDouble(int index);
+ public abstract FloatBuffer putDouble(int index, double value);
+}
diff --git a/libjava/java/nio/IntBuffer.java b/libjava/java/nio/IntBuffer.java
new file mode 100644
index 00000000000..d2d28d36b10
--- /dev/null
+++ b/libjava/java/nio/IntBuffer.java
@@ -0,0 +1,225 @@
+/* IntBuffer.java --
+ Copyright (C) 2002 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 java.nio;
+
+import gnu.java.nio.IntBufferImpl;
+
+public abstract class IntBuffer extends Buffer
+{
+ private ByteOrder endian = ByteOrder.BIG_ENDIAN;
+ protected int [] backing_buffer;
+
+ public static IntBuffer allocateDirect(int capacity)
+ {
+ return new IntBufferImpl (capacity, 0, capacity);
+ }
+
+ public static IntBuffer allocate(int capacity)
+ {
+ return new IntBufferImpl (capacity, 0, capacity);
+ }
+
+ final public static IntBuffer wrap(int[] array, int offset, int length)
+ {
+ return new IntBufferImpl(array, offset, length);
+ }
+
+ final public static IntBuffer wrap(String a)
+ {
+ int len = a.length();
+ int[] buffer = new int[len];
+
+ for (int i=0;i<len;i++)
+ {
+ buffer[i] = (int) a.charAt(i);
+ }
+
+ return wrap(buffer, 0, len);
+ }
+
+ final public static IntBuffer wrap(int[] array)
+ {
+ return wrap(array, 0, array.length);
+ }
+
+ final public IntBuffer get(int[] dst, int offset, int length)
+ {
+ for (int i = offset; i < offset + length; i++)
+ {
+ dst[i] = get();
+ }
+
+ return this;
+ }
+
+ final public IntBuffer get(int[] dst)
+ {
+ return get(dst, 0, dst.length);
+ }
+
+ final public IntBuffer put(IntBuffer src)
+ {
+ while (src.hasRemaining())
+ put(src.get());
+
+ return this;
+ }
+
+ final public IntBuffer put(int[] src, int offset, int length)
+ {
+ for (int i = offset; i < offset + length; i++)
+ put(src[i]);
+
+ return this;
+ }
+
+ public final IntBuffer put(int[] src)
+ {
+ return put(src, 0, src.length);
+ }
+
+ public final boolean hasArray()
+ {
+ return (backing_buffer != null);
+ }
+
+ public final int[] array()
+ {
+ return backing_buffer;
+ }
+
+ public final int arrayOffset()
+ {
+ return 0;
+ }
+
+ public int hashCode()
+ {
+ return super.hashCode();
+ }
+
+ public boolean equals(Object obj)
+ {
+ if (obj instanceof IntBuffer)
+ {
+ return compareTo(obj) == 0;
+ }
+
+ return false;
+ }
+
+ public int compareTo(Object ob)
+ {
+ IntBuffer a = (IntBuffer) ob;
+
+ if (a.remaining() != remaining())
+ return 1;
+
+ if (! hasArray() ||
+ ! a.hasArray())
+ {
+ return 1;
+ }
+
+ int r = remaining();
+ int i1 = position ();
+ int i2 = a.position ();
+
+ for (int i=0;i<r;i++)
+ {
+ int t = (int) (get(i1)- a.get(i2));
+ if (t != 0)
+ {
+ return (int) t;
+ }
+ }
+
+ return 0;
+ }
+
+ public final ByteOrder order()
+ {
+ return endian;
+ }
+
+ public final IntBuffer order(ByteOrder bo)
+ {
+ endian = bo;
+ return this;
+ }
+
+ public abstract int get();
+ public abstract IntBuffer put(int b);
+ public abstract int get(int index);
+ public abstract IntBuffer put(int index, int b);
+ public abstract IntBuffer compact();
+ public abstract boolean isDirect();
+ public abstract IntBuffer slice();
+ public abstract IntBuffer duplicate();
+ public abstract IntBuffer asReadOnlyBuffer();
+ public abstract ShortBuffer asShortBuffer();
+ public abstract CharBuffer asCharBuffer();
+ public abstract IntBuffer asIntBuffer();
+ public abstract LongBuffer asLongBuffer();
+ public abstract FloatBuffer asFloatBuffer();
+ public abstract DoubleBuffer asDoubleBuffer();
+ public abstract char getChar();
+ public abstract IntBuffer putChar(char value);
+ public abstract char getChar(int index);
+ public abstract IntBuffer putChar(int index, char value);
+ public abstract short getShort();
+ public abstract IntBuffer putShort(short value);
+ public abstract short getShort(int index);
+ public abstract IntBuffer putShort(int index, short value);
+ public abstract int getInt();
+ public abstract IntBuffer putInt(int value);
+ public abstract int getInt(int index);
+ public abstract IntBuffer putInt(int index, int value);
+ public abstract long getLong();
+ public abstract IntBuffer putLong(long value);
+ public abstract long getLong(int index);
+ public abstract IntBuffer putLong(int index, long value);
+ public abstract float getFloat();
+ public abstract IntBuffer putFloat(float value);
+ public abstract float getFloat(int index);
+ public abstract IntBuffer putFloat(int index, float value);
+ public abstract double getDouble();
+ public abstract IntBuffer putDouble(double value);
+ public abstract double getDouble(int index);
+ public abstract IntBuffer putDouble(int index, double value);
+}
diff --git a/libjava/java/nio/InvalidMarkException.java b/libjava/java/nio/InvalidMarkException.java
new file mode 100644
index 00000000000..5917855a4c9
--- /dev/null
+++ b/libjava/java/nio/InvalidMarkException.java
@@ -0,0 +1,52 @@
+/* InvalidMarkException.java --
+ Copyright (C) 2002 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 java.nio;
+
+/**
+ * @author Michael Koch
+ * @since 1.4
+ */
+public class InvalidMarkException extends IllegalStateException
+{
+ /**
+ * Creates the exception
+ */
+ public InvalidMarkException ()
+ {
+ }
+}
diff --git a/libjava/java/nio/LongBuffer.java b/libjava/java/nio/LongBuffer.java
new file mode 100644
index 00000000000..5bca6d53b70
--- /dev/null
+++ b/libjava/java/nio/LongBuffer.java
@@ -0,0 +1,226 @@
+/* LongBuffer.java --
+ Copyright (C) 2002 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 java.nio;
+
+import gnu.java.nio.LongBufferImpl;
+
+public abstract class LongBuffer extends Buffer
+{
+ private ByteOrder endian = ByteOrder.BIG_ENDIAN;
+ protected long [] backing_buffer;
+
+ public static LongBuffer allocateDirect(int capacity)
+ {
+ return new LongBufferImpl(capacity, 0, capacity);
+ }
+
+ public static LongBuffer allocate(int capacity)
+ {
+ return new LongBufferImpl(capacity, 0, capacity);
+ }
+
+ final public static LongBuffer wrap(long[] array, int offset, int length)
+ {
+ return new LongBufferImpl (array, offset, length);
+ }
+
+ final public static LongBuffer wrap(String a)
+ {
+ int len = a.length();
+ long[] buffer = new long[len];
+
+ for (int i=0;i<len;i++)
+ {
+ buffer[i] = (long) a.charAt(i);
+ }
+
+ return wrap(buffer, 0, len);
+ }
+
+ final public static LongBuffer wrap(long[] array)
+ {
+ return wrap(array, 0, array.length);
+ }
+
+ final public LongBuffer get(long[] dst, int offset, int length)
+ {
+ for (int i = offset; i < offset + length; i++)
+ {
+ dst[i] = get();
+ }
+
+ return this;
+ }
+
+ final public LongBuffer get(long[] dst)
+ {
+ return get(dst, 0, dst.length);
+ }
+
+ final public LongBuffer put(LongBuffer src)
+ {
+ while (src.hasRemaining())
+ put(src.get());
+
+ return this;
+ }
+
+ final public LongBuffer put(long[] src, int offset, int length)
+ {
+ for (int i = offset; i < offset + length; i++)
+ put(src[i]);
+
+ return this;
+ }
+
+ public final LongBuffer put(long[] src)
+ {
+ return put(src, 0, src.length);
+ }
+
+ public final boolean hasArray()
+ {
+ return (backing_buffer != null);
+ }
+
+ public final long[] array()
+ {
+ return backing_buffer;
+ }
+
+ public final int arrayOffset()
+ {
+ return 0;
+ }
+
+ public int hashCode()
+ {
+ return super.hashCode();
+ }
+
+ public boolean equals(Object obj)
+ {
+ if (obj instanceof LongBuffer)
+ {
+ return compareTo(obj) == 0;
+ }
+
+ return false;
+ }
+
+ public int compareTo(Object ob)
+ {
+ LongBuffer a = (LongBuffer) ob;
+
+ if (a.remaining() != remaining())
+ return 1;
+
+ if (! hasArray() ||
+ ! a.hasArray())
+ {
+ return 1;
+ }
+
+ int r = remaining();
+ int i1 = position ();
+ int i2 = a.position ();
+
+ for (int i=0;i<r;i++)
+ {
+ int t = (int) (get(i1)- a.get(i2));
+
+ if (t != 0)
+ {
+ return (int) t;
+ }
+ }
+
+ return 0;
+ }
+
+ public final ByteOrder order()
+ {
+ return endian;
+ }
+
+ public final LongBuffer order(ByteOrder bo)
+ {
+ endian = bo;
+ return this;
+ }
+
+ public abstract long get();
+ public abstract java.nio. LongBuffer put(long b);
+ public abstract long get(int index);
+ public abstract java.nio. LongBuffer put(int index, long b);
+ public abstract LongBuffer compact();
+ public abstract boolean isDirect();
+ public abstract LongBuffer slice();
+ public abstract LongBuffer duplicate();
+ public abstract LongBuffer asReadOnlyBuffer();
+ public abstract ShortBuffer asShortBuffer();
+ public abstract CharBuffer asCharBuffer();
+ public abstract IntBuffer asIntBuffer();
+ public abstract LongBuffer asLongBuffer();
+ public abstract FloatBuffer asFloatBuffer();
+ public abstract DoubleBuffer asDoubleBuffer();
+ public abstract char getChar();
+ public abstract LongBuffer putChar(char value);
+ public abstract char getChar(int index);
+ public abstract LongBuffer putChar(int index, char value);
+ public abstract short getShort();
+ public abstract LongBuffer putShort(short value);
+ public abstract short getShort(int index);
+ public abstract LongBuffer putShort(int index, short value);
+ public abstract int getInt();
+ public abstract LongBuffer putInt(int value);
+ public abstract int getInt(int index);
+ public abstract LongBuffer putInt(int index, int value);
+ public abstract long getLong();
+ public abstract LongBuffer putLong(long value);
+ public abstract long getLong(int index);
+ public abstract LongBuffer putLong(int index, long value);
+ public abstract float getFloat();
+ public abstract LongBuffer putFloat(float value);
+ public abstract float getFloat(int index);
+ public abstract LongBuffer putFloat(int index, float value);
+ public abstract double getDouble();
+ public abstract LongBuffer putDouble(double value);
+ public abstract double getDouble(int index);
+ public abstract LongBuffer putDouble(int index, double value);
+}
diff --git a/libjava/java/nio/MappedByteBuffer.java b/libjava/java/nio/MappedByteBuffer.java
new file mode 100644
index 00000000000..dc1b20d892c
--- /dev/null
+++ b/libjava/java/nio/MappedByteBuffer.java
@@ -0,0 +1,42 @@
+/* MappedByteBuffer.java --
+ Copyright (C) 2002 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 java.nio;
+
+public abstract class MappedByteBuffer extends ByteBuffer
+{
+}
diff --git a/libjava/java/nio/ReadOnlyBufferException.java b/libjava/java/nio/ReadOnlyBufferException.java
new file mode 100644
index 00000000000..0fcdc3ac7db
--- /dev/null
+++ b/libjava/java/nio/ReadOnlyBufferException.java
@@ -0,0 +1,52 @@
+/* ReadOnlyBufferException.java --
+ Copyright (C) 2002 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 java.nio;
+
+/**
+ * @author Michael Koch
+ * @since 1.4
+ */
+public class ReadOnlyBufferException extends UnsupportedOperationException
+{
+ /**
+ * Creates the exception
+ */
+ public ReadOnlyBufferException ()
+ {
+ }
+}
diff --git a/libjava/java/nio/ShortBuffer.java b/libjava/java/nio/ShortBuffer.java
new file mode 100644
index 00000000000..5301366ceee
--- /dev/null
+++ b/libjava/java/nio/ShortBuffer.java
@@ -0,0 +1,226 @@
+/* ShortBuffer.java --
+ Copyright (C) 2002 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 java.nio;
+
+import gnu.java.nio.ShortBufferImpl;
+
+public abstract class ShortBuffer extends Buffer
+{
+ private ByteOrder endian = ByteOrder.BIG_ENDIAN;
+ protected short [] backing_buffer;
+
+ public static ShortBuffer allocateDirect(int capacity)
+ {
+ return new ShortBufferImpl(capacity, 0, capacity);
+ }
+
+ public static ShortBuffer allocate(int capacity)
+ {
+ return new ShortBufferImpl(capacity, 0, capacity);
+ }
+
+ final public static ShortBuffer wrap(short[] array, int offset, int length)
+ {
+ return new ShortBufferImpl(array, offset, length);
+ }
+
+ final public static ShortBuffer wrap(String a)
+ {
+ int len = a.length();
+ short[] buffer = new short[len];
+
+ for (int i=0;i<len;i++)
+ {
+ buffer[i] = (short) a.charAt(i);
+ }
+
+ return wrap(buffer, 0, len);
+ }
+
+ final public static ShortBuffer wrap(short[] array)
+ {
+ return wrap(array, 0, array.length);
+ }
+
+ final public ShortBuffer get(short[] dst, int offset, int length)
+ {
+ for (int i = offset; i < offset + length; i++)
+ {
+ dst[i] = get();
+ }
+
+ return this;
+ }
+
+ final public ShortBuffer get(short[] dst)
+ {
+ return get(dst, 0, dst.length);
+ }
+
+ final public ShortBuffer put(ShortBuffer src)
+ {
+ while (src.hasRemaining())
+ put(src.get());
+
+ return this;
+ }
+
+ final public ShortBuffer put(short[] src, int offset, int length)
+ {
+ for (int i = offset; i < offset + length; i++)
+ put(src[i]);
+
+ return this;
+ }
+
+ public final ShortBuffer put(short[] src)
+ {
+ return put(src, 0, src.length);
+ }
+
+ public final boolean hasArray()
+ {
+ return (backing_buffer != null);
+ }
+
+ public final short[] array()
+ {
+ return backing_buffer;
+ }
+
+ public final int arrayOffset()
+ {
+ return 0;
+ }
+
+ public int hashCode()
+ {
+ return super.hashCode();
+ }
+
+ public boolean equals(Object obj)
+ {
+ if (obj instanceof ShortBuffer)
+ {
+ return compareTo(obj) == 0;
+ }
+
+ return false;
+ }
+
+ public int compareTo(Object ob)
+ {
+ ShortBuffer a = (ShortBuffer) ob;
+
+ if (a.remaining() != remaining())
+ return 1;
+
+ if (! hasArray() ||
+ ! a.hasArray())
+ {
+ return 1;
+ }
+
+ int r = remaining();
+ int i1 = position ();
+ int i2 = a.position ();
+
+ for (int i=0;i<r;i++)
+ {
+ int t = (int) (get(i1)- a.get(i2));
+
+ if (t != 0)
+ {
+ return (int) t;
+ }
+ }
+
+ return 0;
+ }
+
+ public final ByteOrder order()
+ {
+ return endian;
+ }
+
+ public final ShortBuffer order(ByteOrder bo)
+ {
+ endian = bo;
+ return this;
+ }
+
+ public abstract short get();
+ public abstract java.nio. ShortBuffer put(short b);
+ public abstract short get(int index);
+ public abstract java.nio. ShortBuffer put(int index, short b);
+ public abstract ShortBuffer compact();
+ public abstract boolean isDirect();
+ public abstract ShortBuffer slice();
+ public abstract ShortBuffer duplicate();
+ public abstract ShortBuffer asReadOnlyBuffer();
+ public abstract ShortBuffer asShortBuffer();
+ public abstract CharBuffer asCharBuffer();
+ public abstract IntBuffer asIntBuffer();
+ public abstract LongBuffer asLongBuffer();
+ public abstract FloatBuffer asFloatBuffer();
+ public abstract DoubleBuffer asDoubleBuffer();
+ public abstract char getChar();
+ public abstract ShortBuffer putChar(char value);
+ public abstract char getChar(int index);
+ public abstract ShortBuffer putChar(int index, char value);
+ public abstract short getShort();
+ public abstract ShortBuffer putShort(short value);
+ public abstract short getShort(int index);
+ public abstract ShortBuffer putShort(int index, short value);
+ public abstract int getInt();
+ public abstract ShortBuffer putInt(int value);
+ public abstract int getInt(int index);
+ public abstract ShortBuffer putInt(int index, int value);
+ public abstract long getLong();
+ public abstract ShortBuffer putLong(long value);
+ public abstract long getLong(int index);
+ public abstract ShortBuffer putLong(int index, long value);
+ public abstract float getFloat();
+ public abstract ShortBuffer putFloat(float value);
+ public abstract float getFloat(int index);
+ public abstract ShortBuffer putFloat(int index, float value);
+ public abstract double getDouble();
+ public abstract ShortBuffer putDouble(double value);
+ public abstract double getDouble(int index);
+ public abstract ShortBuffer putDouble(int index, double value);
+}
diff --git a/libjava/java/nio/channels/AlreadyConnectedException.java b/libjava/java/nio/channels/AlreadyConnectedException.java
new file mode 100644
index 00000000000..740fdbc0ddd
--- /dev/null
+++ b/libjava/java/nio/channels/AlreadyConnectedException.java
@@ -0,0 +1,48 @@
+/* AlreadyConnectedException.java --
+ Copyright (C) 2002 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 java.nio.channels;
+
+public class AlreadyConnectedException extends IllegalStateException
+{
+ /**
+ * Creates the exception
+ */
+ public AlreadyConnectedException()
+ {
+ }
+}
diff --git a/libjava/java/nio/channels/AsynchronousCloseException.java b/libjava/java/nio/channels/AsynchronousCloseException.java
new file mode 100644
index 00000000000..ec4bbc7fd47
--- /dev/null
+++ b/libjava/java/nio/channels/AsynchronousCloseException.java
@@ -0,0 +1,52 @@
+/* AsynchronousCloseException.java --
+ Copyright (C) 2002 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 java.nio.channels;
+
+/**
+ * @author Michael Koch
+ * @since 1.4
+ */
+public class AsynchronousCloseException extends ClosedChannelException
+{
+ /**
+ * Creates the exception
+ */
+ public AsynchronousCloseException()
+ {
+ }
+}
diff --git a/libjava/java/nio/channels/ByteChannel.java b/libjava/java/nio/channels/ByteChannel.java
new file mode 100644
index 00000000000..f4958be2bf7
--- /dev/null
+++ b/libjava/java/nio/channels/ByteChannel.java
@@ -0,0 +1,43 @@
+/* ByteChannel.java --
+ Copyright (C) 2002 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 java.nio.channels;
+
+public interface ByteChannel
+ extends ReadableByteChannel, WritableByteChannel
+{
+}
diff --git a/libjava/java/nio/channels/CancelledKeyException.java b/libjava/java/nio/channels/CancelledKeyException.java
new file mode 100644
index 00000000000..cf3c5cc352c
--- /dev/null
+++ b/libjava/java/nio/channels/CancelledKeyException.java
@@ -0,0 +1,52 @@
+/* CancelledKeyException.java --
+ Copyright (C) 2002 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 java.nio.channels;
+
+/**
+ * @author Michael Koch
+ * @since 1.4
+ */
+public class CancelledKeyException extends IllegalStateException
+{
+ /**
+ * Creates the exception
+ */
+ public CancelledKeyException()
+ {
+ }
+}
diff --git a/libjava/java/nio/channels/Channel.java b/libjava/java/nio/channels/Channel.java
new file mode 100644
index 00000000000..b5272c36776
--- /dev/null
+++ b/libjava/java/nio/channels/Channel.java
@@ -0,0 +1,55 @@
+/* Channel.java --
+ Copyright (C) 2002 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 java.nio.channels;
+
+import java.io.IOException;
+
+public interface Channel
+{
+ /**
+ * Tells whether this channel is open or not
+ */
+ public boolean isOpen();
+
+ /**
+ * Closes this channel
+ *
+ * @exception IOException If an error occurs
+ */
+ public void close() throws IOException;
+}
diff --git a/libjava/java/nio/channels/ClosedByInterruptException.java b/libjava/java/nio/channels/ClosedByInterruptException.java
new file mode 100644
index 00000000000..b99e016f17d
--- /dev/null
+++ b/libjava/java/nio/channels/ClosedByInterruptException.java
@@ -0,0 +1,52 @@
+/* ClosedByInterruptException.java --
+ Copyright (C) 2002 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 java.nio.channels;
+
+/**
+ * @author Michael Koch
+ * @since 1.4
+ */
+public class ClosedByInterruptException extends AsynchronousCloseException
+{
+ /**
+ * Creates the exception
+ */
+ public ClosedByInterruptException()
+ {
+ }
+}
diff --git a/libjava/java/nio/channels/ClosedChannelException.java b/libjava/java/nio/channels/ClosedChannelException.java
new file mode 100644
index 00000000000..353a8202647
--- /dev/null
+++ b/libjava/java/nio/channels/ClosedChannelException.java
@@ -0,0 +1,54 @@
+/* ClosedChannelException.java --
+ Copyright (C) 2002 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 java.nio.channels;
+
+import java.io.IOException;
+
+/**
+ * @author Michael Koch
+ * @since 1.4
+ */
+public class ClosedChannelException extends IOException
+{
+ /**
+ * Creates the exception
+ */
+ public ClosedChannelException()
+ {
+ }
+}
diff --git a/libjava/java/nio/channels/ClosedSelectorException.java b/libjava/java/nio/channels/ClosedSelectorException.java
new file mode 100644
index 00000000000..98a9d505ded
--- /dev/null
+++ b/libjava/java/nio/channels/ClosedSelectorException.java
@@ -0,0 +1,52 @@
+/* ClosedSelectorException.java --
+ Copyright (C) 2002 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 java.nio.channels;
+
+/**
+ * @author Michael Koch
+ * @since 1.4
+ */
+public class ClosedSelectorException extends IllegalStateException
+{
+ /**
+ * Creates the exception
+ */
+ public ClosedSelectorException()
+ {
+ }
+}
diff --git a/libjava/java/nio/channels/ConnectionPendingException.java b/libjava/java/nio/channels/ConnectionPendingException.java
new file mode 100644
index 00000000000..876179c01b4
--- /dev/null
+++ b/libjava/java/nio/channels/ConnectionPendingException.java
@@ -0,0 +1,52 @@
+/* ConnectionPendingException.java --
+ Copyright (C) 2002 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 java.nio.channels;
+
+/**
+ * @author Michael Koch
+ * @since 1.4
+ */
+public class ConnectionPendingException extends IllegalStateException
+{
+ /**
+ * Creates the exception
+ */
+ public ConnectionPendingException()
+ {
+ }
+}
diff --git a/libjava/java/nio/channels/DatagramChannel.java b/libjava/java/nio/channels/DatagramChannel.java
new file mode 100644
index 00000000000..6c457557b95
--- /dev/null
+++ b/libjava/java/nio/channels/DatagramChannel.java
@@ -0,0 +1,205 @@
+/* DatagramChannel.java --
+ Copyright (C) 2002 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 java.nio.channels;
+
+import java.io.IOException;
+import java.net.DatagramSocket;
+import java.net.SocketAddress;
+import java.nio.ByteBuffer;
+import java.nio.channels.spi.AbstractSelectableChannel;
+import java.nio.channels.spi.SelectorProvider;
+
+/**
+ * @since 1.4
+ */
+public abstract class DatagramChannel
+ extends AbstractSelectableChannel
+ implements ByteChannel, ScatteringByteChannel, GatheringByteChannel
+{
+ /**
+ * Initializes the channel.
+ */
+ protected DatagramChannel (SelectorProvider provider)
+ {
+ super (provider);
+ }
+
+ /**
+ * Opens a datagram channel.
+ *
+ * @exception IOException If an error occurs
+ */
+ public static DatagramChannel open () throws IOException
+ {
+ return SelectorProvider.provider ().openDatagramChannel ();
+ }
+
+ /**
+ * Reads data from this channel.
+ */
+ public final long read (ByteBuffer[] dsts) throws IOException
+ {
+ long b = 0;
+
+ for (int i = 0; i < dsts.length; i++)
+ b += read (dsts[i]);
+
+ return b;
+ }
+
+ /**
+ * Writes data to this channel.
+ *
+ * @exception IOException If an error occurs
+ * @exception NotYetConnectedException The channel's socket is not connected.
+ */
+ public final long write (ByteBuffer[] srcs)
+ {
+ long b = 0;
+
+ for (int i = 0;i < srcs.length; i++)
+ b += write (srcs[i]);
+
+ return b;
+ }
+
+ /**
+ * Connects this channel's socket.
+ *
+ * @exception AsynchronousCloseException If another thread closes this channel
+ * while the connect operation is in progress.
+ * @exception ClosedByInterruptException If another thread interrupts the
+ * current thread while the read operation is in progress, thereby closing the
+ * channel and setting the current thread's interrupt status.
+ * @exception ClosedChannelException If this channel is closed.
+ * @exception IOException If an error occurs.
+ * @exception SecurityException If a security manager has been installed and
+ * it does not permit datagrams to be sent to the given address.
+ */
+ public abstract DatagramChannel connect (SocketAddress remote);
+
+ /**
+ * Disonnects this channel's socket.
+ *
+ * @exception IOException If an error occurs
+ */
+ public abstract DatagramChannel disconnect ();
+
+ /**
+ * Tells whether or not this channel's socket is connected.
+ *
+ * @exception IOException If an error occurs.
+ * @exception NotYetConnectedException The channel's socket is not connected.
+ */
+ public abstract boolean isConnected ();
+
+ /**
+ * Reads data from this channel.
+ */
+ public abstract int read (ByteBuffer dst);
+
+ /**
+ * Reads data from this channel.
+ *
+ * @exception IOException If an error occurs.
+ * @exception NotYetConnectedException The channel's socket is not connected.
+ */
+ public abstract long read (ByteBuffer[] dsts, int offset, int length);
+
+ /**
+ * Receives a datagram via this channel.
+ *
+ * @exception AsynchronousCloseException If another thread closes this channel
+ * while the connect operation is in progress.
+ * @exception ClosedByInterruptException If another thread interrupts the
+ * current thread while the read operation is in progress, thereby closing the
+ * channel and setting the current thread's interrupt status.
+ * @exception ClosedChannelException If this channel is closed.
+ * @exception IOException If an error occurs
+ * @exception SecurityException If a security manager has been installed and
+ * it does not permit datagrams to be sent to the given address.
+ */
+ public abstract SocketAddress receive (ByteBuffer dst);
+
+ /**
+ * Sends a datagram via this channel.
+ *
+ * @exception AsynchronousCloseException If another thread closes this channel
+ * while the connect operation is in progress.
+ * @exception ClosedByInterruptException If another thread interrupts the
+ * current thread while the read operation is in progress, thereby closing the
+ * channel and setting the current thread's interrupt status.
+ * @exception ClosedChannelException If this channel is closed.
+ * @exception IOException If an error occurs
+ * @exception SecurityException If a security manager has been installed and
+ * it does not permit datagrams to be sent to the given address.
+ */
+ public abstract int send (ByteBuffer src, SocketAddress target);
+
+ /**
+ * Retrieves the channel's socket.
+ */
+ public abstract DatagramSocket socket ();
+
+ /**
+ * Writes data to this channel.
+ *
+ * @exception IOException If an error occurs.
+ * @exception NotYetConnectedException The channel's socket is not connected.
+ */
+ public abstract int write (ByteBuffer src);
+
+ /**
+ * Writes data to this channel.
+ *
+ * @exception IOException If an error occurs.
+ * @exception NotYetConnectedException The channel's socket is not connected.
+ */
+ public abstract long write (ByteBuffer[] srcs, int offset, int length);
+
+ /**
+ * Retrieves the valid operations for this channel.
+ *
+ * @exception IOException If an error occurs.
+ * @exception NotYetConnectedException The channel's socket is not connected.
+ */
+ public final int validOps ()
+ {
+ return SelectionKey.OP_READ | SelectionKey.OP_WRITE;
+ }
+}
diff --git a/libjava/java/nio/channels/FileChannel.java b/libjava/java/nio/channels/FileChannel.java
new file mode 100644
index 00000000000..8970b983923
--- /dev/null
+++ b/libjava/java/nio/channels/FileChannel.java
@@ -0,0 +1,135 @@
+/* FileChannel.java --
+ Copyright (C) 2002 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 java.nio.channels;
+
+import java.io.IOException;
+import java.nio.ByteBuffer;
+import java.nio.MappedByteBuffer;
+import java.nio.channels.spi.AbstractInterruptibleChannel;
+
+/**
+ * @author Michael Koch
+ * @since 1.4
+ */
+public abstract class FileChannel extends AbstractInterruptibleChannel
+ implements ByteChannel, GatheringByteChannel, ScatteringByteChannel
+{
+ public static class MapMode
+ {
+ public int m;
+
+ public static MapMode READ_ONLY = new MapMode(0);
+ public static MapMode READ_WRITE = new MapMode(1);
+ public static MapMode PRIVATE = new MapMode(2);
+
+ /**
+ * Initializes the MapMode.
+ */
+ MapMode(int a)
+ {
+ m = a;
+ }
+
+ public String toString()
+ {
+ return "" + m;
+ }
+ }
+
+ /**
+ * Initializes the channel.
+ */
+ protected FileChannel ()
+ {
+ }
+
+ /**
+ * Maps the file into the memory.
+ *
+ * @exception IOException If an error occurs.
+ */
+ public abstract MappedByteBuffer map(MapMode mode, long position, long size)
+ throws IOException;
+
+ /**
+ * Return the size of the file thus far
+ */
+ public abstract long size() throws IOException;
+
+ /**
+ * Writes data to the channel.
+ *
+ * @exception IOException If an error occurs.
+ */
+ public long write (ByteBuffer[] srcs) throws IOException
+ {
+ long result = 0;
+
+ for (int i = 0; i < srcs.length; i++)
+ {
+ result += write (srcs[i]);
+ }
+
+ return result;
+ }
+
+ /**
+ * Writes data to the channel.
+ */
+ public abstract long write(ByteBuffer[] srcs, int offset, int length)
+ throws IOException;
+
+ /**
+ * Reads data from the channel.
+ */
+ public abstract int read(ByteBuffer dst) throws IOException;
+
+ /**
+ * Closes the channel.
+ *
+ * This is called from @see close.
+ *
+ * @exception IOException If an error occurs.
+ */
+ protected abstract void implCloseChannel() throws IOException;
+
+ /**
+ * msync with the disk
+ */
+ public abstract void force(boolean metaData);
+}
diff --git a/libjava/java/nio/channels/FileLockInterruptionException.java b/libjava/java/nio/channels/FileLockInterruptionException.java
new file mode 100644
index 00000000000..563b0a08fe7
--- /dev/null
+++ b/libjava/java/nio/channels/FileLockInterruptionException.java
@@ -0,0 +1,54 @@
+/* FileLockInterruptionException.java --
+ Copyright (C) 2002 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 java.nio.channels;
+
+import java.io.IOException;
+
+/**
+ * @author Michael Koch
+ * @since 1.4
+ */
+public class FileLockInterruptionException extends IOException
+{
+ /**
+ * Creates the exception
+ */
+ public FileLockInterruptionException()
+ {
+ }
+}
diff --git a/libjava/java/nio/channels/GatheringByteChannel.java b/libjava/java/nio/channels/GatheringByteChannel.java
new file mode 100644
index 00000000000..3ef12b7b6dc
--- /dev/null
+++ b/libjava/java/nio/channels/GatheringByteChannel.java
@@ -0,0 +1,79 @@
+/* GatheringByteChannel.java --
+ Copyright (C) 2002 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 java.nio.channels;
+
+import java.nio.ByteBuffer;
+import java.io.IOException;
+
+public interface GatheringByteChannel
+ extends WritableByteChannel
+{
+ /**
+ * Writes a sequence of bytes to this channel from a subsequence of
+ * the given buffers
+ *
+ * @exception AsynchronousCloseException If another thread closes this
+ * channel while the write operation is in progress
+ * @exception ClosedByInterruptException If another thread interrupts the
+ * current thread while the write operation is in progress, thereby closing
+ * the channel and setting the current thread's interrupt status
+ * @exception ClosedChannelException If this channel is closed
+ * @exception IndexOutOfBoundsException If the preconditions on the offset
+ * and length parameters do not hold
+ * @exception IOException If an error occurs
+ * @exception NonWritableChannelException If this channel was not opened for
+ * writing
+ */
+ public long write(ByteBuffer[] srcs, int offset, int length)
+ throws IOException;
+
+ /**
+ * Writes a sequence of bytes to this channel from the given buffers
+ *
+ * @exception AsynchronousCloseException If another thread closes this
+ * channel while the write operation is in progress
+ * @exception ClosedByInterruptException If another thread interrupts the
+ * current thread while the write operation is in progress, thereby closing
+ * the channel and setting the current thread's interrupt status
+ * @exception ClosedChannelException If this channel is closed
+ * @exception IOException If an error occurs
+ * @exception NonWritableChannelException If this channel was not opened for
+ * writing
+ */
+ public long write(ByteBuffer[] srcs) throws IOException;
+}
diff --git a/libjava/java/nio/channels/IllegalBlockingModeException.java b/libjava/java/nio/channels/IllegalBlockingModeException.java
new file mode 100644
index 00000000000..dca8110059b
--- /dev/null
+++ b/libjava/java/nio/channels/IllegalBlockingModeException.java
@@ -0,0 +1,56 @@
+/* IllegalBlockingModeException.java --
+ Copyright (C) 2002 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 java.nio.channels;
+
+/**
+ * @author Michael Koch <konqueror@gmx.de>
+ * @since 1.4
+ *
+ * Written using JDK 1.4.1 Online API from Sun
+ * Status: JDK 1.4 complete
+ */
+public class IllegalBlockingModeException extends IllegalStateException
+{
+ /**
+ * Creates the exception
+ */
+ public IllegalBlockingModeException()
+ {
+ super();
+ }
+}
diff --git a/libjava/java/nio/channels/IllegalSelectorException.java b/libjava/java/nio/channels/IllegalSelectorException.java
new file mode 100644
index 00000000000..20465e56b1d
--- /dev/null
+++ b/libjava/java/nio/channels/IllegalSelectorException.java
@@ -0,0 +1,52 @@
+/* IllegalSelectorException.java --
+ Copyright (C) 2002 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 java.nio.channels;
+
+/**
+ * @author Michael Koch
+ * @since 1.4
+ */
+public class IllegalSelectorException extends IllegalArgumentException
+{
+ /**
+ * Creates the exception
+ */
+ public IllegalSelectorException()
+ {
+ }
+}
diff --git a/libjava/java/nio/channels/InterruptibleChannel.java b/libjava/java/nio/channels/InterruptibleChannel.java
new file mode 100644
index 00000000000..0b55e7619a5
--- /dev/null
+++ b/libjava/java/nio/channels/InterruptibleChannel.java
@@ -0,0 +1,50 @@
+/* InterruptibleChannel.java --
+ Copyright (C) 2002 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 java.nio.channels;
+
+import java.io.IOException;
+
+public interface InterruptibleChannel extends Channel
+{
+ /**
+ * Closes this channel
+ *
+ * @exception IOException If an error occurs
+ */
+ void close() throws IOException;
+}
diff --git a/libjava/java/nio/channels/NoConnectionPendingException.java b/libjava/java/nio/channels/NoConnectionPendingException.java
new file mode 100644
index 00000000000..f859cf6f651
--- /dev/null
+++ b/libjava/java/nio/channels/NoConnectionPendingException.java
@@ -0,0 +1,52 @@
+/* NoConnectionPendingException.java --
+ Copyright (C) 2002 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 java.nio.channels;
+
+/**
+ * @author Michael Koch
+ * @since 1.4
+ */
+public class NoConnectionPendingException extends IllegalStateException
+{
+ /**
+ * Creates the exception
+ */
+ public NoConnectionPendingException()
+ {
+ }
+}
diff --git a/libjava/java/nio/channels/NonReadableChannelException.java b/libjava/java/nio/channels/NonReadableChannelException.java
new file mode 100644
index 00000000000..cb146bb5133
--- /dev/null
+++ b/libjava/java/nio/channels/NonReadableChannelException.java
@@ -0,0 +1,52 @@
+/* NonReadableChannelException.java --
+ Copyright (C) 2002 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 java.nio.channels;
+
+/**
+ * @author Michael Koch
+ * @since 1.4
+ */
+public class NonReadableChannelException extends IllegalStateException
+{
+ /**
+ * Creates the exception
+ */
+ public NonReadableChannelException()
+ {
+ }
+}
diff --git a/libjava/java/nio/channels/NonWritableChannelException.java b/libjava/java/nio/channels/NonWritableChannelException.java
new file mode 100644
index 00000000000..a26af3537c2
--- /dev/null
+++ b/libjava/java/nio/channels/NonWritableChannelException.java
@@ -0,0 +1,52 @@
+/* NonWritableChannelException.java --
+ Copyright (C) 2002 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 java.nio.channels;
+
+/**
+ * @author Michael Koch
+ * @since 1.4
+ */
+public class NonWritableChannelException extends IllegalStateException
+{
+ /**
+ * Creates the exception
+ */
+ public NonWritableChannelException()
+ {
+ }
+}
diff --git a/libjava/java/nio/channels/NotYetBoundException.java b/libjava/java/nio/channels/NotYetBoundException.java
new file mode 100644
index 00000000000..0367b35e90d
--- /dev/null
+++ b/libjava/java/nio/channels/NotYetBoundException.java
@@ -0,0 +1,52 @@
+/* NotYetBoundException.java --
+ Copyright (C) 2002 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 java.nio.channels;
+
+/**
+ * @author Michael Koch
+ * @since 1.4
+ */
+public class NotYetBoundException extends IllegalStateException
+{
+ /**
+ * Creates the exception
+ */
+ public NotYetBoundException()
+ {
+ }
+}
diff --git a/libjava/java/nio/channels/NotYetConnectedException.java b/libjava/java/nio/channels/NotYetConnectedException.java
new file mode 100644
index 00000000000..3c15369611b
--- /dev/null
+++ b/libjava/java/nio/channels/NotYetConnectedException.java
@@ -0,0 +1,52 @@
+/* NotYetConnectedException.java --
+ Copyright (C) 2002 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 java.nio.channels;
+
+/**
+ * @author Michael Koch
+ * @since 1.4
+ */
+public class NotYetConnectedException extends IllegalStateException
+{
+ /**
+ * Creates the exception
+ */
+ public NotYetConnectedException()
+ {
+ }
+}
diff --git a/libjava/java/nio/channels/OverlappingFileLockException.java b/libjava/java/nio/channels/OverlappingFileLockException.java
new file mode 100644
index 00000000000..2f856d3ea73
--- /dev/null
+++ b/libjava/java/nio/channels/OverlappingFileLockException.java
@@ -0,0 +1,52 @@
+/* OverlappingFileLockException.java --
+ Copyright (C) 2002 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 java.nio.channels;
+
+/**
+ * @author Michael Koch
+ * @since 1.4
+ */
+public class OverlappingFileLockException extends IllegalStateException
+{
+ /**
+ * Creates the exception
+ */
+ public OverlappingFileLockException()
+ {
+ }
+}
diff --git a/libjava/java/nio/channels/Pipe.java b/libjava/java/nio/channels/Pipe.java
new file mode 100644
index 00000000000..22f3d156f68
--- /dev/null
+++ b/libjava/java/nio/channels/Pipe.java
@@ -0,0 +1,121 @@
+/* Pipe.java --
+ Copyright (C) 2002 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 java.nio.channels;
+
+import java.nio.channels.spi.AbstractSelectableChannel;
+import java.nio.channels.spi.SelectorProvider;
+
+/**
+ * @author Michael Koch
+ * @since 1.4
+ */
+public abstract class Pipe
+{
+ public abstract static class SinkChannel
+ extends AbstractSelectableChannel
+ implements WritableByteChannel, GatheringByteChannel
+ {
+ /**
+ * Initializes the channel.
+ */
+ protected SinkChannel (SelectorProvider provider)
+ {
+ super (provider);
+ }
+
+ /**
+ * Returns an operation set that is valid on this channel.
+ *
+ * The only valid operation on this channel is @see SelectionKey.OP_WRITE.
+ */
+ public final int validOps ()
+ {
+ return SelectionKey.OP_WRITE;
+ }
+ }
+
+ public abstract static class SourceChannel
+ extends AbstractSelectableChannel
+ implements ReadableByteChannel, ScatteringByteChannel
+ {
+ /**
+ * Initializes the channel.
+ */
+ protected SourceChannel (SelectorProvider provider)
+ {
+ super (provider);
+ }
+
+ /**
+ * Returns an operation set that is valid on this channel.
+ *
+ * The only valid operation on this channel is @see SelectionKey.OP_READ.
+ */
+ public final int validOps ()
+ {
+ return SelectionKey.OP_READ;
+ }
+ }
+
+ /**
+ * Initializes the pipe.
+ */
+ protected Pipe()
+ {
+ }
+
+ /**
+ * Opens a pipe.
+ *
+ * @exception IOException If an error occurs
+ */
+ public static Pipe open()
+ {
+ return SelectorProvider.provider ().openPipe();
+ }
+
+ /**
+ * Returns a pipe's sink channel.
+ */
+ public abstract Pipe.SinkChannel sink();
+
+ /**
+ * Returns a pipe's source channel
+ */
+ public abstract Pipe.SourceChannel source();
+}
diff --git a/libjava/java/nio/channels/ReadableByteChannel.java b/libjava/java/nio/channels/ReadableByteChannel.java
new file mode 100644
index 00000000000..d1653cc8d3e
--- /dev/null
+++ b/libjava/java/nio/channels/ReadableByteChannel.java
@@ -0,0 +1,59 @@
+/* ReadableByteChannel.java --
+ Copyright (C) 2002 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 java.nio.channels;
+
+import java.io.IOException;
+import java.nio.ByteBuffer;
+
+public interface ReadableByteChannel extends Channel
+{
+ /**
+ * Reads a sequence of bytes from this channel into the given buffer
+ *
+ * @exception AsynchronousCloseException If another thread closes this
+ * channel while the read operation is in progress
+ * @exception ClosedByInterruptException If another thread interrupts the
+ * current thread while the read operation is in progress, thereby closing
+ * the channel and setting the current thread's interrupt status
+ * @exception ClosedChannelException If this channel is closed
+ * @exception IOException If an error occurs
+ * @exception NonReadableChannelException If this channel was not opened for
+ * reading
+ */
+ public int read (ByteBuffer dst) throws IOException;
+}
diff --git a/libjava/java/nio/channels/ScatteringByteChannel.java b/libjava/java/nio/channels/ScatteringByteChannel.java
new file mode 100644
index 00000000000..a9efdbef448
--- /dev/null
+++ b/libjava/java/nio/channels/ScatteringByteChannel.java
@@ -0,0 +1,79 @@
+/* ScatteringByteChannel.java --
+ Copyright (C) 2002 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 java.nio.channels;
+
+import java.nio.ByteBuffer;
+import java.io.IOException;
+
+public interface ScatteringByteChannel
+ extends ReadableByteChannel
+{
+ /**
+ * Reads a sequence of bytes from this channel into a subsequence of the
+ * given buffers
+ *
+ * @exception AsynchronousCloseException If another thread closes this
+ * channel while the write operation is in progress
+ * @exception ClosedByInterruptException If another thread interrupts the
+ * current thread while the write operation is in progress, thereby closing
+ * the channel and setting the current thread's interrupt status
+ * @exception ClosedChannelException If this channel is closed
+ * @exception IndexOutOfBoundsException If the preconditions on the offset
+ * and length parameters do not hold
+ * @exception IOException If an error occurs
+ * @exception NonReadableChannelException If this channel was not opened for
+ * reading
+ */
+ public long read(ByteBuffer[] srcs, int offset, int length)
+ throws IOException;
+
+ /**
+ * Reads a sequence of bytes from this channel into the given buffers
+ *
+ * @exception AsynchronousCloseException If another thread closes this
+ * channel while the write operation is in progress
+ * @exception ClosedByInterruptException If another thread interrupts the
+ * current thread while the write operation is in progress, thereby closing
+ * the channel and setting the current thread's interrupt status
+ * @exception ClosedChannelException If this channel is closed
+ * @exception IOException If an error occurs
+ * @exception NonReadableChannelException If this channel was not opened for
+ * reading
+ */
+ public long read(ByteBuffer[] srcs) throws IOException;
+}
diff --git a/libjava/java/nio/channels/SelectableChannel.java b/libjava/java/nio/channels/SelectableChannel.java
new file mode 100644
index 00000000000..2bc5cc47e35
--- /dev/null
+++ b/libjava/java/nio/channels/SelectableChannel.java
@@ -0,0 +1,138 @@
+/* SelectableChannel.java --
+ Copyright (C) 2002 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 java.nio.channels;
+
+import java.nio.channels.spi.AbstractInterruptibleChannel;
+import java.nio.channels.spi.SelectorProvider;
+
+/**
+ * @author Michael Koch
+ * @since 1.4
+ */
+public abstract class SelectableChannel
+ extends AbstractInterruptibleChannel
+{
+ /**
+ * Initializes the channel.
+ */
+ protected SelectableChannel ()
+ {
+ }
+
+ /**
+ * Returns the lock of this channel.
+ */
+ public abstract Object blockingLock ();
+
+ /**
+ * Adjusts this channel's blocking mode.
+ *
+ * @exception ClosedChannelException If this channel is closed.
+ * @exception IllegalBlockingModeException If block is true and this channel
+ * is registered with one or more selectors.
+ * @exception IOException If an error occurs.
+ */
+ public abstract SelectableChannel configureBlocking (boolean block);
+
+ /**
+ * Tells whether this channel is blocking or not.
+ */
+ public abstract boolean isBlocking ();
+
+ /**
+ * Tells whether or not this channel is currently registered with
+ * any selectors.
+ */
+ public abstract boolean isRegistered ();
+
+ /**
+ * Retrieves the key representing the channel's registration with
+ * the given selector.
+ */
+ public abstract SelectionKey keyFor (Selector sel);
+
+ /**
+ * Returns the provider that created this channel.
+ */
+ public abstract SelectorProvider provider ();
+
+ /**
+ * Registers this channel with the given selector,
+ * returning a selection key.
+ *
+ * @exception CancelledKeyException If this channel is currently registered
+ * with the given selector but the corresponding key has already been cancelled
+ * @exception ClosedChannelException If this channel is closed.
+ * @exception IllegalArgumentException If a bit in ops does not correspond
+ * to an operation that is supported by this channel, that is, if
+ * set &amp; ~validOps() != 0.
+ * @exception IllegalBlockingModeException If block is true and this channel
+ * is registered with one or more selectors.
+ * @exception IllegalSelectorException If this channel was not created by
+ * the same provider as the given selector.
+ */
+ public final SelectionKey register (Selector sel, int ops)
+ throws ClosedChannelException
+ {
+ return register (sel, ops, null);
+ }
+
+ /**
+ * Registers this channel with the given selector,
+ * returning a selection key.
+ *
+ * @exception CancelledKeyException If this channel is currently registered
+ * with the given selector but the corresponding key has already been
+ * cancelled.
+ * @exception ClosedChannelException If this channel is closed.
+ * @exception IllegalArgumentException If a bit in ops does not correspond
+ * to an operation that is supported by this channel, that is, if
+ * set &amp; ~validOps() != 0.
+ * @exception IllegalBlockingModeException If block is true and this channel
+ * is registered with one or more selectors.
+ * @exception IllegalSelectorException If this channel was not created by
+ * the same provider as the given selector.
+ */
+ public abstract SelectionKey register (Selector sel, int ops, Object att)
+ throws ClosedChannelException;
+
+ /**
+ * Returns a set of valid operations on this channel.
+ */
+ public abstract int validOps();
+}
diff --git a/libjava/java/nio/channels/SelectionKey.java b/libjava/java/nio/channels/SelectionKey.java
new file mode 100644
index 00000000000..8d06a301143
--- /dev/null
+++ b/libjava/java/nio/channels/SelectionKey.java
@@ -0,0 +1,164 @@
+/* SelectionKey.java --
+ Copyright (C) 2002 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 java.nio.channels;
+
+/**
+ * @author Michael Koch
+ * @since 1.4
+ */
+public abstract class SelectionKey
+{
+ public static final int OP_ACCEPT = 1<<0;
+ public static final int OP_CONNECT = 1<<1;
+ public static final int OP_READ = 1<<2;
+ public static final int OP_WRITE = 1<<3;
+
+ Object attached;
+
+ /**
+ * Initializes the selection key.
+ */
+ protected SelectionKey ()
+ {
+ }
+
+ /**
+ * Attaches obj to the key and returns the old attached object.
+ */
+ public final Object attach (Object obj)
+ {
+ Object old = attached;
+ attached = obj;
+ return old;
+ }
+
+ /**
+ * Returns the object attached to the key.
+ */
+ public final Object attachment ()
+ {
+ return attached;
+ }
+
+ /**
+ * Tests if the channel attached to this key is ready to accept
+ * a new socket connection.
+ *
+ * @exception CancelledKeyException If this key has been cancelled
+ */
+ public final boolean isAcceptable ()
+ {
+ return (readyOps () & OP_ACCEPT) != 0;
+ }
+
+ /**
+ * Tests whether this key's channel has either finished,
+ * or failed to finish, its socket-connection operation.
+ *
+ * @exception CancelledKeyException If this key has been cancelled
+ */
+ public final boolean isConnectable ()
+ {
+ return (readyOps () & OP_CONNECT) != 0;
+ }
+
+ /**
+ * Tests if the channel attached to the key is readable.
+ *
+ * @exception CancelledKeyException If this key has been cancelled
+ */
+ public final boolean isReadable ()
+ {
+ return (readyOps () & OP_READ) != 0;
+ }
+
+ /**
+ * Tests if the channel attached to the key is writable.
+ *
+ * @exception CancelledKeyException If this key has been cancelled
+ */
+ public final boolean isWritable ()
+ {
+ return (readyOps () & OP_WRITE) != 0;
+ }
+
+ /**
+ * Requests that the registration of this key's channel with
+ * its selector be cancelled.
+ */
+ public abstract void cancel ();
+
+ /**
+ * return the channel attached to the key.
+ */
+ public abstract SelectableChannel channel ();
+
+ /**
+ * Returns the key's interest set.
+ *
+ * @exception CancelledKeyException If this key has been cancelled
+ */
+ public abstract int interestOps ();
+
+ /**
+ * Sets this key's interest set to the given value.
+ *
+ * @exception CancelledKeyException If this key has been cancelled
+ * @exception IllegalArgumentException If a bit in the set does not
+ * correspond to an operation that is supported by this key's channel,
+ * that is, if set &amp; ~(channel().validOps()) != 0
+ */
+ public abstract SelectionKey interestOps (int ops);
+
+ /**
+ * Tells whether or not this key is valid.
+ */
+ public abstract boolean isValid ();
+
+ /**
+ * Retrieves this key's ready-operation set.
+ *
+ * @exception CancelledKeyException If this key has been cancelled
+ */
+ public abstract int readyOps ();
+
+ /**
+ * Returns the selector for which this key was created.
+ */
+ public abstract Selector selector ();
+}
diff --git a/libjava/java/nio/channels/Selector.java b/libjava/java/nio/channels/Selector.java
new file mode 100644
index 00000000000..695969b5b3a
--- /dev/null
+++ b/libjava/java/nio/channels/Selector.java
@@ -0,0 +1,133 @@
+/* Selector.java --
+ Copyright (C) 2002 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 java.nio.channels;
+
+import java.io.IOException;
+import java.nio.channels.spi.SelectorProvider;
+import java.util.Set;
+
+/**
+ * @author Michael Koch
+ * @since 1.4
+ */
+public abstract class Selector
+{
+ /**
+ * Initializes the selector.
+ */
+ protected Selector()
+ {
+ }
+
+ /**
+ * Opens a selector.
+ *
+ * @exception IOException If an error occurs
+ */
+ public static Selector open () throws IOException
+ {
+ return SelectorProvider.provider ().openSelector ();
+ }
+
+ /**
+ * Closes the selector.
+ *
+ * @exception IOException If an error occurs
+ */
+ public abstract void close () throws IOException;
+
+ /**
+ * Tells whether the selector is open or not.
+ */
+ public abstract boolean isOpen ();
+
+ /**
+ * Returns this selector's key set.
+ *
+ * @exception ClosedSelectorException If this selector is closed.
+ */
+ public abstract Set keys ();
+
+ /**
+ * Returns the SelectorProvider that created the selector.
+ */
+ public abstract SelectorProvider provider ();
+
+ /**
+ * Selects a set of keys whose corresponding channels are ready
+ * for I/O operations.
+ *
+ * @exception ClosedSelectorException If this selector is closed.
+ * @exception IOException If an error occurs
+ */
+ public abstract int select () throws IOException;
+
+ /**
+ * Selects a set of keys whose corresponding channels are ready
+ * for I/O operations.
+ *
+ * @param timeout The timeout to use.
+ *
+ * @exception ClosedSelectorException If this selector is closed.
+ * @exception IllegalArgumentException If the timeout value is negative.
+ * @exception IOException If an error occurs
+ */
+ public abstract int select (long timeout) throws IOException;
+
+ /**
+ * Returns this selector's selected-key set.
+ *
+ * @exception ClosedSelectorException If this selector is closed.
+ */
+ public abstract Set selectedKeys ();
+
+ /**
+ * Selects a set of keys whose corresponding channels are ready
+ * for I/O operations.
+ *
+ * @exception ClosedSelectorException If this selector is closed.
+ * @exception IOException If an error occurs
+ */
+ public abstract int selectNow () throws IOException;
+
+ /**
+ * Causes the first selection operation that has not yet returned to
+ * return immediately.
+ */
+ public abstract Selector wakeup ();
+}
diff --git a/libjava/java/nio/channels/ServerSocketChannel.java b/libjava/java/nio/channels/ServerSocketChannel.java
new file mode 100644
index 00000000000..16a3a82df5b
--- /dev/null
+++ b/libjava/java/nio/channels/ServerSocketChannel.java
@@ -0,0 +1,100 @@
+/* ServerSocketChannel.java --
+ Copyright (C) 2002 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 java.nio.channels;
+
+import java.nio.channels.spi.AbstractSelectableChannel;
+import java.nio.channels.spi.SelectorProvider;
+import java.nio.ByteOrder;
+import java.nio.ByteBuffer;
+import java.io.IOException;
+import java.net.ServerSocket;
+
+/**
+ * @author Michael Koch
+ * @since 1.4
+ */
+public abstract class ServerSocketChannel
+ extends AbstractSelectableChannel
+{
+ /**
+ * Initializes this channel.
+ */
+ public ServerSocketChannel (SelectorProvider provider)
+ {
+ super (provider);
+ }
+
+ /**
+ * Accepts a connection made to this channel's socket.
+ *
+ * @exception IOException If an error occurs
+ * @exception AsynchronousCloseException If another thread closes this
+ * channel while the accept operation is in progress.
+ * @exception ClosedByInterruptException If another thread interrupts the
+ * current thread while the accept operation is in progress, thereby closing
+ * the channel and setting the current thread's interrupt status.
+ * @exception ClosedChannelException If the channel is closed.
+ * @exception NotYetBoundException If the channel's socket is not yet bound.
+ * @exception SecurityException If a security manager has been installed and
+ * it does not permit access to the remote endpoint of the new connection.
+ */
+ public abstract SocketChannel accept ();
+
+ /**
+ * Retrieves the channels socket.
+ */
+ public abstract ServerSocket socket ();
+
+ /**
+ * Opens a server socket channel.
+ *
+ * @exception IOException If an error occurs
+ */
+ public static ServerSocketChannel open () throws IOException
+ {
+ return SelectorProvider.provider ().openServerSocketChannel ();
+ }
+
+ /**
+ * Retrieves the valid operations for this channel.
+ */
+ public final int validOps ()
+ {
+ return SelectionKey.OP_ACCEPT;
+ }
+}
diff --git a/libjava/java/nio/channels/SocketChannel.java b/libjava/java/nio/channels/SocketChannel.java
new file mode 100644
index 00000000000..368a8ee468c
--- /dev/null
+++ b/libjava/java/nio/channels/SocketChannel.java
@@ -0,0 +1,222 @@
+/* SocketChannel.java --
+ Copyright (C) 2002 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 java.nio.channels;
+
+import java.nio.channels.spi.AbstractSelectableChannel;
+import java.nio.channels.spi.SelectorProvider;
+import java.nio.ByteBuffer;
+import java.io.IOException;
+import java.net.Socket;
+import java.net.SocketAddress;
+
+/**
+ * @author Michael Koch
+ * @since 1.4
+ */
+abstract public class SocketChannel extends AbstractSelectableChannel
+{
+ /**
+ * Initializes this socket.
+ */
+ protected SocketChannel (SelectorProvider provider)
+ {
+ super (provider);
+ }
+
+ /**
+ * Opens a socket channel.
+ *
+ * @exception IOException If an error occurs
+ */
+ public static SocketChannel open () throws IOException
+ {
+ return SelectorProvider.provider ().openSocketChannel ();
+ }
+
+ /**
+ * Opens a channel and connects it to a remote address.
+ *
+ * @exception AsynchronousCloseException If this channel is already connected.
+ * @exception ClosedByInterruptException If another thread interrupts the
+ * current thread while the connect operation is in progress, thereby closing
+ * the channel and setting the current thread's interrupt status.
+ * @exception IOException If an error occurs
+ * @exception SecurityException If a security manager has been installed and
+ * it does not permit access to the given remote endpoint.
+ * @exception UnresolvedAddressException If the given remote address is not
+ * fully resolved.
+ * @exception UnsupportedAddressTypeException If the type of the given remote
+ * address is not supported.
+ */
+ public static SocketChannel open (SocketAddress remote) throws IOException
+ {
+ SocketChannel ch = open ();
+
+ if (ch.connect (remote))
+ {
+ }
+
+ return ch;
+ }
+
+ /**
+ * Reads data from the channel.
+ *
+ * @exception IOException If an error occurs
+ * @exception NotYetConnectedException If this channel is not yet connected.
+ */
+ public final long read (ByteBuffer[] dsts)
+ {
+ long b = 0;
+
+ for (int i = 0; i < dsts.length; i++)
+ {
+ b += read (dsts [i]);
+ }
+
+ return b;
+ }
+
+ /**
+ * Writes data to the channel.
+ *
+ * @exception IOException If an error occurs
+ * @exception NotYetConnectedException If this channel is not yet connected.
+ */
+ public final long write (ByteBuffer[] dsts)
+ {
+ long b = 0;
+
+ for (int i= 0; i < dsts.length; i++)
+ {
+ b += write (dsts [i]);
+ }
+
+ return b;
+ }
+
+ /**
+ * Retrieves the valid operations for this channel.
+ */
+ public final int validOps ()
+ {
+ return SelectionKey.OP_CONNECT | SelectionKey.OP_READ | SelectionKey.OP_WRITE;
+ }
+
+ /**
+ * Reads data from the channel.
+ *
+ * @exception IOException If an error occurs
+ * @exception NotYetConnectedException If this channel is not yet connected.
+ */
+ public abstract int read (ByteBuffer dst);
+
+ /**
+ * Connects the channel's socket to the remote address.
+ *
+ * @exception AlreadyConnectedException If this channel is already connected.
+ * @exception AsynchronousCloseException If this channel is already connected.
+ * @exception ClosedByInterruptException If another thread interrupts the
+ * current thread while the connect operation is in progress, thereby closing
+ * the channel and setting the current thread's interrupt status.
+ * @exception ClosedChannelException If this channel is closed.
+ * @exception ConnectionPendingException If a non-blocking connection
+ * operation is already in progress on this channel.
+ * @exception IOException If an error occurs
+ * @exception SecurityException If a security manager has been installed and
+ * it does not permit access to the given remote endpoint.
+ * @exception UnresolvedAddressException If the given remote address is not
+ * fully resolved.
+ * @exception UnsupportedAddressTypeException If the type of the given remote
+ * address is not supported.
+ */
+ public abstract boolean connect (SocketAddress remote) throws IOException;
+
+ /**
+ * Finishes the process of connecting a socket channel.
+ *
+ * @exception AsynchronousCloseException If this channel is already connected.
+ * @exception ClosedByInterruptException If another thread interrupts the
+ * current thread while the connect operation is in progress, thereby closing
+ * the channel and setting the current thread's interrupt status.
+ * @exception ClosedChannelException If this channel is closed.
+ * @exception IOException If an error occurs
+ * @exception NoConnectionPendingException If this channel is not connected
+ * and a connection operation has not been initiated.
+ */
+ public abstract boolean finishConnect ();
+
+ /**
+ * Tells whether or not the channel's socket is connected.
+ */
+ public abstract boolean isConnected ();
+
+ /**
+ * Tells whether or not a connection operation is in progress on this channel.
+ */
+ public abstract boolean isConnectionPending ();
+
+ /**
+ * Reads data from the channel.
+ *
+ * @exception IOException If an error occurs
+ * @exception NotYetConnectedException If this channel is not yet connected.
+ */
+ public abstract long read (ByteBuffer[] dsts, int offset, int length);
+
+ /**
+ * Retrieves the channel's socket.
+ */
+ public abstract Socket socket ();
+
+ /**
+ * Writes data to the channel.
+ *
+ * @exception IOException If an error occurs
+ * @exception NotYetConnectedException If this channel is not yet connected.
+ */
+ public abstract int write (ByteBuffer src);
+
+ /**
+ * Writes data to the channel.
+ *
+ * @exception IOException If an error occurs
+ * @exception NotYetConnectedException If this channel is not yet connected.
+ */
+ public abstract long write (ByteBuffer[] srcs, int offset, int length);
+}
diff --git a/libjava/java/nio/channels/UnresolvedAddressException.java b/libjava/java/nio/channels/UnresolvedAddressException.java
new file mode 100644
index 00000000000..1cfdf970dca
--- /dev/null
+++ b/libjava/java/nio/channels/UnresolvedAddressException.java
@@ -0,0 +1,52 @@
+/* UnresolvedAddressException.java --
+ Copyright (C) 2002 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 java.nio.channels;
+
+/**
+ * @author Michael Koch
+ * @since 1.4
+ */
+public class UnresolvedAddressException extends IllegalArgumentException
+{
+ /**
+ * Creates the exception
+ */
+ public UnresolvedAddressException()
+ {
+ }
+}
diff --git a/libjava/java/nio/channels/UnsupportedAddressTypeException.java b/libjava/java/nio/channels/UnsupportedAddressTypeException.java
new file mode 100644
index 00000000000..824772a235b
--- /dev/null
+++ b/libjava/java/nio/channels/UnsupportedAddressTypeException.java
@@ -0,0 +1,52 @@
+/* UnsupportedAddressTypeException.java --
+ Copyright (C) 2002 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 java.nio.channels;
+
+/**
+ * @author Michael Koch
+ * @since 1.4
+ */
+public class UnsupportedAddressTypeException extends IllegalArgumentException
+{
+ /**
+ * Creates the exception
+ */
+ public UnsupportedAddressTypeException()
+ {
+ }
+}
diff --git a/libjava/java/nio/channels/WritableByteChannel.java b/libjava/java/nio/channels/WritableByteChannel.java
new file mode 100644
index 00000000000..003437e5f3c
--- /dev/null
+++ b/libjava/java/nio/channels/WritableByteChannel.java
@@ -0,0 +1,60 @@
+/* WritableByteChannel.java --
+ Copyright (C) 2002 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 java.nio.channels;
+
+import java.io.IOException;
+import java.nio.ByteBuffer;
+
+public interface WritableByteChannel
+ extends Channel
+{
+ /**
+ * Writes a sequence of bytes to this channel from the given buffer
+ *
+ * @exception AsynchronousCloseException If another thread closes this
+ * channel while the write operation is in progress
+ * @exception ClosedByInterruptException If another thread interrupts the
+ * current thread while the write operation is in progress, thereby closing
+ * the channel and setting the current thread's interrupt status
+ * @exception ClosedChannelException If this channel is closed
+ * @exception IOException If an error occurs
+ * @exception NonWritableChannelException If this channel was not opened for
+ * writing
+ */
+ public int write(ByteBuffer src) throws IOException;
+}
diff --git a/libjava/java/nio/channels/spi/AbstractInterruptibleChannel.java b/libjava/java/nio/channels/spi/AbstractInterruptibleChannel.java
new file mode 100644
index 00000000000..855087b5f07
--- /dev/null
+++ b/libjava/java/nio/channels/spi/AbstractInterruptibleChannel.java
@@ -0,0 +1,104 @@
+/* AbstractInterruptibleChannel.java --
+ Copyright (C) 2002 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 java.nio.channels.spi;
+
+import java.io.IOException;
+import java.nio.channels.Channel;
+import java.nio.channels.InterruptibleChannel;
+
+/**
+ * @author Michael Koch
+ * @since 1.4
+ */
+public abstract class AbstractInterruptibleChannel
+ implements Channel, InterruptibleChannel
+{
+ boolean opened = true;
+
+ /**
+ * Initializes the channel.
+ */
+ protected AbstractInterruptibleChannel ()
+ {
+ }
+
+ /**
+ * Marks the beginning of an I/O operation that might block indefinitely.
+ */
+ protected final void begin ()
+ {
+ }
+
+ /**
+ * Closes the channel.
+ *
+ * @exception IOException If an error occurs
+ */
+ public final void close () throws IOException
+ {
+ opened = false;
+ implCloseChannel ();
+ }
+
+ /**
+ * Marks the end of an I/O operation that might block indefinitely.
+ *
+ * @exception AsynchronousCloseException If the channel was asynchronously
+ * closed.
+ * @exception ClosedByInterruptException If the thread blocked in the
+ * I/O operation was interrupted.
+ */
+ protected final void end (boolean completed)
+ {
+ }
+
+ /**
+ * Closes the channel.
+ *
+ * @exception IOException If an error occurs
+ */
+ protected abstract void implCloseChannel () throws IOException;
+
+ /**
+ * Tells whether or not this channel is open.
+ */
+ public final boolean isOpen ()
+ {
+ return opened;
+ }
+}
diff --git a/libjava/java/nio/channels/spi/AbstractSelectableChannel.java b/libjava/java/nio/channels/spi/AbstractSelectableChannel.java
new file mode 100644
index 00000000000..da03693d2cc
--- /dev/null
+++ b/libjava/java/nio/channels/spi/AbstractSelectableChannel.java
@@ -0,0 +1,213 @@
+/* AbstractSelectableChannel.java
+ Copyright (C) 2002 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 java.nio.channels.spi;
+
+import java.io.IOException;
+import java.nio.channels.ClosedChannelException;
+import java.nio.channels.SelectableChannel;
+import java.nio.channels.SelectionKey;
+import java.nio.channels.Selector;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.ListIterator;
+
+public abstract class AbstractSelectableChannel extends SelectableChannel
+{
+ int registered;
+ boolean blocking = true;
+ Object LOCK = new Object ();
+ SelectorProvider provider;
+ List keys;
+
+ /**
+ * Initializes the channel
+ */
+ protected AbstractSelectableChannel (SelectorProvider provider)
+ {
+ this.provider = provider;
+ }
+
+ /**
+ * Retrieves the object upon which the configureBlocking and register
+ * methods synchronize.
+ */
+ public final Object blockingLock ()
+ {
+ return LOCK;
+ }
+
+ /**
+ * Adjusts this channel's blocking mode.
+ */
+ public final SelectableChannel configureBlocking (boolean block)
+ {
+ synchronized (LOCK)
+ {
+ blocking = true;
+ implConfigureBlocking (block);
+ }
+
+ return this;
+ }
+
+ /**
+ * Closes this channel.
+ *
+ * @exception IOException If an error occurs
+ */
+ protected final void implCloseChannel ()
+ {
+ implCloseSelectableChannel ();
+ }
+
+ /**
+ * Closes this selectable channel.
+ */
+ protected abstract void implCloseSelectableChannel ();
+
+ /**
+ * Adjusts this channel's blocking mode.
+ */
+ protected abstract void implConfigureBlocking (boolean block);
+
+ /**
+ * Tells whether or not every I/O operation on this channel will block
+ * until it completes.
+ */
+ public final boolean isBlocking()
+ {
+ return blocking;
+ }
+
+ /**
+ * Tells whether or not this channel is currently registered with
+ * any selectors.
+ */
+ public final boolean isRegistered()
+ {
+ return registered > 0;
+ }
+
+ /**
+ * Retrieves the key representing the channel's registration with the
+ * given selector.
+ */
+ public final SelectionKey keyFor(Selector selector)
+ {
+ try
+ {
+ return register (selector, 0, null);
+ }
+ catch (Exception e)
+ {
+ return null;
+ }
+ }
+
+ /**
+ * Returns the provider that created this channel.
+ */
+ public final SelectorProvider provider ()
+ {
+ return provider;
+ }
+
+ private SelectionKey locate (Selector selector)
+ {
+ if (keys == null)
+ return null;
+
+ SelectionKey k = null;
+ ListIterator it = keys.listIterator ();
+
+ while (it.hasNext ())
+ {
+ k = (SelectionKey) it.next ();
+ if (k.selector () == selector)
+ {
+ return k;
+ }
+ }
+
+ return k;
+ }
+
+ private void add (SelectionKey key)
+ {
+ if (keys == null)
+ {
+ keys = new LinkedList ();
+ }
+
+ keys.add (key);
+ }
+
+ /**
+ * Registers this channel with the given selector, returning a selection key.
+ *
+ * @exception ClosedChannelException If the channel is already closed.
+ */
+ public final SelectionKey register (Selector selin, int ops, Object att)
+ throws ClosedChannelException
+ {
+ if (!isOpen ())
+ throw new ClosedChannelException();
+
+ SelectionKey k = null;
+ AbstractSelector selector = (AbstractSelector) selin;
+
+ synchronized (LOCK)
+ {
+ k = locate (selector);
+
+ if (k != null)
+ {
+ k.attach (att);
+ }
+ else
+ {
+ k = selector.register (this, ops, att);
+
+ if (k != null)
+ add (k);
+ }
+ }
+
+ return k;
+ }
+}
diff --git a/libjava/java/nio/channels/spi/AbstractSelectionKey.java b/libjava/java/nio/channels/spi/AbstractSelectionKey.java
new file mode 100644
index 00000000000..01ea4f33fc2
--- /dev/null
+++ b/libjava/java/nio/channels/spi/AbstractSelectionKey.java
@@ -0,0 +1,75 @@
+/* AbstractSelectionKey.java --
+ Copyright (C) 2002 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 java.nio.channels.spi;
+
+import java.nio.channels.SelectionKey;
+
+/**
+ * @since 1.4
+ */
+public abstract class AbstractSelectionKey
+ extends SelectionKey
+{
+ boolean ok = true;
+
+ /**
+ * Initializes the key.
+ */
+ protected AbstractSelectionKey ()
+ {
+ }
+
+ /**
+ * Cancels this key.
+ */
+ public final void cancel ()
+ {
+ if (ok)
+ selector ().selectedKeys ().add (this);
+
+ ok = false;
+ }
+
+ /**
+ * Tells whether this key is valid or not.
+ */
+ public final boolean isValid ()
+ {
+ return ok;
+ }
+}
diff --git a/libjava/java/nio/channels/spi/AbstractSelector.java b/libjava/java/nio/channels/spi/AbstractSelector.java
new file mode 100644
index 00000000000..fc0aeca32d9
--- /dev/null
+++ b/libjava/java/nio/channels/spi/AbstractSelector.java
@@ -0,0 +1,114 @@
+/* AbstractSelector.java --
+ Copyright (C) 2002 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 java.nio.channels.spi;
+
+import java.io.IOException;
+import java.nio.channels.SelectionKey;
+import java.nio.channels.Selector;
+import java.util.List;
+import java.util.Set;
+
+public abstract class AbstractSelector extends Selector
+{
+ boolean closed = false;
+ SelectorProvider provider;
+
+ /**
+ * Initializes the slector.
+ */
+ protected AbstractSelector (SelectorProvider provider)
+ {
+ this.provider = provider;
+ }
+
+ /**
+ * Marks the beginning of an I/O operation that might block indefinitely.
+ */
+ protected final void begin ()
+ {
+ }
+
+ /**
+ * Closes the channel.
+ *
+ * @exception IOException If an error occurs
+ */
+ public final void close () throws IOException
+ {
+ if (closed)
+ return;
+
+ closed = true;
+ implCloseSelector ();
+ }
+
+ /**
+ * Tells whether this channel is open or not.
+ */
+ public final boolean isOpen ()
+ {
+ return ! closed;
+ }
+
+ protected final void deregister (AbstractSelectionKey key)
+ {
+ cancelledKeys ().remove (key);
+ }
+
+ protected final void end()
+ {
+ }
+
+ public final SelectorProvider provider ()
+ {
+ return provider;
+ }
+
+ protected final Set cancelledKeys()
+ {
+ return null;
+ }
+
+ /**
+ * Closes the channel.
+ */
+ protected abstract void implCloseSelector () throws IOException;
+
+ protected abstract SelectionKey register (AbstractSelectableChannel ch,
+ int ops, Object att);
+}
diff --git a/libjava/java/nio/channels/spi/SelectorProvider.java b/libjava/java/nio/channels/spi/SelectorProvider.java
new file mode 100644
index 00000000000..06017f76edb
--- /dev/null
+++ b/libjava/java/nio/channels/spi/SelectorProvider.java
@@ -0,0 +1,103 @@
+/* SelectorProvider.java
+ Copyright (C) 2002 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 java.nio.channels.spi;
+
+/* import gnu.java.nio.channels.SelectorProviderImpl; */
+import java.nio.channels.DatagramChannel;
+import java.nio.channels.Pipe;
+import java.nio.channels.ServerSocketChannel;
+import java.nio.channels.SocketChannel;
+
+/**
+ * @author Michael Koch
+ * @since 1.4
+ */
+public abstract class SelectorProvider
+{
+ static SelectorProvider pr;
+
+ /**
+ * Initializes the selector provider.
+ *
+ * @exception SecurityException If a security manager has been installed and
+ * it denies @see RuntimePermission ("selectorProvider").
+ */
+ protected SelectorProvider ()
+ {
+ SecurityManager sm = System.getSecurityManager ();
+ if (sm != null)
+ sm.checkPermission (new RuntimePermission ("selectorProvider"));
+ }
+
+ /**
+ * Opens a datagram channel.
+ */
+ public abstract DatagramChannel openDatagramChannel ();
+
+ /**
+ * Opens a pipe.
+ */
+ public abstract Pipe openPipe ();
+
+ /**
+ * Opens a selector.
+ */
+ public abstract AbstractSelector openSelector ();
+
+ /**
+ * Opens a server socket channel.
+ */
+ public abstract ServerSocketChannel openServerSocketChannel ();
+
+ /**
+ * Opens a socket channel.
+ */
+ public abstract SocketChannel openSocketChannel ();
+
+ /**
+ * Returns the system-wide default selector provider for this invocation
+ * of the Java virtual machine.
+ */
+ public static SelectorProvider provider ()
+ {
+/* if (pr == null) */
+/* pr = new SelectorProviderImpl (); */
+
+ return pr;
+ }
+}
diff --git a/libjava/java/nio/charset/CharacterCodingException.java b/libjava/java/nio/charset/CharacterCodingException.java
new file mode 100644
index 00000000000..f6a283bdaff
--- /dev/null
+++ b/libjava/java/nio/charset/CharacterCodingException.java
@@ -0,0 +1,53 @@
+/* CharacterCodingException.java --
+ Copyright (C) 2002 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 java.nio.charset;
+
+import java.io.IOException;
+
+/**
+ * @since 1.4
+ */
+public class CharacterCodingException extends IOException
+{
+ /**
+ * Creates the exception
+ */
+ public CharacterCodingException()
+ {
+ }
+}
diff --git a/libjava/java/nio/charset/Charset.java b/libjava/java/nio/charset/Charset.java
new file mode 100644
index 00000000000..cc60c99b9b6
--- /dev/null
+++ b/libjava/java/nio/charset/Charset.java
@@ -0,0 +1,285 @@
+/* Charset.java --
+ Copyright (C) 2002 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 java.nio.charset;
+
+import java.nio.ByteBuffer;
+import java.nio.CharBuffer;
+import java.nio.charset.spi.CharsetProvider;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Locale;
+import java.util.Set;
+import java.util.SortedMap;
+import java.util.TreeMap;
+import gnu.java.nio.charset.Provider;
+
+/**
+ * @author Jesse Rosenstock
+ * @since 1.4
+ */
+public abstract class Charset implements Comparable
+{
+ private static CharsetEncoder cachedEncoder;
+ private static CharsetDecoder cachedDecoder;
+
+ static
+ {
+ synchronized (Charset.class)
+ {
+ cachedEncoder = null;
+ cachedDecoder = null;
+ }
+ }
+
+ private final String canonicalName;
+ private final String[] aliases;
+
+ protected Charset (String canonicalName, String[] aliases)
+ {
+ checkName (canonicalName);
+ if (aliases != null)
+ {
+ int n = aliases.length;
+ for (int i = 0; i < n; ++i)
+ checkName (aliases[i]);
+ }
+
+ this.canonicalName = canonicalName;
+ this.aliases = aliases;
+ }
+
+ /**
+ * @throws IllegalCharsetNameException if the name is illegal
+ */
+ private static void checkName (String name)
+ {
+ int n = name.length ();
+
+ if (n == 0)
+ throw new IllegalCharsetNameException (name);
+
+ char ch = name.charAt (0);
+ if (!(('A' <= ch && ch <= 'Z')
+ || ('a' <= ch && ch <= 'z')
+ || ('0' <= ch && ch <= '9')))
+ throw new IllegalCharsetNameException (name);
+
+ for (int i = 1; i < n; ++i)
+ {
+ ch = name.charAt (i);
+ if (!(('A' <= ch && ch <= 'Z')
+ || ('a' <= ch && ch <= 'z')
+ || ('0' <= ch && ch <= '9')
+ || ch == '-' || ch == '.' || ch == ':' || ch == '_'))
+ throw new IllegalCharsetNameException (name);
+ }
+ }
+
+ public static boolean isSupported (String charsetName)
+ {
+ return charsetForName (charsetName) != null;
+ }
+
+ public static Charset forName (String charsetName)
+ {
+ Charset cs = charsetForName (charsetName);
+ if (cs == null)
+ throw new UnsupportedCharsetException (charsetName);
+ return cs;
+ }
+
+ /**
+ * Retrieves a charset for the given charset name.
+ *
+ * @return A charset object for the charset with the specified name, or
+ * <code>null</code> if no such charset exists.
+ *
+ * @throws IllegalCharsetNameException if the name is illegal
+ */
+ private static Charset charsetForName (String charsetName)
+ {
+ checkName (charsetName);
+ return provider ().charsetForName (charsetName);
+ }
+
+ public static SortedMap availableCharsets ()
+ {
+ TreeMap charsets = new TreeMap (String.CASE_INSENSITIVE_ORDER);
+
+ for (Iterator i = provider ().charsets (); i.hasNext (); )
+ {
+ Charset cs = (Charset) i.next ();
+ charsets.put (cs.name (), cs);
+ }
+
+ return Collections.unmodifiableSortedMap (charsets);
+ }
+
+ // XXX: we need to support multiple providers, reading them from
+ // java.nio.charset.spi.CharsetProvider in the resource directory
+ // META-INF/services
+ private static final CharsetProvider provider ()
+ {
+ return Provider.provider ();
+ }
+
+ public final String name ()
+ {
+ return canonicalName;
+ }
+
+ public final Set aliases ()
+ {
+ if (aliases == null)
+ return Collections.EMPTY_SET;
+
+ // should we cache the aliasSet instead?
+ int n = aliases.length;
+ HashSet aliasSet = new HashSet (n);
+ for (int i = 0; i < n; ++i)
+ aliasSet.add (aliases[i]);
+ return Collections.unmodifiableSet (aliasSet);
+ }
+
+ public String displayName ()
+ {
+ return canonicalName;
+ }
+
+ public String displayName (Locale locale)
+ {
+ return canonicalName;
+ }
+
+ public final boolean isRegistered (String name)
+ {
+ return !name.startsWith ("x-") && !name.startsWith ("X-");
+ }
+
+ public abstract boolean contains (Charset cs);
+
+ public abstract CharsetDecoder newDecoder ();
+
+ public abstract CharsetEncoder newEncoder ();
+
+ public boolean canEncode ()
+ {
+ return true;
+ }
+
+ public final ByteBuffer encode (CharBuffer cb)
+ {
+ try
+ {
+ // NB: This implementation serializes different threads calling
+ // Charset.encode(), a potential performance problem. It might
+ // be better to remove the cache, or use ThreadLocal to cache on
+ // a per-thread basis.
+ synchronized (Charset.class)
+ {
+ if (cachedEncoder == null)
+ {
+ cachedEncoder = newEncoder ()
+ .onMalformedInput (CodingErrorAction.REPLACE)
+ .onUnmappableCharacter (CodingErrorAction.REPLACE);
+ }
+
+ return cachedEncoder.encode (cb);
+ }
+ }
+ catch (CharacterCodingException e)
+ {
+ throw new AssertionError (e);
+ }
+ }
+
+ public final ByteBuffer encode (String str)
+ {
+ return encode (CharBuffer.wrap (str));
+ }
+
+ public CharBuffer decode (ByteBuffer bb)
+ {
+ try
+ {
+ // NB: This implementation serializes different threads calling
+ // Charset.decode(), a potential performance problem. It might
+ // be better to remove the cache, or use ThreadLocal to cache on
+ // a per-thread basis.
+ synchronized (Charset.class)
+ {
+ if (cachedDecoder == null)
+ {
+ cachedDecoder = newDecoder ()
+ .onMalformedInput (CodingErrorAction.REPLACE)
+ .onUnmappableCharacter (CodingErrorAction.REPLACE);
+ }
+
+ return cachedDecoder.decode (bb);
+ }
+ }
+ catch (CharacterCodingException e)
+ {
+ throw new AssertionError (e);
+ }
+ }
+
+ public final int compareTo (Object ob)
+ {
+ return canonicalName.compareToIgnoreCase (((Charset) ob).canonicalName);
+ }
+
+ public final int hashCode ()
+ {
+ return canonicalName.hashCode ();
+ }
+
+ public final boolean equals (Object ob)
+ {
+ if (ob instanceof Charset)
+ return canonicalName.equalsIgnoreCase (((Charset) ob).canonicalName);
+ else
+ return false;
+ }
+
+ public final String toString ()
+ {
+ return canonicalName;
+ }
+}
diff --git a/libjava/java/nio/charset/CharsetDecoder.java b/libjava/java/nio/charset/CharsetDecoder.java
new file mode 100644
index 00000000000..185de149fd4
--- /dev/null
+++ b/libjava/java/nio/charset/CharsetDecoder.java
@@ -0,0 +1,312 @@
+/* CharsetDecoder.java --
+ Copyright (C) 2002 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 java.nio.charset;
+
+import java.nio.ByteBuffer;
+import java.nio.CharBuffer;
+
+/**
+ * @author Jesse Rosenstock
+ * @since 1.4
+ */
+public abstract class CharsetDecoder
+{
+ private static final int STATE_RESET = 0;
+ private static final int STATE_CODING = 1;
+ private static final int STATE_END = 2;
+ private static final int STATE_FLUSHED = 3;
+
+ private static final String DEFAULT_REPLACEMENT = "\uFFFD";
+
+ private final Charset charset;
+ private final float averageCharsPerByte;
+ private final float maxCharsPerByte;
+ private String replacement;
+
+ private int state = STATE_RESET;
+
+ private CodingErrorAction malformedInputAction
+ = CodingErrorAction.REPORT;
+ private CodingErrorAction unmappableCharacterAction
+ = CodingErrorAction.REPORT;
+
+ private CharsetDecoder (Charset cs, float averageCharsPerByte,
+ float maxCharsPerByte, String replacement)
+ {
+ if (averageCharsPerByte <= 0.0f)
+ throw new IllegalArgumentException ("Non-positive averageCharsPerByte");
+ if (maxCharsPerByte <= 0.0f)
+ throw new IllegalArgumentException ("Non-positive maxCharsPerByte");
+
+ this.charset = cs;
+ this.averageCharsPerByte
+ = averageCharsPerByte;
+ this.maxCharsPerByte
+ = maxCharsPerByte;
+ this.replacement = replacement;
+ implReplaceWith (replacement);
+ }
+
+ protected CharsetDecoder (Charset cs, float averageCharsPerByte,
+ float maxCharsPerByte)
+ {
+ this (cs, averageCharsPerByte, maxCharsPerByte, DEFAULT_REPLACEMENT);
+ }
+
+ public final float averageCharsPerByte ()
+ {
+ return averageCharsPerByte;
+ }
+
+ public final Charset charset ()
+ {
+ return charset;
+ }
+
+ public final CharBuffer decode (ByteBuffer in)
+ throws CharacterCodingException
+ {
+ // XXX: Sun's Javadoc seems to contradict itself saying an
+ // IllegalStateException is thrown "if a decoding operation is already
+ // in progress" and also that "it resets this Decoder".
+ // Should we check to see that the state is reset, or should we
+ // call reset()?
+ if (state != STATE_RESET)
+ throw new IllegalStateException ();
+
+ // REVIEW: Using max instead of average may allocate a very large
+ // buffer. Maybe we should do something more efficient?
+ int remaining = in.remaining ();
+ int n = (int) (remaining * maxCharsPerByte ());
+ CharBuffer out = CharBuffer.allocate (n);
+
+ if (remaining == 0)
+ {
+ state = STATE_FLUSHED;
+ return out;
+ }
+
+ CoderResult cr = decode (in, out, true);
+ if (cr.isError ())
+ cr.throwException ();
+
+ cr = flush (out);
+ if (cr.isError ())
+ cr.throwException ();
+
+ out.flip ();
+ return out;
+ }
+
+ public final CoderResult decode (ByteBuffer in, CharBuffer out,
+ boolean endOfInput)
+ {
+ int newState = endOfInput ? STATE_END : STATE_CODING;
+ // XXX: Need to check for "previous step was an invocation [not] of
+ // this method with a value of true for the endOfInput parameter but
+ // a return value indicating an incomplete decoding operation"
+ // XXX: We will not check the previous return value, just
+ // that the previous call passed true for endOfInput
+ if (state != STATE_RESET && state != STATE_CODING
+ && !(endOfInput && state == STATE_END))
+ throw new IllegalStateException ();
+ state = newState;
+
+ for (;;)
+ {
+ CoderResult cr;
+ try
+ {
+ cr = decodeLoop (in, out);
+ }
+ catch (RuntimeException e)
+ {
+ throw new CoderMalfunctionError (e);
+ }
+
+ if (cr.isOverflow ())
+ return cr;
+
+ if (cr.isUnderflow ())
+ {
+ if (endOfInput && in.hasRemaining ())
+ cr = CoderResult.malformedForLength (in.remaining ());
+ else
+ return cr;
+ }
+
+ CodingErrorAction action = cr.isMalformed ()
+ ? malformedInputAction
+ : unmappableCharacterAction;
+
+ if (action == CodingErrorAction.REPORT)
+ return cr;
+
+ if (action == CodingErrorAction.REPLACE)
+ {
+ if (out.remaining () < replacement.length ())
+ return CoderResult.OVERFLOW;
+ out.put (replacement);
+ }
+
+ in.position (in.position () + cr.length ());
+ }
+ }
+
+ protected abstract CoderResult decodeLoop (ByteBuffer in, CharBuffer out);
+
+ public Charset detectedCharset ()
+ {
+ throw new UnsupportedOperationException ();
+ }
+
+ public final CoderResult flush (CharBuffer out)
+ {
+ // It seems weird that you can flush after reset, but Sun's javadoc
+ // says an IllegalStateException is thrown "If the previous step of the
+ // current decoding operation was an invocation neither of the reset
+ // method nor ... of the three-argument decode method with a value of
+ // true for the endOfInput parameter."
+ // Further note that flush() only requires that there not be
+ // an IllegalStateException if the previous step was a call to
+ // decode with true as the last argument. It does not require
+ // that the call succeeded. decode() does require that it succeeded.
+ // XXX: test this to see if reality matches javadoc
+ if (state != STATE_RESET && state != STATE_END)
+ throw new IllegalStateException ();
+
+ state = STATE_FLUSHED;
+ return implFlush (out);
+ }
+
+ protected CoderResult implFlush (CharBuffer out)
+ {
+ return CoderResult.UNDERFLOW;
+ }
+
+ public final CharsetDecoder onMalformedInput (CodingErrorAction newAction)
+ {
+ if (newAction == null)
+ throw new IllegalArgumentException ("Null action");
+
+ malformedInputAction = newAction;
+ implOnMalformedInput (newAction);
+ return this;
+ }
+
+ protected void implOnMalformedInput (CodingErrorAction newAction)
+ {
+ // default implementation does nothing
+ }
+
+ protected void implOnUnmappableCharacter (CodingErrorAction newAction)
+ {
+ // default implementation does nothing
+ }
+
+ protected void implReplaceWith (String newReplacement)
+ {
+ // default implementation does nothing
+ }
+
+ protected void implReset ()
+ {
+ // default implementation does nothing
+ }
+
+ public boolean isAutoDetecting ()
+ {
+ return false;
+ }
+
+ public boolean isCharsetDetected ()
+ {
+ throw new UnsupportedOperationException ();
+ }
+
+ public CodingErrorAction malformedInputAction ()
+ {
+ return malformedInputAction;
+ }
+
+ public final float maxCharsPerByte ()
+ {
+ return maxCharsPerByte;
+ }
+
+ public final CharsetDecoder onUnmappableCharacter
+ (CodingErrorAction newAction)
+ {
+ if (newAction == null)
+ throw new IllegalArgumentException ("Null action");
+
+ unmappableCharacterAction = newAction;
+ implOnUnmappableCharacter (newAction);
+ return this;
+ }
+
+ public final String replacement ()
+ {
+ return replacement;
+ }
+
+ public final CharsetDecoder replaceWith (String newReplacement)
+ {
+ if (newReplacement == null)
+ throw new IllegalArgumentException ("Null replacement");
+ if (newReplacement.length () == 0)
+ throw new IllegalArgumentException ("Empty replacement");
+ // XXX: what about maxCharsPerByte?
+
+ this.replacement = newReplacement;
+ implReplaceWith (newReplacement);
+ return this;
+ }
+
+ public final CharsetDecoder reset ()
+ {
+ state = STATE_RESET;
+ implReset ();
+ return this;
+ }
+
+ public CodingErrorAction unmappableCharacterAction ()
+ {
+ return unmappableCharacterAction;
+ }
+}
diff --git a/libjava/java/nio/charset/CharsetEncoder.java b/libjava/java/nio/charset/CharsetEncoder.java
new file mode 100644
index 00000000000..dd434a79752
--- /dev/null
+++ b/libjava/java/nio/charset/CharsetEncoder.java
@@ -0,0 +1,360 @@
+/* CharsetEncoder.java --
+ Copyright (C) 2002 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 java.nio.charset;
+
+import java.nio.ByteBuffer;
+import java.nio.CharBuffer;
+
+/**
+ * @author Jesse Rosenstock
+ * @since 1.4
+ */
+public abstract class CharsetEncoder
+{
+ private static final int STATE_RESET = 0;
+ private static final int STATE_CODING = 1;
+ private static final int STATE_END = 2;
+ private static final int STATE_FLUSHED = 3;
+
+ private static final byte[] DEFAULT_REPLACEMENT = {(byte)'?'};
+
+ private final Charset charset;
+ private final float averageBytesPerChar;
+ private final float maxBytesPerChar;
+ private byte[] replacement;
+
+ private int state = STATE_RESET;
+
+ private CodingErrorAction malformedInputAction
+ = CodingErrorAction.REPORT;
+ private CodingErrorAction unmappableCharacterAction
+ = CodingErrorAction.REPORT;
+
+ protected CharsetEncoder (Charset cs, float averageBytesPerChar,
+ float maxBytesPerChar)
+ {
+ this (cs, averageBytesPerChar, maxBytesPerChar, DEFAULT_REPLACEMENT);
+ }
+
+ protected CharsetEncoder (Charset cs, float averageBytesPerChar,
+ float maxBytesPerChar, byte[] replacement)
+ {
+ if (averageBytesPerChar <= 0.0f)
+ throw new IllegalArgumentException ("Non-positive averageBytesPerChar");
+ if (maxBytesPerChar <= 0.0f)
+ throw new IllegalArgumentException ("Non-positive maxBytesPerChar");
+
+ this.charset = cs;
+ this.averageBytesPerChar
+ = averageBytesPerChar;
+ this.maxBytesPerChar
+ = maxBytesPerChar;
+ this.replacement = replacement;
+ implReplaceWith (replacement);
+ }
+
+ public final float averageBytesPerChar ()
+ {
+ return averageBytesPerChar;
+ }
+
+ public boolean canEncode (char c)
+ {
+ CharBuffer cb = CharBuffer.allocate (1).put (c);
+ cb.flip ();
+ return canEncode (cb);
+ }
+
+ public boolean canEncode (CharSequence cs)
+ {
+ CharBuffer cb;
+ if (cs instanceof CharBuffer)
+ cb = ((CharBuffer) cs).duplicate ();
+ else
+ cb = CharBuffer.wrap (cs);
+ return canEncode (cb);
+ }
+
+ private boolean canEncode (CharBuffer cb)
+ {
+ // It is an error if a coding operation is "in progress"
+ // I take that to mean the state is not reset or flushed.
+ // XXX: check "in progress" everywhere
+ if (state == STATE_FLUSHED)
+ reset ();
+ else if (state != STATE_RESET)
+ throw new IllegalStateException ();
+
+ CodingErrorAction oldMalformedInputAction = malformedInputAction;
+ CodingErrorAction oldUnmappableCharacterAction
+ = unmappableCharacterAction;
+
+ try
+ {
+ if (oldMalformedInputAction != CodingErrorAction.REPORT)
+ onMalformedInput (CodingErrorAction.REPORT);
+ if (oldUnmappableCharacterAction != CodingErrorAction.REPORT)
+ onUnmappableCharacter (CodingErrorAction.REPORT);
+ }
+ catch (Exception e)
+ {
+ return false;
+ }
+ finally
+ {
+ if (oldMalformedInputAction != CodingErrorAction.REPORT)
+ onMalformedInput (oldMalformedInputAction);
+ if (oldUnmappableCharacterAction != CodingErrorAction.REPORT)
+ onUnmappableCharacter (oldUnmappableCharacterAction);
+ }
+
+ return true;
+ }
+
+ public final Charset charset ()
+ {
+ return charset;
+ }
+
+ public final ByteBuffer encode (CharBuffer in)
+ throws CharacterCodingException
+ {
+ // XXX: Sun's Javadoc seems to contradict itself saying an
+ // IllegalStateException is thrown "if a decoding operation is already
+ // in progress" and also that "it resets this Encoder".
+ // Should we check to see that the state is reset, or should we
+ // call reset()?
+ if (state != STATE_RESET)
+ throw new IllegalStateException ();
+
+ // REVIEW: Using max instead of average may allocate a very large
+ // buffer. Maybe we should do something more efficient?
+ int remaining = in.remaining ();
+ int n = (int) (remaining * maxBytesPerChar ());
+ ByteBuffer out = ByteBuffer.allocate (n);
+
+ if (remaining == 0)
+ {
+ state = STATE_FLUSHED;
+ return out;
+ }
+
+ CoderResult cr = encode (in, out, true);
+ if (cr.isError ())
+ cr.throwException ();
+
+ cr = flush (out);
+ if (cr.isError ())
+ cr.throwException ();
+
+ out.flip ();
+ return out;
+ }
+
+ public final CoderResult encode (CharBuffer in, ByteBuffer out,
+ boolean endOfInput)
+ {
+ int newState = endOfInput ? STATE_END : STATE_CODING;
+ // XXX: Need to check for "previous step was an invocation [not] of
+ // this method with a value of true for the endOfInput parameter but
+ // a return value indicating an incomplete decoding operation"
+ // XXX: We will not check the previous return value, just
+ // that the previous call passed true for endOfInput
+ if (state != STATE_RESET && state != STATE_CODING
+ && !(endOfInput && state == STATE_END))
+ throw new IllegalStateException ();
+ state = newState;
+
+ for (;;)
+ {
+ CoderResult cr;
+ try
+ {
+ cr = encodeLoop (in, out);
+ }
+ catch (RuntimeException e)
+ {
+ throw new CoderMalfunctionError (e);
+ }
+
+ if (cr.isOverflow ())
+ return cr;
+
+ if (cr.isUnderflow ())
+ {
+ if (endOfInput && in.hasRemaining ())
+ cr = CoderResult.malformedForLength (in.remaining ());
+ else
+ return cr;
+ }
+
+ CodingErrorAction action = cr.isMalformed ()
+ ? malformedInputAction
+ : unmappableCharacterAction;
+
+ if (action == CodingErrorAction.REPORT)
+ return cr;
+
+ if (action == CodingErrorAction.REPLACE)
+ {
+ if (out.remaining () < replacement.length)
+ return CoderResult.OVERFLOW;
+ out.put (replacement);
+ }
+
+ in.position (in.position () + cr.length ());
+ }
+ }
+
+ protected abstract CoderResult encodeLoop (CharBuffer in, ByteBuffer out);
+
+ public final CoderResult flush (ByteBuffer out)
+ {
+ // It seems weird that you can flush after reset, but Sun's javadoc
+ // says an IllegalStateException is thrown "If the previous step of the
+ // current decoding operation was an invocation neither of the reset
+ // method nor ... of the three-argument encode method with a value of
+ // true for the endOfInput parameter."
+ // Further note that flush() only requires that there not be
+ // an IllegalStateException if the previous step was a call to
+ // encode with true as the last argument. It does not require
+ // that the call succeeded. encode() does require that it succeeded.
+ // XXX: test this to see if reality matches javadoc
+ if (state != STATE_RESET && state != STATE_END)
+ throw new IllegalStateException ();
+
+ state = STATE_FLUSHED;
+ return implFlush (out);
+ }
+
+ protected CoderResult implFlush (ByteBuffer out)
+ {
+ return CoderResult.UNDERFLOW;
+ }
+
+ protected void implOnMalformedInput (CodingErrorAction newAction)
+ {
+ // default implementation does nothing
+ }
+
+ protected void implOnUnmappableCharacter (CodingErrorAction newAction)
+ {
+ // default implementation does nothing
+ }
+
+ protected void implReplaceWith (byte[] newReplacement)
+ {
+ // default implementation does nothing
+ }
+
+ protected void implReset ()
+ {
+ // default implementation does nothing
+ }
+
+ public boolean isLegalReplacement (byte[] replacement)
+ {
+ // TODO: cache the decoder
+ // error actions will be REPORT after construction
+ CharsetDecoder decoder = charset.newDecoder ();
+ ByteBuffer bb = ByteBuffer.wrap (replacement);
+ CharBuffer cb
+ = CharBuffer.allocate ((int) (replacement.length
+ * decoder.maxCharsPerByte ()));
+ return !decoder.decode (bb, cb, true).isError ();
+ }
+
+ public CodingErrorAction malformedInputAction ()
+ {
+ return malformedInputAction;
+ }
+
+ public final float maxBytesPerChar ()
+ {
+ return maxBytesPerChar;
+ }
+
+ public final CharsetEncoder onMalformedInput (CodingErrorAction newAction)
+ {
+ if (newAction == null)
+ throw new IllegalArgumentException ("Null action");
+
+ malformedInputAction = newAction;
+ implOnMalformedInput (newAction);
+ return this;
+ }
+
+ public final CharsetEncoder onUnmappableCharacter
+ (CodingErrorAction newAction)
+ {
+ if (newAction == null)
+ throw new IllegalArgumentException ("Null action");
+
+ unmappableCharacterAction = newAction;
+ implOnUnmappableCharacter (newAction);
+ return this;
+ }
+
+ public final byte[] replacement ()
+ {
+ return replacement;
+ }
+
+ public final CharsetEncoder replaceWith (byte[] newReplacement)
+ {
+ if (newReplacement == null)
+ throw new IllegalArgumentException ("Null replacement");
+ if (newReplacement.length == 0)
+ throw new IllegalArgumentException ("Empty replacement");
+ // XXX: what about maxBytesPerChar?
+
+ if (!isLegalReplacement (newReplacement))
+ throw new IllegalArgumentException ("Illegal replacement");
+
+ this.replacement = newReplacement;
+ implReplaceWith (newReplacement);
+ return this;
+ }
+
+ public final CharsetEncoder reset ()
+ {
+ state = STATE_RESET;
+ implReset ();
+ return this;
+ }
+}
diff --git a/libjava/java/nio/charset/CoderMalfunctionError.java b/libjava/java/nio/charset/CoderMalfunctionError.java
new file mode 100644
index 00000000000..df57b820a21
--- /dev/null
+++ b/libjava/java/nio/charset/CoderMalfunctionError.java
@@ -0,0 +1,52 @@
+/* CoderMalfunctionError.java --
+ Copyright (C) 2002 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 java.nio.charset;
+
+/**
+ * @since 1.4
+ */
+public class CoderMalfunctionError extends Error
+{
+ /**
+ * Creates the error
+ */
+ public CoderMalfunctionError(Exception cause)
+ {
+ super (cause);
+ }
+}
diff --git a/libjava/java/nio/charset/CoderResult.java b/libjava/java/nio/charset/CoderResult.java
new file mode 100644
index 00000000000..49c66637c79
--- /dev/null
+++ b/libjava/java/nio/charset/CoderResult.java
@@ -0,0 +1,193 @@
+/* CoderResult.java --
+ Copyright (C) 2002 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 java.nio.charset;
+
+import java.lang.ref.WeakReference;
+import java.nio.BufferOverflowException;
+import java.nio.BufferUnderflowException;
+import java.util.HashMap;
+
+/**
+ * @author Jesse Rosenstock
+ * @since 1.4
+ */
+public class CoderResult
+{
+ private static final int TYPE_MALFORMED = 0;
+ private static final int TYPE_OVERFLOW = 1;
+ private static final int TYPE_UNDERFLOW = 2;
+ private static final int TYPE_UNMAPPABLE = 3;
+
+ public static final CoderResult OVERFLOW
+ = new CoderResult (TYPE_OVERFLOW, 0);
+ public static final CoderResult UNDERFLOW
+ = new CoderResult (TYPE_UNDERFLOW, 0);
+
+ private static final String[] names
+ = { "MALFORMED", "OVERFLOW", "UNDERFLOW", "UNMAPPABLE" };
+
+ private static final Cache malformedCache
+ = new Cache ()
+ {
+ protected CoderResult make (int length)
+ {
+ return new CoderResult (TYPE_MALFORMED, length);
+ }
+ };
+
+ private static final Cache unmappableCache
+ = new Cache ()
+ {
+ protected CoderResult make (int length)
+ {
+ return new CoderResult (TYPE_UNMAPPABLE, length);
+ }
+ };
+
+ private final int type;
+ private final int length;
+
+ private CoderResult (int type, int length)
+ {
+ this.type = type;
+ this.length = length;
+ }
+
+ public boolean isError ()
+ {
+ return length > 0;
+ }
+
+ public boolean isMalformed ()
+ {
+ return type == TYPE_MALFORMED;
+ }
+
+ public boolean isOverflow ()
+ {
+ return type == TYPE_OVERFLOW;
+ }
+
+ public boolean isUnderflow ()
+ {
+ return type == TYPE_UNDERFLOW;
+ }
+
+ public boolean isUnmappable ()
+ {
+ return type == TYPE_UNMAPPABLE;
+ }
+
+ public int length ()
+ {
+ if (length <= 0)
+ throw new UnsupportedOperationException ();
+ else
+ return length;
+ }
+
+ public static CoderResult malformedForLength (int length)
+ {
+ return malformedCache.get (length);
+ }
+
+ public void throwException ()
+ throws CharacterCodingException
+ {
+ switch (type)
+ {
+ case TYPE_MALFORMED:
+ throw new MalformedInputException (length);
+ case TYPE_OVERFLOW:
+ throw new BufferOverflowException ();
+ case TYPE_UNDERFLOW:
+ throw new BufferUnderflowException ();
+ case TYPE_UNMAPPABLE:
+ throw new UnmappableCharacterException (length);
+ }
+ }
+
+ public String toString ()
+ {
+ String name = names[type];
+ return (length > 0) ? name + '[' + length + ']' : name;
+ }
+
+ public static CoderResult unmappableForLength (int length)
+ {
+ return unmappableCache.get (length);
+ }
+
+ private abstract static class Cache
+ {
+ private final HashMap cache;
+
+ private Cache ()
+ {
+ // If we didn't synchronize on this, then cache would be initialized
+ // without holding a lock. Undefined behavior would occur if the
+ // first thread to call get(int) was not the same as the one that
+ // called the constructor.
+ synchronized (this)
+ {
+ cache = new HashMap ();
+ }
+ }
+
+ private synchronized CoderResult get (int length)
+ {
+ if (length <= 0)
+ throw new IllegalArgumentException ("Non-positive length");
+
+ Integer len = new Integer (length);
+ CoderResult cr = null;
+ Object o;
+ if ((o = cache.get (len)) != null)
+ cr = (CoderResult) ((WeakReference) o).get ();
+ if (cr == null)
+ {
+ cr = make (length);
+ cache.put (len, new WeakReference (cr));
+ }
+
+ return cr;
+ }
+
+ protected abstract CoderResult make (int length);
+ }
+}
diff --git a/libjava/java/nio/charset/CodingErrorAction.java b/libjava/java/nio/charset/CodingErrorAction.java
new file mode 100644
index 00000000000..1a2e317c7c2
--- /dev/null
+++ b/libjava/java/nio/charset/CodingErrorAction.java
@@ -0,0 +1,66 @@
+/* CodingErrorAction.java --
+ Copyright (C) 2002 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 java.nio.charset;
+
+public class CodingErrorAction
+{
+ public static final CodingErrorAction IGNORE
+ = new CodingErrorAction("ignore");
+ public static final CodingErrorAction REPLACE
+ = new CodingErrorAction("replace");
+ public static final CodingErrorAction REPORT
+ = new CodingErrorAction("report");
+
+ private final String name;
+
+ /**
+ * Private constructor only used to create the constant CodingErrorActions.
+ */
+ private CodingErrorAction(String name)
+ {
+ this.name = name;
+ }
+
+ /**
+ * Returns the name of the CodingErrorAction.
+ */
+ public String toString ()
+ {
+ return name;
+ }
+}
diff --git a/libjava/java/nio/charset/IllegalCharsetNameException.java b/libjava/java/nio/charset/IllegalCharsetNameException.java
new file mode 100644
index 00000000000..762eb687fbf
--- /dev/null
+++ b/libjava/java/nio/charset/IllegalCharsetNameException.java
@@ -0,0 +1,60 @@
+/* IllegalCharsetNameException.java --
+ Copyright (C) 2002 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 java.nio.charset;
+
+/**
+ * @since 1.4
+ */
+public class IllegalCharsetNameException extends IllegalArgumentException
+{
+ /**
+ * Creates the exception
+ */
+ public IllegalCharsetNameException (String charsetName)
+ {
+ super (charsetName);
+ }
+
+ /**
+ * Retrieves the illegal charset name
+ */
+ public String getCharsetName ()
+ {
+ return getMessage ();
+ }
+}
diff --git a/libjava/java/nio/charset/MalformedInputException.java b/libjava/java/nio/charset/MalformedInputException.java
new file mode 100644
index 00000000000..692eed60f94
--- /dev/null
+++ b/libjava/java/nio/charset/MalformedInputException.java
@@ -0,0 +1,71 @@
+/* MalformedInputException.java --
+ Copyright (C) 2002 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 java.nio.charset;
+
+/**
+ * @since 1.4
+ */
+public class MalformedInputException extends CharacterCodingException
+{
+ private int inputLength;
+
+ /**
+ * Creates the exception
+ */
+ public MalformedInputException (int inputLength)
+ {
+ super ();
+ this.inputLength = inputLength;
+ }
+
+ /**
+ * Retrieves the illegal charset name
+ */
+ public int getInputLength ()
+ {
+ return inputLength;
+ }
+
+ /**
+ * Returns the detail message string of this throwable
+ */
+ public String getMessage ()
+ {
+ return "Input length = " + inputLength;
+ }
+}
diff --git a/libjava/java/nio/charset/UnmappableCharacterException.java b/libjava/java/nio/charset/UnmappableCharacterException.java
new file mode 100644
index 00000000000..5ae49302d06
--- /dev/null
+++ b/libjava/java/nio/charset/UnmappableCharacterException.java
@@ -0,0 +1,71 @@
+/* UnmappableCharacterException.java --
+ Copyright (C) 2002 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 java.nio.charset;
+
+/**
+ * @since 1.4
+ */
+public class UnmappableCharacterException extends CharacterCodingException
+{
+ private int inputLength;
+
+ /**
+ * Creates the exception
+ */
+ public UnmappableCharacterException (int inputLength)
+ {
+ super ();
+ this.inputLength = inputLength;
+ }
+
+ /**
+ * Retrieves the illegal charset name
+ */
+ public int getInputLength ()
+ {
+ return inputLength;
+ }
+
+ /**
+ * Returns the detail message string of this throwable
+ */
+ public String getMessage ()
+ {
+ return "Input length = " + inputLength;
+ }
+}
diff --git a/libjava/java/nio/charset/UnsupportedCharsetException.java b/libjava/java/nio/charset/UnsupportedCharsetException.java
new file mode 100644
index 00000000000..13aaa520524
--- /dev/null
+++ b/libjava/java/nio/charset/UnsupportedCharsetException.java
@@ -0,0 +1,60 @@
+/* UnsupportedCharsetException.java --
+ Copyright (C) 2002 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 java.nio.charset;
+
+/**
+ * @since 1.4
+ */
+public class UnsupportedCharsetException extends IllegalArgumentException
+{
+ /**
+ * Creates the exception
+ */
+ public UnsupportedCharsetException (String charsetName)
+ {
+ super (charsetName);
+ }
+
+ /**
+ * Retrieves the illegal charset name
+ */
+ public String getCharsetName ()
+ {
+ return getMessage ();
+ }
+}
diff --git a/libjava/java/nio/charset/spi/CharsetProvider.java b/libjava/java/nio/charset/spi/CharsetProvider.java
new file mode 100644
index 00000000000..32346a0457c
--- /dev/null
+++ b/libjava/java/nio/charset/spi/CharsetProvider.java
@@ -0,0 +1,88 @@
+/* CharsetProvider.java -- charset service provider interface
+ Copyright (C) 2002 Free Software Foundation
+
+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 java.nio.charset.spi;
+
+import java.nio.charset.Charset;
+import java.util.Iterator;
+
+/**
+ * This class allows an implementor to provide additional character sets. The
+ * subclass must have a nullary constructor, and be attached to charset
+ * implementation classes. These extensions are loaded via the context class
+ * loader. To provide the charset extension, all files named
+ * <code>META-INF/services/java.nio.charset.spi.CharsetProvider</code> are
+ * read from the classpath. Each one should be a UTF-8 encoded list of
+ * fully-qualified names of concrete subclasses of this class; whitespace is
+ * ignored, and '#' starts comments. Duplicates are ignored. The
+ * implementations must be accessible to the classloader that requests them.
+ *
+ * @author Eric Blake <ebb9@email.byu.edu>
+ * @see Charset
+ * @since 1.4
+ * @status updated to 1.4
+ */
+public abstract class CharsetProvider
+{
+ /**
+ * Initialize a new charset provider. This performs a security check on
+ * RuntimePermission("charsetProvider").
+ *
+ * @throws SecurityException if building a new set is not allowed
+ */
+ protected CharsetProvider()
+ {
+ SecurityManager s = System.getSecurityManager();
+ if (s != null)
+ s.checkPermission(new RuntimePermission("charsetProvider"));
+ }
+
+ /**
+ * Returns an iterator over the charsets defined by this provider.
+ *
+ * @return the iterator
+ * @see Charset#availableCharsets()
+ */
+ public abstract Iterator charsets();
+
+ /**
+ * Returns the named charset, by canonical name or alias.
+ *
+ * @return the charset, or null if not supported
+ */
+ public abstract Charset charsetForName(String name);
+} // class CharsetProvider
diff --git a/libjava/java/rmi/MarshalledObject.java b/libjava/java/rmi/MarshalledObject.java
index eaa7fb534b4..9f966b9d9dc 100644
--- a/libjava/java/rmi/MarshalledObject.java
+++ b/libjava/java/rmi/MarshalledObject.java
@@ -38,24 +38,77 @@ exception statement from your version. */
package java.rmi;
import java.io.Serializable;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import gnu.java.rmi.RMIMarshalledObjectInputStream;
+import gnu.java.rmi.RMIMarshalledObjectOutputStream;
+/**
+ * FIXME - doc missing
+ */
public final class MarshalledObject
- extends Object implements Serializable {
+ extends Object implements Serializable
+{
+
+ //The following fields are from Java API Documentation "Serialized form"
+ private static final long serialVersionUID = 8988374069173025854L;
+ byte[] objBytes;
+ byte[] locBytes;
+ int hash;
+
+ public MarshalledObject(Object obj) throws java.io.IOException
+ {
+ ByteArrayOutputStream objStream = new ByteArrayOutputStream();
+ RMIMarshalledObjectOutputStream stream = new RMIMarshalledObjectOutputStream(objStream);
+ stream.writeObject(obj);
+ stream.flush();
+ objBytes = objStream.toByteArray();
+ locBytes = stream.getLocBytes();
+
+ //The following algorithm of calculating hashCode is similar to String
+ hash = 0;
+ for (int i = 0; i < objBytes.length; i++)
+ hash = hash * 31 + objBytes[i];
+ if(locBytes != null)
+ for (int i = 0; i < locBytes.length; i++)
+ hash = hash * 31 + locBytes[i];
+ }
+
+ public boolean equals(Object obj)
+ {
+ if(obj == null || !(obj instanceof MarshalledObject) )
+ return false;
-public MarshalledObject(Object obj) {
- throw new Error("Not implemented");
+ // hashCode even differs, don't do the time-consuming comparisons
+ if (obj.hashCode() != hash)
+ return false;
+
+ MarshalledObject aobj = (MarshalledObject)obj;
+ if (objBytes == null || aobj.objBytes == null)
+ return objBytes == aobj.objBytes;
+ if (objBytes.length != aobj.objBytes.length)
+ return false;
+ for (int i = 0; i < objBytes.length; i++)
+ {
+ if (objBytes[i] != aobj.objBytes[i])
+ return false;
+ }
+ // Ignore comparison of locBytes(annotation)
+ return true;
+ }
+
+public Object get()
+ throws java.io.IOException, java.lang.ClassNotFoundException
+{
+ if(objBytes == null)
+ return null;
+ RMIMarshalledObjectInputStream stream =
+ new RMIMarshalledObjectInputStream(objBytes, locBytes);
+ return stream.readObject();
}
-
-public boolean equals(Object obj) {
- throw new Error("Not implemented");
-}
-
-public Object get() {
- throw new Error("Not implemented");
-}
-
-public int hashCode() {
- throw new Error("Not implemented");
-}
-
+
+ public int hashCode() {
+ return hash;
+ }
+
}
diff --git a/libjava/java/rmi/activation/ActivationDesc.java b/libjava/java/rmi/activation/ActivationDesc.java
index 0e4216a82cb..b0f22aae760 100644
--- a/libjava/java/rmi/activation/ActivationDesc.java
+++ b/libjava/java/rmi/activation/ActivationDesc.java
@@ -40,8 +40,9 @@ package java.rmi.activation;
import java.io.Serializable;
import java.rmi.MarshalledObject;
-public final class ActivationDesc
- implements Serializable {
+public final class ActivationDesc implements Serializable
+{
+ static final long serialVersionUID = 7455834104417690957L;
private ActivationGroupID groupid;
private String classname;
diff --git a/libjava/java/rmi/activation/ActivationGroupDesc.java b/libjava/java/rmi/activation/ActivationGroupDesc.java
index da61fccc9dd..1c627e4d7b0 100644
--- a/libjava/java/rmi/activation/ActivationGroupDesc.java
+++ b/libjava/java/rmi/activation/ActivationGroupDesc.java
@@ -41,8 +41,9 @@ import java.io.Serializable;
import java.util.Properties;
import java.rmi.MarshalledObject;
-public final class ActivationGroupDesc
- implements Serializable {
+public final class ActivationGroupDesc implements Serializable
+{
+ static final long serialVersionUID = -4936225423168276595L;
public static class CommandEnvironment
implements Serializable {
diff --git a/libjava/java/rmi/activation/ActivationGroupID.java b/libjava/java/rmi/activation/ActivationGroupID.java
index 9ce81609ff4..9fff53bb706 100644
--- a/libjava/java/rmi/activation/ActivationGroupID.java
+++ b/libjava/java/rmi/activation/ActivationGroupID.java
@@ -39,8 +39,9 @@ package java.rmi.activation;
import java.io.Serializable;
-public class ActivationGroupID
- implements Serializable {
+public class ActivationGroupID implements Serializable
+{
+ static final long serialVersionUID = -1648432278909740833L;
private ActivationSystem system;
diff --git a/libjava/java/rmi/activation/ActivationID.java b/libjava/java/rmi/activation/ActivationID.java
index 4f1951ef3d4..62bd7763b42 100644
--- a/libjava/java/rmi/activation/ActivationID.java
+++ b/libjava/java/rmi/activation/ActivationID.java
@@ -41,8 +41,9 @@ import java.io.Serializable;
import java.rmi.Remote;
import java.rmi.RemoteException;
-public class ActivationID
- implements Serializable {
+public class ActivationID implements Serializable
+{
+ static final long serialVersionUID = -4608673054848209235L;
private Activator activator;
diff --git a/libjava/java/rmi/server/LogStream.java b/libjava/java/rmi/server/LogStream.java
index 8ba169f83b8..ffbd3f67e71 100644
--- a/libjava/java/rmi/server/LogStream.java
+++ b/libjava/java/rmi/server/LogStream.java
@@ -45,8 +45,8 @@ public class LogStream
extends PrintStream {
public static final int SILENT = 0;
-public static final int BRIEF = 1;
-public static final int VERBOSE = 2;
+public static final int BRIEF = 10;
+public static final int VERBOSE = 20;
private static PrintStream defStream;
diff --git a/libjava/java/rmi/server/RMIClassLoader.java b/libjava/java/rmi/server/RMIClassLoader.java
index cde97b0452e..1b00970e441 100644
--- a/libjava/java/rmi/server/RMIClassLoader.java
+++ b/libjava/java/rmi/server/RMIClassLoader.java
@@ -39,81 +39,177 @@ package java.rmi.server;
import java.net.URL;
import java.net.URLConnection;
+import java.net.URLClassLoader;
import java.io.IOException;
import java.io.DataInputStream;
import java.net.MalformedURLException;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Hashtable;
+import java.util.Map;
import java.util.StringTokenizer;
+import java.util.WeakHashMap;
public class RMIClassLoader
{
- static private class MyClassLoader extends ClassLoader
+ static private class MyClassLoader extends URLClassLoader
{
- /**
- * Non-private constructor to reduce bytecode emitted.
- */
- MyClassLoader()
+
+ private MyClassLoader(URL[] urls, ClassLoader parent, String annotation)
{
+ super(urls, parent);
+ this.annotation = annotation;
}
- Class defineClass(String name, byte[] data)
+ private MyClassLoader(URL[] urls, ClassLoader parent)
{
- return defineClass(name, data, 0, data.length);
+ super (urls, parent);
+ this.annotation = urlToAnnotation(urls);
+ }
+
+ public static String urlToAnnotation(URL[] urls)
+ {
+ if (urls.length == 0)
+ return null;
+
+ StringBuffer annotation = new StringBuffer(64*urls.length);
+ for(int i = 0; i < urls.length; i++)
+ {
+ annotation.append(urls[i].toExternalForm());
+ annotation.append(' ');
+ }
+
+ return annotation.toString();
+ }
+
+ public final String getClassAnnotation(){
+ return annotation;
}
- }
- static private MyClassLoader loader = new MyClassLoader();
+ private final String annotation;
+ }
+
+ private static Map cacheLoaders; //map annotations to loaders
+ private static Map cacheAnnotations; //map loaders to annotations
+
+ //defaultAnnotation is got from system property
+ // "java.rmi.server.defaultAnnotation"
+ private static String defaultAnnotation;
+ //URL object for defaultAnnotation
+ private static URL defaultCodebase;
+ //class loader for defaultAnnotation
+ private static MyClassLoader defaultLoader;
+
+ static
+ {
+ // 89 is a nice prime number for Hashtable initial capacity
+ cacheLoaders = new Hashtable(89);
+ cacheAnnotations = new Hashtable(89);
+
+ defaultAnnotation = System.getProperty("java.rmi.server.defaultAnnotation");
+ try
+ {
+ if (defaultAnnotation != null)
+ defaultCodebase = new URL(defaultAnnotation);
+ }
+ catch(Exception _)
+ {
+ defaultCodebase = null;
+ }
+ if (defaultCodebase != null)
+ {
+ defaultLoader = new MyClassLoader(new URL[]{ defaultCodebase },
+ null, defaultAnnotation);
+ cacheLoaders.put(defaultAnnotation, defaultLoader);
+ }
+ }
+
/**
* @deprecated
*/
public static Class loadClass(String name)
throws MalformedURLException, ClassNotFoundException
{
- return loadClass(System.getProperty("java.rmi.server.codebase"), name);
+ return (loadClass("", name));
}
- public static Class loadClass(URL codebase, String name)
- throws MalformedURLException, ClassNotFoundException
+ public static Class loadClass(String codebases, String name)
+ throws MalformedURLException, ClassNotFoundException
{
- URL u = new URL(codebase, name + ".class");
- try
+ Class c = null;
+ ClassLoader loader = Thread.currentThread().getContextClassLoader();
+ //try context class loader first
+ try
{
- URLConnection conn = u.openConnection();
- DataInputStream strm = new DataInputStream(conn.getInputStream());
- byte data[] = new byte[conn.getContentLength()];
- strm.readFully(data);
- return loader.defineClass(name, data);
+ c = loader.loadClass(name);
}
- catch (IOException _)
- {
- throw new ClassNotFoundException(name);
- }
- }
+ catch(ClassNotFoundException e) {}
- public static Class loadClass(String codebase, String name)
- throws MalformedURLException, ClassNotFoundException
- {
- StringTokenizer tok = new StringTokenizer(codebase, ":");
- while (tok.hasMoreTokens())
+ if (c != null)
+ return c;
+
+ if (codebases.length() == 0) //==""
+ loader = defaultLoader;
+ else
{
- try
- {
- return loadClass(new URL(tok.nextToken()), name);
- }
- catch (ClassNotFoundException _)
- {
- // Ignore - try the next one.
- }
+ loader = (ClassLoader)cacheLoaders.get(codebases);
+ if (loader == null)
+ {
+ //create an entry in cacheLoaders mapping a loader to codebases.
+
+ // codebases are separated by " "
+ StringTokenizer tok = new StringTokenizer(codebases, " ");
+ ArrayList urls = new ArrayList();
+ while (tok.hasMoreTokens())
+ urls.add(new URL(tok.nextToken()));
+
+ loader = new MyClassLoader((URL[])urls.toArray(new URL[urls.size()]),
+ null, codebases);
+ cacheLoaders.put(codebases, loader);
+ }
}
- throw new ClassNotFoundException(name);
- }
+ return loader != null ? loader.loadClass(name) : Class.forName(name);
+ }
+
public static String getClassAnnotation(Class cl)
{
- return null; // We don't yet do this.
+ ClassLoader loader = cl.getClassLoader();
+ if (loader == null || loader == ClassLoader.getSystemClassLoader())
+ {
+ return null; //??
+ }
+
+ if (loader instanceof MyClassLoader)
+ {
+ return ((MyClassLoader)loader).getClassAnnotation();
+ }
+
+ String s = (String)cacheAnnotations.get(loader);
+ if (s != null)
+ return s;
+
+ if (loader instanceof URLClassLoader)
+ {
+ URL[] urls = ((URLClassLoader)loader).getURLs();
+ if(urls.length == 0)
+ return null;
+
+ StringBuffer annotation = new StringBuffer(64*urls.length);
+ for(int i = 0; i < urls.length; i++)
+ {
+ annotation.append(urls[i].toExternalForm());
+ annotation.append(' ');
+ }
+ s = annotation.toString();
+ cacheAnnotations.put(loader, s);
+ }
+ return null;
}
-
+
/**
* @deprecated
*/
diff --git a/libjava/java/rmi/server/RemoteObject.java b/libjava/java/rmi/server/RemoteObject.java
index e73dfc523df..a1febf2dd62 100644
--- a/libjava/java/rmi/server/RemoteObject.java
+++ b/libjava/java/rmi/server/RemoteObject.java
@@ -48,6 +48,7 @@ import java.io.IOException;
import java.lang.ClassNotFoundException;
import java.lang.InstantiationException;
import java.lang.IllegalAccessException;
+import java.lang.reflect.Constructor;
public abstract class RemoteObject
implements Remote, Serializable {
@@ -68,9 +69,22 @@ public RemoteRef getRef() {
return (ref);
}
-public static Remote toStub(Remote obj) throws NoSuchObjectException {
- throw new Error("Not implemented");
-}
+ public static Remote toStub(Remote obj) throws NoSuchObjectException
+ {
+ Class cls = obj.getClass();
+ String classname = cls.getName();
+ ClassLoader cl = cls.getClassLoader();
+ try
+ {
+ Class scls = cl.loadClass(classname + "_Stub");
+ // JDK 1.2 stubs
+ Class[] stubprototype = new Class[] { RemoteRef.class };
+ Constructor con = scls.getConstructor(stubprototype);
+ return (Remote)(con.newInstance(new Object[]{obj}));
+ }
+ catch (Exception e) {}
+ throw new NoSuchObjectException(obj.getClass().getName());
+ }
public int hashCode() {
if (ref == null) {
@@ -86,30 +100,46 @@ public boolean equals(Object obj) {
return (this == obj);
}
-public String toString() {
- return (ref.toString());
-}
-
-private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
- String cname = in.readUTF();
- if (!cname.equals("")) {
- cname = RemoteRef.packagePrefix + '.' + cname;
- try {
- Class cls = Class.forName(cname);
- ref = (RemoteRef)cls.newInstance();
- }
- catch (InstantiationException e1) {
- throw new UnmarshalException("failed to create ref");
- }
- catch (IllegalAccessException e2) {
- throw new UnmarshalException("failed to create ref");
- }
- ref.readExternal(in);
- }
- else {
- ref = (RemoteRef)in.readObject();
- }
-}
+ public String toString()
+ {
+ if (ref == null)
+ return getClass ().toString ();
+ return (ref.toString ());
+ }
+
+ private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException
+ {
+ String cname = in.readUTF();
+ if (!cname.equals(""))
+ {
+ if (cname.equals ("UnicastRef2"))
+ {
+ // hack for interoperating with JDK
+ cname = "UnicastRef";
+ in.read (); //some unknown UnicastRef2 field
+ }
+
+ cname = RemoteRef.packagePrefix + '.' + cname;
+ try
+ {
+ Class cls = Class.forName(cname);
+ ref = (RemoteRef)cls.newInstance();
+ }
+ catch (InstantiationException e1)
+ {
+ throw new UnmarshalException("failed to create ref", e1);
+ }
+ catch (IllegalAccessException e2)
+ {
+ throw new UnmarshalException("failed to create ref", e2);
+ }
+ ref.readExternal(in);
+ }
+ else
+ {
+ ref = (RemoteRef)in.readObject();
+ }
+ }
private void writeObject(ObjectOutputStream out) throws IOException, ClassNotFoundException {
if (ref == null) {
diff --git a/libjava/java/rmi/server/RemoteServer.java b/libjava/java/rmi/server/RemoteServer.java
index ca52d5eb757..b9cfc4e898e 100644
--- a/libjava/java/rmi/server/RemoteServer.java
+++ b/libjava/java/rmi/server/RemoteServer.java
@@ -43,6 +43,8 @@ import java.io.PrintStream;
public abstract class RemoteServer
extends RemoteObject {
+private static final long serialVersionUID = -4100238210092549637L;
+
protected RemoteServer() {
super();
}
diff --git a/libjava/java/rmi/server/UnicastRemoteObject.java b/libjava/java/rmi/server/UnicastRemoteObject.java
index 5571b9f0b49..aefe9701ecd 100644
--- a/libjava/java/rmi/server/UnicastRemoteObject.java
+++ b/libjava/java/rmi/server/UnicastRemoteObject.java
@@ -1,5 +1,5 @@
/*
- Copyright (c) 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
+ Copyright (c) 1996, 1997, 1998, 1999, 2002 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -42,10 +42,17 @@ import java.rmi.Remote;
import java.rmi.server.RemoteRef;
import java.rmi.NoSuchObjectException;
import gnu.java.rmi.server.UnicastServerRef;
+import gnu.java.rmi.server.UnicastServer;
public class UnicastRemoteObject
extends RemoteServer {
+private static final long serialVersionUID = 4974527148936298033L;
+//The following serialized fields are from Java API Documentation "Serialized form"
+private int port = 0;
+private RMIClientSocketFactory csf = null;
+private RMIServerSocketFactory ssf = null;
+
protected UnicastRemoteObject() throws RemoteException {
this(0);
}
@@ -55,11 +62,17 @@ protected UnicastRemoteObject(int port) throws RemoteException {
}
protected UnicastRemoteObject(int port, RMIClientSocketFactory csf, RMIServerSocketFactory ssf) throws RemoteException {
- super(new UnicastServerRef(new ObjID(), port, ssf));
+ this.port = port;
+ //Is RMIXXXSocketFactory serializable
+ //this.csf = csf;
+ //this.ssf = ssf;
+ this.ref = new UnicastServerRef(new ObjID(), port, ssf);
+ exportObject(this);
}
protected UnicastRemoteObject(RemoteRef ref) throws RemoteException {
super((UnicastServerRef)ref);
+ exportObject(this);
}
public Object clone() throws CloneNotSupportedException {
@@ -71,16 +84,46 @@ public static RemoteStub exportObject(Remote obj) throws RemoteException {
return (sref.exportObject(obj));
}
-public static Remote exportObject(Remote obj, int port) throws RemoteException {
- return (exportObject(obj));
-}
-
-public static Remote exportObject(Remote obj, int port, RMIClientSocketFactory csf, RMIServerSocketFactory ssf) throws RemoteException {
- return (exportObject(obj));
-}
-
-public static boolean unexportObject(Remote obj, boolean force) throws NoSuchObjectException {
- throw new Error("Not implemented");
-}
+ public static Remote exportObject(Remote obj, int port) throws RemoteException
+ {
+ return exportObject(obj, port, null);
+ }
+
+ protected static Remote exportObject(Remote obj, int port, RMIServerSocketFactory ssf)
+ throws RemoteException
+ {
+ UnicastServerRef sref = null;
+ if (obj instanceof RemoteObject)
+ sref = (UnicastServerRef)((RemoteObject)obj).getRef ();
+ if(sref == null)
+ {
+ sref = new UnicastServerRef(new ObjID (), port, ssf);
+ }
+ return (sref.exportObject (obj));
+ }
+
+ /**
+ * FIX ME
+ */
+ public static Remote exportObject(Remote obj, int port, RMIClientSocketFactory csf,
+ RMIServerSocketFactory ssf)
+ throws RemoteException
+ {
+ return (exportObject(obj, port, ssf));
+ }
+
+ public static boolean unexportObject(Remote obj, boolean force)
+ throws RemoteException, NoSuchObjectException
+ {
+ if (obj instanceof RemoteObject)
+ {
+ UnicastServerRef sref = (UnicastServerRef)((RemoteObject)obj).getRef();
+ return sref.unexportObject(obj, force);
+ }
+ else
+ //FIX ME
+ ;
+ return true;
+ }
}
diff --git a/libjava/java/security/DummyKeyPairGenerator.java b/libjava/java/security/DummyKeyPairGenerator.java
index d65ec6346bd..3a88b86e01b 100644
--- a/libjava/java/security/DummyKeyPairGenerator.java
+++ b/libjava/java/security/DummyKeyPairGenerator.java
@@ -1,5 +1,5 @@
-/* DummyKeyPairGenerator.java
- Copyright (C) 1999 Free Software Foundation, Inc.
+/* DummyKeyPairGenerator.java - Wrapper for KeyPairGeneratorSpi
+ Copyright (C) 1999, 2002 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -36,6 +36,7 @@ obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package java.security;
+
import java.security.spec.AlgorithmParameterSpec;
final class DummyKeyPairGenerator extends KeyPairGenerator
@@ -48,6 +49,17 @@ final class DummyKeyPairGenerator extends KeyPairGenerator
this.kpgSpi = kpgSpi;
}
+ public Object clone() throws CloneNotSupportedException
+ {
+ if (!(kpgSpi instanceof Cloneable))
+ throw new CloneNotSupportedException();
+
+ KeyPairGenerator result = new DummyKeyPairGenerator
+ ((KeyPairGeneratorSpi) kpgSpi.clone(), this.getAlgorithm());
+ result.provider = this.getProvider();
+ return result;
+ }
+
public void initialize(int keysize, SecureRandom random)
{
kpgSpi.initialize(keysize, random);
diff --git a/libjava/java/security/DummyMessageDigest.java b/libjava/java/security/DummyMessageDigest.java
index 9a96d775607..d7e769d328e 100644
--- a/libjava/java/security/DummyMessageDigest.java
+++ b/libjava/java/security/DummyMessageDigest.java
@@ -1,5 +1,5 @@
-/* DummyMessageDigest.java
- Copyright (C) 1999 Free Software Foundation, Inc.
+/* DummyMessageDigest.java - Wrapper for MessageDigestSpi
+ Copyright (C) 1999, 2002 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -37,10 +37,6 @@ exception statement from your version. */
package java.security;
-import java.security.MessageDigest;
-import java.security.MessageDigestSpi;
-import java.security.DigestException;
-
final class DummyMessageDigest extends MessageDigest
{
private MessageDigestSpi mdSpi = null;
@@ -51,23 +47,47 @@ final class DummyMessageDigest extends MessageDigest
this.mdSpi = mdSpi;
}
- protected void engineUpdate(byte input)
+ public Object clone() throws CloneNotSupportedException
{
- mdSpi.engineUpdate(input);
+ if (!(mdSpi instanceof Cloneable))
+ throw new CloneNotSupportedException();
+
+ MessageDigest result = new DummyMessageDigest
+ ((MessageDigestSpi) mdSpi.clone(), this.getAlgorithm());
+ result.provider = this.getProvider();
+ return result;
}
- protected void engineUpdate(byte[]input, int offset, int len)
+ // java.security.MessageDigestSpi abstract methods implementation ---------
+
+ public byte[] engineDigest()
{
- mdSpi.engineUpdate(input, offset, len);
+ return mdSpi.engineDigest();
}
- protected byte[] engineDigest()
+ public int engineDigest(byte[] buf, int offset, int len)
+ throws DigestException
{
- return mdSpi.engineDigest();
+ return mdSpi.engineDigest(buf, offset, len);
+ }
+
+ public int engineGetDigestLength()
+ {
+ return mdSpi.engineGetDigestLength();
}
- protected void engineReset()
+ public void engineReset()
{
mdSpi.engineReset();
}
+
+ public void engineUpdate(byte input)
+ {
+ mdSpi.engineUpdate(input);
+ }
+
+ public void engineUpdate(byte[] input, int offset, int len)
+ {
+ mdSpi.engineUpdate(input, offset, len);
+ }
}
diff --git a/libjava/java/security/DummySignature.java b/libjava/java/security/DummySignature.java
index 10e08cb4825..850f86d9dbc 100644
--- a/libjava/java/security/DummySignature.java
+++ b/libjava/java/security/DummySignature.java
@@ -1,5 +1,5 @@
-/* DummySignature.java
- Copyright (C) 1999 Free Software Foundation, Inc.
+/* DummySignature.java - Signature wrapper for SignatureSpi.
+ Copyright (C) 1999, 2002 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -47,6 +47,17 @@ final class DummySignature extends Signature
this.sigSpi = sigSpi;
}
+ public Object clone() throws CloneNotSupportedException
+ {
+ if (!(sigSpi instanceof Cloneable))
+ throw new CloneNotSupportedException();
+
+ Signature result = new DummySignature
+ ((SignatureSpi) sigSpi.clone(), this.getAlgorithm());
+ result.provider = this.getProvider();
+ return result;
+ }
+
protected void engineInitVerify(PublicKey publicKey)
throws InvalidKeyException
{
diff --git a/libjava/java/security/Identity.java b/libjava/java/security/Identity.java
index 4230eb06a2c..a1af11273e9 100644
--- a/libjava/java/security/Identity.java
+++ b/libjava/java/security/Identity.java
@@ -64,6 +64,8 @@ import java.util.Vector;
*/
public abstract class Identity implements Principal, Serializable
{
+ static final long serialVersionUID = 3609922007826600659L;
+
private String name;
private IdentityScope scope;
private PublicKey publicKey;
diff --git a/libjava/java/security/KeyPair.java b/libjava/java/security/KeyPair.java
index c6ba61d4cbd..c502add5002 100644
--- a/libjava/java/security/KeyPair.java
+++ b/libjava/java/security/KeyPair.java
@@ -48,6 +48,8 @@ import java.io.Serializable;
*/
public final class KeyPair implements Serializable
{
+ static final long serialVersionUID = -7565189502268009837L;
+
private PublicKey publicKey;
private PrivateKey privateKey;
diff --git a/libjava/java/security/KeyPairGenerator.java b/libjava/java/security/KeyPairGenerator.java
index ea44d53afc2..9ca1aa8ee5e 100644
--- a/libjava/java/security/KeyPairGenerator.java
+++ b/libjava/java/security/KeyPairGenerator.java
@@ -1,5 +1,5 @@
/* KeyPairGenerator.java --- Key Pair Generator Class
- Copyright (C) 1999 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -36,6 +36,7 @@ obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package java.security;
+
import java.security.spec.AlgorithmParameterSpec;
/**
@@ -51,7 +52,7 @@ import java.security.spec.AlgorithmParameterSpec;
*/
public abstract class KeyPairGenerator extends KeyPairGeneratorSpi
{
- private Provider provider;
+ Provider provider;
private String algorithm;
/**
@@ -83,19 +84,21 @@ public abstract class KeyPairGenerator extends KeyPairGeneratorSpi
@param algorithm the name of algorithm to choose
@return a AlgorithmParameterGenerator repesenting the desired algorithm
- @throws NoSuchAlgorithmException if the algorithm is not implemented by providers
+ @throws NoSuchAlgorithmException if the algorithm is not implemented by
+ providers
*/
public static KeyPairGenerator getInstance(String algorithm) throws
NoSuchAlgorithmException
{
Provider[] p = Security.getProviders();
- String name = "KeyPairGenerator." + algorithm;
for (int i = 0; i < p.length; i++)
{
- String classname = p[i].getProperty(name);
- if (classname != null)
- return getInstance(classname, algorithm, p[i]);
+ try
+ {
+ return getInstance(algorithm, p[i]);
+ }
+ catch (NoSuchAlgorithmException ignored) {}
}
throw new NoSuchAlgorithmException(algorithm);
@@ -110,7 +113,8 @@ public abstract class KeyPairGenerator extends KeyPairGeneratorSpi
@param provider the name of the provider to find the algorithm in
@return a AlgorithmParameterGenerator repesenting the desired algorithm
- @throws NoSuchAlgorithmException if the algorithm is not implemented by the provider
+ @throws NoSuchAlgorithmException if the algorithm is not implemented by
+ the provider
@throws NoSuchProviderException if the provider is not found
*/
public static KeyPairGenerator getInstance(String algorithm, String provider)
@@ -118,10 +122,34 @@ public abstract class KeyPairGenerator extends KeyPairGeneratorSpi
{
Provider p = Security.getProvider(provider);
if (p == null)
- throw new NoSuchProviderException();
+ throw new NoSuchProviderException(provider);
+
+ return getInstance(algorithm, p);
+ }
- return getInstance(p.getProperty("KeyPairGenerator." + algorithm),
- algorithm, p);
+ private static KeyPairGenerator getInstance(String algorithm, Provider p)
+ throws NoSuchAlgorithmException
+ {
+ // try the name as is
+ String className = p.getProperty("KeyPairGenerator." + algorithm);
+ if (className == null) { // try all uppercase
+ String upper = algorithm.toUpperCase();
+ className = p.getProperty("KeyPairGenerator." + upper);
+ if (className == null) { // try if it's an alias
+ String alias = p.getProperty("Alg.Alias.KeyPairGenerator." + algorithm);
+ if (alias == null) { // try all-uppercase alias name
+ alias = p.getProperty("Alg.Alias.KeyPairGenerator." + upper);
+ if (alias == null) { // spit the dummy
+ throw new NoSuchAlgorithmException(algorithm);
+ }
+ }
+ className = p.getProperty("KeyPairGenerator." + alias);
+ if (className == null) {
+ throw new NoSuchAlgorithmException(algorithm);
+ }
+ }
+ }
+ return getInstance(className, algorithm, p);
}
private static KeyPairGenerator getInstance(String classname,
@@ -134,10 +162,7 @@ public abstract class KeyPairGenerator extends KeyPairGeneratorSpi
Object o = Class.forName(classname).newInstance();
KeyPairGenerator kpg;
if (o instanceof KeyPairGeneratorSpi)
- kpg =
- (KeyPairGenerator) (new
- DummyKeyPairGenerator((KeyPairGeneratorSpi) o,
- algorithm));
+ kpg = new DummyKeyPairGenerator((KeyPairGeneratorSpi) o, algorithm);
else
{
kpg = (KeyPairGenerator) o;
diff --git a/libjava/java/security/KeyPairGeneratorSpi.java b/libjava/java/security/KeyPairGeneratorSpi.java
index 9e929e032fb..735dd6498f9 100644
--- a/libjava/java/security/KeyPairGeneratorSpi.java
+++ b/libjava/java/security/KeyPairGeneratorSpi.java
@@ -1,5 +1,5 @@
/* KeyPairGeneratorSpi.java --- Key Pair Generator SPI Class
- Copyright (C) 1999 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -90,4 +90,20 @@ public abstract class KeyPairGeneratorSpi
@return a key pair
*/
public abstract KeyPair generateKeyPair();
+
+ /**
+ Returns a clone of this class.
+
+ If cloning is not supported, then by default the class throws a
+ CloneNotSupportedException. The MessageDigestSpi provider
+ implementation has to overload this class in order to be
+ cloneable.
+ */
+ public Object clone() throws CloneNotSupportedException
+ {
+ if (this instanceof Cloneable)
+ return super.clone();
+ else
+ throw new CloneNotSupportedException();
+ }
}
diff --git a/libjava/java/security/KeyStore.java b/libjava/java/security/KeyStore.java
index e7c80716c40..1627bc5610a 100644
--- a/libjava/java/security/KeyStore.java
+++ b/libjava/java/security/KeyStore.java
@@ -1,5 +1,5 @@
/* KeyStore.java --- Key Store Class
- Copyright (C) 1999 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -92,9 +92,9 @@ public class KeyStore
/**
Gets an instance of the KeyStore class representing
the specified keystore. If the type is not
- found then, it throws CertificateException.
+ found then, it throws KeyStoreException.
- @param type the type of certificate to choose
+ @param type the type of keystore to choose
@return a KeyStore repesenting the desired type
@@ -117,20 +117,26 @@ public class KeyStore
/**
Gets an instance of the KeyStore class representing
the specified key store from the specified provider.
- If the type is not found then, it throws CertificateException.
+ If the type is not found then, it throws KeyStoreException.
If the provider is not found, then it throws
NoSuchProviderException.
- @param type the type of certificate to choose
+ @param type the type of keystore to choose
+ @param provider the provider name
@return a KeyStore repesenting the desired type
- @throws KeyStoreException if the type of keystore is not implemented by providers
+ @throws KeyStoreException if the type of keystore is not
+ implemented by the given provider
@throws NoSuchProviderException if the provider is not found
+ @throws IllegalArgumentException if the provider string is
+ null or empty
*/
public static KeyStore getInstance(String type, String provider)
throws KeyStoreException, NoSuchProviderException
{
+ if (provider == null || provider.length() == 0)
+ throw new IllegalArgumentException("Illegal provider");
Provider p = Security.getProvider(provider);
if (p == null)
throw new NoSuchProviderException();
@@ -138,6 +144,33 @@ public class KeyStore
return getInstance(p.getProperty("KeyStore." + type), type, p);
}
+ /**
+ Gets an instance of the KeyStore class representing
+ the specified key store from the specified provider.
+ If the type is not found then, it throws KeyStoreException.
+ If the provider is not found, then it throws
+ NoSuchProviderException.
+
+ @param type the type of keystore to choose
+ @param provider the keystore provider
+
+ @return a KeyStore repesenting the desired type
+
+ @throws KeyStoreException if the type of keystore is not
+ implemented by the given provider
+ @throws IllegalArgumentException if the provider object is null
+ @since 1.4
+ */
+ public static KeyStore getInstance(String type, Provider provider)
+ throws KeyStoreException
+ {
+ if (provider == null)
+ throw new IllegalArgumentException("Illegal provider");
+
+ return getInstance(provider.getProperty("KeyStore." + type),
+ type, provider);
+ }
+
private static KeyStore getInstance(String classname,
String type,
Provider provider)
diff --git a/libjava/java/security/MessageDigest.java b/libjava/java/security/MessageDigest.java
index be9dfd0896b..10032f22012 100644
--- a/libjava/java/security/MessageDigest.java
+++ b/libjava/java/security/MessageDigest.java
@@ -1,5 +1,6 @@
+
/* MessageDigest.java --- The message digest interface.
- Copyright (C) 1999 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -40,7 +41,7 @@ package java.security;
public abstract class MessageDigest extends MessageDigestSpi
{
private String algorithm;
- private Provider provider;
+ Provider provider;
private byte[] lastDigest;
/**
@@ -63,19 +64,20 @@ public abstract class MessageDigest extends MessageDigestSpi
@param algorithm the name of digest algorithm to choose
@return a MessageDigest representing the desired algorithm
- @exception NoSuchAlgorithmException if the algorithm is not implemented by providers
+ @exception NoSuchAlgorithmException if the algorithm is not implemented by
+ providers
*/
public static MessageDigest getInstance(String algorithm)
throws NoSuchAlgorithmException
{
Provider[] p = Security.getProviders();
- String name = "MessageDigest." + algorithm;
-
for (int i = 0; i < p.length; i++)
{
- String classname = p[i].getProperty(name);
- if (classname != null)
- return getInstance(classname, algorithm, p[i]);
+ try
+ {
+ return getInstance(algorithm, p[i]);
+ }
+ catch (NoSuchAlgorithmException ignored) {}
}
throw new NoSuchAlgorithmException(algorithm);
@@ -92,7 +94,8 @@ public abstract class MessageDigest extends MessageDigestSpi
@param provider the name of the provider to find the algorithm in
@return a MessageDigest representing the desired algorithm
- @exception NoSuchAlgorithmException if the algorithm is not implemented by the provider
+ @exception NoSuchAlgorithmException if the algorithm is not implemented by
+ the provider
@exception NoSuchProviderException if the provider is not found
*/
@@ -104,8 +107,32 @@ public abstract class MessageDigest extends MessageDigestSpi
if (p == null)
throw new NoSuchProviderException(provider);
- return getInstance(p.getProperty("MessageDigest." + algorithm),
- algorithm, p);
+ return getInstance(algorithm, p);
+ }
+
+ private static MessageDigest getInstance(String algorithm, Provider p)
+ throws NoSuchAlgorithmException
+ {
+ // try the name as is
+ String className = p.getProperty("MessageDigest." + algorithm);
+ if (className == null) { // try all uppercase
+ String upper = algorithm.toUpperCase();
+ className = p.getProperty("MessageDigest." + upper);
+ if (className == null) { // try if it's an alias
+ String alias = p.getProperty("Alg.Alias.MessageDigest." +algorithm);
+ if (alias == null) { // try all-uppercase alias name
+ alias = p.getProperty("Alg.Alias.MessageDigest." +upper);
+ if (alias == null) { // spit the dummy
+ throw new NoSuchAlgorithmException(algorithm);
+ }
+ }
+ className = p.getProperty("MessageDigest." + alias);
+ if (className == null) {
+ throw new NoSuchAlgorithmException(algorithm);
+ }
+ }
+ }
+ return getInstance(className, algorithm, p);
}
private static MessageDigest getInstance(String classname,
@@ -116,13 +143,22 @@ public abstract class MessageDigest extends MessageDigestSpi
if (classname == null)
throw new NoSuchAlgorithmException(algorithm);
+ MessageDigest result = null;
try
{
- MessageDigest m =
- (MessageDigest) Class.forName(classname).newInstance();
- m.algorithm = algorithm;
- m.provider = provider;
- return m;
+ Object obj = Class.forName(classname).newInstance();
+ if (obj instanceof MessageDigest) {
+ result = (MessageDigest) obj;
+ result.algorithm = algorithm;
+ } else if (obj instanceof MessageDigestSpi) {
+ result = new DummyMessageDigest((MessageDigestSpi) obj, algorithm);
+ } else {
+ throw new ClassCastException("Class "+classname+" from Provider "
+ +provider.getName()
+ +" does not extend java.security.MessageDigestSpi");
+ }
+ result.provider = provider;
+ return result;
}
catch (ClassNotFoundException cnfe)
{
@@ -212,7 +248,7 @@ public abstract class MessageDigest extends MessageDigestSpi
then computes a final digest and returns it. It calls
update(input) and then digest();
- @param buf An array of bytes to perform final update with
+ @param input An array of bytes to perform final update with
@return a byte array representing the message digest
*/
public byte[] digest(byte[]input)
diff --git a/libjava/java/security/ProtectionDomain.java b/libjava/java/security/ProtectionDomain.java
index 35d6d73a7d8..e8ead466565 100644
--- a/libjava/java/security/ProtectionDomain.java
+++ b/libjava/java/security/ProtectionDomain.java
@@ -53,8 +53,6 @@ package java.security;
*/
public class ProtectionDomain
{
- private static final String linesep = System.getProperty("line.separator");
-
/**
* This is the <code>CodeSource</code> for this protection domain
*/
@@ -131,6 +129,7 @@ public class ProtectionDomain
*/
public String toString()
{
+ String linesep = System.getProperty("line.separator");
StringBuffer sb = new StringBuffer("");
sb.append("ProtectionDomain (" + linesep);
if (code_source == null)
diff --git a/libjava/java/security/Provider.java b/libjava/java/security/Provider.java
index a1a9654b665..c40a980aaa3 100644
--- a/libjava/java/security/Provider.java
+++ b/libjava/java/security/Provider.java
@@ -1,5 +1,5 @@
/* Provider.java -- Security provider information
- Copyright (C) 1998, 1999, 2000 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2000, 2002 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -56,6 +56,8 @@ import java.util.Properties;
*/
public abstract class Provider extends Properties implements Serializable
{
+ static final long serialVersionUID = -4298000515446427739L;
+
/**
* This is a textual description of the provider
*/
@@ -117,16 +119,40 @@ public abstract class Provider extends Properties implements Serializable
}
/**
- * This method sets the specified key to have the specified value.
+ * Sets the key property to have the specified value.
+ * <p>
+ * <bold>NOT IMPLEMENTED YET</bold>[
+ * First, if there is a security manager, its <code>checkSecurityAccess</code>
+ * method is called with the string "putProviderProperty."+name, where name is
+ * the provider name, to see if it's ok to set this provider's property
+ * values.
+ * If the default implementation of <code>checkSecurityAccess</code> is used
+ * (that is, that method is not overriden), then this results in a call to the
+ * security manager's <code>checkPermission</code> method with a
+ * <code>SecurityPermission("putProviderProperty."+name)</code>
+ * permission.<br>]
*
- * @param key The property key
- * @param value The property value
+ * @param key The property key.
+ * @param value The property value.
*
- * @return The previous value for this key, or <code>null</code> if no previous value.
+ * @return The previous value of the specified property (<code>key</code>),
+ * or <code>null</code> if it did not have one.
+ * @throws SecurityException If a security manager exists and its
+ * {@link java.lang.SecurityManager.checkSecurityAccess(java.lang.String)}
+ * method denies access to set property values.
+ * @since Classpath 0.4+cvs, JDK 1.2
+ * @see java.lang.Object.equals(Object)
+ * @see java.util.Hashtable.get(Object)
*/
public Object put(Object key, Object value)
{
- return (super.put(key, value));
+ return super.put(toCanonicalKey(key), value);
+ }
+
+ // overrides same in java.util.Hashtable
+ public Object get(Object key)
+ {
+ return super.get(toCanonicalKey(key));
}
/**
@@ -135,11 +161,12 @@ public abstract class Provider extends Properties implements Serializable
*
* @param key The key to remove
*
- * @return The previous value for this key, or <code>null</code> if no previous value.
+ * @return The previous value for this key, or <code>null</code> if no
+ * previous value.
*/
public Object remove(Object key)
{
- return (super.remove(key));
+ return super.remove(toCanonicalKey(key));
}
/**
@@ -164,4 +191,12 @@ public abstract class Provider extends Properties implements Serializable
return (getClass().getName() + ": name=" + getName() + " version=" +
version);
}
+
+ private Object toCanonicalKey(Object key)
+ {
+ if (key.getClass().isAssignableFrom(String.class)) // is it ours?
+ return ((String) key).toUpperCase(); // use default locale
+ else
+ return key;
+ }
}
diff --git a/libjava/java/security/SecureClassLoader.java b/libjava/java/security/SecureClassLoader.java
index 9a4e672f70a..7adba1a9bbc 100644
--- a/libjava/java/security/SecureClassLoader.java
+++ b/libjava/java/security/SecureClassLoader.java
@@ -71,7 +71,7 @@ public class SecureClassLoader extends ClassLoader
@param b the data representing the classfile, in classfile format.
@param off the offset into the data where the classfile starts.
@param len the length of the classfile data in the array.
- @param cs the CodeSource for the class
+ @param cs the CodeSource for the class or null when unknown.
@return the class that was defined and optional CodeSource.
@@ -81,16 +81,14 @@ public class SecureClassLoader extends ClassLoader
CodeSource cs)
{
// FIXME: Need to cache ProtectionDomains according to 1.3 docs.
- ProtectionDomain protectionDomain =
- new ProtectionDomain(cs, getPermissions(cs));
- try
+ if (cs != null)
{
+ ProtectionDomain protectionDomain
+ = new ProtectionDomain(cs, getPermissions(cs));
return super.defineClass(name, b, off, len, protectionDomain);
- }
- catch (ClassFormatError cfe)
- {
- return null;
- }
+ }
+ else
+ return super.defineClass(name, b, off, len);
}
/**
diff --git a/libjava/java/security/SecureRandom.java b/libjava/java/security/SecureRandom.java
index 063c6c1c1b5..31701cb6fd9 100644
--- a/libjava/java/security/SecureRandom.java
+++ b/libjava/java/security/SecureRandom.java
@@ -49,6 +49,8 @@ import java.util.Enumeration;
*/
public class SecureRandom extends Random
{
+ static final long serialVersionUID = 4940670005562187L;
+
//Serialized Field
long counter = 0; //Serialized
MessageDigest digest = null;
diff --git a/libjava/java/security/SecureRandomSpi.java b/libjava/java/security/SecureRandomSpi.java
index a311b8fe5b2..1586994d596 100644
--- a/libjava/java/security/SecureRandomSpi.java
+++ b/libjava/java/security/SecureRandomSpi.java
@@ -50,6 +50,8 @@ import java.io.Serializable;
*/
public abstract class SecureRandomSpi implements Serializable
{
+ static final long serialVersionUID = -2991854161009191830L;
+
/**
Default Constructor for SecureRandomSpi
*/
diff --git a/libjava/java/security/Security.java b/libjava/java/security/Security.java
index 2c73da62dde..8c84c3f7978 100644
--- a/libjava/java/security/Security.java
+++ b/libjava/java/security/Security.java
@@ -1,5 +1,5 @@
/* Security.java --- Java base security class implmentation
- Copyright (C) 1999, 2001 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2001, 2002 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -59,8 +59,9 @@ public final class Security extends Object
static
{
- loadProviders(System.getProperty("java.vm.name"));
- loadProviders("classpath");
+ loadProviders(System.getProperty("java.home"),
+ System.getProperty("java.vm.name"));
+ loadProviders(System.getProperty("gnu.classpath.home"), "classpath");
}
// This class can't be instantiated.
@@ -68,13 +69,13 @@ public final class Security extends Object
{
}
- private static void loadProviders(String vendor)
+ private static void loadProviders(String dir, String vendor)
{
- if (vendor == null)
+ if (dir == null || vendor == null)
return;
String separator = System.getProperty("file.separator");
- String secfilestr = (System.getProperty("java.home") +
+ String secfilestr = (dir +
separator + "lib" +
separator + "security" +
separator + vendor + ".security");
@@ -126,8 +127,8 @@ public final class Security extends Object
}
/**
- Gets a specific property for an algorithm. This is used to produce specialized
- algorithm parsers.
+ Gets a specific property for an algorithm. This is used to produce
+ specialized algorithm parsers.
@deprecated it used to a return the value of a propietary property
for the "SUN" Cryptographic Service Provider to obtain
@@ -146,21 +147,37 @@ public final class Security extends Object
}
/**
- Adds a new provider at the specified position. This allows dynamic loading
- of providers. It will check for duplication of providers.
-
- This class checks the security manager with the call checkSecurityAccess
- with "insertProvider."+provider.getName() to see if the user can add this
- provider.
-
- @param provider the provider to add
- @param position position to add the provider at
-
- @return the position the provider was added at, or -1 if a duplicate provider
- was found
-
- @throws SecurityException - if the security manager denies access to add a
- new provider
+ Adds a new provider, at a specified position. The position is the
+ preference order in which providers are searched for requested algorithms.
+ Note that it is not guaranteed that this preference will be respected. The
+ position is 1-based, that is, 1 is most preferred, followed by 2, and so
+ on.
+ <p>
+ If the given provider is installed at the requested position, the
+ provider that used to be at that position, and all providers with a
+ position greater than position, are shifted up one position (towards the
+ end of the list of installed providers).
+ <p>
+ A provider cannot be added if it is already installed.
+ <p>
+ <b>NOT IMPLEMENTED YET:</b>[
+ First, if there is a security manager, its <code>checkSecurityAccess</code>
+ method is called with the string
+ <code>"insertProvider."+provider.getName()</code>
+ to see if it's ok to add a new provider. If the default implementation of
+ <code>checkSecurityAccess</code> is used (i.e., that method is not
+ overriden), then this will result in a call to the security manager's
+ <code>checkPermission</code> method with a <code>SecurityPermission(
+ "insertProvider."+provider.getName())</code> permission.]
+
+ @param provider the provider to be added.
+ @param position the preference position that the caller would like for
+ this provider.
+ @return the actual preference position (1-based) in which the provider was
+ added, or -1 if the provider was not added because it is already installed.
+ @throws SecurityException if a security manager exists and its <code>
+ SecurityManager.checkSecurityAccess(java.lang.String)</code> method denies
+ access to add a new provider.
*/
public static int insertProviderAt(Provider provider, int position)
{
@@ -168,6 +185,7 @@ public final class Security extends Object
if (sm != null)
sm.checkSecurityAccess("insertProvider." + provider.getName());
+ position--;
int max = providers.size ();
for (int i = 0; i < max; i++)
{
@@ -183,29 +201,33 @@ public final class Security extends Object
providers.insertElementAt(provider, position);
- return position;
+ return position + 1;
}
/**
- Adds a new provider. This allows dynamic loading
- of providers. It will check for duplication of providers.
-
- This method checks the security manager with the call checkSecurityAccess
- with "insertProvider."+provider.getName() to see if the user can add this
- provider.
-
- @param provider the provider to add
-
- @return the position the provider was added at, or -1 if a duplicate provider
- was found
-
- @throws SecurityException - if the security manager denies access to add a
- new provider
+ Adds a provider to the next position available.
+ <p>
+ <b>NOT IMPLEMENTED YET:</b> [
+ First, if there is a security manager, its <code>checkSecurityAccess</code>
+ method is called with the string
+ <code>"insertProvider."+provider.getName()</code>
+ to see if it's ok to add a new provider. If the default implementation of
+ <code>checkSecurityAccess</code> is used (i.e., that method is not
+ overriden), then this will result in a call to the security manager's
+ <code>checkPermission</code> method with a <code>SecurityPermission(
+ "insertProvider."+provider.getName())</code> permission.]
+
+ @param provider the provider to be added.
+ @return the preference position in which the provider was added, or <code>
+ -1</code> if the provider was not added because it is already installed.
+ @throws SecurityException if a security manager exists and its <code>
+ SecurityManager.checkSecurityAccess(java.lang.String)</code> method denies
+ access to add a new provider.
*/
public static int addProvider(Provider provider)
{
- return insertProviderAt (provider, providers.size ());
+ return insertProviderAt (provider, providers.size () + 1);
}
/**
@@ -214,13 +236,13 @@ public final class Security extends Object
ranking. If the provider is not installed, it fails silently.
This method checks the security manager with the call checkSecurityAccess
- with "removeProvider."+provider.getName() to see if the user can remove this
- provider.
+ with "removeProvider."+provider.getName() to see if the user can remove
+ this provider.
@param name name of the provider to add
- @throws SecurityException - if the security manager denies access to remove a
- new provider
+ @throws SecurityException - if the security manager denies access to
+ remove a new provider
*/
public static void removeProvider(String name)
{
@@ -263,15 +285,15 @@ public final class Security extends Object
*/
public static Provider getProvider(String name)
{
- Provider p = null;
+ Provider p;
int max = providers.size ();
for (int i = 0; i < max; i++)
{
p = (Provider) providers.elementAt(i);
if (p.getName() == name)
- break;
+ return p;
}
- return p;
+ return null;
}
/**
diff --git a/libjava/java/security/Signature.java b/libjava/java/security/Signature.java
index 8650c2774db..209a7df7604 100644
--- a/libjava/java/security/Signature.java
+++ b/libjava/java/security/Signature.java
@@ -1,5 +1,5 @@
/* Signature.java --- Signature Class
- Copyright (C) 1999 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -58,15 +58,12 @@ import java.security.spec.AlgorithmParameterSpec;
1. Initialing
- * It must be initialized with a private key for
- signing.
- * It must be initialized with a public key for
- verifying.
+ * It must be initialized with a private key for signing.
+ * It must be initialized with a public key for verifying.
2. Updating
- Update the bytes for signing or verifying with calls
- to update.
+ Update the bytes for signing or verifying with calls to update.
3. Signing or Verify the signature on the currently stored
bytes by calling sign or verify.
@@ -100,7 +97,7 @@ public abstract class Signature extends SignatureSpi
protected int state = UNINITIALIZED;
private String algorithm;
- private Provider provider;
+ Provider provider;
/**
Creates a new signature for this algorithm.
@@ -113,7 +110,7 @@ public abstract class Signature extends SignatureSpi
state = UNINITIALIZED;
}
- /**
+ /**
Gets an instance of the Signature class representing
the specified signature. If the algorithm is not found then,
it throws NoSuchAlgorithmException.
@@ -121,19 +118,21 @@ public abstract class Signature extends SignatureSpi
@param algorithm the name of signature algorithm to choose
@return a Signature repesenting the desired algorithm
- @throws NoSuchAlgorithmException if the algorithm is not implemented by providers
+ @throws NoSuchAlgorithmException if the algorithm is not implemented by
+ providers
*/
public static Signature getInstance(String algorithm)
throws NoSuchAlgorithmException
{
- String name = "Signature." + algorithm;
Provider[] p = Security.getProviders();
for (int i = 0; i < p.length; i++)
{
- String classname = p[i].getProperty(name);
- if (classname != null)
- return getInstance(classname, algorithm, p[i]);
+ try
+ {
+ return getInstance(algorithm, p[i]);
+ }
+ catch (NoSuchAlgorithmException ignored) {}
}
throw new NoSuchAlgorithmException(algorithm);
@@ -150,7 +149,8 @@ public abstract class Signature extends SignatureSpi
@param provider the name of the provider to find the algorithm in
@return a Signature repesenting the desired algorithm
- @throws NoSuchAlgorithmException if the algorithm is not implemented by the provider
+ @throws NoSuchAlgorithmException if the algorithm is not implemented by
+ the provider
@throws NoSuchProviderException if the provider is not found
*/
public static Signature getInstance(String algorithm, String provider)
@@ -158,9 +158,34 @@ public abstract class Signature extends SignatureSpi
{
Provider p = Security.getProvider(provider);
if (p == null)
- throw new NoSuchProviderException();
+ throw new NoSuchProviderException(provider);
+
+ return getInstance(algorithm, p);
+ }
- return getInstance(p.getProperty("Signature." + algorithm), algorithm, p);
+ private static Signature getInstance(String algorithm, Provider p)
+ throws NoSuchAlgorithmException
+ {
+ // try the name as is
+ String className = p.getProperty("Signature." + algorithm);
+ if (className == null) { // try all uppercase
+ String upper = algorithm.toUpperCase();
+ className = p.getProperty("Signature." + upper);
+ if (className == null) { // try if it's an alias
+ String alias = p.getProperty("Alg.Alias.Signature." + algorithm);
+ if (alias == null) {
+ alias = p.getProperty("Alg.Alias.Signature." + upper);
+ if (alias == null) { // spit the dummy
+ throw new NoSuchAlgorithmException(algorithm);
+ }
+ }
+ className = p.getProperty("Signature." + alias);
+ if (className == null) {
+ throw new NoSuchAlgorithmException(algorithm);
+ }
+ }
+ }
+ return getInstance(className, algorithm, p);
}
private static Signature getInstance(String classname,
@@ -173,7 +198,7 @@ public abstract class Signature extends SignatureSpi
Object o = Class.forName(classname).newInstance();
Signature sig;
if (o instanceof SignatureSpi)
- sig = (Signature) (new DummySignature((SignatureSpi) o, algorithm));
+ sig = new DummySignature((SignatureSpi) o, algorithm);
else
{
sig = (Signature) o;
@@ -200,7 +225,7 @@ public abstract class Signature extends SignatureSpi
/**
Gets the provider that the Signature is from.
- @return the provider the this Signature
+ @return the provider of this Signature
*/
public final Provider getProvider()
{
@@ -310,7 +335,7 @@ public abstract class Signature extends SignatureSpi
initial state and can be used to generate additional
signatures.
- @param outbuff array of bytes
+ @param outbuf array of bytes
@param offset the offset to start at in the array
@param len the length of the bytes to put into the array.
Neither this method or the GNU provider will
@@ -325,7 +350,7 @@ public abstract class Signature extends SignatureSpi
@since JDK 1.2
*/
- public final int sign(byte[]outbuf, int offset, int len)
+ public final int sign(byte[] outbuf, int offset, int len)
throws SignatureException
{
if (state == SIGN)
diff --git a/libjava/java/security/SignedObject.java b/libjava/java/security/SignedObject.java
index 93a99e51a6b..78684e57e73 100644
--- a/libjava/java/security/SignedObject.java
+++ b/libjava/java/security/SignedObject.java
@@ -79,6 +79,8 @@ import java.io.Serializable;
*/
public final class SignedObject implements Serializable
{
+ static final long serialVersionUID = 720502720485447167L;
+
private byte[] content;
private byte[] signature;
private String thealgorithm;
diff --git a/libjava/java/security/cert/Certificate.java b/libjava/java/security/cert/Certificate.java
index 221b2d7f83e..25e8aadf191 100644
--- a/libjava/java/security/cert/Certificate.java
+++ b/libjava/java/security/cert/Certificate.java
@@ -69,7 +69,8 @@ import java.io.ObjectStreamException;
*/
public abstract class Certificate
{
-
+ static final long serialVersionUID = -6751606818319535583L;
+
private String type;
/**
Constructs a new certificate of the specified type. An example
diff --git a/libjava/java/text/Collator.java b/libjava/java/text/Collator.java
index b07045417c1..bb5a3449139 100644
--- a/libjava/java/text/Collator.java
+++ b/libjava/java/text/Collator.java
@@ -153,8 +153,8 @@ public abstract class Collator implements Comparator, Cloneable
* @param str1 The first object to compare
* @param str2 The second object to compare
*
- * @return A negative integer if str1 < str2, 0 if str1 == str2, or
- * a positive integer if str1 > str2.
+ * @return A negative integer if str1 &lt; str2, 0 if str1 == str2, or
+ * a positive integer if str1 &gt; str2.
*/
public abstract int compare (String source, String target);
@@ -167,8 +167,8 @@ public abstract class Collator implements Comparator, Cloneable
* @param obj1 The first object to compare
* @param obj2 The second object to compare
*
- * @return A negative integer if obj1 < obj2, 0 if obj1 == obj2, or
- * a positive integer if obj1 > obj2.
+ * @return A negative integer if obj1 &lt; obj2, 0 if obj1 == obj2, or
+ * a positive integer if obj1 &gt; obj2.
*
* @exception ClassCastException If the arguments are not instances
* of <code>String</code>.
diff --git a/libjava/java/text/Format.java b/libjava/java/text/Format.java
index fa7ddbbf4c2..804ef43ff29 100644
--- a/libjava/java/text/Format.java
+++ b/libjava/java/text/Format.java
@@ -59,6 +59,8 @@ import java.io.Serializable;
*/
public abstract class Format implements Serializable, Cloneable
{
+ static final long serialVersionUID = -299282585814624189L;
+
/**
* This method initializes a new instance of <code>Format</code>.
* It performs no actions, but acts as a default constructor for
diff --git a/libjava/java/util/AbstractMap.java b/libjava/java/util/AbstractMap.java
index 11c8f5b544c..4be5f3dbd94 100644
--- a/libjava/java/util/AbstractMap.java
+++ b/libjava/java/util/AbstractMap.java
@@ -466,6 +466,11 @@ public abstract class AbstractMap implements Map
return AbstractMap.this.size();
}
+ public boolean contains(Object value)
+ {
+ return containsValue(value);
+ }
+
public Iterator iterator()
{
return new Iterator()
@@ -527,8 +532,9 @@ public abstract class AbstractMap implements Map
* @author Jon Zeppieri
* @author Eric Blake <ebb9@email.byu.edu>
*/
+ // XXX - FIXME Use fully qualified implements as gcj 3.1 workaround.
static class BasicMapEntry implements Map.Entry
- { // XXX - FIXME Use fully qualified implements as gcj 3.1 workaround.
+ {
/**
* The key. Package visible for direct manipulation.
*/
@@ -553,16 +559,14 @@ public abstract class AbstractMap implements Map
/**
* Compares the specified object with this entry. Returns true only if
* the object is a mapping of identical key and value. In other words,
- * this must be:
- *
-<pre>(o instanceof Map.Entry) &&
-(getKey() == null ? ((HashMap) o).getKey() == null
- : getKey().equals(((HashMap) o).getKey())) &&
-(getValue() == null ? ((HashMap) o).getValue() == null
- : getValue().equals(((HashMap) o).getValue()))</pre>
+ * this must be:<br>
+ * <pre>(o instanceof Map.Entry)
+ * && (getKey() == null ? ((HashMap) o).getKey() == null
+ * : getKey().equals(((HashMap) o).getKey()))
+ * && (getValue() == null ? ((HashMap) o).getValue() == null
+ * : getValue().equals(((HashMap) o).getValue()))</pre>
*
* @param o the object to compare
- *
* @return <code>true</code> if it is equal
*/
public final boolean equals(Object o)
@@ -605,10 +609,9 @@ public abstract class AbstractMap implements Map
/**
* Returns the hash code of the entry. This is defined as the exclusive-or
* of the hashcodes of the key and value (using 0 for null). In other
- * words, this must be:
- *
-<pre>(getKey() == null ? 0 : getKey().hashCode())
-^ (getValue() == null ? 0 : getValue().hashCode())</pre>
+ * words, this must be:<br>
+ * <pre>(getKey() == null ? 0 : getKey().hashCode())
+ * ^ (getValue() == null ? 0 : getValue().hashCode())</pre>
*
* @return the hash code
*/
diff --git a/libjava/java/util/ArrayList.java b/libjava/java/util/ArrayList.java
index 2d2146ddf59..c6f6b86991d 100644
--- a/libjava/java/util/ArrayList.java
+++ b/libjava/java/util/ArrayList.java
@@ -558,7 +558,9 @@ public class ArrayList extends AbstractList
// We serialize unused list entries to preserve capacity.
int len = data.length;
s.writeInt(len);
- for (int i = 0; i < len; i++)
+ // it would be more efficient to just write "size" items,
+ // this need readObject read "size" items too.
+ for (int i = 0; i < size; i++)
s.writeObject(data[i]);
}
@@ -578,7 +580,7 @@ public class ArrayList extends AbstractList
s.defaultReadObject();
int capacity = s.readInt();
data = new Object[capacity];
- for (int i = 0; i < capacity; i++)
+ for (int i = 0; i < size; i++)
data[i] = s.readObject();
}
}
diff --git a/libjava/java/util/Calendar.java b/libjava/java/util/Calendar.java
index 999f10511ba..09e9f2673a5 100644
--- a/libjava/java/util/Calendar.java
+++ b/libjava/java/util/Calendar.java
@@ -1,5 +1,5 @@
/* java.util.Calendar
- Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -504,8 +504,9 @@ public abstract class Calendar implements Serializable, Cloneable
/**
* Returns the time represented by this Calendar.
* @return the time in milliseconds since the epoch.
+ * @specnote This was made public in 1.4.
*/
- protected long getTimeInMillis()
+ public long getTimeInMillis()
{
if (!isTimeSet)
computeTime();
@@ -516,8 +517,9 @@ public abstract class Calendar implements Serializable, Cloneable
* Sets this Calendar's time to the given Time. All time fields
* are invalidated by this method.
* @param time the time in milliseconds since the epoch
+ * @specnote This was made public in 1.4.
*/
- protected void setTimeInMillis(long time)
+ public void setTimeInMillis(long time)
{
this.time = time;
isTimeSet = true;
diff --git a/libjava/java/util/HashMap.java b/libjava/java/util/HashMap.java
index a78eb9a1ff5..9faca0339d1 100644
--- a/libjava/java/util/HashMap.java
+++ b/libjava/java/util/HashMap.java
@@ -180,6 +180,15 @@ public class HashMap extends AbstractMap
}
/**
+ * Called when this entry is accessed via {@link #put(Object, Object)}.
+ * This version does nothing, but in LinkedHashMap, it must do some
+ * bookkeeping for access-traversal mode.
+ */
+ void access()
+ {
+ }
+
+ /**
* Called when this entry is removed from the map. This version simply
* returns the value, but in LinkedHashMap, it must also do bookkeeping.
*
@@ -338,8 +347,12 @@ public class HashMap extends AbstractMap
while (e != null)
{
if (equals(key, e.key))
- // Must use this method for necessary bookkeeping in LinkedHashMap.
- return e.setValue(value);
+ {
+ e.access(); // Must call this for bookkeeping in LinkedHashMap.
+ Object r = e.value;
+ e.value = value;
+ return r;
+ }
else
e = e.next;
}
@@ -368,8 +381,8 @@ public class HashMap extends AbstractMap
public void putAll(Map m)
{
Iterator itr = m.entrySet().iterator();
-
- for (int msize = m.size(); msize > 0; msize--)
+ int msize = m.size();
+ while (msize-- > 0)
{
Map.Entry e = (Map.Entry) itr.next();
// Optimize in case the Entry is one of our own.
@@ -379,9 +392,7 @@ public class HashMap extends AbstractMap
put(entry.key, entry.value);
}
else
- {
- put(e.getKey(), e.getValue());
- }
+ put(e.getKey(), e.getValue());
}
}
@@ -520,7 +531,7 @@ public class HashMap extends AbstractMap
public boolean remove(Object o)
{
// Test against the size of the HashMap to determine if anything
- // really got removed. This is neccessary because the return value
+ // really got removed. This is necessary because the return value
// of HashMap.remove() is ambiguous in the null case.
int oldsize = size;
HashMap.this.remove(o);
@@ -634,7 +645,6 @@ public class HashMap extends AbstractMap
void addEntry(Object key, Object value, int idx, boolean callRemove)
{
HashEntry e = new HashEntry(key, value);
-
e.next = buckets[idx];
buckets[idx] = e;
}
@@ -648,17 +658,18 @@ public class HashMap extends AbstractMap
* @see #entrySet()
*/
// Package visible, for use in nested classes.
- HashEntry getEntry(Object o)
+ final HashEntry getEntry(Object o)
{
- if (!(o instanceof Map.Entry))
+ if (! (o instanceof Map.Entry))
return null;
Map.Entry me = (Map.Entry) o;
- int idx = hash(me.getKey());
+ Object key = me.getKey();
+ int idx = hash(key);
HashEntry e = buckets[idx];
while (e != null)
{
- if (e.equals(me))
- return e;
+ if (equals(e.key, key))
+ return equals(e.value, me.getValue()) ? e : null;
e = e.next;
}
return null;
@@ -699,9 +710,8 @@ public class HashMap extends AbstractMap
{
Iterator itr = m.entrySet().iterator();
int msize = m.size();
- this.size = msize;
-
- for (; msize > 0; msize--)
+ size = msize;
+ while (msize-- > 0)
{
Map.Entry e = (Map.Entry) itr.next();
Object key = e.getKey();
@@ -742,9 +752,7 @@ public class HashMap extends AbstractMap
dest.next = e;
}
else
- {
- buckets[idx] = e;
- }
+ buckets[idx] = e;
HashEntry next = e.next;
e.next = null;
@@ -797,13 +805,14 @@ public class HashMap extends AbstractMap
// Read the threshold and loadFactor fields.
s.defaultReadObject();
- // Read and use capacity.
+ // Read and use capacity, followed by key/value pairs.
buckets = new HashEntry[s.readInt()];
int len = s.readInt();
-
- // Read and use key/value pairs.
- for ( ; len > 0; len--)
- put(s.readObject(), s.readObject());
+ while (len-- > 0)
+ {
+ Object key = s.readObject();
+ addEntry(key, s.readObject(), hash(key), false);
+ }
}
/**
diff --git a/libjava/java/util/LinkedHashMap.java b/libjava/java/util/LinkedHashMap.java
index 2716ac100d0..0a8484bae88 100644
--- a/libjava/java/util/LinkedHashMap.java
+++ b/libjava/java/util/LinkedHashMap.java
@@ -1,6 +1,6 @@
/* LinkedHashMap.java -- a class providing hashtable data structure,
mapping Object --> Object, with linked list traversal
- Copyright (C) 2001 Free Software Foundation, Inc.
+ Copyright (C) 2001, 2002 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -50,8 +50,17 @@ package java.util;
* can cause primary clustering) and rehashing (which does not fit very
* well with Java's method of precomputing hash codes) are avoided. In
* addition, this maintains a doubly-linked list which tracks either
- * insertion or access order. Note that the insertion order is not
- * modified if a <code>put</code> simply reinserts a key in the map.
+ * insertion or access order.
+ * <p>
+ *
+ * In insertion order, calling <code>put</code> adds the key to the end of
+ * traversal, unless the key was already in the map; changing traversal order
+ * requires removing and reinserting a key. On the other hand, in access
+ * order, all calls to <code>put</code> and <code>get</code> cause the
+ * accessed key to move to the end of the traversal list. Note that any
+ * accesses to the map's contents via its collection views and iterators do
+ * not affect the map's traversal order, since the collection views do not
+ * call <code>put</code> or <code>get</code>.
* <p>
*
* One of the nice features of tracking insertion order is that you can
@@ -61,19 +70,19 @@ package java.util;
* <p>
*
* When using this {@link #LinkedHashMap(int, float, boolean) constructor},
- * you build an access-order mapping. This can be used to implement LRU
- * caches, for example. In this case, every invocation of <code>put</code>,
- * <code>putAll</code>, or <code>get</code> moves the accessed entry to
- * the end of the iteration list. By overriding
- * {@link #removeEldestEntry(Map.Entry)}, you can also control the
- * removal of the oldest entry, and thereby do things like keep the map
- * at a fixed size.
+ * you can build an access-order mapping. This can be used to implement LRU
+ * caches, for example. By overriding {@link #removeEldestEntry(Map.Entry)},
+ * you can also control the removal of the oldest entry, and thereby do
+ * things like keep the map at a fixed size.
* <p>
*
* Under ideal circumstances (no collisions), LinkedHashMap offers O(1)
* performance on most operations (<code>containsValue()</code> is,
* of course, O(n)). In the worst case (all keys map to the same
- * hash code -- very unlikely), most operations are O(n).
+ * hash code -- very unlikely), most operations are O(n). Traversal is
+ * faster than in HashMap (proportional to the map size, and not the space
+ * allocated for the map), but other operations may be slower because of the
+ * overhead of the maintaining the traversal order list.
* <p>
*
* LinkedHashMap accepts the null key and null values. It is not
@@ -105,19 +114,15 @@ public class LinkedHashMap extends HashMap
private static final long serialVersionUID = 3801124242820219131L;
/**
- * The first Entry to iterate over.
- */
- transient LinkedHashEntry head;
-
- /**
- * The last Entry to iterate over.
+ * The oldest Entry to begin iteration at.
*/
- transient LinkedHashEntry tail;
+ transient LinkedHashEntry root;
/**
* The iteration order of this linked hash map: <code>true</code> for
* access-order, <code>false</code> for insertion-order.
- * @serial
+ *
+ * @serial true for access order traversal
*/
final boolean accessOrder;
@@ -127,69 +132,91 @@ public class LinkedHashMap extends HashMap
*/
class LinkedHashEntry extends HashEntry
{
- /** The predecessor in the iteration list, null if this is the eldest. */
+ /**
+ * The predecessor in the iteration list. If this entry is the root
+ * (eldest), pred points to the newest entry.
+ */
LinkedHashEntry pred;
+
/** The successor in the iteration list, null if this is the newest. */
LinkedHashEntry succ;
/**
* Simple constructor.
+ *
* @param key the key
* @param value the value
*/
LinkedHashEntry(Object key, Object value)
{
super(key, value);
- if (head == null)
- head = this;
- pred = tail;
- tail = this;
- if (pred != null)
- pred.succ = this;
+ if (root == null)
+ {
+ root = this;
+ pred = this;
+ }
+ else
+ {
+ pred = root.pred;
+ pred.succ = this;
+ root.pred = this;
+ }
}
/**
- * Sets the value of this entry, and shuffles it to the end of
- * the list if this is in access-order.
- * @param value the new value
- * @return the prior value
+ * Called when this entry is accessed via put or get. This version does
+ * the necessary bookkeeping to keep the doubly-linked list in order,
+ * after moving this element to the newest position in access order.
*/
- public Object setValue(Object value)
+ void access()
{
if (accessOrder && succ != null)
{
- succ.pred = pred;
- if (pred == null)
- head = succ;
+ modCount++;
+ if (this == root)
+ {
+ root = succ;
+ pred.succ = this;
+ succ = null;
+ }
else
- pred.succ = succ;
- succ = null;
- pred = tail;
- pred.succ = this;
- tail = this;
+ {
+ pred.succ = succ;
+ succ.pred = pred;
+ succ = null;
+ pred = root.pred;
+ pred.succ = this;
+ }
}
- return super.setValue(value);
}
/**
* Called when this entry is removed from the map. This version does
* the necessary bookkeeping to keep the doubly-linked list in order.
+ *
* @return the value of this key as it is removed
*/
Object cleanup()
{
- if (pred == null)
- head = succ;
- else
- pred.succ = succ;
- if (succ == null)
- tail = pred;
+ if (this == root)
+ {
+ root = succ;
+ if (succ != null)
+ succ.pred = pred;
+ }
+ else if (succ == null)
+ {
+ pred.succ = null;
+ root.pred = pred;
+ }
else
- succ.pred = pred;
-
+ {
+ pred.succ = succ;
+ succ.pred = pred;
+ }
return value;
}
- }
+ } // class LinkedHashEntry
/**
* Construct a new insertion-ordered LinkedHashMap with the default
@@ -253,10 +280,9 @@ public class LinkedHashMap extends HashMap
* Construct a new LinkedHashMap with a specific inital capacity, load
* factor, and ordering mode.
*
- * @param initialCapacity the initial capacity (>=0)
- * @param loadFactor the load factor (>0, not NaN)
+ * @param initialCapacity the initial capacity (&gt;=0)
+ * @param loadFactor the load factor (&gt;0, not NaN)
* @param accessOrder true for access-order, false for insertion-order
- *
* @throws IllegalArgumentException if (initialCapacity &lt; 0) ||
* ! (loadFactor &gt; 0.0)
*/
@@ -273,8 +299,7 @@ public class LinkedHashMap extends HashMap
public void clear()
{
super.clear();
- head = null;
- tail = null;
+ root = null;
}
/**
@@ -282,12 +307,11 @@ public class LinkedHashMap extends HashMap
* <code>o</code>, such that <code>o.equals(value)</code>.
*
* @param value the value to search for in this HashMap
- *
* @return <code>true</code> if at least one key maps to the value
*/
public boolean containsValue(Object value)
{
- LinkedHashEntry e = head;
+ LinkedHashEntry e = root;
while (e != null)
{
if (equals(value, e.value))
@@ -318,23 +342,7 @@ public class LinkedHashMap extends HashMap
{
if (equals(key, e.key))
{
- if (accessOrder)
- {
- modCount++;
- LinkedHashEntry l = (LinkedHashEntry) e;
- if (l.succ != null)
- {
- l.succ.pred = l.pred;
- if (l.pred == null)
- head = l.succ;
- else
- l.pred.succ = l.succ;
- l.succ = null;
- l.pred = tail;
- tail.succ = l;
- tail = l;
- }
- }
+ e.access();
return e.value;
}
e = e.next;
@@ -352,20 +360,21 @@ public class LinkedHashMap extends HashMap
* <p>
*
* For example, to keep the Map limited to 100 entries, override as follows:
- *
-<pre>private static final int MAX_ENTRIES = 100;
-
-protected boolean removeEldestEntry(Map.Entry eldest)
-{
- return size() &gt; MAX_ENTRIES;
-}
-</pre><p>
+ * <pre>
+ * private static final int MAX_ENTRIES = 100;
+ * protected boolean removeEldestEntry(Map.Entry eldest)
+ * {
+ * return size() &gt; MAX_ENTRIES;
+ * }
+ * </pre><p>
*
* Typically, this method does not modify the map, but just uses the
* return value as an indication to <code>put</code> whether to proceed.
* However, if you override it to modify the map, you must return false
- * (indicating that <code>put</code> should do nothing), or face
- * unspecified behavior.
+ * (indicating that <code>put</code> should leave the modified map alone),
+ * or you face unspecified behavior. Remember that in access-order mode,
+ * even calling <code>get</code> is a structural modification, but using
+ * the collections views (such as <code>keySet</code>) is not.
* <p>
*
* This method is called after the eldest entry has been inserted, so
@@ -378,7 +387,6 @@ protected boolean removeEldestEntry(Map.Entry eldest)
* returns true. For an access-order map, this is the least
* recently accessed; for an insertion-order map, this is the
* earliest element inserted.
- *
* @return true if <code>eldest</code> should be removed
*/
protected boolean removeEldestEntry(Map.Entry eldest)
@@ -396,33 +404,33 @@ protected boolean removeEldestEntry(Map.Entry eldest)
* @param callRemove whether to call the removeEldestEntry method
* @see #put(Object, Object)
* @see #removeEldestEntry(Map.Entry)
+ * @see LinkedHashEntry#LinkedHashEntry(Object, Object)
*/
void addEntry(Object key, Object value, int idx, boolean callRemove)
{
LinkedHashEntry e = new LinkedHashEntry(key, value);
-
e.next = buckets[idx];
buckets[idx] = e;
-
- if (callRemove && removeEldestEntry(head))
- remove(head);
+ if (callRemove && removeEldestEntry(root))
+ remove(root);
}
/**
* Helper method, called by clone() to reset the doubly-linked list.
+ *
* @param m the map to add entries from
* @see #clone()
*/
void putAllInternal(Map m)
{
- head = null;
- tail = null;
+ root = null;
super.putAllInternal(m);
}
/**
* Generates a parameterized iterator. This allows traversal to follow
* the doubly-linked list instead of the random bin order of HashMap.
+ *
* @param type {@link #KEYS}, {@link #VALUES}, or {@link #ENTRIES}
* @return the appropriate iterator
*/
@@ -430,17 +438,18 @@ protected boolean removeEldestEntry(Map.Entry eldest)
{
return new Iterator()
{
- /** The current Entry */
- LinkedHashEntry current = head;
+ /** The current Entry. */
+ LinkedHashEntry current = root;
- /** The previous Entry returned by next() */
+ /** The previous Entry returned by next(). */
LinkedHashEntry last;
- /** The number of known modifications to the backing HashMap */
+ /** The number of known modifications to the backing Map. */
int knownMod = modCount;
/**
* Returns true if the Iterator has more elements.
+ *
* @return true if there are more elements
* @throws ConcurrentModificationException if the HashMap was modified
*/
@@ -453,6 +462,7 @@ protected boolean removeEldestEntry(Map.Entry eldest)
/**
* Returns the next element in the Iterator's sequential view.
+ *
* @return the next element
* @throws ConcurrentModificationException if the HashMap was modified
* @throws NoSuchElementException if there is none
@@ -473,7 +483,6 @@ protected boolean removeEldestEntry(Map.Entry eldest)
* with the <code>next()</code> method.
*
* @throws ConcurrentModificationException if the HashMap was modified
- *
* @throws IllegalStateException if called when there is no last element
*/
public void remove()
@@ -482,11 +491,10 @@ protected boolean removeEldestEntry(Map.Entry eldest)
throw new ConcurrentModificationException();
if (last == null)
throw new IllegalStateException();
-
LinkedHashMap.this.remove(last.key);
last = null;
knownMod++;
}
};
}
-}
+} // class LinkedHashMap
diff --git a/libjava/java/util/Locale.java b/libjava/java/util/Locale.java
index df5dac15b37..22e19384c59 100644
--- a/libjava/java/util/Locale.java
+++ b/libjava/java/util/Locale.java
@@ -420,6 +420,8 @@ public final class Locale implements Serializable, Cloneable
{
if (language.length() == 0 && country.length() == 0)
return "";
+ else if (country.length() == 0 && variant.length() == 0)
+ return language;
StringBuffer result = new StringBuffer(language);
result.append('_').append(country);
if (variant.length() != 0)
diff --git a/libjava/java/util/Random.java b/libjava/java/util/Random.java
index 500a02d3765..6e7d8cf2491 100644
--- a/libjava/java/util/Random.java
+++ b/libjava/java/util/Random.java
@@ -259,7 +259,7 @@ public int nextInt(int n)
int bits, val;
do
{
- bits = next(32);
+ bits = next(31);
val = bits % n;
}
while(bits - val + (n-1) &lt; 0);
@@ -296,7 +296,7 @@ public int nextInt(int n)
int bits, val;
do
{
- bits = next(32);
+ bits = next(31);
val = bits % n;
}
while (bits - val + (n - 1) < 0);
diff --git a/libjava/java/util/ResourceBundle.java b/libjava/java/util/ResourceBundle.java
index 150a01bf44f..bfb6b306337 100644
--- a/libjava/java/util/ResourceBundle.java
+++ b/libjava/java/util/ResourceBundle.java
@@ -65,7 +65,7 @@ baseName_<i>def. language</i>_<i>def. country</i>
baseName_<i>def. language</i>
baseName</pre>
*
- * <p>A bundle is backed up by less specific bundles (omiting variant, country
+ * <p>A bundle is backed up by less specific bundles (omitting variant, country
* or language). But it is not backed up by the default language locale.
*
* <p>If you provide a bundle for a given locale, say
@@ -239,7 +239,6 @@ public abstract class ResourceBundle
*/
protected void setParent(ResourceBundle parent)
{
- // Shall we ignore the old parent?
this.parent = parent;
}
@@ -362,42 +361,59 @@ public abstract class ResourceBundle
cache = new HashMap();
resourceBundleCache.put(classLoader, cache);
}
- else
+ else if (cache.containsKey(name))
{
- Reference ref = (Reference) cache.get(name);
- if (ref != null)
- {
- ResourceBundle rb = (ResourceBundle) ref.get();
- if (rb != null)
- // rb should already have the right parent, except if
- // something very strange happened.
- return rb;
- }
+ Reference ref = (Reference) cache.get(name);
+ ResourceBundle result = null;
+ // If REF is null, that means that we added a `null' value to
+ // the hash map. That means we failed to find the bundle
+ // previously, and we cached that fact. The JDK does this, so
+ // it must be ok.
+ if (ref == null)
+ throw new MissingResourceException("Bundle " + baseName
+ + " not found",
+ baseName, "");
+ else
+ {
+ ResourceBundle rb = (ResourceBundle) ref.get();
+ if (rb != null)
+ {
+ // RB should already have the right parent, except if
+ // something very strange happened.
+ return rb;
+ }
+ // If RB is null, then we previously found it but it was
+ // collected. So we try again.
+ }
}
+ // It is ok if this returns null. We aren't required to have the
+ // base bundle.
ResourceBundle baseBundle = tryBundle(baseName, emptyLocale,
classLoader, null, cache);
- if (baseBundle == null)
- // JDK says, that if one provides a bundle base_en_UK, one
- // must also provide the bundles base_en and base.
- // This implies that if there is no bundle for base, there
- // is no bundle at all.
- throw new MissingResourceException("Bundle " + baseName + " not found",
- baseName, "");
- // Now use the default locale.
+ // Now use our locale, followed by the default locale. We only
+ // need to try the default locale if our locale is different, and
+ // if our locale failed to yield a result other than the base
+ // bundle.
ResourceBundle bundle = tryLocalBundle(baseName, locale,
classLoader, baseBundle, cache);
if (bundle == baseBundle && !locale.equals(Locale.getDefault()))
- bundle = tryLocalBundle(baseName, Locale.getDefault(),
- classLoader, baseBundle, cache);
+ {
+ bundle = tryLocalBundle(baseName, Locale.getDefault(),
+ classLoader, baseBundle, cache);
+ // We need to record that the argument locale maps to the
+ // bundle we just found. If we didn't find a bundle, record
+ // that instead.
+ if (bundle == null)
+ cache.put(name, null);
+ else
+ cache.put(name, new SoftReference(bundle));
+ }
- // Check whether baseName_locale has been loaded; if not, map the
- // "baseName" bundle to "baseName_locale" to avoid retrying to load
- // baseName_locale.
- Reference ref = (Reference) cache.get(name);
- if (ref == null)
- cache.put(name, new SoftReference(bundle));
+ if (bundle == null)
+ throw new MissingResourceException("Bundle " + baseName + " not found",
+ baseName, "");
return bundle;
}
@@ -440,15 +456,28 @@ public abstract class ResourceBundle
HashMap cache)
{
// First look into the cache.
- // XXX We should remove cleared references from the cache.
- Reference ref = (Reference) cache.get(localizedName);
- if (ref != null)
+ if (cache.containsKey(localizedName))
{
- ResourceBundle rb = (ResourceBundle) ref.get();
- if (rb != null)
- // rb should already have the right parent, except if
- // something very strange happened.
- return rb;
+ Reference ref = (Reference) cache.get(localizedName);
+ ResourceBundle result = null;
+ // If REF is null, that means that we added a `null' value to
+ // the hash map. That means we failed to find the bundle
+ // previously, and we cached that fact. The JDK does this, so
+ // it must be ok.
+ if (ref == null)
+ return null;
+ else
+ {
+ ResourceBundle rb = (ResourceBundle) ref.get();
+ if (rb != null)
+ {
+ // RB should already have the right parent, except if
+ // something very strange happened.
+ return rb;
+ }
+ // If RB is null, then we previously found it but it was
+ // collected. So we try again.
+ }
}
// foundBundle holds exact matches for the localizedName resource
@@ -470,30 +499,38 @@ public abstract class ResourceBundle
// ignore them all
}
if (foundBundle == null)
- try
- {
- InputStream is;
- final String resourceName
- = localizedName.replace('.', '/') + ".properties";
- if (classloader == null)
- is = ClassLoader.getSystemResourceAsStream(resourceName);
- else
- is = classloader.getResourceAsStream(resourceName);
- if (is != null)
- {
- foundBundle = new PropertyResourceBundle(is);
- foundBundle.parent = bundle;
- foundBundle.locale = locale;
- }
- }
- catch (IOException ex)
- {
- }
+ {
+ try
+ {
+ InputStream is;
+ final String resourceName
+ = localizedName.replace('.', '/') + ".properties";
+ if (classloader == null)
+ is = ClassLoader.getSystemResourceAsStream(resourceName);
+ else
+ is = classloader.getResourceAsStream(resourceName);
+ if (is != null)
+ {
+ foundBundle = new PropertyResourceBundle(is);
+ foundBundle.parent = bundle;
+ foundBundle.locale = locale;
+ }
+ }
+ catch (IOException ex)
+ {
+ }
+ }
- if (foundBundle != null)
+ // Put the result into the hash table. If we didn't find anything
+ // here, we record our parent bundle. If we record `null' that means
+ // nothing, not even the base, was found.
+ if (foundBundle == null)
+ foundBundle = bundle;
+ if (foundBundle == null)
+ cache.put(localizedName, null);
+ else
cache.put(localizedName, new SoftReference(foundBundle));
-
- return foundBundle != null ? foundBundle : bundle;
+ return foundBundle;
}
/**
@@ -501,45 +538,50 @@ public abstract class ResourceBundle
* locales with the same language.
*
* @param name the name
- * @param locale the locale, that must be used exactly
+ * @param locale the locale
* @param classloader the classloader
* @param bundle the backup (parent) bundle
* @return the resource bundle if it was loaded, otherwise the backup
*/
private static final ResourceBundle tryLocalBundle(String baseName,
- Locale locale,
+ Locale locale,
ClassLoader classloader,
ResourceBundle bundle,
HashMap cache)
{
final String language = locale.getLanguage();
+ final String country = locale.getCountry();
+ final String variant = locale.getVariant();
+
StringBuffer sb = new StringBuffer(60);
+ sb.append(baseName);
+ sb.append('_');
if (language.length() > 0)
{
- final String country = locale.getCountry();
- sb.append(baseName).append('_').append(language);
- String name = sb.toString();
-
- if (country.length() != 0)
- {
- bundle = tryBundle(name, new Locale(language),
- classloader, bundle, cache);
- sb.append('_').append(country);
- name = sb.toString();
-
- final String variant = locale.getVariant();
-
- if (variant.length() != 0)
- {
- bundle = tryBundle(name, new Locale(language, country),
- classloader, bundle, cache);
- sb.append('_').append(variant);
- name = sb.toString();
- }
- }
- bundle = tryBundle(name, locale, classloader, bundle, cache);
+ sb.append(language);
+ bundle = tryBundle(sb.toString(), new Locale(language),
+ classloader, bundle, cache);
+ }
+ // If LANGUAGE was empty, we still need to try the other
+ // components, and the `_' is required.
+ sb.append('_');
+
+ if (country.length() > 0)
+ {
+ sb.append(country);
+ bundle = tryBundle(sb.toString(), new Locale(language, country),
+ classloader, bundle, cache);
+ }
+ sb.append('_');
+
+ if (variant.length() > 0)
+ {
+ sb.append(variant);
+ bundle = tryBundle(sb.toString(), locale,
+ classloader, bundle, cache);
}
+
return bundle;
}
-} // class ResourceBundle
+}
diff --git a/libjava/java/util/TimeZone.java b/libjava/java/util/TimeZone.java
index eba22363d18..6d4493001f6 100644
--- a/libjava/java/util/TimeZone.java
+++ b/libjava/java/util/TimeZone.java
@@ -961,6 +961,22 @@ public abstract class TimeZone implements java.io.Serializable, Cloneable
public abstract boolean inDaylightTime(Date date);
/**
+ * Gets the daylight savings offset. This is a positive offset in
+ * milliseconds with respect to standard time. Typically this
+ * is one hour, but for some time zones this may be half an our.
+ * <p>The default implementation returns 3600000 milliseconds
+ * (one hour) if the time zone uses daylight savings time
+ * (as specified by {@link #useDaylightTime()}), otherwise
+ * it returns 0.
+ * @return the daylight savings offset in milliseconds.
+ * @since 1.4
+ */
+ public int getDSTSavings ()
+ {
+ return useDaylightTime () ? 3600000 : 0;
+ }
+
+ /**
* Gets the TimeZone for the given ID.
* @param ID the time zone identifier.
* @return The time zone for the identifier or GMT, if no such time
diff --git a/libjava/java/util/jar/Attributes.java b/libjava/java/util/jar/Attributes.java
index 0bf27bdb9ec..ea203446eaa 100644
--- a/libjava/java/util/jar/Attributes.java
+++ b/libjava/java/util/jar/Attributes.java
@@ -1,5 +1,5 @@
/* Attributes.java -- Represents attribute name/value pairs from a Manifest
- Copyright (C) 2000 Free Software Foundation, Inc.
+ Copyright (C) 2000, 2002 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -285,6 +285,7 @@ public class Attributes implements Cloneable, Map
// all other characters must be alphanums, '-' or '_'
for (int i = 1; i < chars.length; i++)
{
+ c = chars[i];
if (!((c >= 'a' && c <= 'z') ||
(c >= 'A' && c <= 'Z') ||
(c >= '0' && c <= '9') || (c == '-') || (c == '_')))
diff --git a/libjava/java/util/regex/Matcher.java b/libjava/java/util/regex/Matcher.java
new file mode 100644
index 00000000000..a1f95dbcc49
--- /dev/null
+++ b/libjava/java/util/regex/Matcher.java
@@ -0,0 +1,51 @@
+/* Matcher.java --
+ Copyright (C) 2002 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. */
+
+// Stub class until java.util.regex is implemented.
+package java.util.regex;
+
+public class Matcher
+{
+ public String replaceFirst(String replacement)
+ {
+ throw new InternalError("Not implemented yet");
+ }
+ public String replaceAll(String replacement)
+ {
+ throw new InternalError("Not implemented yet");
+ }
+}
diff --git a/libjava/java/util/regex/Pattern.java b/libjava/java/util/regex/Pattern.java
new file mode 100644
index 00000000000..0ea1bfb1c5a
--- /dev/null
+++ b/libjava/java/util/regex/Pattern.java
@@ -0,0 +1,59 @@
+/* Pattern.java --
+ Copyright (C) 2002 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. */
+
+// Stub class until java.util.regex is implemented.
+package java.util.regex;
+
+public class Pattern
+{
+ public static Pattern compile(String regex)
+ {
+ throw new InternalError("Not implemented yet");
+ }
+ public static boolean matches(String regex, CharSequence input)
+ {
+ throw new InternalError("Not implemented yet");
+ }
+ public Matcher matcher(CharSequence input)
+ {
+ throw new InternalError("Not implemented yet");
+ }
+ public String[] split(CharSequence input, int limit)
+ {
+ throw new InternalError("Not implemented yet");
+ }
+}
diff --git a/libjava/java/util/regex/PatternSyntaxException.java b/libjava/java/util/regex/PatternSyntaxException.java
new file mode 100644
index 00000000000..fc40d341862
--- /dev/null
+++ b/libjava/java/util/regex/PatternSyntaxException.java
@@ -0,0 +1,131 @@
+/* PatternSyntaxException - Indicates illegal pattern for regular expression.
+ Copyright (C) 2002 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 java.util.regex;
+
+/**
+ * Indicates illegal pattern for regular expression.
+ * Includes state to inspect the pattern and what and where the expression
+ * was not valid regular expression.
+ */
+public class PatternSyntaxException extends IllegalArgumentException
+{
+
+ /**
+ * Human readable escription of the syntax error.
+ */
+ private final String desc;
+
+ /**
+ * The original pattern that contained the syntax error.
+ */
+ private final String pattern;
+
+ /**
+ * Index of the first character in the String that was probably invalid,
+ * or -1 when unknown.
+ */
+ private final int index;
+
+ /**
+ * Creates a new PatternSyntaxException.
+ *
+ * @param description Human readable escription of the syntax error.
+ * @param pattern The original pattern that contained the syntax error.
+ * @param index Index of the first character in the String that was
+ * probably invalid, or -1 when unknown.
+ */
+ public PatternSyntaxException(String description,
+ String pattern,
+ int index)
+ {
+ super(description);
+ this.desc = description;
+ this.pattern = pattern;
+ this.index = index;
+ }
+
+ /**
+ * Returns a human readable escription of the syntax error.
+ */
+ public String getDescription()
+ {
+ return desc;
+ }
+
+ /**
+ * Returns the original pattern that contained the syntax error.
+ */
+ public String getPattern()
+ {
+ return pattern;
+ }
+
+ /**
+ * Returns the index of the first character in the String that was probably
+ * invalid, or -1 when unknown.
+ */
+ public int getIndex()
+ {
+ return index;
+ }
+
+ /**
+ * Returns a string containing a line with the description, a line with
+ * the original pattern and a line indicating with a ^ which character is
+ * probably the first invalid character in the pattern if the index is not
+ * negative.
+ */
+ public String getMessage()
+ {
+ String lineSep = System.getProperty("line.separator");
+ StringBuffer sb = new StringBuffer(desc);
+ sb.append(lineSep);
+ sb.append('\t');
+ sb.append(pattern);
+ if (index != -1)
+ {
+ sb.append(lineSep);
+ sb.append('\t');
+ for (int i=0; i<index; i++)
+ sb.append(' ');
+ sb.append('^');
+ }
+ return sb.toString();
+ }
+
+}
diff --git a/libjava/java/util/zip/GZIPInputStream.java b/libjava/java/util/zip/GZIPInputStream.java
index 07e4959e474..68fda79dc88 100644
--- a/libjava/java/util/zip/GZIPInputStream.java
+++ b/libjava/java/util/zip/GZIPInputStream.java
@@ -1,5 +1,5 @@
/* GZIPInputStream.java - Input filter for reading gzip file
- Copyright (C) 1999, 2000 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2000, 2002 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -141,28 +141,34 @@ public class GZIPInputStream extends InflaterInputStream
if (r == -1)
{
eos = true;
- int header_crc = read4 ();
+
+ byte[] tmp = new byte[8];
+ // First copy remaining bytes from inflater input buffer.
+ int avail = inf.getRemaining ();
+ System.arraycopy (this.buf, this.len - avail, tmp, 0, avail);
+
+ // Now read remaining bytes from wrapped input stream.
+ for (int i = avail; i < 8; ++i)
+ {
+ tmp[i] = (byte) eof_read ();
+ }
+
+ int header_crc = read4 (tmp, 0);
if (crc.getValue() != header_crc)
- throw new ZipException ("corrupted gzip file");
- // Read final `ISIZE' field.
- // FIXME: should we check this length?
- read4 ();
+ throw new ZipException ("corrupted gzip file - crc mismatch");
+ int isize = read4 (tmp, 4);
+ if (inf.getTotalOut() != isize)
+ throw new ZipException ("corrupted gzip file - size mismatch");
return -1;
}
crc.update(buf, off, r);
return r;
}
- private final int read4 () throws IOException
+ private final int read4 (byte[] buf, int offset) throws IOException
{
- int byte0 = in.read();
- int byte1 = in.read();
- int byte2 = in.read();
- int byte3 = in.read();
- if (byte3 < 0)
- throw new ZipException (".zip archive ended prematurely");
- return ((byte3 & 0xFF) << 24) + ((byte2 & 0xFF) << 16)
- + ((byte1 & 0xFF) << 8) + (byte0 & 0xFF);
+ return (((buf[offset + 3] & 0xFF) << 24) + ((buf[offset + 2] & 0xFF) << 16)
+ + ((buf[offset + 1] & 0xFF) << 8) + (buf[offset] & 0xFF));
}
// Checksum used by this input stream.
diff --git a/libjava/java/util/zip/ZipFile.java b/libjava/java/util/zip/ZipFile.java
index 6dbed7cdaee..2eb1156d2bc 100644
--- a/libjava/java/util/zip/ZipFile.java
+++ b/libjava/java/util/zip/ZipFile.java
@@ -1,5 +1,5 @@
/* java.util.zip.ZipFile
- Copyright (C) 2001 Free Software Foundation, Inc.
+ Copyright (C) 2001, 2002 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -36,6 +36,10 @@ obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package java.util.zip;
+
+import java.io.ByteArrayInputStream;
+import java.io.DataInput;
+import java.io.DataInputStream;
import java.io.File;
import java.io.InputStream;
import java.io.IOException;
@@ -102,9 +106,9 @@ public class ZipFile implements ZipConstants
/**
* Opens a Zip file reading the given File in the given mode.
*
- * If the OPEN_DELETE mode is specified, the zip file will be deleted at some time moment
- * after it is opened. It will be deleted before the zip file is closed or the Virtual Machine
- * exits.
+ * If the OPEN_DELETE mode is specified, the zip file will be deleted at
+ * some time moment after it is opened. It will be deleted before the zip
+ * file is closed or the Virtual Machine exits.
*
* The contents of the zip file will be accessible until it is closed.
*
@@ -121,7 +125,8 @@ public class ZipFile implements ZipConstants
{
if ((mode & OPEN_DELETE) != 0)
{
- throw new IllegalArgumentException("OPEN_DELETE mode not supported yet in java.util.zip.ZipFile");
+ throw new IllegalArgumentException
+ ("OPEN_DELETE mode not supported yet in java.util.zip.ZipFile");
}
this.raf = new RandomAccessFile(file, "r");
this.name = file.getName();
@@ -133,8 +138,11 @@ public class ZipFile implements ZipConstants
* @exception IOException if a i/o error occured.
* @exception EOFException if the file ends prematurely
*/
- private final int readLeShort() throws IOException {
- return raf.readUnsignedByte() | raf.readUnsignedByte() << 8;
+ private final int readLeShort(DataInput di) throws IOException
+ {
+ byte[] b = new byte[2];
+ di.readFully(b);
+ return (b[0] & 0xff) | (b[1] & 0xff) << 8;
}
/**
@@ -142,8 +150,12 @@ public class ZipFile implements ZipConstants
* @exception IOException if a i/o error occured.
* @exception EOFException if the file ends prematurely
*/
- private final int readLeInt() throws IOException {
- return readLeShort() | readLeShort() << 16;
+ private final int readLeInt(DataInput di) throws IOException
+ {
+ byte[] b = new byte[4];
+ di.readFully(b);
+ return ((b[0] & 0xff) | (b[1] & 0xff) << 8)
+ | ((b[2] & 0xff) | (b[3] & 0xff) << 8) << 16;
}
/**
@@ -164,36 +176,43 @@ public class ZipFile implements ZipConstants
{
if (pos < 0)
throw new ZipException
- ("central directory not found, probably not a zip file");
+ ("central directory not found, probably not a zip file: " + name);
raf.seek(pos--);
}
- while (readLeInt() != ENDSIG);
+ while (readLeInt(raf) != ENDSIG);
if (raf.skipBytes(ENDTOT - ENDNRD) != ENDTOT - ENDNRD)
- throw new EOFException();
- int count = readLeShort();
+ throw new EOFException(name);
+ int count = readLeShort(raf);
if (raf.skipBytes(ENDOFF - ENDSIZ) != ENDOFF - ENDSIZ)
- throw new EOFException();
- int centralOffset = readLeInt();
+ throw new EOFException(name);
+ int centralOffset = readLeInt(raf);
entries = new ZipEntry[count];
raf.seek(centralOffset);
+ byte[] ebs = new byte[24];
+ ByteArrayInputStream ebais = new ByteArrayInputStream(ebs);
+ DataInputStream edip = new DataInputStream(ebais);
for (int i = 0; i < count; i++)
{
- if (readLeInt() != CENSIG)
- throw new ZipException("Wrong Central Directory signature");
+ if (readLeInt(raf) != CENSIG)
+ throw new ZipException("Wrong Central Directory signature: " + name);
if (raf.skipBytes(CENHOW - CENVEM) != CENHOW - CENVEM)
- throw new EOFException();
- int method = readLeShort();
- int dostime = readLeInt();
- int crc = readLeInt();
- int csize = readLeInt();
- int size = readLeInt();
- int nameLen = readLeShort();
- int extraLen = readLeShort();
- int commentLen = readLeShort();
+ throw new EOFException(name);
+
+ raf.readFully(ebs);
+ ebais.reset();
+ int method = readLeShort(edip);
+ int dostime = readLeInt(edip);
+ int crc = readLeInt(edip);
+ int csize = readLeInt(edip);
+ int size = readLeInt(edip);
+ int nameLen = readLeShort(edip);
+ int extraLen = readLeShort(edip);
+ int commentLen = readLeShort(edip);
+
if (raf.skipBytes(CENOFF - CENDSK) != CENOFF - CENDSK)
- throw new EOFException();
- int offset = readLeInt();
+ throw new EOFException(name);
+ int offset = readLeInt(raf);
byte[] buffer = new byte[Math.max(nameLen, commentLen)];
@@ -244,7 +263,7 @@ public class ZipFile implements ZipConstants
public Enumeration entries()
{
if (entries == null)
- throw new IllegalStateException("ZipFile has closed");
+ throw new IllegalStateException("ZipFile has closed: " + name);
return new ZipEntryEnumeration(entries);
}
@@ -265,7 +284,7 @@ public class ZipFile implements ZipConstants
public ZipEntry getEntry(String name)
{
if (entries == null)
- throw new IllegalStateException("ZipFile has closed");
+ throw new IllegalStateException("ZipFile has closed: " + name);
int index = getEntryIndex(name);
return index >= 0 ? (ZipEntry) entries[index].clone() : null;
}
@@ -283,24 +302,24 @@ public class ZipFile implements ZipConstants
synchronized (raf)
{
raf.seek(entry.offset);
- if (readLeInt() != LOCSIG)
- throw new ZipException("Wrong Local header signature");
+ if (readLeInt(raf) != LOCSIG)
+ throw new ZipException("Wrong Local header signature: " + name);
/* skip version and flags */
if (raf.skipBytes(LOCHOW - LOCVER) != LOCHOW - LOCVER)
- throw new EOFException();
+ throw new EOFException(name);
- if (entry.getMethod() != readLeShort())
- throw new ZipException("Compression method mismatch");
+ if (entry.getMethod() != readLeShort(raf))
+ throw new ZipException("Compression method mismatch: " + name);
/* Skip time, crc, size and csize */
if (raf.skipBytes(LOCNAM - LOCTIM) != LOCNAM - LOCTIM)
- throw new EOFException();
+ throw new EOFException(name);
- if (entry.getName().length() != readLeShort())
- throw new ZipException("file name length mismatch");
+ if (entry.getName().length() != readLeShort(raf))
+ throw new ZipException("file name length mismatch: " + name);
- int extraLen = entry.getName().length() + readLeShort();
+ int extraLen = entry.getName().length() + readLeShort(raf);
return entry.offset + LOCHDR + extraLen;
}
}
diff --git a/libjava/java/util/zip/ZipInputStream.java b/libjava/java/util/zip/ZipInputStream.java
index 63153b649c9..c9a6c0159e7 100644
--- a/libjava/java/util/zip/ZipInputStream.java
+++ b/libjava/java/util/zip/ZipInputStream.java
@@ -61,6 +61,7 @@ public class ZipInputStream extends InflaterInputStream implements ZipConstants
private int method;
private int flags;
private int avail;
+ private boolean entryAtEOF;
/**
* Creates a new Zip input stream, reading a zip archive.
@@ -138,7 +139,7 @@ public class ZipInputStream extends InflaterInputStream implements ZipConstants
public ZipEntry getNextEntry() throws IOException
{
if (crc == null)
- throw new IllegalStateException("Closed.");
+ throw new IOException("Stream closed.");
if (entry != null)
closeEntry();
@@ -150,7 +151,8 @@ public class ZipInputStream extends InflaterInputStream implements ZipConstants
return null;
}
if (header != LOCSIG)
- throw new ZipException("Wrong Local header signature" + Integer.toHexString(header));
+ throw new ZipException("Wrong Local header signature"
+ + Integer.toHexString(header));
/* skip version */
readLeShort();
flags = readLeShort();
@@ -171,6 +173,7 @@ public class ZipInputStream extends InflaterInputStream implements ZipConstants
String name = new String(buffer);
entry = createZipEntry(name);
+ entryAtEOF = false;
entry.setMethod(method);
if ((flags & 8) == 0)
{
@@ -213,7 +216,7 @@ public class ZipInputStream extends InflaterInputStream implements ZipConstants
public void closeEntry() throws IOException
{
if (crc == null)
- throw new IllegalStateException("Closed.");
+ throw new IOException("Stream closed.");
if (entry == null)
return;
@@ -252,11 +255,12 @@ public class ZipInputStream extends InflaterInputStream implements ZipConstants
if (method == ZipOutputStream.DEFLATED)
inf.reset();
entry = null;
+ entryAtEOF = true;
}
public int available() throws IOException
{
- return entry != null ? 1 : 0;
+ return entryAtEOF ? 0 : 1;
}
/**
@@ -283,7 +287,7 @@ public class ZipInputStream extends InflaterInputStream implements ZipConstants
public int read(byte[] b, int off, int len) throws IOException
{
if (crc == null)
- throw new IllegalStateException("Closed.");
+ throw new IOException("Stream closed.");
if (entry == null)
return -1;
boolean finished = false;
@@ -335,6 +339,7 @@ public class ZipInputStream extends InflaterInputStream implements ZipConstants
throw new ZipException("CRC mismatch");
crc.reset();
entry = null;
+ entryAtEOF = true;
}
return len;
}
@@ -348,6 +353,7 @@ public class ZipInputStream extends InflaterInputStream implements ZipConstants
super.close();
crc = null;
entry = null;
+ entryAtEOF = true;
}
/**
diff --git a/libjava/java/util/zip/ZipOutputStream.java b/libjava/java/util/zip/ZipOutputStream.java
index e4fb864a955..44c4a9cc9b1 100644
--- a/libjava/java/util/zip/ZipOutputStream.java
+++ b/libjava/java/util/zip/ZipOutputStream.java
@@ -158,12 +158,12 @@ public class ZipOutputStream extends DeflaterOutputStream implements ZipConstant
* is not set in the entry, the current time is used.
* @param entry the entry.
* @exception IOException if an I/O error occured.
- * @exception IllegalStateException if stream was finished
+ * @exception ZipException if stream was finished.
*/
public void putNextEntry(ZipEntry entry) throws IOException
{
if (entries == null)
- throw new IllegalStateException("ZipOutputStream was finished");
+ throw new ZipException("ZipOutputStream was finished");
int method = entry.getMethod();
int flags = 0;
@@ -249,12 +249,12 @@ public class ZipOutputStream extends DeflaterOutputStream implements ZipConstant
/**
* Closes the current entry.
* @exception IOException if an I/O error occured.
- * @exception IllegalStateException if no entry is active.
+ * @exception ZipException if no entry is active.
*/
public void closeEntry() throws IOException
{
if (curEntry == null)
- throw new IllegalStateException("No open entry");
+ throw new ZipException("No open entry");
/* First finish the deflater, if appropriate */
if (curMethod == DEFLATED)
@@ -300,12 +300,12 @@ public class ZipOutputStream extends DeflaterOutputStream implements ZipConstant
/**
* Writes the given buffer to the current entry.
* @exception IOException if an I/O error occured.
- * @exception IllegalStateException if no entry is active.
+ * @exception ZipException if no entry is active.
*/
public void write(byte[] b, int off, int len) throws IOException
{
if (curEntry == null)
- throw new IllegalStateException("No open entry.");
+ throw new ZipException("No open entry.");
switch (curMethod)
{
diff --git a/libjava/java/util/zip/natDeflater.cc b/libjava/java/util/zip/natDeflater.cc
index 09411439541..23e1201b543 100644
--- a/libjava/java/util/zip/natDeflater.cc
+++ b/libjava/java/util/zip/natDeflater.cc
@@ -124,6 +124,7 @@ java::util::zip::Deflater::reset ()
z_streamp s = (z_streamp) zstream;
// Just ignore errors.
deflateReset (s);
+ s->avail_in = 0;
flush_flag = 0;
is_finished = false;
}
diff --git a/libjava/java/util/zip/natInflater.cc b/libjava/java/util/zip/natInflater.cc
index 0568b5e85d3..69de6c33560 100644
--- a/libjava/java/util/zip/natInflater.cc
+++ b/libjava/java/util/zip/natInflater.cc
@@ -149,6 +149,7 @@ java::util::zip::Inflater::reset ()
z_streamp s = (z_streamp) zstream;
// Just ignore errors.
inflateReset (s);
+ s->avail_in = 0;
is_finished = false;
dict_needed = false;
}
diff --git a/libjava/javax/naming/AuthenticationException.java b/libjava/javax/naming/AuthenticationException.java
index 105b7f3e59b..112dd612e6f 100644
--- a/libjava/javax/naming/AuthenticationException.java
+++ b/libjava/javax/naming/AuthenticationException.java
@@ -1,10 +1,40 @@
-/* Copyright (C) 2000 Free Software Foundation
+/* AuthenticationException.java --
+ Copyright (C) 2000 Free Software Foundation, Inc.
- This file is part of libgcj.
+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. */
-This software is copyrighted work licensed under the terms of the
-Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
-details. */
package javax.naming;
diff --git a/libjava/javax/naming/AuthenticationNotSupportedException.java b/libjava/javax/naming/AuthenticationNotSupportedException.java
index 2078285bf86..6409e6490fa 100644
--- a/libjava/javax/naming/AuthenticationNotSupportedException.java
+++ b/libjava/javax/naming/AuthenticationNotSupportedException.java
@@ -1,10 +1,40 @@
-/* Copyright (C) 2000 Free Software Foundation
+/* AuthenticationNotSupportedException.java --
+ Copyright (C) 2000 Free Software Foundation, Inc.
- This file is part of libgcj.
+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. */
-This software is copyrighted work licensed under the terms of the
-Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
-details. */
package javax.naming;
diff --git a/libjava/javax/naming/BinaryRefAddr.java b/libjava/javax/naming/BinaryRefAddr.java
index 8d8d44d9bd4..793552a9e65 100644
--- a/libjava/javax/naming/BinaryRefAddr.java
+++ b/libjava/javax/naming/BinaryRefAddr.java
@@ -50,7 +50,8 @@ import java.util.Arrays;
*/
public class BinaryRefAddr extends RefAddr
{
-
+ static final long serialVersionUID = -3415254970957330361L;
+
/**
* The possibly null content of this RefAddr.
* Set by the constructor and returned by getContent.
@@ -97,17 +98,17 @@ public class BinaryRefAddr extends RefAddr
* the addrType is the same as this addrType and the bytes of the
* content are the same.
*/
- public boolean equals (Object o)
+ public boolean equals(Object o)
{
if (o instanceof BinaryRefAddr)
{
BinaryRefAddr refAddr = (BinaryRefAddr) o;
if (this.getType().equals(refAddr.getType()))
- {
- byte[] c1 = (byte[]) this.getContent();
- byte[] c2 = (byte[]) refAddr.getContent();
- return Arrays.equals(c1, c2);
- }
+ {
+ byte[] c1 = (byte[]) this.getContent();
+ byte[] c2 = (byte[]) refAddr.getContent();
+ return Arrays.equals(c1, c2);
+ }
}
return false;
}
diff --git a/libjava/javax/naming/Binding.java b/libjava/javax/naming/Binding.java
index e8ee4a24571..45f0d13ea5f 100644
--- a/libjava/javax/naming/Binding.java
+++ b/libjava/javax/naming/Binding.java
@@ -1,10 +1,40 @@
-/* Copyright (C) 2001 Free Software Foundation
+/* Binding.java --
+ Copyright (C) 2001 Free Software Foundation, Inc.
- This file is part of libgcj.
+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. */
-This software is copyrighted work licensed under the terms of the
-Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
-details. */
package javax.naming;
diff --git a/libjava/javax/naming/CannotProceedException.java b/libjava/javax/naming/CannotProceedException.java
index f35e147b2df..f98541876d9 100644
--- a/libjava/javax/naming/CannotProceedException.java
+++ b/libjava/javax/naming/CannotProceedException.java
@@ -1,10 +1,40 @@
-/* Copyright (C) 2001 Free Software Foundation
+/* CannotProceedException.java --
+ Copyright (C) 2001 Free Software Foundation, Inc.
- This file is part of libgcj.
+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. */
-This software is copyrighted work licensed under the terms of the
-Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
-details. */
package javax.naming;
diff --git a/libjava/javax/naming/CommunicationException.java b/libjava/javax/naming/CommunicationException.java
index f5e67efe3ef..8731be15acb 100644
--- a/libjava/javax/naming/CommunicationException.java
+++ b/libjava/javax/naming/CommunicationException.java
@@ -1,11 +1,41 @@
-/* Copyright (C) 2000 Free Software Foundation
+/* CommunicationException.java --
+ Copyright (C) 2000 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. */
- 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. */
-
package javax.naming;
import java.lang.Exception;
diff --git a/libjava/javax/naming/CompositeName.java b/libjava/javax/naming/CompositeName.java
index afc85d53f23..71cdaaf7ba9 100644
--- a/libjava/javax/naming/CompositeName.java
+++ b/libjava/javax/naming/CompositeName.java
@@ -1,10 +1,40 @@
-/* Copyright (C) 2001 Free Software Foundation
+/* CompositeName.java --
+ Copyright (C) 2001 Free Software Foundation, Inc.
- This file is part of libgcj.
+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. */
-This software is copyrighted work licensed under the terms of the
-Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
-details. */
package javax.naming;
diff --git a/libjava/javax/naming/CompoundName.java b/libjava/javax/naming/CompoundName.java
index 4e9f5bd8a00..686a3a3d348 100644
--- a/libjava/javax/naming/CompoundName.java
+++ b/libjava/javax/naming/CompoundName.java
@@ -1,10 +1,40 @@
-/* Copyright (C) 2001 Free Software Foundation
+/* CompoundName.java --
+ Copyright (C) 2001 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. */
- 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. */
package javax.naming;
diff --git a/libjava/javax/naming/ConfigurationException.java b/libjava/javax/naming/ConfigurationException.java
index 9f8013b8813..7df4603c5a0 100644
--- a/libjava/javax/naming/ConfigurationException.java
+++ b/libjava/javax/naming/ConfigurationException.java
@@ -1,11 +1,41 @@
-/* Copyright (C) 2000 Free Software Foundation
+/* ConfigurationException.java --
+ Copyright (C) 2000 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. */
- 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. */
-
package javax.naming;
import java.lang.Exception;
diff --git a/libjava/javax/naming/Context.java b/libjava/javax/naming/Context.java
index 32dab766fbe..5720dc40221 100644
--- a/libjava/javax/naming/Context.java
+++ b/libjava/javax/naming/Context.java
@@ -1,10 +1,40 @@
-/* Copyright (C) 2000 Free Software Foundation
+/* Context.java --
+ Copyright (C) 2000 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. */
- 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. */
package javax.naming;
diff --git a/libjava/javax/naming/ContextNotEmptyException.java b/libjava/javax/naming/ContextNotEmptyException.java
index 24cb5b64e12..74204db54ba 100644
--- a/libjava/javax/naming/ContextNotEmptyException.java
+++ b/libjava/javax/naming/ContextNotEmptyException.java
@@ -1,11 +1,41 @@
-/* Copyright (C) 2000 Free Software Foundation
+/* ContextNotEmptyException.java --
+ Copyright (C) 2000 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. */
- 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. */
-
package javax.naming;
import java.lang.Exception;
diff --git a/libjava/javax/naming/InitialContext.java b/libjava/javax/naming/InitialContext.java
index 6ee6a9a8e54..99ae426e9ab 100644
--- a/libjava/javax/naming/InitialContext.java
+++ b/libjava/javax/naming/InitialContext.java
@@ -1,10 +1,40 @@
-/* Copyright (C) 2000 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. */
+/* InitialContext.java --
+ Copyright (C) 2000 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 javax.naming;
diff --git a/libjava/javax/naming/InsufficientResourcesException.java b/libjava/javax/naming/InsufficientResourcesException.java
index 6d3e97635cf..120033dd143 100644
--- a/libjava/javax/naming/InsufficientResourcesException.java
+++ b/libjava/javax/naming/InsufficientResourcesException.java
@@ -1,10 +1,40 @@
-/* Copyright (C) 2000 Free Software Foundation
+/* InsufficientResourcesException.java --
+ Copyright (C) 2000 Free Software Foundation, Inc.
- This file is part of libgcj.
+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. */
-This software is copyrighted work licensed under the terms of the
-Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
-details. */
package javax.naming;
diff --git a/libjava/javax/naming/InterruptedNamingException.java b/libjava/javax/naming/InterruptedNamingException.java
index f9897ec7de3..e5ad1f864af 100644
--- a/libjava/javax/naming/InterruptedNamingException.java
+++ b/libjava/javax/naming/InterruptedNamingException.java
@@ -1,11 +1,41 @@
-/* Copyright (C) 2000 Free Software Foundation
+/* InterruptedNamingException.java --
+ Copyright (C) 2000 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. */
- 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. */
-
package javax.naming;
import java.lang.Exception;
diff --git a/libjava/javax/naming/LimitExceededException.java b/libjava/javax/naming/LimitExceededException.java
index 5490faf9f62..4bbbb0f496a 100644
--- a/libjava/javax/naming/LimitExceededException.java
+++ b/libjava/javax/naming/LimitExceededException.java
@@ -1,10 +1,40 @@
-/* Copyright (C) 2000 Free Software Foundation
+/* LimitExceededException.java --
+ Copyright (C) 2000 Free Software Foundation, Inc.
- This file is part of libgcj.
+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. */
-This software is copyrighted work licensed under the terms of the
-Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
-details. */
package javax.naming;
diff --git a/libjava/javax/naming/LinkException.java b/libjava/javax/naming/LinkException.java
index 6512c926c24..46ea6bd0b14 100644
--- a/libjava/javax/naming/LinkException.java
+++ b/libjava/javax/naming/LinkException.java
@@ -1,10 +1,40 @@
-/* Copyright (C) 2001 Free Software Foundation
+/* LinkException.java --
+ Copyright (C) 2001 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. */
- 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. */
package javax.naming;
diff --git a/libjava/javax/naming/LinkLoopException.java b/libjava/javax/naming/LinkLoopException.java
index f2f333cf621..0c2bdddd876 100644
--- a/libjava/javax/naming/LinkLoopException.java
+++ b/libjava/javax/naming/LinkLoopException.java
@@ -1,10 +1,40 @@
-/* Copyright (C) 2000 Free Software Foundation
+/* LinkLoopException.java --
+ Copyright (C) 2000 Free Software Foundation, Inc.
- This file is part of libgcj.
+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. */
-This software is copyrighted work licensed under the terms of the
-Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
-details. */
package javax.naming;
diff --git a/libjava/javax/naming/LinkRef.java b/libjava/javax/naming/LinkRef.java
index 703eb7476a0..a8a22adca8f 100644
--- a/libjava/javax/naming/LinkRef.java
+++ b/libjava/javax/naming/LinkRef.java
@@ -1,10 +1,40 @@
-/* Copyright (C) 2001 Free Software Foundation
+/* LinkRef.java --
+ Copyright (C) 2001 Free Software Foundation, Inc.
- This file is part of libgcj.
+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. */
-This software is copyrighted work licensed under the terms of the
-Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
-details. */
package javax.naming;
diff --git a/libjava/javax/naming/MalformedLinkException.java b/libjava/javax/naming/MalformedLinkException.java
index 5f2f6998881..5233e772365 100644
--- a/libjava/javax/naming/MalformedLinkException.java
+++ b/libjava/javax/naming/MalformedLinkException.java
@@ -1,11 +1,41 @@
-/* Copyright (C) 2000 Free Software Foundation
+/* MalformedLinkException.java --
+ Copyright (C) 2000 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. */
- 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. */
-
package javax.naming;
import java.lang.Exception;
diff --git a/libjava/javax/naming/Name.java b/libjava/javax/naming/Name.java
index 7c3e6d7ef8e..4a10f321f9c 100644
--- a/libjava/javax/naming/Name.java
+++ b/libjava/javax/naming/Name.java
@@ -62,6 +62,8 @@ import java.io.Serializable;
*/
public interface Name extends Cloneable, Serializable
{
+ static final long serialVersionUID = -3617482732056931635L;
+
/**
* Returns the number of components of this <code>Name</code>.
* The returned number can be zero.
diff --git a/libjava/javax/naming/NameAlreadyBoundException.java b/libjava/javax/naming/NameAlreadyBoundException.java
index da2ddbc52a7..2b57436285a 100644
--- a/libjava/javax/naming/NameAlreadyBoundException.java
+++ b/libjava/javax/naming/NameAlreadyBoundException.java
@@ -1,11 +1,41 @@
-/* Copyright (C) 2000 Free Software Foundation
+/* NameAlreadyBoundException.java --
+ Copyright (C) 2000 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. */
- 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. */
-
package javax.naming;
import java.lang.Exception;
diff --git a/libjava/javax/naming/NameClassPair.java b/libjava/javax/naming/NameClassPair.java
index 3d4c0a78370..2f115598641 100644
--- a/libjava/javax/naming/NameClassPair.java
+++ b/libjava/javax/naming/NameClassPair.java
@@ -1,10 +1,40 @@
-/* Copyright (C) 2001 Free Software Foundation
+/* NameClassPair.java --
+ Copyright (C) 2001 Free Software Foundation, Inc.
- This file is part of libgcj.
+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. */
-This software is copyrighted work licensed under the terms of the
-Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
-details. */
package javax.naming;
diff --git a/libjava/javax/naming/NameNotFoundException.java b/libjava/javax/naming/NameNotFoundException.java
index f69c161fc59..cb22ab371e2 100644
--- a/libjava/javax/naming/NameNotFoundException.java
+++ b/libjava/javax/naming/NameNotFoundException.java
@@ -1,10 +1,40 @@
-/* Copyright (C) 2000 Free Software Foundation
+/* NameNotFoundException.java --
+ Copyright (C) 2000 Free Software Foundation, Inc.
- This file is part of libgcj.
+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. */
-This software is copyrighted work licensed under the terms of the
-Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
-details. */
package javax.naming;
diff --git a/libjava/javax/naming/NameParser.java b/libjava/javax/naming/NameParser.java
index 366feac0ab7..0bd2a7a8a6e 100644
--- a/libjava/javax/naming/NameParser.java
+++ b/libjava/javax/naming/NameParser.java
@@ -1,10 +1,40 @@
-/* Copyright (C) 2000 Free Software Foundation
+/* NameParser.java --
+ Copyright (C) 2000 Free Software Foundation, Inc.
- This file is part of libgcj.
+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. */
-This software is copyrighted work licensed under the terms of the
-Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
-details. */
package javax.naming;
diff --git a/libjava/javax/naming/NamingEnumeration.java b/libjava/javax/naming/NamingEnumeration.java
index aed4d76578f..4340c1287bf 100644
--- a/libjava/javax/naming/NamingEnumeration.java
+++ b/libjava/javax/naming/NamingEnumeration.java
@@ -1,10 +1,40 @@
-/* Copyright (C) 2000 Free Software Foundation
+/* NamingEnumeration.java --
+ Copyright (C) 2000 Free Software Foundation, Inc.
- This file is part of libgcj.
+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. */
-This software is copyrighted work licensed under the terms of the
-Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
-details. */
package javax.naming;
diff --git a/libjava/javax/naming/NamingException.java b/libjava/javax/naming/NamingException.java
index a377041ae83..6c0f0172dc1 100644
--- a/libjava/javax/naming/NamingException.java
+++ b/libjava/javax/naming/NamingException.java
@@ -47,7 +47,7 @@ import java.io.PrintWriter;
* <code>NamingException</code>), the part of the <code>Name</code> that
* could be resolved (including the <code>Object</code> it resolved to)
* and the part of the <code>Name</code> that could not be resolved when
- * the exception occurred.
+ * the exception occured.
*
* @since 1.3
* @author Anthony Green (green@redhat.com)
diff --git a/libjava/javax/naming/NamingSecurityException.java b/libjava/javax/naming/NamingSecurityException.java
index 15501ef92b0..71d538a0b0e 100644
--- a/libjava/javax/naming/NamingSecurityException.java
+++ b/libjava/javax/naming/NamingSecurityException.java
@@ -1,11 +1,41 @@
-/* Copyright (C) 2000 Free Software Foundation
+/* NamingSecurityException.java --
+ Copyright (C) 2000 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. */
- 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. */
-
package javax.naming;
import java.lang.Exception;
diff --git a/libjava/javax/naming/NoInitialContextException.java b/libjava/javax/naming/NoInitialContextException.java
index 1d13939c210..a1220dfb879 100644
--- a/libjava/javax/naming/NoInitialContextException.java
+++ b/libjava/javax/naming/NoInitialContextException.java
@@ -1,11 +1,41 @@
-/* Copyright (C) 2000 Free Software Foundation
+/* NoInitialContextException.java --
+ Copyright (C) 2000 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. */
- 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. */
-
package javax.naming;
import java.lang.Exception;
diff --git a/libjava/javax/naming/NoPermissionException.java b/libjava/javax/naming/NoPermissionException.java
index 4d1ceb5a3b2..261b7ff2614 100644
--- a/libjava/javax/naming/NoPermissionException.java
+++ b/libjava/javax/naming/NoPermissionException.java
@@ -1,11 +1,41 @@
-/* Copyright (C) 2000 Free Software Foundation
+/* NoPermissionException.java --
+ Copyright (C) 2000 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. */
- 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. */
-
package javax.naming;
import java.lang.Exception;
diff --git a/libjava/javax/naming/NotContextException.java b/libjava/javax/naming/NotContextException.java
index 7a681b9981d..87edeb31967 100644
--- a/libjava/javax/naming/NotContextException.java
+++ b/libjava/javax/naming/NotContextException.java
@@ -1,11 +1,41 @@
-/* Copyright (C) 2000 Free Software Foundation
+/* NotContextException.java --
+ Copyright (C) 2000 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. */
- 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. */
-
package javax.naming;
import java.lang.Exception;
diff --git a/libjava/javax/naming/OperationNotSupportedException.java b/libjava/javax/naming/OperationNotSupportedException.java
index 6259b1ee535..7278118d905 100644
--- a/libjava/javax/naming/OperationNotSupportedException.java
+++ b/libjava/javax/naming/OperationNotSupportedException.java
@@ -1,11 +1,41 @@
-/* Copyright (C) 2000 Free Software Foundation
+/* OperationNotSupportedException.java --
+ Copyright (C) 2000 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. */
- 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. */
-
package javax.naming;
public class OperationNotSupportedException extends NamingException
diff --git a/libjava/javax/naming/PartialResultException.java b/libjava/javax/naming/PartialResultException.java
index 4e827d69217..6f323d59dcf 100644
--- a/libjava/javax/naming/PartialResultException.java
+++ b/libjava/javax/naming/PartialResultException.java
@@ -1,11 +1,41 @@
-/* Copyright (C) 2000 Free Software Foundation
+/* PartialResultException.java --
+ Copyright (C) 2000 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. */
- 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. */
-
package javax.naming;
import java.lang.Exception;
diff --git a/libjava/javax/naming/RefAddr.java b/libjava/javax/naming/RefAddr.java
index 2bccdfab8c0..a1c096c10d8 100644
--- a/libjava/javax/naming/RefAddr.java
+++ b/libjava/javax/naming/RefAddr.java
@@ -61,7 +61,7 @@ public abstract class RefAddr implements Serializable
* The string resprenstation of the type of address.
* Set by the constructor and returned by the getType() method.
*/
- protected final String addrType;
+ protected String addrType;
/**
* Protected constructor for use by subclasses.
@@ -71,9 +71,9 @@ public abstract class RefAddr implements Serializable
*/
protected RefAddr(String addrType)
{
- if (addrType == null)
- throw new NullPointerException("addrType cannot be null");
-
+ if (addrType == null)
+ throw new NullPointerException("addrType cannot be null");
+
this.addrType = addrType;
}
@@ -98,20 +98,20 @@ public abstract class RefAddr implements Serializable
* is the same as this addrType and the content is equals to the
* content of this object.
*/
- public boolean equals (Object o)
+ public boolean equals(Object o)
{
if (o instanceof RefAddr)
{
RefAddr refAddr = (RefAddr) o;
if (this.getType().equals(refAddr.getType()))
- {
- Object c1 = this.getContent();
- Object c2 = refAddr.getContent();
- if (c1 == null)
- return c2 == null;
- else
- return c1.equals(c2);
- }
+ {
+ Object c1 = this.getContent();
+ Object c2 = refAddr.getContent();
+ if (c1 == null)
+ return c2 == null;
+ else
+ return c1.equals(c2);
+ }
}
return false;
}
diff --git a/libjava/javax/naming/Reference.java b/libjava/javax/naming/Reference.java
index dbd3418cfe2..7309ebd293f 100644
--- a/libjava/javax/naming/Reference.java
+++ b/libjava/javax/naming/Reference.java
@@ -1,10 +1,40 @@
-/* Copyright (C) 2000, 2001 Free Software Foundation
+/* Reference.java --
+ Copyright (C) 2000, 2001 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. */
- 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. */
package javax.naming;
diff --git a/libjava/javax/naming/Referenceable.java b/libjava/javax/naming/Referenceable.java
index feb97fc63c5..50170b9ac4d 100644
--- a/libjava/javax/naming/Referenceable.java
+++ b/libjava/javax/naming/Referenceable.java
@@ -1,10 +1,40 @@
-/* Copyright (C) 2000 Free Software Foundation
+/* Referenceable.java --
+ Copyright (C) 2000 Free Software Foundation, Inc.
- This file is part of libgcj.
+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. */
-This software is copyrighted work licensed under the terms of the
-Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
-details. */
package javax.naming;
diff --git a/libjava/javax/naming/ReferralException.java b/libjava/javax/naming/ReferralException.java
index 9e815f969b0..5becc6b3162 100644
--- a/libjava/javax/naming/ReferralException.java
+++ b/libjava/javax/naming/ReferralException.java
@@ -1,11 +1,41 @@
-/* Copyright (C) 2001 Free Software Foundation
+/* ReferralException.java --
+ Copyright (C) 2001 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. */
- 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. */
-
package javax.naming;
import java.lang.Exception;
diff --git a/libjava/javax/naming/ServiceUnavailableException.java b/libjava/javax/naming/ServiceUnavailableException.java
index de76f286f6a..43aee5354f7 100644
--- a/libjava/javax/naming/ServiceUnavailableException.java
+++ b/libjava/javax/naming/ServiceUnavailableException.java
@@ -1,11 +1,41 @@
-/* Copyright (C) 2000 Free Software Foundation
+/* ServiceUnavailableException.java --
+ Copyright (C) 2000 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. */
- 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. */
-
package javax.naming;
import java.lang.Exception;
diff --git a/libjava/javax/naming/SizeLimitExceededException.java b/libjava/javax/naming/SizeLimitExceededException.java
index 2d6c1e6db49..5d4414f7bf4 100644
--- a/libjava/javax/naming/SizeLimitExceededException.java
+++ b/libjava/javax/naming/SizeLimitExceededException.java
@@ -1,11 +1,41 @@
-/* Copyright (C) 2000 Free Software Foundation
+/* SizeLimitExceededException.java --
+ Copyright (C) 2000 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. */
- 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. */
-
package javax.naming;
import java.lang.Exception;
diff --git a/libjava/javax/naming/TimeLimitExceededException.java b/libjava/javax/naming/TimeLimitExceededException.java
index d3124f4c605..dc8dadf1e33 100644
--- a/libjava/javax/naming/TimeLimitExceededException.java
+++ b/libjava/javax/naming/TimeLimitExceededException.java
@@ -1,11 +1,41 @@
-/* Copyright (C) 2000 Free Software Foundation
+/* TimeLimitExceededException.java --
+ Copyright (C) 2000 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. */
- 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. */
-
package javax.naming;
import java.lang.Exception;
diff --git a/libjava/javax/naming/directory/Attribute.java b/libjava/javax/naming/directory/Attribute.java
index 5c2b933871c..d04a12c36f4 100644
--- a/libjava/javax/naming/directory/Attribute.java
+++ b/libjava/javax/naming/directory/Attribute.java
@@ -1,11 +1,41 @@
-/* Copyright (C) 2001 Free Software Foundation
+/* Attribute.java --
+ Copyright (C) 2001 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. */
- 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. */
-
package javax.naming.directory;
import javax.naming.*;
diff --git a/libjava/javax/naming/directory/AttributeInUseException.java b/libjava/javax/naming/directory/AttributeInUseException.java
index 118d991f9e2..70959554270 100644
--- a/libjava/javax/naming/directory/AttributeInUseException.java
+++ b/libjava/javax/naming/directory/AttributeInUseException.java
@@ -1,10 +1,40 @@
-/* Copyright (C) 2000, 2001 Free Software Foundation
+/* AttributeInUseException.java --
+ Copyright (C) 2000, 2001 Free Software Foundation, Inc.
- This file is part of libgcj.
+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. */
-This software is copyrighted work licensed under the terms of the
-Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
-details. */
package javax.naming.directory;
diff --git a/libjava/javax/naming/directory/AttributeModificationException.java b/libjava/javax/naming/directory/AttributeModificationException.java
index 898f7a4689e..0012458007b 100644
--- a/libjava/javax/naming/directory/AttributeModificationException.java
+++ b/libjava/javax/naming/directory/AttributeModificationException.java
@@ -1,11 +1,41 @@
-/* Copyright (C) 2001 Free Software Foundation
+/* AttributeModificationException.java --
+ Copyright (C) 2001 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. */
- 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. */
-
package javax.naming.directory;
import javax.naming.NamingException;
diff --git a/libjava/javax/naming/directory/Attributes.java b/libjava/javax/naming/directory/Attributes.java
index f76d593cd60..7f5ac47c210 100644
--- a/libjava/javax/naming/directory/Attributes.java
+++ b/libjava/javax/naming/directory/Attributes.java
@@ -1,11 +1,41 @@
-/* Copyright (C) 2001 Free Software Foundation
+/* Attributes.java --
+ Copyright (C) 2001 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. */
- 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. */
-
package javax.naming.directory;
import javax.naming.*;
diff --git a/libjava/javax/naming/directory/BasicAttribute.java b/libjava/javax/naming/directory/BasicAttribute.java
index 8ccb67abc40..6bf77f1712e 100644
--- a/libjava/javax/naming/directory/BasicAttribute.java
+++ b/libjava/javax/naming/directory/BasicAttribute.java
@@ -1,10 +1,40 @@
-/* Copyright (C) 2000, 2001 Free Software Foundation
+/* BasicAttribute.java --
+ Copyright (C) 2000, 2001 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. */
- 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. */
package javax.naming.directory;
diff --git a/libjava/javax/naming/directory/BasicAttributes.java b/libjava/javax/naming/directory/BasicAttributes.java
index 935612c2277..331a3c2a3e7 100644
--- a/libjava/javax/naming/directory/BasicAttributes.java
+++ b/libjava/javax/naming/directory/BasicAttributes.java
@@ -1,10 +1,40 @@
-/* Copyright (C) 2000, 2001 Free Software Foundation
+/* BasicAttributes.java --
+ Copyright (C) 2000, 2001 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. */
- 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. */
package javax.naming.directory;
diff --git a/libjava/javax/naming/directory/DirContext.java b/libjava/javax/naming/directory/DirContext.java
index 4b82231e6d4..aabad173e38 100644
--- a/libjava/javax/naming/directory/DirContext.java
+++ b/libjava/javax/naming/directory/DirContext.java
@@ -1,11 +1,41 @@
-/* Copyright (C) 2001 Free Software Foundation
+/* DirContext.java --
+ Copyright (C) 2001 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. */
- 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. */
-
package javax.naming.directory;
import javax.naming.*;
diff --git a/libjava/javax/naming/directory/InitialDirContext.java b/libjava/javax/naming/directory/InitialDirContext.java
index 185528f699b..05c48af89ad 100644
--- a/libjava/javax/naming/directory/InitialDirContext.java
+++ b/libjava/javax/naming/directory/InitialDirContext.java
@@ -1,10 +1,40 @@
-/* Copyright (C) 2000, 2001 Free Software Foundation
+/* InitialDirContext.java --
+ Copyright (C) 2000, 2001 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. */
- 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. */
package javax.naming.directory;
diff --git a/libjava/javax/naming/directory/InvalidAttributeIdentifierException.java b/libjava/javax/naming/directory/InvalidAttributeIdentifierException.java
index 3c2b38f222c..e48d4835261 100644
--- a/libjava/javax/naming/directory/InvalidAttributeIdentifierException.java
+++ b/libjava/javax/naming/directory/InvalidAttributeIdentifierException.java
@@ -1,11 +1,41 @@
-/* Copyright (C) 2000, 2001 Free Software Foundation
+/* InvalidAttributeIdentifierException.java --
+ Copyright (C) 2000, 2001 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. */
- 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. */
-
package javax.naming.directory;
import javax.naming.NamingException;
diff --git a/libjava/javax/naming/directory/InvalidAttributeValueException.java b/libjava/javax/naming/directory/InvalidAttributeValueException.java
index 5a07604a57a..b9f62237f44 100644
--- a/libjava/javax/naming/directory/InvalidAttributeValueException.java
+++ b/libjava/javax/naming/directory/InvalidAttributeValueException.java
@@ -1,11 +1,41 @@
-/* Copyright (C) 2000, 2001 Free Software Foundation
+/* InvalidAttributeValueException.java --
+ Copyright (C) 2000, 2001 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. */
- 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. */
-
package javax.naming.directory;
import javax.naming.NamingException;
diff --git a/libjava/javax/naming/directory/InvalidAttributesException.java b/libjava/javax/naming/directory/InvalidAttributesException.java
index ce13acb124d..a7a8cc61f27 100644
--- a/libjava/javax/naming/directory/InvalidAttributesException.java
+++ b/libjava/javax/naming/directory/InvalidAttributesException.java
@@ -1,11 +1,41 @@
-/* Copyright (C) 2000, 2001 Free Software Foundation
+/* InvalidAttributesException.java --
+ Copyright (C) 2000, 2001 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. */
- 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. */
-
package javax.naming.directory;
import javax.naming.NamingException;
diff --git a/libjava/javax/naming/directory/InvalidSearchControlsException.java b/libjava/javax/naming/directory/InvalidSearchControlsException.java
index f0c535a7d92..38325cee4b4 100644
--- a/libjava/javax/naming/directory/InvalidSearchControlsException.java
+++ b/libjava/javax/naming/directory/InvalidSearchControlsException.java
@@ -1,11 +1,41 @@
-/* Copyright (C) 2000, 2001 Free Software Foundation
+/* InvalidSearchControlsException.java --
+ Copyright (C) 2000, 2001 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. */
- 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. */
-
package javax.naming.directory;
import javax.naming.NamingException;
diff --git a/libjava/javax/naming/directory/InvalidSearchFilterException.java b/libjava/javax/naming/directory/InvalidSearchFilterException.java
index e1bb61c9295..b6e009c8894 100644
--- a/libjava/javax/naming/directory/InvalidSearchFilterException.java
+++ b/libjava/javax/naming/directory/InvalidSearchFilterException.java
@@ -1,11 +1,41 @@
-/* Copyright (C) 2000, 2001 Free Software Foundation
+/* InvalidSearchFilterException.java --
+ Copyright (C) 2000, 2001 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. */
- 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. */
-
package javax.naming.directory;
import javax.naming.NamingException;
diff --git a/libjava/javax/naming/directory/ModificationItem.java b/libjava/javax/naming/directory/ModificationItem.java
index 963abee883e..b32fd6f7aa5 100644
--- a/libjava/javax/naming/directory/ModificationItem.java
+++ b/libjava/javax/naming/directory/ModificationItem.java
@@ -1,11 +1,41 @@
-/* Copyright (C) 2001 Free Software Foundation
+/* ModificationItem.java --
+ Copyright (C) 2001 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. */
- 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. */
-
package javax.naming.directory;
import java.io.Serializable;
diff --git a/libjava/javax/naming/directory/NoSuchAttributeException.java b/libjava/javax/naming/directory/NoSuchAttributeException.java
index 0c5ee1c3bc2..48598bba628 100644
--- a/libjava/javax/naming/directory/NoSuchAttributeException.java
+++ b/libjava/javax/naming/directory/NoSuchAttributeException.java
@@ -1,11 +1,41 @@
-/* Copyright (C) 2000, 2001 Free Software Foundation
+/* NoSuchAttributeException.java --
+ Copyright (C) 2000, 2001 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. */
- 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. */
-
package javax.naming.directory;
import javax.naming.NamingException;
diff --git a/libjava/javax/naming/directory/SchemaViolationException.java b/libjava/javax/naming/directory/SchemaViolationException.java
index 6fc5b1d4090..56afc114733 100644
--- a/libjava/javax/naming/directory/SchemaViolationException.java
+++ b/libjava/javax/naming/directory/SchemaViolationException.java
@@ -1,11 +1,41 @@
-/* Copyright (C) 2000, 2001 Free Software Foundation
+/* SchemaViolationException.java --
+ Copyright (C) 2000, 2001 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. */
- 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. */
-
package javax.naming.directory;
import javax.naming.NamingException;
diff --git a/libjava/javax/naming/directory/SearchControls.java b/libjava/javax/naming/directory/SearchControls.java
index d2b3e2453a9..21b97403f65 100644
--- a/libjava/javax/naming/directory/SearchControls.java
+++ b/libjava/javax/naming/directory/SearchControls.java
@@ -1,11 +1,41 @@
-/* Copyright (C) 2001 Free Software Foundation
+/* SearchControls.java --
+ Copyright (C) 2001 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. */
- 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. */
-
package javax.naming.directory;
import java.io.Serializable;
diff --git a/libjava/javax/naming/directory/SearchResult.java b/libjava/javax/naming/directory/SearchResult.java
index 956c32cd502..5d339635566 100644
--- a/libjava/javax/naming/directory/SearchResult.java
+++ b/libjava/javax/naming/directory/SearchResult.java
@@ -1,11 +1,41 @@
-/* Copyright (C) 2001 Free Software Foundation
+/* SearchResult.java --
+ Copyright (C) 2001 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. */
- 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. */
-
package javax.naming.directory;
import javax.naming.*;
import java.io.Serializable;
diff --git a/libjava/javax/naming/event/EventContext.java b/libjava/javax/naming/event/EventContext.java
index 80565391bb4..c4936ab4419 100644
--- a/libjava/javax/naming/event/EventContext.java
+++ b/libjava/javax/naming/event/EventContext.java
@@ -1,11 +1,41 @@
-/* Copyright (C) 2001 Free Software Foundation
+/* EventContext.java --
+ Copyright (C) 2001 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. */
- 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. */
-
package javax.naming.event;
import javax.naming.*;
diff --git a/libjava/javax/naming/event/EventDirContext.java b/libjava/javax/naming/event/EventDirContext.java
index 7321d0cc2c2..0c3a5d14347 100644
--- a/libjava/javax/naming/event/EventDirContext.java
+++ b/libjava/javax/naming/event/EventDirContext.java
@@ -1,11 +1,41 @@
-/* Copyright (C) 2001 Free Software Foundation
+/* EventDirContext.java --
+ Copyright (C) 2001 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. */
- 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. */
-
package javax.naming.event;
import javax.naming.*;
import javax.naming.directory.*;
diff --git a/libjava/javax/naming/event/NamespaceChangeListener.java b/libjava/javax/naming/event/NamespaceChangeListener.java
index 5469d0437b2..9eeecd0eee5 100644
--- a/libjava/javax/naming/event/NamespaceChangeListener.java
+++ b/libjava/javax/naming/event/NamespaceChangeListener.java
@@ -1,11 +1,41 @@
-/* Copyright (C) 2001 Free Software Foundation
+/* NamespaceChangeListener.java --
+ Copyright (C) 2001 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. */
- 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. */
-
package javax.naming.event;
/**
diff --git a/libjava/javax/naming/event/NamingEvent.java b/libjava/javax/naming/event/NamingEvent.java
index 3151dd84024..2415704e122 100644
--- a/libjava/javax/naming/event/NamingEvent.java
+++ b/libjava/javax/naming/event/NamingEvent.java
@@ -1,11 +1,41 @@
-/* Copyright (C) 2001 Free Software Foundation
+/* NamingEvent.java --
+ Copyright (C) 2001 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. */
- 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. */
-
package javax.naming.event;
import javax.naming.*;
import java.util.EventObject;
diff --git a/libjava/javax/naming/event/NamingExceptionEvent.java b/libjava/javax/naming/event/NamingExceptionEvent.java
index 2cbdcb1141f..79f23dd3844 100644
--- a/libjava/javax/naming/event/NamingExceptionEvent.java
+++ b/libjava/javax/naming/event/NamingExceptionEvent.java
@@ -1,11 +1,41 @@
-/* Copyright (C) 2001 Free Software Foundation
+/* NamingExceptionEvent.java --
+ Copyright (C) 2001 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. */
- 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. */
-
package javax.naming.event;
import javax.naming.*;
import java.util.EventObject;
diff --git a/libjava/javax/naming/event/NamingListener.java b/libjava/javax/naming/event/NamingListener.java
index b631ccb384e..59ff4185a72 100644
--- a/libjava/javax/naming/event/NamingListener.java
+++ b/libjava/javax/naming/event/NamingListener.java
@@ -1,11 +1,41 @@
-/* Copyright (C) 2001 Free Software Foundation
+/* NamingListener.java --
+ Copyright (C) 2001 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. */
- 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. */
-
package javax.naming.event;
import java.util.EventListener;
diff --git a/libjava/javax/naming/event/ObjectChangeListener.java b/libjava/javax/naming/event/ObjectChangeListener.java
index 9da3473a9d6..99426bbd8ac 100644
--- a/libjava/javax/naming/event/ObjectChangeListener.java
+++ b/libjava/javax/naming/event/ObjectChangeListener.java
@@ -1,11 +1,41 @@
-/* Copyright (C) 2001 Free Software Foundation
+/* ObjectChangeListener.java --
+ Copyright (C) 2001 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. */
- 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. */
-
package javax.naming.event;
/**
diff --git a/libjava/javax/naming/ldap/Control.java b/libjava/javax/naming/ldap/Control.java
index 156af9661ae..7fed89418b3 100644
--- a/libjava/javax/naming/ldap/Control.java
+++ b/libjava/javax/naming/ldap/Control.java
@@ -1,11 +1,41 @@
-/* Copyright (C) 2001 Free Software Foundation
+/* Control.java --
+ Copyright (C) 2001 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. */
- 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. */
-
package javax.naming.ldap;
import java.io.Serializable;
diff --git a/libjava/javax/naming/ldap/ControlFactory.java b/libjava/javax/naming/ldap/ControlFactory.java
index 8c988ab16dd..a9acd3d7e48 100644
--- a/libjava/javax/naming/ldap/ControlFactory.java
+++ b/libjava/javax/naming/ldap/ControlFactory.java
@@ -1,11 +1,41 @@
-/* Copyright (C) 2001 Free Software Foundation
+/* ControlFactory.java --
+ Copyright (C) 2001 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. */
- 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. */
-
package javax.naming.ldap;
import javax.naming.*;
diff --git a/libjava/javax/naming/ldap/ExtendedRequest.java b/libjava/javax/naming/ldap/ExtendedRequest.java
index af5a0fbabf9..dd6b538a669 100644
--- a/libjava/javax/naming/ldap/ExtendedRequest.java
+++ b/libjava/javax/naming/ldap/ExtendedRequest.java
@@ -1,11 +1,41 @@
-/* Copyright (C) 2001 Free Software Foundation
+/* ExtendedRequest.java --
+ Copyright (C) 2001 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. */
- 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. */
-
package javax.naming.ldap;
import java.io.Serializable;
import javax.naming.*;
diff --git a/libjava/javax/naming/ldap/ExtendedResponse.java b/libjava/javax/naming/ldap/ExtendedResponse.java
index 73dd96ebed2..3591e6ddb9d 100644
--- a/libjava/javax/naming/ldap/ExtendedResponse.java
+++ b/libjava/javax/naming/ldap/ExtendedResponse.java
@@ -1,11 +1,41 @@
-/* Copyright (C) 2001 Free Software Foundation
+/* ExtendedResponse.java --
+ Copyright (C) 2001 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. */
- 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. */
-
package javax.naming.ldap;
import java.io.Serializable;
diff --git a/libjava/javax/naming/ldap/HasControls.java b/libjava/javax/naming/ldap/HasControls.java
index c37d30c3ede..bf4b0018412 100644
--- a/libjava/javax/naming/ldap/HasControls.java
+++ b/libjava/javax/naming/ldap/HasControls.java
@@ -1,11 +1,41 @@
-/* Copyright (C) 2001 Free Software Foundation
+/* HasControls.java --
+ Copyright (C) 2001 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. */
- 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. */
-
package javax.naming.ldap;
import javax.naming.*;
diff --git a/libjava/javax/naming/ldap/InitialLdapContext.java b/libjava/javax/naming/ldap/InitialLdapContext.java
index 88d0e26ec65..7a7d7ad720f 100644
--- a/libjava/javax/naming/ldap/InitialLdapContext.java
+++ b/libjava/javax/naming/ldap/InitialLdapContext.java
@@ -1,11 +1,41 @@
-/* Copyright (C) 2001 Free Software Foundation
+/* InitialLdapContext.java --
+ Copyright (C) 2001 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. */
- 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. */
-
package javax.naming.ldap;
import javax.naming.*;
diff --git a/libjava/javax/naming/ldap/LdapContext.java b/libjava/javax/naming/ldap/LdapContext.java
index 204269e337b..c61639434ce 100644
--- a/libjava/javax/naming/ldap/LdapContext.java
+++ b/libjava/javax/naming/ldap/LdapContext.java
@@ -1,11 +1,41 @@
-/* Copyright (C) 2001 Free Software Foundation
+/* LdapContext.java --
+ Copyright (C) 2001 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. */
- 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. */
-
package javax.naming.ldap;
import javax.naming.*;
import javax.naming.directory.*;
diff --git a/libjava/javax/naming/ldap/LdapReferralException.java b/libjava/javax/naming/ldap/LdapReferralException.java
index 165371052c5..a4b4f0a622c 100644
--- a/libjava/javax/naming/ldap/LdapReferralException.java
+++ b/libjava/javax/naming/ldap/LdapReferralException.java
@@ -1,11 +1,41 @@
-/* Copyright (C) 2001 Free Software Foundation
+/* LdapReferralException.java --
+ Copyright (C) 2001 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. */
- 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. */
-
package javax.naming.ldap;
import javax.naming.*;
import java.util.Hashtable;
diff --git a/libjava/javax/naming/ldap/UnsolicitedNotification.java b/libjava/javax/naming/ldap/UnsolicitedNotification.java
index 539d5999267..b185d798a76 100644
--- a/libjava/javax/naming/ldap/UnsolicitedNotification.java
+++ b/libjava/javax/naming/ldap/UnsolicitedNotification.java
@@ -1,11 +1,41 @@
-/* Copyright (C) 2001 Free Software Foundation
+/* UnsolicitedNotification.java --
+ Copyright (C) 2001 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. */
- 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. */
-
package javax.naming.ldap;
import javax.naming.*;
diff --git a/libjava/javax/naming/ldap/UnsolicitedNotificationEvent.java b/libjava/javax/naming/ldap/UnsolicitedNotificationEvent.java
index fe1e4042bcd..93d9144232e 100644
--- a/libjava/javax/naming/ldap/UnsolicitedNotificationEvent.java
+++ b/libjava/javax/naming/ldap/UnsolicitedNotificationEvent.java
@@ -1,11 +1,41 @@
-/* Copyright (C) 2001 Free Software Foundation
+/* UnsolicitedNotificationEvent.java --
+ Copyright (C) 2001 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. */
- 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. */
-
package javax.naming.ldap;
import java.util.EventObject;
diff --git a/libjava/javax/naming/ldap/UnsolicitedNotificationListener.java b/libjava/javax/naming/ldap/UnsolicitedNotificationListener.java
index 2f22a618096..c01f5453299 100644
--- a/libjava/javax/naming/ldap/UnsolicitedNotificationListener.java
+++ b/libjava/javax/naming/ldap/UnsolicitedNotificationListener.java
@@ -1,11 +1,41 @@
-/* Copyright (C) 2001 Free Software Foundation
+/* UnsolicitedNotificationListener.java --
+ Copyright (C) 2001 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. */
- 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. */
-
package javax.naming.ldap;
import javax.naming.event.*;
diff --git a/libjava/javax/naming/spi/DirObjectFactory.java b/libjava/javax/naming/spi/DirObjectFactory.java
index 6749ff31634..c80aeeb5c4b 100644
--- a/libjava/javax/naming/spi/DirObjectFactory.java
+++ b/libjava/javax/naming/spi/DirObjectFactory.java
@@ -1,11 +1,41 @@
-/* Copyright (C) 2001 Free Software Foundation
+/* DirObjectFactory.java --
+ Copyright (C) 2001 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. */
- 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. */
-
package javax.naming.spi;
import javax.naming.*;
import javax.naming.directory.*;
diff --git a/libjava/javax/naming/spi/DirStateFactory.java b/libjava/javax/naming/spi/DirStateFactory.java
index dbd35c7cc3c..03d6c8d1cda 100644
--- a/libjava/javax/naming/spi/DirStateFactory.java
+++ b/libjava/javax/naming/spi/DirStateFactory.java
@@ -1,11 +1,41 @@
-/* Copyright (C) 2001 Free Software Foundation
+/* DirStateFactory.java --
+ Copyright (C) 2001 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. */
- 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. */
-
package javax.naming.spi;
import javax.naming.*;
import javax.naming.directory.*;
diff --git a/libjava/javax/naming/spi/DirectoryManager.java b/libjava/javax/naming/spi/DirectoryManager.java
index 33872f41594..78b960c745f 100644
--- a/libjava/javax/naming/spi/DirectoryManager.java
+++ b/libjava/javax/naming/spi/DirectoryManager.java
@@ -1,10 +1,40 @@
-/* Copyright (C) 2000, 2001 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. */
+/* DirectoryManager.java --
+ Copyright (C) 2000, 2001 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 javax.naming.spi;
diff --git a/libjava/javax/naming/spi/InitialContextFactory.java b/libjava/javax/naming/spi/InitialContextFactory.java
index 493b3f5234f..57a421ecf88 100644
--- a/libjava/javax/naming/spi/InitialContextFactory.java
+++ b/libjava/javax/naming/spi/InitialContextFactory.java
@@ -1,10 +1,40 @@
-/* Copyright (C) 2000 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. */
+/* InitialContextFactory.java --
+ Copyright (C) 2000 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 javax.naming.spi;
diff --git a/libjava/javax/naming/spi/InitialContextFactoryBuilder.java b/libjava/javax/naming/spi/InitialContextFactoryBuilder.java
index e4ae85f7d3e..39d7eeb0d67 100644
--- a/libjava/javax/naming/spi/InitialContextFactoryBuilder.java
+++ b/libjava/javax/naming/spi/InitialContextFactoryBuilder.java
@@ -1,10 +1,40 @@
-/* Copyright (C) 2000 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. */
+/* InitialContextFactoryBuilder.java --
+ Copyright (C) 2000 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 javax.naming.spi;
diff --git a/libjava/javax/naming/spi/NamingManager.java b/libjava/javax/naming/spi/NamingManager.java
index d3f419f00b4..bb3d87253d7 100644
--- a/libjava/javax/naming/spi/NamingManager.java
+++ b/libjava/javax/naming/spi/NamingManager.java
@@ -1,10 +1,40 @@
-/* Copyright (C) 2000, 2001, 2002 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. */
+/* NamingManager.java --
+ Copyright (C) 2000, 2001, 2002 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 javax.naming.spi;
@@ -16,7 +46,9 @@ public class NamingManager
public static final String CPE = "java.naming.spi.CannotProceedException";
private static InitialContextFactoryBuilder icfb = null;
- private static ObjectFactoryBuilder ofb = null;
+
+ // Package private so DirectoryManager can access it.
+ static ObjectFactoryBuilder ofb = null;
// This class cannot be instantiated.
NamingManager ()
diff --git a/libjava/javax/naming/spi/ObjectFactory.java b/libjava/javax/naming/spi/ObjectFactory.java
index 81896287948..5b291f04cf8 100644
--- a/libjava/javax/naming/spi/ObjectFactory.java
+++ b/libjava/javax/naming/spi/ObjectFactory.java
@@ -1,10 +1,40 @@
-/* Copyright (C) 2001 Free Software Foundation
+/* ObjectFactory.java --
+ Copyright (C) 2001 Free Software Foundation, Inc.
- This file is part of libgcj.
+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. */
-This software is copyrighted work licensed under the terms of the
-Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
-details. */
package javax.naming.spi;
diff --git a/libjava/javax/naming/spi/ObjectFactoryBuilder.java b/libjava/javax/naming/spi/ObjectFactoryBuilder.java
index e8796036aa4..828f5c93535 100644
--- a/libjava/javax/naming/spi/ObjectFactoryBuilder.java
+++ b/libjava/javax/naming/spi/ObjectFactoryBuilder.java
@@ -1,11 +1,41 @@
-/* Copyright (C) 2001 Free Software Foundation
+/* ObjectFactoryBuilder.java --
+ Copyright (C) 2001 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. */
- 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. */
-
package javax.naming.spi;
import javax.naming.*;
import java.util.Hashtable;
diff --git a/libjava/javax/naming/spi/ResolveResult.java b/libjava/javax/naming/spi/ResolveResult.java
index d00aef581f4..7e34e3c7dd5 100644
--- a/libjava/javax/naming/spi/ResolveResult.java
+++ b/libjava/javax/naming/spi/ResolveResult.java
@@ -1,11 +1,41 @@
-/* Copyright (C) 2001 Free Software Foundation
+/* ResolveResult.java --
+ Copyright (C) 2001 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. */
- 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. */
-
package javax.naming.spi;
import javax.naming.*;
import java.util.EventObject;
diff --git a/libjava/javax/naming/spi/Resolver.java b/libjava/javax/naming/spi/Resolver.java
index ff52f66382d..1cae847f1b1 100644
--- a/libjava/javax/naming/spi/Resolver.java
+++ b/libjava/javax/naming/spi/Resolver.java
@@ -1,11 +1,41 @@
-/* Copyright (C) 2001 Free Software Foundation
+/* Resolver.java --
+ Copyright (C) 2001 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. */
- 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. */
-
package javax.naming.spi;
import javax.naming.*;
diff --git a/libjava/javax/naming/spi/StateFactory.java b/libjava/javax/naming/spi/StateFactory.java
index 3be66d2bcc4..3f41b551de6 100644
--- a/libjava/javax/naming/spi/StateFactory.java
+++ b/libjava/javax/naming/spi/StateFactory.java
@@ -1,11 +1,41 @@
-/* Copyright (C) 2001 Free Software Foundation
+/* StateFactory.java --
+ Copyright (C) 2001 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. */
- 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. */
-
package javax.naming.spi;
import javax.naming.*;
import java.util.Hashtable;
diff --git a/libjava/javax/swing/AbstractListModel.java b/libjava/javax/swing/AbstractListModel.java
index 13518cafa19..f1033cf9781 100644
--- a/libjava/javax/swing/AbstractListModel.java
+++ b/libjava/javax/swing/AbstractListModel.java
@@ -188,6 +188,15 @@ public abstract class AbstractListModel implements ListModel, Serializable {
} // getListeners()
/**
+ * getListDataListeners
+ */
+ public ListDataListener[] getListDataListeners()
+ {
+ // FIXME: implement this
+ return null;
+ }
+
+ /**
* getElementAt
* @param index TODO
* @returns Object
diff --git a/libjava/javax/swing/DefaultBoundedRangeModel.java b/libjava/javax/swing/DefaultBoundedRangeModel.java
index 82ab7675890..a0b1abd618d 100644
--- a/libjava/javax/swing/DefaultBoundedRangeModel.java
+++ b/libjava/javax/swing/DefaultBoundedRangeModel.java
@@ -334,5 +334,14 @@ public class DefaultBoundedRangeModel implements BoundedRangeModel, Serializable
return listenerList.getListeners(c);
} // getListeners()
+ /**
+ * getChangeListeners
+ */
+ public ChangeListener[] getChangeListeners()
+ {
+ // FIXME: implement this
+ return null;
+ }
+
} // DefaultBoundedRangeModel
diff --git a/libjava/javax/swing/DefaultSingleSelectionModel.java b/libjava/javax/swing/DefaultSingleSelectionModel.java
index 50a35d9d9a5..a55c911c3a8 100644
--- a/libjava/javax/swing/DefaultSingleSelectionModel.java
+++ b/libjava/javax/swing/DefaultSingleSelectionModel.java
@@ -175,5 +175,14 @@ public class DefaultSingleSelectionModel implements
return listenerList.getListeners(listenerClass);
} // getListeners()
+ /**
+ * getChangeListeners
+ */
+ public ChangeListener[] getChangeListeners()
+ {
+ // FIXME: implement this
+ return null;
+ }
+
} // DefaultSingleSelectionModel
diff --git a/libjava/javax/transaction/HeuristicCommitException.java b/libjava/javax/transaction/HeuristicCommitException.java
index 0646a2352d1..e1ef8e2def2 100644
--- a/libjava/javax/transaction/HeuristicCommitException.java
+++ b/libjava/javax/transaction/HeuristicCommitException.java
@@ -1,11 +1,41 @@
-/* Copyright (C) 2001 Free Software Foundation
+/* HeuristicCommitException.java --
+ Copyright (C) 2001, 2002 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. */
- 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. */
-
package javax.transaction;
/**
@@ -13,7 +43,7 @@ package javax.transaction;
* @date May 25, 2001
*/
-public class HeuristicCommitException extends java.lang.Exception
+public class HeuristicCommitException extends Exception
{
public HeuristicCommitException ()
{
diff --git a/libjava/javax/transaction/HeuristicMixedException.java b/libjava/javax/transaction/HeuristicMixedException.java
index f351da32fe2..68986b60672 100644
--- a/libjava/javax/transaction/HeuristicMixedException.java
+++ b/libjava/javax/transaction/HeuristicMixedException.java
@@ -1,11 +1,41 @@
-/* Copyright (C) 2001 Free Software Foundation
+/* HeuristicMixedException.java --
+ Copyright (C) 2001, 2002 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. */
- 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. */
-
package javax.transaction;
/**
@@ -13,7 +43,7 @@ package javax.transaction;
* @date May 25, 2001
*/
-public class HeuristicMixedException extends java.lang.Exception
+public class HeuristicMixedException extends Exception
{
public HeuristicMixedException ()
{
diff --git a/libjava/javax/transaction/HeuristicRollbackException.java b/libjava/javax/transaction/HeuristicRollbackException.java
index 7ad3782710e..72ac3b4d4d5 100644
--- a/libjava/javax/transaction/HeuristicRollbackException.java
+++ b/libjava/javax/transaction/HeuristicRollbackException.java
@@ -1,11 +1,41 @@
-/* Copyright (C) 2001 Free Software Foundation
+/* HeuristicRollbackException.java --
+ Copyright (C) 2001, 2002 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. */
- 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. */
-
package javax.transaction;
/**
@@ -13,7 +43,7 @@ package javax.transaction;
* @date May 25, 2001
*/
-public class HeuristicRollbackException extends java.lang.Exception
+public class HeuristicRollbackException extends Exception
{
public HeuristicRollbackException ()
{
diff --git a/libjava/javax/transaction/InvalidTransactionException.java b/libjava/javax/transaction/InvalidTransactionException.java
index f5bb7184e2d..0c47912be46 100644
--- a/libjava/javax/transaction/InvalidTransactionException.java
+++ b/libjava/javax/transaction/InvalidTransactionException.java
@@ -1,11 +1,40 @@
-/* Copyright (C) 2001 Free Software Foundation
+/* InvalidTransactionException.java --
+ Copyright (C) 2001, 2002 Free Software Foundation, Inc.
- This file is part of libgcj.
+This file is part of GNU Classpath.
-This software is copyrighted work licensed under the terms of the
-Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
-details. */
+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 javax.transaction;
import java.rmi.RemoteException;
diff --git a/libjava/javax/transaction/NotSupportedException.java b/libjava/javax/transaction/NotSupportedException.java
index 767babbeba4..b239574fcb4 100644
--- a/libjava/javax/transaction/NotSupportedException.java
+++ b/libjava/javax/transaction/NotSupportedException.java
@@ -1,11 +1,41 @@
-/* Copyright (C) 2001 Free Software Foundation
+/* NotSupportedException.java --
+ Copyright (C) 2001, 2002 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. */
- 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. */
-
package javax.transaction;
/**
@@ -13,7 +43,7 @@ package javax.transaction;
* @date May 25, 2001
*/
-public class NotSupportedException extends java.lang.Exception
+public class NotSupportedException extends Exception
{
public NotSupportedException ()
{
diff --git a/libjava/javax/transaction/RollbackException.java b/libjava/javax/transaction/RollbackException.java
index 7bc77eeaa13..c8706f5bb86 100644
--- a/libjava/javax/transaction/RollbackException.java
+++ b/libjava/javax/transaction/RollbackException.java
@@ -1,11 +1,41 @@
-/* Copyright (C) 2001 Free Software Foundation
+/* RollbackException.java --
+ Copyright (C) 2001, 2002 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. */
- 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. */
-
package javax.transaction;
/**
@@ -13,7 +43,7 @@ package javax.transaction;
* @date May 25, 2001
*/
-public class RollbackException extends java.lang.Exception
+public class RollbackException extends Exception
{
public RollbackException ()
{
diff --git a/libjava/javax/transaction/Status.java b/libjava/javax/transaction/Status.java
index 84f1e7ca4c7..7068602b197 100644
--- a/libjava/javax/transaction/Status.java
+++ b/libjava/javax/transaction/Status.java
@@ -1,11 +1,41 @@
-/* Copyright (C) 2001 Free Software Foundation
+/* Status.java --
+ Copyright (C) 2001, 2002 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. */
- 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. */
-
package javax.transaction;
/**
@@ -13,7 +43,7 @@ package javax.transaction;
* @date May 25, 2001
*/
-public abstract interface Status
+public interface Status
{
public static final int STATUS_ACTIVE = 0;
public static final int STATUS_MARKED_ROLLBACK = 1;
diff --git a/libjava/javax/transaction/Synchronization.java b/libjava/javax/transaction/Synchronization.java
index 046f64d9cf8..7a1dfa5ce26 100644
--- a/libjava/javax/transaction/Synchronization.java
+++ b/libjava/javax/transaction/Synchronization.java
@@ -1,11 +1,41 @@
-/* Copyright (C) 2001 Free Software Foundation
+/* Synchronization.java --
+ Copyright (C) 2001, 2002 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. */
- 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. */
-
package javax.transaction;
/**
@@ -13,7 +43,7 @@ package javax.transaction;
* @date May 25, 2001
*/
-public abstract interface Synchronization
+public interface Synchronization
{
public void beforeCompletion();
public void afterCompletion(int status);
diff --git a/libjava/javax/transaction/SystemException.java b/libjava/javax/transaction/SystemException.java
index e279acaca35..ed9c9e4f273 100644
--- a/libjava/javax/transaction/SystemException.java
+++ b/libjava/javax/transaction/SystemException.java
@@ -1,11 +1,41 @@
-/* Copyright (C) 2001 Free Software Foundation
+/* SystemException.java --
+ Copyright (C) 2001, 2002 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. */
- 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. */
-
package javax.transaction;
/**
@@ -13,7 +43,7 @@ package javax.transaction;
* @date May 25, 2001
*/
-public class SystemException extends java.lang.Exception
+public class SystemException extends Exception
{
public int errorCode;
diff --git a/libjava/javax/transaction/Transaction.java b/libjava/javax/transaction/Transaction.java
index 632707c6ccc..11aca01211e 100644
--- a/libjava/javax/transaction/Transaction.java
+++ b/libjava/javax/transaction/Transaction.java
@@ -1,12 +1,43 @@
-/* Copyright (C) 2001 Free Software Foundation
+/* Transaction.java --
+ Copyright (C) 2001, 2002 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. */
- 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. */
-
package javax.transaction;
+
import javax.transaction.xa.XAResource;
/**
@@ -14,20 +45,26 @@ import javax.transaction.xa.XAResource;
* @date May 25, 2001
*/
-public abstract interface Transaction
+public interface Transaction
{
public void commit()
throws RollbackException, HeuristicMixedException,
- HeuristicRollbackException, java.lang.SecurityException, SystemException;
+ HeuristicRollbackException, SecurityException, SystemException;
+
public boolean delistResource(XAResource xaRes, int flag)
- throws java.lang.IllegalStateException, SystemException;
+ throws IllegalStateException, SystemException;
+
public boolean enlistResource(XAResource xaRes)
- throws RollbackException, java.lang.IllegalStateException, SystemException;
+ throws RollbackException, IllegalStateException, SystemException;
+
public int getStatus() throws SystemException;
+
public void registerSynchronization(Synchronization sync)
- throws RollbackException, java.lang.IllegalStateException, SystemException;
+ throws RollbackException, IllegalStateException, SystemException;
+
public void rollback()
- throws java.lang.IllegalStateException, SystemException;
+ throws IllegalStateException, SystemException;
+
public void setRollbackOnly()
- throws java.lang.IllegalStateException, SystemException;
+ throws IllegalStateException, SystemException;
}
diff --git a/libjava/javax/transaction/TransactionManager.java b/libjava/javax/transaction/TransactionManager.java
index 9f5f57cb351..e0501afb1c5 100644
--- a/libjava/javax/transaction/TransactionManager.java
+++ b/libjava/javax/transaction/TransactionManager.java
@@ -1,11 +1,41 @@
-/* Copyright (C) 2001 Free Software Foundation
+/* TransactionManager.java --
+ Copyright (C) 2001, 2002 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. */
- 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. */
-
package javax.transaction;
/**
@@ -13,23 +43,30 @@ package javax.transaction;
* @date May 25, 2001
*/
-public abstract interface TransactionManager
+public interface TransactionManager
{
public void begin() throws NotSupportedException, SystemException;
+
public void commit()
throws RollbackException, HeuristicMixedException,
- HeuristicRollbackException, java.lang.SecurityException,
- java.lang.IllegalStateException, SystemException;
+ HeuristicRollbackException, SecurityException,
+ IllegalStateException, SystemException;
+
public int getStatus() throws SystemException;
+
public Transaction getTransaction() throws SystemException;
+
public void resume(Transaction tobj)
- throws InvalidTransactionException, java.lang.IllegalStateException,
+ throws InvalidTransactionException, IllegalStateException,
SystemException;
+
public void rollback()
- throws java.lang.IllegalStateException, java.lang.SecurityException,
- SystemException;
+ throws IllegalStateException, SecurityException, SystemException;
+
public void setRollbackOnly()
- throws java.lang.IllegalStateException, SystemException;
+ throws IllegalStateException, SystemException;
+
public void setTransactionTimeout(int seconds) throws SystemException;
+
public Transaction suspend() throws SystemException;
}
diff --git a/libjava/javax/transaction/TransactionRequiredException.java b/libjava/javax/transaction/TransactionRequiredException.java
index e845a9ff0eb..ebc5679d941 100644
--- a/libjava/javax/transaction/TransactionRequiredException.java
+++ b/libjava/javax/transaction/TransactionRequiredException.java
@@ -1,11 +1,40 @@
-/* Copyright (C) 2001 Free Software Foundation
+/* TransactionRequiredException --
+ Copyright (C) 2001, 2002 Free Software Foundation, Inc.
- This file is part of libgcj.
+This file is part of GNU Classpath.
-This software is copyrighted work licensed under the terms of the
-Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
-details. */
+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 javax.transaction;
import java.rmi.RemoteException;
diff --git a/libjava/javax/transaction/TransactionRolledbackException.java b/libjava/javax/transaction/TransactionRolledbackException.java
index 96dd8dda1b0..ef4f1cc2641 100644
--- a/libjava/javax/transaction/TransactionRolledbackException.java
+++ b/libjava/javax/transaction/TransactionRolledbackException.java
@@ -1,11 +1,40 @@
-/* Copyright (C) 2001 Free Software Foundation
+/* TransactionRolledbackException --
+ Copyright (C) 2001, 2002 Free Software Foundation, Inc.
- This file is part of libgcj.
+This file is part of GNU Classpath.
-This software is copyrighted work licensed under the terms of the
-Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
-details. */
+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 javax.transaction;
import java.rmi.RemoteException;
diff --git a/libjava/javax/transaction/UserTransaction.java b/libjava/javax/transaction/UserTransaction.java
index eb02a6c4f23..fe8aad78a62 100644
--- a/libjava/javax/transaction/UserTransaction.java
+++ b/libjava/javax/transaction/UserTransaction.java
@@ -1,11 +1,41 @@
-/* Copyright (C) 2001 Free Software Foundation
+/* UserTransaction.java --
+ Copyright (C) 2001, 2002 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. */
- 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. */
-
package javax.transaction;
/**
@@ -13,18 +43,22 @@ package javax.transaction;
* @date May 25, 2001
*/
-public abstract interface UserTransaction
+public interface UserTransaction
{
public void begin() throws NotSupportedException, SystemException;
+
public void commit()
throws RollbackException, HeuristicMixedException,
- HeuristicRollbackException, java.lang.SecurityException,
- java.lang.IllegalStateException, SystemException;
+ HeuristicRollbackException, SecurityException,
+ IllegalStateException, SystemException;
+
public void rollback()
- throws java.lang.IllegalStateException, java.lang.SecurityException,
- SystemException;
+ throws IllegalStateException, SecurityException, SystemException;
+
public void setRollbackOnly()
- throws java.lang.IllegalStateException, SystemException;
+ throws IllegalStateException, SystemException;
+
public int getStatus() throws SystemException;
+
public void setTransactionTimeout(int seconds) throws SystemException;
}
diff --git a/libjava/javax/transaction/xa/XAException.java b/libjava/javax/transaction/xa/XAException.java
index 43ede1d93da..48c7ca8126d 100644
--- a/libjava/javax/transaction/xa/XAException.java
+++ b/libjava/javax/transaction/xa/XAException.java
@@ -1,11 +1,40 @@
-/* Copyright (C) 2001 Free Software Foundation
+/* XAException.java --
+ Copyright (C) 2001, 2002 Free Software Foundation, Inc.
- This file is part of libgcj.
+This file is part of GNU Classpath.
-This software is copyrighted work licensed under the terms of the
-Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
-details. */
+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 javax.transaction.xa;
/**
diff --git a/libjava/javax/transaction/xa/XAResource.java b/libjava/javax/transaction/xa/XAResource.java
index 226850ce35e..038923fded5 100644
--- a/libjava/javax/transaction/xa/XAResource.java
+++ b/libjava/javax/transaction/xa/XAResource.java
@@ -1,11 +1,40 @@
-/* Copyright (C) 2001 Free Software Foundation
+/* XAResource.java --
+ Copyright (C) 2001, 2002 Free Software Foundation, Inc.
- This file is part of libgcj.
+This file is part of GNU Classpath.
-This software is copyrighted work licensed under the terms of the
-Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
-details. */
+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 javax.transaction.xa;
/**
@@ -13,7 +42,7 @@ package javax.transaction.xa;
* @date May 25, 2001
*/
-public abstract interface XAResource
+public interface XAResource
{
public static final int TMENDRSCAN = 8388608;
public static final int TMFAIL = 536870912;
diff --git a/libjava/javax/transaction/xa/Xid.java b/libjava/javax/transaction/xa/Xid.java
index 2edf0c52c57..d509ccfaf47 100644
--- a/libjava/javax/transaction/xa/Xid.java
+++ b/libjava/javax/transaction/xa/Xid.java
@@ -1,11 +1,40 @@
-/* Copyright (C) 2001 Free Software Foundation
+/* Xid.java --
+ Copyright (C) 2001, 2002 Free Software Foundation, Inc.
- This file is part of libgcj.
+This file is part of GNU Classpath.
-This software is copyrighted work licensed under the terms of the
-Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
-details. */
+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 javax.transaction.xa;
/**
@@ -13,7 +42,7 @@ package javax.transaction.xa;
* @date May 25, 2001
*/
-public abstract interface Xid
+public interface Xid
{
public static final int MAXGTRIDSIZE = 64;
public static final int MAXBQUALSIZE = 64;
diff --git a/libjava/jni.cc b/libjava/jni.cc
index 8c404296b5c..44ea4118f89 100644
--- a/libjava/jni.cc
+++ b/libjava/jni.cc
@@ -217,7 +217,7 @@ unwrap (T *obj)
static jobject
-_Jv_JNI_NewGlobalRef (JNIEnv *, jobject obj)
+(JNICALL _Jv_JNI_NewGlobalRef) (JNIEnv *, jobject obj)
{
// This seems weird but I think it is correct.
obj = unwrap (obj);
@@ -226,7 +226,7 @@ _Jv_JNI_NewGlobalRef (JNIEnv *, jobject obj)
}
static void
-_Jv_JNI_DeleteGlobalRef (JNIEnv *, jobject obj)
+(JNICALL _Jv_JNI_DeleteGlobalRef) (JNIEnv *, jobject obj)
{
// This seems weird but I think it is correct.
obj = unwrap (obj);
@@ -234,7 +234,7 @@ _Jv_JNI_DeleteGlobalRef (JNIEnv *, jobject obj)
}
static void
-_Jv_JNI_DeleteLocalRef (JNIEnv *env, jobject obj)
+(JNICALL _Jv_JNI_DeleteLocalRef) (JNIEnv *env, jobject obj)
{
_Jv_JNI_LocalFrame *frame;
@@ -261,7 +261,7 @@ _Jv_JNI_DeleteLocalRef (JNIEnv *env, jobject obj)
}
static jint
-_Jv_JNI_EnsureLocalCapacity (JNIEnv *env, jint size)
+(JNICALL _Jv_JNI_EnsureLocalCapacity) (JNIEnv *env, jint size)
{
// It is easier to just always allocate a new frame of the requested
// size. This isn't the most efficient thing, but for now we don't
@@ -289,7 +289,7 @@ _Jv_JNI_EnsureLocalCapacity (JNIEnv *env, jint size)
}
static jint
-_Jv_JNI_PushLocalFrame (JNIEnv *env, jint size)
+(JNICALL _Jv_JNI_PushLocalFrame) (JNIEnv *env, jint size)
{
jint r = _Jv_JNI_EnsureLocalCapacity (env, size);
if (r < 0)
@@ -302,7 +302,7 @@ _Jv_JNI_PushLocalFrame (JNIEnv *env, jint size)
}
static jobject
-_Jv_JNI_NewLocalRef (JNIEnv *env, jobject obj)
+(JNICALL _Jv_JNI_NewLocalRef) (JNIEnv *env, jobject obj)
{
// This seems weird but I think it is correct.
obj = unwrap (obj);
@@ -343,7 +343,7 @@ _Jv_JNI_NewLocalRef (JNIEnv *env, jobject obj)
}
static jobject
-_Jv_JNI_PopLocalFrame (JNIEnv *env, jobject result, int stop)
+(JNICALL _Jv_JNI_PopLocalFrame) (JNIEnv *env, jobject result, int stop)
{
_Jv_JNI_LocalFrame *rf = env->locals;
@@ -378,7 +378,7 @@ _Jv_JNI_PopLocalFrame (JNIEnv *env, jobject result, int stop)
}
static jobject
-_Jv_JNI_PopLocalFrame (JNIEnv *env, jobject result)
+(JNICALL _Jv_JNI_PopLocalFrame) (JNIEnv *env, jobject result)
{
return _Jv_JNI_PopLocalFrame (env, result, MARK_USER);
}
@@ -422,14 +422,14 @@ wrap_value (JNIEnv *env, T *value)
static jint
-_Jv_JNI_GetVersion (JNIEnv *)
+(JNICALL _Jv_JNI_GetVersion) (JNIEnv *)
{
return JNI_VERSION_1_4;
}
static jclass
-_Jv_JNI_DefineClass (JNIEnv *env, jobject loader,
- const jbyte *buf, jsize bufLen)
+(JNICALL _Jv_JNI_DefineClass) (JNIEnv *env, jobject loader,
+ const jbyte *buf, jsize bufLen)
{
try
{
@@ -454,7 +454,7 @@ _Jv_JNI_DefineClass (JNIEnv *env, jobject loader,
}
static jclass
-_Jv_JNI_FindClass (JNIEnv *env, const char *name)
+(JNICALL _Jv_JNI_FindClass) (JNIEnv *env, const char *name)
{
// FIXME: assume that NAME isn't too long.
int len = strlen (name);
@@ -490,19 +490,19 @@ _Jv_JNI_FindClass (JNIEnv *env, const char *name)
}
static jclass
-_Jv_JNI_GetSuperclass (JNIEnv *env, jclass clazz)
+(JNICALL _Jv_JNI_GetSuperclass) (JNIEnv *env, jclass clazz)
{
return (jclass) wrap_value (env, unwrap (clazz)->getSuperclass ());
}
static jboolean
-_Jv_JNI_IsAssignableFrom(JNIEnv *, jclass clazz1, jclass clazz2)
+(JNICALL _Jv_JNI_IsAssignableFrom) (JNIEnv *, jclass clazz1, jclass clazz2)
{
return unwrap (clazz1)->isAssignableFrom (unwrap (clazz2));
}
static jint
-_Jv_JNI_Throw (JNIEnv *env, jthrowable obj)
+(JNICALL _Jv_JNI_Throw) (JNIEnv *env, jthrowable obj)
{
// We check in case the user did some funky cast.
obj = unwrap (obj);
@@ -512,7 +512,7 @@ _Jv_JNI_Throw (JNIEnv *env, jthrowable obj)
}
static jint
-_Jv_JNI_ThrowNew (JNIEnv *env, jclass clazz, const char *message)
+(JNICALL _Jv_JNI_ThrowNew) (JNIEnv *env, jclass clazz, const char *message)
{
using namespace java::lang::reflect;
@@ -549,32 +549,32 @@ _Jv_JNI_ThrowNew (JNIEnv *env, jclass clazz, const char *message)
}
static jthrowable
-_Jv_JNI_ExceptionOccurred (JNIEnv *env)
+(JNICALL _Jv_JNI_ExceptionOccurred) (JNIEnv *env)
{
return (jthrowable) wrap_value (env, env->ex);
}
static void
-_Jv_JNI_ExceptionDescribe (JNIEnv *env)
+(JNICALL _Jv_JNI_ExceptionDescribe) (JNIEnv *env)
{
if (env->ex != NULL)
env->ex->printStackTrace();
}
static void
-_Jv_JNI_ExceptionClear (JNIEnv *env)
+(JNICALL _Jv_JNI_ExceptionClear) (JNIEnv *env)
{
env->ex = NULL;
}
static jboolean
-_Jv_JNI_ExceptionCheck (JNIEnv *env)
+(JNICALL _Jv_JNI_ExceptionCheck) (JNIEnv *env)
{
return env->ex != NULL;
}
static void
-_Jv_JNI_FatalError (JNIEnv *, const char *message)
+(JNICALL _Jv_JNI_FatalError) (JNIEnv *, const char *message)
{
JvFail (message);
}
@@ -582,13 +582,13 @@ _Jv_JNI_FatalError (JNIEnv *, const char *message)
static jboolean
-_Jv_JNI_IsSameObject (JNIEnv *, jobject obj1, jobject obj2)
+(JNICALL _Jv_JNI_IsSameObject) (JNIEnv *, jobject obj1, jobject obj2)
{
return unwrap (obj1) == unwrap (obj2);
}
static jobject
-_Jv_JNI_AllocObject (JNIEnv *env, jclass clazz)
+(JNICALL _Jv_JNI_AllocObject) (JNIEnv *env, jclass clazz)
{
jobject obj = NULL;
using namespace java::lang::reflect;
@@ -600,10 +600,7 @@ _Jv_JNI_AllocObject (JNIEnv *env, jclass clazz)
if (clazz->isInterface() || Modifier::isAbstract(clazz->getModifiers()))
env->ex = new java::lang::InstantiationException ();
else
- {
- // FIXME: will this work for String?
- obj = JvAllocObject (clazz);
- }
+ obj = JvAllocObject (clazz);
}
catch (jthrowable t)
{
@@ -614,7 +611,7 @@ _Jv_JNI_AllocObject (JNIEnv *env, jclass clazz)
}
static jclass
-_Jv_JNI_GetObjectClass (JNIEnv *env, jobject obj)
+(JNICALL _Jv_JNI_GetObjectClass) (JNIEnv *env, jobject obj)
{
obj = unwrap (obj);
JvAssert (obj);
@@ -622,7 +619,7 @@ _Jv_JNI_GetObjectClass (JNIEnv *env, jobject obj)
}
static jboolean
-_Jv_JNI_IsInstanceOf (JNIEnv *, jobject obj, jclass clazz)
+(JNICALL _Jv_JNI_IsInstanceOf) (JNIEnv *, jobject obj, jclass clazz)
{
return unwrap (clazz)->isInstance(unwrap (obj));
}
@@ -635,8 +632,8 @@ _Jv_JNI_IsInstanceOf (JNIEnv *, jobject obj, jclass clazz)
template<jboolean is_static>
static jmethodID
-_Jv_JNI_GetAnyMethodID (JNIEnv *env, jclass clazz,
- const char *name, const char *sig)
+(JNICALL _Jv_JNI_GetAnyMethodID) (JNIEnv *env, jclass clazz,
+ const char *name, const char *sig)
{
try
{
@@ -694,18 +691,27 @@ array_from_valist (jvalue *values, JArray<jclass> *arg_types, va_list vargs)
jclass *arg_elts = elements (arg_types);
for (int i = 0; i < arg_types->length; ++i)
{
+ // Here we assume that sizeof(int) >= sizeof(jint), because we
+ // use `int' when decoding the varargs. Likewise for
+ // float, and double. Also we assume that sizeof(jlong) >=
+ // sizeof(int), i.e. that jlong values are not further
+ // promoted.
+ JvAssert (sizeof (int) >= sizeof (jint));
+ JvAssert (sizeof (jlong) >= sizeof (int));
+ JvAssert (sizeof (double) >= sizeof (jfloat));
+ JvAssert (sizeof (double) >= sizeof (jdouble));
if (arg_elts[i] == JvPrimClass (byte))
values[i].b = (jbyte) va_arg (vargs, int);
else if (arg_elts[i] == JvPrimClass (short))
values[i].s = (jshort) va_arg (vargs, int);
else if (arg_elts[i] == JvPrimClass (int))
- values[i].i = va_arg (vargs, jint);
+ values[i].i = (jint) va_arg (vargs, int);
else if (arg_elts[i] == JvPrimClass (long))
- values[i].j = va_arg (vargs, jlong);
+ values[i].j = (jlong) va_arg (vargs, jlong);
else if (arg_elts[i] == JvPrimClass (float))
- values[i].f = va_arg (vargs, jfloat);
+ values[i].f = (jfloat) va_arg (vargs, double);
else if (arg_elts[i] == JvPrimClass (double))
- values[i].d = va_arg (vargs, jdouble);
+ values[i].d = (jdouble) va_arg (vargs, double);
else if (arg_elts[i] == JvPrimClass (boolean))
values[i].z = (jboolean) va_arg (vargs, int);
else if (arg_elts[i] == JvPrimClass (char))
@@ -722,8 +728,8 @@ array_from_valist (jvalue *values, JArray<jclass> *arg_types, va_list vargs)
// constructor.
template<typename T, invocation_type style>
static T
-_Jv_JNI_CallAnyMethodV (JNIEnv *env, jobject obj, jclass klass,
- jmethodID id, va_list vargs)
+(JNICALL _Jv_JNI_CallAnyMethodV) (JNIEnv *env, jobject obj, jclass klass,
+ jmethodID id, va_list vargs)
{
obj = unwrap (obj);
klass = unwrap (klass);
@@ -770,8 +776,8 @@ _Jv_JNI_CallAnyMethodV (JNIEnv *env, jobject obj, jclass klass,
template<typename T, invocation_type style>
static T
-_Jv_JNI_CallAnyMethod (JNIEnv *env, jobject obj, jclass klass,
- jmethodID method, ...)
+(JNICALL _Jv_JNI_CallAnyMethod) (JNIEnv *env, jobject obj, jclass klass,
+ jmethodID method, ...)
{
va_list args;
T result;
@@ -785,8 +791,8 @@ _Jv_JNI_CallAnyMethod (JNIEnv *env, jobject obj, jclass klass,
template<typename T, invocation_type style>
static T
-_Jv_JNI_CallAnyMethodA (JNIEnv *env, jobject obj, jclass klass,
- jmethodID id, jvalue *args)
+(JNICALL _Jv_JNI_CallAnyMethodA) (JNIEnv *env, jobject obj, jclass klass,
+ jmethodID id, jvalue *args)
{
obj = unwrap (obj);
klass = unwrap (klass);
@@ -840,8 +846,8 @@ _Jv_JNI_CallAnyMethodA (JNIEnv *env, jobject obj, jclass klass,
template<invocation_type style>
static void
-_Jv_JNI_CallAnyVoidMethodV (JNIEnv *env, jobject obj, jclass klass,
- jmethodID id, va_list vargs)
+(JNICALL _Jv_JNI_CallAnyVoidMethodV) (JNIEnv *env, jobject obj, jclass klass,
+ jmethodID id, va_list vargs)
{
obj = unwrap (obj);
klass = unwrap (klass);
@@ -881,8 +887,8 @@ _Jv_JNI_CallAnyVoidMethodV (JNIEnv *env, jobject obj, jclass klass,
template<invocation_type style>
static void
-_Jv_JNI_CallAnyVoidMethod (JNIEnv *env, jobject obj, jclass klass,
- jmethodID method, ...)
+(JNICALL _Jv_JNI_CallAnyVoidMethod) (JNIEnv *env, jobject obj, jclass klass,
+ jmethodID method, ...)
{
va_list args;
@@ -893,8 +899,8 @@ _Jv_JNI_CallAnyVoidMethod (JNIEnv *env, jobject obj, jclass klass,
template<invocation_type style>
static void
-_Jv_JNI_CallAnyVoidMethodA (JNIEnv *env, jobject obj, jclass klass,
- jmethodID id, jvalue *args)
+(JNICALL _Jv_JNI_CallAnyVoidMethodA) (JNIEnv *env, jobject obj, jclass klass,
+ jmethodID id, jvalue *args)
{
if (style == normal)
id = _Jv_LookupDeclaredMethod (obj->getClass (), id->name, id->signature);
@@ -937,7 +943,8 @@ _Jv_JNI_CallAnyVoidMethodA (JNIEnv *env, jobject obj, jclass klass,
// the CallMethod family.
template<typename T>
static T
-_Jv_JNI_CallMethodV (JNIEnv *env, jobject obj, jmethodID id, va_list args)
+(JNICALL _Jv_JNI_CallMethodV) (JNIEnv *env, jobject obj,
+ jmethodID id, va_list args)
{
return _Jv_JNI_CallAnyMethodV<T, normal> (env, obj, NULL, id, args);
}
@@ -946,7 +953,7 @@ _Jv_JNI_CallMethodV (JNIEnv *env, jobject obj, jmethodID id, va_list args)
// the CallMethod family.
template<typename T>
static T
-_Jv_JNI_CallMethod (JNIEnv *env, jobject obj, jmethodID id, ...)
+(JNICALL _Jv_JNI_CallMethod) (JNIEnv *env, jobject obj, jmethodID id, ...)
{
va_list args;
T result;
@@ -962,19 +969,21 @@ _Jv_JNI_CallMethod (JNIEnv *env, jobject obj, jmethodID id, ...)
// the CallMethod family.
template<typename T>
static T
-_Jv_JNI_CallMethodA (JNIEnv *env, jobject obj, jmethodID id, jvalue *args)
+(JNICALL _Jv_JNI_CallMethodA) (JNIEnv *env, jobject obj,
+ jmethodID id, jvalue *args)
{
return _Jv_JNI_CallAnyMethodA<T, normal> (env, obj, NULL, id, args);
}
static void
-_Jv_JNI_CallVoidMethodV (JNIEnv *env, jobject obj, jmethodID id, va_list args)
+(JNICALL _Jv_JNI_CallVoidMethodV) (JNIEnv *env, jobject obj,
+ jmethodID id, va_list args)
{
_Jv_JNI_CallAnyVoidMethodV<normal> (env, obj, NULL, id, args);
}
static void
-_Jv_JNI_CallVoidMethod (JNIEnv *env, jobject obj, jmethodID id, ...)
+(JNICALL _Jv_JNI_CallVoidMethod) (JNIEnv *env, jobject obj, jmethodID id, ...)
{
va_list args;
@@ -984,7 +993,8 @@ _Jv_JNI_CallVoidMethod (JNIEnv *env, jobject obj, jmethodID id, ...)
}
static void
-_Jv_JNI_CallVoidMethodA (JNIEnv *env, jobject obj, jmethodID id, jvalue *args)
+(JNICALL _Jv_JNI_CallVoidMethodA) (JNIEnv *env, jobject obj,
+ jmethodID id, jvalue *args)
{
_Jv_JNI_CallAnyVoidMethodA<normal> (env, obj, NULL, id, args);
}
@@ -993,8 +1003,8 @@ _Jv_JNI_CallVoidMethodA (JNIEnv *env, jobject obj, jmethodID id, jvalue *args)
// the CallStaticMethod family.
template<typename T>
static T
-_Jv_JNI_CallStaticMethodV (JNIEnv *env, jclass klass,
- jmethodID id, va_list args)
+(JNICALL _Jv_JNI_CallStaticMethodV) (JNIEnv *env, jclass klass,
+ jmethodID id, va_list args)
{
JvAssert (((id->accflags) & java::lang::reflect::Modifier::STATIC));
JvAssert (java::lang::Class::class$.isInstance (unwrap (klass)));
@@ -1006,7 +1016,8 @@ _Jv_JNI_CallStaticMethodV (JNIEnv *env, jclass klass,
// the CallStaticMethod family.
template<typename T>
static T
-_Jv_JNI_CallStaticMethod (JNIEnv *env, jclass klass, jmethodID id, ...)
+(JNICALL _Jv_JNI_CallStaticMethod) (JNIEnv *env, jclass klass,
+ jmethodID id, ...)
{
va_list args;
T result;
@@ -1026,8 +1037,8 @@ _Jv_JNI_CallStaticMethod (JNIEnv *env, jclass klass, jmethodID id, ...)
// the CallStaticMethod family.
template<typename T>
static T
-_Jv_JNI_CallStaticMethodA (JNIEnv *env, jclass klass, jmethodID id,
- jvalue *args)
+(JNICALL _Jv_JNI_CallStaticMethodA) (JNIEnv *env, jclass klass, jmethodID id,
+ jvalue *args)
{
JvAssert (((id->accflags) & java::lang::reflect::Modifier::STATIC));
JvAssert (java::lang::Class::class$.isInstance (unwrap (klass)));
@@ -1036,14 +1047,15 @@ _Jv_JNI_CallStaticMethodA (JNIEnv *env, jclass klass, jmethodID id,
}
static void
-_Jv_JNI_CallStaticVoidMethodV (JNIEnv *env, jclass klass, jmethodID id,
- va_list args)
+(JNICALL _Jv_JNI_CallStaticVoidMethodV) (JNIEnv *env, jclass klass,
+ jmethodID id, va_list args)
{
_Jv_JNI_CallAnyVoidMethodV<static_type> (env, NULL, klass, id, args);
}
static void
-_Jv_JNI_CallStaticVoidMethod (JNIEnv *env, jclass klass, jmethodID id, ...)
+(JNICALL _Jv_JNI_CallStaticVoidMethod) (JNIEnv *env, jclass klass,
+ jmethodID id, ...)
{
va_list args;
@@ -1053,15 +1065,15 @@ _Jv_JNI_CallStaticVoidMethod (JNIEnv *env, jclass klass, jmethodID id, ...)
}
static void
-_Jv_JNI_CallStaticVoidMethodA (JNIEnv *env, jclass klass, jmethodID id,
- jvalue *args)
+(JNICALL _Jv_JNI_CallStaticVoidMethodA) (JNIEnv *env, jclass klass,
+ jmethodID id, jvalue *args)
{
_Jv_JNI_CallAnyVoidMethodA<static_type> (env, NULL, klass, id, args);
}
static jobject
-_Jv_JNI_NewObjectV (JNIEnv *env, jclass klass,
- jmethodID id, va_list args)
+(JNICALL _Jv_JNI_NewObjectV) (JNIEnv *env, jclass klass,
+ jmethodID id, va_list args)
{
JvAssert (klass && ! klass->isArray ());
JvAssert (! strcmp (id->name->data, "<init>")
@@ -1075,7 +1087,7 @@ _Jv_JNI_NewObjectV (JNIEnv *env, jclass klass,
}
static jobject
-_Jv_JNI_NewObject (JNIEnv *env, jclass klass, jmethodID id, ...)
+(JNICALL _Jv_JNI_NewObject) (JNIEnv *env, jclass klass, jmethodID id, ...)
{
JvAssert (klass && ! klass->isArray ());
JvAssert (! strcmp (id->name->data, "<init>")
@@ -1096,8 +1108,8 @@ _Jv_JNI_NewObject (JNIEnv *env, jclass klass, jmethodID id, ...)
}
static jobject
-_Jv_JNI_NewObjectA (JNIEnv *env, jclass klass, jmethodID id,
- jvalue *args)
+(JNICALL _Jv_JNI_NewObjectA) (JNIEnv *env, jclass klass, jmethodID id,
+ jvalue *args)
{
JvAssert (klass && ! klass->isArray ());
JvAssert (! strcmp (id->name->data, "<init>")
@@ -1114,7 +1126,7 @@ _Jv_JNI_NewObjectA (JNIEnv *env, jclass klass, jmethodID id,
template<typename T>
static T
-_Jv_JNI_GetField (JNIEnv *env, jobject obj, jfieldID field)
+(JNICALL _Jv_JNI_GetField) (JNIEnv *env, jobject obj, jfieldID field)
{
obj = unwrap (obj);
JvAssert (obj);
@@ -1124,7 +1136,7 @@ _Jv_JNI_GetField (JNIEnv *env, jobject obj, jfieldID field)
template<typename T>
static void
-_Jv_JNI_SetField (JNIEnv *, jobject obj, jfieldID field, T value)
+(JNICALL _Jv_JNI_SetField) (JNIEnv *, jobject obj, jfieldID field, T value)
{
obj = unwrap (obj);
value = unwrap (value);
@@ -1136,8 +1148,8 @@ _Jv_JNI_SetField (JNIEnv *, jobject obj, jfieldID field, T value)
template<jboolean is_static>
static jfieldID
-_Jv_JNI_GetAnyFieldID (JNIEnv *env, jclass clazz,
- const char *name, const char *sig)
+(JNICALL _Jv_JNI_GetAnyFieldID) (JNIEnv *env, jclass clazz,
+ const char *name, const char *sig)
{
try
{
@@ -1197,7 +1209,7 @@ _Jv_JNI_GetAnyFieldID (JNIEnv *env, jclass clazz,
template<typename T>
static T
-_Jv_JNI_GetStaticField (JNIEnv *env, jclass, jfieldID field)
+(JNICALL _Jv_JNI_GetStaticField) (JNIEnv *env, jclass, jfieldID field)
{
T *ptr = (T *) field->u.addr;
return wrap_value (env, *ptr);
@@ -1205,7 +1217,7 @@ _Jv_JNI_GetStaticField (JNIEnv *env, jclass, jfieldID field)
template<typename T>
static void
-_Jv_JNI_SetStaticField (JNIEnv *, jclass, jfieldID field, T value)
+(JNICALL _Jv_JNI_SetStaticField) (JNIEnv *, jclass, jfieldID field, T value)
{
value = unwrap (value);
T *ptr = (T *) field->u.addr;
@@ -1213,7 +1225,7 @@ _Jv_JNI_SetStaticField (JNIEnv *, jclass, jfieldID field, T value)
}
static jstring
-_Jv_JNI_NewString (JNIEnv *env, const jchar *unichars, jsize len)
+(JNICALL _Jv_JNI_NewString) (JNIEnv *env, const jchar *unichars, jsize len)
{
try
{
@@ -1228,13 +1240,13 @@ _Jv_JNI_NewString (JNIEnv *env, const jchar *unichars, jsize len)
}
static jsize
-_Jv_JNI_GetStringLength (JNIEnv *, jstring string)
+(JNICALL _Jv_JNI_GetStringLength) (JNIEnv *, jstring string)
{
return unwrap (string)->length();
}
static const jchar *
-_Jv_JNI_GetStringChars (JNIEnv *, jstring string, jboolean *isCopy)
+(JNICALL _Jv_JNI_GetStringChars) (JNIEnv *, jstring string, jboolean *isCopy)
{
string = unwrap (string);
jchar *result = _Jv_GetStringChars (string);
@@ -1245,13 +1257,13 @@ _Jv_JNI_GetStringChars (JNIEnv *, jstring string, jboolean *isCopy)
}
static void
-_Jv_JNI_ReleaseStringChars (JNIEnv *, jstring string, const jchar *)
+(JNICALL _Jv_JNI_ReleaseStringChars) (JNIEnv *, jstring string, const jchar *)
{
unmark_for_gc (unwrap (string), global_ref_table);
}
static jstring
-_Jv_JNI_NewStringUTF (JNIEnv *env, const char *bytes)
+(JNICALL _Jv_JNI_NewStringUTF) (JNIEnv *env, const char *bytes)
{
try
{
@@ -1266,13 +1278,14 @@ _Jv_JNI_NewStringUTF (JNIEnv *env, const char *bytes)
}
static jsize
-_Jv_JNI_GetStringUTFLength (JNIEnv *, jstring string)
+(JNICALL _Jv_JNI_GetStringUTFLength) (JNIEnv *, jstring string)
{
return JvGetStringUTFLength (unwrap (string));
}
static const char *
-_Jv_JNI_GetStringUTFChars (JNIEnv *env, jstring string, jboolean *isCopy)
+(JNICALL _Jv_JNI_GetStringUTFChars) (JNIEnv *env, jstring string,
+ jboolean *isCopy)
{
string = unwrap (string);
jsize len = JvGetStringUTFLength (string);
@@ -1295,14 +1308,14 @@ _Jv_JNI_GetStringUTFChars (JNIEnv *env, jstring string, jboolean *isCopy)
}
static void
-_Jv_JNI_ReleaseStringUTFChars (JNIEnv *, jstring, const char *utf)
+(JNICALL _Jv_JNI_ReleaseStringUTFChars) (JNIEnv *, jstring, const char *utf)
{
_Jv_Free ((void *) utf);
}
static void
-_Jv_JNI_GetStringRegion (JNIEnv *env, jstring string, jsize start, jsize len,
- jchar *buf)
+(JNICALL _Jv_JNI_GetStringRegion) (JNIEnv *env, jstring string, jsize start,
+ jsize len, jchar *buf)
{
string = unwrap (string);
jchar *result = _Jv_GetStringChars (string);
@@ -1323,8 +1336,8 @@ _Jv_JNI_GetStringRegion (JNIEnv *env, jstring string, jsize start, jsize len,
}
static void
-_Jv_JNI_GetStringUTFRegion (JNIEnv *env, jstring str, jsize start,
- jsize len, char *buf)
+(JNICALL _Jv_JNI_GetStringUTFRegion) (JNIEnv *env, jstring str, jsize start,
+ jsize len, char *buf)
{
str = unwrap (str);
@@ -1345,7 +1358,7 @@ _Jv_JNI_GetStringUTFRegion (JNIEnv *env, jstring str, jsize start,
}
static const jchar *
-_Jv_JNI_GetStringCritical (JNIEnv *, jstring str, jboolean *isCopy)
+(JNICALL _Jv_JNI_GetStringCritical) (JNIEnv *, jstring str, jboolean *isCopy)
{
jchar *result = _Jv_GetStringChars (unwrap (str));
if (isCopy)
@@ -1354,20 +1367,20 @@ _Jv_JNI_GetStringCritical (JNIEnv *, jstring str, jboolean *isCopy)
}
static void
-_Jv_JNI_ReleaseStringCritical (JNIEnv *, jstring, const jchar *)
+(JNICALL _Jv_JNI_ReleaseStringCritical) (JNIEnv *, jstring, const jchar *)
{
// Nothing.
}
static jsize
-_Jv_JNI_GetArrayLength (JNIEnv *, jarray array)
+(JNICALL _Jv_JNI_GetArrayLength) (JNIEnv *, jarray array)
{
return unwrap (array)->length;
}
static jarray
-_Jv_JNI_NewObjectArray (JNIEnv *env, jsize length, jclass elementClass,
- jobject init)
+(JNICALL _Jv_JNI_NewObjectArray) (JNIEnv *env, jsize length,
+ jclass elementClass, jobject init)
{
try
{
@@ -1385,15 +1398,16 @@ _Jv_JNI_NewObjectArray (JNIEnv *env, jsize length, jclass elementClass,
}
static jobject
-_Jv_JNI_GetObjectArrayElement (JNIEnv *env, jobjectArray array, jsize index)
+(JNICALL _Jv_JNI_GetObjectArrayElement) (JNIEnv *env, jobjectArray array,
+ jsize index)
{
jobject *elts = elements (unwrap (array));
return wrap_value (env, elts[index]);
}
static void
-_Jv_JNI_SetObjectArrayElement (JNIEnv *env, jobjectArray array, jsize index,
- jobject value)
+(JNICALL _Jv_JNI_SetObjectArrayElement) (JNIEnv *env, jobjectArray array,
+ jsize index, jobject value)
{
try
{
@@ -1412,7 +1426,7 @@ _Jv_JNI_SetObjectArrayElement (JNIEnv *env, jobjectArray array, jsize index,
template<typename T, jclass K>
static JArray<T> *
-_Jv_JNI_NewPrimitiveArray (JNIEnv *env, jsize length)
+(JNICALL _Jv_JNI_NewPrimitiveArray) (JNIEnv *env, jsize length)
{
try
{
@@ -1427,8 +1441,8 @@ _Jv_JNI_NewPrimitiveArray (JNIEnv *env, jsize length)
template<typename T>
static T *
-_Jv_JNI_GetPrimitiveArrayElements (JNIEnv *, JArray<T> *array,
- jboolean *isCopy)
+(JNICALL _Jv_JNI_GetPrimitiveArrayElements) (JNIEnv *, JArray<T> *array,
+ jboolean *isCopy)
{
array = unwrap (array);
T *elts = elements (array);
@@ -1443,8 +1457,8 @@ _Jv_JNI_GetPrimitiveArrayElements (JNIEnv *, JArray<T> *array,
template<typename T>
static void
-_Jv_JNI_ReleasePrimitiveArrayElements (JNIEnv *, JArray<T> *array,
- T *, jint /* mode */)
+(JNICALL _Jv_JNI_ReleasePrimitiveArrayElements) (JNIEnv *, JArray<T> *array,
+ T *, jint /* mode */)
{
array = unwrap (array);
// Note that we ignore MODE. We can do this because we never copy
@@ -1455,8 +1469,8 @@ _Jv_JNI_ReleasePrimitiveArrayElements (JNIEnv *, JArray<T> *array,
template<typename T>
static void
-_Jv_JNI_GetPrimitiveArrayRegion (JNIEnv *env, JArray<T> *array,
- jsize start, jsize len,
+(JNICALL _Jv_JNI_GetPrimitiveArrayRegion) (JNIEnv *env, JArray<T> *array,
+ jsize start, jsize len,
T *buf)
{
array = unwrap (array);
@@ -1485,8 +1499,8 @@ _Jv_JNI_GetPrimitiveArrayRegion (JNIEnv *env, JArray<T> *array,
template<typename T>
static void
-_Jv_JNI_SetPrimitiveArrayRegion (JNIEnv *env, JArray<T> *array,
- jsize start, jsize len, T *buf)
+(JNICALL _Jv_JNI_SetPrimitiveArrayRegion) (JNIEnv *env, JArray<T> *array,
+ jsize start, jsize len, T *buf)
{
array = unwrap (array);
@@ -1512,8 +1526,8 @@ _Jv_JNI_SetPrimitiveArrayRegion (JNIEnv *env, JArray<T> *array,
}
static void *
-_Jv_JNI_GetPrimitiveArrayCritical (JNIEnv *, jarray array,
- jboolean *isCopy)
+(JNICALL _Jv_JNI_GetPrimitiveArrayCritical) (JNIEnv *, jarray array,
+ jboolean *isCopy)
{
array = unwrap (array);
// FIXME: does this work?
@@ -1526,13 +1540,13 @@ _Jv_JNI_GetPrimitiveArrayCritical (JNIEnv *, jarray array,
}
static void
-_Jv_JNI_ReleasePrimitiveArrayCritical (JNIEnv *, jarray, void *, jint)
+(JNICALL _Jv_JNI_ReleasePrimitiveArrayCritical) (JNIEnv *, jarray, void *, jint)
{
// Nothing.
}
static jint
-_Jv_JNI_MonitorEnter (JNIEnv *env, jobject obj)
+(JNICALL _Jv_JNI_MonitorEnter) (JNIEnv *env, jobject obj)
{
try
{
@@ -1547,7 +1561,7 @@ _Jv_JNI_MonitorEnter (JNIEnv *env, jobject obj)
}
static jint
-_Jv_JNI_MonitorExit (JNIEnv *env, jobject obj)
+(JNICALL _Jv_JNI_MonitorExit) (JNIEnv *env, jobject obj)
{
try
{
@@ -1563,8 +1577,8 @@ _Jv_JNI_MonitorExit (JNIEnv *env, jobject obj)
// JDK 1.2
jobject
-_Jv_JNI_ToReflectedField (JNIEnv *env, jclass cls, jfieldID fieldID,
- jboolean)
+(JNICALL _Jv_JNI_ToReflectedField) (JNIEnv *env, jclass cls, jfieldID fieldID,
+ jboolean)
{
try
{
@@ -1584,7 +1598,7 @@ _Jv_JNI_ToReflectedField (JNIEnv *env, jclass cls, jfieldID fieldID,
// JDK 1.2
static jfieldID
-_Jv_JNI_FromReflectedField (JNIEnv *, jobject f)
+(JNICALL _Jv_JNI_FromReflectedField) (JNIEnv *, jobject f)
{
using namespace java::lang::reflect;
@@ -1594,8 +1608,8 @@ _Jv_JNI_FromReflectedField (JNIEnv *, jobject f)
}
jobject
-_Jv_JNI_ToReflectedMethod (JNIEnv *env, jclass klass, jmethodID id,
- jboolean)
+(JNICALL _Jv_JNI_ToReflectedMethod) (JNIEnv *env, jclass klass, jmethodID id,
+ jboolean)
{
using namespace java::lang::reflect;
@@ -1629,7 +1643,7 @@ _Jv_JNI_ToReflectedMethod (JNIEnv *env, jclass klass, jmethodID id,
}
static jmethodID
-_Jv_JNI_FromReflectedMethod (JNIEnv *, jobject method)
+(JNICALL _Jv_JNI_FromReflectedMethod) (JNIEnv *, jobject method)
{
using namespace java::lang::reflect;
method = unwrap (method);
@@ -1641,7 +1655,7 @@ _Jv_JNI_FromReflectedMethod (JNIEnv *, jobject method)
// JDK 1.2.
jweak
-_Jv_JNI_NewWeakGlobalRef (JNIEnv *env, jobject obj)
+(JNICALL _Jv_JNI_NewWeakGlobalRef) (JNIEnv *env, jobject obj)
{
using namespace gnu::gcj::runtime;
JNIWeakRef *ref = NULL;
@@ -1662,7 +1676,7 @@ _Jv_JNI_NewWeakGlobalRef (JNIEnv *env, jobject obj)
}
void
-_Jv_JNI_DeleteWeakGlobalRef (JNIEnv *, jweak obj)
+(JNICALL _Jv_JNI_DeleteWeakGlobalRef) (JNIEnv *, jweak obj)
{
using namespace gnu::gcj::runtime;
JNIWeakRef *ref = reinterpret_cast<JNIWeakRef *> (obj);
@@ -1675,21 +1689,21 @@ _Jv_JNI_DeleteWeakGlobalRef (JNIEnv *, jweak obj)
// Direct byte buffers.
static jobject
-_Jv_JNI_NewDirectByteBuffer (JNIEnv *, void *, jlong)
+(JNICALL _Jv_JNI_NewDirectByteBuffer) (JNIEnv *, void *, jlong)
{
// For now we don't support this.
return NULL;
}
static void *
-_Jv_JNI_GetDirectBufferAddress (JNIEnv *, jobject)
+(JNICALL _Jv_JNI_GetDirectBufferAddress) (JNIEnv *, jobject)
{
// For now we don't support this.
return NULL;
}
static jlong
-_Jv_JNI_GetDirectBufferCapacity (JNIEnv *, jobject)
+(JNICALL _Jv_JNI_GetDirectBufferCapacity) (JNIEnv *, jobject)
{
// For now we don't support this.
return -1;
@@ -1812,9 +1826,9 @@ nathash_add (const JNINativeMethod *method)
}
static jint
-_Jv_JNI_RegisterNatives (JNIEnv *env, jclass klass,
- const JNINativeMethod *methods,
- jint nMethods)
+(JNICALL _Jv_JNI_RegisterNatives) (JNIEnv *env, jclass klass,
+ const JNINativeMethod *methods,
+ jint nMethods)
{
// Synchronize while we do the work. This must match
// synchronization in some other functions that manipulate or use
@@ -1866,7 +1880,7 @@ _Jv_JNI_RegisterNatives (JNIEnv *env, jclass klass,
}
static jint
-_Jv_JNI_UnregisterNatives (JNIEnv *, jclass)
+(JNICALL _Jv_JNI_UnregisterNatives) (JNIEnv *, jclass)
{
// FIXME -- we could implement this.
return JNI_ERR;
@@ -1978,9 +1992,9 @@ _Jv_GetJNIEnvNewFrame (jclass klass)
{
env = (JNIEnv *) _Jv_MallocUnchecked (sizeof (JNIEnv));
env->p = &_Jv_JNIFunctions;
- env->ex = NULL;
env->klass = klass;
env->locals = NULL;
+ // We set env->ex below.
_Jv_SetCurrentJNIEnv (env);
}
@@ -1993,11 +2007,13 @@ _Jv_GetJNIEnvNewFrame (jclass klass)
frame->marker = MARK_SYSTEM;
frame->size = FRAME_SIZE;
frame->next = env->locals;
- env->locals = frame;
for (int i = 0; i < frame->size; ++i)
frame->vec[i] = NULL;
+ env->locals = frame;
+ env->ex = NULL;
+
return env;
}
@@ -2191,19 +2207,20 @@ _Jv_JNI_AttachCurrentThread (JavaVM *, jstring name, void **penv,
// This is the one actually used by JNI.
static jint
-_Jv_JNI_AttachCurrentThread (JavaVM *vm, void **penv, void *args)
+(JNICALL _Jv_JNI_AttachCurrentThread) (JavaVM *vm, void **penv, void *args)
{
return _Jv_JNI_AttachCurrentThread (vm, NULL, penv, args, false);
}
static jint
-_Jv_JNI_AttachCurrentThreadAsDaemon (JavaVM *vm, void **penv, void *args)
+(JNICALL _Jv_JNI_AttachCurrentThreadAsDaemon) (JavaVM *vm, void **penv,
+ void *args)
{
return _Jv_JNI_AttachCurrentThread (vm, NULL, penv, args, true);
}
static jint
-_Jv_JNI_DestroyJavaVM (JavaVM *vm)
+(JNICALL _Jv_JNI_DestroyJavaVM) (JavaVM *vm)
{
JvAssert (the_vm && vm == the_vm);
@@ -2237,14 +2254,14 @@ _Jv_JNI_DestroyJavaVM (JavaVM *vm)
}
jint
-_Jv_JNI_DetachCurrentThread (JavaVM *)
+(JNICALL _Jv_JNI_DetachCurrentThread) (JavaVM *)
{
jint code = _Jv_DetachCurrentThread ();
return code ? JNI_EDETACHED : 0;
}
static jint
-_Jv_JNI_GetEnv (JavaVM *, void **penv, jint version)
+(JNICALL _Jv_JNI_GetEnv) (JavaVM *, void **penv, jint version)
{
if (_Jv_ThreadCurrent () == NULL)
{
@@ -2273,7 +2290,7 @@ _Jv_JNI_GetEnv (JavaVM *, void **penv, jint version)
return 0;
}
-jint
+JNIEXPORT jint JNICALL
JNI_GetDefaultJavaVMInitArgs (void *args)
{
jint version = * (jint *) args;
@@ -2290,7 +2307,7 @@ JNI_GetDefaultJavaVMInitArgs (void *args)
return 0;
}
-jint
+JNIEXPORT jint JNICALL
JNI_CreateJavaVM (JavaVM **vm, void **penv, void *args)
{
JvAssert (! the_vm);
@@ -2355,7 +2372,7 @@ JNI_CreateJavaVM (JavaVM **vm, void **penv, void *args)
return 0;
}
-jint
+JNIEXPORT jint JNICALL
JNI_GetCreatedJavaVMs (JavaVM **vm_buffer, jsize buf_len, jsize *n_vms)
{
if (buf_len <= 0)
@@ -2396,7 +2413,7 @@ _Jv_GetJavaVM ()
}
static jint
-_Jv_JNI_GetJavaVM (JNIEnv *, JavaVM **vm)
+(JNICALL _Jv_JNI_GetJavaVM) (JNIEnv *, JavaVM **vm)
{
*vm = _Jv_GetJavaVM ();
return *vm == NULL ? JNI_ERR : JNI_OK;
diff --git a/libjava/mauve-libgcj b/libjava/mauve-libgcj
index deda5cb1f01..64ee52e1cc8 100644
--- a/libjava/mauve-libgcj
+++ b/libjava/mauve-libgcj
@@ -7,28 +7,16 @@ JDK1.4
JLS1.0
JLS1.1
JLS1.2
+JDBC1.0
JDBC2.0
-# These 2 are tests that fail with JDBC2.0 but the tags don't seem to
-# have the right effect.
-!java.sql.Connection.TestJdbc10
-!java.sql.DatabaseMetaData.TestJdbc10
-
-# We now implement JDBC3.0 which means the following tests don't compile
-!java.sql.Blob.BlobTest
-!java.sql.Clob.ClobTest
-!java.sql.Connection.TestJdbc20
-!java.sql.DatabaseMetaData.TestJdbc20
-
# Cannot be compiled
!java.text.ACIAttribute
-# The following tests seem to (sometimes) hang or crash the testsuite
+# The following tests seem to hang or crash the testsuite.
+# This a problem when running Mauve "standalone".
!java.io.ObjectInputOutput
!java.lang.reflect.Array.newInstance
-!java.util.ResourceBundle.getBundle
-!java.util.zip.GZIPInputStream.basic
-!java.net.DatagramSocket.DatagramSocketTest2
# Character.unicode seems to be very broken (the test)
# Does not give meaningfull test results at the moment.
@@ -36,4 +24,5 @@ JDBC2.0
# These are almost certainly buggy test cases.
# The behaviour of the garbarge collector cannot be predicted.
-!java.lang.ref
+# Note the . at the end so we do test java.lang.reflect
+!java.lang.ref.
diff --git a/libjava/name-finder.cc b/libjava/name-finder.cc
deleted file mode 100644
index 2d383aaa250..00000000000
--- a/libjava/name-finder.cc
+++ /dev/null
@@ -1,356 +0,0 @@
-// name-finder.cc - Convert addresses to names
-
-/* Copyright (C) 2000, 2002 Free Software Foundation, Inc
-
- 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. */
-
-/**
- * @author Andrew Haley <aph@cygnus.com>
- * @date Jan 6 2000
- */
-
-/* _Jv_name_finder is a class wrapper around a mechanism that can
- convert address of methods to their names and the names of files in
- which they appear.
-
- Right now, the only implementation of this involves running a copy
- of addr2line, but at some point it is worth building this
- functionality into libgcj, if only for embedded systems. */
-
-
-#ifndef _GNU_SOURCE
-#define _GNU_SOURCE 1
-#endif
-
-#include <config.h>
-
-#include <string.h>
-
-#include <gcj/cni.h>
-#include <jvm.h>
-#include <java/lang/Object.h>
-#include <java-threads.h>
-#include <java/lang/Throwable.h>
-#include <java/io/PrintStream.h>
-#include <java/io/PrintWriter.h>
-
-#include <sys/types.h>
-
-#include <stdlib.h>
-#include <stdio.h>
-
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-
-#ifdef HAVE_DLFCN_H
-#include <dlfcn.h>
-#endif
-
-#include <name-finder.h>
-
-/* Create a new name finder which will perform address lookups on an
- executable. */
-
-_Jv_name_finder::_Jv_name_finder (char *executable)
-{
-#if defined (HAVE_PIPE) && defined (HAVE_FORK) && defined (HAVE_EXECVP)
- demangling_error = lookup_error = 0;
-
- // Initialize file descriptors so that shutdown works properly.
- f_pipe[0] = -1;
- f_pipe[1] = -1;
- b_pipe[0] = -1;
- b_pipe[1] = -1;
- b_pipe_fd = NULL;
-
- f2_pipe[0] = -1;
- f2_pipe[1] = -1;
- b2_pipe[0] = -1;
- b2_pipe[1] = -1;
- b2_pipe_fd = NULL;
-
- // addr2line helper process.
-
- char *argv[5];
- {
- int arg = 0;
-#ifdef __ia64__
- argv[arg++] = "addr2name.awk";
-#else
- argv[arg++] = "addr2line";
- argv[arg++] = "-f";
- argv[arg++] = "-e";
-#endif
- argv[arg++] = executable;
- argv[arg] = NULL;
- }
-
- lookup_error |= pipe (f_pipe) < 0;
- lookup_error |= pipe (b_pipe) < 0;
-
- if (lookup_error)
- return;
-
- pid = fork ();
- if (pid == 0)
- {
- close (f_pipe[1]);
- close (b_pipe[0]);
- dup2 (f_pipe[0], fileno (stdin));
- dup2 (b_pipe[1], fileno (stdout));
- execvp (argv[0], argv);
- _exit (127);
- }
-
- // Close child end of pipes. Set local descriptors to -1 so we
- // don't try to close the fd again.
- close (f_pipe [0]);
- f_pipe[0] = -1;
- close (b_pipe [1]);
- b_pipe[1] = -1;
-
- if (pid < 0)
- {
- lookup_error |= 1;
- return;
- }
-
- b_pipe_fd = fdopen (b_pipe[0], "r");
- lookup_error |= !b_pipe_fd;
-
- if (! lookup_error)
- {
- // Don't try to close the fd twice.
- b_pipe[0] = -1;
- }
-
- // c++filt helper process.
-
- char *argv2[4];
- argv2[0] = "c++filt";
- argv2[1] = "-s";
- argv2[2] = "java";
- argv2[3] = NULL;
-
- demangling_error |= pipe (f2_pipe) < 0;
- demangling_error |= pipe (b2_pipe) < 0;
-
- if (demangling_error)
- return;
-
- pid2 = fork ();
- if (pid2 == 0)
- {
- close (f2_pipe[1]);
- close (b2_pipe[0]);
- dup2 (f2_pipe[0], fileno (stdin));
- dup2 (b2_pipe[1], fileno (stdout));
- execvp (argv2[0], argv2);
- _exit (127);
- }
-
- // Close child end of pipes. Set local descriptors to -1 so we
- // don't try to close the fd again.
- close (f2_pipe [0]);
- f2_pipe[0] = -1;
- close (b2_pipe [1]);
- b2_pipe[1] = -1;
-
- if (pid2 < 0)
- {
- demangling_error |= 1;
- return;
- }
-
- b2_pipe_fd = fdopen (b2_pipe[0], "r");
- demangling_error |= !b2_pipe_fd;
-
- if (! demangling_error)
- {
- // Don't try to close the fd twice.
- b2_pipe[0] = -1;
- }
-#endif
-}
-
-/* Convert a pointer to hex. */
-
-void
-_Jv_name_finder::toHex (void *p)
-{
- typedef unsigned word_t __attribute ((mode (word)));
- word_t n = (word_t) p;
- int digits = sizeof (void *) * 2;
-
- strcpy (hex, "0x");
- for (int i = digits - 1; i >= 0; i--)
- {
- int digit = n % 16;
-
- n /= 16;
- hex[i+2] = digit > 9 ? 'a' + digit - 10 : '0' + digit;
- }
- hex [digits+2] = 0;
-}
-
-/* Creates a StackTraceElement given a string and a filename.
- Splits the given string into the class and method part.
- The string s will be a demangled to a fully qualified java method string.
- The string f will be decomposed into a file name and a possible line number.
- The given strings will be altered. */
-
-java::lang::StackTraceElement*
-_Jv_name_finder::createStackTraceElement(char *s, char *f)
-{
- char *c;
- char *class_name = NULL;
- char *method_name = NULL;
-
-#if defined (HAVE_PIPE) && defined (HAVE_FORK) && defined (HAVE_EXECVP)
- if (demangling_error)
- goto fail;
-
- demangling_error |= write (f2_pipe[1], s, strlen (s)) < 0;
- if (demangling_error)
- goto fail;
- demangling_error |= write (f2_pipe[1], "\n", 1) < 0;
- if (demangling_error)
- goto fail;
-
- char name[1024];
- demangling_error |= (fgets (name, sizeof name, b2_pipe_fd) == NULL);
- if (demangling_error)
- goto fail;
-
- c = strchr (name, '\n');
- if (c)
- *c = 0;
- s = name;
-#endif
-
- c = strchr (s, '(');
- if (c)
- {
- while(c-->s)
- if (*c == '.')
- break;
-
- if (*c == '.')
- {
- *c = 0;
- class_name = s;
- method_name = c+1;
- }
- else
- {
- class_name = NULL;
- method_name = s;
- }
- }
- else
- {
- class_name = NULL;
- method_name = s;
- }
-
- // Get line number
- int line_number;
- c = strrchr (f, ':');
- if (c)
- {
- if (c[1] != 0)
- line_number = atoi(c+1);
- else
- line_number = -1;
- *c = 0;
- }
- else
- {
- line_number = -1;
- c = strchr (f, '\n');
- if (c)
- *c = 0;
- }
-
- fail:
- return new java::lang::StackTraceElement(
- f ? JvNewStringLatin1 (f) : NULL,
- line_number,
- class_name ? JvNewStringLatin1 (class_name) : NULL,
- JvNewStringLatin1 (method_name ? method_name : s),
- false);
-}
-
-/* Given a pointer to a function or method, try to convert it into a
- name and the appropriate line and source file. The caller passes
- the code pointer in p.
-
- Returns false if the lookup fails. Even if this happens, the field
- he will have been correctly filled in with the pointer. */
-
-java::lang::StackTraceElement*
-_Jv_name_finder::lookup (void *p)
-{
- extern char **_Jv_argv;
- toHex (p);
-
- char name[1024];
- char file_name[1024];
-
- file_name[0] = 0;
-
-#if defined (HAVE_DLFCN_H) && defined (HAVE_DLADDR)
- {
- Dl_info dl_info;
-
- if (dladdr (p, &dl_info))
- {
- if (dl_info.dli_fname)
- strncpy (file_name, dl_info.dli_fname, sizeof file_name);
- if (dl_info.dli_sname)
- strncpy (name, dl_info.dli_sname, sizeof name);
-
- /* Don't trust dladdr() if the address is from the main program. */
- if (dl_info.dli_fname != NULL
- && dl_info.dli_sname != NULL
- && (_Jv_argv == NULL || strcmp (file_name, _Jv_argv[0]) != 0))
- return createStackTraceElement (name, file_name);
- }
- }
-#endif
-
- memcpy (name, hex, strlen (hex) + 1);
-
-#if defined (HAVE_PIPE) && defined (HAVE_FORK) && defined (HAVE_EXECVP)
- if (lookup_error)
- goto fail;
-
- lookup_error |= write (f_pipe[1], hex, strlen (hex)) < 0;
- if (lookup_error)
- goto fail;
- lookup_error |= write (f_pipe[1], "\n", 1) < 0;
- if (lookup_error)
- goto fail;
-
- lookup_error |= (fgets (name, sizeof name, b_pipe_fd) == NULL);
- if (lookup_error)
- goto fail;
- lookup_error |= (fgets (file_name, sizeof file_name, b_pipe_fd) == NULL);
- if (lookup_error)
- goto fail;
-
- {
- char *newline = strchr (name, '\n');
- if (newline)
- *newline = 0;
- }
-#endif /* defined (HAVE_PIPE) && defined (HAVE_FORK) && defined (HAVE_EXECVP) */
-
- fail:
- return (createStackTraceElement (name, file_name));
-}
diff --git a/libjava/prims.cc b/libjava/prims.cc
index 054290b16ad..76c25877b7d 100644
--- a/libjava/prims.cc
+++ b/libjava/prims.cc
@@ -53,6 +53,7 @@ details. */
#include <java/lang/NullPointerException.h>
#include <java/lang/OutOfMemoryError.h>
#include <java/lang/System.h>
+#include <java/lang/VMThrowable.h>
#include <java/lang/reflect/Modifier.h>
#include <java/io/PrintStream.h>
#include <java/lang/UnsatisfiedLinkError.h>
@@ -656,7 +657,6 @@ _Jv_FindClassFromSignature (char *sig, java::lang::ClassLoader *loader)
;
_Jv_Utf8Const *name = _Jv_makeUtf8Const (&sig[1], i - 1);
return _Jv_FindClass (name, loader);
-
}
case '[':
{
@@ -910,8 +910,8 @@ _Jv_CreateJavaVM (void* /*vm_args*/)
_Jv_InitPrimClass (&_Jv_voidClass, "void", 'V', 0, &_Jv_voidVTable);
// Turn stack trace generation off while creating exception objects.
- _Jv_InitClass (&java::lang::Throwable::class$);
- java::lang::Throwable::trace_enabled = 0;
+ _Jv_InitClass (&java::lang::VMThrowable::class$);
+ java::lang::VMThrowable::trace_enabled = 0;
INIT_SEGV;
#ifdef HANDLE_FPE
@@ -923,7 +923,7 @@ _Jv_CreateJavaVM (void* /*vm_args*/)
no_memory = new java::lang::OutOfMemoryError;
- java::lang::Throwable::trace_enabled = 1;
+ java::lang::VMThrowable::trace_enabled = 1;
#ifdef USE_LTDL
LTDL_SET_PRELOADED_SYMBOLS ();
diff --git a/libjava/resolve.cc b/libjava/resolve.cc
index f55875509e3..e9fe4ad5af2 100644
--- a/libjava/resolve.cc
+++ b/libjava/resolve.cc
@@ -20,6 +20,7 @@ details. */
#include <java-cpool.h>
#include <java/lang/Class.h>
#include <java/lang/String.h>
+#include <java/lang/StringBuffer.h>
#include <java/lang/Thread.h>
#include <java/lang/InternalError.h>
#include <java/lang/VirtualMachineError.h>
@@ -28,7 +29,7 @@ details. */
#include <java/lang/ClassFormatError.h>
#include <java/lang/IllegalAccessError.h>
#include <java/lang/AbstractMethodError.h>
-#include <java/lang/ClassNotFoundException.h>
+#include <java/lang/NoClassDefFoundError.h>
#include <java/lang/IncompatibleClassChangeError.h>
#include <java/lang/reflect/Modifier.h>
@@ -54,10 +55,6 @@ static void throw_class_format_error (jstring msg)
static void throw_class_format_error (char *msg)
__attribute__ ((__noreturn__));
-// Exceptional return values for _Jv_DetermineVTableIndex
-#define METHOD_NOT_THERE (-2)
-#define METHOD_INACCESSIBLE (-1)
-
static int get_alignment_from_class (jclass);
static _Jv_ResolvedMethod*
@@ -97,7 +94,8 @@ _Jv_ResolvePoolEntry (jclass klass, int index)
if (! found)
{
jstring str = _Jv_NewStringUTF (name->data);
- throw new java::lang::ClassNotFoundException (str);
+ // This exception is specified in JLS 2nd Ed, section 5.1.
+ throw new java::lang::NoClassDefFoundError (str);
}
if ((found->accflags & Modifier::PUBLIC) == Modifier::PUBLIC
@@ -201,12 +199,13 @@ _Jv_ResolvePoolEntry (jclass klass, int index)
end_of_field_search:
if (the_field == 0)
{
- jstring msg = JvNewStringLatin1 ("field ");
- msg = msg->concat (owner->getName ());
- msg = msg->concat (JvNewStringLatin1("."));
- msg = msg->concat (_Jv_NewStringUTF (field_name->data));
- msg = msg->concat (JvNewStringLatin1(" was not found."));
- throw_incompatible_class_change_error (msg);
+ java::lang::StringBuffer *sb = new java::lang::StringBuffer();
+ sb->append(JvNewStringLatin1("field "));
+ sb->append(owner->getName());
+ sb->append(JvNewStringLatin1("."));
+ sb->append(_Jv_NewStringUTF(field_name->data));
+ sb->append(JvNewStringLatin1(" was not found."));
+ throw_incompatible_class_change_error(sb->toString());
}
pool->data[index].field = the_field;
@@ -234,7 +233,6 @@ _Jv_ResolvePoolEntry (jclass klass, int index)
_Jv_Utf8Const *method_name = pool->data[name_index].utf8;
_Jv_Utf8Const *method_signature = pool->data[type_index].utf8;
- int vtable_index = -1;
_Jv_Method *the_method = 0;
jclass found_class = 0;
@@ -300,26 +298,21 @@ _Jv_ResolvePoolEntry (jclass klass, int index)
// with either loader should produce the same result,
// i.e., exactly the same jclass object. JVMS 5.4.3.3
- if (pool->tags[index] == JV_CONSTANT_InterfaceMethodref)
- vtable_index = -1;
- else
- vtable_index = _Jv_DetermineVTableIndex
- (found_class, method_name, method_signature);
-
- if (vtable_index == METHOD_NOT_THERE)
- throw_incompatible_class_change_error
- (JvNewStringLatin1 ("method not found"));
-
if (the_method == 0)
{
- jstring msg = JvNewStringLatin1 ("method ");
- msg = msg->concat (owner->getName ());
- msg = msg->concat (JvNewStringLatin1("."));
- msg = msg->concat (_Jv_NewStringUTF (method_name->data));
- msg = msg->concat (JvNewStringLatin1(" was not found."));
- throw new java::lang::NoSuchMethodError (msg);
+ java::lang::StringBuffer *sb = new java::lang::StringBuffer();
+ sb->append(JvNewStringLatin1("method "));
+ sb->append(owner->getName());
+ sb->append(JvNewStringLatin1("."));
+ sb->append(_Jv_NewStringUTF(method_name->data));
+ sb->append(JvNewStringLatin1(" was not found."));
+ throw new java::lang::NoSuchMethodError (sb->toString());
}
+ int vtable_index = -1;
+ if (pool->tags[index] != JV_CONSTANT_InterfaceMethodref)
+ vtable_index = (jshort)the_method->index;
+
pool->data[index].rmethod =
_Jv_BuildResolvedMethod(the_method,
found_class,
@@ -370,116 +363,6 @@ _Jv_SearchMethodInClass (jclass cls, jclass klass,
return 0;
}
-/** FIXME: this is a terribly inefficient algorithm! It would improve
- things if compiled classes to know vtable offset, and _Jv_Method had
- a field for this.
-
- Returns METHOD_NOT_THERE if this class does not declare the given method.
- Returns METHOD_INACCESSIBLE if the given method does not appear in the
- vtable, i.e., it is static, private, final or a constructor.
- Otherwise, returns the vtable index. */
-int
-_Jv_DetermineVTableIndex (jclass klass,
- _Jv_Utf8Const *name,
- _Jv_Utf8Const *signature)
-{
- using namespace java::lang::reflect;
-
- jclass super_class = klass->getSuperclass ();
-
- if (super_class != NULL)
- {
- int prev = _Jv_DetermineVTableIndex (super_class,
- name,
- signature);
- if (prev != METHOD_NOT_THERE)
- return prev;
- }
-
- /* at this point, we know that the super-class does not declare
- * the method. Otherwise, the above call would have found it, and
- * determined the result of this function (-1 or some positive
- * number).
- */
-
- _Jv_Method *meth = _Jv_GetMethodLocal (klass, name, signature);
-
- /* now, if we do not declare this method, return zero */
- if (meth == NULL)
- return METHOD_NOT_THERE;
-
- /* so now, we know not only that the super class does not declare the
- * method, but we do! So, this is a first declaration of the method. */
-
- /* now, the checks for things that are declared in this class, but do
- * not go into the vtable. There are three cases.
- * 1) the method is static, private or final
- * 2) the class itself is final, or
- * 3) it is the method <init>
- */
-
- if ((meth->accflags & (Modifier::STATIC
- | Modifier::PRIVATE
- | Modifier::FINAL)) != 0
- || (klass->accflags & Modifier::FINAL) != 0
- || _Jv_equalUtf8Consts (name, init_name))
- return METHOD_INACCESSIBLE;
-
- /* reaching this point, we know for sure, that the method in question
- * will be in the vtable. The question is where. */
-
- /* the base offset, is where we will start assigning vtable
- * indexes for this class. It is 0 for base classes
- * and for non-base classes it is the
- * number of entries in the super class' vtable. */
-
- int base_offset;
- if (super_class == 0)
- base_offset = 0;
- else
- base_offset = super_class->vtable_method_count;
-
- /* we will consider methods 0..this_method_index-1. And for each one,
- * determine if it is new (i.e., if it appears in the super class),
- * and if it should go in the vtable. If so, increment base_offset */
-
- int this_method_index = meth - (&klass->methods[0]);
-
- for (int i = 0; i < this_method_index; i++)
- {
- _Jv_Method *m = &klass->methods[i];
-
- /* fist some checks for things that surely do not go in the
- * vtable */
-
- if ((m->accflags & (Modifier::STATIC | Modifier::PRIVATE)) != 0)
- continue;
- if (_Jv_equalUtf8Consts (m->name, init_name))
- continue;
-
- /* Then, we need to know if this method appears in the
- superclass. (This is where this function gets expensive) */
- _Jv_Method *sm = _Jv_LookupDeclaredMethod (super_class,
- m->name,
- m->signature);
-
- /* if it was somehow declared in the superclass, skip this */
- if (sm != NULL)
- continue;
-
- /* but if it is final, and not declared in the super class,
- * then we also skip it */
- if ((m->accflags & Modifier::FINAL) != 0)
- continue;
-
- /* finally, we can assign the index of this method */
- /* m->vtable_index = base_offset */
- base_offset += 1;
- }
-
- return base_offset;
-}
-
/* this is installed in place of abstract methods */
static void
_Jv_abstractMethodError ()
@@ -647,107 +530,8 @@ _Jv_PrepareClass(jclass klass)
return;
}
- /* Now onto the actual job: vtable layout. First, count how many new
- methods we have */
- int new_method_count = 0;
-
- jclass super_class = clz->getSuperclass ();
-
- for (int i = 0; i < clz->method_count; i++)
- {
- _Jv_Method *this_meth = &clz->methods[i];
-
- if ((this_meth->accflags & (Modifier::STATIC | Modifier::PRIVATE)) != 0
- || _Jv_equalUtf8Consts (this_meth->name, init_name))
- {
- /* skip this, it doesn't go in the vtable */
- continue;
- }
-
- _Jv_Method *orig_meth = _Jv_LookupDeclaredMethod (super_class,
- this_meth->name,
- this_meth->signature);
-
- if (orig_meth == 0)
- {
- // new methods that are final, also don't go in the vtable
- if ((this_meth->accflags & Modifier::FINAL) != 0)
- continue;
-
- new_method_count += 1;
- continue;
- }
-
- if ((orig_meth->accflags & (Modifier::STATIC
- | Modifier::PRIVATE
- | Modifier::FINAL)) != 0
- || ((orig_meth->accflags & Modifier::ABSTRACT) == 0
- && (this_meth->accflags & Modifier::ABSTRACT) != 0
- && (klass->accflags & Modifier::ABSTRACT) == 0))
- {
- clz->state = JV_STATE_ERROR;
- clz->notifyAll ();
- throw new java::lang::IncompatibleClassChangeError (clz->getName ());
- }
-
- /* FIXME: At this point, if (loader != super_class->loader), we
- * need to "impose class loader constraints" for the types
- * involved in the signature of this method */
- }
-
- /* determine size */
- int vtable_count = (super_class->vtable_method_count) + new_method_count;
- clz->vtable_method_count = vtable_count;
-
- /* allocate vtable structure */
- _Jv_VTable *vtable = _Jv_VTable::new_vtable (vtable_count);
- vtable->clas = clz;
- vtable->gc_descr = _Jv_BuildGCDescr(clz);
-
- {
- jclass effective_superclass = super_class;
-
- /* If super_class is abstract or an interface it has no vtable.
- We need to find a real one... */
- while (effective_superclass && effective_superclass->vtable == NULL)
- effective_superclass = effective_superclass->superclass;
-
- /* If we ended up without a superclass, use Object. */
- if (! effective_superclass)
- effective_superclass = &java::lang::Object::class$;
-
- /* copy super class' vtable entries. */
- if (effective_superclass && effective_superclass->vtable)
- for (int i = 0; i < effective_superclass->vtable_method_count; ++i)
- vtable->set_method (i, effective_superclass->vtable->get_method (i));
- }
-
- /* now, install our own vtable entries, reprise... */
- for (int i = 0; i < clz->method_count; i++)
- {
- _Jv_Method *this_meth = &clz->methods[i];
-
- int index = _Jv_DetermineVTableIndex (clz,
- this_meth->name,
- this_meth->signature);
-
- if (index == METHOD_NOT_THERE)
- throw_internal_error ("method now found in own class");
-
- if (index != METHOD_INACCESSIBLE)
- {
- if (index > clz->vtable_method_count)
- throw_internal_error ("vtable problem...");
-
- if (clz->interpreted_methods[i] == 0)
- vtable->set_method(index, (void*)&_Jv_abstractMethodError);
- else
- vtable->set_method(index, this_meth->ncode);
- }
- }
-
- /* finally, assign the vtable! */
- clz->vtable = vtable;
+ clz->vtable_method_count = -1;
+ _Jv_MakeVTable (clz);
/* wooha! we're done. */
clz->state = JV_STATE_PREPARED;
diff --git a/libjava/sysdep/s390/locks.h b/libjava/sysdep/s390/locks.h
new file mode 100644
index 00000000000..b0f3185254f
--- /dev/null
+++ b/libjava/sysdep/s390/locks.h
@@ -0,0 +1,77 @@
+// locks.h - Thread synchronization primitives. S/390 implementation.
+
+/* Copyright (C) 2002 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. */
+
+#ifndef __SYSDEP_LOCKS_H__
+#define __SYSDEP_LOCKS_H__
+
+typedef size_t obj_addr_t; /* Integer type big enough for object */
+ /* address. */
+
+// Atomically replace *addr by new_val if it was initially equal to old.
+// Return true if the comparison succeeded.
+// Assumed to have acquire semantics, i.e. later memory operations
+// cannot execute before the compare_and_swap finishes.
+inline static bool
+compare_and_swap(volatile obj_addr_t *addr,
+ obj_addr_t old, obj_addr_t new_val)
+{
+ int result;
+
+ __asm__ __volatile__ (
+#ifndef __s390x__
+ " cs %1,%2,0(%3)\n"
+#else
+ " csg %1,%2,0(%3)\n"
+#endif
+ " ipm %0\n"
+ " srl %0,28\n"
+ : "=&d" (result), "+d" (old)
+ : "d" (new_val), "a" (addr)
+ : "cc", "memory");
+
+ return result == 0;
+}
+
+// Set *addr to new_val with release semantics, i.e. making sure
+// that prior loads and stores complete before this
+// assignment.
+inline static void
+release_set(volatile obj_addr_t *addr, obj_addr_t new_val)
+{
+ __asm__ __volatile__("bcr 15,0" : : : "memory");
+ *(addr) = new_val;
+}
+
+// Compare_and_swap with release semantics instead of acquire semantics.
+// On many architecture, the operation makes both guarantees, so the
+// implementation can be the same.
+inline static bool
+compare_and_swap_release(volatile obj_addr_t *addr,
+ obj_addr_t old, obj_addr_t new_val)
+{
+ return compare_and_swap(addr, old, new_val);
+}
+
+// Ensure that subsequent instructions do not execute on stale
+// data that was loaded from memory before the barrier.
+inline static void
+read_barrier()
+{
+ __asm__ __volatile__("bcr 15,0" : : : "memory");
+}
+
+// Ensure that prior stores to memory are completed with respect to other
+// processors.
+inline static void
+write_barrier()
+{
+ __asm__ __volatile__("bcr 15,0" : : : "memory");
+}
+#endif
diff --git a/libjava/sysdep/x86-64/locks.h b/libjava/sysdep/x86-64/locks.h
index cb6be85951b..bad6de6dc6f 100644
--- a/libjava/sysdep/x86-64/locks.h
+++ b/libjava/sysdep/x86-64/locks.h
@@ -24,10 +24,17 @@ inline static bool
compare_and_swap(volatile obj_addr_t *addr, obj_addr_t old, obj_addr_t new_val)
{
char result;
+#ifdef __x86_64__
__asm__ __volatile__("lock; cmpxchgq %2, %0; setz %1"
: "+m"(*(addr)), "=q"(result)
: "r" (new_val), "a"(old)
: "memory");
+#else
+ __asm__ __volatile__("lock; cmpxchgl %2, %0; setz %1"
+ : "+m"(*(addr)), "=q"(result)
+ : "r" (new_val), "a"(old)
+ : "memory");
+#endif
return (bool) result;
}
diff --git a/libjava/testsuite/ChangeLog b/libjava/testsuite/ChangeLog
index 73bc1251899..98006afe6e7 100644
--- a/libjava/testsuite/ChangeLog
+++ b/libjava/testsuite/ChangeLog
@@ -1,3 +1,124 @@
+2002-12-01 Tom Tromey <tromey@redhat.com>
+
+ * libjava.jacks/jacks.exp (gcj_jacks_setup_xfail): New function.
+ (gcj_jacks_parse): Use it; set up xfails.
+ * libjava.jacks/jacks.xfail: New file.
+
+2002-12-01 Mark Wielaard <mark@klomp.org>
+
+ * libjava.mauve/xfails: Remove Inspector FAILs that now PASS.
+
+2002-11-21 Tom Tromey <tromey@redhat.com>
+
+ For PR java/8676:
+ * libjava.lang/pr8676.java: New file.
+ * libjava.lang/pr8676.out: New file.
+
+2002-11-21 Ulrich Weigand <uweigand@de.ibm.com>
+
+ * libjava.loader/loader.exp (gcj_loader_test_one): Fix typo in
+ 'type' argument to libjava_tcompile.
+ (gcj_loader_run): Use libjava_tcompile instead of running
+ GCJ_UNDER_TEST directly.
+
+2002-11-05 Tom Tromey <tromey@redhat.com>
+
+ * libjava.jacks/jacks.exp: New file.
+
+2002-11-04 Tom Tromey <tromey@redhat.com>
+
+ * libjava.compile/pr7912.java: New file.
+
+2002-11-04 Andrew Haley <aph@redhat.com>
+
+ * libjava.lang/utilTest.java: New.
+ * libjava.lang/utilTest.out: New.
+
+2002-11-04 Anthony Green <green@redhat.com>
+
+ * libjava.loader/MyLoader.java: New constructor.
+ * libjava.loader/TestParent.java: New file.
+ * libjava.loader/TestParent.out: New file.
+
+2002-11-04 Anthony Green <green@redhat.com>
+
+ * libjava.loader/TestEarlyGC.java,
+ libjava.loader/TestEarlyGC.out: New files (from
+ Jeff Sturm).
+
+2002-11-04 Anthony Green <green@redhat.com>
+
+ * libjava.loader/dummy.java, libjava.loader/loader.exp,
+ libjava.loader/MyLoader.java, libjava.loader/TestLeak.java,
+ libjava.loader/TestLeak.out, libjava.loader/TestMultiple.java,
+ libjava.loader/TestMultiple.out: New files.
+
+2002-11-02 Tom Tromey <tromey@redhat.com>
+
+ * libjava.lang/initexc.java (fail): Static initializers must be
+ able to complete normally. From Eric Blake.
+
+ * libjava.lang/initexc.java: New file.
+ * libjava.lang/initexc.out: New file.
+
+2002-11-01 Tom Tromey <tromey@redhat.com>
+
+ For PR java/8415:
+ * libjava.lang/pr8415.java: New file.
+ * libjava.lang/pr8415.out: New file.
+
+ * libjava.mauve/mauve.exp (find_mauve_sources): New proc.
+ (test_mauve): Use it.
+ (test_mauve_sim): Likewise.
+
+2002-10-24 Tom Tromey <tromey@redhat.com>
+
+ * libjava.lang/Primes.java: Removed.
+ * libjava.lang/Primes.out: Removed.
+
+2002-10-23 Tom Tromey <tromey@redhat.com>
+
+ For PR java/6388:
+ * libjava.lang/pr6388.java: New file.
+ * libjava.lang/pr6388.out: New file.
+
+2002-10-15 Andrew Haley <aph@redhat.com>
+
+ * libjava.lang/EvaluationOrder.java (EvaluationOrder): New.
+ * libjava.lang/EvaluationOrder.out (EvaluationOrder): New.
+
+2002-10-14 Andrew Haley <aph@redhat.com>
+
+ * libjava.lang/StaticConstructor.java: New.
+ * libjava.lang/StaticConstructor.out: New.
+
+2002-10-13 Mark Wielaard <mark@klomp.org>
+
+ * libjava.mauve/xfails: Remove tests that now XPASS.
+
+2002-10-03 Andrew Haley <aph@redhat.com>
+
+ * libjava.lang/Array_3.java (baz): New.
+ (main): Call baz.
+
+2002-09-29 Anthony Green <green@redhat.com>
+
+ * libjava.lang/TestProxy.java: New file.
+ * libjava.lang/TestProxy.out: Ditto.
+
+2002-09-29 Anthony Green <green@redhat.com>
+
+ * libjava.lang/utf8concat.java: New file.
+ * libjava.lang/utf8concat.out: Ditto.
+
+2002-08-26 Tom Tromey <tromey@redhat.com>
+
+ * libjava.compile/narrow_case.java: New file.
+
+2002-08-25 Adam Megacz <adam@xwt.org>
+
+ * lib/libjava.exp: don't apply -no-install when platform is mingw.
+
2002-08-16 H.J. Lu <hjl@gnu.org>
* lib/libjava.exp (gcc_version): Removed.
diff --git a/libjava/testsuite/lib/libjava.exp b/libjava/testsuite/lib/libjava.exp
index bbac0eaca9a..3cb6140438d 100644
--- a/libjava/testsuite/lib/libjava.exp
+++ b/libjava/testsuite/lib/libjava.exp
@@ -405,7 +405,7 @@ proc libjava_arguments {{mode compile}} {
# Avoid libtool wrapper scripts when possible.
# but not if libtool warnings results in FAILs
if {$mode == "link"} {
- if {! [istarget "*-*-cygwin*"]} {
+ if {! [istarget "*-*-cygwin*"] && ! [istarget "*-*-mingw*"] } {
lappend args "additional_flags=-no-install"
}
}
diff --git a/libjava/testsuite/libjava.compile/narrow_case.java b/libjava/testsuite/libjava.compile/narrow_case.java
new file mode 100644
index 00000000000..48b56820256
--- /dev/null
+++ b/libjava/testsuite/libjava.compile/narrow_case.java
@@ -0,0 +1,11 @@
+public class narrow_case
+{
+ private int test(byte b)
+ {
+ switch (b)
+ {
+ case '0' :return 0;
+ }
+ return 99;
+ }
+}
diff --git a/libjava/testsuite/libjava.compile/pr7912.java b/libjava/testsuite/libjava.compile/pr7912.java
new file mode 100644
index 00000000000..a7de398462e
--- /dev/null
+++ b/libjava/testsuite/libjava.compile/pr7912.java
@@ -0,0 +1,8 @@
+public class pr7912
+{
+ static Cloneable c;
+ public static void main(String[] args)
+ {
+ c = new int[1];
+ }
+}
diff --git a/libjava/testsuite/libjava.jacks/jacks.exp b/libjava/testsuite/libjava.jacks/jacks.exp
new file mode 100644
index 00000000000..b7f87eb6316
--- /dev/null
+++ b/libjava/testsuite/libjava.jacks/jacks.exp
@@ -0,0 +1,99 @@
+# Run the Jacks test suite.
+# See http://www-124.ibm.com/developerworks/oss/cvs/jikes/~checkout~/jacks/jacks.html
+
+proc gcj_jacks_setup_xfail {ary} {
+ upvar $ary array
+ global srcdir
+
+ set fd [open $srcdir/libjava.jacks/jacks.xfail]
+ while {! [eof $fd]} {
+ set array([gets $fd]) {}
+ }
+ close $fd
+}
+
+proc gcj_jacks_write {filename} {
+ global GCJ_UNDER_TEST
+
+ set gcjl [split $GCJ_UNDER_TEST]
+ set gcj_cmd [lindex $gcjl 0]
+ set rest [join [lreplace $gcjl 0 0]]
+ append rest " -C"
+
+ set fd [open $filename w]
+ puts $fd "set JAVAC $gcj_cmd"
+ puts $fd "set JAVA_CLASSPATH \"\""
+ puts $fd "set JAVAC_FLAGS [list $rest]"
+ puts $fd "set JAVA [list [libjava_find_gij]]"
+ puts $fd "set JAVA_FLAGS \"\""
+ puts $fd "set JAVAC_ENCODING_FLAG --encoding="
+ puts $fd "set tcltest::testConstraints(encoding) 1"
+ puts $fd "set tcltest::testConstraints(gcj) 1"
+ # "Time-consuming JVM limitation tests".
+ # puts $fd "set tcltest::testConstraints(jvm) 1"
+ close $fd
+}
+
+proc gcj_jacks_parse {file} {
+ if {[catch {open $file} fd]} {
+ verbose "couldn't parse Jacks output: $fd"
+ return
+ }
+
+ verbose "Reading jacks.xfail"
+ gcj_jacks_setup_xfail xfails
+
+ while {! [eof $fd]} {
+ set line [gets $fd]
+ if {[string match RESULT* $line]} {
+ set linelist [split $line]
+ set test [lindex $linelist 1]
+ if {[info exists xfails($test)]} {
+ setup_xfail "*-*-*"
+ }
+ if {[lindex $linelist 2] == "PASSED"} {
+ pass $test
+ } else {
+ fail $test
+ }
+ }
+ }
+
+ close $fd
+}
+
+proc gcj_jacks_run {} {
+ global srcdir
+
+ if {! [file isdirectory $srcdir/libjava.jacks/jacks]} {
+ # No tests.
+ verbose "Jacks tests not found"
+ return
+ }
+
+ # Jacks forces us to do this. You can't run it from a separate
+ # tree.
+ verbose "Copying Jacks..."
+ catch {system "rm -rf jacks"}
+ catch {system "cp -r $srcdir/libjava.jacks/jacks jacks"}
+
+ set here [pwd]
+ cd jacks
+
+ verbose "Writing Jacks setup file"
+ gcj_jacks_write gcj_setup
+
+ verbose "Running Jacks..."
+ if {[catch {exec ./jacks gcj} msg]} {
+ verbose "jacks invocation failure: $msg"
+ fail "running jacks"
+ } else {
+ pass "running jacks"
+
+ gcj_jacks_parse logging/gcj.log
+ }
+
+ cd $here
+}
+
+gcj_jacks_run
diff --git a/libjava/testsuite/libjava.jacks/jacks.xfail b/libjava/testsuite/libjava.jacks/jacks.xfail
new file mode 100644
index 00000000000..8e2ebe77f0e
--- /dev/null
+++ b/libjava/testsuite/libjava.jacks/jacks.xfail
@@ -0,0 +1,848 @@
+14.14-plain-2
+14.14-plain-5
+14.14-label-1
+14.14-label-2
+14.14-label-5
+14.14-label-8
+14.7-shadow-3
+14.3-1
+14.3-scope-2
+14.3-scope-3
+14.3-scope-4
+14.3-scope-5
+14.3-scope-9
+14.3-scope-11
+14.4.2-shadow-5
+14.4.2-shadow-6
+14.4.2-shadow-7
+14.4.2-shadow-9
+14.19-shadow-4
+14.19-shadow-5
+14.19-shadow-6
+14.19-shadow-7
+14.19-shadow-12
+14.19-shadow-13
+14.19-shadow-14
+14.19-shadow-15
+14.19.exception-13
+14.19.exception-14
+14.19.exception-15
+14.19.exception-16
+14.19.exception-21
+14.19.exception-22
+14.19.exception-23
+14.19.exception-24
+14.20-block-4
+14.20-block-5
+14.20-block-9
+14.20-block-10
+14.20-local-2
+14.20-label-5
+14.20-label-6
+14.20-label-8
+14.20-label-9
+14.20-label-10
+14.20-label-11
+14.20-label-12
+14.20-label-13
+14.20-label-14
+14.20-label-15
+14.20-switch-8
+14.20-switch-9
+14.20-switch-14
+14.20-switch-15
+14.20-switch-17
+14.20-switch-18
+14.20-switch-19
+14.20-switch-20
+14.20-switch-21
+14.20-switch-22
+14.20-switch-23
+14.20-switch-24
+14.20-while-4
+14.20-while-5
+14.20-while-12
+14.20-while-13
+14.20-while-14
+14.20-while-15
+14.20-while-16
+14.20-while-17
+14.20-while-18
+14.20-while-19
+14.20-do-6
+14.20-do-7
+14.20-do-9
+14.20-do-10
+14.20-do-11
+14.20-do-12
+14.20-do-13
+14.20-do-14
+14.20-do-15
+14.20-do-16
+14.20-do-17
+14.20-do-18
+14.20-do-19
+14.20-do-20
+14.20-do-21
+14.20-do-22
+14.20-do-23
+14.20-do-24
+14.20-do-25
+14.20-do-26
+14.20-do-27
+14.20-do-28
+14.20-do-29
+14.20-do-30
+14.20-do-31
+14.20-do-32
+14.20-do-33
+14.20-for-4
+14.20-for-5
+14.20-for-8
+14.20-for-9
+14.20-for-15
+14.20-for-16
+14.20-for-17
+14.20-for-18
+14.20-for-19
+14.20-for-20
+14.20-for-21
+14.20-for-22
+14.20-abrupt-2
+14.20-abrupt-3
+14.20-abrupt-6
+14.20-abrupt-7
+14.20-abrupt-10
+14.20-abrupt-11
+14.20-abrupt-14
+14.20-abrupt-15
+14.20-synchronized-3
+14.20-synchronized-4
+14.20-try-3
+14.20-try-4
+14.20-try-9
+14.20-try-10
+14.20-try-14
+14.20-try-15
+14.20-try-18
+14.20-try-19
+14.20-try-22
+14.20-try-23
+14.20-try-27
+14.20-try-28
+14.20-try-31
+14.20-try-32
+14.20-catch-15
+14.20-catch-17
+14.20-if-6
+14.20-if-7
+14.20-for-update-1
+8.1.1.1-default-abstract-11
+8.1.1.1-default-abstract-13
+8.1.1.1-default-abstract-15
+8.1.1.1-default-abstract-19
+8.1.1.1-default-abstract-21
+8.1.1.1-default-abstract-22
+8.1.1.1-default-abstract-24
+8.1.1.1-default-abstract-25
+8.1.2-static-1
+8.1.2-static-11
+8.1.2-static-16
+8.1.2-enclosing-4
+8.1.2-enclosing-5
+8.1.3-object-3
+8.1.3-superclass-10
+8.1.3-superclass-12
+8.1.3-superclass-13
+8.1.4-superinterface-8
+8.1.4-superinterface-10
+8.1.4-superinterface-11
+8.2-accessibility-inherited-member-5
+8.8.5.1-example-1
+8.8.5.1-example-3
+8.8.5.1-qualified-1
+8.8.5.1-qualified-2
+8.8.5.1-qualified-3
+8.8.5.1-qualified-4
+8.8.5.1-qualified-10
+8.8.5.1-qualified-11
+8.8.5.1-qualified-12
+8.8.5.1-qualified-13
+8.8.5.1-qualified-15
+8.8.7-inaccessible-default-constructor-toplevel-2
+8.8.7-accessible-default-constructor-inner-18
+8.8.7-accessible-default-constructor-inner-20
+8.3-inheritance-1
+8.3-inheritance-2
+8.3-inheritance-3
+8.3-inheritance-5
+8.3-inheritance-6
+8.3.1.2-final-2
+8.3.1.2-final-17
+8.3.1.2-final-19
+8.3.1.2-final-21
+8.3.1.2-final-24
+8.3.1.2-final-27
+8.3.1.2-final-28
+8.3.1.2-final-29
+8.3.2-abrupt-3
+8.3.2-abrupt-5
+8.3.2-abrupt-6
+8.3.2-abrupt-7
+8.3.2.2-super-2
+8.3.2.3-illegal-forward-instance-1
+8.3.2.3-illegal-forward-instance-2
+8.3.2.3-illegal-forward-instance-3
+8.3.2.3-illegal-forward-instance-4
+8.3.2.3-illegal-forward-instance-5
+8.3.2.3-illegal-forward-instance-6
+8.3.2.3-illegal-forward-instance-7
+8.3.2.3-illegal-forward-instance-8
+8.3.2.3-illegal-forward-instance-9
+8.3.2.3-legal-forward-instance-11
+8.3.2.3-illegal-forward-static-1
+8.3.2.3-illegal-forward-static-2
+8.3.2.3-illegal-forward-static-3
+8.3.2.3-illegal-forward-static-4
+8.3.2.3-illegal-forward-static-5
+8.3.2.3-illegal-forward-static-6
+8.3.2.3-illegal-forward-static-7
+8.3.2.3-illegal-forward-static-8
+8.3.2.3-illegal-forward-static-9
+8.3.2.3-illegal-forward-static-10
+8.6-checked-exception-2
+8.6-checked-exception-4
+8.6-checked-exception-5
+8.6-checked-exception-6
+8.6-checked-exception-8
+8.6-checked-exception-10
+8.6-checked-exception-11
+8.6-checked-exception-12
+8.6-abrupt-1
+8.6-abrupt-4
+8.5-inheritance-4
+8.5-inheritance-6
+8.5.2-non-static-member-usage-2
+8.4.6-miranda-2
+8.4.6-miranda-3
+8.4.6-miranda-4
+8.4.6-inheritance-1
+8.4.6-inheritance-2
+8.4.6.2-hiding-3
+8.4.6.4-multiple-3
+8.4.6.4-multiple-4
+8.4.6.4-multiple-5
+8.4.6.4-multiple-7
+8.4.6.4-multiple-8
+8.4.6.4-abstract-1
+8.4.6.4-abstract-2
+8.4.6.4-abstract-4
+8.4.6.4-abstract-9
+8.4.6.4-abstract-10
+8.4.6.1-override-3
+8.4.6.3-modifier-8
+8.4.6.3-modifier-9
+8.4.6.3-modifier-10
+8.4.6.3-modifier-11
+8.4.6.3-modifier-12
+8.4.6.3-modifier-13
+8.4.6.3-default-4
+8.4.6.3-default-6
+8.4.6.3-default-10
+8.4.6.3-default-12
+8.4.6.3-default-14
+8.4.6.3-signature-4
+8.4.6.3-signature-7
+8.4.6.3-signature-9
+8.4.6.3-signature-10
+8.4.6.3-signature-12
+8.4.6.3-signature-15
+8.4.3-native-9
+8.4.3-native-10
+8.4.3-bad-1
+8.4.3-bad-2
+8.7-abrupt-1
+5.1.3-dti-1
+5.1.3-dti-2
+5.1.3-fti-1
+5.1.3-fti-2
+5.1.2-bts-1
+5.1.2-bts-2
+5.1.2-bts-3
+5.1.2-bts-4
+5.1.2-bts-5
+5.1.2-bti-1
+5.1.2-bti-3
+5.1.2-bti-5
+5.1.2-btl-1
+5.1.2-btl-3
+5.1.2-btl-5
+5.1.2-btf-1
+5.1.2-btf-3
+5.1.2-btf-5
+5.1.2-btd-1
+5.1.2-btd-3
+5.1.2-btd-5
+5.1.2-sti-1
+5.1.2-sti-5
+5.1.2-stl-1
+5.1.2-stl-3
+5.1.2-stl-5
+5.1.2-stf-1
+5.1.2-stf-3
+5.1.2-stf-5
+5.1.2-std-3
+5.1.2-std-5
+16-static-1
+16-static-2
+16-instance-5
+16-instance-6
+16-instance-7
+16.5-anonymous-3
+16.8-constructor-6
+16.8-constructor-7
+16.8-constructor-8
+16.1.7-simple-definite-assignment-fail-8
+16.1.7-simple-definite-assignment-fail-9
+16.1.7-compound-definite-assignment-fail-8
+16.1.7-compound-definite-assignment-fail-9
+16.1.7-simple-definite-unassignment-fail-1
+16.1.7-compound-definite-unassignment-fail-1
+16.1.7-compound-definite-unassignment-fail-6
+16.1.7-compound-definite-unassignment-pass-6
+16.1.7-compound-definite-unassignment-pass-7
+16.1.2-definite-unassignment-fail-6
+16.1.5-definite-unassignment-pass-4
+16.1.5-definite-unassignment-pass-7
+16.1.5-not-assignable-7
+16.1.5-not-assignable-8
+16.1.3-definite-unassignment-fail-6
+16.1.8-definite-unassign-fail-1
+16.1.8-definite-unassign-fail-2
+16.1.8-definite-unassign-fail-3
+16.1.8-definite-unassign-fail-4
+16.2.10-definite-unassign-pass-1
+16.2.10-definite-unassign-pass-2
+16.2.10-definite-unassign-pass-4
+16.2.10-definite-unassign-pass-5
+16.2.10-definite-unassign-pass-6
+16.2.10-definite-unassign-pass-7
+16.2.10-definite-unassign-pass-8
+16.2.10-definite-unassign-pass-9
+16.2.10-definite-unassign-fail-6
+16.2.10-definite-unassign-fail-7
+16.2.10-definite-unassign-fail-8
+16.2.10-definite-unassign-fail-9
+16.2.10-definite-assign-pass-2
+16.2.10-definite-assign-fail-2
+16.2.11-definite-unassign-pass-1
+16.2.11-definite-unassign-pass-2
+16.2.11-definite-unassign-pass-4
+16.2.11-definite-unassign-pass-5
+16.2.11-definite-unassign-pass-6
+16.2.11-definite-unassign-pass-7
+16.2.11-definite-unassign-pass-8
+16.2.11-definite-unassign-fail-7
+16.2.11-definite-unassign-fail-8
+16.2.11-definite-unassign-fail-9
+16.2.11-definite-assign-pass-2
+16.2.11-definite-assign-fail-3
+16.2.7-final-4
+16.2.7-final-6
+16.2.5-definite-unassign-pass-1
+16.2.5-definite-unassign-pass-2
+16.2.5-definite-unassign-pass-3
+16.2.3-switch-1
+16.2.8-final-1
+16.2.8-final-2
+16.2.8-unassigned-1
+16.2.8-unassigned-6
+16.2.8-unassigned-8
+16.2.14-definite-unassign-fail-5
+16.2.14-definite-unassign-fail-6
+16.2.14-definite-unassign-fail-7
+16.2.14-definite-unassign-fail-8
+16.2.14-definite-unassign-fail-12
+16.2.14-definite-unassign-fail-13
+16.2.9-definite-unassign-pass-1
+16.2.9-definite-unassign-pass-2
+16.2.9-definite-unassign-pass-4
+16.2.9-definite-unassign-pass-5
+16.2.9-definite-unassign-pass-6
+16.2.9-definite-unassign-pass-7
+16.2.9-definite-unassign-pass-8
+16.2.9-definite-unassign-fail-5
+16.2.9-definite-unassign-fail-6
+16.2.9-definite-unassign-fail-7
+16.2.9-definite-assign-pass-2
+16.2.9-definite-assign-fail-3
+15.18.1-float-1
+15.18.1-float-2
+15.18.1-float-3
+15.18.1-float-4
+15.18.1-float-5
+15.18.1-float-6
+15.18.1-float-7
+15.18.1-float-8
+15.18.1-float-9
+15.18.1-float-10
+15.18.1-float-11
+15.18.1-float-12
+15.18.1-double-1
+15.18.1-double-2
+15.18.1-double-3
+15.18.1-double-4
+15.18.1-double-5
+15.18.1-double-6
+15.18.1-double-7
+15.18.1-double-8
+15.18.1-double-9
+15.18.1-double-10
+15.18.1-double-11
+15.18.1-double-12
+15.18.1-double-13
+15.18.1-valid-1
+15.13-anon-1
+15.26.2-mult-12
+15.26.2-div-12
+15.26.2-mod-12
+15.26.2-add-12
+15.26.2-sub-12
+15.26.2-left-shift-12
+15.26.2-signed-right-shift-12
+15.26.2-unsigned-right-shift-12
+15.26.2-and-10
+15.26.2-and-12
+15.26.2-xor-10
+15.26.2-xor-12
+15.26.2-or-10
+15.26.2-or-12
+15.16-value-1
+15.16-value-2
+15.16-semantic-5
+15.9.5.1-superconstructor-2
+15.9.5.1-superconstructor-4
+15.9.5.1-superconstructor-7
+15.9.5.1-superconstructor-8
+15.9.5.1-exception-1
+15.9.5.1-exception-3
+15.9.5.1-exception-4
+15.9.3-choosing-4
+15.9.1-unqualified-anonymous-23
+15.9.1-unqualified-anonymous-25
+15.9.1-unqualified-anonymous-26
+15.9.1-unqualified-anonymous-27
+15.9.1-qualified-anonymous-2
+15.9.1-qualified-anonymous-6
+15.9.1-qualified-anonymous-7
+15.9.1-qualified-anonymous-10
+15.9.1-qualified-anonymous-12
+15.9.1-qualified-anonymous-13
+15.9.1-qualified-anonymous-14
+15.9.1-qualified-anonymous-17
+15.9.1-qualified-anonymous-18
+15.9.1-qualified-anonymous-20
+15.9.1-qualified-anonymous-22
+15.9.1-qualified-anonymous-26
+15.9.1-qualified-anonymous-28
+15.9.1-unqualified-concrete-6
+15.9.1-unqualified-concrete-7
+15.9.1-unqualified-concrete-10
+15.9.1-unqualified-concrete-15
+15.9.1-qualified-concrete-6
+15.9.1-qualified-concrete-7
+15.9.1-qualified-concrete-10
+15.9.1-qualified-concrete-12
+15.9.1-qualified-concrete-14
+15.9.1-qualified-concrete-16
+15.9.1-qualified-concrete-20
+15.9.1-qualified-concrete-23
+15.28-primitive-9
+15.28-primitive-15
+15.28-primitive-16
+15.28-primitive-17
+15.28-simple-name-6
+15.28-simple-name-8
+15.28-uninitialized-simple-name-3
+15.28-cast-simple-name-1
+15.28-cast-simple-name-2
+15.28-cast-simple-name-3
+15.28-qualified-name-5
+15.28-qualified-name-6
+15.28-qualified-name-7
+15.28-qualified-name-8
+15.28-qualified-name-9
+15.28-qualified-name-10
+15.28-string-2
+15.28-string-5
+15.28-string-9
+15.28-string-11
+15.28-string-13
+15.28-string-15
+15.28-string-16
+15.28-string-17
+15.28-string-18
+15.28-simple-namestr-1
+15.28-simple-namestr-2
+15.28-simple-namestr-3
+15.28-simple-namestr-4
+15.28-qualified-namestr-7
+15.28-qualified-namestr-8
+15.28-qualified-namestr-9
+15.28-notstring-1
+15.28-null-1
+15.28-null-3
+15.28-instanceof-3
+15.21-assoc-7
+15.21-assoc-8
+15.21-equal-3
+15.21-type-7
+15.21-type-17
+15.21-type-21
+15.21-type-22
+15.21-type-23
+15.21-type-24
+15.21-type-30
+15.11.2-syntax-1
+15.11.2-explicit-constructor-2
+15.11.2-meaning-3
+15.11.2-meaning-6
+15.11.2-meaning-8
+15.11.2-meaning-9
+15.11.2-meaning-10
+15.11.2-meaning-11
+15.11.2-meaning-13
+15.11.2-meaning-14
+15.11.2-meaning-17
+15.11.1-ambiguous-2
+15.11.1-ambiguous-3
+15.11.1-explicit-constructor-3
+15.12.3-explicit-constructor-3
+15.12.3-explicit-constructor-4
+15.12.3-explicit-constructor-5
+15.12.3-explicit-constructor-7
+15.12.3-explicit-constructor-10
+15.12.3-abstract-1
+15.12.3-abstract-2
+15.12.3-abstract-3
+15.12.1-syntax-1
+15.12.1-type-14
+15.12.2.1-accessibility-method-2
+15.12.2.1-accessibility-method-4
+15.12.2.1-accessibility-method-6
+15.12.2.2-ambiguous-1
+15.12.2.2-ambiguous-2
+15.12.2.2-ambiguous-6
+15.12.2.2-ambiguous-9
+15.12.2.2-ambiguous-10
+15.12.2.2-ambiguous-12
+15.12.2.2-ambiguous-14
+15.12.2.2-ambiguous-18
+15.12.2.2-ambiguous-21
+15.17-mod-3
+15.17-mod-4
+15.17.3-assoc-2
+15.17.3-float-1
+15.17.3-float-2
+15.17.3-float-3
+15.17.3-float-4
+15.17.3-float-5
+15.17.3-float-6
+15.17.3-float-7
+15.17.3-float-8
+15.17.3-float-9
+15.17.3-float-10
+15.17.3-float-11
+15.17.3-float-12
+15.17.3-float-13
+15.17.3-float-14
+15.17.3-double-1
+15.17.3-double-2
+15.17.3-double-3
+15.17.3-double-4
+15.17.3-double-5
+15.17.3-double-6
+15.17.3-double-7
+15.17.3-double-8
+15.17.3-double-9
+15.17.3-double-10
+15.17.3-double-11
+15.17.3-double-12
+15.17.3-double-13
+15.17.3-double-14
+15.14.2-final-2
+15.14.2-final-3
+15.14.1-final-2
+15.14.1-final-3
+15.8.2-type-11
+15.8.2-type-12
+15.8.2-type-13
+15.8.2-type-14
+15.8.5-field-expression-6
+15.8.5-method-expression-8
+15.8.5-variable-5
+15.8.5-variable-6
+15.8.5-variable-7
+15.8.5-variable-8
+15.15-precedence-5
+15.15.2-final-2
+15.15.2-final-3
+15.15.1-final-2
+15.15.1-final-3
+9.4-modifier-10
+9.4.1-conflict-2
+9.3.1-init-1
+9.3.1-illegal-forward-1
+9.3.1-illegal-forward-2
+9.1.3-body-5
+9.1.1-in-class-17
+9.1.1-in-class-24
+9.1.1-in-interface-2
+9.1.1-in-interface-3
+9.1.1-in-interface-9
+9.1.1-in-interface-16
+9.1.2-interface-3
+9.1.2-interface-5
+9.1.2-interface-6
+9.1.2-supertype-1
+9.2-implicit-2
+9.2-implicit-3
+9.2-implicit-4
+9.2-implicit-6
+9.2-implicit-7
+9.2-implicit-11
+9.2-implicit-12
+9.2-implicit-15
+9.2-implicit-17
+9.2-implicit-18
+9.2-implicit-19
+3.7-line-number-1
+3.7-line-number-2
+3.7-line-number-3
+3.7-line-number-4
+3.7-line-number-5
+3.7-line-number-6
+3.7-line-number-7
+3.7-line-number-8
+3.7-line-number-9
+3.7-line-number-10
+3.7-line-number-11
+3.7-line-number-12
+3.7-line-number-13
+3.7-line-number-14
+3.2-valid-1
+3.4-line-number-1
+3.4-line-number-2
+3.4-line-number-3
+3.4-line-number-4
+3.4-line-number-5
+3.4-line-number-6
+3.4-line-number-7
+3.4-line-number-8
+3.4-line-number-9
+3.4-line-number-10
+3.4-line-number-11
+3.4-line-number-12
+3.4-line-number-13
+3.4-line-number-14
+3.4-line-number-15
+3.4-line-number-16
+3.4-line-number-17
+3.4-line-number-18
+3.4-line-number-19
+3.4-line-number-20
+3.4-line-number-21
+3.4-line-number-22
+3.4-line-number-23
+3.4-line-number-24
+3.4-line-number-25
+3.10.2-round-6
+3.10.2-round-7
+3.10.2-round-9
+3.10.2-round-10
+3.10.2-round-11
+3.10.2-round-12
+3.10.2-double-13
+3.10.2-double-14
+3.10.1-invalid-3
+3.10.1-invalid-4
+3.3-invalid-5
+3.3-invalid-6
+3.3-invalid-7
+3.3-invalid-8
+6.6.2.2-protected-creation-3
+6.6.2.1-protected-instance-field-3
+6.6.2.1-protected-instance-field-4
+6.6.2.1-protected-instance-field-6
+6.6.2.1-protected-instance-field-7
+6.6.2.1-protected-instance-method-3
+6.6.2.1-protected-instance-method-5
+6.6.2.1-protected-instance-method-6
+6.6.2.1-protected-instance-method-7
+6.6.2.1-protected-type-2
+6.6.2.1-protected-type-4
+6.6.2.1-protected-type-5
+6.6.2.1-protected-type-7
+6.6.2.1-protected-type-8
+6.6.1-8
+6.6.1-11
+6.6.1-array-2
+6.6.1-array-3
+6.6.1-array-5
+6.6.1-array-8
+6.6.1-array-11
+6.6.1-array-13
+6.6.1-array-14
+6.6.1-array-17
+6.6.1-array-20
+6.6.1-array-22
+6.6.1-array-23
+6.6.1-array-26
+6.6.1-array-29
+6.6.1-array-31
+6.6.1-array-32
+6.6.1-array-35
+6.5.6.2-type-2
+6.5.6.2-type-6
+6.5.6.2-type-8
+6.5.6.2-type-9
+6.5.6.2-expression-6
+6.5.6.1-local-3
+6.5.6.1-local-4
+6.5.6.1-field-6
+6.5.6.1-explicit-constructor-2
+6.5.4.2-qualified-1
+6.5.4.1-simple-6
+6.5.4.1-simple-8
+6.5.1-type-15
+6.5.1-type-16
+6.5.1-type-19
+6.5.1-typeorpackage-1
+6.5.1-typeorpackage-2
+6.5.5.2-type-5
+6.5.5.2-type-6
+6.5.5.2-type-7
+6.5.5.2-type-8
+6.5.5.1-nested-4
+6.5.5.1-nested-7
+6.5.5.1-nested-8
+6.5.5.1-nested-9
+6.5.5.1-nested-14
+6.5.5.1-nested-16
+6.5.5.1-nested-17
+6.5.5.1-nested-19
+6.5.5.1-nested-20
+6.5.5.1-nested-21
+6.5.5.1-nested-22
+6.5.5.1-nested-23
+6.3-1
+7.5.1-canonical-3
+7.5.1-accessible-1
+7.5.1-duplicate-4
+7.5.2-canonical-3
+7.5.2-accessible-1
+7.5.2-accessible-3
+7.5.2-duplicate-3
+7.1-named-5
+7.1-named-6
+7.1-named-7
+7.6-unnamed-scope-1
+4.5.4-static-1
+4.5.4-static-5
+4.5.4-parameter-2
+4.5.4-parameter-3
+4.7.10-jvms-class-1
+4.7.10-jvms-class-2
+4.7.10-jvms-class-3
+4.7.10-jvms-class-4
+4.7.10-jvms-class-5
+4.7.10-jvms-class-10
+4.7.10-jvms-class-11
+4.7.10-jvms-class-12
+4.7.10-jvms-class-13
+4.7.10-jvms-class-14
+4.7.10-jvms-class-17
+4.7.10-jvms-class-18
+4.7.10-jvms-class-19
+4.7.10-jvms-method-1
+4.7.10-jvms-method-2
+4.7.10-jvms-method-3
+4.7.10-jvms-method-4
+4.7.10-jvms-method-5
+4.7.10-jvms-method-10
+4.7.10-jvms-constructor-1
+4.7.10-jvms-constructor-2
+4.7.10-jvms-constructor-3
+4.7.10-jvms-constructor-4
+4.7.10-jvms-constructor-5
+4.7.10-jvms-constructor-10
+4.7.10-jvms-constructor-11
+4.7.10-jvms-constructor-12
+4.7.10-jvms-field-1
+4.7.10-jvms-field-2
+4.7.10-jvms-field-3
+4.7.10-jvms-field-4
+4.7.10-jvms-field-5
+4.7.10-jvms-field-10
+4.7.10-jvms-field-11
+4.7.10-jvms-lex-6
+4.7.10-jvms-lex-7
+4.7.10-jvms-lex-8
+4.7.10-jvms-lex-9
+4.7.10-jvms-lex-10
+non-jls-argument-expansion-11
+non-jls-argument-expansion-12
+non-jls-argument-expansion-13
+non-jls-argument-expansion-error-2
+non-jls-argument-expansion-tokens-1
+non-jls-argument-expansion-tokens-2
+non-jls-argument-expansion-tokens-4
+non-jls-argument-expansion-tokens-5
+non-jls-zip-2
+13.1-runtime-constant-1
+13.1-runtime-constant-3
+13.1-runtime-field-1
+14-runtime-jump-1
+14-runtime-jump-2
+14.3.1-runtime-3
+14.19.2-runtime-try-1
+8.1.2-runtime-1
+6.6.1-runtime-privateconstructor-1
+8.8.3-runtime-inner-4
+8.8.7-runtime-accessible-default-1
+8.3-runtime-1
+8.4.6.4-multiple-runtime-1
+16.5-runtime-1
+16.5-runtime-2
+16.5-runtime-3
+16.5-runtime-4
+16.5-runtime-5
+12.4.1-runtime-1
+12.4.1-runtime-2
+12.4.1-runtime-3
+12.4.1-runtime-4
+15.9-runtime-numcalls-1
+15.9.4-runtime-creation-1
+15.9.4-runtime-creation-2
+15.9.4-runtime-creation-5
+15.25-runtime-1
+15.11.2-runtime-1
+15.11.2-runtime-2
+15.11.1-runtime-static-1
+15.11.1-runtime-static-2
+15.11.1-runtime-static-3
+15.12.3-runtime-mode-1
+15.12.3-runtime-mode-2
+15.12.3-runtime-mode-3
+15.12.3-runtime-mode-4
+15.12.3-runtime-mode-5
+15.12.3-runtime-mode-6
+15.12.4.1-runtime-static-1
+15.12.4.1-runtime-static-2
+15.12.4.1-runtime-super-1
+15.12.4.1-runtime-super-2
+15.14-runtime-3
+15.14-runtime-4
+15.20-2-runtime-1
+15.15-runtime-3
+15.15-runtime-4
diff --git a/libjava/testsuite/libjava.lang/Array_3.java b/libjava/testsuite/libjava.lang/Array_3.java
index 453387d51fb..e94549a0f4e 100644
--- a/libjava/testsuite/libjava.lang/Array_3.java
+++ b/libjava/testsuite/libjava.lang/Array_3.java
@@ -12,6 +12,13 @@ public class Array_3
return null;
}
+ static int baz ()
+ {
+ int[] x = (int[])null;
+ int nn = x.length;
+ return 5;
+ }
+
public static void main(String args[])
{
boolean ok = false;
@@ -68,5 +75,17 @@ public class Array_3
}
if (!ok)
throw new RuntimeException("test failed:4");
+
+ ok = false;
+ try
+ {
+ nn = baz ();
+ }
+ catch (NullPointerException _)
+ {
+ ok = true;
+ }
+ if (!ok)
+ throw new RuntimeException("test failed:5");
}
}
diff --git a/libjava/testsuite/libjava.lang/EvaluationOrder.java b/libjava/testsuite/libjava.lang/EvaluationOrder.java
new file mode 100644
index 00000000000..7c09bbb9cb9
--- /dev/null
+++ b/libjava/testsuite/libjava.lang/EvaluationOrder.java
@@ -0,0 +1,22 @@
+public class EvaluationOrder
+ {
+ private static int first (int x, int y)
+ {
+ return x;
+ }
+
+ public static void main (String[] args)
+ {
+ int l = args.length;
+
+ /* This should print:
+ 0
+ 0
+ 1
+ */
+ System.out.println (l);
+ System.out.println (first (l, ++l));
+ System.out.println (l);
+ }
+ }
+
diff --git a/libjava/testsuite/libjava.lang/EvaluationOrder.out b/libjava/testsuite/libjava.lang/EvaluationOrder.out
new file mode 100644
index 00000000000..bb5ee5c21eb
--- /dev/null
+++ b/libjava/testsuite/libjava.lang/EvaluationOrder.out
@@ -0,0 +1,3 @@
+0
+0
+1
diff --git a/libjava/testsuite/libjava.lang/Primes.java b/libjava/testsuite/libjava.lang/Primes.java
deleted file mode 100644
index d6e4336726a..00000000000
--- a/libjava/testsuite/libjava.lang/Primes.java
+++ /dev/null
@@ -1,213 +0,0 @@
-// Primes.java
-
-/** Copyright 1998
- * Roedy Green
- * Canadian Mind Products
- * 5317 Barker Avenue
- * Burnaby, BC Canada V5H 2N6
- * tel: (604) 435-3016
- * mailto:roedy@mindprod.com
- * http://mindprod.com
- */
-// May be freely distributed for any purpose but military
-
-import java.util.BitSet;
-
-/**
- * @author Roedy Green
- * @version 1.10 1998 November 10
- * Calculate primes using Eratostheses Sieve.
- * Tell if a given number is prime.
- * Find a prime just below a given number.
- * Find a prime just above a given number.
- */
-
-/*
- * version 1.1 1998 November 10 - new address and phone.
- */
-class Primes
- {
-
- /**
- * constructors
- */
- Primes()
- {
- ensureCapacity(1000);
- }
-
- /**
- * @param capacity - largest number you will be asking if prime.
- * If give too small a number, it will automatically grow by
- * recomputing the sieve array.
- */
- Primes (int capacity)
- {
- ensureCapacity(capacity);
- }
-
- /**
- * @param candidate - is this a prime?
- */
- public boolean isPrime(int candidate)
- {
- ensureCapacity(candidate);
- if (candidate < 3) return candidate != 0;
- if (candidate % 2 == 0 ) return false;
- return !b.get(candidate/2);
- }
-
- /**
- * @return first prime higher than candidate
- */
- public int above(int candidate)
- {
- do
- {
- // see what we can find in the existing sieve
- for (int i=candidate+1; i<= sieveCapacity; i++)
- {
- if (isPrime(i)) return i;
- }
- // Keep building ever bigger sieves till we succeed.
- // The next prime P' is between P+2 and P^2 - 2.
- // However that is a rather pessimistic upper bound.
- // Ideally some theorem would tell us how big we need to build
- // to find one.
- ensureCapacity(Math.max(candidate*2, sieveCapacity*2));
- } // end do
- while (true);
- } // end above
-
- /**
- * @param return first prime less than candidate
- */
- public int below (int candidate)
- {
- for (candidate--; candidate > 0; candidate--)
- {
- if (isPrime(candidate)) return candidate;
- }
- // candidate was 1 or 0 or -ve
- return 0;
- }
-
- /**
- * calc all primes in the range 1..n,
- * not the first n primes.
- * @param n, highest candidate, not necessarily prime.
- * @return list of primes 1..n in an array
- */
- public final int[] getPrimes(int n)
- {
- // calculate the primes
- ensureCapacity(n);
-
- // pass 1: count primes
- int countPrimes = 0;
- for (int i = 0; i <= n; i++)
- {
- if (isPrime(i)) countPrimes++;
- }
-
- // pass 2: construct array of primes
- int [] primes = new int[countPrimes];
- countPrimes = 0;
- for (int i = 0; i <= n; i++)
- {
- if (isPrime(i)) primes[countPrimes++] = i;
- }
- return primes;
- } // end getPrimes
-
- /**
- * calculate the sieve, bit map of all primes 0..n
- * @param n highest number evalutated by the sieve, not necessarily prime.
- */
- private final void sieve ( int n )
- {
- // Presume BitSet b set is big enough for our purposes.
- // Presume all even numbers are already marked composite, effectively.
- // Presume all odd numbers are already marked prime (0 in bit map).
- int last = (int)(Math.sqrt(n))+1;
- for (int candidate = 3; candidate <= last; candidate += 2)
- {
- // only look at odd numbers
- if (!b.get(candidate/2) /* if candidate is prime */)
- {
- // Our candidate is prime.
- // Only bother to mark multiples of primes. Others already done.
- // no need to mark even multiples, already done
- int incr = candidate*2;
- for ( int multiple = candidate + incr; multiple < n; multiple += incr)
- {
- b.set(multiple/2); // mark multiple as composite
- } // end for multiple
- } // end if
- } // end for candidate
- // at this point our sieve b is correct, except for 0..2
- } // end sieve
-
- /**
- * Ensure have a sieve to tackle primes as big as n.
- * If we don't allocate a sieve big enough and calculate it.
- * @param n - ensure sieve big enough to evaluate n for primality.
- */
- private void ensureCapacity (int n)
- {
- if ( n > sieveCapacity )
- {
- b = new BitSet((n+1)/2);
- // starts out all 0, presume all numbers prime
- sieveCapacity = n;
- sieve(n);
- }
- // otherwise existing sieve is fine
- } // end ensureCapacity
-
- private int sieveCapacity;
- // biggest number we have computed in our sieve.
- // our BitSet array is indexed 0..N (odd only)
-
- private BitSet b; /* true for each odd number if is composite */
-
- /**
- * Demonstrate and test the methods
- */
- public static void main (String[] args)
- {
- // print primes 1..101
- Primes calc = new Primes(106);
- int[] primes = calc.getPrimes(101);
- for (int i=0; i<primes.length; i++)
- {
- System.out.println(primes[i]);
- }
-
- // demonstrate isPrime, above, below
- System.out.println(calc.isPrime(149));
- System.out.println(calc.below(149));
- System.out.println(calc.above(149));
-
- // print all the primes just greater than powers of 2
- calc = new Primes(10000000);
- for (int pow=8; pow < 10000000; pow*=2)
- System.out.println(calc.above(pow));
-
- // Validate that isPrime works by comparing it with brute force
- for (int i=3; i<=151; i++)
- {
- boolean prime = true;
- for (int j=2; j<i; j++)
- {
- if (i % j == 0 )
- {
- prime = false;
- break;
- }
- } // end for j
- if ( calc.isPrime(i) != prime ) System.out.println(i + " oops");
- } // end for i
-
- } // end main
-} // end Primes
diff --git a/libjava/testsuite/libjava.lang/Primes.out b/libjava/testsuite/libjava.lang/Primes.out
deleted file mode 100644
index 279398b6233..00000000000
--- a/libjava/testsuite/libjava.lang/Primes.out
+++ /dev/null
@@ -1,51 +0,0 @@
-1
-2
-3
-5
-7
-11
-13
-17
-19
-23
-29
-31
-37
-41
-43
-47
-53
-59
-61
-67
-71
-73
-79
-83
-89
-97
-101
-true
-139
-151
-11
-17
-37
-67
-131
-257
-521
-1031
-2053
-4099
-8209
-16411
-32771
-65537
-131101
-262147
-524309
-1048583
-2097169
-4194319
-8388617
diff --git a/libjava/testsuite/libjava.lang/StaticConstructor.java b/libjava/testsuite/libjava.lang/StaticConstructor.java
new file mode 100644
index 00000000000..54c0f5376df
--- /dev/null
+++ b/libjava/testsuite/libjava.lang/StaticConstructor.java
@@ -0,0 +1,29 @@
+// Test to make sure static initializers are called
+
+class bar
+{
+ public static int zog;
+ public static int zag;
+
+ static
+ {
+ zog = 12;
+ zag = 2;
+ }
+
+ public bar() { }
+}
+
+public class StaticConstructor
+{
+ static int foo ()
+ {
+ return new bar().zog;
+ }
+
+ public static void main(String args[])
+ {
+ System.out.println ("" + (foo() + bar.zag));
+ }
+}
+
diff --git a/libjava/testsuite/libjava.lang/StaticConstructor.out b/libjava/testsuite/libjava.lang/StaticConstructor.out
new file mode 100644
index 00000000000..8351c19397f
--- /dev/null
+++ b/libjava/testsuite/libjava.lang/StaticConstructor.out
@@ -0,0 +1 @@
+14
diff --git a/libjava/testsuite/libjava.lang/TestProxy.java b/libjava/testsuite/libjava.lang/TestProxy.java
new file mode 100644
index 00000000000..d1411a6f0a8
--- /dev/null
+++ b/libjava/testsuite/libjava.lang/TestProxy.java
@@ -0,0 +1,34 @@
+import java.lang.reflect.*;
+import java.net.*;
+
+public class TestProxy
+{
+ public class MyInvocationHandler implements InvocationHandler
+ {
+ public Object invoke (Object proxy,
+ Method method,
+ Object[] args)
+ throws Throwable
+ {
+ System.out.println (args[0]);
+ return null;
+ }
+ }
+
+ public static void main (String[] args)
+ {
+ try {
+ InvocationHandler ih = new MyInvocationHandler();
+
+ SocketOptions c = (SocketOptions)
+ Proxy.newProxyInstance (SocketOptions.class.getClassLoader(),
+ new Class[]{SocketOptions.class},
+ ih);
+
+ c.getOption (555);
+
+ } catch (Exception e) {
+ e.printStackTrace ();
+ }
+ }
+}
diff --git a/libjava/testsuite/libjava.lang/TestProxy.out b/libjava/testsuite/libjava.lang/TestProxy.out
new file mode 100644
index 00000000000..3749383ded2
--- /dev/null
+++ b/libjava/testsuite/libjava.lang/TestProxy.out
@@ -0,0 +1 @@
+555
diff --git a/libjava/testsuite/libjava.lang/initexc.java b/libjava/testsuite/libjava.lang/initexc.java
new file mode 100644
index 00000000000..eda24ab033f
--- /dev/null
+++ b/libjava/testsuite/libjava.lang/initexc.java
@@ -0,0 +1,37 @@
+public class initexc
+{
+ public static class fail
+ {
+ static
+ {
+ // Static initializers must be able to complete normally.
+ if (true)
+ throw new NullPointerException("nope");
+ }
+
+ public static int val ()
+ {
+ return 23;
+ }
+ }
+
+ public static void main (String[] args)
+ {
+ try
+ {
+ System.out.println (fail.val ());
+ }
+ catch (ExceptionInInitializerError _)
+ {
+ // Ok.
+ }
+ try
+ {
+ System.out.println (fail.val ());
+ }
+ catch (NoClassDefFoundError _)
+ {
+ // Ok.
+ }
+ }
+}
diff --git a/libjava/testsuite/libjava.lang/initexc.out b/libjava/testsuite/libjava.lang/initexc.out
new file mode 100644
index 00000000000..e69de29bb2d
--- /dev/null
+++ b/libjava/testsuite/libjava.lang/initexc.out
diff --git a/libjava/testsuite/libjava.lang/pr6388.java b/libjava/testsuite/libjava.lang/pr6388.java
new file mode 100644
index 00000000000..175e1d213e2
--- /dev/null
+++ b/libjava/testsuite/libjava.lang/pr6388.java
@@ -0,0 +1,10 @@
+public class pr6388
+{
+ public static void main (String[] args)
+ {
+ System.out.println (Integer.MIN_VALUE);
+ System.out.println (0x80000000);
+ System.out.println (Integer.MIN_VALUE == 0x80000000);
+ System.out.println (0x80000000 == 0x80000000);
+ }
+}
diff --git a/libjava/testsuite/libjava.lang/pr6388.out b/libjava/testsuite/libjava.lang/pr6388.out
new file mode 100644
index 00000000000..1a551d97f1e
--- /dev/null
+++ b/libjava/testsuite/libjava.lang/pr6388.out
@@ -0,0 +1,4 @@
+-2147483648
+-2147483648
+true
+true
diff --git a/libjava/testsuite/libjava.lang/pr8415.java b/libjava/testsuite/libjava.lang/pr8415.java
new file mode 100644
index 00000000000..d23fa139637
--- /dev/null
+++ b/libjava/testsuite/libjava.lang/pr8415.java
@@ -0,0 +1,15 @@
+import java.lang.reflect.*;
+public class pr8415
+{
+ public static void meth () throws NullPointerException
+ {
+ throw new NullPointerException();
+ }
+
+ public static void main(String[] args) throws Throwable
+ {
+ Class k = pr8415.class;
+ Method m = k.getMethod ("meth", new Class[0]);
+ System.out.println(m);
+ }
+}
diff --git a/libjava/testsuite/libjava.lang/pr8415.out b/libjava/testsuite/libjava.lang/pr8415.out
new file mode 100644
index 00000000000..7589404f04a
--- /dev/null
+++ b/libjava/testsuite/libjava.lang/pr8415.out
@@ -0,0 +1 @@
+public static void pr8415.meth() throws java.lang.NullPointerException
diff --git a/libjava/testsuite/libjava.lang/pr8676.java b/libjava/testsuite/libjava.lang/pr8676.java
new file mode 100644
index 00000000000..e28b15b1ab5
--- /dev/null
+++ b/libjava/testsuite/libjava.lang/pr8676.java
@@ -0,0 +1,11 @@
+public class pr8676 {
+ // The problem here was that this function couldn't be compiled to
+ // bytecode.
+ private void f(long j) {
+ boolean x = (1 << j) != 0;
+ }
+
+ public static void main(String[] args)
+ {
+ }
+}
diff --git a/libjava/testsuite/libjava.lang/pr8676.out b/libjava/testsuite/libjava.lang/pr8676.out
new file mode 100644
index 00000000000..e69de29bb2d
--- /dev/null
+++ b/libjava/testsuite/libjava.lang/pr8676.out
diff --git a/libjava/testsuite/libjava.lang/utf8concat.java b/libjava/testsuite/libjava.lang/utf8concat.java
new file mode 100644
index 00000000000..8b8f47ee1a0
--- /dev/null
+++ b/libjava/testsuite/libjava.lang/utf8concat.java
@@ -0,0 +1,11 @@
+public class utf8concat
+{
+ private static String s;
+
+ public static void main (String[] args)
+ {
+ // This causes a crash at runtime because the compiler is
+ // producing an invalid UTF-8 string literal.
+ s = "abc" + (char)183;
+ }
+}
diff --git a/libjava/testsuite/libjava.lang/utf8concat.out b/libjava/testsuite/libjava.lang/utf8concat.out
new file mode 100644
index 00000000000..e69de29bb2d
--- /dev/null
+++ b/libjava/testsuite/libjava.lang/utf8concat.out
diff --git a/libjava/testsuite/libjava.lang/utilTest.java b/libjava/testsuite/libjava.lang/utilTest.java
new file mode 100644
index 00000000000..221bbf827a2
--- /dev/null
+++ b/libjava/testsuite/libjava.lang/utilTest.java
@@ -0,0 +1,58 @@
+class utilTest {
+
+ public static void main(String[] argv) throws Throwable {
+ byte[] b = new byte[] {
+ 0x01, 0x23, 0x45, 0x67, (byte) 0x89, (byte) 0xab,
+ (byte) 0xcd, (byte) 0xef
+ };
+ String s = "0123456789ABCDEF";
+ System.out.println(toString(b));
+ System.out.println(s);
+ System.out.println(toString(toBytesFromString(s)));
+ }
+
+ // The following comes from the GNU Crypto project gnu.crypto.util.Util
+
+ private static final char[] HEX_DIGITS = {
+ '0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'
+ };
+
+ public static byte[] toBytesFromString(String s) {
+ int limit = s.length();
+ byte[] result = new byte[((limit + 1) / 2)];
+ int i = 0, j = 0;
+ if ((limit % 2) == 1) {
+ result[j++] = (byte) fromDigit(s.charAt(i++));
+ }
+ while (i < limit) {
+ result[j++] =
+ (byte)((fromDigit(s.charAt(i++)) << 4) | fromDigit(s.charAt(i++)));
+ }
+ return result;
+ }
+
+ public static int fromDigit(char c) {
+ if (c >= '0' && c <= '9') {
+ return c - '0';
+ } else if (c >= 'A' && c <= 'F') {
+ return c - 'A' + 10;
+ } else if (c >= 'a' && c <= 'f') {
+ return c - 'a' + 10;
+ } else
+ throw new IllegalArgumentException("Invalid hexadecimal digit: " + c);
+ }
+
+ public static String toString(byte[] ba) {
+ return toString(ba, 0, ba.length);
+ }
+
+ public static final String toString(byte[] ba, int offset, int length) {
+ char[] buf = new char[length * 2];
+ for (int i = 0, j = 0, k; i < length; ) {
+ k = ba[offset + i++];
+ buf[j++] = HEX_DIGITS[(k >>> 4) & 0x0F];
+ buf[j++] = HEX_DIGITS[ k & 0x0F];
+ }
+ return new String(buf);
+ }
+}
diff --git a/libjava/testsuite/libjava.lang/utilTest.out b/libjava/testsuite/libjava.lang/utilTest.out
new file mode 100644
index 00000000000..036c36ebfd8
--- /dev/null
+++ b/libjava/testsuite/libjava.lang/utilTest.out
@@ -0,0 +1,3 @@
+0123456789ABCDEF
+0123456789ABCDEF
+0123456789ABCDEF
diff --git a/libjava/testsuite/libjava.loader/MyLoader.java b/libjava/testsuite/libjava.loader/MyLoader.java
new file mode 100644
index 00000000000..40c31d7f682
--- /dev/null
+++ b/libjava/testsuite/libjava.loader/MyLoader.java
@@ -0,0 +1,14 @@
+import java.net.*;
+
+public class MyLoader extends URLClassLoader
+{
+ public MyLoader (URL urls[])
+ {
+ super (urls);
+ }
+
+ public MyLoader (URL urls[], ClassLoader parent)
+ {
+ super (urls, parent);
+ }
+}
diff --git a/libjava/testsuite/libjava.loader/TestEarlyGC.java b/libjava/testsuite/libjava.loader/TestEarlyGC.java
new file mode 100644
index 00000000000..7381b50705c
--- /dev/null
+++ b/libjava/testsuite/libjava.loader/TestEarlyGC.java
@@ -0,0 +1,52 @@
+public class TestEarlyGC extends ClassLoader {
+
+ static TestEarlyGC[] a = new TestEarlyGC[10];
+
+ byte[] code = {
+ -54,-2,-70,-66,0,3,0,45,0,32,1,0,1,67,7,0,
+ 1,1,0,16,106,97,118,97,47,108,97,110,103,47,79,98,
+ 106,101,99,116,7,0,3,1,0,1,99,1,0,3,76,67,
+ 59,1,0,6,60,105,110,105,116,62,1,0,3,40,41,86,
+ 1,0,4,67,111,100,101,12,0,7,0,8,10,0,4,0,
+ 10,12,0,5,0,6,9,0,2,0,12,1,0,15,76,105,
+ 110,101,78,117,109,98,101,114,84,97,98,108,101,1,0,8,
+ 102,105,110,97,108,105,122,101,1,0,16,106,97,118,97,47,
+ 108,97,110,103,47,83,121,115,116,101,109,7,0,16,1,0,
+ 3,111,117,116,1,0,21,76,106,97,118,97,47,105,111,47,
+ 80,114,105,110,116,83,116,114,101,97,109,59,12,0,18,0,
+ 19,9,0,17,0,20,1,0,9,102,105,110,97,108,105,122,
+ 101,100,8,0,22,1,0,19,106,97,118,97,47,105,111,47,
+ 80,114,105,110,116,83,116,114,101,97,109,7,0,24,1,0,
+ 7,112,114,105,110,116,108,110,1,0,21,40,76,106,97,118,
+ 97,47,108,97,110,103,47,83,116,114,105,110,103,59,41,86,
+ 12,0,26,0,27,10,0,25,0,28,1,0,10,83,111,117,
+ 114,99,101,70,105,108,101,1,0,6,67,46,106,97,118,97,
+ 0,33,0,2,0,4,0,0,0,1,0,10,0,5,0,6,
+ 0,0,0,2,0,1,0,7,0,8,0,1,0,9,0,0,
+ 0,33,0,1,0,1,0,0,0,9,42,-73,0,11,42,-77,
+ 0,13,-79,0,0,0,1,0,14,0,0,0,6,0,1,0,
+ 4,0,5,0,4,0,15,0,8,0,1,0,9,0,0,0,
+ 33,0,2,0,1,0,0,0,9,-78,0,21,18,23,-74,0,
+ 29,-79,0,0,0,1,0,14,0,0,0,6,0,1,0,0,
+ 0,9,0,1,0,30,0,0,0,2,0,31
+ };
+
+ TestEarlyGC() throws Throwable {
+ defineClass("C", code, 0, code.length).newInstance();
+ }
+
+ public static void main(String[] args) {
+ Runtime r = Runtime.getRuntime();
+
+ try {
+ for (int n = 0; n < a.length; n++) {
+ a[n] = new TestEarlyGC();
+ r.gc();
+ r.runFinalization();
+ Thread.yield();
+ }
+ } catch (Throwable t) {
+ t.printStackTrace();
+ }
+ }
+}
diff --git a/libjava/testsuite/libjava.loader/TestEarlyGC.out b/libjava/testsuite/libjava.loader/TestEarlyGC.out
new file mode 100644
index 00000000000..e69de29bb2d
--- /dev/null
+++ b/libjava/testsuite/libjava.loader/TestEarlyGC.out
diff --git a/libjava/testsuite/libjava.loader/TestLeak.java b/libjava/testsuite/libjava.loader/TestLeak.java
new file mode 100644
index 00000000000..9d467f2fdc9
--- /dev/null
+++ b/libjava/testsuite/libjava.loader/TestLeak.java
@@ -0,0 +1,33 @@
+import java.net.*;
+import java.lang.reflect.*;
+
+public class TestLeak
+{
+ class MyLoader extends URLClassLoader
+ {
+ public MyLoader (URL urls[])
+ {
+ super (urls);
+ }
+ }
+
+ public static void main (String[] args)
+ {
+ URLClassLoader ucl =
+ (URLClassLoader) ClassLoader.getSystemClassLoader();
+ URL urls[] = ucl.getURLs ();
+ Class ifaces[] = new Class[1];
+ ifaces[0] = java.lang.Comparable.class;
+
+ try {
+ for (int i = 0; i < 100; i++)
+ {
+ Proxy.getProxyClass (new MyLoader (urls), ifaces);
+ }
+ } catch (Exception e) {
+ e.printStackTrace ();
+ }
+ }
+}
+
+
diff --git a/libjava/testsuite/libjava.loader/TestLeak.out b/libjava/testsuite/libjava.loader/TestLeak.out
new file mode 100644
index 00000000000..e69de29bb2d
--- /dev/null
+++ b/libjava/testsuite/libjava.loader/TestLeak.out
diff --git a/libjava/testsuite/libjava.loader/TestMultiple.java b/libjava/testsuite/libjava.loader/TestMultiple.java
new file mode 100644
index 00000000000..1a56fc4878c
--- /dev/null
+++ b/libjava/testsuite/libjava.loader/TestMultiple.java
@@ -0,0 +1,28 @@
+import java.net.*;
+
+public class TestMultiple
+{
+ public static void main (String[] args)
+ {
+ URLClassLoader ucl =
+ (URLClassLoader) ClassLoader.getSystemClassLoader();
+ URL urls[] = ucl.getURLs ();
+
+ MyLoader t1 = new MyLoader (urls);
+ MyLoader t2 = new MyLoader (urls);
+
+ Class c1, c2;
+
+ try {
+
+ c1 = t1.loadClass ("dummy");
+ c2 = t2.loadClass ("dummy");
+
+ }
+ catch (Exception e) {
+ e.printStackTrace ();
+ }
+ }
+}
+
+
diff --git a/libjava/testsuite/libjava.loader/TestMultiple.out b/libjava/testsuite/libjava.loader/TestMultiple.out
new file mode 100644
index 00000000000..e69de29bb2d
--- /dev/null
+++ b/libjava/testsuite/libjava.loader/TestMultiple.out
diff --git a/libjava/testsuite/libjava.loader/TestParent.java b/libjava/testsuite/libjava.loader/TestParent.java
new file mode 100644
index 00000000000..3996b7671c0
--- /dev/null
+++ b/libjava/testsuite/libjava.loader/TestParent.java
@@ -0,0 +1,29 @@
+import java.net.*;
+
+public class TestParent
+{
+ public static void main (String[] args)
+ {
+ URLClassLoader ucl =
+ (URLClassLoader) ClassLoader.getSystemClassLoader();
+ URL urls[] = ucl.getURLs ();
+
+ MyLoader parent = new MyLoader (urls);
+
+ MyLoader t1 = new MyLoader (urls, parent);
+ MyLoader t2 = new MyLoader (urls, parent);
+
+ Class c1, c2;
+
+ try {
+
+ c1 = t1.loadClass ("dummy");
+ c2 = t2.loadClass ("dummy");
+
+ }
+ catch (Exception e) {
+ e.printStackTrace ();
+ }
+ }
+}
+
diff --git a/libjava/testsuite/libjava.loader/TestParent.out b/libjava/testsuite/libjava.loader/TestParent.out
new file mode 100644
index 00000000000..e69de29bb2d
--- /dev/null
+++ b/libjava/testsuite/libjava.loader/TestParent.out
diff --git a/libjava/testsuite/libjava.loader/dummy.java b/libjava/testsuite/libjava.loader/dummy.java
new file mode 100644
index 00000000000..67bb4a79f48
--- /dev/null
+++ b/libjava/testsuite/libjava.loader/dummy.java
@@ -0,0 +1,6 @@
+// A dummy class
+
+public class dummy
+{
+}
+
diff --git a/libjava/testsuite/libjava.loader/loader.exp b/libjava/testsuite/libjava.loader/loader.exp
new file mode 100644
index 00000000000..6864a5f663a
--- /dev/null
+++ b/libjava/testsuite/libjava.loader/loader.exp
@@ -0,0 +1,67 @@
+# Tests for ClassLoader and native library loader code.
+
+# Do all the work for a single JNI test. Return 0 on failure.
+proc gcj_loader_test_one {srcfile} {
+ global objdir srcdir subdir
+
+ set resfile $srcdir/$subdir/[file rootname [file tail $srcfile]].out
+
+ regsub "^.*/(\[^/.\]+)\[.\]\[^/]*$" "$srcfile" "\\1" out
+ set executable "${objdir}/$out.exe"
+
+ set errname [file rootname [file tail $srcfile]]
+ set args [libjava_arguments link]
+ lappend args "additional_flags=--main=[file rootname [file tail $srcfile]] $srcdir/$subdir/MyLoader.java $objdir/dummy.o"
+ set x [prune_warnings \
+ [libjava_tcompile $srcfile "$executable" executable $args]]
+
+ if { $x != "" } {
+ verbose "target_compile failed: $x" 2
+
+ fail "$errname compilation from source"
+ untested "$errname execution from source compiled test"
+ return
+ }
+ pass "$errname compilation from source"
+
+ libjava_invoke $executable $executable "" $executable "" $resfile ""
+
+ return 1
+}
+
+# Run the bytecode loader tests.
+proc gcj_loader_run {} {
+ global srcdir subdir objdir
+ global build_triplet host_triplet
+ global GCJ_UNDER_TEST
+
+ set file "${srcdir}/${subdir}/dummy.java"
+ if {! [bytecompile_file $file [pwd]]} {
+ fail "bytecompile $file"
+ # FIXME - should use `untested' on all remaining tests.
+ # But that is hard.
+ return 0
+ }
+ pass "bytecompile $file"
+
+ set args [libjava_arguments compile]
+ lappend args "additional_flags=--resource $objdir/dummy.class"
+ set x [prune_warnings \
+ [libjava_tcompile "$objdir/dummy.class" "$objdir/dummy.o" object $args]]
+
+ if { $x != "" } {
+ verbose "resource compilation failed: $x" 2
+
+ fail "resource compilation dummy.class"
+ return 0;
+ }
+ pass "resource compilation: dummy.class"
+
+ catch { lsort [glob -nocomplain ${srcdir}/${subdir}/Test*.java] } srcfiles
+
+ foreach x $srcfiles {
+ gcj_loader_test_one $x
+ }
+}
+
+gcj_loader_run
diff --git a/libjava/testsuite/libjava.mauve/mauve.exp b/libjava/testsuite/libjava.mauve/mauve.exp
index 4a26b27242d..a9a1c98d6ac 100644
--- a/libjava/testsuite/libjava.mauve/mauve.exp
+++ b/libjava/testsuite/libjava.mauve/mauve.exp
@@ -52,12 +52,27 @@ proc mauve_compute_uses {aName} {
return [lsort [array names uses]]
}
+# Find Mauve sources. At end, env(MAUVEDIR) points to sources.
+# Returns 0 if sources not found, 1 otherwise.
+proc find_mauve_sources {} {
+ global env srcdir
+
+ if {[info exists env(MAUVEDIR)]} {
+ return 1
+ } elseif {[file isdirectory $srcdir/libjava.mauve/mauve]} {
+ set env(MAUVEDIR) $srcdir/libjava.mauve/mauve
+ return 1
+ }
+
+ return 0
+}
+
# Run all the Mauve tests. Return 1 on success, 0 on any failure. If
# the tests are skipped, that is treated like success.
proc test_mauve {} {
global srcdir objdir subdir env
- if {! [info exists env(MAUVEDIR)]} then {
+ if {! [find_mauve_sources]} then {
verbose "MAUVEDIR not set; not running Mauve tests"
return 1
}
@@ -220,7 +235,7 @@ proc test_mauve {} {
proc test_mauve_sim {} {
global srcdir subdir env
- if {! [info exists env(MAUVEDIR)]} then {
+ if {! [find_mauve_sources]} then {
verbose "MAUVEDIR not set; not running Mauve tests"
return 1
}
diff --git a/libjava/testsuite/libjava.mauve/xfails b/libjava/testsuite/libjava.mauve/xfails
index 1594a3b8ea0..270c28a0378 100644
--- a/libjava/testsuite/libjava.mauve/xfails
+++ b/libjava/testsuite/libjava.mauve/xfails
@@ -1,12 +1,3 @@
-FAIL: gnu.testlet.java.beans.Introspector.jdk11: getBeanInfo (number 1)
-FAIL: gnu.testlet.java.beans.Introspector.jdk11: getBeanInfo (number 2)
-FAIL: gnu.testlet.java.beans.Introspector.jdk11: getBeanInfo (number 4)
-FAIL: gnu.testlet.java.beans.Introspector.jdk11: getBeanInfo (number 9)
-FAIL: gnu.testlet.java.beans.Introspector.jdk11: getBeanInfo (number 10)
-FAIL: gnu.testlet.java.beans.Introspector.jdk11: getBeanInfo (number 12)
-FAIL: gnu.testlet.java.beans.Introspector.jdk11: getBeanInfo (number 13)
-FAIL: gnu.testlet.java.beans.Introspector.jdk11: getBeanInfo (number 14)
-FAIL: gnu.testlet.java.beans.Introspector.jdk11: getBeanInfo (number 15)
FAIL: gnu.testlet.java.beans.Introspector.jdk11: getBeanInfo (number 16)
FAIL: gnu.testlet.java.beans.Introspector.jdk11: getBeanInfo (number 17)
FAIL: gnu.testlet.java.beans.Introspector.jdk11: getBeanInfo (number 19)
@@ -35,10 +26,7 @@ FAIL: gnu.testlet.java.lang.Character.getType (number 22)
FAIL: gnu.testlet.java.lang.Class.ClassTest: Error: test_getClassLoader failed - 1 (number 1)
FAIL: gnu.testlet.java.lang.Class.ClassTest: Error: test_getClassLoader failed - 2 (number 1)
FAIL: gnu.testlet.java.lang.Double.DoubleTest: Error: test_intValue returned wrong results CYGNUS: Float to int conversions - 1 (number 1)
-FAIL: gnu.testlet.java.lang.Double.DoubleTest: Error: test_longValue returned wrong results CYGNUS: Float to int conversions - 1 (number 1)
FAIL: gnu.testlet.java.lang.Float.FloatTest: Error: test_intValue returned wrong results - 1 (number 1)
-FAIL: gnu.testlet.java.lang.String.CASE_INSENSITIVE_ORDER: unicode mappings (number 1)
-FAIL: gnu.testlet.java.lang.String.CASE_INSENSITIVE_ORDER: unicode mappings (number 2)
FAIL: gnu.testlet.java.text.AttributedString.Test: Attribute key count (number 1)
FAIL: gnu.testlet.java.text.DateFormatSymbols.Test: patterns (number 2)
FAIL: gnu.testlet.java.text.SimpleDateFormat.Test: equals() (number 1)
diff --git a/libjava/verify.cc b/libjava/verify.cc
index 29f0f321a7f..dc88944e757 100644
--- a/libjava/verify.cc
+++ b/libjava/verify.cc
@@ -458,8 +458,8 @@ private:
if (key < reference_type || k.key < reference_type)
return key == k.key;
- // The `null' type is convertible to any reference type.
- // FIXME: is this correct for THIS?
+ // The `null' type is convertible to any initialized reference
+ // type.
if (key == null_type || k.key == null_type)
return true;
@@ -1138,6 +1138,19 @@ private:
return t;
}
+ // Pop a reference which is guaranteed to be initialized. MATCH
+ // doesn't have to be a reference type; in this case this acts like
+ // pop_type.
+ type pop_init_ref (type match)
+ {
+ type t = pop_raw ();
+ if (t.isreference () && ! t.isinitialized ())
+ verify_fail ("initialized reference required");
+ else if (! match.compatible (t, this))
+ verify_fail ("incompatible type on stack");
+ return t;
+ }
+
// Pop a reference type or a return address.
type pop_ref_or_return ()
{
@@ -2301,42 +2314,42 @@ private:
break;
case op_iaload:
pop_type (int_type);
- push_type (require_array_type (pop_type (reference_type),
+ push_type (require_array_type (pop_init_ref (reference_type),
int_type));
break;
case op_laload:
pop_type (int_type);
- push_type (require_array_type (pop_type (reference_type),
+ push_type (require_array_type (pop_init_ref (reference_type),
long_type));
break;
case op_faload:
pop_type (int_type);
- push_type (require_array_type (pop_type (reference_type),
+ push_type (require_array_type (pop_init_ref (reference_type),
float_type));
break;
case op_daload:
pop_type (int_type);
- push_type (require_array_type (pop_type (reference_type),
+ push_type (require_array_type (pop_init_ref (reference_type),
double_type));
break;
case op_aaload:
pop_type (int_type);
- push_type (require_array_type (pop_type (reference_type),
+ push_type (require_array_type (pop_init_ref (reference_type),
reference_type));
break;
case op_baload:
pop_type (int_type);
- require_array_type (pop_type (reference_type), byte_type);
+ require_array_type (pop_init_ref (reference_type), byte_type);
push_type (int_type);
break;
case op_caload:
pop_type (int_type);
- require_array_type (pop_type (reference_type), char_type);
+ require_array_type (pop_init_ref (reference_type), char_type);
push_type (int_type);
break;
case op_saload:
pop_type (int_type);
- require_array_type (pop_type (reference_type), short_type);
+ require_array_type (pop_init_ref (reference_type), short_type);
push_type (int_type);
break;
case op_istore:
@@ -2387,42 +2400,42 @@ private:
case op_iastore:
pop_type (int_type);
pop_type (int_type);
- require_array_type (pop_type (reference_type), int_type);
+ require_array_type (pop_init_ref (reference_type), int_type);
break;
case op_lastore:
pop_type (long_type);
pop_type (int_type);
- require_array_type (pop_type (reference_type), long_type);
+ require_array_type (pop_init_ref (reference_type), long_type);
break;
case op_fastore:
pop_type (float_type);
pop_type (int_type);
- require_array_type (pop_type (reference_type), float_type);
+ require_array_type (pop_init_ref (reference_type), float_type);
break;
case op_dastore:
pop_type (double_type);
pop_type (int_type);
- require_array_type (pop_type (reference_type), double_type);
+ require_array_type (pop_init_ref (reference_type), double_type);
break;
case op_aastore:
pop_type (reference_type);
pop_type (int_type);
- require_array_type (pop_type (reference_type), reference_type);
+ require_array_type (pop_init_ref (reference_type), reference_type);
break;
case op_bastore:
pop_type (int_type);
pop_type (int_type);
- require_array_type (pop_type (reference_type), byte_type);
+ require_array_type (pop_init_ref (reference_type), byte_type);
break;
case op_castore:
pop_type (int_type);
pop_type (int_type);
- require_array_type (pop_type (reference_type), char_type);
+ require_array_type (pop_init_ref (reference_type), char_type);
break;
case op_sastore:
pop_type (int_type);
pop_type (int_type);
- require_array_type (pop_type (reference_type), short_type);
+ require_array_type (pop_init_ref (reference_type), short_type);
break;
case op_pop:
pop32 ();
@@ -2760,7 +2773,7 @@ private:
invalidate_pc ();
break;
case op_areturn:
- check_return_type (pop_type (reference_type));
+ check_return_type (pop_init_ref (reference_type));
invalidate_pc ();
break;
case op_return:
@@ -2842,7 +2855,7 @@ private:
// This is only used for verifying the byte for
// invokeinterface.
nargs -= arg_types[i].depth ();
- pop_type (arg_types[i]);
+ pop_init_ref (arg_types[i]);
}
if (opcode == op_invokeinterface
@@ -2859,7 +2872,15 @@ private:
}
type raw = pop_raw ();
bool ok = false;
- if (t.compatible (raw, this))
+ if (! is_init && ! raw.isinitialized ())
+ {
+ // This is a failure.
+ }
+ else if (is_init && raw.isnull ())
+ {
+ // Another failure.
+ }
+ else if (t.compatible (raw, this))
{
ok = true;
}
@@ -2915,7 +2936,7 @@ private:
break;
case op_arraylength:
{
- type t = pop_type (reference_type);
+ type t = pop_init_ref (reference_type);
if (! t.isarray () && ! t.isnull ())
verify_fail ("array type expected");
push_type (int_type);
@@ -2926,19 +2947,19 @@ private:
invalidate_pc ();
break;
case op_checkcast:
- pop_type (reference_type);
+ pop_init_ref (reference_type);
push_type (check_class_constant (get_ushort ()));
break;
case op_instanceof:
- pop_type (reference_type);
+ pop_init_ref (reference_type);
check_class_constant (get_ushort ());
push_type (int_type);
break;
case op_monitorenter:
- pop_type (reference_type);
+ pop_init_ref (reference_type);
break;
case op_monitorexit:
- pop_type (reference_type);
+ pop_init_ref (reference_type);
break;
case op_wide:
{
@@ -2972,7 +2993,7 @@ private:
set_variable (get_ushort (), pop_type (double_type));
break;
case op_astore:
- set_variable (get_ushort (), pop_type (reference_type));
+ set_variable (get_ushort (), pop_init_ref (reference_type));
break;
case op_ret:
handle_ret_insn (get_short ());