aboutsummaryrefslogtreecommitdiff
path: root/libjava
diff options
context:
space:
mode:
Diffstat (limited to 'libjava')
-rw-r--r--libjava/ChangeLog1281
-rw-r--r--libjava/Makefile.am188
-rw-r--r--libjava/Makefile.in316
-rw-r--r--libjava/acinclude.m424
-rw-r--r--libjava/aclocal.m447
-rw-r--r--libjava/boehm.cc2
-rwxr-xr-xlibjava/configure596
-rw-r--r--libjava/configure.host11
-rw-r--r--libjava/configure.in34
-rw-r--r--libjava/defineclass.cc2
-rw-r--r--libjava/gcj/Makefile.in4
-rw-r--r--libjava/gcj/javaprims.h21
-rw-r--r--libjava/gnu/awt/j2d/DirectRasterGraphics.java5
-rw-r--r--libjava/gnu/awt/j2d/Graphics2DImpl.java5
-rw-r--r--libjava/gnu/awt/j2d/IntegerGraphicsState.java18
-rw-r--r--libjava/gnu/awt/xlib/XGraphics.java8
-rw-r--r--libjava/gnu/awt/xlib/XGraphicsConfiguration.java37
-rw-r--r--libjava/gnu/awt/xlib/XToolkit.java4
-rw-r--r--libjava/gnu/gcj/protocol/http/Connection.java59
-rw-r--r--libjava/gnu/gcj/runtime/NameFinder.java2
-rw-r--r--libjava/gnu/gcj/runtime/natStackTrace.cc3
-rw-r--r--libjava/gnu/gcj/xlib/GC.java4
-rw-r--r--libjava/gnu/gcj/xlib/natGC.cc24
-rw-r--r--libjava/gnu/java/nio/ByteBufferImpl.java386
-rw-r--r--libjava/gnu/java/nio/CharBufferImpl.java146
-rw-r--r--libjava/gnu/java/nio/DoubleBufferImpl.java118
-rw-r--r--libjava/gnu/java/nio/FileChannelImpl.java181
-rw-r--r--libjava/gnu/java/nio/FileLockImpl.java63
-rw-r--r--libjava/gnu/java/nio/FloatBufferImpl.java112
-rw-r--r--libjava/gnu/java/nio/IntBufferImpl.java116
-rw-r--r--libjava/gnu/java/nio/LongBufferImpl.java114
-rw-r--r--libjava/gnu/java/nio/SelectorProviderImpl.java6
-rw-r--r--libjava/gnu/java/nio/ServerSocketChannelImpl.java10
-rw-r--r--libjava/gnu/java/nio/ShortBufferImpl.java124
-rw-r--r--libjava/gnu/java/nio/natByteBufferImpl.cc10
-rw-r--r--libjava/gnu/java/nio/natCharBufferImpl.cc112
-rw-r--r--libjava/gnu/java/nio/natDoubleBufferImpl.cc112
-rw-r--r--libjava/gnu/java/nio/natFileChannelImpl.cc53
-rw-r--r--libjava/gnu/java/nio/natFloatBufferImpl.cc112
-rw-r--r--libjava/gnu/java/nio/natIntBufferImpl.cc112
-rw-r--r--libjava/gnu/java/nio/natLongBufferImpl.cc112
-rw-r--r--libjava/gnu/java/nio/natServerSocketChannelImpl.cc77
-rw-r--r--libjava/gnu/java/nio/natShortBufferImpl.cc112
-rw-r--r--libjava/gnu/java/nio/natSocketChannelImpl.cc20
-rw-r--r--libjava/gnu/java/rmi/server/UnicastServerRef.java4
-rw-r--r--libjava/gnu/java/security/provider/SHA1PRNG.java32
-rw-r--r--libjava/include/Makefile.in4
-rw-r--r--libjava/include/config.h.in2
-rw-r--r--libjava/include/dwarf2-signal.h3
-rw-r--r--libjava/include/java-interp.h4
-rw-r--r--libjava/include/posix.h28
-rw-r--r--libjava/include/win32-threads.h58
-rw-r--r--libjava/include/win32.h25
-rw-r--r--libjava/include/x86_64-signal.h96
-rw-r--r--libjava/java/awt/AlphaComposite.java24
-rw-r--r--libjava/java/awt/BasicStroke.java58
-rw-r--r--libjava/java/awt/BufferCapabilities.java5
-rw-r--r--libjava/java/awt/Button.java13
-rw-r--r--libjava/java/awt/CardLayout.java47
-rw-r--r--libjava/java/awt/CheckboxMenuItem.java12
-rw-r--r--libjava/java/awt/Choice.java34
-rw-r--r--libjava/java/awt/Component.java33
-rw-r--r--libjava/java/awt/Container.java511
-rw-r--r--libjava/java/awt/Cursor.java14
-rw-r--r--libjava/java/awt/DisplayMode.java16
-rw-r--r--libjava/java/awt/EventQueue.java30
-rw-r--r--libjava/java/awt/FileDialog.java12
-rw-r--r--libjava/java/awt/Graphics2D.java3
-rw-r--r--libjava/java/awt/Label.java13
-rw-r--r--libjava/java/awt/List.java13
-rw-r--r--libjava/java/awt/Menu.java9
-rw-r--r--libjava/java/awt/MenuBar.java4
-rw-r--r--libjava/java/awt/MenuComponent.java4
-rw-r--r--libjava/java/awt/PopupMenu.java9
-rw-r--r--libjava/java/awt/ScrollPane.java11
-rw-r--r--libjava/java/awt/Scrollbar.java19
-rw-r--r--libjava/java/awt/TextArea.java13
-rw-r--r--libjava/java/awt/TextComponent.java8
-rw-r--r--libjava/java/awt/TextField.java13
-rw-r--r--libjava/java/awt/Toolkit.java64
-rw-r--r--libjava/java/awt/Window.java95
-rw-r--r--libjava/java/awt/color/CMMException.java2
-rw-r--r--libjava/java/awt/color/ColorSpace.java9
-rw-r--r--libjava/java/awt/color/ICC_ColorSpace.java33
-rw-r--r--libjava/java/awt/color/ICC_Profile.java2
-rw-r--r--libjava/java/awt/color/ProfileDataException.java2
-rw-r--r--libjava/java/awt/datatransfer/Clipboard.java4
-rw-r--r--libjava/java/awt/datatransfer/DataFlavor.java17
-rw-r--r--libjava/java/awt/datatransfer/FlavorMap.java65
-rw-r--r--libjava/java/awt/datatransfer/SystemFlavorMap.java241
-rw-r--r--libjava/java/awt/dnd/DragGestureEvent.java27
-rw-r--r--libjava/java/awt/dnd/DragGestureRecognizer.java6
-rw-r--r--libjava/java/awt/dnd/DragSource.java46
-rw-r--r--libjava/java/awt/dnd/DropTarget.java9
-rw-r--r--libjava/java/awt/event/WindowEvent.java2
-rw-r--r--libjava/java/awt/geom/Dimension2D.java5
-rw-r--r--libjava/java/awt/geom/GeneralPath.java4
-rw-r--r--libjava/java/awt/geom/Line2D.java4
-rw-r--r--libjava/java/awt/geom/PathIterator.java4
-rw-r--r--libjava/java/awt/geom/QuadCurve2D.java4
-rw-r--r--libjava/java/awt/im/InputMethodHighlight.java2
-rw-r--r--libjava/java/awt/image/ColorModel.java22
-rw-r--r--libjava/java/awt/image/ImageFilter.java13
-rw-r--r--libjava/java/beans/PropertyDescriptor.java566
-rw-r--r--libjava/java/io/BufferedOutputStream.java8
-rw-r--r--libjava/java/io/FileDescriptor.java4
-rw-r--r--libjava/java/io/FileInputStream.java6
-rw-r--r--libjava/java/io/InputStreamReader.java7
-rw-r--r--libjava/java/io/ObjectStreamClass.java123
-rw-r--r--libjava/java/io/OutputStreamWriter.java7
-rw-r--r--libjava/java/io/PipedOutputStream.java8
-rw-r--r--libjava/java/io/PipedWriter.java6
-rw-r--r--libjava/java/io/StringWriter.java4
-rw-r--r--libjava/java/io/VMObjectStreamClass.java50
-rw-r--r--libjava/java/io/natFileDescriptorPosix.cc50
-rw-r--r--libjava/java/io/natFileDescriptorWin32.cc19
-rw-r--r--libjava/java/io/natFilePosix.cc12
-rw-r--r--libjava/java/io/natFileWin32.cc11
-rw-r--r--libjava/java/io/natVMObjectStreamClass.cc23
-rw-r--r--libjava/java/lang/Class.h10
-rw-r--r--libjava/java/lang/ClassLoader.java18
-rw-r--r--libjava/java/lang/StringBuffer.java39
-rw-r--r--libjava/java/lang/System.java45
-rw-r--r--libjava/java/lang/Win32Process.java52
-rw-r--r--libjava/java/lang/natClass.cc41
-rw-r--r--libjava/java/lang/natClassLoader.cc75
-rw-r--r--libjava/java/lang/natObject.cc5
-rw-r--r--libjava/java/lang/natRuntime.cc44
-rw-r--r--libjava/java/lang/natSystem.cc5
-rw-r--r--libjava/java/lang/natWin32Process.cc294
-rw-r--r--libjava/java/lang/reflect/Modifier.java13
-rw-r--r--libjava/java/math/BigDecimal.java64
-rw-r--r--libjava/java/math/BigInteger.java311
-rw-r--r--libjava/java/net/DatagramSocket.java609
-rw-r--r--libjava/java/net/HttpURLConnection.java58
-rw-r--r--libjava/java/net/InetSocketAddress.java5
-rw-r--r--libjava/java/net/MulticastSocket.java23
-rw-r--r--libjava/java/net/NetPermission.java3
-rw-r--r--libjava/java/net/NetworkInterface.java5
-rw-r--r--libjava/java/net/ServerSocket.java18
-rw-r--r--libjava/java/net/Socket.java60
-rw-r--r--libjava/java/net/SocketAddress.java3
-rw-r--r--libjava/java/net/SocketImpl.java7
-rw-r--r--libjava/java/net/SocketPermission.java112
-rw-r--r--libjava/java/net/URLClassLoader.java33
-rw-r--r--libjava/java/net/URLDecoder.java6
-rw-r--r--libjava/java/net/URLStreamHandler.java2
-rw-r--r--libjava/java/nio/Buffer.java32
-rw-r--r--libjava/java/nio/ByteBuffer.java545
-rw-r--r--libjava/java/nio/CharBuffer.java237
-rw-r--r--libjava/java/nio/DoubleBuffer.java75
-rw-r--r--libjava/java/nio/FloatBuffer.java77
-rw-r--r--libjava/java/nio/IntBuffer.java76
-rw-r--r--libjava/java/nio/LongBuffer.java76
-rw-r--r--libjava/java/nio/MappedByteBuffer.java23
-rw-r--r--libjava/java/nio/ShortBuffer.java76
-rw-r--r--libjava/java/nio/channels/Channels.java130
-rw-r--r--libjava/java/nio/channels/DatagramChannel.java22
-rw-r--r--libjava/java/nio/channels/FileLock.java137
-rw-r--r--libjava/java/nio/channels/Pipe.java3
-rw-r--r--libjava/java/nio/channels/SelectableChannel.java4
-rw-r--r--libjava/java/nio/channels/SelectionKey.java8
-rw-r--r--libjava/java/nio/channels/ServerSocketChannel.java2
-rw-r--r--libjava/java/nio/channels/SocketChannel.java17
-rw-r--r--libjava/java/nio/channels/spi/AbstractInterruptibleChannel.java2
-rw-r--r--libjava/java/nio/channels/spi/AbstractSelectableChannel.java8
-rw-r--r--libjava/java/nio/channels/spi/SelectorProvider.java12
-rw-r--r--libjava/java/nio/charset/Charset.java5
-rw-r--r--libjava/java/nio/charset/CharsetEncoder.java5
-rw-r--r--libjava/java/nio/charset/IllegalCharsetNameException.java13
-rw-r--r--libjava/java/nio/charset/UnsupportedCharsetException.java13
-rw-r--r--libjava/java/rmi/server/RMIClassLoader.java2
-rw-r--r--libjava/java/rmi/server/RMIClassLoaderSpi.java64
-rw-r--r--libjava/java/rmi/server/UnicastRemoteObject.java4
-rw-r--r--libjava/java/security/SecureRandom.java8
-rw-r--r--libjava/java/security/Security.java21
-rw-r--r--libjava/java/sql/Timestamp.java34
-rw-r--r--libjava/java/util/Properties.java84
-rw-r--r--libjava/java/util/TreeMap.java6
-rw-r--r--libjava/java/util/jar/JarFile.java24
-rw-r--r--libjava/java/util/natResourceBundle.cc20
-rw-r--r--libjava/java/util/natTimeZone.cc5
-rw-r--r--libjava/java/util/zip/InflaterInputStream.java4
-rw-r--r--libjava/java/util/zip/ZipEntry.java10
-rw-r--r--libjava/java/util/zip/ZipFile.java186
-rw-r--r--libjava/java/util/zip/ZipInputStream.java4
-rw-r--r--libjava/javax/naming/InitialContext.java22
-rw-r--r--libjava/javax/sql/ConnectionEvent.java13
-rw-r--r--libjava/jni.cc94
-rw-r--r--libjava/libgcj.spec.in2
-rw-r--r--libjava/libtool-version2
-rw-r--r--libjava/org/xml/sax/AttributeList.java384
-rw-r--r--libjava/org/xml/sax/Attributes.java495
-rw-r--r--libjava/org/xml/sax/ContentHandler.java782
-rw-r--r--libjava/org/xml/sax/DTDHandler.java225
-rw-r--r--libjava/org/xml/sax/DocumentHandler.java462
-rw-r--r--libjava/org/xml/sax/EntityResolver.java229
-rw-r--r--libjava/org/xml/sax/ErrorHandler.java248
-rw-r--r--libjava/org/xml/sax/HandlerBase.java738
-rw-r--r--libjava/org/xml/sax/InputSource.java657
-rw-r--r--libjava/org/xml/sax/Locator.java262
-rw-r--r--libjava/org/xml/sax/Parser.java416
-rw-r--r--libjava/org/xml/sax/SAXException.java297
-rw-r--r--libjava/org/xml/sax/SAXNotRecognizedException.java99
-rw-r--r--libjava/org/xml/sax/SAXNotSupportedException.java99
-rw-r--r--libjava/org/xml/sax/SAXParseException.java534
-rw-r--r--libjava/org/xml/sax/XMLFilter.java132
-rw-r--r--libjava/org/xml/sax/XMLReader.java813
-rw-r--r--libjava/org/xml/sax/ext/DeclHandler.java274
-rw-r--r--libjava/org/xml/sax/ext/LexicalHandler.java373
-rw-r--r--libjava/org/xml/sax/ext/package.html49
-rw-r--r--libjava/org/xml/sax/helpers/AttributeListImpl.java622
-rw-r--r--libjava/org/xml/sax/helpers/AttributesImpl.java1226
-rw-r--r--libjava/org/xml/sax/helpers/DefaultHandler.java915
-rw-r--r--libjava/org/xml/sax/helpers/LocatorImpl.java426
-rw-r--r--libjava/org/xml/sax/helpers/NamespaceSupport.java1459
-rw-r--r--libjava/org/xml/sax/helpers/NewInstance.java80
-rw-r--r--libjava/org/xml/sax/helpers/ParserAdapter.java2034
-rw-r--r--libjava/org/xml/sax/helpers/ParserFactory.java258
-rw-r--r--libjava/org/xml/sax/helpers/XMLFilterImpl.java1483
-rw-r--r--libjava/org/xml/sax/helpers/XMLReaderAdapter.java1065
-rw-r--r--libjava/org/xml/sax/helpers/XMLReaderFactory.java339
-rw-r--r--libjava/org/xml/sax/helpers/package.html13
-rw-r--r--libjava/org/xml/sax/package.html164
-rw-r--r--libjava/resolve.cc95
-rw-r--r--libjava/testsuite/ChangeLog101
-rw-r--r--libjava/testsuite/Makefile.in4
-rw-r--r--libjava/testsuite/lib/libjava.exp22
-rw-r--r--libjava/testsuite/libjava.compile/consthrow.java6
-rw-r--r--libjava/testsuite/libjava.compile/consthrow.xfail2
-rw-r--r--libjava/testsuite/libjava.compile/pr8712.java7
-rw-r--r--libjava/testsuite/libjava.compile/pr8955.java13
-rw-r--r--libjava/testsuite/libjava.jacks/jacks.exp7
-rw-r--r--libjava/testsuite/libjava.jacks/jacks.xfail90
-rw-r--r--libjava/testsuite/libjava.jni/calls.c2
-rw-r--r--libjava/testsuite/libjava.jni/field.c2
-rw-r--r--libjava/testsuite/libjava.jni/final_method.c2
-rw-r--r--libjava/testsuite/libjava.jni/findclass.c2
-rw-r--r--libjava/testsuite/libjava.jni/invoke.c2
-rw-r--r--libjava/testsuite/libjava.jni/martin.c3
-rw-r--r--libjava/testsuite/libjava.jni/noclass.c2
-rw-r--r--libjava/testsuite/libjava.jni/overload.c4
-rw-r--r--libjava/testsuite/libjava.jni/register.c2
-rw-r--r--libjava/testsuite/libjava.jni/simple_int.c2
-rw-r--r--libjava/testsuite/libjava.jni/throwit.c2
-rw-r--r--libjava/testsuite/libjava.jni/virtual.c2
-rw-r--r--libjava/testsuite/libjava.lang/pr8823.xfail1
-rw-r--r--libjava/testsuite/libjava.lang/pr8945.java9
-rw-r--r--libjava/testsuite/libjava.lang/pr8945.out1
-rw-r--r--libjava/testsuite/libjava.mauve/mauve.exp47
-rw-r--r--libjava/testsuite/libjava.mauve/xfails51
-rw-r--r--libjava/verify.cc121
-rw-r--r--libjava/win32-threads.cc101
-rw-r--r--libjava/win32.cc4
254 files changed, 17530 insertions, 12671 deletions
diff --git a/libjava/ChangeLog b/libjava/ChangeLog
index d9c65cc89b1..f8071fd7066 100644
--- a/libjava/ChangeLog
+++ b/libjava/ChangeLog
@@ -1,3 +1,1284 @@
+2003-02-21 Mark Wielaard <mark@klomp.org>
+
+ * java/util/zip/ZipEntry.java (setComment): Don't check length when
+ argument is null.
+
+2003-02-21 Mark Wielaard <mark@klomp.org>
+
+ * java/util/zip/ZipEntry.java (ZipEntry(String)): When name is bigger
+ then 65535 chars throw IllegalArgumentException.
+
+2003-02-21 Mark Wielaard <mark@klomp.org>
+
+ * java/util/zip/ZipFile.java (finalize): New method.
+
+2003-02-20 Alexandre Oliva <aoliva@redhat.com>
+
+ * configure.in: Propagate ORIGINAL_LD_FOR_MULTILIBS to
+ config.status.
+ * configure: Rebuilt.
+
+2003-02-19 Rainer Orth <ro@TechFak.Uni-Bielefeld.DE>
+
+ * gnu/gcj/runtime/natStackTrace.cc: Include platform.h immediately
+ after config.h. Use <> for consistency.
+ * java/lang/natObject.cc: Likewise.
+ * java/lang/natRuntime.cc: Likewise.
+ * java/lang/natSystem.cc: Likewise.
+ * java/util/natTimeZone.cc: Likewise.
+ * win32.cc: Likewise.
+ * include/posix.h (fcntl, socket, connect, close, bind, accept,
+ listen, write, read): Undef to avoid interference from OS macros.
+
+2003-02-18 Raif S. Naffah <raif@fl.net.au>
+
+ * java/math/BigInteger.java (euclidInv): Take result array as an
+ argument. Updated all callers.
+ (modInverse): Removed unused variables.
+
+2003-02-17 Michael Koch <konqueror@gmx.de>
+
+ * java/net/DatagramSocket.java
+ (connect): Merged with classpath.
+ (disconnect): Merged documentation with classpath.
+ (receice): Merged documentation with classpath.
+ (send): Merged documentation with classpath.
+
+2003-02-17 Jesse Rosenstock <jmr@ugcs.caltech.edu>
+
+ * java/nio/charset/Charset.java
+ (isRegistered): Fixed method args and implementation.
+ * java/nio/charset/CharsetEncoder.java
+ (unmappableCharacterAction): New method.
+
+2003-02-17 Raif S. Naffah <raif@fl.net.au>
+
+ * java/math/BigInteger.java (euclidInv): Return array of
+ `BigInteger's. Changed all callers.
+
+2003-02-16 Ranjit Mathew <rmathew@hotmail.com>
+
+ * java/util/Properties.java (store): Move the code formerly in
+ list(), into this method.
+ (list (PrintStream)): Just call list (PrintWriter) with a
+ PrintWriter object constructed from the given PrintStream object.
+ (list (PrintWriter)): Emulate the output of Properties.list()
+ as found in JDK 1.3/1.4.
+
+2003-02-16 Tom Tromey <tromey@redhat.com>
+
+ * verify.cc (_Jv_BytecodeVerifier::pop_jump): Removed unused
+ variable.
+
+2003-02-14 Michael Koch <konqueror@gmx.de>
+
+ * gnu/java/nio/natServerSocketChannelImpl.cc: Removed.
+ * gnu/java/nio/ServerSocketChannelImpl.java
+ (SocketAccept): Removed.
+ (accept): Commented out use of SocketAccept.
+
+2003-02-14 Mark Wielaard <mark@klomp.org>
+
+ * java/math/BigDecimal.java (BigDecimal(String)): Always set scale to
+ zero when there is an exponent and the significant is zero.
+ (divide): Always set scale to newScale even in special ZERO case.
+
+2003-02-14 Tom Tromey <tromey@redhat.com>
+
+ * java/lang/System.java (properties): Use Properties.clone.
+ (setProperties): Likewise.
+
+2003-02-13 Tom Tromey <tromey@redhat.com>
+
+ * verify.cc (state::seen_subrs): New field.
+ (state::state): Initialize it.
+ (state::clean_subrs): New method.
+ (state::~state): Call it.
+ (state::copy): Copy subroutine list.
+ (state::add_subr): New method.
+ (state::merge): Only register a change if the current subroutine
+ hasn't yet been noted.
+
+2003-02-13 Mark Wielaard <mark@klomp.org>
+
+ * java/io/InputStreamReader.java (getEncoding): Return null when
+ closed.
+ * java/io/OutputStreamWriter.java (getEncoding): Likewise.
+
+2003-02-13 Mark Wielaard <mark@klomp.org>
+
+ * java/util/zip/InflaterInputStream.java (read): Return zero when len
+ is zero.
+
+2003-02-13 Mark Wielaard <mark@klomp.org>
+
+ * java/io/BufferedOutputStream.java (write(int)): Only flush when
+ next byte cannot be buffered.
+
+2003-02-13 Casey Marshall <rsdio@metastatic.org>
+
+ PR libgcj/9271:
+ * java/security/SecureRandom.java (next): Avoid bias in results.
+
+2003-02-13 Michael <konqueror@gmx.de>
+
+ * gnu/java/nio/FileChannelImpl.java
+ (lengthInternal): Must be native.
+ (size): Check if channel is already closed.
+ (implCloseChannel): Reformated.
+ (read): w was unused, removed it.
+ (read): Removed.
+ (read): New method.
+ (write): New method.
+ (map): Check arguments.
+ (force): Throws IOException, check if channel is closed.
+ (transferTo): New method.
+ (transferFrom): New method.
+ (lock): New method.
+ (tryLock): New method.
+ (position): New method.
+ (truncate): New method.
+ (nio_mmap_file): Uncommented.
+ (nio_munmap_file): Uncommented.
+ (nio_msync): Uncommented.
+ * gnu/java/nio/natFileChannelImpl.cc: New file.
+
+2003-02-13 Michael Koch <konqueror@gmx.de>
+
+ * java/nio/ByteBuffer.java
+ (endian): New member variable.
+ (get): New methods.
+ (equals): New method.
+ (compareTo): New method.
+ (order): New methods.
+ (compact): New method.
+ (isDirect): New method.
+ (slice): New method.
+ (duplicate): New method.
+ (asReadOnlyBuffer): New method.
+ (asCharBuffer): New method.
+ (asDoubleBuffer): New method.
+ (asFloatBuffer): New method.
+ (asIntBuffer): New method.
+ (asLongBuffer): New method.
+ (asShortBuffer): New method.
+ (get*): New methods.
+ (put*): New methods.
+ (toString): New method.
+ * java/nio/CharBuffer.java
+ (CharBuffer): Implement Comparable instead of Cloneable.
+ (get): May not be final.
+ (put): May not be final.
+
+2003-02-13 Michael Koch <konqueror@gmx.de>
+
+ * gnu/java/nio/natSocketChannelImpl.cc
+ (SocketConnect): This is not implemented yet.
+ (SocketBind): This is not implemented yet.
+
+2003-02-13 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/natShortBufferImpl.cc:
+ Added copyright and license.
+ * java/nio/DoubleBuffer.java,
+ java/nio/FloatBuffer.java,
+ java/nio/IntBuffer.java,
+ java/nio/LongBuffer.java,
+ java/nio/ShortBuffer.java
+ (array): Throw exceptions.
+ (arrayOffset): Throw exceptions.
+
+2002-02-13 Ranjit Mathew <rmathew@hotmail.com>
+
+ * gnu/gcj/runtime/NameFinder.java (createStackTraceElement): Use
+ lastIndexOf( ) instead of indexOf( ) to find the colon before
+ the line number, because Win32 file names might contain a
+ drive letter and a colon at the start of an absolute path.
+
+2003-02-12 Jeff Sturm <jsturm@one-point.com>
+
+ * configure.host (alpha*-*): Default to -mieee.
+ * configure.in (IEEESPEC): New.
+ * libgcj.spec.in (jc1): Add IEEESPEC.
+ * configure: Rebuild.
+
+2003-02-12 Ranjit Mathew <rmathew@hotmail.com>
+
+ * include/win32.h: Include ws2tcpip.h instead of
+ winsock.h to obtain definition of the socklen_t type.
+ Remove IP_TOS definition - not needed with ws2tcpip.h
+ (_Jv_connect): Correct slight formatting error.
+
+2003-02-12 Ranjit Mathew <rmathew@hotmail.com>
+
+ * jni.cc (_Jv_LookupJNIMethod): Modify to accept the
+ size of the arguments for a JNI function. For Win32,
+ modify to search for all forms of possible exported
+ names of an stdcall JNI function.
+ (_Jv_JNIMethod::call): Modify to calculate the size
+ of the arguments passed to a JNI function and pass
+ it to _Jv_LookupJNIMethod.
+
+2003-02-12 Michael Koch <konqueror@gmx.de>
+
+ * java/net/NetPermission.java
+ (NetPermission): Make doucmentation match the method declaration.
+ * java/net/NetworkInterface.java
+ (equals): Reformated for GNU coding style.
+ * java/net/ServerSocket.java: Merged with classpath.
+ * java/net/Socket.java: Partly merged with classpath (Added some
+ @since).
+ * java/net/SocketImpl.java
+ (localPort): Merged with classpath (initialize with -1).
+ * java/net/SocketPermission.java: Merged with classpath (reindented).
+ * java/net/URLDecoder.java: Merged with classpath (reindented).
+
+2003-02-12 Michael Koch <konqueror@gmx.de>
+
+ * java/nio/channels/Channels.java: New file.
+ * Makefile.am
+ (ordinary_java_source_files): Added java/nio/channels/Channels.java.
+ * Makefile.in: Regenerated.
+
+2003-02-12 Michael Koch <konqueror@gmx.de>
+
+ * java/nio/ByteBuffer.java
+ (allocate): Implemented.
+ (wrap): Implemented.
+ * java/nio/CharBuffer.java:
+ Some documentation added and reworked.
+ (endian): Removed.
+ (allocate): Implemented.
+ (wrap): Implemented.
+ (array): Throw exceptions.
+ (arrayOffset): Throw exceptions.
+ (toString): Implemented.
+ (length): Implemented.
+ (put): Implemented.
+ (charAt): Implemented.
+
+2003-02-11 John Leuner <jewel@debian.org>
+
+ * java/util/zip/ZipInputStream.java: Fix problem with 0-length
+ reads from end of file.
+
+2003-02-11 Michael Koch <konqueror@gmx.de>
+
+ * gnu/java/nio/ByteBufferImpl.java:
+ Reformated and removed some code.
+ (backing_buffer): Removed.
+ (array_offset): Removed.
+ (ro): Renamed to readOnly.
+ (ByteBufferImpl): Use parent constructor, initialize readOnly.
+ * gnu/java/nio/CharBufferImpl.java:
+ Reformated and removed some code.
+ (array_offset): Removed.
+ (ro): Renamed to readOnly.
+ (CharBufferImpl): Use parent constructor, initialize readOnly.
+ (inc_pos): Removed.
+ (order): New method.
+ * gnu/java/nio/DoubleBufferImpl.java:
+ Reformated and removed some code.
+ (array_offset): Removed.
+ (ro): Renamed to readOnly.
+ (DoubleBufferImpl): Use parent constructor, initialize readOnly.
+ (inc_pos): Removed.
+ (order): New method.
+ * gnu/java/nio/FloatBufferImpl.java:
+ Reformated and removed some code.
+ (array_offset): Removed.
+ (ro): Renamed to readOnly.
+ (FloatBufferImpl): Use parent constructor, initialize readOnly.
+ (inc_pos): Removed.
+ (order): New method.
+ * gnu/java/nio/IntBufferImpl.java:
+ Reformated and removed some code.
+ (array_offset): Removed.
+ (ro): Renamed to readOnly.
+ (IntBufferImpl): Use parent constructor, initialize readOnly.
+ (inc_pos): Removed.
+ (order): New method.
+ * gnu/java/nio/LongBufferImpl.java:
+ Reformated and removed some code.
+ (array_offset): Removed.
+ (ro): Renamed to readOnly.
+ (LongBufferImpl): Use parent constructor, initialize readOnly.
+ (inc_pos): Removed.
+ (order): New method.
+ * gnu/java/nio/ShortBufferImpl.java:
+ Reformated and removed some code.
+ (array_offset): Removed.
+ (ro): Renamed to readOnly.
+ (ShortBufferImpl): Use parent constructor, initialize readOnly.
+ (inc_pos): Removed.
+ (order): New method.
+ * Makefile.am
+ (ordinary_java_source_files): Added the following files:
+ gnu/java/nio/ByteBufferImpl.java
+ gnu/java/nio/CharBufferImpl.java
+ gnu/java/nio/DoubleBufferImpl.java
+ gnu/java/nio/FloatBufferImpl.java
+ gnu/java/nio/IntBufferImpl.java
+ gnu/java/nio/LongBufferImpl.java
+ gnu/java/nio/ShortBufferImpl.java
+ java/nio/DoubleBuffer.java
+ java/nio/FloatBuffer.java
+ java/nio/IntBuffer.java
+ java/nio/LongBuffer.java
+ java/nio/ShortBuffer.java
+ (nat_source_files): Added the following files:
+ 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/natShortBufferImpl.cc
+ * Makefile.in: Regenerated.
+
+2003-02-11 Michael Koch <konqueror@gmx.de>
+
+ * gnu/java/nio/natCharBufferImpl.cc
+ (nio_cast): Removed.
+ (nio_put_*): Removed.
+ (nio_get_*): Removed.
+ * gnu/java/nio/natDoubleBufferImpl.cc
+ (nio_cast): Removed.
+ (nio_put_*): Removed.
+ (nio_get_*): Removed.
+ * gnu/java/nio/natFloatBufferImpl.cc
+ (nio_cast): Removed.
+ (nio_put_*): Removed.
+ (nio_get_*): Removed.
+ * gnu/java/nio/natIntBufferImpl.cc
+ (nio_cast): Removed.
+ (nio_put_*): Removed.
+ (nio_get_*): Removed.
+ * gnu/java/nio/natLongBufferImpl.cc
+ (nio_cast): Removed.
+ (nio_put_*): Removed.
+ (nio_get_*): Removed.
+ * gnu/java/nio/natShortBufferImpl.cc
+ (nio_cast): Removed.
+ (nio_put_*): Removed.
+ (nio_get_*): Removed.
+ * gnu/java/nio/SelectorProviderImpl.java
+ (openDatagramChannel): Throws IOException.
+ (openPipe): Throws IOException.
+ (openSelector): Throws IOException.
+ (openServerSocketChannel): Throws IOException.
+ (openSocketChannel): Throws IOException.
+ * gnu/java/nio/ServerSocketChannelImpl.java
+ (ServerSocketChannelImpl): Throws IOException.
+ (implCloseSelectableChannel): Throws IOException.
+ (implConfigureBlocking): Throws IOException.
+ * java/nio/ByteBuffer.java
+ (readOnly): Removed.
+ (hasArray): Use isReadOnly() instead of readOnly.
+ (array): Use isReadOnly() instead of readOnly.
+ (arrayOffset): Use isReadOnly() instead of readOnly.
+ * java/nio/CharBuffer.java
+ (CharBuffer): Implements Cloneable and CharSequence.
+
+2003-02-11 Michael Koch <konqueror@gmx.de>
+
+ * java/nio/Buffer.java
+ (cap, lim, pos, mark): Made private
+ (Buffer): Added package private constructor.
+ * java/nio/ByteBuffer.java
+ (ByteBuffer): Implements Cloneable.
+ (offset): New member variable.
+ (readOnly): New member variable.
+ (backing_buffer): New member variable.
+ (allocateDirect): Throw exception and tell that direct buffers are
+ not supported yet, documentation added.
+ (allocate): Documentation added.
+ (wrap): Documentation added.
+ (ByteBuffer): New constructor.
+ (hasArray): New method.
+ (array): New method.
+ (arrayOffset): New method.
+ (get): Documentation added.
+ (put): Documentation added.
+ * java/nio/CharBuffer.java
+ (CharBuffer): New constructor.
+ (compareTo): Don't access member variables of Buffer directly.
+ * java/nio/DoubleBuffer.java
+ (allocateDirect): Throw exception and tell that direct buffers are
+ not supported yet.
+ * java/nio/FloatBuffer.java
+ (allocateDirect): Throw exception and tell that direct buffers are
+ not supported yet.
+ * java/nio/IntBuffer.java
+ (allocateDirect): Throw exception and tell that direct buffers are
+ not supported yet.
+ * java/nio/LongBuffer.java
+ (allocateDirect): Throw exception and tell that direct buffers are
+ not supported yet.
+ * java/nio/MappedByteBuffer.java
+ (MappedByteBuffer): New method.
+ (force): New method.
+ (isLoaded): New method.
+ (load): New method.
+ * java/nio/ShortBuffer.java
+ (allocateDirect): Throw exception and tell that direct buffers are
+ not supported yet.
+
+2003-02-11 Ranjit Mathew <rmathew@hotmail.com>
+
+ * java/io/natFileDescriptorWin32.cc
+ (java::io::FileDescriptor::read): Return -1 (EOF) if ReadFile( )
+ returns with Win32 error code ERROR_BROKEN_PIPE.
+
+2003-02-10 Tom Tromey <tromey@redhat.com>
+
+ * javax/sql/ConnectionEvent.java (serialVersionUID): New field.
+ (ex): Renamed from sqlException.
+
+2003-02-10 Michael Koch <konqueror@gmx.de>
+
+ * java/nio/DoubleBuffer.java
+ (DoubleBuffer): Implements Comparable.
+ (endian): Removed.
+ (array_offset): New member variable.
+ (DoubleBuffer): New constuctor.
+ (get): May not be final.
+ (put): May not be final.
+ (arrayOffset): Implemented.
+ (order): Made abstract.
+ (order): Removed.
+ (as*Buffer): Removed.
+ (get*): Removed.
+ (put*): Removed.
+ * java/nio/FloatBuffer.java
+ (FloatBuffer): Implements Comparable.
+ (endian): Removed.
+ (array_offset): New member variable.
+ (FloatBuffer): New constuctor.
+ (get): May not be final.
+ (put): May not be final.
+ (arrayOffset): Implemented.
+ (order): Made abstract.
+ (order): Removed.
+ (as*Buffer): Removed.
+ (get*): Removed.
+ (put*): Removed.
+ * java/nio/IntBuffer.java
+ (IntBuffer): Implements Comparable.
+ (endian): Removed.
+ (array_offset): New member variable.
+ (IntBuffer): New constuctor.
+ (get): May not be final.
+ (put): May not be final.
+ (arrayOffset): Implemented.
+ (order): Made abstract.
+ (order): Removed.
+ (as*Buffer): Removed.
+ (get*): Removed.
+ (put*): Removed.
+ * java/nio/LongBuffer.java
+ (LongBuffer): Implements Comparable.
+ (endian): Removed.
+ (array_offset): New member variable.
+ (LongBuffer): New constuctor.
+ (get): May not be final.
+ (put): May not be final.
+ (arrayOffset): Implemented.
+ (order): Made abstract.
+ (order): Removed.
+ (as*Buffer): Removed.
+ (get*): Removed.
+ (put*): Removed.
+ * java/nio/ShortBuffer.java
+ (ShortBuffer): Implements Comparable.
+ (endian): Removed.
+ (array_offset): New member variable.
+ (ShortBuffer): New constuctor.
+ (get): May not be final.
+ (put): May not be final.
+ (arrayOffset): Implemented.
+ (order): Made abstract.
+ (order): Removed.
+ (as*Buffer): Removed.
+ (get*): Removed.
+ (put*): Removed.
+
+2003-02-10 Michael Koch <konqueror@gmx.de>
+
+ * gnu/java/nio/FileLockImpl.java,
+ java/nio/channels/FileLock.java: New files.
+
+2003-02-10 Michael Koch <konqueror@gmx.de>
+
+ * java/nio/charset/IllegalCharsetNameException.java
+ (serialVersionUID): New member variable.
+ (charsetName): New member variable.
+ (IllegalCharsetException): New implementation.
+ (getCharsetName): New implementation.
+ * java/nio/charset/UnsupportedCharsetException.java
+ (serialVersionUID): New member variable.
+ (charsetName): New member variable.
+ (UnsupportedCharsetException): New implementation.
+ (getCharsetName): New implementation.
+
+2003-02-10 Michael Koch <konqueror@gmx.de>
+
+ * java/nio/channels/DatagramChannel.java
+ (write): Throws IOException.
+ (connect): Throws IOException.
+ (disconnect): Throws IOException.
+ (read): Throws IOException.
+ (receive): Throws IOException.
+ (send): Throws IOException.
+ * java/nio/channels/Pipe.java
+ (open): Throws IOException.
+ * java/nio/channels/SelectableChannel.java
+ (configureBlocking): Throws IOException.
+ * java/nio/channels/ServerSocketChannel.java
+ (accept): Throws IOException.
+ * java/nio/channels/SocketChannel.java
+ (SocketChannel): Implements ByteChannel, ScatteringByteChannel,
+ GatheringByteChannel.
+ (read): Throws IOException.
+ (write): Throws IOException.
+ (finishConnect): Throws IOException.
+ * java/nio/channels/spi/AbstractInterruptibleChannel.java
+ (end): Throws AsynchronousCloseException.
+ * java/nio/channels/spi/AbstractSelectableChannel.java
+ (configureBlocking): Throws IOException.
+ (implCloseChannel): Throws IOException.
+ (implCloseSelectableChannel): Throws IOException.
+ (implConfigureBlocking): Throws IOException.
+ * java/nio/channels/spi/SelectorProvider.java
+ (openDatagramChannel): Throws IOException.
+ (openPipe): Throws IOException.
+ (openSelector): Throws IOException.
+ (openServerSocketChannel): Throws IOException.
+ (openSocketChannel): Throws IOException.
+
+2003-02-10 Raif S. Naffah <raif@fl.net.au>
+
+ * gnu/java/security/provider/SHA1PRNG.java (ensureIsSeeded): new
+ method used to ensure seeding has occurred and that a specific
+ seed can be set and used.
+
+2003-02-10 Michael Koch <konqueror@gmx.de>
+
+ * java/nio/channels/SelectionKey.java
+ (OP_ACCEPT, OP_CONNECT, OP_READ, OP_WRITE): Initialize with correct
+ values.
+
+2003-02-10 Ranjit Mathew <rmathew@hotmail.com>
+
+ * java/lang/Win32Process.java (destroy): Declare as native.
+ (hasExited): New native method.
+ (exitValue): Define.
+ (getErrorStream): Likewise.
+ (getInputStream): Likewise.
+ (getOutputStream): Likewise.
+ (waitFor): Declare as native.
+ (startProcess): New native method.
+ (cleanup): Likewise.
+ (ConcreteProcess): Define.
+ (outputStream, inputStream, errorStream): New members.
+ (procHandle, exitCode): Likewise.
+
+ * java/lang/natWin32Process.cc
+ (java::lang::ConcreteProcess::cleanup): Define.
+ (java::lang::ConcreteProcess::destroy): Likewise.
+ (java::lang::ConcreteProcess::hasExited): Likewise.
+ (java::lang::ConcreteProcess::waitFor): Likewise.
+ (new_string): Likewise.
+ (java::lang::ConcreteProcess::startProcess): Likewise.
+
+2003-02-10 Raif S. Naffah <raif@fl.net.au>
+
+ * java/math/BigInteger.java:
+ Updated notice to include years 2002 and 3.
+ Added 2 private (int) arrays with values from the HAC (Handbook of
+ Applied Cryptography -A. Menezes & al): k[] that contains bit lengths
+ and t[] that contains nbr. of tests --used in isProbablePrime().
+
+ * java/math/BigInteger.java (make(long)): Merged into valueOf(long).
+
+ * java/math/BigInteger.java (make(int[],int), add(int,int),
+ add(BI,BI,int), times(BI,int), divide(long,long,BI,BI,int), gcd(BI),
+ isProbablePrime(int), shift(BI,int), valueOf(String,int), neg(BI),
+ bitOp(int,BI,BI), and(BI,int)): Use valueOf(long) instead of
+ make(long).
+
+ * java/math/BigInteger.java (euclidInv): Reduce number of work vars
+ (euclidInv(int,int,int)): Now returns an array of 2 ints instead of 3.
+ (euclidInv(BI,BI,BI)): Used to return an array of 2 BIs; now accepts 6
+ BIs and returns void.
+ (modInverse(BI)): Use new signatures of euclidInv().
+
+ * java/math/BigInteger.java (isProbablePrime(int)): Use divide() with
+ static small primes instead of remainder().
+ Use pre-computed max nbr of trials based on bitlength of BI to test.
+ Use pre-computed small primes for the trial tests instead of random
+ numbers.
+
+ * java/math/BigInteger.java (isOdd, isMinusOne, pow): Removed.
+ not used.
+
+ * java/math/BigInteger.java (format(int,StringBuffer)): Removed
+ invoacation of MPN.chars_per_word(). not used.
+
+ * java/math/BigInteger.java (gcd(int,int)): Declared 'tmp' once as
+ local var and used where needed.
+
+ * java/math/BigInteger.java (modPow(BI,BI)): Fixed spelling.
+ Combined declaration with initialisation of locals.
+ Removed unused var.
+
+ * java/math/BigInteger.java: Style changes
+ (pow(int)): Removed 'else' keyword.
+ (toString(int)): idem.
+ (doubleValue()): idem.
+ (bitLength()): idem.
+ (equals(Object)): Use static methods name in same class w/o prepending
+ class name.
+ (doubleValue()): idem.
+ (setNegative(BI)): idem.
+ (negate()): idem.
+ (and(BI,int)): idem.
+ (and(BI)): idem.
+ (gcd(BI)): idem.
+ (byteArrayToIntArray()): Removed casting to (int). this is
+ std. behaviour.
+ (canonicalize()): idem.
+ (alloc(int)): Always instantiate a new BI.
+
+2003-02-10 Tom Tromey <tromey@redhat.com>
+
+ * java/sql/Timestamp.java (compareTo(Object)): New method.
+ (compareTo(Timestamp)): Likewise.
+ (serialVersionUID): Updated.
+
+2003-02-07 Mark Wielaard <mark@klomp.org>
+
+ * java/util/jar/JarFile.java (JarFile(String, boolean)): Read manifest
+ when verify is true.
+ (JarFile(File, boolean)): Likewise.
+ (manifestRead): Set manifestRead field correctly.
+
+2003-02-07 Stephen Crawley <crawley@dstc.edu.au>
+
+ * java/math/BigDecimal(valueOf): fix DiagBigDecimal val008, val013
+ tests; see patch #1016 on Savannah.
+
+2003-02-07 Stephen Crawley <crawley@dstc.edu.au>
+
+ * java/math/BigDecimal.java (BigDecimal): enhance parsing of exponents
+ (toString): do not return Strings starting with . and - erroneously.
+ Improves Mauve results to 12 of 600 instead of 16 of 338 on
+ DiagBigDecimal.
+
+2003-02-07 Stephen Crawley <crawley@dstc.edu.au>
+
+ * java/beans/PropertyDescriptor.java
+ (PropertyDescriptor(String, Class)): Sanity check getter and setter
+ methods.
+ (PropertyDescriptor(String, Class, String, String)): Likewise.
+ (PropertyDescriptor(String, Method, Method): Factor out getter and
+ setter method sanity checks into new method.
+ (findMethods): Don't do parameter sanity checking of get method here.
+ (checkMethods): New method.
+
+2003-02-07 Stephen Crawley <crawley@dstc.edu.au>
+
+ * java/beans/PropertyDescriptor.java: Reformat.
+
+2003-02-04 Tom Tromey <tromey@redhat.com>
+
+ * java/io/PipedOutputStream.java (flush): Declare as throwing
+ IOException.
+ (close): Likewise.
+ * java/io/PipedWriter.java (close): Declare as throwing
+ IOException.
+ * java/io/StringWriter.java (close): Declare as throwing
+ IOException.
+
+2003-02-03 Ranjit Mathew <rmathew@hotmail.com>
+
+ * java/lang/natRuntime.cc (java::lang::Runtime::_load)): Take care
+ of the fact that on Win32, JNI_OnLoad is an "stdcall" function and
+ could also have been exported as "JNI_OnLoad@8" (MinGW) or
+ "_JNI_OnLoad@8" (MSVC).
+
+2003-02-03 Ranjit Mathew <rmathew@hotmail.com>
+
+ * resolve.cc (_Jv_JNIMethod::ncode): Use stdcall calling
+ convention on Win32 to invoke native JNI methods.
+
+2003-02-03 Andrew Haley <aph@redhat.com>
+
+ * configure.host (x86_64): Enable interpreter.
+
+2003-01-28 Andrew Haley <aph@redhat.com>
+
+ * libgcj.spec.in (jc1): Add BACKTRACESPEC.
+ * configure.host (x86_64): Default to -fno-omit-frame-pointer.
+ * configure.in (BACKTRACESPEC): New.
+ * configure: Regenerate.
+
+2003-02-02 Tom Tromey <tromey@redhat.com>
+
+ * Makefile.in: Rebuilt.
+ * Makefile.am (lib_gnu_awt_xlib_la_LDFLAGS): Link against
+ libstdc++.
+
+2003-01-31 Tom Tromey <tromey@redhat.com>
+
+ * jni.cc (_Jv_JNI_NewObjectArray): Check that initializer can be
+ cast to element type.
+ (_Jv_JNI_SetObjectArrayElement): Check array bounds.
+ (_Jv_JNI_GetObjectArrayElement): Likewise.
+
+2003-01-31 Tom Tromey <tromey@redhat.com>
+
+ * Makefile.in: Rebuilt.
+ * Makefile.am (cond_x_ltlibrary): Renamed library to
+ lib-gnu-awt-xlib.la.
+ (lib_gnu_awt_xlib_la_SOURCES): Renamed.
+ (EXTRA_lib_gnu_awt_xlib_la_SOURCES): Likewise.
+ (lib_gnu_awt_xlib_la_DEPENDENCIES): Likewise.
+ (lib_gnu_awt_xlib_la_LIBADD): Likewise.
+ (lib_gnu_awt_xlib_la_LDFLAGS): Likewise.
+ (lib_gnu_awt_xlib_la_LINK): Likewise.
+ (install-exec-hook): Removed.
+ (lib-gnu-awt-xlib.la): Renamed.
+
+ * aclocal.m4, configure, include/config.h.in: Rebuilt.
+ * acinclude.m4 (CHECK_FOR_BROKEN_MINGW_LD): Moved from
+ aclocal.m4.
+
+2003-01-31 Julian Dolby <dolby@us.ibm.com>
+
+ * java/util/Properties.java (load): Ignore backslash before EOF.
+
+2003-01-28 Oscar Pearce <oscar@pearceenterprises.com>
+
+ * java/awt/Component.java (processPaintEvent): Dispose of Graphics
+ object when finished.
+
+2003-01-28 Andreas Tobler <a.tobler@schweiz.ch>
+
+ * libjava/configure.host: Disable can_unwind_signal on darwin.
+
+2003-01-28 Ranjit Mathew <rmathew@hotmail.com>
+
+ Fixes PR java/9254:
+ * include/win32-threads.h (_Jv_Mutex_t): Convert to a struct
+ additionally containing id of the owner thread as well as
+ the number of nested times the thread has acquired the mutex.
+ (_Jv_MutexInit): Initialise owner thread id and refcount to 0.
+ (_Jv_MutexDestroy): Reset owner thread id and refcount to 0.
+ (_Jv_MutexUnlock): Check if really the owner thread, reset
+ owner thread id to 0 before leaving, if leaving for the last
+ time.
+ (_Jv_MutexLock): Set owner thread id in the mutex and increment
+ refcount.
+ (_Jv_ThreadYield): Yield using a call to Sleep(0).
+ * win32-threads.cc (_Jv_CondWait): Check if really owner of
+ the passed mutex.
+ Pass handle of the broadcast event, instead of a pointer to it
+ in Win32 ResetEvent( ) call.
+ Remove incorrect return values.
+ (_Jv_CondDestroy): Close both event handles and delete
+ critical section.
+ (_Jv_CondNotify): Check if really the owner thread.
+ (_Jv_CondNotifyAll): Check if really the owner thread.
+ (_Jv_InitThreads): Change daemon_cond to a manual-reset event.
+ (really_start): Use SetEvent( ) to signal daemon_cond.
+ (_Jv_ThreadWait): Remove SignalObjectAndWait( ) and use
+ WaitForSingleObject( ) instead to wait for daemon_cond to be
+ signalled.
+
+2003-01-28 Ranjit Mathew <rmathew@hotmail.com>
+
+ * configure.in: Specifically define HAVE_BACKTRACE if building
+ for MinGW.
+ * include/win32.h: Remove HAVE_BACKTRACE definition.
+ * gnu/gcj/runtime/natStackTrace.cc: Include platform.h.
+ * configure: Rebuilt.
+
+2003-01-27 Alexandre Oliva <aoliva@redhat.com>
+
+ * configure.in (toolexecdir, toolexecmainlibdir, toolexeclibdir):
+ Set and AC_SUBST. Remove USE_LIBDIR conditional.
+ * Makefile.am (toolexecdir, toolexeclibdir): Don't override.
+ (toolexecmainlib_DATA): Renamed from toolexeclib_DATA.
+ * Makefile.in, configure: Rebuilt.
+
+2003-01-24 Ranjit Mathew <rmathew@hotmail.com>
+
+ Fixes PR java/9253:
+ * java/io/natFileWin32.cc (performList): Append only "*.*"
+ if the canonical file path already has a "\" at the end.
+
+2003-01-24 Tom Tromey <tromey@redhat.com>
+
+ * java/lang/ClassLoader.java (findLoadedClass): Removed erroneous
+ comment.
+
+2003-01-22 Andrew Haley <aph@redhat.com>
+
+ * x86_64-signal.h: Add simple handler for x86_64 32-bit mode.
+ * configure.host (CHECKREFSPEC): Define for x86_64.
+
+2003-01-21 Tom Tromey <tromey@redhat.com>
+
+ * java/util/natResourceBundle.cc (getCallingClassLoader): Start
+ search at 2, not 3.
+
+2003-01-21 Vladimir Puskas <vpuskas@eunet.yu>
+
+ * java/io/natFileWin32.cc (isAbsolute): Check path length before
+ looking at any characters.
+ * java/io/natFilePosix.cc (_stat): Only compute `buf' if it will
+ be used.
+ (isAbsolute): Check path's length as well.
+
+2003-01-17 Mark Wielaard <mark@klomp.org>
+
+ * Makefile.am (core_java_source_files): Add VMObjectStreamClass.java.
+ (nat_source_files): Add natVMObjectStreamClass.cc.
+ * Makefile.in: Regenerated.
+ * gcj/javaprims.h (namespace java): Regenerated.
+ * java/io/ObjectStreamClass.java (getClassUID): Call
+ VMObjectStreamClass.hasClassInitializer().
+ (hasClassInitializer): Removed.
+ * java/io/VMObjectStreamClass.java: New class.
+ * java/io/natVMObjectStreamClass.cc: New file.
+ * java/lang/Class.h: Make java::io::VMObjectStreamClass friend class.
+
+2003-01-19 Michael Koch <konqueror@gmx.de>
+
+ * java/net/MulticastSocket.java
+ (setInterface): Reindented.
+
+2003-01-16 Mark Wielaard <mark@klomp.org>
+
+ * java/net/SocketImpl.java (toString): Don't explicitly call
+ toString() on possible null address.
+
+2003-01-15 Scott Gilbertson <scottg@mantatest.com>
+
+ * gnu/gcj/xlib/natGC.cc (fillPolygon): New method.
+ * gnu/gcj/xlib/GC.java (fillPolygon): Declare.
+ * gnu/awt/xlib/XGraphics.java (fillPolygon): Added translateX and
+ translateY arguments. Implement.
+ * gnu/awt/j2d/IntegerGraphicsState.java (fillPolygon): Pass
+ down translation arguments.
+ (drawPolyline, drawPolygon): Fix incorrect tests.
+ * gnu/awt/j2d/DirectRasterGraphics.java (fillPolygon): Added
+ translateX and translateY arguments.
+
+2003-01-15 Scott Gilbertson <scottg@mantatest.com>
+
+ * Makefile.in: Rebuilt.
+ * Makefile.am (xlib_includes): New macro.
+ (INCLUDES): Use it.
+
+2003-01-15 Scott Gilbertson <scottg@mantatest.com>
+
+ * gnu/awt/xlib/XToolkit.java (getColorModel): Implemented.
+ * gnu/awt/xlib/XGraphicsConfiguration.java (getPixel): Work with
+ 16-bit display mode.
+
+2003-01-15 Scott Gilbertson <scottg@mantatest.com>
+
+ * java/awt/CardLayout.java (show): Rewrote.
+ (gotoComponent): Removed `target' argument. Simplified code.
+ Don't pre-compute `choice' unless `what' is FIRST or LAST.
+ Changed all callers.
+ (NONE): Removed.
+
+2003-01-14 Michael Koch <konqueror@gmx.de>
+
+ * java/net/InetSocketAddress.java
+ (serialVersionUID): New member variable.
+ * java/net/NetPermission.java
+ (NetPermission): Dont implement java.io.Serialization directly.
+ * java/net/SocketAddress.java:
+ (serialVersionUID): Documentation added.
+
+2003-01-14 Michael Koch <konqueror@gmx.de>
+
+ * java/awt/Label.java
+ (Label): Implements javax.accessibility.Accessible;
+ * java/awt/List.java
+ (List): Implements javax.accessibility.Accessible;
+ * java/awt/ScrollPane.java
+ (ScrollPane): Implements javax.accessibility.Accessible;
+ * java/awt/Scrollbar.java
+ (Scrollbar): Implements javax.accessibility.Accessible;
+ * java/awt/TextComponent.java
+ (setCaretPosition): Throw exception, documentation added.
+ * java/awt/Toolkit.java:
+ Added some newlines in method documentations.
+ (createButton): Exception documentation added.
+ (createTextField): Exception documentation added.
+ (createLabel): Exception documentation added.
+ (createList): Exception documentation added.
+ (createCheckbox): Exception documentation added.
+ (createScrollbar): Exception documentation added.
+ (createScrollPane): Exception documentation added.
+ (createTextArea): Exception documentation added.
+ (createChoice): Exception documentation added.
+ (createFrame): Exception documentation added.
+ (createWindow): Exception documentation added.
+ (createDialog): Exception documentation added.
+ (createMenuBar): Exception documentation added.
+ (createMenu): Exception documentation added.
+ (createMenuItem): Exception documentation added.
+ (createFileDialog): Exception documentation added.
+ (createCheckboxMenuItem): Exception documentation added.
+ (loadSystemColors): Exception documentation added.
+ (setDynamicLayout): Exception documentation added.
+ (isDynamicLayoutSet): Exception documentation added.
+ (isDynamicLayoutActive): Exception documentation added.
+ (getScreenSize): Exception documentation added.
+ (getScreenResolution): Exception documentation added.
+ (getScreenInsets): Exception documentation added.
+ (getColorModel): Exception documentation added.
+ (getSystemClipboard): Exception documentation added.
+ (getSystemSelection): Exception documentation added.
+ (getMenuShortcutKeyMask): Exception documentation added.
+ (getSystemEventQueue): Exception documentation added.
+ * java/awt/Window.java:
+ Reindented some code.
+ (Window): Centralized implementation, documentation added.
+ (finalize): Documentation added.
+ (hide): Fixed typo in comment.
+ (getWindowListeners): Documentation added.
+ * java/awt/color/ColorSpace.java
+ (toRGB): Documentation added.
+ * java/awt/color/ICC_ColorSpace.java
+ (ICC_ColorSpace): Documentation added.
+ (toRGB): Throw exception, documentation added.
+ (fromRGB): Throw exception, documentation added.
+ (toCIEXYZ): Documentation added.
+ (fromCIEXYZ): Documentation added.
+ (getMinValue): Documentation added.
+ (getMaxValue): Documentation added.
+ * java/awt/geom/Dimension2D.java
+ (clone): Documentation added.
+ * java/awt/geom/GeneralPath.java
+ (clone): Documentation added.
+ * java/awt/geom/Line2D.java
+ (clone): Documentation added.
+ * java/awt/geom/QuadCurve2D.java
+ (clone): Documentation added.
+ * java/awt/image/ColorModel.java
+ (ColorModel): Throw exception, documentation added.
+ * java/awt/image/ImageFilter.java
+ (clone): Doesnt throw CloneNotSupportedException.
+
+2003-01-14 Andrew Haley <aph@redhat.com>
+
+ * java/lang/natRuntime.cc (_load): StackTrace access needs to be
+ in a try block.
+
+2003-01-10 Andrew Haley <aph@redhat.com>
+
+ * include/dwarf2-signal.h: Remove x86_64.
+ * configure.host (x86_64 DIVIDESPEC): Remove.
+ * include/x86_64-signal.h: New file.
+ * configure.in: Regenerate.
+
+2003-01-10 Michael Koch <konqueror@gmx.de>
+
+ * java/net/DatagramSocket.java
+ (ch): Description added.
+ (remotePort): Initialize with -1.
+ (connect): Doesnt throws SocketException.
+ * java/net/MulticastSocket.java
+ (setInterface): Merge with Classpath.
+ * java/net/ServerSocket.java
+ (closed): New member variable.
+ (bind): Check if socket is closed.
+ (close): Close an associated channel too, set new value to closed.
+ (isBound): Reindented.
+ (isClosed): Implemented.
+ * java/net/Socket.java
+ (closed): New member variable.
+ (bind): Check if socket is closed.
+ (connect): Check if socket is closed.
+ (close): Close an associated channel too, set new value to closed.
+ (isClosed): Implemented.
+
+2003-01-10 Michael Koch <konqueror@gmx.de>
+
+ * java/awt/DisplayMode.java
+ (equals): Fixed argument type and implementation.
+
+2003-01-07 Michael Koch <konqueror@gmx.de>
+
+ * java/net/DatagramSocket.java:
+ Added classpath license info.
+ (DatagramSocket): Merged description with classpath.
+ (close): Merged description with classpath.
+ (getChannel): Merged description with classpath.
+ (getInetAddress): Merged description with classpath.
+ (getPort): Merged description with classpath.
+ (getLocalAddress): Merged description with classpath.
+ (getLocalPort): Merged description with classpath.
+ (getSoTimeout): Merged description with classpath.
+ (setSoTimeout): Merged description with classpath.
+ (getSendBufferSize): Merged description with classpath.
+ (setSendBufferSize): Merged description with classpath.
+ (getReceiveBufferSize): Merged description with classpath.
+ (setReceiveBufferSize): Merged description with classpath.
+
+2003-01-07 Tom Tromey <tromey@redhat.com>
+
+ * include/posix.h (_Jv_platform_usleep): Wrap in ifdef
+ JV_HASH_SYNCHRONIZATION.
+ * include/win32.h (_Jv_platform_usleep): Wrap in ifdef
+ JV_HASH_SYNCHRONIZATION.
+
+2003-01-04 Tom Tromey <tromey@redhat.com>
+
+ * java/awt/List.java: Merged with Classpath.
+
+2003-01-03 Mark Wielaard <mark@klomp.org>
+
+ * java/io/FileDescriptor.java (position): New private field.
+ * java/io/natFileDescriptorPosix.cc (write): Up position.
+ (setLength): Use and set position.
+ (seek): Set position.
+ (getFilePointer): Return position.
+ (read): Up position.
+
+2003-01-03 Mark Wielaard <mark@klomp.org>
+
+ Merge with Classpath:
+ * java/io/ObjectStreamClass.java (lookup): Split method and call
+ lookupForClassObject().
+ (lookupForClassObject): New method.
+ (isProxyClass): New field.
+ (setClass): Set isProxyClass, add object to classLookupTable, set
+ superClass and calculateOffsets.
+ (ObjectStreamClass): Set isProxyClass. Only set uid when Serializable
+ and not a proxy class.
+ (setFields): Set accessible true for serialPersistentFields.
+ (getClassUID): Same for suid. And check if suid is of type long.
+ (hasClassInitializer): Don't throw NoSuchMethodError.
+
+2003-01-03 Jeff Sturm <jsturm@one-point.com>
+
+ * configure.host (sparc*-*): Enable bytecode interpreter.
+
+2003-01-03 Mark Wielaard <mark@klomp.org>
+
+ * java/io/FileInputStream.java (finalize): Don't explicitly
+ finalize FileDescriptor.
+
+2003-01-03 Dhek Bhun Kho <bhun@chello.nl>
+
+ * gnu/java/rmi/server/UnicastServerRef.java (unexportObject):
+ Don't throw RemoteException.
+ * java/rmi/server/UnicastRemoteObject.java (unexportObject): Don't
+ throw RemoteException.
+
+2003-01-03 Joerg Brunsmann <joerg_brunsmann@yahoo.de>
+
+ * gnu/gcj/protocol/http/Connection.java (proxyPort, proxyInUse,
+ proxyHost): New static fields.
+ (<clinit>): Initialize new fields.
+ (connect): Use proxy if necessary.
+ (usingProxy): Implement.
+
+2003-01-03 Eric Blake <ebb9@email.byu.edu>
+
+ * java/util/TreeMap.java (fabricateTree): Fix off-by-one error.
+ (TreeIterator.remove): Prefer IllegalStateException over
+ ConcurrentModificationException, to match Sun.
+
+2002-01-02 Anthony Green <green@redhat.com>
+
+ * boehm.cc (_Jv_MarkObj): Mark the protectionDomain of a class.
+
+2003-01-02 Mark Wielaard <mark@klomp.org>
+
+ * java/net/HttpURLConnection.java (HTTP_NOT_IMPLEMENTED): Must be
+ public.
+ (HTTP_USE_PROXY): Add field.
+ (getResponseVals): Only set responseCode when not yet explicitly
+ set by subclass.
+
+2003-01-02 Artur Biesiadowski <abies@pg.gda.pl>
+ Mark Wielaard <mark@klomp.org>
+
+ * java/util/zip/ZipFile.java (entries): Now HashMap.
+ (readLeShort(DataInput, byte[])): Read from given byte array.
+ (readLeInt(DataInput, byte[]): Likewise.
+ (readLeShort(byte[] b, int off)): New method.
+ (readLeInt(byte[] b, int off)): Likewise.
+ (readEntries): Use byte arrays to read info in bigger chunks.
+ (getEntries): Return HashMap.
+ (getEntry): Use HashMap.
+ (locBuf): New private field.
+ (checkLocalHeader): Use locBuf to read info in one chunk.
+ (getInputStream): Use entries HashMap, wrap PartialInputStream
+ in BufferedInputStream.
+ (ZipEntryEnumeration): Use HashMap and Interator.
+
+2003-01-02 Mark Wielaard <mark@klomp.org>
+ Jeroen Frijters <jeroen@sumatra.nl>
+
+ * java/net/URLClassLoader.java (Resource.getCodeSource):
+ Fix check certs == null.
+ (getCanonicalFileURL): Removed method.
+ (JarURLLoader): Don't call removed method.
+ (FileURLLoader): Likewise.
+ (FileURLLoader.getResource): Don't canonicalize file name.
+
+2003-01-01 Tom Tromey <tromey@redhat.com>
+
+ * Makefile.in: Rebuilt.
+ * Makefile.am (rmi_java_source_files): Added RMIClassLoaderSpi.
+ * java/awt/AlphaComposite.java, java/awt/BasicStroke.java,
+ java/awt/BufferCapabilities.java, java/awt/Button.java,
+ java/awt/CheckboxMenuItem.java, java/awt/Choice.java,
+ java/awt/Container.java, java/awt/Cursor.java,
+ java/awt/EventQueue.java, java/awt/FileDialog.java,
+ java/awt/Graphics2D.java, java/awt/Label.java, java/awt/Menu.java,
+ java/awt/MenuBar.java, java/awt/MenuComponent.java,
+ java/awt/PopupMenu.java, java/awt/ScrollPane.java,
+ java/awt/Scrollbar.java, java/awt/TextArea.java,
+ java/awt/TextField.java, java/awt/color/CMMException.java,
+ java/awt/color/ColorSpace.java, java/awt/color/ICC_Profile.java,
+ java/awt/color/ProfileDataException.java,
+ java/awt/datatransfer/Clipboard.java,
+ java/awt/datatransfer/DataFlavor.java,
+ java/awt/datatransfer/FlavorMap.java,
+ java/awt/datatransfer/SystemFlavorMap.java,
+ java/awt/dnd/DragGestureEvent.java,
+ java/awt/dnd/DragGestureRecognizer.java,
+ java/awt/dnd/DragSource.java, java/awt/dnd/DropTarget.java,
+ java/awt/event/WindowEvent.java, java/awt/geom/PathIterator.java,
+ java/awt/im/InputMethodHighlight.java,
+ java/io/PipedOutputStream.java, java/io/PipedWriter.java,
+ java/rmi/server/RMIClassLoader.java: Merged from Classpath.
+
+ * gnu/awt/j2d/Graphics2DImpl.java (drawImage): Changed type of
+ `op' to BufferedImageOp.
+
+2002-12-31 Tom Tromey <tromey@redhat.com>
+
+ Fix for PR libgcj/7416:
+ * javax/naming/InitialContext.java (init): Use
+ gnu.classpath.home.url.
+ * java/security/Security.java: Use new properties.
+ (loadProviders): Accept base url; use it.
+ * java/lang/System.java: Document gnu.classpath.vm.shortname, and
+ gnu.classpath.home.url.
+ (gnu.classpath.home.url): Define.
+ (gnu.classpath.vm.shortname): Likewise.
+
+2002-12-31 Tom Tromey <tromey@redhat.com>
+ Ranjit Mathew <rmathew@hotmail.com>
+
+ Fix for PR libgcj/8997:
+ * java/lang/natObject.cc (spin): Use _Jv_platform_usleep.
+ Include platform.h.
+ * include/posix.h (_Jv_platform_usleep): New function.
+ * include/win32.h (_Jv_platform_usleep): New function.
+
+2002-12-30 Tom Tromey <tromey@redhat.com>
+
+ * gcj/javaprims.h: Updated class list.
+
+2002-12-30 Mark Wielaard <mark@klomp.org>
+
+ * java/net/URLStreamHandler.java (toExternalForm): Ignore port
+ if zero or smaller.
+
+2002-12-30 Mark Wielaard <mark@klomp.org>
+
+ * java/util/Properties (formatForOutput): Don't fall through to
+ default case after escaping character.
+
+2002-11-30 Mark Wielaard <mark@klomp.org>
+
+ * java/lang/StringBuffer.java (getChars): Remove wrong dstOffset check
+ against count.
+
+2002-11-21 Anthony Green <green@redhat.com>
+
+ * Makefile.am: Move org.xml.sax and org.w3c.dom into their own
+ libraries.
+ * Makefile.in: Rebuilt.
+
+2002-12-19 Anthony Green <green@redhat.com>
+
+ * Makefile.am (ordinary_java_source_files): Add
+ org/xml/sax/helpers/NewInstance.java.
+ * Makefile.in: Rebuilt.
+ * org/xml/sax/package.html, org/xml/sax/ext/package.html,
+ org/xml/sax/helpers/package.html: New files.
+ * org/xml/sax/*: Upgrade to SAX 2.0.1 release from
+ http://www.saxproject.org.
+
+2002-12-19 Andrew Haley <aph@redhat.com>
+
+ * java/util/natResourceBundle.cc: Include
+ ArrayIndexOutOfBoundsException.h.
+ (getCallingClassLoader): Don't put upper bound on stack search.
+ Catch ArrayIndexOutOfBoundsException.
+
+2002-12-19 Tom Tromey <tromey@redhat.com>
+
+ * libtool-version: Increased `current'.
+
+2002-12-19 Tom Tromey <tromey@redhat.com>
+
+ * java/lang/natClassLoader.cc (defineClass0): Removed erroneous
+ comment.
+ * java/lang/ClassLoader.java (defineClass): Use chained
+ exception when rethrowing.
+ * defineclass.cc (handleClassBegin): Mark class as interpreted.
+ * java/lang/reflect/Modifier.java (INVISIBLE, INTERPRETED): New
+ constants.
+ * resolve.cc (_Jv_PrepareMissingMethods): New function.
+ (_Jv_PrepareClass): Use it.
+ * include/java-interp.h (_Jv_IsInterpretedClass): Rewrote.
+ (_Jv_InterpClass): _Jv_PrepareMissingMethods now friend.
+ * java/lang/Class.h (Class::getModifiers): Mask with ALL_FLAGS.
+ (Class): _Jv_PrepareMissingMethods now friend.
+ * java/lang/natClassLoader.cc (defineClass0): Use JvSynchronize.
+ Record `NULL' for system class loader.
+ (_Jv_RegisterInitiatingLoader): Use JvSynchronize. Special case
+ system class loader.
+ (_Jv_FindClassInCache): Likewise.
+ (_Jv_UnregisterClass): Use JvSynchronize. Free old loader info.
+ (_Jv_FindClass): Special case system class loader.
+ * java/lang/natClass.cc (_Jv_abstractMethodError): New function.
+ (_Jv_SetVTableEntries): Put _Jv_abstractMethodError into empty
+ vtable slots.
+ (_Jv_LayoutVTableMethods): Don't generate vtable slot for a method
+ in a final class.
+ (_getDeclaredMethod): Don't return synthetic methods.
+ (getDeclaredMethods): Likewise.
+ (_getMethod): Likewise.
+ (_getMethods): Likewise.
+
+2002-12-18 Raif Naffah <raif@fl.net.au>
+
+ * java/math/BigInteger.java (euclidInv): Make sure quot and rem are in
+ canonical form after divide().
+ (modInverse): Likewise.
+
2002-12-13 Casey Marshall <rsdio@metastatic.org>
Mark Wielaard <mark@klomp.org>
diff --git a/libjava/Makefile.am b/libjava/Makefile.am
index 0db820f360f..b21365ffb87 100644
--- a/libjava/Makefile.am
+++ b/libjava/Makefile.am
@@ -14,23 +14,17 @@ endif
## What gets installed, and where.
##
-## Install a library built with a cross compiler in tooldir, not
-## libdir.
-if USE_LIBDIR
-toolexeclibdir = $(libdir)$(MULTISUBDIR)
-else
-toolexecdir = $(exec_prefix)/$(target_alias)
-toolexeclibdir = $(toolexecdir)/lib$(MULTISUBDIR)
-endif
-
if XLIB_AWT
-cond_x_ltlibrary = libgcjx.la
+cond_x_ltlibrary = lib-gnu-awt-xlib.la
+## We require libstdc++-v3 to be in the same build tree.
+xlib_includes = -I../libstdc++-v3/include -I../libstdc++-v3/include/$(target_alias) -I$(srcdir)/../libstdc++-v3/libsupc++
else
cond_x_ltlibrary =
+xlib_includes =
endif
-toolexeclib_LTLIBRARIES = libgcj.la $(cond_x_ltlibrary)
-toolexeclib_DATA = libgcj.spec
+toolexeclib_LTLIBRARIES = libgcj.la lib-org-xml-sax.la lib-org-w3c-dom.la $(cond_x_ltlibrary)
+toolexecmainlib_DATA = libgcj.spec
jardir = $(datadir)/java
jar_DATA = libgcj-@gcc_version@.jar
@@ -107,10 +101,9 @@ JC1FLAGS = @LIBGCJ_JAVAFLAGS@ $(GCJFLAGS)
LIBFFIINCS = @LIBFFIINCS@
INCLUDES = -I$(top_srcdir) -Iinclude -I$(top_srcdir)/include \
- $(GCINCS) $(THREADINCS) $(INCLTDL) \
+ $(GCINCS) $(THREADINCS) $(INCLTDL) $(xlib_includes) \
$(GCC_UNWIND_INCLUDE) $(ZINCS) $(LIBFFIINCS)
-
## ################################################################
##
@@ -147,27 +140,79 @@ libgcj_la_LDFLAGS = -rpath $(toolexeclibdir) $(THREADLDFLAGS) $(THREADLIBS) \
-version-info `grep -v '^\#' $(srcdir)/libtool-version`
libgcj_la_LINK = $(LIBLINK)
-libgcjx_la_SOURCES = $(x_nat_source_files)
-EXTRA_libgcjx_la_SOURCES = $(x_java_source_files)
-libgcjx_la_DEPENDENCIES = libgcj-@gcc_version@.jar $(x_javao_files)
-libgcjx_la_LIBADD = $(x_javao_files)
-libgcjx_la_LDFLAGS = @X_PRE_LIBS@ @X_LIBS@ -lX11 @X_EXTRA_LIBS@ \
+lib_org_w3c_dom_la_SOURCES = org/w3c/dom/Attr.java \
+org/w3c/dom/CDATASection.java \
+org/w3c/dom/CharacterData.java \
+org/w3c/dom/Comment.java \
+org/w3c/dom/DOMException.java \
+org/w3c/dom/DOMImplementation.java \
+org/w3c/dom/Document.java \
+org/w3c/dom/DocumentFragment.java \
+org/w3c/dom/DocumentType.java \
+org/w3c/dom/Element.java \
+org/w3c/dom/Entity.java \
+org/w3c/dom/EntityReference.java \
+org/w3c/dom/NamedNodeMap.java \
+org/w3c/dom/Node.java \
+org/w3c/dom/NodeList.java \
+org/w3c/dom/Notation.java \
+org/w3c/dom/ProcessingInstruction.java \
+org/w3c/dom/Text.java \
+org/w3c/dom/ranges/DocumentRange.java \
+org/w3c/dom/ranges/Range.java \
+org/w3c/dom/ranges/RangeException.java \
+org/w3c/dom/traversal/DocumentTraversal.java \
+org/w3c/dom/traversal/NodeFilter.java \
+org/w3c/dom/traversal/NodeIterator.java \
+org/w3c/dom/traversal/TreeWalker.java
+
+lib_org_xml_sax_la_SOURCES = org/xml/sax/ext/DeclHandler.java \
+org/xml/sax/ext/LexicalHandler.java \
+org/xml/sax/helpers/AttributeListImpl.java \
+org/xml/sax/helpers/AttributesImpl.java \
+org/xml/sax/helpers/DefaultHandler.java \
+org/xml/sax/helpers/LocatorImpl.java \
+org/xml/sax/helpers/NamespaceSupport.java \
+org/xml/sax/helpers/NewInstance.java \
+org/xml/sax/helpers/ParserAdapter.java \
+org/xml/sax/helpers/ParserFactory.java \
+org/xml/sax/helpers/XMLFilterImpl.java \
+org/xml/sax/helpers/XMLReaderAdapter.java \
+org/xml/sax/helpers/XMLReaderFactory.java \
+org/xml/sax/AttributeList.java \
+org/xml/sax/Attributes.java \
+org/xml/sax/ContentHandler.java \
+org/xml/sax/DTDHandler.java \
+org/xml/sax/DocumentHandler.java \
+org/xml/sax/EntityResolver.java \
+org/xml/sax/ErrorHandler.java \
+org/xml/sax/HandlerBase.java \
+org/xml/sax/InputSource.java \
+org/xml/sax/Locator.java \
+org/xml/sax/Parser.java \
+org/xml/sax/SAXException.java \
+org/xml/sax/SAXNotRecognizedException.java \
+org/xml/sax/SAXNotSupportedException.java \
+org/xml/sax/SAXParseException.java \
+org/xml/sax/XMLFilter.java \
+org/xml/sax/XMLReader.java
+
+lib_gnu_awt_xlib_la_SOURCES = $(x_nat_source_files)
+EXTRA_lib_gnu_awt_xlib_la_SOURCES = $(x_java_source_files)
+lib_gnu_awt_xlib_la_DEPENDENCIES = libgcj-@gcc_version@.jar $(x_javao_files)
+lib_gnu_awt_xlib_la_LIBADD = $(x_javao_files)
+lib_gnu_awt_xlib_la_LDFLAGS = ../libstdc++-v3/src/libstdc++.la \
+ @X_PRE_LIBS@ @X_LIBS@ -lX11 @X_EXTRA_LIBS@ \
-rpath $(toolexeclibdir) \
## The mysterious backslash is consumed by make.
-version-info `grep -v '^\#' $(srcdir)/libtool-version`
-libgcjx_la_LINK = $(LIBLINK)
-
-## Make a symlink for each `libgcjx' file that was installed.
-install-exec-hook:
- cd $(DESTDIR)$(libdir) && \
- if test -f libgcjx.la; then \
- rm -f gnu-awt-xlib.la; \
- $(LN_S) libgcjx.la gnu-awt-xlib.la; \
- fi
+lib_gnu_awt_xlib_la_LINK = $(LIBLINK)
all_java_source_files = \
$(java_source_files) \
$(built_java_source_files) \
+ $(lib_org_xml_sax_la_SOURCES) \
+ $(lib_org_w3c_dom_la_SOURCES) \
$(x_java_source_files)
all_java_class_files = $(all_java_source_files:.java=.class)
@@ -218,7 +263,7 @@ $(c_files): %.lo: %.c
$(c_files): java/lang/fdlibm.h java/lang/ieeefp.h java/lang/mprec.h
## FIXME: GNU make.
-$(javao_files) $(x_javao_files): %.lo: %.java
+$(javao_files) $(x_javao_files) $(lib_org_w3c_dom_la_OBJECTS) $(lib_org_xml_sax_la_OBJECTS): %.lo: %.java
$(GCJCOMPILE) -o $@ $<
## Pass the list of object files to libtool in a temporary file to
@@ -229,10 +274,10 @@ libgcj.la: $(libgcj_la_OBJECTS) $(libgcj_la_DEPENDENCIES)
@GCLIBS@ @LIBFFI@ @ZLIBS@ \
-rpath $(toolexeclibdir) $(libgcj_la_LDFLAGS) $(LIBS)
-libgcjx.la: $(libgcjx_la_OBJECTS) $(libgcjx_la_DEPENDENCIES)
- @: $(shell echo Creating list of files to link...) $(shell rm -f libgcjx.objectlist || :) $(shell touch libgcjx.objectlist) $(foreach object,$(libgcjx_la_OBJECTS) $(libgcjx_la_LIBADD),$(shell echo $(object) >> libgcjx.objectlist))
- $(libgcjx_la_LINK) -objectlist libgcjx.objectlist \
- -rpath $(toolexeclibdir) $(libgcjx_la_LDFLAGS) $(LIBS)
+lib-gnu-awt-xlib.la: $(lib_gnu_awt_xlib_la_OBJECTS) $(lib_gnu_awt_xlib_la_DEPENDENCIES)
+ @: $(shell echo Creating list of files to link...) $(shell rm -f lib_gnu_awt_xlib.objectlist || :) $(shell touch lib_gnu_awt_xlib.objectlist) $(foreach object,$(lib_gnu_awt_xlib_la_OBJECTS) $(lib_gnu_awt_xlib_la_LIBADD),$(shell echo $(object) >> lib_gnu_awt_xlib.objectlist))
+ $(lib_gnu_awt_xlib_la_LINK) -objectlist lib_gnu_awt_xlib.objectlist \
+ -rpath $(toolexeclibdir) $(lib_gnu_awt_xlib_la_LDFLAGS) $(LIBS)
## ################################################################
@@ -1277,6 +1322,7 @@ java/rmi/server/LogStream.java \
java/rmi/server/ObjID.java \
java/rmi/server/Operation.java \
java/rmi/server/RMIClassLoader.java \
+java/rmi/server/RMIClassLoaderSpi.java \
java/rmi/server/RMIClientSocketFactory.java \
java/rmi/server/RMIFailureHandler.java \
java/rmi/server/RMIServerSocketFactory.java \
@@ -1630,6 +1676,7 @@ java/io/StringWriter.java \
java/io/SyncFailedException.java \
java/io/UTFDataFormatException.java \
java/io/UnsupportedEncodingException.java \
+java/io/VMObjectStreamClass.java \
java/io/WriteAbortedException.java \
java/io/Writer.java \
java/util/AbstractCollection.java \
@@ -1873,6 +1920,13 @@ 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/ByteBufferImpl.java \
+gnu/java/nio/CharBufferImpl.java \
+gnu/java/nio/DoubleBufferImpl.java \
+gnu/java/nio/FloatBufferImpl.java \
+gnu/java/nio/IntBufferImpl.java \
+gnu/java/nio/LongBufferImpl.java \
+gnu/java/nio/ShortBufferImpl.java \
gnu/java/nio/charset/ISO_8859_1.java \
gnu/java/nio/charset/Provider.java \
gnu/java/nio/charset/US_ASCII.java \
@@ -1975,14 +2029,20 @@ java/nio/BufferUnderflowException.java \
java/nio/ByteBuffer.java \
java/nio/ByteOrder.java \
java/nio/CharBuffer.java \
+java/nio/DoubleBuffer.java \
+java/nio/FloatBuffer.java \
+java/nio/IntBuffer.java \
java/nio/InvalidMarkException.java \
+java/nio/LongBuffer.java \
java/nio/MappedByteBuffer.java \
java/nio/ReadOnlyBufferException.java \
+java/nio/ShortBuffer.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/Channels.java \
java/nio/channels/ClosedByInterruptException.java \
java/nio/channels/ClosedChannelException.java \
java/nio/channels/ClosedSelectorException.java \
@@ -2220,60 +2280,6 @@ java/util/zip/ZipException.java \
java/util/zip/ZipFile.java \
java/util/zip/ZipInputStream.java \
java/util/zip/ZipOutputStream.java \
-org/w3c/dom/Attr.java \
-org/w3c/dom/CDATASection.java \
-org/w3c/dom/CharacterData.java \
-org/w3c/dom/Comment.java \
-org/w3c/dom/DOMException.java \
-org/w3c/dom/DOMImplementation.java \
-org/w3c/dom/Document.java \
-org/w3c/dom/DocumentFragment.java \
-org/w3c/dom/DocumentType.java \
-org/w3c/dom/Element.java \
-org/w3c/dom/Entity.java \
-org/w3c/dom/EntityReference.java \
-org/w3c/dom/NamedNodeMap.java \
-org/w3c/dom/Node.java \
-org/w3c/dom/NodeList.java \
-org/w3c/dom/Notation.java \
-org/w3c/dom/ProcessingInstruction.java \
-org/w3c/dom/Text.java \
-org/w3c/dom/ranges/DocumentRange.java \
-org/w3c/dom/ranges/Range.java \
-org/w3c/dom/ranges/RangeException.java \
-org/w3c/dom/traversal/DocumentTraversal.java \
-org/w3c/dom/traversal/NodeFilter.java \
-org/w3c/dom/traversal/NodeIterator.java \
-org/w3c/dom/traversal/TreeWalker.java \
-org/xml/sax/ext/DeclHandler.java \
-org/xml/sax/ext/LexicalHandler.java \
-org/xml/sax/helpers/AttributeListImpl.java \
-org/xml/sax/helpers/AttributesImpl.java \
-org/xml/sax/helpers/DefaultHandler.java \
-org/xml/sax/helpers/LocatorImpl.java \
-org/xml/sax/helpers/NamespaceSupport.java \
-org/xml/sax/helpers/ParserAdapter.java \
-org/xml/sax/helpers/ParserFactory.java \
-org/xml/sax/helpers/XMLFilterImpl.java \
-org/xml/sax/helpers/XMLReaderAdapter.java \
-org/xml/sax/helpers/XMLReaderFactory.java \
-org/xml/sax/AttributeList.java \
-org/xml/sax/Attributes.java \
-org/xml/sax/ContentHandler.java \
-org/xml/sax/DTDHandler.java \
-org/xml/sax/DocumentHandler.java \
-org/xml/sax/EntityResolver.java \
-org/xml/sax/ErrorHandler.java \
-org/xml/sax/HandlerBase.java \
-org/xml/sax/InputSource.java \
-org/xml/sax/Locator.java \
-org/xml/sax/Parser.java \
-org/xml/sax/SAXException.java \
-org/xml/sax/SAXNotRecognizedException.java \
-org/xml/sax/SAXNotSupportedException.java \
-org/xml/sax/SAXParseException.java \
-org/xml/sax/XMLFilter.java \
-org/xml/sax/XMLReader.java \
$(rmi_java_source_files) \
$(awt_java_source_files) \
$(convert_source_files) \
@@ -2321,10 +2327,18 @@ gnu/gcj/runtime/natSharedLibLoader.cc \
gnu/gcj/runtime/natStackTrace.cc \
gnu/gcj/runtime/natStringBuffer.cc \
gnu/gcj/runtime/natVMClassLoader.cc \
+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/natShortBufferImpl.cc \
java/io/natFile.cc \
java/io/natFileDescriptor.cc \
java/io/natObjectInputStream.cc \
java/io/natObjectOutputStream.cc \
+java/io/natVMObjectStreamClass.cc \
java/lang/natCharacter.cc \
java/lang/natClass.cc \
java/lang/natClassLoader.cc \
diff --git a/libjava/Makefile.in b/libjava/Makefile.in
index c8d722f0521..4e341a28a33 100644
--- a/libjava/Makefile.in
+++ b/libjava/Makefile.in
@@ -65,6 +65,7 @@ target_alias = @target_alias@
target_triplet = @target@
AR = @AR@
AS = @AS@
+BACKTRACESPEC = @BACKTRACESPEC@
CC = @CC@
CHECKREFSPEC = @CHECKREFSPEC@
COMPPATH = @COMPPATH@
@@ -127,18 +128,20 @@ here = @here@
libgcj_basedir = @libgcj_basedir@
mkinstalldirs = @mkinstalldirs@
tool_include_dir = @tool_include_dir@
+toolexecdir = @toolexecdir@
+toolexeclibdir = @toolexeclibdir@
+toolexecmainlibdir = @toolexecmainlibdir@
AUTOMAKE_OPTIONS = foreign
@TESTSUBDIR_TRUE@SUBDIRS = @TESTSUBDIR_TRUE@$(DIRLTDL) testsuite gcj include
@TESTSUBDIR_FALSE@SUBDIRS = @TESTSUBDIR_FALSE@$(DIRLTDL) gcj include
-@USE_LIBDIR_TRUE@toolexeclibdir = @USE_LIBDIR_TRUE@$(libdir)$(MULTISUBDIR)
-@USE_LIBDIR_FALSE@toolexeclibdir = @USE_LIBDIR_FALSE@$(toolexecdir)/lib$(MULTISUBDIR)
-@USE_LIBDIR_FALSE@toolexecdir = @USE_LIBDIR_FALSE@$(exec_prefix)/$(target_alias)
-@XLIB_AWT_TRUE@cond_x_ltlibrary = @XLIB_AWT_TRUE@libgcjx.la
+@XLIB_AWT_TRUE@cond_x_ltlibrary = @XLIB_AWT_TRUE@lib-gnu-awt-xlib.la
@XLIB_AWT_FALSE@cond_x_ltlibrary =
+@XLIB_AWT_TRUE@xlib_includes = @XLIB_AWT_TRUE@-I../libstdc++-v3/include -I../libstdc++-v3/include/$(target_alias) -I$(srcdir)/../libstdc++-v3/libsupc++
+@XLIB_AWT_FALSE@xlib_includes =
-toolexeclib_LTLIBRARIES = libgcj.la $(cond_x_ltlibrary)
-toolexeclib_DATA = libgcj.spec
+toolexeclib_LTLIBRARIES = libgcj.la lib-org-xml-sax.la lib-org-w3c-dom.la $(cond_x_ltlibrary)
+toolexecmainlib_DATA = libgcj.spec
jardir = $(datadir)/java
jar_DATA = libgcj-@gcc_version@.jar
@@ -182,7 +185,7 @@ JC1FLAGS = @LIBGCJ_JAVAFLAGS@ $(GCJFLAGS)
LIBFFIINCS = @LIBFFIINCS@
INCLUDES = -I$(top_srcdir) -Iinclude -I$(top_srcdir)/include \
- $(GCINCS) $(THREADINCS) $(INCLTDL) \
+ $(GCINCS) $(THREADINCS) $(INCLTDL) $(xlib_includes) \
$(GCC_UNWIND_INCLUDE) $(ZINCS) $(LIBFFIINCS)
@@ -218,19 +221,81 @@ libgcj_la_LDFLAGS = -rpath $(toolexeclibdir) $(THREADLDFLAGS) $(THREADLIBS) \
libgcj_la_LINK = $(LIBLINK)
-libgcjx_la_SOURCES = $(x_nat_source_files)
-EXTRA_libgcjx_la_SOURCES = $(x_java_source_files)
-libgcjx_la_DEPENDENCIES = libgcj-@gcc_version@.jar $(x_javao_files)
-libgcjx_la_LIBADD = $(x_javao_files)
-libgcjx_la_LDFLAGS = @X_PRE_LIBS@ @X_LIBS@ -lX11 @X_EXTRA_LIBS@ \
+lib_org_w3c_dom_la_SOURCES = org/w3c/dom/Attr.java \
+org/w3c/dom/CDATASection.java \
+org/w3c/dom/CharacterData.java \
+org/w3c/dom/Comment.java \
+org/w3c/dom/DOMException.java \
+org/w3c/dom/DOMImplementation.java \
+org/w3c/dom/Document.java \
+org/w3c/dom/DocumentFragment.java \
+org/w3c/dom/DocumentType.java \
+org/w3c/dom/Element.java \
+org/w3c/dom/Entity.java \
+org/w3c/dom/EntityReference.java \
+org/w3c/dom/NamedNodeMap.java \
+org/w3c/dom/Node.java \
+org/w3c/dom/NodeList.java \
+org/w3c/dom/Notation.java \
+org/w3c/dom/ProcessingInstruction.java \
+org/w3c/dom/Text.java \
+org/w3c/dom/ranges/DocumentRange.java \
+org/w3c/dom/ranges/Range.java \
+org/w3c/dom/ranges/RangeException.java \
+org/w3c/dom/traversal/DocumentTraversal.java \
+org/w3c/dom/traversal/NodeFilter.java \
+org/w3c/dom/traversal/NodeIterator.java \
+org/w3c/dom/traversal/TreeWalker.java
+
+
+lib_org_xml_sax_la_SOURCES = org/xml/sax/ext/DeclHandler.java \
+org/xml/sax/ext/LexicalHandler.java \
+org/xml/sax/helpers/AttributeListImpl.java \
+org/xml/sax/helpers/AttributesImpl.java \
+org/xml/sax/helpers/DefaultHandler.java \
+org/xml/sax/helpers/LocatorImpl.java \
+org/xml/sax/helpers/NamespaceSupport.java \
+org/xml/sax/helpers/NewInstance.java \
+org/xml/sax/helpers/ParserAdapter.java \
+org/xml/sax/helpers/ParserFactory.java \
+org/xml/sax/helpers/XMLFilterImpl.java \
+org/xml/sax/helpers/XMLReaderAdapter.java \
+org/xml/sax/helpers/XMLReaderFactory.java \
+org/xml/sax/AttributeList.java \
+org/xml/sax/Attributes.java \
+org/xml/sax/ContentHandler.java \
+org/xml/sax/DTDHandler.java \
+org/xml/sax/DocumentHandler.java \
+org/xml/sax/EntityResolver.java \
+org/xml/sax/ErrorHandler.java \
+org/xml/sax/HandlerBase.java \
+org/xml/sax/InputSource.java \
+org/xml/sax/Locator.java \
+org/xml/sax/Parser.java \
+org/xml/sax/SAXException.java \
+org/xml/sax/SAXNotRecognizedException.java \
+org/xml/sax/SAXNotSupportedException.java \
+org/xml/sax/SAXParseException.java \
+org/xml/sax/XMLFilter.java \
+org/xml/sax/XMLReader.java
+
+
+lib_gnu_awt_xlib_la_SOURCES = $(x_nat_source_files)
+EXTRA_lib_gnu_awt_xlib_la_SOURCES = $(x_java_source_files)
+lib_gnu_awt_xlib_la_DEPENDENCIES = libgcj-@gcc_version@.jar $(x_javao_files)
+lib_gnu_awt_xlib_la_LIBADD = $(x_javao_files)
+lib_gnu_awt_xlib_la_LDFLAGS = ../libstdc++-v3/src/libstdc++.la \
+ @X_PRE_LIBS@ @X_LIBS@ -lX11 @X_EXTRA_LIBS@ \
-rpath $(toolexeclibdir) \
-version-info `grep -v '^\#' $(srcdir)/libtool-version`
-libgcjx_la_LINK = $(LIBLINK)
+lib_gnu_awt_xlib_la_LINK = $(LIBLINK)
all_java_source_files = \
$(java_source_files) \
$(built_java_source_files) \
+ $(lib_org_xml_sax_la_SOURCES) \
+ $(lib_org_w3c_dom_la_SOURCES) \
$(x_java_source_files)
@@ -1035,6 +1100,7 @@ java/rmi/server/LogStream.java \
java/rmi/server/ObjID.java \
java/rmi/server/Operation.java \
java/rmi/server/RMIClassLoader.java \
+java/rmi/server/RMIClassLoaderSpi.java \
java/rmi/server/RMIClientSocketFactory.java \
java/rmi/server/RMIFailureHandler.java \
java/rmi/server/RMIServerSocketFactory.java \
@@ -1385,6 +1451,7 @@ java/io/StringWriter.java \
java/io/SyncFailedException.java \
java/io/UTFDataFormatException.java \
java/io/UnsupportedEncodingException.java \
+java/io/VMObjectStreamClass.java \
java/io/WriteAbortedException.java \
java/io/Writer.java \
java/util/AbstractCollection.java \
@@ -1623,6 +1690,13 @@ 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/ByteBufferImpl.java \
+gnu/java/nio/CharBufferImpl.java \
+gnu/java/nio/DoubleBufferImpl.java \
+gnu/java/nio/FloatBufferImpl.java \
+gnu/java/nio/IntBufferImpl.java \
+gnu/java/nio/LongBufferImpl.java \
+gnu/java/nio/ShortBufferImpl.java \
gnu/java/nio/charset/ISO_8859_1.java \
gnu/java/nio/charset/Provider.java \
gnu/java/nio/charset/US_ASCII.java \
@@ -1725,14 +1799,20 @@ java/nio/BufferUnderflowException.java \
java/nio/ByteBuffer.java \
java/nio/ByteOrder.java \
java/nio/CharBuffer.java \
+java/nio/DoubleBuffer.java \
+java/nio/FloatBuffer.java \
+java/nio/IntBuffer.java \
java/nio/InvalidMarkException.java \
+java/nio/LongBuffer.java \
java/nio/MappedByteBuffer.java \
java/nio/ReadOnlyBufferException.java \
+java/nio/ShortBuffer.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/Channels.java \
java/nio/channels/ClosedByInterruptException.java \
java/nio/channels/ClosedChannelException.java \
java/nio/channels/ClosedSelectorException.java \
@@ -1970,60 +2050,6 @@ java/util/zip/ZipException.java \
java/util/zip/ZipFile.java \
java/util/zip/ZipInputStream.java \
java/util/zip/ZipOutputStream.java \
-org/w3c/dom/Attr.java \
-org/w3c/dom/CDATASection.java \
-org/w3c/dom/CharacterData.java \
-org/w3c/dom/Comment.java \
-org/w3c/dom/DOMException.java \
-org/w3c/dom/DOMImplementation.java \
-org/w3c/dom/Document.java \
-org/w3c/dom/DocumentFragment.java \
-org/w3c/dom/DocumentType.java \
-org/w3c/dom/Element.java \
-org/w3c/dom/Entity.java \
-org/w3c/dom/EntityReference.java \
-org/w3c/dom/NamedNodeMap.java \
-org/w3c/dom/Node.java \
-org/w3c/dom/NodeList.java \
-org/w3c/dom/Notation.java \
-org/w3c/dom/ProcessingInstruction.java \
-org/w3c/dom/Text.java \
-org/w3c/dom/ranges/DocumentRange.java \
-org/w3c/dom/ranges/Range.java \
-org/w3c/dom/ranges/RangeException.java \
-org/w3c/dom/traversal/DocumentTraversal.java \
-org/w3c/dom/traversal/NodeFilter.java \
-org/w3c/dom/traversal/NodeIterator.java \
-org/w3c/dom/traversal/TreeWalker.java \
-org/xml/sax/ext/DeclHandler.java \
-org/xml/sax/ext/LexicalHandler.java \
-org/xml/sax/helpers/AttributeListImpl.java \
-org/xml/sax/helpers/AttributesImpl.java \
-org/xml/sax/helpers/DefaultHandler.java \
-org/xml/sax/helpers/LocatorImpl.java \
-org/xml/sax/helpers/NamespaceSupport.java \
-org/xml/sax/helpers/ParserAdapter.java \
-org/xml/sax/helpers/ParserFactory.java \
-org/xml/sax/helpers/XMLFilterImpl.java \
-org/xml/sax/helpers/XMLReaderAdapter.java \
-org/xml/sax/helpers/XMLReaderFactory.java \
-org/xml/sax/AttributeList.java \
-org/xml/sax/Attributes.java \
-org/xml/sax/ContentHandler.java \
-org/xml/sax/DTDHandler.java \
-org/xml/sax/DocumentHandler.java \
-org/xml/sax/EntityResolver.java \
-org/xml/sax/ErrorHandler.java \
-org/xml/sax/HandlerBase.java \
-org/xml/sax/InputSource.java \
-org/xml/sax/Locator.java \
-org/xml/sax/Parser.java \
-org/xml/sax/SAXException.java \
-org/xml/sax/SAXNotRecognizedException.java \
-org/xml/sax/SAXNotSupportedException.java \
-org/xml/sax/SAXParseException.java \
-org/xml/sax/XMLFilter.java \
-org/xml/sax/XMLReader.java \
$(rmi_java_source_files) \
$(awt_java_source_files) \
$(convert_source_files) \
@@ -2070,10 +2096,18 @@ gnu/gcj/runtime/natSharedLibLoader.cc \
gnu/gcj/runtime/natStackTrace.cc \
gnu/gcj/runtime/natStringBuffer.cc \
gnu/gcj/runtime/natVMClassLoader.cc \
+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/natShortBufferImpl.cc \
java/io/natFile.cc \
java/io/natFileDescriptor.cc \
java/io/natObjectInputStream.cc \
java/io/natObjectOutputStream.cc \
+java/io/natVMObjectStreamClass.cc \
java/lang/natCharacter.cc \
java/lang/natClass.cc \
java/lang/natClassLoader.cc \
@@ -2240,9 +2274,13 @@ gnu/gcj/io/shs.lo gnu/gcj/protocol/core/natCoreInputStream.lo \
gnu/gcj/runtime/natFinalizerThread.lo gnu/gcj/runtime/natFirstThread.lo \
gnu/gcj/runtime/natNameFinder.lo gnu/gcj/runtime/natSharedLibLoader.lo \
gnu/gcj/runtime/natStackTrace.lo gnu/gcj/runtime/natStringBuffer.lo \
-gnu/gcj/runtime/natVMClassLoader.lo java/io/natFile.lo \
-java/io/natFileDescriptor.lo java/io/natObjectInputStream.lo \
-java/io/natObjectOutputStream.lo java/lang/natCharacter.lo \
+gnu/gcj/runtime/natVMClassLoader.lo gnu/java/nio/natByteBufferImpl.lo \
+gnu/java/nio/natCharBufferImpl.lo gnu/java/nio/natDoubleBufferImpl.lo \
+gnu/java/nio/natFloatBufferImpl.lo gnu/java/nio/natIntBufferImpl.lo \
+gnu/java/nio/natLongBufferImpl.lo gnu/java/nio/natShortBufferImpl.lo \
+java/io/natFile.lo java/io/natFileDescriptor.lo \
+java/io/natObjectInputStream.lo java/io/natObjectOutputStream.lo \
+java/io/natVMObjectStreamClass.lo java/lang/natCharacter.lo \
java/lang/natClass.lo java/lang/natClassLoader.lo \
java/lang/natConcreteProcess.lo java/lang/natDouble.lo \
java/lang/natFloat.lo java/lang/natMath.lo java/lang/natObject.lo \
@@ -2257,7 +2295,47 @@ java/net/natPlainDatagramSocketImpl.lo java/net/natPlainSocketImpl.lo \
java/text/natCollator.lo java/util/natResourceBundle.lo \
java/util/natTimeZone.lo java/util/zip/natDeflater.lo \
java/util/zip/natInflater.lo
-libgcjx_la_OBJECTS = gnu/gcj/xlib/natClip.lo \
+lib_org_xml_sax_la_LDFLAGS =
+lib_org_xml_sax_la_LIBADD =
+lib_org_xml_sax_la_OBJECTS = org/xml/sax/ext/DeclHandler.lo \
+org/xml/sax/ext/LexicalHandler.lo \
+org/xml/sax/helpers/AttributeListImpl.lo \
+org/xml/sax/helpers/AttributesImpl.lo \
+org/xml/sax/helpers/DefaultHandler.lo \
+org/xml/sax/helpers/LocatorImpl.lo \
+org/xml/sax/helpers/NamespaceSupport.lo \
+org/xml/sax/helpers/NewInstance.lo org/xml/sax/helpers/ParserAdapter.lo \
+org/xml/sax/helpers/ParserFactory.lo \
+org/xml/sax/helpers/XMLFilterImpl.lo \
+org/xml/sax/helpers/XMLReaderAdapter.lo \
+org/xml/sax/helpers/XMLReaderFactory.lo org/xml/sax/AttributeList.lo \
+org/xml/sax/Attributes.lo org/xml/sax/ContentHandler.lo \
+org/xml/sax/DTDHandler.lo org/xml/sax/DocumentHandler.lo \
+org/xml/sax/EntityResolver.lo org/xml/sax/ErrorHandler.lo \
+org/xml/sax/HandlerBase.lo org/xml/sax/InputSource.lo \
+org/xml/sax/Locator.lo org/xml/sax/Parser.lo \
+org/xml/sax/SAXException.lo org/xml/sax/SAXNotRecognizedException.lo \
+org/xml/sax/SAXNotSupportedException.lo \
+org/xml/sax/SAXParseException.lo org/xml/sax/XMLFilter.lo \
+org/xml/sax/XMLReader.lo
+lib_org_w3c_dom_la_LDFLAGS =
+lib_org_w3c_dom_la_LIBADD =
+lib_org_w3c_dom_la_OBJECTS = org/w3c/dom/Attr.lo \
+org/w3c/dom/CDATASection.lo org/w3c/dom/CharacterData.lo \
+org/w3c/dom/Comment.lo org/w3c/dom/DOMException.lo \
+org/w3c/dom/DOMImplementation.lo org/w3c/dom/Document.lo \
+org/w3c/dom/DocumentFragment.lo org/w3c/dom/DocumentType.lo \
+org/w3c/dom/Element.lo org/w3c/dom/Entity.lo \
+org/w3c/dom/EntityReference.lo org/w3c/dom/NamedNodeMap.lo \
+org/w3c/dom/Node.lo org/w3c/dom/NodeList.lo org/w3c/dom/Notation.lo \
+org/w3c/dom/ProcessingInstruction.lo org/w3c/dom/Text.lo \
+org/w3c/dom/ranges/DocumentRange.lo org/w3c/dom/ranges/Range.lo \
+org/w3c/dom/ranges/RangeException.lo \
+org/w3c/dom/traversal/DocumentTraversal.lo \
+org/w3c/dom/traversal/NodeFilter.lo \
+org/w3c/dom/traversal/NodeIterator.lo \
+org/w3c/dom/traversal/TreeWalker.lo
+lib_gnu_awt_xlib_la_OBJECTS = gnu/gcj/xlib/natClip.lo \
gnu/gcj/xlib/natColormap.lo gnu/gcj/xlib/natDisplay.lo \
gnu/gcj/xlib/natDrawable.lo gnu/gcj/xlib/natFont.lo \
gnu/gcj/xlib/natGC.lo gnu/gcj/xlib/natPixmap.lo \
@@ -2291,7 +2369,7 @@ COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CF
LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC)
LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@
-DATA = $(jar_DATA) $(toolexeclib_DATA)
+DATA = $(jar_DATA) $(toolexecmainlib_DATA)
DIST_COMMON = README COPYING ChangeLog Makefile.am Makefile.in NEWS \
THANKS acinclude.m4 aclocal.m4 configure configure.in \
@@ -2553,7 +2631,13 @@ 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/nio/charset/ISO_8859_1.P \
+.deps/gnu/java/math/MPN.P .deps/gnu/java/nio/ByteBufferImpl.P \
+.deps/gnu/java/nio/CharBufferImpl.P \
+.deps/gnu/java/nio/DoubleBufferImpl.P \
+.deps/gnu/java/nio/FloatBufferImpl.P .deps/gnu/java/nio/IntBufferImpl.P \
+.deps/gnu/java/nio/LongBufferImpl.P \
+.deps/gnu/java/nio/ShortBufferImpl.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 \
@@ -2562,6 +2646,13 @@ DEP_FILES = .deps/$(srcdir)/$(CONVERT_DIR)/gen-from-JIS.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/nio/natByteBufferImpl.P \
+.deps/gnu/java/nio/natCharBufferImpl.P \
+.deps/gnu/java/nio/natDoubleBufferImpl.P \
+.deps/gnu/java/nio/natFloatBufferImpl.P \
+.deps/gnu/java/nio/natIntBufferImpl.P \
+.deps/gnu/java/nio/natLongBufferImpl.P \
+.deps/gnu/java/nio/natShortBufferImpl.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 \
@@ -2892,10 +2983,12 @@ DEP_FILES = .deps/$(srcdir)/$(CONVERT_DIR)/gen-from-JIS.P \
.deps/java/io/SyncFailedException.P \
.deps/java/io/UTFDataFormatException.P \
.deps/java/io/UnsupportedEncodingException.P \
+.deps/java/io/VMObjectStreamClass.P \
.deps/java/io/WriteAbortedException.P .deps/java/io/Writer.P \
.deps/java/io/natFile.P .deps/java/io/natFileDescriptor.P \
.deps/java/io/natObjectInputStream.P \
.deps/java/io/natObjectOutputStream.P \
+.deps/java/io/natVMObjectStreamClass.P \
.deps/java/lang/AbstractMethodError.P \
.deps/java/lang/ArithmeticException.P \
.deps/java/lang/ArrayIndexOutOfBoundsException.P \
@@ -3029,13 +3122,15 @@ DEP_FILES = .deps/$(srcdir)/$(CONVERT_DIR)/gen-from-JIS.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/DoubleBuffer.P .deps/java/nio/FloatBuffer.P \
+.deps/java/nio/IntBuffer.P .deps/java/nio/InvalidMarkException.P \
+.deps/java/nio/LongBuffer.P .deps/java/nio/MappedByteBuffer.P \
+.deps/java/nio/ReadOnlyBufferException.P .deps/java/nio/ShortBuffer.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/Channel.P .deps/java/nio/channels/Channels.P \
.deps/java/nio/channels/ClosedByInterruptException.P \
.deps/java/nio/channels/ClosedChannelException.P \
.deps/java/nio/channels/ClosedSelectorException.P \
@@ -3117,6 +3212,7 @@ DEP_FILES = .deps/$(srcdir)/$(CONVERT_DIR)/gen-from-JIS.P \
.deps/java/rmi/server/LoaderHandler.P .deps/java/rmi/server/LogStream.P \
.deps/java/rmi/server/ObjID.P .deps/java/rmi/server/Operation.P \
.deps/java/rmi/server/RMIClassLoader.P \
+.deps/java/rmi/server/RMIClassLoaderSpi.P \
.deps/java/rmi/server/RMIClientSocketFactory.P \
.deps/java/rmi/server/RMIFailureHandler.P \
.deps/java/rmi/server/RMIServerSocketFactory.P \
@@ -3701,6 +3797,7 @@ DEP_FILES = .deps/$(srcdir)/$(CONVERT_DIR)/gen-from-JIS.P \
.deps/org/xml/sax/helpers/DefaultHandler.P \
.deps/org/xml/sax/helpers/LocatorImpl.P \
.deps/org/xml/sax/helpers/NamespaceSupport.P \
+.deps/org/xml/sax/helpers/NewInstance.P \
.deps/org/xml/sax/helpers/ParserAdapter.P \
.deps/org/xml/sax/helpers/ParserFactory.P \
.deps/org/xml/sax/helpers/XMLFilterImpl.P \
@@ -3708,8 +3805,8 @@ DEP_FILES = .deps/$(srcdir)/$(CONVERT_DIR)/gen-from-JIS.P \
.deps/org/xml/sax/helpers/XMLReaderFactory.P .deps/posix-threads.P \
.deps/posix.P .deps/prims.P .deps/resolve.P .deps/verify.P \
.deps/win32-threads.P .deps/win32.P
-SOURCES = $(libgcj_la_SOURCES) $(EXTRA_libgcj_la_SOURCES) $(libgcjx_la_SOURCES) $(EXTRA_libgcjx_la_SOURCES) $(jv_convert_SOURCES) $(EXTRA_jv_convert_SOURCES) $(gij_SOURCES) $(rmic_SOURCES) $(EXTRA_rmic_SOURCES) $(rmiregistry_SOURCES) $(EXTRA_rmiregistry_SOURCES) $(gen_from_JIS_SOURCES) $(EXTRA_gen_from_JIS_SOURCES)
-OBJECTS = $(libgcj_la_OBJECTS) $(libgcjx_la_OBJECTS) $(jv_convert_OBJECTS) $(gij_OBJECTS) $(rmic_OBJECTS) $(rmiregistry_OBJECTS) $(gen_from_JIS_OBJECTS)
+SOURCES = $(libgcj_la_SOURCES) $(EXTRA_libgcj_la_SOURCES) $(lib_org_xml_sax_la_SOURCES) $(lib_org_w3c_dom_la_SOURCES) $(lib_gnu_awt_xlib_la_SOURCES) $(EXTRA_lib_gnu_awt_xlib_la_SOURCES) $(jv_convert_SOURCES) $(EXTRA_jv_convert_SOURCES) $(gij_SOURCES) $(rmic_SOURCES) $(EXTRA_rmic_SOURCES) $(rmiregistry_SOURCES) $(EXTRA_rmiregistry_SOURCES) $(gen_from_JIS_SOURCES) $(EXTRA_gen_from_JIS_SOURCES)
+OBJECTS = $(libgcj_la_OBJECTS) $(lib_org_xml_sax_la_OBJECTS) $(lib_org_w3c_dom_la_OBJECTS) $(lib_gnu_awt_xlib_la_OBJECTS) $(jv_convert_OBJECTS) $(gij_OBJECTS) $(rmic_OBJECTS) $(rmiregistry_OBJECTS) $(gen_from_JIS_OBJECTS)
all: all-redirect
.SUFFIXES:
@@ -3796,6 +3893,12 @@ distclean-libtool:
maintainer-clean-libtool:
+lib-org-xml-sax.la: $(lib_org_xml_sax_la_OBJECTS) $(lib_org_xml_sax_la_DEPENDENCIES)
+ $(LINK) -rpath $(toolexeclibdir) $(lib_org_xml_sax_la_LDFLAGS) $(lib_org_xml_sax_la_OBJECTS) $(lib_org_xml_sax_la_LIBADD) $(LIBS)
+
+lib-org-w3c-dom.la: $(lib_org_w3c_dom_la_OBJECTS) $(lib_org_w3c_dom_la_DEPENDENCIES)
+ $(LINK) -rpath $(toolexeclibdir) $(lib_org_w3c_dom_la_LDFLAGS) $(lib_org_w3c_dom_la_OBJECTS) $(lib_org_w3c_dom_la_LIBADD) $(LIBS)
+
mostlyclean-binPROGRAMS:
clean-binPROGRAMS:
@@ -3894,23 +3997,23 @@ uninstall-jarDATA:
rm -f $(DESTDIR)$(jardir)/$$p; \
done
-install-toolexeclibDATA: $(toolexeclib_DATA)
+install-toolexecmainlibDATA: $(toolexecmainlib_DATA)
@$(NORMAL_INSTALL)
- $(mkinstalldirs) $(DESTDIR)$(toolexeclibdir)
- @list='$(toolexeclib_DATA)'; for p in $$list; do \
+ $(mkinstalldirs) $(DESTDIR)$(toolexecmainlibdir)
+ @list='$(toolexecmainlib_DATA)'; for p in $$list; do \
if test -f $(srcdir)/$$p; then \
- echo " $(INSTALL_DATA) $(srcdir)/$$p $(DESTDIR)$(toolexeclibdir)/$$p"; \
- $(INSTALL_DATA) $(srcdir)/$$p $(DESTDIR)$(toolexeclibdir)/$$p; \
+ echo " $(INSTALL_DATA) $(srcdir)/$$p $(DESTDIR)$(toolexecmainlibdir)/$$p"; \
+ $(INSTALL_DATA) $(srcdir)/$$p $(DESTDIR)$(toolexecmainlibdir)/$$p; \
else if test -f $$p; then \
- echo " $(INSTALL_DATA) $$p $(DESTDIR)$(toolexeclibdir)/$$p"; \
- $(INSTALL_DATA) $$p $(DESTDIR)$(toolexeclibdir)/$$p; \
+ echo " $(INSTALL_DATA) $$p $(DESTDIR)$(toolexecmainlibdir)/$$p"; \
+ $(INSTALL_DATA) $$p $(DESTDIR)$(toolexecmainlibdir)/$$p; \
fi; fi; \
done
-uninstall-toolexeclibDATA:
+uninstall-toolexecmainlibDATA:
@$(NORMAL_UNINSTALL)
- list='$(toolexeclib_DATA)'; for p in $$list; do \
- rm -f $(DESTDIR)$(toolexeclibdir)/$$p; \
+ list='$(toolexecmainlib_DATA)'; for p in $$list; do \
+ rm -f $(DESTDIR)$(toolexecmainlibdir)/$$p; \
done
# This directory's subdirectories are mostly independent; you can cd
@@ -4125,9 +4228,7 @@ check: check-recursive
installcheck-am:
installcheck: installcheck-recursive
install-exec-am: install-toolexeclibLTLIBRARIES install-binPROGRAMS \
- install-binSCRIPTS install-toolexeclibDATA
- @$(NORMAL_INSTALL)
- $(MAKE) $(AM_MAKEFLAGS) install-exec-hook
+ install-binSCRIPTS install-toolexecmainlibDATA
install-exec: install-exec-recursive
install-data-am: install-jarDATA install-data-local
@@ -4138,7 +4239,7 @@ install-am: all-am
install: install-recursive
uninstall-am: uninstall-toolexeclibLTLIBRARIES uninstall-binPROGRAMS \
uninstall-binSCRIPTS uninstall-jarDATA \
- uninstall-toolexeclibDATA
+ uninstall-toolexecmainlibDATA
uninstall: uninstall-recursive
all-am: Makefile $(LTLIBRARIES) $(PROGRAMS) $(SCRIPTS) $(DATA)
all-redirect: all-recursive
@@ -4148,7 +4249,7 @@ installdirs: installdirs-recursive
installdirs-am:
$(mkinstalldirs) $(DESTDIR)$(toolexeclibdir) $(DESTDIR)$(bindir) \
$(DESTDIR)$(bindir) $(DESTDIR)$(jardir) \
- $(DESTDIR)$(toolexeclibdir)
+ $(DESTDIR)$(toolexecmainlibdir)
mostlyclean-generic:
@@ -4207,12 +4308,12 @@ distclean-binPROGRAMS clean-binPROGRAMS maintainer-clean-binPROGRAMS \
uninstall-binPROGRAMS install-binPROGRAMS mostlyclean-noinstPROGRAMS \
distclean-noinstPROGRAMS clean-noinstPROGRAMS \
maintainer-clean-noinstPROGRAMS uninstall-binSCRIPTS install-binSCRIPTS \
-uninstall-jarDATA install-jarDATA uninstall-toolexeclibDATA \
-install-toolexeclibDATA install-data-recursive uninstall-data-recursive \
-install-exec-recursive uninstall-exec-recursive installdirs-recursive \
-uninstalldirs-recursive all-recursive check-recursive \
-installcheck-recursive info-recursive dvi-recursive \
-mostlyclean-recursive distclean-recursive clean-recursive \
+uninstall-jarDATA install-jarDATA uninstall-toolexecmainlibDATA \
+install-toolexecmainlibDATA install-data-recursive \
+uninstall-data-recursive install-exec-recursive \
+uninstall-exec-recursive installdirs-recursive uninstalldirs-recursive \
+all-recursive check-recursive installcheck-recursive info-recursive \
+dvi-recursive mostlyclean-recursive distclean-recursive clean-recursive \
maintainer-clean-recursive tags tags-recursive mostlyclean-tags \
distclean-tags clean-tags maintainer-clean-tags distdir \
mostlyclean-depend distclean-depend clean-depend \
@@ -4224,13 +4325,6 @@ installdirs mostlyclean-generic distclean-generic clean-generic \
maintainer-clean-generic clean mostlyclean distclean maintainer-clean
-install-exec-hook:
- cd $(DESTDIR)$(libdir) && \
- if test -f libgcjx.la; then \
- rm -f gnu-awt-xlib.la; \
- $(LN_S) libgcjx.la gnu-awt-xlib.la; \
- fi
-
.java.class:
$(JAVAC) $(JCFLAGS) -classpath '' -bootclasspath $(here):$(srcdir) \
-d $(here) $<
@@ -4264,7 +4358,7 @@ $(c_files): %.lo: %.c
$(c_files): java/lang/fdlibm.h java/lang/ieeefp.h java/lang/mprec.h
-$(javao_files) $(x_javao_files): %.lo: %.java
+$(javao_files) $(x_javao_files) $(lib_org_w3c_dom_la_OBJECTS) $(lib_org_xml_sax_la_OBJECTS): %.lo: %.java
$(GCJCOMPILE) -o $@ $<
libgcj.la: $(libgcj_la_OBJECTS) $(libgcj_la_DEPENDENCIES)
@@ -4273,10 +4367,10 @@ libgcj.la: $(libgcj_la_OBJECTS) $(libgcj_la_DEPENDENCIES)
@GCLIBS@ @LIBFFI@ @ZLIBS@ \
-rpath $(toolexeclibdir) $(libgcj_la_LDFLAGS) $(LIBS)
-libgcjx.la: $(libgcjx_la_OBJECTS) $(libgcjx_la_DEPENDENCIES)
- @: $(shell echo Creating list of files to link...) $(shell rm -f libgcjx.objectlist || :) $(shell touch libgcjx.objectlist) $(foreach object,$(libgcjx_la_OBJECTS) $(libgcjx_la_LIBADD),$(shell echo $(object) >> libgcjx.objectlist))
- $(libgcjx_la_LINK) -objectlist libgcjx.objectlist \
- -rpath $(toolexeclibdir) $(libgcjx_la_LDFLAGS) $(LIBS)
+lib-gnu-awt-xlib.la: $(lib_gnu_awt_xlib_la_OBJECTS) $(lib_gnu_awt_xlib_la_DEPENDENCIES)
+ @: $(shell echo Creating list of files to link...) $(shell rm -f lib_gnu_awt_xlib.objectlist || :) $(shell touch lib_gnu_awt_xlib.objectlist) $(foreach object,$(lib_gnu_awt_xlib_la_OBJECTS) $(lib_gnu_awt_xlib_la_LIBADD),$(shell echo $(object) >> lib_gnu_awt_xlib.objectlist))
+ $(lib_gnu_awt_xlib_la_LINK) -objectlist lib_gnu_awt_xlib.objectlist \
+ -rpath $(toolexeclibdir) $(lib_gnu_awt_xlib_la_LDFLAGS) $(LIBS)
.class.h:
$(GCJH) -classpath '' -bootclasspath $(top_builddir) $(basename $<)
diff --git a/libjava/acinclude.m4 b/libjava/acinclude.m4
index d205aa029dd..ab3b2f1dd27 100644
--- a/libjava/acinclude.m4
+++ b/libjava/acinclude.m4
@@ -273,3 +273,27 @@ AC_DEFUN([AM_LC_MESSAGES],
[Define if your <locale.h> file defines LC_MESSAGES.])
fi
fi])
+
+AC_DEFUN([CHECK_FOR_BROKEN_MINGW_LD],
+[
+AC_MSG_CHECKING(whether 'ld' is at least 2.13)
+LD_PROG=`$CC --print-prog-name=ld`
+LD_VERSION=`$LD_PROG --version`
+LD_VERSION_MAJOR=`echo "$LD_VERSION" | head -1 | cut -d '.' -f 1 | cut -d ' ' -f 4`
+LD_VERSION_MINOR=`echo "$LD_VERSION" | head -1 | cut -d '.' -f 2`
+if expr "$LD_VERSION_MAJOR" \> 2 > /dev/null; then
+ LD_OK="ok"
+else
+ if expr "$LD_VERSION_MAJOR" = 2 && expr "$LD_VERSION_MINOR" \>= 13 > /dev/null; then
+ LD_OK="ok"
+ fi
+fi
+if test "x$LD_OK" != x; then
+ AC_MSG_RESULT([yes; major=$LD_VERSION_MAJOR, minor=$LD_VERSION_MINOR])
+else
+ AC_MSG_RESULT([no; major=$LD_VERSION_MAJOR, minor=$LD_VERSION_MINOR])
+ AC_MSG_WARN([ld <2.13 detected; enabling JV_LINKER_CANNOT_8BYTE_ALIGN_STATICS hack...])
+ AC_DEFINE(JV_LINKER_CANNOT_8BYTE_ALIGN_STATICS, 1,
+ [Indicate that linker is not able to 8-byte align static data])
+fi[]dnl
+])# CHECK_FOR_BROKEN_MINGW_LD
diff --git a/libjava/aclocal.m4 b/libjava/aclocal.m4
index 26e735711b9..5748ebada1f 100644
--- a/libjava/aclocal.m4
+++ b/libjava/aclocal.m4
@@ -286,6 +286,30 @@ AC_DEFUN([AM_LC_MESSAGES],
fi
fi])
+AC_DEFUN([CHECK_FOR_BROKEN_MINGW_LD],
+[
+AC_MSG_CHECKING(whether 'ld' is at least 2.13)
+LD_PROG=`$CC --print-prog-name=ld`
+LD_VERSION=`$LD_PROG --version`
+LD_VERSION_MAJOR=`echo "$LD_VERSION" | head -1 | cut -d '.' -f 1 | cut -d ' ' -f 4`
+LD_VERSION_MINOR=`echo "$LD_VERSION" | head -1 | cut -d '.' -f 2`
+if expr "$LD_VERSION_MAJOR" \> 2 > /dev/null; then
+ LD_OK="ok"
+else
+ if expr "$LD_VERSION_MAJOR" = 2 && expr "$LD_VERSION_MINOR" \>= 13 > /dev/null; then
+ LD_OK="ok"
+ fi
+fi
+if test "x$LD_OK" != x; then
+ AC_MSG_RESULT([yes; major=$LD_VERSION_MAJOR, minor=$LD_VERSION_MINOR])
+else
+ AC_MSG_RESULT([no; major=$LD_VERSION_MAJOR, minor=$LD_VERSION_MINOR])
+ AC_MSG_WARN([ld <2.13 detected; enabling JV_LINKER_CANNOT_8BYTE_ALIGN_STATICS hack...])
+ AC_DEFINE(JV_LINKER_CANNOT_8BYTE_ALIGN_STATICS, 1,
+ [Indicate that linker is not able to 8-byte align static data])
+fi[]dnl
+])# CHECK_FOR_BROKEN_MINGW_LD
+
# Do all the work for Automake. This macro actually does too much --
# some checks are only needed if your package does certain things.
# But this isn't really a big deal.
@@ -434,26 +458,3 @@ for am_file in <<$1>>; do
done<<>>dnl>>)
changequote([,]))])
-AC_DEFUN([CHECK_FOR_BROKEN_MINGW_LD],
-[
-AC_MSG_CHECKING(whether 'ld' is at least 2.13)
-LD_PROG=`$CC --print-prog-name=ld`
-LD_VERSION=`$LD_PROG --version`
-LD_VERSION_MAJOR=`echo "$LD_VERSION" | head -1 | cut -d '.' -f 1 | cut -d ' ' -f 4`
-LD_VERSION_MINOR=`echo "$LD_VERSION" | head -1 | cut -d '.' -f 2`
-if expr "$LD_VERSION_MAJOR" \> 2 > /dev/null; then
- LD_OK="ok"
-else
- if expr "$LD_VERSION_MAJOR" = 2 && expr "$LD_VERSION_MINOR" \>= 13 > /dev/null; then
- LD_OK="ok"
- fi
-fi
-if test "x$LD_OK" != x; then
- AC_MSG_RESULT([yes; major=$LD_VERSION_MAJOR, minor=$LD_VERSION_MINOR])
-else
- AC_MSG_RESULT([no; major=$LD_VERSION_MAJOR, minor=$LD_VERSION_MINOR])
- AC_MSG_WARN([ld <2.13 detected; enabling JV_LINKER_CANNOT_8BYTE_ALIGN_STATICS hack...])
- AC_DEFINE(JV_LINKER_CANNOT_8BYTE_ALIGN_STATICS, 1,
- [Indicate that linker is not able to 8-byte align static data])
-fi[]dnl
-])# CHECK_FOR_BROKEN_MINGW_LD
diff --git a/libjava/boehm.cc b/libjava/boehm.cc
index 90796f2ddf0..5006059dabd 100644
--- a/libjava/boehm.cc
+++ b/libjava/boehm.cc
@@ -203,6 +203,8 @@ _Jv_MarkObj (void *addr, void *msp, void *msl, void * /* env */)
MAYBE_MARK (p, mark_stack_ptr, mark_stack_limit, c, cBlabel);
p = (ptr_t) c->arrayclass;
MAYBE_MARK (p, mark_stack_ptr, mark_stack_limit, c, cDlabel);
+ p = (ptr_t) c->protectionDomain;
+ MAYBE_MARK (p, mark_stack_ptr, mark_stack_limit, c, cPlabel);
#ifdef INTERPRETER
if (_Jv_IsInterpretedClass (c))
diff --git a/libjava/configure b/libjava/configure
index 4160fef7d68..1aee8cb6a45 100755
--- a/libjava/configure
+++ b/libjava/configure
@@ -2430,6 +2430,19 @@ case $host in
# Find out which ABI we are using.
echo '#line 2432 "configure"' > conftest.$ac_ext
if { (eval echo configure:2433: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ if test "$lt_cv_prog_gnu_ld" = yes; then
+ case `/usr/bin/file conftest.$ac_objext` in
+ *32-bit*)
+ LD="${LD-ld} -melf32bsmip"
+ ;;
+ *N32*)
+ LD="${LD-ld} -melf32bmipn32"
+ ;;
+ *64-bit*)
+ LD="${LD-ld} -melf64bmip"
+ ;;
+ esac
+ else
case `/usr/bin/file conftest.$ac_objext` in
*32-bit*)
LD="${LD-ld} -32"
@@ -2441,6 +2454,7 @@ case $host in
LD="${LD-ld} -64"
;;
esac
+ fi
fi
rm -rf conftest*
;;
@@ -2448,7 +2462,7 @@ case $host in
ia64-*-hpux*)
# Find out which ABI we are using.
echo 'int i;' > conftest.$ac_ext
- if { (eval echo configure:2452: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ if { (eval echo configure:2466: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
case "`/usr/bin/file conftest.o`" in
*ELF-32*)
HPUX_IA64_MODE="32"
@@ -2464,7 +2478,7 @@ ia64-*-hpux*)
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
+ if { (eval echo configure:2482: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
case "`/usr/bin/file conftest.o`" in
*32-bit*)
case $host in
@@ -2508,7 +2522,7 @@ x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*|s390*-*linux*|sparc*-*linux*)
SAVE_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -belf"
echo $ac_n "checking whether the C compiler needs -belf""... $ac_c" 1>&6
-echo "configure:2512: checking whether the C compiler needs -belf" >&5
+echo "configure:2526: 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
@@ -2521,14 +2535,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 2525 "configure"
+#line 2539 "configure"
#include "confdefs.h"
int main() {
; return 0; }
EOF
-if { (eval echo configure:2532: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2546: \"$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
@@ -2558,12 +2572,12 @@ 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:2562: checking how to run the C++ preprocessor" >&5
+echo "configure:2576: 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
else
- ac_ext=C
+ ac_ext=C
# CXXFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
ac_cpp='$CXXCPP $CPPFLAGS'
ac_compile='${CXX-g++} -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
@@ -2571,12 +2585,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 2575 "configure"
+#line 2589 "configure"
#include "confdefs.h"
#include <stdlib.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2580: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2594: \"$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
:
@@ -2589,18 +2603,15 @@ else
fi
rm -f conftest*
ac_cv_prog_CXXCPP="$CXXCPP"
- ac_ext=c
+ac_ext=c
# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
ac_cpp='$CPP $CPPFLAGS'
ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
cross_compiling=$ac_cv_prog_cc_cross
-
fi
- CXXCPP="$ac_cv_prog_CXXCPP"
-else
- ac_cv_prog_CXXCPP=$CXXCPP
fi
+CXXCPP="$ac_cv_prog_CXXCPP"
echo "$ac_t""$CXXCPP" 1>&6
@@ -2815,7 +2826,7 @@ INTERPRETER="$libgcj_interpreter"
echo $ac_n "checking for exception model to use""... $ac_c" 1>&6
-echo "configure:2819: checking for exception model to use" >&5
+echo "configure:2830: 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.
@@ -2830,7 +2841,7 @@ if test "${enable_sjlj_exceptions+set}" = set; then
:
else
cat > conftest.$ac_ext << EOF
-#line 2834 "configure"
+#line 2845 "configure"
struct S { ~S(); };
void bar();
void foo()
@@ -2841,7 +2852,7 @@ void foo()
EOF
old_CXXFLAGS="$CXXFLAGS"
CXXFLAGS=-S
-if { (eval echo configure:2845: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2856: \"$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
@@ -2951,7 +2962,7 @@ case "$TARGET_ECOS" in
PLATFORMH=win32.h
echo $ac_n "checking whether 'ld' is at least 2.13""... $ac_c" 1>&6
-echo "configure:2955: checking whether 'ld' is at least 2.13" >&5
+echo "configure:2966: checking whether 'ld' is at least 2.13" >&5
LD_PROG=`$CC --print-prog-name=ld`
LD_VERSION=`$LD_PROG --version`
LD_VERSION_MAJOR=`echo "$LD_VERSION" | head -1 | cut -d '.' -f 1 | cut -d ' ' -f 4`
@@ -2995,7 +3006,7 @@ esac
echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
-echo "configure:2999: checking how to run the C preprocessor" >&5
+echo "configure:3010: checking how to run the C preprocessor" >&5
# On Suns, sometimes $CPP names a directory.
if test -n "$CPP" && test -d "$CPP"; then
CPP=
@@ -3010,13 +3021,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 3014 "configure"
+#line 3025 "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:3020: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:3031: \"$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
:
@@ -3027,13 +3038,13 @@ else
rm -rf conftest*
CPP="${CC-cc} -E -traditional-cpp"
cat > conftest.$ac_ext <<EOF
-#line 3031 "configure"
+#line 3042 "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:3037: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:3048: \"$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
:
@@ -3044,13 +3055,13 @@ else
rm -rf conftest*
CPP="${CC-cc} -nologo -E"
cat > conftest.$ac_ext <<EOF
-#line 3048 "configure"
+#line 3059 "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:3054: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:3065: \"$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
:
@@ -3075,7 +3086,7 @@ fi
echo "$ac_t""$CPP" 1>&6
cat > conftest.$ac_ext <<EOF
-#line 3079 "configure"
+#line 3090 "configure"
#include "confdefs.h"
#include <stdint.h>
EOF
@@ -3090,7 +3101,7 @@ fi
rm -f conftest*
cat > conftest.$ac_ext <<EOF
-#line 3094 "configure"
+#line 3105 "configure"
#include "confdefs.h"
#include <inttypes.h>
EOF
@@ -3105,7 +3116,7 @@ fi
rm -f conftest*
cat > conftest.$ac_ext <<EOF
-#line 3109 "configure"
+#line 3120 "configure"
#include "confdefs.h"
#include <sys/types.h>
EOF
@@ -3120,7 +3131,7 @@ fi
rm -f conftest*
cat > conftest.$ac_ext <<EOF
-#line 3124 "configure"
+#line 3135 "configure"
#include "confdefs.h"
#include <sys/config.h>
EOF
@@ -3137,7 +3148,7 @@ rm -f conftest*
cat > conftest.$ac_ext <<EOF
-#line 3141 "configure"
+#line 3152 "configure"
#include "confdefs.h"
#include <time.h>
EOF
@@ -3152,7 +3163,7 @@ fi
rm -f conftest*
cat > conftest.$ac_ext <<EOF
-#line 3156 "configure"
+#line 3167 "configure"
#include "confdefs.h"
#include <time.h>
EOF
@@ -3204,7 +3215,7 @@ ZLIBTESTSPEC=
libsubdir=.libs
echo $ac_n "checking for garbage collector to use""... $ac_c" 1>&6
-echo "configure:3208: checking for garbage collector to use" >&5
+echo "configure:3219: 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"
@@ -3257,7 +3268,7 @@ esac
echo $ac_n "checking for thread model used by GCC""... $ac_c" 1>&6
-echo "configure:3261: checking for thread model used by GCC" >&5
+echo "configure:3272: 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
@@ -3465,12 +3476,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:3469: checking for $ac_func" >&5
+echo "configure:3480: 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 3474 "configure"
+#line 3485 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -3493,7 +3504,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:3497: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3508: \"$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
@@ -3520,12 +3531,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:3524: checking for $ac_func" >&5
+echo "configure:3535: 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 3529 "configure"
+#line 3540 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -3548,7 +3559,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:3552: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3563: \"$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
@@ -3575,12 +3586,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:3579: checking for $ac_func" >&5
+echo "configure:3590: 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 3584 "configure"
+#line 3595 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -3603,7 +3614,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:3607: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3618: \"$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
@@ -3630,12 +3641,12 @@ done
for ac_func in nl_langinfo setlocale
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:3634: checking for $ac_func" >&5
+echo "configure:3645: 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 3639 "configure"
+#line 3650 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -3658,7 +3669,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:3662: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3673: \"$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
@@ -3685,12 +3696,12 @@ done
for ac_func in inet_aton inet_addr
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:3689: checking for $ac_func" >&5
+echo "configure:3700: 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 3694 "configure"
+#line 3705 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -3713,7 +3724,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:3717: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3728: \"$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
@@ -3740,12 +3751,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:3744: checking for $ac_func" >&5
+echo "configure:3755: 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 3749 "configure"
+#line 3760 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -3768,7 +3779,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:3772: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3783: \"$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
@@ -3795,12 +3806,12 @@ done
for ac_func in fork execvp pipe sigaction ftruncate
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:3799: checking for $ac_func" >&5
+echo "configure:3810: 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 3804 "configure"
+#line 3815 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -3823,7 +3834,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:3827: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3838: \"$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
@@ -3851,17 +3862,17 @@ done
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:3855: checking for $ac_hdr" >&5
+echo "configure:3866: 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 3860 "configure"
+#line 3871 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3865: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:3876: \"$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*
@@ -3888,12 +3899,12 @@ fi
done
echo $ac_n "checking for backtrace""... $ac_c" 1>&6
-echo "configure:3892: checking for backtrace" >&5
+echo "configure:3903: 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 3897 "configure"
+#line 3908 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char backtrace(); below. */
@@ -3916,7 +3927,7 @@ backtrace();
; return 0; }
EOF
-if { (eval echo configure:3920: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3931: \"$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
@@ -3948,11 +3959,22 @@ EOF
else
echo "$ac_t""no" 1>&6
+
+ case "$host" in
+ *mingw*)
+ # Has backtrace() defined in libgcj itself
+ cat >> confdefs.h <<\EOF
+#define HAVE_BACKTRACE 1
+EOF
+
+ ;;
+ esac
+
fi
echo $ac_n "checking for dladdr in -ldl""... $ac_c" 1>&6
-echo "configure:3956: checking for dladdr in -ldl" >&5
+echo "configure:3978: 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
@@ -3960,7 +3982,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-ldl $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 3964 "configure"
+#line 3986 "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
@@ -3971,7 +3993,7 @@ int main() {
dladdr()
; return 0; }
EOF
-if { (eval echo configure:3975: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3997: \"$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
@@ -4001,7 +4023,7 @@ do
ac_safe=`echo "$ac_file" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_file""... $ac_c" 1>&6
-echo "configure:4005: checking for $ac_file" >&5
+echo "configure:4027: 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
@@ -4059,7 +4081,7 @@ fi
echo $ac_n "checking for iconv""... $ac_c" 1>&6
-echo "configure:4063: checking for iconv" >&5
+echo "configure:4085: checking for iconv" >&5
if eval "test \"`echo '$''{'am_cv_func_iconv'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -4067,7 +4089,7 @@ else
am_cv_func_iconv="no, consider installing GNU libiconv"
am_cv_lib_iconv=no
cat > conftest.$ac_ext <<EOF
-#line 4071 "configure"
+#line 4093 "configure"
#include "confdefs.h"
#include <stdlib.h>
#include <iconv.h>
@@ -4077,7 +4099,7 @@ iconv_t cd = iconv_open("","");
iconv_close(cd);
; return 0; }
EOF
-if { (eval echo configure:4081: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4103: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
am_cv_func_iconv=yes
else
@@ -4089,7 +4111,7 @@ rm -f conftest*
am_save_LIBS="$LIBS"
LIBS="$LIBS $am_cv_libiconv_ldpath -liconv"
cat > conftest.$ac_ext <<EOF
-#line 4093 "configure"
+#line 4115 "configure"
#include "confdefs.h"
#include <stdlib.h>
#include <iconv.h>
@@ -4099,7 +4121,7 @@ iconv_t cd = iconv_open("","");
iconv_close(cd);
; return 0; }
EOF
-if { (eval echo configure:4103: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4125: \"$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
@@ -4120,13 +4142,13 @@ echo "$ac_t""$am_cv_func_iconv" 1>&6
EOF
echo $ac_n "checking for iconv declaration""... $ac_c" 1>&6
-echo "configure:4124: checking for iconv declaration" >&5
+echo "configure:4146: 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 4130 "configure"
+#line 4152 "configure"
#include "confdefs.h"
#include <stdlib.h>
@@ -4145,7 +4167,7 @@ int main() {
; return 0; }
EOF
-if { (eval echo configure:4149: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4171: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
am_cv_proto_iconv_arg1=""
else
@@ -4174,19 +4196,19 @@ EOF
if test $ac_cv_header_locale_h = yes; then
echo $ac_n "checking for LC_MESSAGES""... $ac_c" 1>&6
-echo "configure:4178: checking for LC_MESSAGES" >&5
+echo "configure:4200: 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 4183 "configure"
+#line 4205 "configure"
#include "confdefs.h"
#include <locale.h>
int main() {
return LC_MESSAGES
; return 0; }
EOF
-if { (eval echo configure:4190: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4212: \"$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
@@ -4207,12 +4229,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:4211: checking whether struct tm is in sys/time.h or time.h" >&5
+echo "configure:4233: 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 4216 "configure"
+#line 4238 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <time.h>
@@ -4220,7 +4242,7 @@ int main() {
struct tm *tp; tp->tm_sec;
; return 0; }
EOF
-if { (eval echo configure:4224: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4246: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_struct_tm=time.h
else
@@ -4241,12 +4263,12 @@ EOF
fi
echo $ac_n "checking for tm_zone in struct tm""... $ac_c" 1>&6
-echo "configure:4245: checking for tm_zone in struct tm" >&5
+echo "configure:4267: 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 4250 "configure"
+#line 4272 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <$ac_cv_struct_tm>
@@ -4254,7 +4276,7 @@ int main() {
struct tm tm; tm.tm_zone;
; return 0; }
EOF
-if { (eval echo configure:4258: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4280: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_struct_tm_zone=yes
else
@@ -4274,12 +4296,12 @@ EOF
else
echo $ac_n "checking for tzname""... $ac_c" 1>&6
-echo "configure:4278: checking for tzname" >&5
+echo "configure:4300: 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 4283 "configure"
+#line 4305 "configure"
#include "confdefs.h"
#include <time.h>
#ifndef tzname /* For SGI. */
@@ -4289,7 +4311,7 @@ int main() {
atoi(*tzname);
; return 0; }
EOF
-if { (eval echo configure:4293: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4315: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
ac_cv_var_tzname=yes
else
@@ -4314,12 +4336,12 @@ fi
for ac_func in gethostbyname_r
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:4318: checking for $ac_func" >&5
+echo "configure:4340: 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 4323 "configure"
+#line 4345 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -4342,7 +4364,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:4346: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4368: \"$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
@@ -4369,7 +4391,7 @@ EOF
# We look for the one that returns `int'.
# Hopefully this check is robust enough.
cat > conftest.$ac_ext <<EOF
-#line 4373 "configure"
+#line 4395 "configure"
#include "confdefs.h"
#include <netdb.h>
EOF
@@ -4389,7 +4411,7 @@ rm -f conftest*
*" -D_REENTRANT "*) ;;
*)
echo $ac_n "checking whether gethostbyname_r declaration requires -D_REENTRANT""... $ac_c" 1>&6
-echo "configure:4393: checking whether gethostbyname_r declaration requires -D_REENTRANT" >&5
+echo "configure:4415: 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
@@ -4402,14 +4424,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 4406 "configure"
+#line 4428 "configure"
#include "confdefs.h"
#include <netdb.h>
int main() {
gethostbyname_r("", 0, 0);
; return 0; }
EOF
-if { (eval echo configure:4413: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4435: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
libjava_cv_gethostbyname_r_needs_reentrant=no
else
@@ -4419,14 +4441,14 @@ else
CPPFLAGS_SAVE="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS -D_REENTRANT"
cat > conftest.$ac_ext <<EOF
-#line 4423 "configure"
+#line 4445 "configure"
#include "confdefs.h"
#include <netdb.h>
int main() {
gethostbyname_r("", 0, 0);
; return 0; }
EOF
-if { (eval echo configure:4430: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4452: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
libjava_cv_gethostbyname_r_needs_reentrant=yes
else
@@ -4461,12 +4483,12 @@ EOF
esac
echo $ac_n "checking for struct hostent_data""... $ac_c" 1>&6
-echo "configure:4465: checking for struct hostent_data" >&5
+echo "configure:4487: 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 4470 "configure"
+#line 4492 "configure"
#include "confdefs.h"
#if GETHOSTBYNAME_R_NEEDS_REENTRANT && !defined(_REENTRANT)
@@ -4477,7 +4499,7 @@ int main() {
struct hostent_data data;
; return 0; }
EOF
-if { (eval echo configure:4481: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4503: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
libjava_cv_struct_hostent_data=yes
else
@@ -4509,7 +4531,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 4513 "configure"
+#line 4535 "configure"
#include "confdefs.h"
#include <netdb.h>
EOF
@@ -4520,12 +4542,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:4524: checking for $ac_func" >&5
+echo "configure:4546: 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 4529 "configure"
+#line 4551 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -4548,7 +4570,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:4552: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4574: \"$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
@@ -4575,7 +4597,7 @@ EOF
# We look for the one that returns `int'.
# Hopefully this check is robust enough.
cat > conftest.$ac_ext <<EOF
-#line 4579 "configure"
+#line 4601 "configure"
#include "confdefs.h"
#include <netdb.h>
EOF
@@ -4602,12 +4624,12 @@ rm -f conftest*
for ac_func in gethostname
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:4606: checking for $ac_func" >&5
+echo "configure:4628: 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 4611 "configure"
+#line 4633 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -4630,7 +4652,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:4634: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4656: \"$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
@@ -4654,7 +4676,7 @@ EOF
EOF
cat > conftest.$ac_ext <<EOF
-#line 4658 "configure"
+#line 4680 "configure"
#include "confdefs.h"
#include <unistd.h>
EOF
@@ -4685,12 +4707,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:4689: checking for $ac_func" >&5
+echo "configure:4711: 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 4716 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -4713,7 +4735,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:4739: \"$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
@@ -4743,12 +4765,12 @@ done
for ac_func in sched_yield
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:4747: checking for $ac_func" >&5
+echo "configure:4769: 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 4752 "configure"
+#line 4774 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -4771,7 +4793,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:4775: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4797: \"$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
@@ -4793,7 +4815,7 @@ EOF
else
echo "$ac_t""no" 1>&6
echo $ac_n "checking for sched_yield in -lrt""... $ac_c" 1>&6
-echo "configure:4797: checking for sched_yield in -lrt" >&5
+echo "configure:4819: 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
@@ -4801,7 +4823,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lrt $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 4805 "configure"
+#line 4827 "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
@@ -4812,7 +4834,7 @@ int main() {
sched_yield()
; return 0; }
EOF
-if { (eval echo configure:4816: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4838: \"$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
@@ -4838,7 +4860,7 @@ else
echo "$ac_t""no" 1>&6
echo $ac_n "checking for sched_yield in -lposix4""... $ac_c" 1>&6
-echo "configure:4842: checking for sched_yield in -lposix4" >&5
+echo "configure:4864: 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
@@ -4846,7 +4868,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lposix4 $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 4850 "configure"
+#line 4872 "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
@@ -4857,7 +4879,7 @@ int main() {
sched_yield()
; return 0; }
EOF
-if { (eval echo configure:4861: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4883: \"$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
@@ -4893,7 +4915,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 4897 "configure"
+#line 4919 "configure"
#include "confdefs.h"
#include <pthread.h>
int main() {
@@ -4902,7 +4924,7 @@ int main() {
; return 0; }
EOF
-if { (eval echo configure:4906: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4928: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
cat >> confdefs.h <<\EOF
#define PTHREAD_MUTEX_HAVE_M_COUNT 1
@@ -4914,7 +4936,7 @@ else
rm -rf conftest*
cat > conftest.$ac_ext <<EOF
-#line 4918 "configure"
+#line 4940 "configure"
#include "confdefs.h"
#include <pthread.h>
int main() {
@@ -4923,7 +4945,7 @@ int main() {
; return 0; }
EOF
-if { (eval echo configure:4927: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4949: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
cat >> confdefs.h <<\EOF
#define PTHREAD_MUTEX_HAVE___M_COUNT 1
@@ -4943,12 +4965,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:4947: checking for $ac_func" >&5
+echo "configure:4969: 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 4952 "configure"
+#line 4974 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -4971,7 +4993,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:4975: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4997: \"$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 +5024,12 @@ done
for ac_func in memmove
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:5006: checking for $ac_func" >&5
+echo "configure:5028: 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 5033 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -5030,7 +5052,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:5056: \"$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
@@ -5060,12 +5082,12 @@ done
for ac_func in memcpy
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:5064: checking for $ac_func" >&5
+echo "configure:5086: 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 5069 "configure"
+#line 5091 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -5088,7 +5110,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:5092: \"$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_func_$ac_func=yes"
else
@@ -5117,7 +5139,7 @@ done
fi
echo $ac_n "checking for dlopen in -ldl""... $ac_c" 1>&6
-echo "configure:5121: checking for dlopen in -ldl" >&5
+echo "configure:5143: 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
@@ -5125,7 +5147,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-ldl $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 5129 "configure"
+#line 5151 "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
@@ -5136,7 +5158,7 @@ int main() {
dlopen()
; return 0; }
EOF
-if { (eval echo configure:5140: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5162: \"$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
@@ -5181,7 +5203,7 @@ fi
#--------------------------------------------------------------------
echo $ac_n "checking for socket libraries""... $ac_c" 1>&6
-echo "configure:5185: checking for socket libraries" >&5
+echo "configure:5207: 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
@@ -5189,12 +5211,12 @@ else
gcj_checkBoth=0
unset ac_cv_func_connect
echo $ac_n "checking for connect""... $ac_c" 1>&6
-echo "configure:5193: checking for connect" >&5
+echo "configure:5215: 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 5198 "configure"
+#line 5220 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char connect(); below. */
@@ -5217,7 +5239,7 @@ connect();
; return 0; }
EOF
-if { (eval echo configure:5221: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5243: \"$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
@@ -5240,7 +5262,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:5244: checking for main in -lsocket" >&5
+echo "configure:5266: 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
@@ -5248,14 +5270,14 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lsocket $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 5252 "configure"
+#line 5274 "configure"
#include "confdefs.h"
int main() {
main()
; return 0; }
EOF
-if { (eval echo configure:5259: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5281: \"$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
@@ -5282,12 +5304,12 @@ fi
LIBS="$LIBS -lsocket -lnsl"
unset ac_cv_func_accept
echo $ac_n "checking for accept""... $ac_c" 1>&6
-echo "configure:5286: checking for accept" >&5
+echo "configure:5308: 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 5291 "configure"
+#line 5313 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char accept(); below. */
@@ -5310,7 +5332,7 @@ accept();
; return 0; }
EOF
-if { (eval echo configure:5314: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5336: \"$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
@@ -5337,12 +5359,12 @@ fi
gcj_oldLibs=$LIBS
LIBS="$LIBS $gcj_cv_lib_sockets"
echo $ac_n "checking for gethostbyname""... $ac_c" 1>&6
-echo "configure:5341: checking for gethostbyname" >&5
+echo "configure:5363: 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 5346 "configure"
+#line 5368 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char gethostbyname(); below. */
@@ -5365,7 +5387,7 @@ gethostbyname();
; return 0; }
EOF
-if { (eval echo configure:5369: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5391: \"$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
@@ -5383,7 +5405,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:5387: checking for main in -lnsl" >&5
+echo "configure:5409: 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
@@ -5391,14 +5413,14 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lnsl $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 5395 "configure"
+#line 5417 "configure"
#include "confdefs.h"
int main() {
main()
; return 0; }
EOF
-if { (eval echo configure:5402: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5424: \"$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
@@ -5430,7 +5452,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:5434: checking for deflate in -lz" >&5
+echo "configure:5456: 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
@@ -5438,7 +5460,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lz $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 5442 "configure"
+#line 5464 "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
@@ -5449,7 +5471,7 @@ int main() {
deflate()
; return 0; }
EOF
-if { (eval echo configure:5453: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5475: \"$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
@@ -5476,7 +5498,7 @@ fi
# requires -ldl.
if test "$GC" = boehm; then
echo $ac_n "checking for main in -ldl""... $ac_c" 1>&6
-echo "configure:5480: checking for main in -ldl" >&5
+echo "configure:5502: 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
@@ -5484,14 +5506,14 @@ else
ac_save_LIBS="$LIBS"
LIBS="-ldl $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 5488 "configure"
+#line 5510 "configure"
#include "confdefs.h"
int main() {
main()
; return 0; }
EOF
-if { (eval echo configure:5495: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5517: \"$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
@@ -5557,7 +5579,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:5561: checking for $ac_word" >&5
+echo "configure:5583: 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
@@ -5589,7 +5611,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:5593: checking for $ac_word" >&5
+echo "configure:5615: 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
@@ -5651,13 +5673,13 @@ exec 5>>./config.log
CPPFLAGS=$GCJ_SAVE_CPPFLAGS
echo $ac_n "checking size of void *""... $ac_c" 1>&6
-echo "configure:5655: checking size of void *" >&5
+echo "configure:5677: 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 5661 "configure"
+#line 5683 "configure"
#include "confdefs.h"
#include "confdefs.h"
#include <sys/types.h>
@@ -5667,7 +5689,7 @@ int main() {
switch (0) case 0: case (sizeof (void *) == $ac_size):;
; return 0; }
EOF
-if { (eval echo configure:5671: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5693: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_sizeof_void_p=$ac_size
else
@@ -5711,6 +5733,7 @@ fi
+
if test "$CANADIAN" = yes; then
CANADIAN_TRUE=
CANADIAN_FALSE='#'
@@ -5738,15 +5761,6 @@ else
fi
-if test -z "$with_cross_host"; then
- USE_LIBDIR_TRUE=
- USE_LIBDIR_FALSE='#'
-else
- USE_LIBDIR_TRUE='#'
- USE_LIBDIR_FALSE=
-fi
-
-
if test "$NEEDS_DATA_START" = yes && test "$NATIVE" = yes; then
NEEDS_DATA_START_TRUE=
NEEDS_DATA_START_FALSE='#'
@@ -5756,6 +5770,19 @@ else
fi
+if test -n "$with_cross_host" &&
+ test x"$with_cross_host" != x"no"; then
+ toolexecdir='$(exec_prefix)/$(target_alias)'
+ toolexecmainlibdir='$(toolexecdir)/lib'
+else
+ toolexecdir='$(libdir)/gcc-lib/$(target_alias)'
+ toolexecmainlibdir='$(libdir)'
+fi
+toolexeclibdir=$toolexecmainlibdir/`$CC -print-multi-os-directory`
+
+
+
+
# Determine gcj version number.
gcjversion=`$GCJ -v 2>&1 | sed -n 's/^.*version \([^ ]*\).*$/\1/p'`
@@ -5768,18 +5795,18 @@ EOF
echo $ac_n "checking for g++ -ffloat-store bug""... $ac_c" 1>&6
-echo "configure:5772: checking for g++ -ffloat-store bug" >&5
+echo "configure:5799: checking for g++ -ffloat-store bug" >&5
save_CFLAGS="$CFLAGS"
CFLAGS="-x c++ -O2 -ffloat-store"
cat > conftest.$ac_ext <<EOF
-#line 5776 "configure"
+#line 5803 "configure"
#include "confdefs.h"
#include <math.h>
int main() {
; return 0; }
EOF
-if { (eval echo configure:5783: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5810: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
echo "$ac_t""no" 1>&6
else
@@ -5799,17 +5826,17 @@ for ac_hdr in unistd.h bstring.h sys/time.h sys/types.h fcntl.h sys/ioctl.h sys/
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:5803: checking for $ac_hdr" >&5
+echo "configure:5830: 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 5808 "configure"
+#line 5835 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:5813: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:5840: \"$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*
@@ -5839,17 +5866,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:5843: checking for $ac_hdr" >&5
+echo "configure:5870: 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 5848 "configure"
+#line 5875 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:5853: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:5880: \"$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*
@@ -5879,17 +5906,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:5883: checking for $ac_hdr" >&5
+echo "configure:5910: 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 5888 "configure"
+#line 5915 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:5893: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:5920: \"$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*
@@ -5925,12 +5952,12 @@ fi
done
echo $ac_n "checking for sys/wait.h that is POSIX.1 compatible""... $ac_c" 1>&6
-echo "configure:5929: checking for sys/wait.h that is POSIX.1 compatible" >&5
+echo "configure:5956: 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 5934 "configure"
+#line 5961 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <sys/wait.h>
@@ -5946,7 +5973,7 @@ wait (&s);
s = WIFEXITED (s) ? WEXITSTATUS (s) : 1;
; return 0; }
EOF
-if { (eval echo configure:5950: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5977: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_header_sys_wait_h=yes
else
@@ -5968,12 +5995,12 @@ fi
echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
-echo "configure:5972: checking for ANSI C header files" >&5
+echo "configure:5999: 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 5977 "configure"
+#line 6004 "configure"
#include "confdefs.h"
#include <stdlib.h>
#include <stdarg.h>
@@ -5981,7 +6008,7 @@ else
#include <float.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:5985: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:6012: \"$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*
@@ -5998,7 +6025,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 6002 "configure"
+#line 6029 "configure"
#include "confdefs.h"
#include <string.h>
EOF
@@ -6016,7 +6043,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 6020 "configure"
+#line 6047 "configure"
#include "confdefs.h"
#include <stdlib.h>
EOF
@@ -6037,7 +6064,7 @@ if test "$cross_compiling" = yes; then
:
else
cat > conftest.$ac_ext <<EOF
-#line 6041 "configure"
+#line 6068 "configure"
#include "confdefs.h"
#include <ctype.h>
#define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
@@ -6048,7 +6075,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2);
exit (0); }
EOF
-if { (eval echo configure:6052: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:6079: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
:
else
@@ -6072,12 +6099,12 @@ EOF
fi
echo $ac_n "checking for ssize_t""... $ac_c" 1>&6
-echo "configure:6076: checking for ssize_t" >&5
+echo "configure:6103: 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 6081 "configure"
+#line 6108 "configure"
#include "confdefs.h"
#include <sys/types.h>
#if STDC_HEADERS
@@ -6106,9 +6133,9 @@ fi
echo $ac_n "checking for in_addr_t""... $ac_c" 1>&6
-echo "configure:6110: checking for in_addr_t" >&5
+echo "configure:6137: checking for in_addr_t" >&5
cat > conftest.$ac_ext <<EOF
-#line 6112 "configure"
+#line 6139 "configure"
#include "confdefs.h"
#include <sys/types.h>
#if STDC_HEADERS
@@ -6122,7 +6149,7 @@ int main() {
in_addr_t foo;
; return 0; }
EOF
-if { (eval echo configure:6126: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:6153: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
cat >> confdefs.h <<\EOF
#define HAVE_IN_ADDR_T 1
@@ -6138,16 +6165,16 @@ fi
rm -f conftest*
echo $ac_n "checking whether struct ip_mreq is in netinet/in.h""... $ac_c" 1>&6
-echo "configure:6142: checking whether struct ip_mreq is in netinet/in.h" >&5
+echo "configure:6169: checking whether struct ip_mreq is in netinet/in.h" >&5
cat > conftest.$ac_ext <<EOF
-#line 6144 "configure"
+#line 6171 "configure"
#include "confdefs.h"
#include <netinet/in.h>
int main() {
struct ip_mreq mreq;
; return 0; }
EOF
-if { (eval echo configure:6151: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:6178: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
cat >> confdefs.h <<\EOF
#define HAVE_STRUCT_IP_MREQ 1
@@ -6163,16 +6190,16 @@ fi
rm -f conftest*
echo $ac_n "checking whether struct ipv6_mreq is in netinet/in.h""... $ac_c" 1>&6
-echo "configure:6167: checking whether struct ipv6_mreq is in netinet/in.h" >&5
+echo "configure:6194: checking whether struct ipv6_mreq is in netinet/in.h" >&5
cat > conftest.$ac_ext <<EOF
-#line 6169 "configure"
+#line 6196 "configure"
#include "confdefs.h"
#include <netinet/in.h>
int main() {
struct ipv6_mreq mreq6;
; return 0; }
EOF
-if { (eval echo configure:6176: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:6203: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
cat >> confdefs.h <<\EOF
#define HAVE_STRUCT_IPV6_MREQ 1
@@ -6188,16 +6215,16 @@ fi
rm -f conftest*
echo $ac_n "checking whether struct sockaddr_in6 is in netinet/in.h""... $ac_c" 1>&6
-echo "configure:6192: checking whether struct sockaddr_in6 is in netinet/in.h" >&5
+echo "configure:6219: checking whether struct sockaddr_in6 is in netinet/in.h" >&5
cat > conftest.$ac_ext <<EOF
-#line 6194 "configure"
+#line 6221 "configure"
#include "confdefs.h"
#include <netinet/in.h>
int main() {
struct sockaddr_in6 addr6;
; return 0; }
EOF
-if { (eval echo configure:6201: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:6228: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
cat >> confdefs.h <<\EOF
#define HAVE_INET6 1
@@ -6213,9 +6240,9 @@ fi
rm -f conftest*
echo $ac_n "checking for socklen_t in sys/socket.h""... $ac_c" 1>&6
-echo "configure:6217: checking for socklen_t in sys/socket.h" >&5
+echo "configure:6244: checking for socklen_t in sys/socket.h" >&5
cat > conftest.$ac_ext <<EOF
-#line 6219 "configure"
+#line 6246 "configure"
#include "confdefs.h"
#define _POSIX_PII_SOCKET
#include <sys/types.h>
@@ -6224,7 +6251,7 @@ int main() {
socklen_t x = 5;
; return 0; }
EOF
-if { (eval echo configure:6228: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:6255: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
cat >> confdefs.h <<\EOF
#define HAVE_SOCKLEN_T 1
@@ -6240,16 +6267,16 @@ fi
rm -f conftest*
echo $ac_n "checking for tm_gmtoff in struct tm""... $ac_c" 1>&6
-echo "configure:6244: checking for tm_gmtoff in struct tm" >&5
+echo "configure:6271: checking for tm_gmtoff in struct tm" >&5
cat > conftest.$ac_ext <<EOF
-#line 6246 "configure"
+#line 6273 "configure"
#include "confdefs.h"
#include <time.h>
int main() {
struct tm tim; tim.tm_gmtoff = 0;
; return 0; }
EOF
-if { (eval echo configure:6253: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:6280: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
cat >> confdefs.h <<\EOF
#define STRUCT_TM_HAS_GMTOFF 1
@@ -6262,16 +6289,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:6266: checking for global timezone variable" >&5
+echo "configure:6293: checking for global timezone variable" >&5
cat > conftest.$ac_ext <<EOF
-#line 6268 "configure"
+#line 6295 "configure"
#include "confdefs.h"
#include <time.h>
int main() {
void i(){long z2 = 2*timezone;}
; return 0; }
EOF
-if { (eval echo configure:6275: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:6302: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
cat >> confdefs.h <<\EOF
#define HAVE_TIMEZONE 1
@@ -6284,16 +6311,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:6288: checking for global _timezone variable" >&5
+echo "configure:6315: checking for global _timezone variable" >&5
cat > conftest.$ac_ext <<EOF
-#line 6290 "configure"
+#line 6317 "configure"
#include "confdefs.h"
#include <time.h>
int main() {
long z2 = _timezone;
; return 0; }
EOF
-if { (eval echo configure:6297: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:6324: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
cat >> confdefs.h <<\EOF
#define HAVE_UNDERSCORE_TIMEZONE 1
@@ -6315,19 +6342,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:6319: checking for working alloca.h" >&5
+echo "configure:6346: 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 6324 "configure"
+#line 6351 "configure"
#include "confdefs.h"
#include <alloca.h>
int main() {
char *p = alloca(2 * sizeof(int));
; return 0; }
EOF
-if { (eval echo configure:6331: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6358: \"$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
@@ -6348,12 +6375,12 @@ EOF
fi
echo $ac_n "checking for alloca""... $ac_c" 1>&6
-echo "configure:6352: checking for alloca" >&5
+echo "configure:6379: 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 6357 "configure"
+#line 6384 "configure"
#include "confdefs.h"
#ifdef __GNUC__
@@ -6381,7 +6408,7 @@ int main() {
char *p = (char *) alloca(1);
; return 0; }
EOF
-if { (eval echo configure:6385: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6412: \"$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
@@ -6413,12 +6440,12 @@ EOF
echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6
-echo "configure:6417: checking whether alloca needs Cray hooks" >&5
+echo "configure:6444: 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 6422 "configure"
+#line 6449 "configure"
#include "confdefs.h"
#if defined(CRAY) && ! defined(CRAY2)
webecray
@@ -6443,12 +6470,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:6447: checking for $ac_func" >&5
+echo "configure:6474: 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 6452 "configure"
+#line 6479 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -6471,7 +6498,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:6475: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6502: \"$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
@@ -6498,7 +6525,7 @@ done
fi
echo $ac_n "checking stack direction for C alloca""... $ac_c" 1>&6
-echo "configure:6502: checking stack direction for C alloca" >&5
+echo "configure:6529: 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
@@ -6506,7 +6533,7 @@ else
ac_cv_c_stack_direction=0
else
cat > conftest.$ac_ext <<EOF
-#line 6510 "configure"
+#line 6537 "configure"
#include "confdefs.h"
find_stack_direction ()
{
@@ -6525,7 +6552,7 @@ main ()
exit (find_stack_direction() < 0);
}
EOF
-if { (eval echo configure:6529: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:6556: \"$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
@@ -6552,7 +6579,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:6556: checking for $ac_word" >&5
+echo "configure:6583: 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
@@ -6609,7 +6636,7 @@ case "${host}" in
SIGNAL_HANDLER=include/s390-signal.h
;;
x86_64*-*-linux*)
- SIGNAL_HANDLER=include/dwarf2-signal.h
+ SIGNAL_HANDLER=include/x86_64-signal.h
;;
sparc*-*-linux*)
SIGNAL_HANDLER=include/dwarf2-signal.h
@@ -6627,6 +6654,15 @@ if test "$enable_sjlj_exceptions" = yes; then
SIGNAL_HANDLER=include/default-signal.h
fi
+# Define here any compiler flags that you need in order to make backtrace() work.
+BACKTRACESPEC=
+case "${host}" in
+ x86_64*-*-linux*)
+ BACKTRACESPEC=-fno-omit-frame-pointer
+ ;;
+esac
+
+
@@ -6642,7 +6678,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:6646: checking for X" >&5
+echo "configure:6682: checking for X" >&5
# Check whether --with-x or --without-x was given.
if test "${with_x+set}" = set; then
@@ -6704,12 +6740,12 @@ if test "$ac_x_includes" = NO; then
# First, try using that file with no special directory specified.
cat > conftest.$ac_ext <<EOF
-#line 6708 "configure"
+#line 6744 "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:6713: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:6749: \"$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*
@@ -6778,14 +6814,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 6782 "configure"
+#line 6818 "configure"
#include "confdefs.h"
int main() {
${x_direct_test_function}()
; return 0; }
EOF
-if { (eval echo configure:6789: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6825: \"$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.
@@ -6891,17 +6927,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:6895: checking whether -R must be followed by a space" >&5
+echo "configure:6931: 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 6898 "configure"
+#line 6934 "configure"
#include "confdefs.h"
int main() {
; return 0; }
EOF
-if { (eval echo configure:6905: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6941: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
ac_R_nospace=yes
else
@@ -6917,14 +6953,14 @@ rm -f conftest*
else
LIBS="$ac_xsave_LIBS -R $x_libraries"
cat > conftest.$ac_ext <<EOF
-#line 6921 "configure"
+#line 6957 "configure"
#include "confdefs.h"
int main() {
; return 0; }
EOF
-if { (eval echo configure:6928: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6964: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
ac_R_space=yes
else
@@ -6956,7 +6992,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:6960: checking for dnet_ntoa in -ldnet" >&5
+echo "configure:6996: 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
@@ -6964,7 +7000,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-ldnet $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 6968 "configure"
+#line 7004 "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
@@ -6975,7 +7011,7 @@ int main() {
dnet_ntoa()
; return 0; }
EOF
-if { (eval echo configure:6979: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:7015: \"$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
@@ -6997,7 +7033,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:7001: checking for dnet_ntoa in -ldnet_stub" >&5
+echo "configure:7037: 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
@@ -7005,7 +7041,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-ldnet_stub $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 7009 "configure"
+#line 7045 "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
@@ -7016,7 +7052,7 @@ int main() {
dnet_ntoa()
; return 0; }
EOF
-if { (eval echo configure:7020: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:7056: \"$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
@@ -7045,12 +7081,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:7049: checking for gethostbyname" >&5
+echo "configure:7085: 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 7054 "configure"
+#line 7090 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char gethostbyname(); below. */
@@ -7073,7 +7109,7 @@ gethostbyname();
; return 0; }
EOF
-if { (eval echo configure:7077: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:7113: \"$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
@@ -7094,7 +7130,7 @@ fi
if test $ac_cv_func_gethostbyname = no; then
echo $ac_n "checking for gethostbyname in -lnsl""... $ac_c" 1>&6
-echo "configure:7098: checking for gethostbyname in -lnsl" >&5
+echo "configure:7134: 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
@@ -7102,7 +7138,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lnsl $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 7106 "configure"
+#line 7142 "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
@@ -7113,7 +7149,7 @@ int main() {
gethostbyname()
; 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:7153: \"$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
@@ -7143,12 +7179,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:7147: checking for connect" >&5
+echo "configure:7183: 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 7152 "configure"
+#line 7188 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char connect(); below. */
@@ -7171,7 +7207,7 @@ connect();
; return 0; }
EOF
-if { (eval echo configure:7175: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:7211: \"$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
@@ -7192,7 +7228,7 @@ fi
if test $ac_cv_func_connect = no; then
echo $ac_n "checking for connect in -lsocket""... $ac_c" 1>&6
-echo "configure:7196: checking for connect in -lsocket" >&5
+echo "configure:7232: 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
@@ -7200,7 +7236,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lsocket $X_EXTRA_LIBS $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 7204 "configure"
+#line 7240 "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
@@ -7211,7 +7247,7 @@ int main() {
connect()
; return 0; }
EOF
-if { (eval echo configure:7215: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:7251: \"$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
@@ -7235,12 +7271,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:7239: checking for remove" >&5
+echo "configure:7275: 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 7244 "configure"
+#line 7280 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char remove(); below. */
@@ -7263,7 +7299,7 @@ remove();
; return 0; }
EOF
-if { (eval echo configure:7267: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:7303: \"$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
@@ -7284,7 +7320,7 @@ fi
if test $ac_cv_func_remove = no; then
echo $ac_n "checking for remove in -lposix""... $ac_c" 1>&6
-echo "configure:7288: checking for remove in -lposix" >&5
+echo "configure:7324: 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
@@ -7292,7 +7328,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lposix $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 7296 "configure"
+#line 7332 "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
@@ -7303,7 +7339,7 @@ int main() {
remove()
; return 0; }
EOF
-if { (eval echo configure:7307: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:7343: \"$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
@@ -7327,12 +7363,12 @@ fi
# BSDI BSD/OS 2.1 needs -lipc for XOpenDisplay.
echo $ac_n "checking for shmat""... $ac_c" 1>&6
-echo "configure:7331: checking for shmat" >&5
+echo "configure:7367: 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 7336 "configure"
+#line 7372 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char shmat(); below. */
@@ -7355,7 +7391,7 @@ shmat();
; return 0; }
EOF
-if { (eval echo configure:7359: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:7395: \"$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
@@ -7376,7 +7412,7 @@ fi
if test $ac_cv_func_shmat = no; then
echo $ac_n "checking for shmat in -lipc""... $ac_c" 1>&6
-echo "configure:7380: checking for shmat in -lipc" >&5
+echo "configure:7416: 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
@@ -7384,7 +7420,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lipc $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 7388 "configure"
+#line 7424 "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
@@ -7395,7 +7431,7 @@ int main() {
shmat()
; return 0; }
EOF
-if { (eval echo configure:7399: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:7435: \"$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
@@ -7428,7 +7464,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:7432: checking for IceConnectionNumber in -lICE" >&5
+echo "configure:7468: 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
@@ -7436,7 +7472,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lICE $X_EXTRA_LIBS $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 7440 "configure"
+#line 7476 "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
@@ -7447,7 +7483,7 @@ int main() {
IceConnectionNumber()
; return 0; }
EOF
-if { (eval echo configure:7451: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:7487: \"$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
@@ -7756,20 +7792,23 @@ s%@ZINCS@%$ZINCS%g
s%@DIVIDESPEC@%$DIVIDESPEC%g
s%@CHECKREFSPEC@%$CHECKREFSPEC%g
s%@EXCEPTIONSPEC@%$EXCEPTIONSPEC%g
+s%@IEEESPEC@%$IEEESPEC%g
s%@CANADIAN_TRUE@%$CANADIAN_TRUE%g
s%@CANADIAN_FALSE@%$CANADIAN_FALSE%g
s%@NULL_TARGET_TRUE@%$NULL_TARGET_TRUE%g
s%@NULL_TARGET_FALSE@%$NULL_TARGET_FALSE%g
s%@NATIVE_TRUE@%$NATIVE_TRUE%g
s%@NATIVE_FALSE@%$NATIVE_FALSE%g
-s%@USE_LIBDIR_TRUE@%$USE_LIBDIR_TRUE%g
-s%@USE_LIBDIR_FALSE@%$USE_LIBDIR_FALSE%g
s%@NEEDS_DATA_START_TRUE@%$NEEDS_DATA_START_TRUE%g
s%@NEEDS_DATA_START_FALSE@%$NEEDS_DATA_START_FALSE%g
s%@GCC_UNWIND_INCLUDE@%$GCC_UNWIND_INCLUDE%g
+s%@toolexecdir@%$toolexecdir%g
+s%@toolexecmainlibdir@%$toolexecmainlibdir%g
+s%@toolexeclibdir@%$toolexeclibdir%g
s%@GCJVERSION@%$GCJVERSION%g
s%@ALLOCA@%$ALLOCA%g
s%@PERL@%$PERL%g
+s%@BACKTRACESPEC@%$BACKTRACESPEC%g
s%@SYSDEP_SOURCES@%$SYSDEP_SOURCES%g
s%@X_CFLAGS@%$X_CFLAGS%g
s%@X_PRE_LIBS@%$X_PRE_LIBS%g
@@ -8044,6 +8083,7 @@ CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
libgcj_basedir=${libgcj_basedir}
CC="${CC}"
CXX="${CXX}"
+ORIGINAL_LD_FOR_MULTILIBS="${ORIGINAL_LD_FOR_MULTILIBS}"
EOF
cat >> $CONFIG_STATUS <<\EOF
diff --git a/libjava/configure.host b/libjava/configure.host
index f5d1ef07cda..7f3b69fb772 100644
--- a/libjava/configure.host
+++ b/libjava/configure.host
@@ -96,20 +96,21 @@ case "${host}" in
slow_pthread_self=yes
;;
x86_64-*)
+ CHECKREFSPEC="%{m32:-fcheck-references}"
sysdeps_dir=x86-64
- libgcj_flags="${libgcj_flags} -ffloat-store"
- libgcj_interpreter=no
+ libgcj_flags="${libgcj_flags} -ffloat-store -fno-omit-frame-pointer"
libgcj_cxxflags="-D__NO_MATH_INLINES"
libgcj_cflags="-D__NO_MATH_INLINES"
- DIVIDESPEC=-fno-use-divide-subroutine
enable_hash_synchronization_default=yes
slow_pthread_self=yes
+ libgcj_interpreter=yes
;;
alpha*-*)
sysdeps_dir=alpha
libgcj_flags="${libgcj_flags} -mieee"
libgcj_interpreter=yes
enable_hash_synchronization_default=yes
+ IEEESPEC=-mieee
;;
powerpc64*-*)
# libffi not ported.
@@ -132,7 +133,8 @@ case "${host}" in
libgcj_interpreter=yes
enable_hash_synchronization_default=yes
;;
- sparc-*)
+ sparc*-*)
+ libgcj_interpreter=yes
;;
ia64-*)
sysdeps_dir=ia64
@@ -167,6 +169,7 @@ case "${host}" in
*-*-darwin*)
enable_hash_synchronization_default=no
slow_pthread_self=
+ can_unwind_signal=no
;;
*-*-freebsd*)
slow_pthread_self=
diff --git a/libjava/configure.in b/libjava/configure.in
index 59f821accce..c9a7b699a9c 100644
--- a/libjava/configure.in
+++ b/libjava/configure.in
@@ -522,6 +522,13 @@ else
AC_DEFINE(HAVE_BACKTRACE)
;;
esac
+ ], [
+ case "$host" in
+ *mingw*)
+ # Has backtrace() defined in libgcj itself
+ AC_DEFINE(HAVE_BACKTRACE)
+ ;;
+ esac
])
AC_CHECK_LIB(dl, dladdr, [
@@ -785,14 +792,27 @@ AC_SUBST(ZINCS)
AC_SUBST(DIVIDESPEC)
AC_SUBST(CHECKREFSPEC)
AC_SUBST(EXCEPTIONSPEC)
+AC_SUBST(IEEESPEC)
AM_CONDITIONAL(CANADIAN, test "$CANADIAN" = yes)
AM_CONDITIONAL(NULL_TARGET, test "$NULL_TARGET" = yes)
AM_CONDITIONAL(NATIVE, test "$NATIVE" = yes || test "$NULL_TARGET" = yes)
-AM_CONDITIONAL(USE_LIBDIR, test -z "$with_cross_host")
AM_CONDITIONAL(NEEDS_DATA_START, test "$NEEDS_DATA_START" = yes && test "$NATIVE" = yes)
AC_SUBST(GCC_UNWIND_INCLUDE)
+if test -n "$with_cross_host" &&
+ test x"$with_cross_host" != x"no"; then
+ toolexecdir='$(exec_prefix)/$(target_alias)'
+ toolexecmainlibdir='$(toolexecdir)/lib'
+else
+ toolexecdir='$(libdir)/gcc-lib/$(target_alias)'
+ toolexecmainlibdir='$(libdir)'
+fi
+toolexeclibdir=$toolexecmainlibdir/`$CC -print-multi-os-directory`
+AC_SUBST(toolexecdir)
+AC_SUBST(toolexecmainlibdir)
+AC_SUBST(toolexeclibdir)
+
# Determine gcj version number.
changequote(<<,>>)
gcjversion=`$GCJ -v 2>&1 | sed -n 's/^.*version \([^ ]*\).*$/\1/p'`
@@ -916,7 +936,7 @@ case "${host}" in
SIGNAL_HANDLER=include/s390-signal.h
;;
x86_64*-*-linux*)
- SIGNAL_HANDLER=include/dwarf2-signal.h
+ SIGNAL_HANDLER=include/x86_64-signal.h
;;
sparc*-*-linux*)
SIGNAL_HANDLER=include/dwarf2-signal.h
@@ -934,6 +954,15 @@ if test "$enable_sjlj_exceptions" = yes; then
SIGNAL_HANDLER=include/default-signal.h
fi
+# Define here any compiler flags that you need in order to make backtrace() work.
+BACKTRACESPEC=
+case "${host}" in
+ x86_64*-*-linux*)
+ BACKTRACESPEC=-fno-omit-frame-pointer
+ ;;
+esac
+AC_SUBST(BACKTRACESPEC)
+
AC_SUBST(SYSDEP_SOURCES)
AC_LINK_FILES($SIGNAL_HANDLER, include/java-signal.h)
@@ -1027,4 +1056,5 @@ CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
libgcj_basedir=${libgcj_basedir}
CC="${CC}"
CXX="${CXX}"
+ORIGINAL_LD_FOR_MULTILIBS="${ORIGINAL_LD_FOR_MULTILIBS}"
)
diff --git a/libjava/defineclass.cc b/libjava/defineclass.cc
index dc350028cdd..81de5ad7da2 100644
--- a/libjava/defineclass.cc
+++ b/libjava/defineclass.cc
@@ -890,7 +890,7 @@ _Jv_ClassReader::handleClassBegin
throw_no_class_def_found_error (msg);
}
- def->accflags = access_flags;
+ def->accflags = access_flags | java::lang::reflect::Modifier::INTERPRETED;
pool_data[this_class].clazz = def;
pool_tags[this_class] = JV_CONSTANT_ResolvedClass;
diff --git a/libjava/gcj/Makefile.in b/libjava/gcj/Makefile.in
index 201722f80ca..51b97ac8964 100644
--- a/libjava/gcj/Makefile.in
+++ b/libjava/gcj/Makefile.in
@@ -65,6 +65,7 @@ target_alias = @target_alias@
target_triplet = @target@
AR = @AR@
AS = @AS@
+BACKTRACESPEC = @BACKTRACESPEC@
CC = @CC@
CHECKREFSPEC = @CHECKREFSPEC@
COMPPATH = @COMPPATH@
@@ -129,6 +130,9 @@ here = @here@
libgcj_basedir = @libgcj_basedir@
mkinstalldirs = @mkinstalldirs@
tool_include_dir = @tool_include_dir@
+toolexecdir = @toolexecdir@
+toolexeclibdir = @toolexeclibdir@
+toolexecmainlibdir = @toolexecmainlibdir@
AUTOMAKE_OPTIONS = foreign
diff --git a/libjava/gcj/javaprims.h b/libjava/gcj/javaprims.h
index 8ed649432a2..e2840731ed0 100644
--- a/libjava/gcj/javaprims.h
+++ b/libjava/gcj/javaprims.h
@@ -120,6 +120,7 @@ extern "Java"
class SyncFailedException;
class UTFDataFormatException;
class UnsupportedEncodingException;
+ class VMObjectStreamClass;
class ValidatorAndPriority;
class WriteAbortedException;
class Writer;
@@ -230,16 +231,18 @@ extern "Java"
class Array;
class Constructor;
class Field;
- class InvocationHandler;
+ class InvocationHandler;
class InvocationTargetException;
class Member;
class Method;
class Modifier;
- class Proxy;
- class Proxy$ProxyData;
- class Proxy$ProxyType;
+ class Proxy;
+ class Proxy$ClassFactory;
+ class Proxy$ProxyData;
+ class Proxy$ProxySignature;
+ class Proxy$ProxyType;
class ReflectPermission;
- class UndeclaredThrowableException;
+ class UndeclaredThrowableException;
};
};
@@ -334,7 +337,6 @@ extern "Java"
class RandomAccess;
class RandomAccessSubList;
class ResourceBundle;
- class ResourceBundle$Security;
class Set;
class SimpleTimeZone;
class SortedMap;
@@ -371,6 +373,13 @@ extern "Java"
class Manifest;
};
+ namespace regex
+ {
+ class Matcher;
+ class Pattern;
+ class PatternSyntaxException;
+ };
+
namespace zip
{
class Adler32;
diff --git a/libjava/gnu/awt/j2d/DirectRasterGraphics.java b/libjava/gnu/awt/j2d/DirectRasterGraphics.java
index 8d25b88d018..28aad9b0404 100644
--- a/libjava/gnu/awt/j2d/DirectRasterGraphics.java
+++ b/libjava/gnu/awt/j2d/DirectRasterGraphics.java
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000 Free Software Foundation
+/* Copyright (C) 2000, 2003 Free Software Foundation
This file is part of libgcj.
@@ -61,7 +61,8 @@ public interface DirectRasterGraphics extends Cloneable
public void drawPolygon(int[] xPoints, int[] yPoints, int nPoints);
- public void fillPolygon(int[] xPoints, int[] yPoints, int nPoints);
+ public void fillPolygon(int[] xPoints, int[] yPoints, int nPoints,
+ int translateX, int translateY);
public void drawString(String str, int x, int y);
diff --git a/libjava/gnu/awt/j2d/Graphics2DImpl.java b/libjava/gnu/awt/j2d/Graphics2DImpl.java
index ef4d742c056..5af41bfc9cb 100644
--- a/libjava/gnu/awt/j2d/Graphics2DImpl.java
+++ b/libjava/gnu/awt/j2d/Graphics2DImpl.java
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000, 2002 Free Software Foundation
+/* Copyright (C) 2000, 2002, 2003 Free Software Foundation
This file is part of libgcj.
@@ -24,6 +24,7 @@ import java.awt.Stroke;
import java.awt.geom.AffineTransform;
import java.awt.image.ImageObserver;
import java.awt.image.BufferedImage;
+import java.awt.image.BufferedImageOp;
import java.awt.image.RenderedImage;
import java.awt.image.renderable.RenderableImage;
import java.text.AttributedCharacterIterator;
@@ -459,7 +460,7 @@ public class Graphics2DImpl extends Graphics2D implements Cloneable
throw new UnsupportedOperationException(msg);
}
- public void drawImage(BufferedImage image, BufferedImage op, int x, int y)
+ public void drawImage(BufferedImage image, BufferedImageOp op, int x, int y)
{
throw new UnsupportedOperationException("not implemented yet");
}
diff --git a/libjava/gnu/awt/j2d/IntegerGraphicsState.java b/libjava/gnu/awt/j2d/IntegerGraphicsState.java
index 90a1a4d2ab5..bfea6611ca5 100644
--- a/libjava/gnu/awt/j2d/IntegerGraphicsState.java
+++ b/libjava/gnu/awt/j2d/IntegerGraphicsState.java
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000 Free Software Foundation
+/* Copyright (C) 2000, 2003 Free Software Foundation
This file is part of libgcj.
@@ -212,7 +212,7 @@ public class IntegerGraphicsState extends AbstractGraphicsState
public void drawPolyline(int[] xPoints, int[] yPoints, int nPoints)
{
- if ((tx == 0) || (ty == 0))
+ if ((tx == 0) && (ty == 0))
{
directGfx.drawPolyline(xPoints, yPoints, nPoints);
return;
@@ -223,7 +223,7 @@ public class IntegerGraphicsState extends AbstractGraphicsState
public void drawPolygon(int[] xPoints, int[] yPoints, int nPoints)
{
- if ((tx == 0) || (ty == 0))
+ if ((tx == 0) && (ty == 0))
{
directGfx.drawPolygon(xPoints, yPoints, nPoints);
return;
@@ -232,15 +232,11 @@ public class IntegerGraphicsState extends AbstractGraphicsState
throw new UnsupportedOperationException("translate not implemented");
}
- public void fillPolygon(int[] xPoints, int[] yPoints, int nPoints)
+ public void fillPolygon (int[] xPoints, int[] yPoints, int nPoints)
{
- if ((tx == 0) || (ty == 0))
- {
- directGfx.fillPolygon(xPoints, yPoints, nPoints);
- return;
- }
-
- throw new UnsupportedOperationException("translate not implemented");
+ // FIXME: remove tx & ty args once translation via AffineTransform
+ // is implemented.
+ directGfx.fillPolygon (xPoints, yPoints, nPoints, tx, ty);
}
public boolean drawImage(Image image, int x, int y,
diff --git a/libjava/gnu/awt/xlib/XGraphics.java b/libjava/gnu/awt/xlib/XGraphics.java
index 27b07a2369a..90f53880e85 100644
--- a/libjava/gnu/awt/xlib/XGraphics.java
+++ b/libjava/gnu/awt/xlib/XGraphics.java
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000 Free Software Foundation
+/* Copyright (C) 2000, 2003 Free Software Foundation
This file is part of libgcj.
@@ -176,10 +176,10 @@ public class XGraphics implements Cloneable, DirectRasterGraphics
throw new UnsupportedOperationException("not implemented");
}
- public void fillPolygon(int[] xPoints, int[] yPoints, int
- nPoints)
+ public void fillPolygon(int[] xPoints, int[] yPoints, int nPoints,
+ int translateX, int translateY)
{
- throw new UnsupportedOperationException("not implemented");
+ context.fillPolygon(xPoints, yPoints, nPoints, translateX, translateY);
}
public void drawString(String str, int x, int y)
diff --git a/libjava/gnu/awt/xlib/XGraphicsConfiguration.java b/libjava/gnu/awt/xlib/XGraphicsConfiguration.java
index 9ae12d6f8b9..7d7d5159fe0 100644
--- a/libjava/gnu/awt/xlib/XGraphicsConfiguration.java
+++ b/libjava/gnu/awt/xlib/XGraphicsConfiguration.java
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000 Free Software Foundation
+/* Copyright (C) 2000, 2003 Free Software Foundation
This file is part of libgcj.
@@ -389,15 +389,32 @@ public class XGraphicsConfiguration extends GraphicsConfiguration
int getPixel(Color color)
{
+ /* FIXME: consider an integer technique whenever
+ * the ColorModel is 8 bits per color.
+ * The problem with using integers is that it doesn't work unless
+ * the colors are 8 bits each (as in the array), since ColorModel.getDataElement(int[],int)
+ * expects non-normalized values. For example, in a 16-bit display mode, you
+ * would typically have 5 bits each for red and blue, and 6 bits for green.
int[] components =
- {
- color.getRed(),
- color.getGreen(),
- color.getBlue(),
- 0xff
- };
-
- ColorModel cm = getColorModel();
- return cm.getDataElement(components, 0);
+ {
+ color.getRed (),
+ color.getGreen (),
+ color.getBlue (),
+ 0xff
+ };
+ */
+
+ float[] normalizedComponents =
+ {
+ ((float)color.getRed ()) / 255F,
+ ((float)color.getGreen ()) / 255F,
+ ((float)color.getBlue ()) / 255F,
+ 1
+ };
+ int[] unnormalizedComponents = { 0, 0, 0, 0xff };
+ ColorModel cm = getColorModel ();
+ cm.getUnnormalizedComponents(normalizedComponents, 0,
+ unnormalizedComponents, 0);
+ return cm.getDataElement (unnormalizedComponents, 0);
}
}
diff --git a/libjava/gnu/awt/xlib/XToolkit.java b/libjava/gnu/awt/xlib/XToolkit.java
index 0c199b2b7f7..c71b39d0f80 100644
--- a/libjava/gnu/awt/xlib/XToolkit.java
+++ b/libjava/gnu/awt/xlib/XToolkit.java
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000, 2002 Free Software Foundation
+/* Copyright (C) 2000, 2002, 2003 Free Software Foundation
This file is part of libgcj.
@@ -173,7 +173,7 @@ public class XToolkit extends Toolkit
public java.awt.image.ColorModel getColorModel()
{
- throw new UnsupportedOperationException("not implemented yet");
+ return getDefaultXGraphicsConfiguration().getColorModel();
}
public String[] getFontList()
diff --git a/libjava/gnu/gcj/protocol/http/Connection.java b/libjava/gnu/gcj/protocol/http/Connection.java
index caababa6823..1a6fc0105f9 100644
--- a/libjava/gnu/gcj/protocol/http/Connection.java
+++ b/libjava/gnu/gcj/protocol/http/Connection.java
@@ -1,6 +1,6 @@
// Connection.java - Implementation of HttpURLConnection for http protocol.
-/* Copyright (C) 1999, 2000 Free Software Foundation
+/* Copyright (C) 1999, 2000, 2003 Free Software Foundation
This file is part of libgcj.
@@ -25,10 +25,11 @@ 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: Minimal subset of functionality. Proxies and Redirects
- * not yet handled. FileNameMap handling needs to be considered.
- * useCaches, ifModifiedSince, and allowUserInteraction need
- * consideration as well as doInput and doOutput.
+ * Status: Minimal subset of functionality. Proxies only partially
+ * handled; Redirects not yet handled. FileNameMap handling needs to
+ * be considered. useCaches, ifModifiedSince, and
+ * allowUserInteraction need consideration as well as doInput and
+ * doOutput.
*/
class Connection extends HttpURLConnection
@@ -40,6 +41,33 @@ class Connection extends HttpURLConnection
private Vector hdrVec = new Vector();
private BufferedInputStream bufferedIn;
+ private static int proxyPort = 80;
+ private static boolean proxyInUse = false;
+ private static String proxyHost = null;
+
+ static
+ {
+ // Recognize some networking properties listed at
+ // http://java.sun.com/j2se/1.4/docs/guide/net/properties.html.
+ String port = null;
+ proxyHost = System.getProperty("http.proxyHost");
+ if (proxyHost != null)
+ {
+ proxyInUse = true;
+ if ((port = System.getProperty("http.proxyPort")) != null)
+ {
+ try
+ {
+ proxyPort = Integer.parseInt(port);
+ }
+ catch (Throwable t)
+ {
+ // Nothing.
+ }
+ }
+ }
+ }
+
public Connection(URL url)
{
super(url);
@@ -85,12 +113,20 @@ class Connection extends HttpURLConnection
// Get address and port number.
int port;
- InetAddress destAddr = InetAddress.getByName(url.getHost());
- if ((port = url.getPort()) == -1)
- port = 80;
+ if (proxyInUse)
+ {
+ port = proxyPort;
+ sock = new Socket(proxyHost, port);
+ }
+ else
+ {
+ InetAddress destAddr = InetAddress.getByName(url.getHost());
+ if ((port = url.getPort()) == -1)
+ port = 80;
+ // Open socket and output stream.
+ sock = new Socket(destAddr, port);
+ }
- // Open socket and output stream.
- sock = new Socket(destAddr, port);
PrintWriter out = new PrintWriter(sock.getOutputStream());
// Send request including any request properties that were set.
@@ -123,10 +159,9 @@ class Connection extends HttpURLConnection
}
}
- // TODO: public boolean usingProxy()
public boolean usingProxy()
{
- return false;
+ return proxyInUse;
}
// Override default method in URLConnection.
diff --git a/libjava/gnu/gcj/runtime/NameFinder.java b/libjava/gnu/gcj/runtime/NameFinder.java
index 1d729d252ac..4089411e84b 100644
--- a/libjava/gnu/gcj/runtime/NameFinder.java
+++ b/libjava/gnu/gcj/runtime/NameFinder.java
@@ -371,7 +371,7 @@ public class NameFinder
int line = -1;
if (fileName != null)
{
- int colon = file.indexOf(':');
+ int colon = file.lastIndexOf(':');
if (colon > 0)
{
fileName = file.substring(0, colon);
diff --git a/libjava/gnu/gcj/runtime/natStackTrace.cc b/libjava/gnu/gcj/runtime/natStackTrace.cc
index e977f356638..d39cd00dbab 100644
--- a/libjava/gnu/gcj/runtime/natStackTrace.cc
+++ b/libjava/gnu/gcj/runtime/natStackTrace.cc
@@ -1,6 +1,6 @@
// natStackTrace.cc - native helper methods for Throwable
-/* Copyright (C) 2000, 2002 Free Software Foundation, Inc
+/* Copyright (C) 2000, 2002, 2003 Free Software Foundation, Inc
This file is part of libgcj.
@@ -16,6 +16,7 @@ details. */
*/
#include <config.h>
+#include <platform.h>
#include <string.h>
diff --git a/libjava/gnu/gcj/xlib/GC.java b/libjava/gnu/gcj/xlib/GC.java
index 6b33715cf6c..1806c2ae569 100644
--- a/libjava/gnu/gcj/xlib/GC.java
+++ b/libjava/gnu/gcj/xlib/GC.java
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000 Free Software Foundation
+/* Copyright (C) 2000, 2003 Free Software Foundation
This file is part of libgcj.
@@ -84,6 +84,8 @@ public class GC implements Cloneable
public native void drawRectangle(int x, int y, int w, int h);
public native void fillRectangle(int x, int y, int w, int h);
+ public native void fillPolygon(int[] xPoints, int[] yPoints, int nPoints,
+ int translateX, int translateY);
/**
*
diff --git a/libjava/gnu/gcj/xlib/natGC.cc b/libjava/gnu/gcj/xlib/natGC.cc
index 66de35f868b..1a1bd586d8e 100644
--- a/libjava/gnu/gcj/xlib/natGC.cc
+++ b/libjava/gnu/gcj/xlib/natGC.cc
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000 Free Software Foundation
+/* Copyright (C) 2000, 2003 Free Software Foundation
This file is part of libgcj.
@@ -11,6 +11,7 @@ details. */
#include <X11/Xlib.h>
#include <gcj/cni.h>
+#include <gcj/array.h>
#include <gnu/gcj/RawData.h>
#include <java/lang/String.h>
#include <java/awt/Rectangle.h>
@@ -154,6 +155,27 @@ void gnu::gcj::xlib::GC::fillRectangle(jint x, jint y, jint w, jint h)
// no fast fail
}
+void gnu::gcj::xlib::GC::fillPolygon(jintArray xPoints, jintArray yPoints,
+ jint nPoints,
+ jint translateX, jint translateY)
+{
+ Display* display = target->getDisplay();
+ ::Display* dpy = (::Display*) (display->display);
+ ::Drawable drawableXID = target->getXID();
+ ::GC gc = (::GC) structure;
+ typedef ::XPoint xpoint;
+ std::vector<xpoint> points(nPoints+1);
+ for (int i=0; i<nPoints; i++)
+ {
+ points[i].x = elements(xPoints)[i] + translateX;
+ points[i].y = elements(yPoints)[i] + translateY;
+ }
+ points[nPoints] = points[0];
+ XFillPolygon(dpy, drawableXID, gc, &(points.front()), nPoints,
+ Complex, CoordModeOrigin);
+ // no fast fail
+}
+
void gnu::gcj::xlib::GC::clearArea(jint x, jint y, jint w, jint h,
jboolean exposures)
{
diff --git a/libjava/gnu/java/nio/ByteBufferImpl.java b/libjava/gnu/java/nio/ByteBufferImpl.java
index 54fba2492e1..19783e57807 100644
--- a/libjava/gnu/java/nio/ByteBufferImpl.java
+++ b/libjava/gnu/java/nio/ByteBufferImpl.java
@@ -43,37 +43,35 @@ import java.nio.DoubleBuffer;
import java.nio.FloatBuffer;
import java.nio.IntBuffer;
import java.nio.LongBuffer;
+import java.nio.ReadOnlyBufferException;
import java.nio.ShortBuffer;
+/**
+ * This is a Heap memory implementation
+ */
public final class ByteBufferImpl extends ByteBuffer
{
- private byte[] backing_buffer;
- private int array_offset;
- private boolean ro;
-
+ private boolean readOnly;
+
public ByteBufferImpl (int cap, int off, int lim)
{
- this.cap = cap;
- limit (lim);
- position (off);
- this.backing_buffer = new byte[cap];
+ super (cap, lim, off, 0);
+ this.backing_buffer = new byte [cap];
+ readOnly = false;
}
public ByteBufferImpl (byte[] array, int off, int lim)
{
- this.cap = array.length;
- limit (lim);
- position (off);
+ super (array.length, lim, off, 0);
this.backing_buffer = array;
+ readOnly = false;
}
public ByteBufferImpl (ByteBufferImpl copy)
{
- this.cap = copy.capacity ();
- limit (copy.limit ());
- position (copy.position ());
- ro = copy.ro;
+ super (copy.capacity (), copy.limit (), copy.position (), 0);
backing_buffer = copy.backing_buffer;
+ readOnly = copy.isReadOnly ();
}
void inc_pos (int toAdd)
@@ -89,52 +87,140 @@ public final class ByteBufferImpl extends ByteBuffer
private static native byte[] nio_cast(float[]copy);
private static native byte[] nio_cast(double[]copy);
+ ByteBufferImpl (byte[] copy)
+ {
+ super (copy.length, copy.length, 0, 0);
+ this.backing_buffer = copy != null ? nio_cast (copy) : null;
+ readOnly = false;
+ }
- 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; }
+ 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 (char[] copy)
+ {
+ super (copy.length * 2, copy.length * 2, 0, 0);
+ this.backing_buffer = copy != null ? nio_cast (copy) : null;
+ readOnly = false;
+ }
- 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; }
+ private static native char nio_get_Char (ByteBufferImpl b, int index, int limit);
- 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; }
+ private static native void nio_put_Char (ByteBufferImpl b, int index, int limit, char value);
- 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; }
+ public CharBuffer asCharBuffer ()
+ {
+ CharBufferImpl res = new CharBufferImpl (backing_buffer);
+ res.limit ((limit () * 2) / 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 (short[] copy)
+ {
+ super (copy.length, copy.length, 0, 0);
+ this.backing_buffer = copy != null ? nio_cast (copy) : null;
+ readOnly = false;
+ }
+
+ 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(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; }
+ ByteBufferImpl (int[] copy)
+ {
+ super (copy.length * 4, copy.length * 4, 0, 0);
+ this.backing_buffer = copy != null ? nio_cast(copy) : null;
+ readOnly = false;
+ }
+
+ 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)
+ {
+ super (copy.length * 8, copy.length * 8, 0, 0);
+ this.backing_buffer = copy != null ? nio_cast (copy) : null;
+ readOnly = false;
+ }
+
+ 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)
+ {
+ super (copy.length * 4, copy.length * 4, 0, 0);
+ this.backing_buffer = copy != null ? nio_cast (copy) : null;
+ readOnly = false;
+ }
+
+ 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)
+ {
+ super (copy.length * 8, copy.length * 8, 0, 0);
+ this.backing_buffer = copy != null ? nio_cast (copy) : null;
+ readOnly = false;
+ }
+
+ 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;
+ return readOnly;
}
public ByteBuffer slice()
{
- ByteBufferImpl A = new ByteBufferImpl(this);
- A.array_offset = position();
- return A;
+ return new ByteBufferImpl(this);
}
public ByteBuffer duplicate()
@@ -145,7 +231,7 @@ public final class ByteBufferImpl extends ByteBuffer
public ByteBuffer asReadOnlyBuffer()
{
ByteBufferImpl a = new ByteBufferImpl(this);
- a.ro = true;
+ a.readOnly = true;
return a;
}
@@ -156,7 +242,7 @@ public final class ByteBufferImpl extends ByteBuffer
public boolean isDirect()
{
- return backing_buffer != null;
+ return false;
}
final public byte get()
@@ -168,6 +254,9 @@ public final class ByteBufferImpl extends ByteBuffer
final public ByteBuffer put(byte b)
{
+ if (readOnly)
+ throw new ReadOnlyBufferException ();
+
backing_buffer[position()] = b;
position(position()+1);
return this;
@@ -180,14 +269,201 @@ public final class ByteBufferImpl extends ByteBuffer
final public ByteBuffer put(int index, byte b)
{
+ if (readOnly)
+ throw new ReadOnlyBufferException ();
+
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; };
+ final public char getChar ()
+ {
+ char a = nio_get_Char (this, position (), limit ());
+ inc_pos (2);
+ return a;
+ }
+
+ final public ByteBuffer putChar (char value)
+ {
+ if (readOnly)
+ throw new ReadOnlyBufferException ();
+
+ 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)
+ {
+ if (readOnly)
+ throw new ReadOnlyBufferException ();
+
+ 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)
+ {
+ if (readOnly)
+ throw new ReadOnlyBufferException ();
+
+ 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)
+ {
+ if (readOnly)
+ throw new ReadOnlyBufferException ();
+
+ 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)
+ {
+ if (readOnly)
+ throw new ReadOnlyBufferException ();
+
+ 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)
+ {
+ if (readOnly)
+ throw new ReadOnlyBufferException ();
+
+ 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)
+ {
+ if (readOnly)
+ throw new ReadOnlyBufferException ();
+
+ 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)
+ {
+ if (readOnly)
+ throw new ReadOnlyBufferException ();
+
+ 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)
+ {
+ if (readOnly)
+ throw new ReadOnlyBufferException ();
+
+ 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)
+ {
+ if (readOnly)
+ throw new ReadOnlyBufferException ();
+
+ 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)
+ {
+ if (readOnly)
+ throw new ReadOnlyBufferException ();
+
+ nio_put_Double (this, position(), limit (), value);
+ inc_pos (8);
+ return this;
+ }
+
+ final public double getDouble (int index)
+ {
+ return nio_get_Double (this, index, limit ());
+ }
+
+ final public ByteBuffer putDouble (int index, double value)
+ {
+ if (readOnly)
+ throw new ReadOnlyBufferException ();
+
+ 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
index 399dd6096b8..07a96fe9c36 100644
--- a/libjava/gnu/java/nio/CharBufferImpl.java
+++ b/libjava/gnu/java/nio/CharBufferImpl.java
@@ -40,101 +40,65 @@ 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;
+import java.nio.ReadOnlyBufferException;
+/**
+ * This is a Heap memory implementation
+ */
public final class CharBufferImpl extends CharBuffer
{
- private boolean ro;
+ private boolean readOnly;
- 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);
+ super (cap, lim, off, 0);
+ this.backing_buffer = new char [cap];
+ readOnly = false;
}
public CharBufferImpl(char[] array, int off, int lim)
{
+ super (array.length, lim, off, 0);
this.backing_buffer = array;
- this.cap = array.length;
- this.limit(lim);
- this.position(off);
+ readOnly = false;
}
public CharBufferImpl (CharBufferImpl copy)
{
+ super (copy.capacity (), copy.limit (), copy.position (), 0);
backing_buffer = copy.backing_buffer;
- ro = copy.ro;
- limit (copy.limit());
- position (copy.position ());
+ readOnly = copy.isReadOnly ();
}
- void inc_pos (int a)
+ private static native char[] nio_cast (byte[] copy);
+
+ CharBufferImpl (byte[] copy)
{
- position (position () + a);
+ super (copy.length / 2, copy.length / 2, 0, 0);
+ this.backing_buffer = (copy != null ? nio_cast (copy) : null);
+ readOnly = false;
}
- 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; }
+ private static native byte nio_get_Byte (CharBufferImpl b, int index, int limit);
- 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; }
+ private static native void nio_put_Byte (CharBufferImpl b, int index, int limit, byte value);
- 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 ByteBuffer asByteBuffer ()
+ {
+ ByteBufferImpl res = new ByteBufferImpl (backing_buffer);
+ res.limit ((limit () * 1) / 2);
+ return res;
+ }
public boolean isReadOnly()
{
- return ro;
+ return readOnly;
}
public CharBuffer slice()
{
- CharBufferImpl buffer = new CharBufferImpl (this);
- buffer.array_offset = position ();
- return buffer;
+ return new CharBufferImpl (this);
}
public CharBuffer duplicate()
@@ -144,9 +108,9 @@ public final class CharBufferImpl extends CharBuffer
public CharBuffer asReadOnlyBuffer()
{
- CharBufferImpl a = new CharBufferImpl(this);
- a.ro = true;
- return a;
+ CharBufferImpl result = new CharBufferImpl (this);
+ result.readOnly = true;
+ return result;
}
public CharBuffer compact()
@@ -156,7 +120,7 @@ public final class CharBufferImpl extends CharBuffer
public boolean isDirect()
{
- return backing_buffer != null;
+ return false;
}
final public CharSequence subSequence (int start, int end)
@@ -172,6 +136,9 @@ public final class CharBufferImpl extends CharBuffer
position () + end);
}
+ /**
+ * Relative get method. Reads the next character from the buffer.
+ */
final public char get()
{
char e = backing_buffer[position()];
@@ -179,27 +146,54 @@ public final class CharBufferImpl extends CharBuffer
return e;
}
+ /**
+ * Relative put method. Writes <code>value</code> to the next position
+ * in the buffer.
+ *
+ * @exception ReadOnlyBufferException If this buffer is read-only.
+ */
final public CharBuffer put(char b)
{
+ if (readOnly)
+ throw new ReadOnlyBufferException ();
+
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; };
+ /**
+ * Absolute get method. Reads the character at position <code>index</code>.
+ *
+ * @exception IndexOutOfBoundsException If index is negative or not smaller
+ * than the buffer's limit.
+ */
final public char get(int index)
{
+ if (index < 0
+ || index >= limit ())
+ throw new IndexOutOfBoundsException ();
+
return backing_buffer[index];
}
+ /**
+ * Absolute put method. Writes <code>value</value> to position
+ * <code>index</code> in the buffer.
+ *
+ * @exception IndexOutOfBoundsException If index is negative or not smaller
+ * than the buffer's limit.
+ * @exception ReadOnlyBufferException If this buffer is read-only.
+ */
final public CharBuffer put(int index, char b)
{
+ if (index < 0
+ || index >= limit ())
+ throw new IndexOutOfBoundsException ();
+
+ if (readOnly)
+ throw new ReadOnlyBufferException ();
+
backing_buffer[index] = b;
return this;
}
@@ -207,6 +201,6 @@ public final class CharBufferImpl extends CharBuffer
public final ByteOrder order()
{
- return endian;
+ return ByteOrder.BIG_ENDIAN;
}
}
diff --git a/libjava/gnu/java/nio/DoubleBufferImpl.java b/libjava/gnu/java/nio/DoubleBufferImpl.java
index de0e6717fd0..973487555cb 100644
--- a/libjava/gnu/java/nio/DoubleBufferImpl.java
+++ b/libjava/gnu/java/nio/DoubleBufferImpl.java
@@ -38,100 +38,66 @@ exception statement from your version. */
package gnu.java.nio;
import java.nio.ByteBuffer;
-import java.nio.CharBuffer;
+import java.nio.ByteOrder;
import java.nio.DoubleBuffer;
-import java.nio.FloatBuffer;
-import java.nio.IntBuffer;
-import java.nio.LongBuffer;
-import java.nio.ShortBuffer;
+import java.nio.ReadOnlyBufferException;
+/**
+ * This is a Heap memory implementation
+ */
public final class DoubleBufferImpl extends DoubleBuffer
{
- private int array_offset;
- private boolean ro;
+ private boolean readOnly;
public DoubleBufferImpl(int cap, int off, int lim)
{
+ super (cap, lim, off, 0);
this.backing_buffer = new double[cap];
- this.cap = cap;
- this.limit(lim);
- this.position(off);
+ readOnly = false;
}
public DoubleBufferImpl(double[] array, int off, int lim)
{
+ super (array.length, lim, off, 0);
this.backing_buffer = array;
- this.cap = array.length;
- this.limit(lim);
- this.position(off);
+ readOnly = false;
}
public DoubleBufferImpl(DoubleBufferImpl copy)
{
+ super (copy.capacity (), copy.limit (), copy.position (), 0);
backing_buffer = copy.backing_buffer;
- ro = copy.ro;
- limit(copy.limit());
- position(copy.position());
+ readOnly = copy.isReadOnly ();
}
- void inc_pos(int a)
+ DoubleBufferImpl (byte[] copy)
{
- position(position() + a);
+ super (copy.length, copy.length, 0, 0);
+ this.backing_buffer = copy != null ? nio_cast (copy) : null;
+ readOnly = false;
}
-
- 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; }
+ private static native byte nio_get_Byte (DoubleBufferImpl b, int index, int limit);
- 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; }
+ private static native void nio_put_Byte (DoubleBufferImpl b, int index, int limit, byte value);
- 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; }
+ public ByteBuffer asByteBuffer ()
+ {
+ ByteBufferImpl res = new ByteBufferImpl (backing_buffer);
+ res.limit ((limit () * 1) / 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);
+ private static native double[] nio_cast (byte[] copy);
- public boolean isReadOnly()
+ public boolean isReadOnly ()
{
- return ro;
+ return readOnly;
}
- public DoubleBuffer slice()
+ public DoubleBuffer slice ()
{
- DoubleBufferImpl A = new DoubleBufferImpl(this);
- A.array_offset = position();
- return A;
+ return new DoubleBufferImpl (this);
}
public DoubleBuffer duplicate()
@@ -141,9 +107,9 @@ public final class DoubleBufferImpl extends DoubleBuffer
public DoubleBuffer asReadOnlyBuffer()
{
- DoubleBufferImpl a = new DoubleBufferImpl(this);
- a.ro = true;
- return a;
+ DoubleBufferImpl result = new DoubleBufferImpl (this);
+ result.readOnly = true;
+ return result;
}
public DoubleBuffer compact()
@@ -153,7 +119,7 @@ public final class DoubleBufferImpl extends DoubleBuffer
public boolean isDirect()
{
- return backing_buffer != null;
+ return false;
}
final public double get()
@@ -165,6 +131,9 @@ public final class DoubleBufferImpl extends DoubleBuffer
final public DoubleBuffer put(double b)
{
+ if (readOnly)
+ throw new ReadOnlyBufferException ();
+
backing_buffer[position()] = b;
position(position()+1);
return this;
@@ -177,14 +146,15 @@ public final class DoubleBufferImpl extends DoubleBuffer
final public DoubleBuffer put(int index, double b)
{
+ if (readOnly)
+ throw new ReadOnlyBufferException ();
+
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); };
+
+ final public ByteOrder order ()
+ {
+ return ByteOrder.BIG_ENDIAN;
+ }
}
diff --git a/libjava/gnu/java/nio/FileChannelImpl.java b/libjava/gnu/java/nio/FileChannelImpl.java
index 26b48e5e51c..31779bbc64e 100644
--- a/libjava/gnu/java/nio/FileChannelImpl.java
+++ b/libjava/gnu/java/nio/FileChannelImpl.java
@@ -44,7 +44,13 @@ import java.io.IOException;
import java.io.RandomAccessFile;
import java.nio.ByteBuffer;
import java.nio.MappedByteBuffer;
+import java.nio.channels.ClosedChannelException;
import java.nio.channels.FileChannel;
+import java.nio.channels.FileLock;
+import java.nio.channels.NonReadableChannelException;
+import java.nio.channels.NonWritableChannelException;
+import java.nio.channels.ReadableByteChannel;
+import java.nio.channels.WritableByteChannel;
/**
* This file is not user visible !
@@ -66,11 +72,7 @@ public class FileChannelImpl extends FileChannel
* 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;
- };
+ private native long lengthInternal (int native_fd) throws IOException;
public FileChannelImpl (int fd, Object obj)
{
@@ -80,39 +82,42 @@ public class FileChannelImpl extends FileChannel
public long size () throws IOException
{
+ if (!isOpen ())
+ throw new ClosedChannelException ();
+
return lengthInternal (fd);
}
- protected void implCloseChannel() throws IOException
+ protected void implCloseChannel() throws IOException
{
if (address != 0)
- {
+ {
nio_unmmap_file (fd, address, (int) length);
- }
+ address = 0;
+ }
// 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)
@@ -128,9 +133,18 @@ public class FileChannelImpl extends FileChannel
return s;
}
- public long read (ByteBuffer[] dsts) throws IOException
+ public int read (ByteBuffer dst, long position)
+ throws IOException
{
- return read (dsts, 0, dsts.length);
+ if (position < 0)
+ throw new IllegalArgumentException ();
+
+ if (!isOpen ())
+ throw new ClosedChannelException ();
+
+ // FIXME: check for NonReadableChannelException
+
+ throw new Error ("Not implemented");
}
public long read (ByteBuffer[] dsts, int offset, int length)
@@ -164,6 +178,20 @@ public class FileChannelImpl extends FileChannel
return w;
}
+ public int write (ByteBuffer src, long position)
+ throws IOException
+ {
+ if (position < 0)
+ throw new IllegalArgumentException ();
+
+ if (!isOpen ())
+ throw new ClosedChannelException ();
+
+ // FIXME: check for NonWritableChannelException
+
+ throw new Error ("Not implemented");
+ }
+
public long write(ByteBuffer[] srcs, int offset, int length)
throws IOException
{
@@ -173,13 +201,22 @@ public class FileChannelImpl extends FileChannel
{
res += write (srcs[i]);
}
- return res;
- }
+
+ return res;
+ }
public MappedByteBuffer map (FileChannel.MapMode mode, long position,
long size)
throws IOException
{
+ if ((mode != MapMode.READ_ONLY
+ && mode != MapMode.READ_WRITE
+ && mode != MapMode.PRIVATE)
+ || position < 0
+ || size < 0
+ || size > Integer.MAX_VALUE)
+ throw new IllegalArgumentException ();
+
// int cmode = mode.m;
// address = nio_mmap_file (fd, position, size, cmode);
// length = size;
@@ -208,27 +245,113 @@ public class FileChannelImpl extends FileChannel
/**
* msync with the disk
*/
- public void force (boolean metaData)
+ public void force (boolean metaData) throws IOException
{
+ if (!isOpen ())
+ throw new ClosedChannelException ();
+
+ // FIXME: What to do with metaData ?
+
nio_msync (fd, address, length);
}
-// static native long nio_mmap_file (int fd, long pos, int size, int mode);
+ public long transferTo (long position, long count, WritableByteChannel target)
+ throws IOException
+ {
+ if (position < 0
+ || count < 0)
+ throw new IllegalArgumentException ();
+
+ if (!isOpen ())
+ throw new ClosedChannelException ();
+
+ // FIXME: check for NonReadableChannelException
+ // FIXME: check for NonWritableChannelException
+
+ throw new Error ("Not implemented");
+ }
+
+ public long transferFrom (ReadableByteChannel src, long position, long count)
+ throws IOException
+ {
+ if (position < 0
+ || count < 0)
+ throw new IllegalArgumentException ();
-// static native void nio_unmmap_file (int fd, long address, int size);
+ if (!isOpen ())
+ throw new ClosedChannelException ();
-// static native void nio_msync (int fd, long address, int length);
+ // FIXME: check for NonReadableChannelException
+ // FIXME: check for NonWritableChannelException
+
+ throw new Error ("Not implemented");
+ }
- static long nio_mmap_file (int fd, long pos, int size, int mode)
+ public FileLock lock (long position, long size, boolean shared)
+ throws IOException
{
- return 0;
+ if (position < 0
+ || size < 0)
+ throw new IllegalArgumentException ();
+
+ if (!isOpen ())
+ throw new ClosedChannelException ();
+
+ // FIXME: check for NonReadableChannelException
+ // FIXME: check for NonWritableChannelException
+
+ throw new Error ("Not implemented");
}
+
+ public FileLock tryLock (long position, long size, boolean shared)
+ throws IOException
+ {
+ if (position < 0
+ || size < 0)
+ throw new IllegalArgumentException ();
+
+ if (!isOpen ())
+ throw new ClosedChannelException ();
- static void nio_unmmap_file (int fd, long address, int size)
+ throw new Error ("Not implemented");
+ }
+
+ public long position ()
+ throws IOException
+ {
+ if (!isOpen ())
+ throw new ClosedChannelException ();
+
+ throw new Error ("not implemented");
+ }
+
+ public FileChannel position (long newPosition)
+ throws IOException
{
- };
+ if (newPosition < 0)
+ throw new IllegalArgumentException ();
- static void nio_msync (int fd, long address, int length)
+ if (!isOpen ())
+ throw new ClosedChannelException ();
+
+ throw new Error ("not implemented");
+ }
+
+ public FileChannel truncate (long size)
+ throws IOException
{
- };
+ if (size < 0)
+ throw new IllegalArgumentException ();
+
+ if (!isOpen ())
+ throw new ClosedChannelException ();
+
+ // FIXME: check for NonWritableChannelException
+
+ throw new Error ("not implemented");
+ }
+
+ private static native long nio_mmap_file (int fd, long pos, int size, int mode);
+ private static native void nio_unmmap_file (int fd, long address, int size);
+ private static native void nio_msync (int fd, long address, int length);
}
diff --git a/libjava/gnu/java/nio/FileLockImpl.java b/libjava/gnu/java/nio/FileLockImpl.java
new file mode 100644
index 00000000000..2e55f6bb657
--- /dev/null
+++ b/libjava/gnu/java/nio/FileLockImpl.java
@@ -0,0 +1,63 @@
+/* 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.nio.channels.FileChannel;
+import java.nio.channels.FileLock;
+
+/**
+ * @author Michael Koch
+ */
+public class FileLockImpl extends FileLock
+{
+ public FileLockImpl (FileChannel channel, long position, long size,
+ boolean shared)
+ {
+ super (channel, position, size, shared);
+ }
+
+ public boolean isValid ()
+ {
+ throw new Error ("Not implemented");
+ }
+
+ public void release ()
+ {
+ throw new Error ("Not implemented");
+ }
+}
diff --git a/libjava/gnu/java/nio/FloatBufferImpl.java b/libjava/gnu/java/nio/FloatBufferImpl.java
index bab47425f1d..27a8deaf1c2 100644
--- a/libjava/gnu/java/nio/FloatBufferImpl.java
+++ b/libjava/gnu/java/nio/FloatBufferImpl.java
@@ -38,49 +38,49 @@ exception statement from your version. */
package gnu.java.nio;
import java.nio.ByteBuffer;
-import java.nio.CharBuffer;
-import java.nio.DoubleBuffer;
+import java.nio.ByteOrder;
import java.nio.FloatBuffer;
-import java.nio.IntBuffer;
-import java.nio.LongBuffer;
-import java.nio.ShortBuffer;
+import java.nio.ReadOnlyBufferException;
+/**
+ * This is a Heap memory implementation
+ */
public final class FloatBufferImpl extends FloatBuffer
{
- private int array_offset;
- private boolean ro;
+ private boolean readOnly;
public FloatBufferImpl(int cap, int off, int lim)
{
- this.backing_buffer = new float[cap];
- this.cap = cap;
- this.limit(lim);
- this.position(off);
+ super (cap, lim, off, 0);
+ this.backing_buffer = new float [cap];
+ readOnly = false;
}
public FloatBufferImpl(float[] array, int off, int lim)
{
+ super (array.length, lim, off, 0);
this.backing_buffer = array;
- this.cap = array.length;
- this.limit(lim);
- this.position(off);
+ readOnly = false;
}
public FloatBufferImpl(FloatBufferImpl copy)
{
+ super (copy.capacity (), copy.limit (), copy.position (), 0);
backing_buffer = copy.backing_buffer;
- ro = copy.ro;
- limit(copy.limit());
- position(copy.position());
+ readOnly = copy.isReadOnly ();
}
- void inc_pos(int a)
+ private static native float[] nio_cast (byte[] copy);
+
+ FloatBufferImpl (byte[] copy)
{
- position(position() + a);
+ super (copy.length, copy.length, 0, 0);
+ this.backing_buffer = copy != null ? nio_cast (copy) : null;
+ readOnly = false;
}
-
- 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()
@@ -90,54 +90,14 @@ public final class FloatBufferImpl extends FloatBuffer
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()
+ public boolean isReadOnly ()
{
- return ro;
+ return readOnly;
}
public FloatBuffer slice()
{
- FloatBufferImpl A = new FloatBufferImpl(this);
- A.array_offset = position();
- return A;
+ return new FloatBufferImpl (this);
}
public FloatBuffer duplicate()
@@ -147,9 +107,9 @@ public final class FloatBufferImpl extends FloatBuffer
public FloatBuffer asReadOnlyBuffer()
{
- FloatBufferImpl a = new FloatBufferImpl(this);
- a.ro = true;
- return a;
+ FloatBufferImpl result = new FloatBufferImpl (this);
+ result.readOnly = true;
+ return result;
}
public FloatBuffer compact()
@@ -159,7 +119,7 @@ public final class FloatBufferImpl extends FloatBuffer
public boolean isDirect()
{
- return backing_buffer != null;
+ return false;
}
final public float get()
@@ -171,6 +131,9 @@ public final class FloatBufferImpl extends FloatBuffer
final public FloatBuffer put(float b)
{
+ if (readOnly)
+ throw new ReadOnlyBufferException ();
+
backing_buffer[position()] = b;
position(position()+1);
return this;
@@ -183,14 +146,15 @@ public final class FloatBufferImpl extends FloatBuffer
final public FloatBuffer put(int index, float b)
{
+ if (readOnly)
+ throw new ReadOnlyBufferException ();
+
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; };
+ final public ByteOrder order ()
+ {
+ return ByteOrder.BIG_ENDIAN;
+ }
}
diff --git a/libjava/gnu/java/nio/IntBufferImpl.java b/libjava/gnu/java/nio/IntBufferImpl.java
index cccc418487c..fda2d68e00a 100644
--- a/libjava/gnu/java/nio/IntBufferImpl.java
+++ b/libjava/gnu/java/nio/IntBufferImpl.java
@@ -38,100 +38,66 @@ 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.ByteOrder;
import java.nio.IntBuffer;
-import java.nio.LongBuffer;
-import java.nio.ShortBuffer;
+import java.nio.ReadOnlyBufferException;
+/**
+ * This is a Heap memory implementation
+ */
public final class IntBufferImpl extends IntBuffer
{
- private int array_offset;
- private boolean ro;
+ private boolean readOnly;
public IntBufferImpl(int cap, int off, int lim)
{
+ super (cap, lim, off, 0);
this.backing_buffer = new int[cap];
- this.cap = cap;
- this.limit(lim);
- this.position(off);
+ readOnly = false;
}
public IntBufferImpl(int[] array, int off, int lim)
{
+ super (array.length, lim, off, 0);
this.backing_buffer = array;
- this.cap = array.length;
- this.limit(lim);
- this.position(off);
+ readOnly = false;
}
public IntBufferImpl(IntBufferImpl copy)
{
+ super (copy.capacity (), copy.limit (), copy.position (), 0);
backing_buffer = copy.backing_buffer;
- ro = copy.ro;
- limit(copy.limit());
- position(copy.position());
+ readOnly = copy.isReadOnly ();
}
- void inc_pos(int a)
+ private static native int[] nio_cast (byte[] copy);
+
+ IntBufferImpl (byte[] copy)
{
- position(position() + a);
+ super (copy.length, copy.length, 0, 0);
+ this.backing_buffer = copy != null ? nio_cast (copy) : null;
+ readOnly = false;
}
- 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; }
+ private static native byte nio_get_Byte (IntBufferImpl b, int index, int limit);
- 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 void nio_put_Byte (IntBufferImpl b, int index, int limit, byte value);
- 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 ByteBuffer asByteBuffer ()
+ {
+ ByteBufferImpl res = new ByteBufferImpl (backing_buffer);
+ res.limit ((limit () * 1) / 4);
+ return res;
+ }
public boolean isReadOnly()
{
- return ro;
+ return readOnly;
}
public IntBuffer slice()
{
- IntBufferImpl A = new IntBufferImpl(this);
- A.array_offset = position();
- return A;
+ return new IntBufferImpl (this);
}
public IntBuffer duplicate()
@@ -141,9 +107,9 @@ public final class IntBufferImpl extends IntBuffer
public IntBuffer asReadOnlyBuffer()
{
- IntBufferImpl a = new IntBufferImpl(this);
- a.ro = true;
- return a;
+ IntBufferImpl result = new IntBufferImpl (this);
+ result.readOnly = true;
+ return result;
}
public IntBuffer compact()
@@ -153,7 +119,7 @@ public final class IntBufferImpl extends IntBuffer
public boolean isDirect()
{
- return backing_buffer != null;
+ return false;
}
final public int get()
@@ -165,6 +131,9 @@ public final class IntBufferImpl extends IntBuffer
final public IntBuffer put(int b)
{
+ if (readOnly)
+ throw new ReadOnlyBufferException ();
+
backing_buffer[position()] = b;
position(position()+1);
return this;
@@ -177,14 +146,15 @@ public final class IntBufferImpl extends IntBuffer
final public IntBuffer put(int index, int b)
{
+ if (readOnly)
+ throw new ReadOnlyBufferException ();
+
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; };
+
+ final public ByteOrder order ()
+ {
+ return ByteOrder.BIG_ENDIAN;
+ }
}
diff --git a/libjava/gnu/java/nio/LongBufferImpl.java b/libjava/gnu/java/nio/LongBufferImpl.java
index 8f29b06939f..5dc4992066a 100644
--- a/libjava/gnu/java/nio/LongBufferImpl.java
+++ b/libjava/gnu/java/nio/LongBufferImpl.java
@@ -38,100 +38,66 @@ 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.ByteOrder;
import java.nio.LongBuffer;
-import java.nio.ShortBuffer;
+import java.nio.ReadOnlyBufferException;
+/**
+ * This is a Heap memory implementation
+ */
public final class LongBufferImpl extends LongBuffer
{
- private int array_offset;
- private boolean ro;
+ private boolean readOnly;
public LongBufferImpl(int cap, int off, int lim)
{
+ super (cap, lim, off, 0);
this.backing_buffer = new long[cap];
- this.cap = cap ;
- this.limit(lim);
- this.position(off);
+ readOnly = false;
}
public LongBufferImpl(long[] array, int off, int lim)
{
+ super (array.length, lim, off, 0);
this.backing_buffer = array;
- this.cap = array.length;
- this.limit(lim);
- this.position(off);
+ readOnly = false;
}
public LongBufferImpl(LongBufferImpl copy)
{
+ super (copy.capacity (), copy.limit (), copy.position (), 0);
backing_buffer = copy.backing_buffer;
- ro = copy.ro;
- limit(copy.limit());
- position(copy.position());
+ readOnly = copy.isReadOnly ();
}
- void inc_pos(int a)
+ private static native long[] nio_cast (byte[] copy);
+
+ LongBufferImpl (byte[] copy)
{
- position(position() + a);
+ super (copy.length, copy.length, 0, 0);
+ this.backing_buffer = copy != null ? nio_cast (copy) : null;
+ readOnly = false;
}
- 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; }
+ private static native byte nio_get_Byte (LongBufferImpl b, int index, int limit);
- 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; }
+ private static native void nio_put_Byte (LongBufferImpl b, int index, int limit, byte value);
- 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 ByteBuffer asByteBuffer ()
+ {
+ ByteBufferImpl res = new ByteBufferImpl (backing_buffer);
+ res.limit ((limit () * 1) / 8);
+ return res;
+ }
public boolean isReadOnly()
{
- return ro;
+ return readOnly;
}
public LongBuffer slice()
{
- LongBufferImpl A = new LongBufferImpl(this);
- A.array_offset = position();
- return A;
+ return new LongBufferImpl (this);
}
public LongBuffer duplicate()
@@ -141,9 +107,9 @@ public final class LongBufferImpl extends LongBuffer
public LongBuffer asReadOnlyBuffer()
{
- LongBufferImpl a = new LongBufferImpl(this);
- a.ro = true;
- return a;
+ LongBufferImpl result = new LongBufferImpl (this);
+ result.readOnly = true;
+ return result;
}
public LongBuffer compact()
@@ -153,7 +119,7 @@ public final class LongBufferImpl extends LongBuffer
public boolean isDirect()
{
- return backing_buffer != null;
+ return false;
}
final public long get()
@@ -165,6 +131,9 @@ public final class LongBufferImpl extends LongBuffer
final public LongBuffer put(long b)
{
+ if (readOnly)
+ throw new ReadOnlyBufferException ();
+
backing_buffer[position()] = b;
position(position()+1);
return this;
@@ -177,14 +146,15 @@ public final class LongBufferImpl extends LongBuffer
final public LongBuffer put(int index, long b)
{
+ if (readOnly)
+ throw new ReadOnlyBufferException ();
+
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; };
+ final public ByteOrder order ()
+ {
+ return ByteOrder.BIG_ENDIAN;
+ }
}
diff --git a/libjava/gnu/java/nio/SelectorProviderImpl.java b/libjava/gnu/java/nio/SelectorProviderImpl.java
index 3fedfc73546..d58e10a010e 100644
--- a/libjava/gnu/java/nio/SelectorProviderImpl.java
+++ b/libjava/gnu/java/nio/SelectorProviderImpl.java
@@ -37,6 +37,7 @@ exception statement from your version. */
package gnu.java.nio;
+import java.io.IOException;
import java.nio.channels.DatagramChannel;
import java.nio.channels.Pipe;
import java.nio.channels.ServerSocketChannel;
@@ -51,26 +52,31 @@ public class SelectorProviderImpl extends SelectorProvider
}
public DatagramChannel openDatagramChannel ()
+ throws IOException
{
return new DatagramChannelImpl (this);
}
public Pipe openPipe ()
+ throws IOException
{
return new PipeImpl ();
}
public AbstractSelector openSelector ()
+ throws IOException
{
return new SelectorImpl (this);
}
public ServerSocketChannel openServerSocketChannel ()
+ throws IOException
{
return new ServerSocketChannelImpl (this);
}
public SocketChannel openSocketChannel ()
+ throws IOException
{
return new SocketChannelImpl (this);
}
diff --git a/libjava/gnu/java/nio/ServerSocketChannelImpl.java b/libjava/gnu/java/nio/ServerSocketChannelImpl.java
index 4a51f2a4b61..039b50308d6 100644
--- a/libjava/gnu/java/nio/ServerSocketChannelImpl.java
+++ b/libjava/gnu/java/nio/ServerSocketChannelImpl.java
@@ -54,10 +54,8 @@ class ServerSocketChannelImpl extends ServerSocketChannel
boolean connected = false;
// InetSocketAddress sa;
- private static native int SocketAccept (ServerSocketChannelImpl server,
- SocketChannelImpl s);
-
protected ServerSocketChannelImpl (SelectorProvider provider)
+ throws IOException
{
super (provider);
fd = SocketChannelImpl.SocketCreate ();
@@ -86,14 +84,14 @@ class ServerSocketChannelImpl extends ServerSocketChannel
}
}
- protected void implCloseSelectableChannel ()
+ protected void implCloseSelectableChannel () throws IOException
{
connected = false;
SocketChannelImpl.SocketClose (fd);
fd = SocketChannelImpl.SocketCreate ();
}
- protected void implConfigureBlocking (boolean block)
+ protected void implConfigureBlocking (boolean block) throws IOException
{
blocking = block;
}
@@ -102,7 +100,7 @@ class ServerSocketChannelImpl extends ServerSocketChannel
{
SocketChannelImpl result = new SocketChannelImpl (provider ());
result.sa = new InetSocketAddress (0);
- int res = SocketAccept (this,result);
+ //int res = SocketAccept (this,result);
return result;
}
diff --git a/libjava/gnu/java/nio/ShortBufferImpl.java b/libjava/gnu/java/nio/ShortBufferImpl.java
index bccb2d0f65a..c55f0989ae9 100644
--- a/libjava/gnu/java/nio/ShortBufferImpl.java
+++ b/libjava/gnu/java/nio/ShortBufferImpl.java
@@ -38,100 +38,66 @@ 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.ByteOrder;
import java.nio.ShortBuffer;
+import java.nio.ReadOnlyBufferException;
+/**
+ * This is a Heap memory implementation
+ */
public final class ShortBufferImpl extends ShortBuffer
{
- private int array_offset;
- private boolean ro;
+ private boolean readOnly;
public ShortBufferImpl(int cap, int off, int lim)
{
- this.backing_buffer = new short[cap];
- this.cap = cap ;
- this.limit(lim);
- this.position(off);
+ super (cap, lim, off, 0);
+ this.backing_buffer = new short [cap];
+ readOnly = false;
}
public ShortBufferImpl(short[] array, int off, int lim)
{
+ super (array.length, lim, off, 0);
this.backing_buffer = array;
- this.cap = array.length;
- this.limit(lim);
- this.position(off);
+ readOnly = false;
}
public ShortBufferImpl(ShortBufferImpl copy)
{
+ super (copy.capacity (), copy.limit (), copy.position (), 0);
backing_buffer = copy.backing_buffer;
- ro = copy.ro;
- limit(copy.limit());
- position(copy.position());
+ readOnly = copy.isReadOnly ();
}
- void inc_pos(int a)
+ private static native short[] nio_cast (byte[] copy);
+
+ ShortBufferImpl (byte[] copy)
{
- position(position() + a);
+ super (copy.length, copy.length, 0, 0);
+ this.backing_buffer = copy != null ? nio_cast (copy) : null;
+ readOnly = false;
+ }
+
+ 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(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;
+ return readOnly;
}
public ShortBuffer slice()
{
- ShortBufferImpl a = new ShortBufferImpl(this);
- a.array_offset = position();
- return a;
+ return new ShortBufferImpl (this);
}
public ShortBuffer duplicate()
@@ -141,9 +107,9 @@ public final class ShortBufferImpl extends ShortBuffer
public ShortBuffer asReadOnlyBuffer()
{
- ShortBufferImpl a = new ShortBufferImpl(this);
- a.ro = true;
- return a;
+ ShortBufferImpl result = new ShortBufferImpl (this);
+ result.readOnly = true;
+ return result;
}
public ShortBuffer compact()
@@ -153,7 +119,7 @@ public final class ShortBufferImpl extends ShortBuffer
public boolean isDirect()
{
- return backing_buffer != null;
+ return false;
}
final public short get()
@@ -165,6 +131,9 @@ public final class ShortBufferImpl extends ShortBuffer
final public ShortBuffer put(short b)
{
+ if (readOnly)
+ throw new ReadOnlyBufferException ();
+
backing_buffer[position()] = b;
position(position()+1);
return this;
@@ -177,14 +146,15 @@ public final class ShortBufferImpl extends ShortBuffer
final public ShortBuffer put(int index, short b)
{
+ if (readOnly)
+ throw new ReadOnlyBufferException ();
+
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; };
+
+ final public ByteOrder order ()
+ {
+ return ByteOrder.BIG_ENDIAN;
+ }
}
diff --git a/libjava/gnu/java/nio/natByteBufferImpl.cc b/libjava/gnu/java/nio/natByteBufferImpl.cc
index b98b694e87b..2bb1e41a622 100644
--- a/libjava/gnu/java/nio/natByteBufferImpl.cc
+++ b/libjava/gnu/java/nio/natByteBufferImpl.cc
@@ -1,3 +1,13 @@
+// natByteBufferImpl.cc
+
+/* Copyright (C) 2002, 2003 Free Software Foundation
+
+ This file is part of libgcj.
+
+This software is copyrighted work licensed under the terms of the
+Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
+details. */
+
#include <config.h>
#include <gcj/cni.h>
diff --git a/libjava/gnu/java/nio/natCharBufferImpl.cc b/libjava/gnu/java/nio/natCharBufferImpl.cc
index 2d01a679bfa..9fb54e14561 100644
--- a/libjava/gnu/java/nio/natCharBufferImpl.cc
+++ b/libjava/gnu/java/nio/natCharBufferImpl.cc
@@ -1,3 +1,13 @@
+// natCharBufferImpl.cc
+
+/* Copyright (C) 2002, 2003 Free Software Foundation
+
+ This file is part of libgcj.
+
+This software is copyrighted work licensed under the terms of the
+Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
+details. */
+
#include <config.h>
#include <gcj/cni.h>
@@ -11,115 +21,13 @@ 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
index 53bf73db5a6..6c66a337417 100644
--- a/libjava/gnu/java/nio/natDoubleBufferImpl.cc
+++ b/libjava/gnu/java/nio/natDoubleBufferImpl.cc
@@ -1,3 +1,13 @@
+// natDoubleBufferImpl.cc
+
+/* Copyright (C) 2002, 2003 Free Software Foundation
+
+ This file is part of libgcj.
+
+This software is copyrighted work licensed under the terms of the
+Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
+details. */
+
#include <config.h>
#include <gcj/cni.h>
@@ -11,115 +21,13 @@ 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/natFileChannelImpl.cc b/libjava/gnu/java/nio/natFileChannelImpl.cc
new file mode 100644
index 00000000000..87386305bc6
--- /dev/null
+++ b/libjava/gnu/java/nio/natFileChannelImpl.cc
@@ -0,0 +1,53 @@
+// natFileChannelImpl.cc
+
+/* Copyright (C) 2003 Free Software Foundation
+
+ This file is part of libgcj.
+
+This software is copyrighted work licensed under the terms of the
+Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
+details. */
+
+#include <config.h>
+
+#include <jvm.h>
+
+#include <errno.h>
+#include <string.h>
+#include <sys/types.h>
+
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
+#ifdef HAVE_FCNTL_H
+#include <fcntl.h>
+#endif
+
+#include <gnu/java/nio/FileChannelImpl.h>
+#include <java/io/IOException.h>
+#include <java/nio/channels/FileChannel.h>
+
+jlong
+gnu::java::nio::FileChannelImpl::lengthInternal (jint fd)
+{
+ throw new ::java::io::IOException (JvNewStringUTF ("lengthInternal not implemented"));
+}
+
+jlong
+gnu::java::nio::FileChannelImpl::nio_mmap_file (jint, jlong, jint, jint)
+{
+ throw new ::java::io::IOException (JvNewStringUTF ("mmap not implemented"));
+}
+
+void
+gnu::java::nio::FileChannelImpl::nio_unmmap_file (jint, jlong, jint)
+{
+ throw new ::java::io::IOException (JvNewStringUTF ("munmap not implemented"));
+}
+
+void
+gnu::java::nio::FileChannelImpl::nio_msync (jint, jlong, jint)
+{
+ throw new ::java::io::IOException (JvNewStringUTF ("msync not implemented"));
+}
diff --git a/libjava/gnu/java/nio/natFloatBufferImpl.cc b/libjava/gnu/java/nio/natFloatBufferImpl.cc
index 2462be539f9..9785454634c 100644
--- a/libjava/gnu/java/nio/natFloatBufferImpl.cc
+++ b/libjava/gnu/java/nio/natFloatBufferImpl.cc
@@ -1,3 +1,13 @@
+// natFloatBufferImpl.cc
+
+/* Copyright (C) 2002, 2003 Free Software Foundation
+
+ This file is part of libgcj.
+
+This software is copyrighted work licensed under the terms of the
+Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
+details. */
+
#include <config.h>
#include <gcj/cni.h>
@@ -11,115 +21,13 @@ 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
index 6a14653917e..eff70f838bb 100644
--- a/libjava/gnu/java/nio/natIntBufferImpl.cc
+++ b/libjava/gnu/java/nio/natIntBufferImpl.cc
@@ -1,3 +1,13 @@
+// natIntBufferImpl.cc
+
+/* Copyright (C) 2002, 2003 Free Software Foundation
+
+ This file is part of libgcj.
+
+This software is copyrighted work licensed under the terms of the
+Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
+details. */
+
#include <config.h>
#include <gcj/cni.h>
@@ -11,115 +21,13 @@ 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
index ea21f475c61..a84248136e5 100644
--- a/libjava/gnu/java/nio/natLongBufferImpl.cc
+++ b/libjava/gnu/java/nio/natLongBufferImpl.cc
@@ -1,3 +1,13 @@
+// natLongBufferImpl.cc
+
+/* Copyright (C) 2002, 2003 Free Software Foundation
+
+ This file is part of libgcj.
+
+This software is copyrighted work licensed under the terms of the
+Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
+details. */
+
#include <config.h>
#include <gcj/cni.h>
@@ -11,115 +21,13 @@ 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/natServerSocketChannelImpl.cc b/libjava/gnu/java/nio/natServerSocketChannelImpl.cc
deleted file mode 100644
index 1f7d7fc6890..00000000000
--- a/libjava/gnu/java/nio/natServerSocketChannelImpl.cc
+++ /dev/null
@@ -1,77 +0,0 @@
-// 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
index bfcfe28a6e2..188bff9575e 100644
--- a/libjava/gnu/java/nio/natShortBufferImpl.cc
+++ b/libjava/gnu/java/nio/natShortBufferImpl.cc
@@ -1,3 +1,13 @@
+// natShortBufferImpl.cc
+
+/* Copyright (C) 2002, 2003 Free Software Foundation
+
+ This file is part of libgcj.
+
+This software is copyrighted work licensed under the terms of the
+Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
+details. */
+
#include <config.h>
#include <gcj/cni.h>
@@ -11,115 +21,13 @@ 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
index 4e6c6da3782..167ee92f140 100644
--- a/libjava/gnu/java/nio/natSocketChannelImpl.cc
+++ b/libjava/gnu/java/nio/natSocketChannelImpl.cc
@@ -38,15 +38,7 @@ 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;
+ throw new ::java::io::IOException (JvNewStringUTF ("SocketConnect not implemented"));
}
jint
@@ -54,15 +46,7 @@ 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;
+ throw new ::java::io::IOException (JvNewStringUTF ("SocketBind not implemented"));
}
jint
diff --git a/libjava/gnu/java/rmi/server/UnicastServerRef.java b/libjava/gnu/java/rmi/server/UnicastServerRef.java
index 4f64452b124..a3a999f2e9f 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, 2002 Free Software Foundation, Inc.
+ Copyright (c) 1996, 1997, 1998, 1999, 2002, 2003 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -129,7 +129,7 @@ public RemoteStub getStub(){
}
-public boolean unexportObject(Remote obj, boolean force) throws RemoteException {
+public boolean unexportObject(Remote obj, boolean force) {
// Remove all hashes of methods which may be called.
buildMethodHash(obj.getClass(), false);
return UnicastServer.unexportObject(this, force);
diff --git a/libjava/gnu/java/security/provider/SHA1PRNG.java b/libjava/gnu/java/security/provider/SHA1PRNG.java
index 669b1b55b75..97a8b9e3433 100644
--- a/libjava/gnu/java/security/provider/SHA1PRNG.java
+++ b/libjava/gnu/java/security/provider/SHA1PRNG.java
@@ -1,5 +1,5 @@
/* SHA1PRNG.java --- Secure Random SPI SHA1PRNG
- Copyright (C) 1999, 2001 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2001, 2003 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -51,27 +51,22 @@ public class SHA1PRNG extends SecureRandomSpi implements Serializable
byte data[];
int seedpos;
int datapos;
+ private boolean seeded = false; // set to true when we seed this
public SHA1PRNG()
{
try {
digest = MessageDigest.getInstance("SHA");
} catch ( NoSuchAlgorithmException nsae) {
- System.out.println("Failed to find SHA Message Digest: " + nsae);
- nsae.printStackTrace();
+// System.out.println("Failed to find SHA Message Digest: " + nsae);
+// nsae.printStackTrace();
+ throw new InternalError ("no SHA implementation found");
}
seed = new byte[20];
seedpos = 0;
data = new byte[40];
- datapos = 0;
-
- new Random().nextBytes(seed);
-
- byte digestdata[];
- digestdata = digest.digest( data );
- System.arraycopy( digestdata, 0, data, 0, 20);
-
+ datapos = 20; // try to force hashing a first block
}
public void engineSetSeed(byte[] seed)
@@ -84,6 +79,7 @@ public class SHA1PRNG extends SecureRandomSpi implements Serializable
public void engineNextBytes(byte[] bytes)
{
+ ensureIsSeeded ();
int loc = 0;
while (loc < bytes.length)
{
@@ -113,4 +109,18 @@ public class SHA1PRNG extends SecureRandomSpi implements Serializable
engineNextBytes( tmp );
return tmp;
}
+
+ private void ensureIsSeeded()
+ {
+ if (!seeded)
+ {
+ new Random(0L).nextBytes(seed);
+
+ byte[] digestdata = digest.digest(data);
+ System.arraycopy(digestdata, 0, data, 0, 20);
+
+ seeded = true;
+ }
+ }
+
}
diff --git a/libjava/include/Makefile.in b/libjava/include/Makefile.in
index 1deb2b46dc3..42c5e3f9004 100644
--- a/libjava/include/Makefile.in
+++ b/libjava/include/Makefile.in
@@ -65,6 +65,7 @@ target_alias = @target_alias@
target_triplet = @target@
AR = @AR@
AS = @AS@
+BACKTRACESPEC = @BACKTRACESPEC@
CC = @CC@
CHECKREFSPEC = @CHECKREFSPEC@
COMPPATH = @COMPPATH@
@@ -129,6 +130,9 @@ here = @here@
libgcj_basedir = @libgcj_basedir@
mkinstalldirs = @mkinstalldirs@
tool_include_dir = @tool_include_dir@
+toolexecdir = @toolexecdir@
+toolexeclibdir = @toolexeclibdir@
+toolexecmainlibdir = @toolexecmainlibdir@
AUTOMAKE_OPTIONS = foreign
diff --git a/libjava/include/config.h.in b/libjava/include/config.h.in
index cd770f93ac6..5fb650327b6 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 2.13. */
+/* include/config.h.in. Generated automatically from configure.in by autoheader. */
/* Define if using alloca.c. */
#undef C_ALLOCA
diff --git a/libjava/include/dwarf2-signal.h b/libjava/include/dwarf2-signal.h
index b996732b743..7dbcd9dfd2d 100644
--- a/libjava/include/dwarf2-signal.h
+++ b/libjava/include/dwarf2-signal.h
@@ -209,9 +209,6 @@ do \
while (0)
#endif
#elif !defined(__ia64__)
-#if defined(__x86_64__)
-#define SYS_sigaction SYS_rt_sigaction
-#endif
#define INIT_SEGV \
do \
{ \
diff --git a/libjava/include/java-interp.h b/libjava/include/java-interp.h
index a44db38ca85..a00f4db0a1d 100644
--- a/libjava/include/java-interp.h
+++ b/libjava/include/java-interp.h
@@ -21,6 +21,7 @@ details. */
#include <java/lang/Class.h>
#include <java/lang/ClassLoader.h>
+#include <java/lang/reflect/Modifier.h>
#include <gnu/gcj/runtime/StackTrace.h>
extern "C" {
@@ -30,7 +31,7 @@ extern "C" {
extern inline jboolean
_Jv_IsInterpretedClass (jclass c)
{
- return (c->loader != 0);
+ return (c->accflags & java::lang::reflect::Modifier::INTERPRETED) != 0;
}
struct _Jv_ResolvedMethod;
@@ -158,6 +159,7 @@ class _Jv_InterpClass : public java::lang::Class
friend class _Jv_ClassReader;
friend class _Jv_InterpMethod;
friend void _Jv_PrepareClass(jclass);
+ friend void _Jv_PrepareMissingMethods (jclass base2, jclass iface_class);
friend void _Jv_InitField (jobject, jclass, int);
#ifdef JV_MARKOBJ_DECL
friend JV_MARKOBJ_DECL;
diff --git a/libjava/include/posix.h b/libjava/include/posix.h
index cdcdb5d45ac..0aadd47d3b3 100644
--- a/libjava/include/posix.h
+++ b/libjava/include/posix.h
@@ -1,6 +1,6 @@
// posix.h -- Helper functions for POSIX-flavored OSs.
-/* Copyright (C) 2000, 2002 Free Software Foundation
+/* Copyright (C) 2000, 2002, 2003 Free Software Foundation
This file is part of libgcj.
@@ -60,6 +60,16 @@ _Jv_platform_close_on_exec (jint fd)
::fcntl (fd, F_SETFD, FD_CLOEXEC);
}
+#undef fcntl
+
+#ifdef JV_HASH_SYNCHRONIZATION
+inline void
+_Jv_platform_usleep (unsigned long usecs)
+{
+ usleep (usecs);
+}
+#endif /* JV_HASH_SYNCHRONIZATION */
+
#ifndef DISABLE_JAVA_NET
#ifndef HAVE_SOCKLEN_T
@@ -72,18 +82,24 @@ _Jv_socket (int domain, int type, int protocol)
return ::socket (domain, type, protocol);
}
+#undef socket
+
inline int
_Jv_connect (jint fd, sockaddr *ptr, int len)
{
return ::connect (fd, ptr, len);
}
+#undef connect
+
inline int
_Jv_close (jint fd)
{
return ::close (fd);
}
+#undef close
+
// Avoid macro definitions of bind from system headers, e.g. on
// Solaris 7 with _XOPEN_SOURCE. FIXME
inline int
@@ -92,6 +108,8 @@ _Jv_bind (int fd, struct sockaddr *addr, int addrlen)
return ::bind (fd, addr, addrlen);
}
+#undef bind
+
// Same problem with accept on Tru64 UNIX with _POSIX_PII_SOCKET
inline int
_Jv_accept (int fd, struct sockaddr *addr, socklen_t *addrlen)
@@ -99,24 +117,32 @@ _Jv_accept (int fd, struct sockaddr *addr, socklen_t *addrlen)
return ::accept (fd, addr, addrlen);
}
+#undef accept
+
inline int
_Jv_listen (int fd, int backlog)
{
return ::listen (fd, backlog);
}
+#undef listen
+
inline int
_Jv_write(int s, void *buf, int len)
{
return ::write (s, buf, len);
}
+#undef write
+
inline int
_Jv_read(int s, void *buf, int len)
{
return ::read (s, buf, len);
}
+#undef read
+
#endif /* DISABLE_JAVA_NET */
#endif /* __JV_POSIX_H__ */
diff --git a/libjava/include/win32-threads.h b/libjava/include/win32-threads.h
index e8cf80598c2..5e40ae24b87 100644
--- a/libjava/include/win32-threads.h
+++ b/libjava/include/win32-threads.h
@@ -1,7 +1,8 @@
// -*- c++ -*-
// win32-threads.h - Defines for using Win32 threads.
-/* Copyright (C) 1998, 1999, 2000 Free Software Foundation
+/* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Free Software
+ Foundation
This file is part of libgcj.
@@ -18,13 +19,32 @@ details. */
// Typedefs.
//
-typedef struct _Jv_ConditionVariable_t {
+typedef struct
+{
+ // ev[0] (signal) is a Win32 auto-reset event for _Jv_CondNotify
+ // ev[1] (broadcast) is a Win32 manual-reset event for _Jv_CondNotifyAll
HANDLE ev[2];
- CRITICAL_SECTION count_mutex;
+
+ // Number of threads waiting on this condition variable
int blocked_count;
-};
-typedef CRITICAL_SECTION _Jv_Mutex_t;
+ // Protects access to the blocked_count variable
+ CRITICAL_SECTION count_mutex;
+
+} _Jv_ConditionVariable_t;
+
+typedef struct
+{
+ // The thread-id of the owner thread if any, 0 otherwise
+ DWORD owner;
+
+ // Track nested mutex acquisitions by the same thread
+ int refcount;
+
+ // The actual Windows construct used to implement this mutex
+ CRITICAL_SECTION cs;
+
+} _Jv_Mutex_t;
typedef struct
{
@@ -60,25 +80,39 @@ int _Jv_CondNotifyAll (_Jv_ConditionVariable_t *cv, _Jv_Mutex_t *);
inline void _Jv_MutexInit (_Jv_Mutex_t *mu)
{
- InitializeCriticalSection(mu);
+ mu->owner = 0UL;
+ mu->refcount = 0;
+ InitializeCriticalSection (&(mu->cs));
}
#define _Jv_HaveMutexDestroy
inline void _Jv_MutexDestroy (_Jv_Mutex_t *mu)
{
- DeleteCriticalSection(mu);
+ mu->owner = 0UL;
+ mu->refcount = 0;
+ DeleteCriticalSection (&(mu->cs));
mu = NULL;
}
inline int _Jv_MutexUnlock (_Jv_Mutex_t *mu)
{
- LeaveCriticalSection(mu);
- return 0;
+ if (mu->owner == GetCurrentThreadId ( ))
+ {
+ mu->refcount--;
+ if (mu->refcount == 0)
+ mu->owner = 0UL;
+ LeaveCriticalSection (&(mu->cs));
+ return 0;
+ }
+ else
+ return 1;
}
inline int _Jv_MutexLock (_Jv_Mutex_t *mu)
{
- EnterCriticalSection(mu);
+ EnterCriticalSection (&(mu->cs));
+ mu->owner = GetCurrentThreadId ( );
+ mu->refcount++;
return 0;
}
@@ -104,9 +138,7 @@ inline _Jv_Thread_t *_Jv_ThreadCurrentData(void)
inline void _Jv_ThreadYield (void)
{
- // FIXME: win98 freezes hard (OS hang) when we use this --
- // for now, we simply don't yield
- // Sleep (0);
+ Sleep (0);
}
void _Jv_ThreadRegister (_Jv_Thread_t *data);
diff --git a/libjava/include/win32.h b/libjava/include/win32.h
index d4c0ab6c18d..4330c79d397 100644
--- a/libjava/include/win32.h
+++ b/libjava/include/win32.h
@@ -1,6 +1,6 @@
// win32.h -- Helper functions for Microsoft-flavored OSs.
-/* Copyright (C) 2002 Free Software Foundation
+/* Copyright (C) 2002, 2003 Free Software Foundation
This file is part of libgcj.
@@ -14,9 +14,7 @@ details. */
#include <windows.h>
#undef STRICT
-#undef __INSIDE_CYGWIN__
-#include <winsock.h>
-#define IP_TOS 3
+#include <ws2tcpip.h>
#include <gcj/cni.h>
#include <java/util/Properties.h>
@@ -48,6 +46,21 @@ _Jv_platform_close_on_exec (jint)
// Ignore.
}
+#ifdef JV_HASH_SYNCHRONIZATION
+/* Suspends the execution of the current thread for the specified
+ number of microseconds. Tries to emulate the behaviour of usleep()
+ on UNIX and provides a granularity of 1 millisecond. */
+inline void
+_Jv_platform_usleep (unsigned long usecs)
+{
+ if (usecs > 0UL)
+ {
+ unsigned long millis = ((usecs + 999UL) / 1000UL);
+ Sleep (millis);
+ }
+}
+#endif /* JV_HASH_SYNCHRONIZATION */
+
#ifndef DISABLE_JAVA_NET
static inline int
@@ -59,7 +72,7 @@ _Jv_socket (int domain, int type, int protocol)
inline int
_Jv_connect (jint fd, sockaddr *ptr, int len)
{
- return ::connect (fd, ptr, len);
+ return ::connect (fd, ptr, len);
}
inline int
@@ -100,8 +113,6 @@ _Jv_read(int s, void *buf, int len)
#endif /* DISABLE_JAVA_NET */
-#define HAVE_BACKTRACE
-
/* Store up to SIZE return address of the current program state in
ARRAY and return the exact number of values stored. */
extern int backtrace (void **__array, int __size);
diff --git a/libjava/include/x86_64-signal.h b/libjava/include/x86_64-signal.h
new file mode 100644
index 00000000000..b5bb8236f10
--- /dev/null
+++ b/libjava/include/x86_64-signal.h
@@ -0,0 +1,96 @@
+// x86_64-signal.h - Catch runtime signals and turn them into exceptions
+// on an x86_64 based GNU/Linux system.
+
+/* Copyright (C) 2003 Free Software Foundation
+
+ This file is part of libgcj.
+
+This software is copyrighted work licensed under the terms of the
+Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
+details. */
+
+
+#ifndef JAVA_SIGNAL_H
+#define JAVA_SIGNAL_H 1
+
+#include <signal.h>
+#include <sys/syscall.h>
+
+#ifdef __x86_64__
+
+#define HANDLE_SEGV 1
+
+#define SIGNAL_HANDLER(_name) \
+static void _Jv_##_name (int, siginfo_t *_sip, void *_p)
+
+extern "C"
+{
+ struct kernel_sigaction
+ {
+ void (*k_sa_sigaction)(int,siginfo_t *,void *);
+ unsigned long k_sa_flags;
+ void (*k_sa_restorer) (void);
+ sigset_t k_sa_mask;
+ };
+}
+
+#define MAKE_THROW_FRAME(_exception) \
+do \
+{ \
+ /* Advance the program counter so that it is after the start of the \
+ instruction: the x86_64 exception handler expects \
+ the PC to point to the instruction after a call. */ \
+ struct ucontext *_uc = (struct ucontext *)_p; \
+ struct sigcontext *_sc = (struct sigcontext *) &_uc->uc_mcontext; \
+ _sc->rip += 2; \
+} \
+while (0)
+
+#define RESTORE(name, syscall) RESTORE2 (name, syscall)
+#define RESTORE2(name, syscall) \
+asm \
+ ( \
+ ".byte 0 # Yes, this really is necessary\n" \
+ ".align 16\n" \
+ "__" #name ":\n" \
+ " movq $" #syscall ", %rax\n" \
+ " syscall\n" \
+ );
+
+/* The return code for realtime-signals. */
+RESTORE (restore_rt, __NR_rt_sigreturn)
+static void restore_rt (void) asm ("__restore_rt");
+
+#define INIT_SEGV \
+do \
+ { \
+ nullp = new java::lang::NullPointerException (); \
+ struct kernel_sigaction act; \
+ act.k_sa_sigaction = _Jv_catch_segv; \
+ sigemptyset (&act.k_sa_mask); \
+ act.k_sa_flags = SA_SIGINFO|0x4000000; \
+ act.k_sa_restorer = restore_rt; \
+ syscall (SYS_rt_sigaction, SIGSEGV, &act, NULL, _NSIG / 8); \
+ } \
+while (0)
+
+/* We use syscall(SYS_rt_sigaction) in INIT_SEGV instead of
+ * sigaction() because on some systems the pthreads wrappers for
+ * signal handlers are not compiled with unwind information, so it's
+ * not possible to unwind through them. This is a problem that will
+ * go away if all systems ever have pthreads libraries that are
+ * compiled with unwind info. */
+
+#else /* __x86_64__ */
+
+/* This is for the 32-bit subsystem on on x86-64. Catching signals
+ doesn't yet work on that target. */
+
+#undef HANDLE_SEGV
+#undef HANDLE_FPE
+
+#define INIT_SEGV do {} while (0)
+#define INIT_FPE do {} while (0)
+
+#endif /* __x86_64__ */
+#endif /* JAVA_SIGNAL_H */
diff --git a/libjava/java/awt/AlphaComposite.java b/libjava/java/awt/AlphaComposite.java
index 14649fc74a3..f0795a96010 100644
--- a/libjava/java/awt/AlphaComposite.java
+++ b/libjava/java/awt/AlphaComposite.java
@@ -64,6 +64,7 @@ public final class AlphaComposite implements Composite
return size() > MAX_CACHE_SIZE;
}
};
+
public static final int CLEAR = 1;
public static final int SRC = 2;
public static final int DST = 9;
@@ -88,6 +89,7 @@ public final class AlphaComposite implements Composite
public static final AlphaComposite SrcAtop = getInstance(SRC_ATOP);
public static final AlphaComposite DstAtop = getInstance(DST_ATOP);
public static final AlphaComposite Xor = getInstance(XOR);
+
private final int rule;
private final float alpha;
private AlphaComposite(int rule, float alpha)
@@ -95,10 +97,32 @@ public final class AlphaComposite implements Composite
this.rule = rule;
this.alpha = alpha;
}
+
+ /**
+ * Creates an AlphaComposite object with the specified rule.
+ *
+ * @param rule The compositing rule.
+ *
+ * @exception IllegalArgumentException If rule is not one of the following:
+ * CLEAR, SRC, DST, SRC_OVER, DST_OVER, SRC_IN, DST_IN, SRC_OUT, DST_OUT,
+ * SRC_ATOP, DST_ATOP, or XOR.
+ */
public static AlphaComposite getInstance(int rule)
{
return getInstance(rule, 1);
}
+
+ /**
+ * Creates an AlphaComposite object with the specified rule and the constant
+ * alpha to multiply with the alpha of the source. The source is multiplied
+ * with the specified alpha before being composited with the destination.
+ *
+ * @param rule The compositing rule.
+ *
+ * @exception IllegalArgumentException If rule is not one of the following:
+ * CLEAR, SRC, DST, SRC_OVER, DST_OVER, SRC_IN, DST_IN, SRC_OUT, DST_OUT,
+ * SRC_ATOP, DST_ATOP, or XOR.
+ */
public static AlphaComposite getInstance(int rule, float alpha)
{
if (rule < CLEAR || rule > XOR || ! (alpha >= 0 && alpha <= 1))
diff --git a/libjava/java/awt/BasicStroke.java b/libjava/java/awt/BasicStroke.java
index c3290336cd9..3d0a2e74506 100644
--- a/libjava/java/awt/BasicStroke.java
+++ b/libjava/java/awt/BasicStroke.java
@@ -1,5 +1,5 @@
/* BasicStroke.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2003 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -59,12 +59,31 @@ public class BasicStroke implements Stroke
private final float[] dash;
private final float phase;
+ /**
+ * Creates a basic stroke.
+ *
+ * @param width May not be negative .
+ * @param cap May be either CAP_BUTT, CAP_ROUND or CAP_SQUARE.
+ * @param join May be either JOIN_ROUND, JOIN_BEVEL, or JOIN_MITER.
+ * @param miterlimit the limit to trim the miter join. The miterlimit must be
+ * greater than or equal to 1.0f.
+ * @param dash The array representing the dashing pattern.
+ * @param dash_phase is negative and dash is not null.
+ *
+ * @exception IllegalArgumentException If one input parameter doesn't meet
+ * its needs.
+ */
public BasicStroke(float width, int cap, int join, float miterlimit,
float[] dash, float dashPhase)
{
- if (width < 0 || miterlimit < 1 || cap < CAP_BUTT || cap > CAP_SQUARE
- || join < JOIN_MITER || join > JOIN_BEVEL)
+ if (width < 0 ||
+ miterlimit < 1.0f ||
+ cap < CAP_BUTT ||
+ cap > CAP_SQUARE ||
+ join < JOIN_MITER ||
+ join > JOIN_BEVEL)
throw new IllegalArgumentException();
+
this.width = width;
this.cap = cap;
this.join = join;
@@ -73,21 +92,54 @@ public class BasicStroke implements Stroke
phase = dashPhase;
}
+ /**
+ * Creates a basic stroke.
+ *
+ * @param width The width of the BasicStroke. May not be negative .
+ * @param cap May be either CAP_BUTT, CAP_ROUND or CAP_SQUARE.
+ * @param join May be either JOIN_ROUND, JOIN_BEVEL, or JOIN_MITER.
+ * @param miterlimit the limit to trim the miter join. The miterlimit must be
+ * greater than or equal to 1.0f.
+ *
+ * @exception IllegalArgumentException If one input parameter doesn't meet
+ * its needs.
+ */
public BasicStroke(float width, int cap, int join, float miterlimit)
{
this(width, cap, join, miterlimit, null, 0);
}
+ /**
+ * Creates a basic stroke.
+ *
+ * @param width The width of the BasicStroke. May not be nehative.
+ * @param cap May be either CAP_BUTT, CAP_ROUND or CAP_SQUARE.
+ * @param join May be either JOIN_ROUND, JOIN_BEVEL, or JOIN_MITER.
+ *
+ * @exception IllegalArgumentException If one input parameter doesn't meet
+ * its needs.
+ * @exception IllegalArgumentException FIXME
+ */
public BasicStroke(float width, int cap, int join)
{
this(width, cap, join, 10, null, 0);
}
+ /**
+ * Creates a basic stroke.
+ *
+ * @param width The width of the BasicStroke.
+ *
+ * @exception IllegalArgumentException If width is negative.
+ */
public BasicStroke(float width)
{
this(width, CAP_SQUARE, JOIN_MITER, 10, null, 0);
}
+ /**
+ * Creates a basic stroke.
+ */
public BasicStroke()
{
this(1, CAP_SQUARE, JOIN_MITER, 10, null, 0);
diff --git a/libjava/java/awt/BufferCapabilities.java b/libjava/java/awt/BufferCapabilities.java
index 389594b76b5..871529e6e93 100644
--- a/libjava/java/awt/BufferCapabilities.java
+++ b/libjava/java/awt/BufferCapabilities.java
@@ -67,6 +67,11 @@ public class BufferCapabilities implements Cloneable
private final ImageCapabilities back;
private final FlipContents flip;
+ /**
+ * Creates a buffer capabilities object.
+ *
+ * @exception IllegalArgumentException If frontCaps or backCaps are null.
+ */
public BufferCapabilities(ImageCapabilities front, ImageCapabilities back,
FlipContents flip)
{
diff --git a/libjava/java/awt/Button.java b/libjava/java/awt/Button.java
index ed954ddcfda..989fbc95173 100644
--- a/libjava/java/awt/Button.java
+++ b/libjava/java/awt/Button.java
@@ -90,6 +90,9 @@ private transient ActionListener action_listeners;
/**
* Initializes a new instance of <code>Button</code> with no label.
+ *
+ * @exception HeadlessException If GraphicsEnvironment.isHeadless()
+ * returns true
*/
public
Button()
@@ -104,12 +107,18 @@ Button()
* label. The action command name is also initialized to this value.
*
* @param label The label to display on the button.
+ *
+ * @exception HeadlessException If GraphicsEnvironment.isHeadless()
+ * returns true
*/
public
Button(String label)
{
this.label = label;
actionCommand = label;
+
+ if (GraphicsEnvironment.isHeadless ())
+ throw new HeadlessException ();
}
/*************************************************************************/
@@ -211,6 +220,10 @@ removeActionListener(ActionListener listener)
/** Returns all registered EventListers of the given listenerType.
* listenerType must be a subclass of EventListener, or a
* ClassClassException is thrown.
+ *
+ * @exception ClassCastException If listenerType doesn't specify a class or
+ * interface that implements @see java.util.EventListener.
+ *
* @since 1.3
*/
public EventListener[] getListeners(Class listenerType)
diff --git a/libjava/java/awt/CardLayout.java b/libjava/java/awt/CardLayout.java
index 10ffa2ec6c2..1900a6094e2 100644
--- a/libjava/java/awt/CardLayout.java
+++ b/libjava/java/awt/CardLayout.java
@@ -1,6 +1,6 @@
// CardLayout.java - Card-based layout engine
-/* Copyright (C) 1999, 2000, 2002 Free Software Foundation
+/* Copyright (C) 1999, 2000, 2002, 2003 Free Software Foundation
This file is part of GNU Classpath.
@@ -110,7 +110,7 @@ public class CardLayout implements LayoutManager2, Serializable
*/
public void first (Container parent)
{
- gotoComponent (parent, FIRST, null);
+ gotoComponent (parent, FIRST);
}
/** Return this layout manager's horizontal gap. */
@@ -154,7 +154,7 @@ public class CardLayout implements LayoutManager2, Serializable
*/
public void last (Container parent)
{
- gotoComponent (parent, LAST, null);
+ gotoComponent (parent, LAST);
}
/**
@@ -210,7 +210,7 @@ public class CardLayout implements LayoutManager2, Serializable
*/
public void next (Container parent)
{
- gotoComponent (parent, NEXT, null);
+ gotoComponent (parent, NEXT);
}
/** Get the preferred layout size of the container.
@@ -228,7 +228,7 @@ public class CardLayout implements LayoutManager2, Serializable
*/
public void previous (Container parent)
{
- gotoComponent (parent, PREV, null);
+ gotoComponent (parent, PREV);
}
/** Remove the indicated component from this layout manager.
@@ -273,7 +273,21 @@ public class CardLayout implements LayoutManager2, Serializable
{
Object target = tab.get (name);
if (target != null)
- gotoComponent (parent, NONE, (Component) target);
+ {
+ int num = parent.ncomponents;
+ // This is more efficient than calling getComponents().
+ Component[] comps = parent.component;
+ for (int i = 0; i < num; ++i)
+ {
+ if (comps[i].isVisible())
+ {
+ if (target == comps[i])
+ return;
+ comps[i].setVisible (false);
+ }
+ }
+ ((Component) target).setVisible (true);
+ }
}
/**
@@ -286,9 +300,11 @@ public class CardLayout implements LayoutManager2, Serializable
return getClass ().getName () + "[" + hgap + "," + vgap + "]";
}
- // This implements first(), last(), next(), and previous().
- private void gotoComponent (Container parent, int what,
- Component target)
+ /** This implements first(), last(), next(), and previous().
+ * @param parent The parent container
+ * @param what The type of goto: FIRST, LAST, NEXT or PREV
+ */
+ private void gotoComponent (Container parent, int what)
{
synchronized (parent.getTreeLock ())
{
@@ -301,19 +317,9 @@ public class CardLayout implements LayoutManager2, Serializable
choice = 0;
else if (what == LAST)
choice = num - 1;
- else if (what >= 0)
- choice = what;
for (int i = 0; i < num; ++i)
{
- // If TARGET is set then we are looking for a specific
- // component.
- if (target != null)
- {
- if (target == comps[i])
- choice = i;
- }
-
if (comps[i].isVisible ())
{
if (what == NEXT)
@@ -335,7 +341,7 @@ public class CardLayout implements LayoutManager2, Serializable
return;
}
comps[i].setVisible (false);
-
+
if (choice >= 0)
break;
}
@@ -403,7 +409,6 @@ public class CardLayout implements LayoutManager2, Serializable
private int LAST = 1;
private int NEXT = 2;
private int PREV = 3;
- private int NONE = 4;
// These constants are used by the private getSize method.
private int MIN = 0;
diff --git a/libjava/java/awt/CheckboxMenuItem.java b/libjava/java/awt/CheckboxMenuItem.java
index 2f7ecd79fc5..88218397c3c 100644
--- a/libjava/java/awt/CheckboxMenuItem.java
+++ b/libjava/java/awt/CheckboxMenuItem.java
@@ -84,6 +84,9 @@ private transient ItemListener item_listeners;
/**
* Initializes a new instance of <code>CheckboxMenuItem</code> with no
* label and an initial state of off.
+ *
+ * @exception HeadlessException If GraphicsEnvironment.isHeadless()
+ * returns true.
*/
public
CheckboxMenuItem()
@@ -98,6 +101,9 @@ CheckboxMenuItem()
* specified label and an initial state of off.
*
* @param label The label of the menu item.
+ *
+ * @exception HeadlessException If GraphicsEnvironment.isHeadless()
+ * returns true.
*/
public
CheckboxMenuItem(String label)
@@ -114,12 +120,18 @@ CheckboxMenuItem(String label)
* @param label The label of the menu item.
* @param state The initial state of the menu item, where <code>true</code>
* is on, and <code>false</code> is off.
+ *
+ * @exception HeadlessException If GraphicsEnvironment.isHeadless()
+ * returns true.
*/
public
CheckboxMenuItem(String label, boolean state)
{
super(label);
this.state = state;
+
+ if (GraphicsEnvironment.isHeadless())
+ throw new HeadlessException ();
}
/*************************************************************************/
diff --git a/libjava/java/awt/Choice.java b/libjava/java/awt/Choice.java
index 81a2a31c932..4c7b505535c 100644
--- a/libjava/java/awt/Choice.java
+++ b/libjava/java/awt/Choice.java
@@ -85,13 +85,17 @@ private ItemListener item_listeners;
* Constructors
*/
-/**
- * Initializes a new instance of <code>Choice</code>.
- */
-public
-Choice()
-{
-}
+ /**
+ * Initializes a new instance of <code>Choice</code>.
+ *
+ * @exception HeadlessException If GraphicsEnvironment.isHeadless()
+ * returns true
+ */
+ public Choice()
+ {
+ if (GraphicsEnvironment.isHeadless())
+ throw new HeadlessException ();
+ }
/*************************************************************************/
@@ -146,12 +150,16 @@ getItem(int index)
* Adds the specified item to this choice box.
*
* @param item The item to add.
+ *
+ * @exception NullPointerException If the item's value is null
+ *
+ * @since 1.1
*/
public synchronized void
add(String item)
{
if (item == null)
- throw new IllegalArgumentException ("item must be non-null");
+ throw new NullPointerException ("item must be non-null");
pItems.addElement(item);
@@ -171,7 +179,12 @@ add(String item)
/**
* Adds the specified item to this choice box.
*
+ * This method is oboslete since Java 2 platform 1.1. Please use @see add
+ * instead.
+ *
* @param item The item to add.
+ *
+ * @exception NullPointerException If the item's value is equal to null
*/
public synchronized void
addItem(String item)
@@ -189,10 +202,15 @@ addItem(String item)
*
* @param item The item to add.
* @param index The index at which the item should be inserted.
+ *
+ * @exception IllegalArgumentException If index is less than 0
*/
public synchronized void
insert(String item, int index)
{
+ if (index < 0)
+ throw new IllegalArgumentException ("index may not be less then 0");
+
if (index > getItemCount ())
index = getItemCount ();
diff --git a/libjava/java/awt/Component.java b/libjava/java/awt/Component.java
index fd039116bb8..d61db055f56 100644
--- a/libjava/java/awt/Component.java
+++ b/libjava/java/awt/Component.java
@@ -1,5 +1,5 @@
/* Component.java -- a graphics component
- Copyright (C) 1999, 2000, 2001, 2002 Free Software Foundation
+ Copyright (C) 1999, 2000, 2001, 2002, 2003 Free Software Foundation
This file is part of GNU Classpath.
@@ -4168,19 +4168,26 @@ p * <li>the set of backward traversal keys
return;
Graphics gfx = getGraphics();
- Shape clip = event.getUpdateRect();
- gfx.setClip(clip);
-
- switch (event.id)
+ try
{
- case PaintEvent.PAINT:
- paint(gfx);
- break;
- case PaintEvent.UPDATE:
- update(gfx);
- break;
- default:
- throw new IllegalArgumentException("unknown paint event");
+ Shape clip = event.getUpdateRect();
+ gfx.setClip(clip);
+
+ switch (event.id)
+ {
+ case PaintEvent.PAINT:
+ paint(gfx);
+ break;
+ case PaintEvent.UPDATE:
+ update(gfx);
+ break;
+ default:
+ throw new IllegalArgumentException("unknown paint event");
+ }
+ }
+ finally
+ {
+ gfx.dispose();
}
}
diff --git a/libjava/java/awt/Container.java b/libjava/java/awt/Container.java
index dd2390d35ba..9494d8c56ac 100644
--- a/libjava/java/awt/Container.java
+++ b/libjava/java/awt/Container.java
@@ -59,7 +59,9 @@ import javax.accessibility.Accessible;
*
* @author original author unknown
* @author Eric Blake <ebb9@email.byu.edu>
+ *
* @since 1.0
+ *
* @status still missing 1.4 support
*/
public class Container extends Component
@@ -78,7 +80,9 @@ public class Container extends Component
Dimension maxSize;
- /** @since 1.4 */
+ /**
+ * @since 1.4
+ */
boolean focusCycleRoot;
int containerSerializedDataVersion;
@@ -107,6 +111,7 @@ public class Container extends Component
* Returns the number of components in this container.
*
* @return The number of components in this container.
+ *
* @deprecated use {@link #getComponentCount()} instead
*/
public int countComponents()
@@ -118,16 +123,19 @@ public class Container extends Component
* Returns the component at the specified index.
*
* @param index The index of the component to retrieve.
+ *
* @return The requested component.
+ *
* @throws ArrayIndexOutOfBoundsException If the specified index is invalid
*/
public Component getComponent(int n)
{
synchronized (getTreeLock ())
{
- if (n < 0 || n >= ncomponents)
- throw new ArrayIndexOutOfBoundsException("no such component");
- return component[n];
+ if (n < 0 || n >= ncomponents)
+ throw new ArrayIndexOutOfBoundsException("no such component");
+
+ return component[n];
}
}
@@ -140,10 +148,12 @@ public class Container extends Component
{
synchronized (getTreeLock ())
{
- Component[] result = new Component[ncomponents];
- if (ncomponents > 0)
- System.arraycopy(component, 0, result, 0, ncomponents);
- return result;
+ Component[] result = new Component[ncomponents];
+
+ if (ncomponents > 0)
+ System.arraycopy(component, 0, result, 0, ncomponents);
+
+ return result;
}
}
@@ -157,6 +167,7 @@ public class Container extends Component
{
if (peer == null)
return new Insets(0, 0, 0, 0);
+
return ((ContainerPeer) peer).getInsets();
}
@@ -177,6 +188,7 @@ public class Container extends Component
* component list.
*
* @param component The component to add to the container.
+ *
* @return The same component that was added.
*/
public Component add(Component comp)
@@ -190,7 +202,7 @@ public class Container extends Component
* component list. This method should not be used. Instead, use
* <code>add(Component, Object</code>.
*
- * @param name FIXME
+ * @param name The name of the component to be added.
* @param component The component to be added.
*
* @return The same component that was added.
@@ -268,69 +280,70 @@ public class Container extends Component
{
synchronized (getTreeLock ())
{
- 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);
- }
+ 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();
- invalidate();
+ if (comp.isLightweight())
+ enableEvents(comp.eventMask);
+ }
- if (component == null)
- component = new Component[4]; // FIXME, better initial size?
+ invalidate();
- // 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;
- }
+ if (component == null)
+ component = new Component[4]; // FIXME, better initial size?
- // 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);
- }
+ // 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;
+ }
- // Post event to notify of adding the container.
- ContainerEvent ce = new ContainerEvent(this,
- ContainerEvent.COMPONENT_ADDED,
- comp);
- getToolkit().getSystemEventQueue().postEvent(ce);
+ // 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);
}
}
@@ -343,24 +356,24 @@ public class Container extends Component
{
synchronized (getTreeLock ())
{
- Component r = component[index];
+ 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);
}
}
@@ -373,14 +386,14 @@ public class Container extends Component
{
synchronized (getTreeLock ())
{
- for (int i = 0; i < ncomponents; ++i)
- {
- if (component[i] == comp)
- {
- remove(i);
- break;
- }
- }
+ for (int i = 0; i < ncomponents; ++i)
+ {
+ if (component[i] == comp)
+ {
+ remove(i);
+ break;
+ }
+ }
}
}
@@ -391,8 +404,8 @@ public class Container extends Component
{
synchronized (getTreeLock ())
{
- while (ncomponents > 0)
- remove(0);
+ while (ncomponents > 0)
+ remove(0);
}
}
@@ -525,6 +538,7 @@ public class Container extends Component
* Returns the preferred size of this container.
*
* @return The preferred size of this container.
+ *
* @deprecated use {@link #getPreferredSize()} instead
*/
public Dimension preferredSize()
@@ -549,6 +563,7 @@ public class Container extends Component
* Returns the minimum size of this container.
*
* @return The minimum size of this container.
+ *
* @deprecated use {@link #getMinimumSize()} instead
*/
public Dimension minimumSize()
@@ -709,6 +724,10 @@ public class Container extends Component
}
/**
+ * Returns an array of all the objects currently registered as FooListeners
+ * upon this Container. FooListeners are registered using the addFooListener
+ * method.
+ *
* @since 1.3
*/
public EventListener[] getListeners(Class listenerType)
@@ -760,6 +779,7 @@ public class Container extends Component
* AWT 1.0 event processor.
*
* @param event The event that occurred.
+ *
* @deprecated use {@link #dispatchEvent(AWTEvent)} instead
*/
public void deliverEvent(Event e)
@@ -784,20 +804,20 @@ public class Container extends Component
{
synchronized (getTreeLock ())
{
- 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;
+ 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;
}
}
@@ -813,6 +833,7 @@ public class Container extends Component
*
* @return The component containing the specified point, or <code>null</code>
* if there is no such point.
+ *
* @deprecated use {@link #getComponentAt(int, int)} instead
*/
public Component locate(int x, int y)
@@ -841,31 +862,31 @@ public class Container extends Component
{
synchronized (getTreeLock ())
{
- 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];
- }
+ if (! contains(x, y))
+ return null;
- return this;
+ 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;
}
}
@@ -894,9 +915,9 @@ public class Container extends Component
{
synchronized (getTreeLock ())
{
- for (int i = 0; i < ncomponents; ++i)
- component[i].removeNotify();
- super.removeNotify();
+ for (int i = 0; i < ncomponents; ++i)
+ component[i].removeNotify();
+ super.removeNotify();
}
}
@@ -913,14 +934,14 @@ public class Container extends Component
{
synchronized (getTreeLock ())
{
- while (true)
- {
- 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();
+ }
}
}
@@ -950,9 +971,9 @@ public class Container extends Component
{
synchronized (getTreeLock ())
{
- super.list(out, indent);
- for (int i = 0; i < ncomponents; ++i)
- component[i].list(out, indent + 2);
+ super.list(out, indent);
+ for (int i = 0; i < ncomponents; ++i)
+ component[i].list(out, indent + 2);
}
}
@@ -967,62 +988,93 @@ public class Container extends Component
{
synchronized (getTreeLock ())
{
- super.list(out, indent);
- for (int i = 0; i < ncomponents; ++i)
- component[i].list(out, indent + 2);
+ super.list(out, indent);
+ for (int i = 0; i < ncomponents; ++i)
+ component[i].list(out, indent + 2);
}
}
public void setFocusTraversalKeys(int id, Set keys)
{
+ if (id != KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS &&
+ id != KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS &&
+ id != KeyboardFocusManager.UP_CYCLE_TRAVERSAL_KEYS &&
+ id != KeyboardFocusManager.DOWN_CYCLE_TRAVERSAL_KEYS)
+ throw new IllegalArgumentException ();
}
+
public Set getFocusTraversalKeys(int id)
{
+ if (id != KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS &&
+ id != KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS &&
+ id != KeyboardFocusManager.UP_CYCLE_TRAVERSAL_KEYS &&
+ id != KeyboardFocusManager.DOWN_CYCLE_TRAVERSAL_KEYS)
+ throw new IllegalArgumentException ();
+
return null;
}
+
public boolean areFocusTraversalKeysSet(int id)
{
+ if (id != KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS &&
+ id != KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS &&
+ id != KeyboardFocusManager.UP_CYCLE_TRAVERSAL_KEYS &&
+ id != KeyboardFocusManager.DOWN_CYCLE_TRAVERSAL_KEYS)
+ throw new IllegalArgumentException ();
+
return false;
}
+
public boolean isFocusCycleRoot(Container c)
{
return false;
}
+
public void transferFocusBackward()
{
}
+
public void setFocusTraversalPolicy(FocusTraversalPolicy policy)
{
}
+
public FocusTraversalPolicy getFocusTraversalPolicy()
{
return null;
}
+
public boolean isFocusTraversalPolicySet()
{
return false;
}
+
public void setFocusCycleRoot(boolean focusCycleRoot)
{
}
+
public boolean isFocusCycleRoot()
{
return false;
}
+
public void transferFocusDownCycle()
{
}
+
public void applyComponentOrientation(ComponentOrientation o)
{
+ if (orientation == null)
+ throw new NullPointerException ();
}
+
public void addPropertyChangeListener(PropertyChangeListener l)
{
}
+
public void addPropertyChangeListener(String name, PropertyChangeListener l)
{
}
-
// Hidden helper methods.
/**
@@ -1044,14 +1096,14 @@ public class Container extends Component
{
synchronized (getTreeLock ())
{
- for (int i = 0; i < ncomponents; ++i)
- {
- 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);
}
}
}
@@ -1100,50 +1152,50 @@ public class Container extends Component
{
synchronized (getTreeLock ())
{
- 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;
- }
+ 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];
- }
+ 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;
}
}
@@ -1151,16 +1203,15 @@ public class Container extends Component
{
synchronized (getTreeLock ())
{
- for (int i = ncomponents; --i >= 0; )
- {
- 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);
+ }
}
}
-
// Nested classes.
/* The following classes are used in concert with the
@@ -1200,6 +1251,7 @@ public class Container extends Component
* This class provides accessibility support for subclasses of container.
*
* @author Eric Blake <ebb9@email.byu.edu>
+ *
* @since 1.3
*/
protected class AccessibleAWTContainer extends AccessibleAWTComponent
@@ -1234,14 +1286,14 @@ public class Container extends Component
public int getAccessibleChildrenCount()
{
synchronized (getTreeLock ())
- {
- int count = 0;
- int i = component == null ? 0 : component.length;
- while (--i >= 0)
- if (component[i] instanceof Accessible)
- count++;
- return count;
- }
+ {
+ int count = 0;
+ int i = component == null ? 0 : component.length;
+ while (--i >= 0)
+ if (component[i] instanceof Accessible)
+ count++;
+ return count;
+ }
}
/**
@@ -1253,17 +1305,17 @@ public class Container extends Component
public Accessible getAccessibleChild(int i)
{
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;
- }
+ {
+ 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;
+ }
}
/**
@@ -1271,7 +1323,9 @@ public class Container extends Component
* coordinates), if one exists.
*
* @param p the point to look at
+ *
* @return an accessible object at that point, or null
+ *
* @throws NullPointerException if p is null
*/
public Accessible getAccessibleAt(Point p)
@@ -1286,6 +1340,7 @@ public class Container extends Component
* when children are added or removed from the enclosing accessible object.
*
* @author Eric Blake <ebb9@email.byu.edu>
+ *
* @since 1.3
*/
protected class AccessibleContainerHandler implements ContainerListener
@@ -1324,7 +1379,6 @@ public class Container extends Component
} // class AccessibleAWTPanel
} // class Container
-
/**
* Undocumented helper class.
* STUBBED
@@ -1339,39 +1393,50 @@ class LightweightDispatcher implements Serializable, AWTEventListener
private transient boolean isMouseInNativeContainer;
private Cursor nativeCursor;
private long eventMask;
+
LightweightDispatcher(Container c)
{
}
+
void dispose()
{
}
+
void enableEvents(long l)
{
}
+
boolean dispatchEvent(AWTEvent e)
{
return true;
}
+
boolean isMouseGrab(MouseEvent e)
{
return true;
}
+
boolean processMouseEvent(MouseEvent e)
{
return true;
}
+
void trackMouseEnterExit(Component c, MouseEvent e)
{
}
+
void startListeningForOtherDrags()
{
}
+
void stopListeningForOtherDrags()
{
}
+
public void eventDispatched(AWTEvent e)
{
}
+
void retargetMouseEvent(Component c, int i, MouseEvent e)
{
}
diff --git a/libjava/java/awt/Cursor.java b/libjava/java/awt/Cursor.java
index 5852b8bbf85..8652a1e5ebe 100644
--- a/libjava/java/awt/Cursor.java
+++ b/libjava/java/awt/Cursor.java
@@ -133,11 +133,14 @@ public class Cursor implements java.io.Serializable
* type.
*
* @param type The cursor type.
+ *
+ * @exception IllegalArgumentException If the specified cursor type is invalid
*/
public Cursor(int type)
{
if (type < 0 || type >= PREDEFINED_COUNT)
throw new IllegalArgumentException ("invalid cursor " + type);
+
this.type = type;
// FIXME: lookup and set name?
}
@@ -171,9 +174,20 @@ public class Cursor implements java.io.Serializable
return predefined[type];
}
+ /**
+ * Retrieves the system specific custom Cursor named Cursor names are,
+ * for example: "Invalid.16x16".
+ *
+ * @exception AWTException
+ * @exception HeadlessException If GraphicsEnvironment.isHeadless()
+ * returns true.
+ */
public static Cursor getSystemCustomCursor(String name)
throws AWTException
{
+ if (GraphicsEnvironment.isHeadless())
+ throw new HeadlessException ();
+
// FIXME
return null;
}
diff --git a/libjava/java/awt/DisplayMode.java b/libjava/java/awt/DisplayMode.java
index b988e20be5e..533ab5ef482 100644
--- a/libjava/java/awt/DisplayMode.java
+++ b/libjava/java/awt/DisplayMode.java
@@ -1,5 +1,5 @@
/* DisplayMode.java -- a description of display mode configurations
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2003 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -140,16 +140,16 @@ public final class DisplayMode
* Test for equality. This returns true for two modes with identical
* parameters.
*
- * @param o the object to compare to
+ * @param dm The display mode to compare to
+ *
* @return true if it is equal
*/
- public boolean equals(Object o)
+ public boolean equals (DisplayMode dm)
{
- if (! (o instanceof DisplayMode))
- return false;
- DisplayMode m = (DisplayMode) o;
- return width == m.width && height == m.height && bitDepth == m.bitDepth
- && refreshRate == m.refreshRate;
+ return (width == dm.width
+ && height == dm.height
+ && bitDepth == dm.bitDepth
+ && refreshRate == dm.refreshRate);
}
/**
diff --git a/libjava/java/awt/EventQueue.java b/libjava/java/awt/EventQueue.java
index 1ce3d163181..6b64fb7ee3b 100644
--- a/libjava/java/awt/EventQueue.java
+++ b/libjava/java/awt/EventQueue.java
@@ -151,6 +151,8 @@ public class EventQueue
* Posts a new event to the queue.
*
* @param event The event to post to the queue.
+ *
+ * @exception NullPointerException If event is null.
*/
public synchronized void postEvent(AWTEvent evt)
{
@@ -209,7 +211,19 @@ public class EventQueue
notify();
}
- /** @since JDK1.2 */
+ /**
+ * Causes runnable to have its run method called in the dispatch thread of the
+ * EventQueue. This will happen after all pending events are processed. The
+ * call blocks until this has happened. This method will throw an Error if
+ * called from the event dispatcher thread.
+ *
+ * @exception InterruptedException If another thread has interrupted
+ * this thread.
+ * @exception InvocationTargetException If an exception is thrown when running
+ * runnable.
+ *
+ * @since 1.2
+ */
public static void invokeAndWait(Runnable runnable)
throws InterruptedException, InvocationTargetException
{
@@ -254,6 +268,8 @@ public class EventQueue
* All pending events are transferred to the new queue. Calls to postEvent,
* getNextEvent, and peekEvent are forwarded to the pushed queue until it
* is removed with a pop().
+ *
+ * @exception NullPointerException if newEventQueue is null.
*/
public synchronized void push(EventQueue newEventQueue)
{
@@ -271,7 +287,11 @@ public class EventQueue
}
/** Transfer any pending events from this queue back to the parent queue that
- * was previously push()ed. Event dispatch from this queue is suspended. */
+ * was previously push()ed. Event dispatch from this queue is suspended.
+ *
+ * @exception EmptyStackException If no previous push was made on this
+ * EventQueue.
+ */
protected void pop() throws EmptyStackException
{
if (prev == null)
@@ -297,6 +317,12 @@ public class EventQueue
}
}
+ /**
+ * Dispatches an event. The manner in which the event is dispatched depends
+ * upon the type of the event and the type of the event's source object.
+ *
+ * @exception NullPointerException If event is null.
+ */
protected void dispatchEvent(AWTEvent evt)
{
if (evt instanceof ActiveEvent)
diff --git a/libjava/java/awt/FileDialog.java b/libjava/java/awt/FileDialog.java
index 2019572d5f6..764424c82c3 100644
--- a/libjava/java/awt/FileDialog.java
+++ b/libjava/java/awt/FileDialog.java
@@ -142,16 +142,15 @@ FileDialog(Frame parent, String title)
* @param title The title for this dialog.
* @param mode The mode of the dialog, either <code>LOAD</code> or
* <code>SAVE</code>.
+ *
+ * @exception IllegalArgumentException If an illegal file dialog mode
+ * is supplied.
*/
public
FileDialog(Frame parent, String title, int mode)
{
super(parent, title, true);
-
- if ((mode != LOAD) && (mode != SAVE))
- throw new IllegalArgumentException("Bad mode: " + mode);
-
- this.mode = mode;
+ setMode (mode);
}
/*************************************************************************/
@@ -180,6 +179,9 @@ getMode()
* peer is created.
*
* @param mode The new mode of this file dialog.
+ *
+ * @exception IllegalArgumentException If an illegal file dialog mode
+ * is supplied.
*/
public void
setMode(int mode)
diff --git a/libjava/java/awt/Graphics2D.java b/libjava/java/awt/Graphics2D.java
index 879fae5ad51..ed80936bfcb 100644
--- a/libjava/java/awt/Graphics2D.java
+++ b/libjava/java/awt/Graphics2D.java
@@ -38,6 +38,7 @@ package java.awt;
import java.awt.geom.AffineTransform;
import java.awt.image.BufferedImage;
+import java.awt.image.BufferedImageOp;
import java.awt.image.RenderedImage;
import java.awt.image.ImageObserver;
import java.awt.image.renderable.RenderableImage;
@@ -74,7 +75,7 @@ public abstract class Graphics2D extends Graphics
ImageObserver obs);
public abstract void drawImage(BufferedImage image,
- BufferedImage op,
+ BufferedImageOp op,
int x,
int y);
diff --git a/libjava/java/awt/Label.java b/libjava/java/awt/Label.java
index 36ea45b944a..4f248c30bb9 100644
--- a/libjava/java/awt/Label.java
+++ b/libjava/java/awt/Label.java
@@ -40,6 +40,8 @@ package java.awt;
import java.awt.peer.LabelPeer;
import java.awt.peer.ComponentPeer;
+import java.io.Serializable;
+import javax.accessibility.Accessible;
/**
* This component is used for displaying simple text strings that cannot
@@ -48,7 +50,7 @@ import java.awt.peer.ComponentPeer;
* @author Aaron M. Renn (arenn@urbanophile.com)
* @author Tom Tromey <tromey@cygnus.com>
*/
-public class Label extends Component implements java.io.Serializable
+public class Label extends Component implements Serializable, Accessible
{
/*
@@ -99,6 +101,8 @@ private String text;
/**
* Initializes a new instance of <code>Label</code> with no text.
+ *
+ * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true.
*/
public
Label()
@@ -113,6 +117,8 @@ Label()
* text that is aligned to the left.
*
* @param text The text of the label.
+ *
+ * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true.
*/
public
Label(String text)
@@ -130,12 +136,17 @@ Label(String text)
* @param alignment The desired alignment for the text in this label,
* which must be one of <code>LEFT</code>, <code>CENTER</code>, or
* <code>RIGHT</code>.
+ *
+ * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true.
*/
public
Label(String text, int alignment)
{
setAlignment (alignment);
setText (text);
+
+ if (GraphicsEnvironment.isHeadless())
+ throw new HeadlessException ();
}
/*************************************************************************/
diff --git a/libjava/java/awt/List.java b/libjava/java/awt/List.java
index f2c6d078832..561a30d4dab 100644
--- a/libjava/java/awt/List.java
+++ b/libjava/java/awt/List.java
@@ -46,13 +46,15 @@ import java.awt.event.ItemListener;
import java.awt.peer.ListPeer;
import java.awt.peer.ComponentPeer;
import java.util.Vector;
+import javax.accessibility.Accessible;
/**
* Class that implements a listbox widget
*
* @author Aaron M. Renn (arenn@urbanophile.com)
*/
-public class List extends Component implements ItemSelectable, Serializable
+public class List extends Component
+ implements ItemSelectable, Serializable, Accessible
{
/*
@@ -113,6 +115,8 @@ private ActionListener action_listeners;
/**
* Initializes a new instance of <code>List</code> with no visible lines
* and multi-select disabled.
+ *
+ * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true.
*/
public
List()
@@ -127,6 +131,8 @@ List()
* number of visible lines and multi-select disabled.
*
* @param lines The number of visible lines in the list.
+ *
+ * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true.
*/
public
List(int rows)
@@ -143,12 +149,17 @@ List(int rows)
* @param lines The number of visible lines in the list.
* @param multipleMode <code>true</code> if multiple lines can be selected
* simultaneously, <code>false</code> otherwise.
+ *
+ * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true.
*/
public
List(int rows, boolean multipleMode)
{
this.rows = rows;
this.multipleMode = multipleMode;
+
+ if (GraphicsEnvironment.isHeadless())
+ throw new HeadlessException ();
}
/*************************************************************************/
diff --git a/libjava/java/awt/Menu.java b/libjava/java/awt/Menu.java
index 18d63be7490..326101b76e5 100644
--- a/libjava/java/awt/Menu.java
+++ b/libjava/java/awt/Menu.java
@@ -95,6 +95,8 @@ static final MenuItem separator = new MenuItem("-");
/**
* Initializes a new instance of <code>Menu</code> with no label and that
* is not a tearoff;
+ *
+ * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true.
*/
public
Menu()
@@ -108,6 +110,8 @@ Menu()
* that has the specified label.
*
* @param label The menu label.
+ *
+ * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true.
*/
public
Menu(String label)
@@ -124,6 +128,8 @@ Menu(String label)
* @param label The label for this menu
* @param isTearOff <code>true</code> if this menu is a tear off menu,
* <code>false</code> otherwise.
+ *
+ * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true.
*/
public
Menu(String label, boolean isTearOff)
@@ -134,6 +140,9 @@ Menu(String label, boolean isTearOff)
if (label.equals("Help"))
isHelpMenu = true;
+
+ if (GraphicsEnvironment.isHeadless())
+ throw new HeadlessException ();
}
/*************************************************************************/
diff --git a/libjava/java/awt/MenuBar.java b/libjava/java/awt/MenuBar.java
index 2e1a9636155..b9ddef9aa1b 100644
--- a/libjava/java/awt/MenuBar.java
+++ b/libjava/java/awt/MenuBar.java
@@ -86,10 +86,14 @@ private Vector menus = new Vector();
/**
* Initializes a new instance of <code>MenuBar</code>.
+ *
+ * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true.
*/
public
MenuBar()
{
+ if (GraphicsEnvironment.isHeadless())
+ throw new HeadlessException ();
}
/*************************************************************************/
diff --git a/libjava/java/awt/MenuComponent.java b/libjava/java/awt/MenuComponent.java
index b9c6ea020f1..548aa77937a 100644
--- a/libjava/java/awt/MenuComponent.java
+++ b/libjava/java/awt/MenuComponent.java
@@ -92,10 +92,14 @@ private static transient Toolkit toolkit = Toolkit.getDefaultToolkit();
/**
* Default constructor for subclasses.
+ *
+ * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true.
*/
protected
MenuComponent()
{
+ if (GraphicsEnvironment.isHeadless())
+ throw new HeadlessException ();
}
/*************************************************************************/
diff --git a/libjava/java/awt/PopupMenu.java b/libjava/java/awt/PopupMenu.java
index 9553b87f10a..d0f1980472b 100644
--- a/libjava/java/awt/PopupMenu.java
+++ b/libjava/java/awt/PopupMenu.java
@@ -65,6 +65,9 @@ private static final long serialVersionUID = -4620452533522760060L;
/**
* Initializes a new instance of <code>PopupMenu</code>.
+ *
+ * @exception HeadlessException If GraphicsEnvironment.isHeadless()
+ * returns true.
*/
public
PopupMenu()
@@ -78,11 +81,17 @@ PopupMenu()
* label.
*
* @param label The label for this popup menu.
+ *
+ * @exception HeadlessException If GraphicsEnvironment.isHeadless()
+ * returns true.
*/
public
PopupMenu(String label)
{
super(label);
+
+ if (GraphicsEnvironment.isHeadless())
+ throw new HeadlessException ();
}
/*************************************************************************/
diff --git a/libjava/java/awt/ScrollPane.java b/libjava/java/awt/ScrollPane.java
index e558d0bc23f..045600cddf2 100644
--- a/libjava/java/awt/ScrollPane.java
+++ b/libjava/java/awt/ScrollPane.java
@@ -41,6 +41,8 @@ package java.awt;
import java.awt.peer.ScrollPanePeer;
import java.awt.peer.ContainerPeer;
import java.awt.peer.ComponentPeer;
+import java.io.Serializable;
+import javax.accessibility.Accessible;
/**
* This widget provides a scrollable region that allows a single
@@ -48,7 +50,7 @@ import java.awt.peer.ComponentPeer;
*
* @author Aaron M. Renn (arenn@urbanophile.com)
*/
-public class ScrollPane extends Container implements java.io.Serializable
+public class ScrollPane extends Container implements Accessible, Serializable
{
/*
@@ -113,6 +115,8 @@ private Point scrollPosition = new Point(0, 0);
/**
* Initializes a new instance of <code>ScrollPane</code> with a default
* scrollbar policy of <code>SCROLLBARS_AS_NEEDED</code>.
+ *
+ * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true.
*/
public
ScrollPane()
@@ -128,10 +132,15 @@ ScrollPane()
*
* @param scrollbarDisplayPolicy When to display scrollbars, which must
* be one of the constants defined in this class.
+ *
+ * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true.
*/
public
ScrollPane(int scrollbarDisplayPolicy)
{
+ if (GraphicsEnvironment.isHeadless ())
+ throw new HeadlessException ();
+
this.scrollbarDisplayPolicy = scrollbarDisplayPolicy;
if (scrollbarDisplayPolicy != SCROLLBARS_ALWAYS
diff --git a/libjava/java/awt/Scrollbar.java b/libjava/java/awt/Scrollbar.java
index 1f1875955bf..4bdc3166ad9 100644
--- a/libjava/java/awt/Scrollbar.java
+++ b/libjava/java/awt/Scrollbar.java
@@ -1,5 +1,5 @@
/* Scrollbar.java -- AWT Scrollbar widget
- Copyright (C) 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -40,9 +40,10 @@ package java.awt;
import java.awt.peer.ScrollbarPeer;
import java.awt.peer.ComponentPeer;
-
import java.awt.event.AdjustmentListener;
import java.awt.event.AdjustmentEvent;
+import java.io.Serializable;
+import javax.accessibility.Accessible;
/**
* This class implements a scrollbar widget.
@@ -50,8 +51,9 @@ import java.awt.event.AdjustmentEvent;
* @author Aaron M. Renn (arenn@urbanophile.com)
* @author Tom Tromey <tromey@cygnus.com>
*/
-public class Scrollbar extends Component implements Adjustable,
- java.io.Serializable
+public class Scrollbar extends Component implements Accessible,
+ Adjustable,
+ Serializable
{
// FIXME: Serialization readObject/writeObject
@@ -126,7 +128,9 @@ private AdjustmentListener adjustment_listeners;
/**
* Initializes a new instance of <code>Scrollbar</code> with a
- * veritical orientation and default values for all other parameters.
+ * vertical orientation and default values for all other parameters.
+ *
+ * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true,
*/
public
Scrollbar()
@@ -145,6 +149,7 @@ Scrollbar()
*
* @param orientation The orientation of this scrollbar.
*
+ * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true,
* @exception IllegalArgumentException If the orientation value is not valid.
*/
public
@@ -168,12 +173,16 @@ Scrollbar(int orientation) throws IllegalArgumentException
* @param minimum The minimum value of the scrollbar.
* @param maximum The maximum value of the scrollbar.
*
+ * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true,
* @exception IllegalArgumentException If the orientation value is not valid.
*/
public
Scrollbar(int orientation, int value, int visibleAmount, int minimum,
int maximum) throws IllegalArgumentException
{
+ if (GraphicsEnvironment.isHeadless())
+ throw new HeadlessException ();
+
if ((orientation != HORIZONTAL) && (orientation != VERTICAL))
throw new IllegalArgumentException("Bad orientation value: "
+ orientation);
diff --git a/libjava/java/awt/TextArea.java b/libjava/java/awt/TextArea.java
index 799656ec554..f164add49a1 100644
--- a/libjava/java/awt/TextArea.java
+++ b/libjava/java/awt/TextArea.java
@@ -109,6 +109,8 @@ private int scrollbarVisibility;
* Initialize a new instance of <code>TextArea</code> that is empty
* and is one row and one column. Both horizontal and vertical
* scrollbars will be used.
+ *
+ * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true,
*/
public
TextArea()
@@ -124,6 +126,8 @@ TextArea()
* scrollbars will be used.
*
* @param text The text to display in this text area.
+ *
+ * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true,
*/
public
TextArea(String text)
@@ -140,6 +144,8 @@ TextArea(String text)
*
* @param rows The number of rows in this text area.
* @param columns The number of columns in this text area.
+ *
+ * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true,
*/
public
TextArea(int rows, int columns)
@@ -156,6 +162,8 @@ TextArea(int rows, int columns)
* @param text The text to display in this text area.
* @param rows The number of rows in this text area.
* @param columns The number of columns in this text area.
+ *
+ * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true,
*/
public
TextArea(String text, int rows, int columns)
@@ -174,12 +182,17 @@ TextArea(String text, int rows, int columns)
* @param rows The number of rows in this text area.
* @param columns The number of columns in this text area.
* @param scrollbarVisibility Which scrollbars to display.
+ *
+ * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true,
*/
public
TextArea(String text, int rows, int columns, int scrollbarVisibility)
{
super(text);
+ if (GraphicsEnvironment.isHeadless())
+ throw new HeadlessException ();
+
if ((rows < 1) || (columns < 0))
throw new IllegalArgumentException("Bad row or column value");
diff --git a/libjava/java/awt/TextComponent.java b/libjava/java/awt/TextComponent.java
index 5ba80edc1da..6dc904cc8b1 100644
--- a/libjava/java/awt/TextComponent.java
+++ b/libjava/java/awt/TextComponent.java
@@ -291,10 +291,18 @@ getCaretPosition()
* Sets the caret position to the specified value.
*
* @param caretPosition The new caret position.
+ *
+ * @exception IllegalArgumentException If the value supplied for position
+ * is less than zero.
+ *
+ * @since 1.1
*/
public synchronized void
setCaretPosition(int caretPosition)
{
+ if (caretPosition < 0)
+ throw new IllegalArgumentException ();
+
TextComponentPeer tcp = (TextComponentPeer)getPeer();
if (tcp != null)
tcp.setCaretPosition(caretPosition);
diff --git a/libjava/java/awt/TextField.java b/libjava/java/awt/TextField.java
index 28d444ce95f..0106d77e3ad 100644
--- a/libjava/java/awt/TextField.java
+++ b/libjava/java/awt/TextField.java
@@ -84,9 +84,11 @@ private ActionListener action_listeners;
* Constructors
*/
-/*
+/**
* Initializes a new instance of <code>TextField</code> that is empty
* and has one column.
+ *
+ * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true,
*/
public
TextField()
@@ -102,6 +104,8 @@ TextField()
* length of the text string.
*
* @param text The text to display in the field.
+ *
+ * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true,
*/
public
TextField(String text)
@@ -116,6 +120,8 @@ TextField(String text)
* and has the specified number of columns.
*
* @param columns The number of columns in the text field.
+ *
+ * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true,
*/
public
TextField(int columns)
@@ -131,12 +137,17 @@ TextField(int columns)
*
* @param text The text to display in the field.
* @param columns The number of columns in the field.
+ *
+ * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true,
*/
public
TextField(String text, int columns)
{
super(text);
this.columns = columns;
+
+ if (GraphicsEnvironment.isHeadless())
+ throw new HeadlessException ();
}
/*************************************************************************/
diff --git a/libjava/java/awt/Toolkit.java b/libjava/java/awt/Toolkit.java
index fb5e020a29e..da9bc0e4e4b 100644
--- a/libjava/java/awt/Toolkit.java
+++ b/libjava/java/awt/Toolkit.java
@@ -123,7 +123,10 @@ public abstract class Toolkit
* Creates a peer object for the specified <code>Button</code>.
*
* @param target The <code>Button</code> to create the peer for.
+ *
* @return The peer for the specified <code>Button</code> object.
+ *
+ * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true.
*/
protected abstract ButtonPeer createButton(Button target);
@@ -132,6 +135,8 @@ public abstract class Toolkit
*
* @param target The <code>TextField</code> to create the peer for.
* @return The peer for the specified <code>TextField</code> object.
+ *
+ * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true.
*/
protected abstract TextFieldPeer createTextField(TextField target);
@@ -140,6 +145,8 @@ public abstract class Toolkit
*
* @param target The <code>Label</code> to create the peer for.
* @return The peer for the specified <code>Label</code> object.
+ *
+ * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true.
*/
protected abstract LabelPeer createLabel(Label target);
@@ -148,6 +155,8 @@ public abstract class Toolkit
*
* @param target The <code>List</code> to create the peer for.
* @return The peer for the specified <code>List</code> object.
+ *
+ * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true.
*/
protected abstract ListPeer createList(List target);
@@ -156,6 +165,8 @@ public abstract class Toolkit
*
* @param target The <code>Checkbox</code> to create the peer for.
* @return The peer for the specified <code>Checkbox</code> object.
+ *
+ * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true.
*/
protected abstract CheckboxPeer createCheckbox(Checkbox target);
@@ -164,6 +175,8 @@ public abstract class Toolkit
*
* @param target The <code>Scrollbar</code> to create the peer for.
* @return The peer for the specified <code>Scrollbar</code> object.
+ *
+ * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true.
*/
protected abstract ScrollbarPeer createScrollbar(Scrollbar target);
@@ -172,6 +185,8 @@ public abstract class Toolkit
*
* @param target The <code>ScrollPane</code> to create the peer for.
* @return The peer for the specified <code>ScrollPane</code> object.
+ *
+ * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true.
*/
protected abstract ScrollPanePeer createScrollPane(ScrollPane target);
@@ -180,6 +195,8 @@ public abstract class Toolkit
*
* @param target The <code>TextArea</code> to create the peer for.
* @return The peer for the specified <code>TextArea</code> object.
+ *
+ * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true.
*/
protected abstract TextAreaPeer createTextArea(TextArea target);
@@ -188,6 +205,8 @@ public abstract class Toolkit
*
* @param target The <code>Choice</code> to create the peer for.
* @return The peer for the specified <code>Choice</code> object.
+ *
+ * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true.
*/
protected abstract ChoicePeer createChoice(Choice target);
@@ -196,6 +215,8 @@ public abstract class Toolkit
*
* @param target The <code>Frame</code> to create the peer for.
* @return The peer for the specified <code>Frame</code> object.
+ *
+ * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true.
*/
protected abstract FramePeer createFrame(Frame target);
@@ -220,6 +241,8 @@ public abstract class Toolkit
*
* @param target The <code>Window</code> to create the peer for.
* @return The peer for the specified <code>Window</code> object.
+ *
+ * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true.
*/
protected abstract WindowPeer createWindow(Window target);
@@ -228,6 +251,8 @@ public abstract class Toolkit
*
* @param target The dialog to create the peer for
* @return The peer for the specified font name.
+ *
+ * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true.
*/
protected abstract DialogPeer createDialog(Dialog target);
@@ -236,6 +261,8 @@ public abstract class Toolkit
*
* @param target The <code>MenuBar</code> to create the peer for.
* @return The peer for the specified <code>MenuBar</code> object.
+ *
+ * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true.
*/
protected abstract MenuBarPeer createMenuBar(MenuBar target);
@@ -244,6 +271,8 @@ public abstract class Toolkit
*
* @param target The <code>Menu</code> to create the peer for.
* @return The peer for the specified <code>Menu</code> object.
+ *
+ * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true.
*/
protected abstract MenuPeer createMenu(Menu target);
@@ -252,6 +281,8 @@ public abstract class Toolkit
*
* @param target The <code>PopupMenu</code> to create the peer for.
* @return The peer for the specified <code>PopupMenu</code> object.
+ *
+ * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true.
*/
protected abstract PopupMenuPeer createPopupMenu(PopupMenu target);
@@ -260,6 +291,8 @@ public abstract class Toolkit
*
* @param target The <code>MenuItem</code> to create the peer for.
* @return The peer for the specified <code>MenuItem</code> object.
+ *
+ * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true.
*/
protected abstract MenuItemPeer createMenuItem(MenuItem target);
@@ -268,6 +301,8 @@ public abstract class Toolkit
*
* @param target The <code>FileDialog</code> to create the peer for.
* @return The peer for the specified <code>FileDialog</code> object.
+ *
+ * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true.
*/
protected abstract FileDialogPeer createFileDialog(FileDialog target);
@@ -276,6 +311,8 @@ public abstract class Toolkit
*
* @param target The <code>CheckboxMenuItem</code> to create the peer for.
* @return The peer for the specified <code>CheckboxMenuItem</code> object.
+ *
+ * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true.
*/
protected abstract CheckboxMenuItemPeer
createCheckboxMenuItem(CheckboxMenuItem target);
@@ -310,6 +347,8 @@ public abstract class Toolkit
* the interface used by the <code>SystemColors</code> class.
*
* @param colors The array to copy the system colors into.
+ *
+ * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true.
*/
protected void loadSystemColors(int systemColors[])
{
@@ -318,6 +357,8 @@ public abstract class Toolkit
/**
* @since 1.4
+ *
+ * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true.
*/
public void setDynamicLayout(boolean dynamic)
{
@@ -325,6 +366,8 @@ public abstract class Toolkit
/**
* @since 1.4
+ *
+ * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true.
*/
protected boolean isDynamicLayoutSet()
{
@@ -333,6 +376,8 @@ public abstract class Toolkit
/**
* @since 1.4
+ *
+ * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true.
*/
public boolean isDynamicLayoutActive()
{
@@ -343,6 +388,8 @@ public abstract class Toolkit
* Returns the dimensions of the screen in pixels.
*
* @return The dimensions of the screen in pixels.
+ *
+ * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true.
*/
public abstract Dimension getScreenSize();
@@ -350,10 +397,14 @@ public abstract class Toolkit
* Returns the screen resolution in dots per square inch.
*
* @return The screen resolution in dots per square inch.
+ *
+ * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true.
*/
public abstract int getScreenResolution();
/**
+ * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true.
+ *
* @since 1.4
*/
public Insets getScreenInsets(GraphicsConfiguration gc)
@@ -396,6 +447,7 @@ public abstract class Toolkit
* if the property is not set.
*
* @return An instance of the system default toolkit.
+ *
* @throws AWTError If the toolkit cannot be loaded.
*/
public static Toolkit getDefaultToolkit()
@@ -450,6 +502,7 @@ public abstract class Toolkit
* @param height The height of the image.
* @param observer The observer to receive events about the preparation
* process.
+ *
* @return <code>true</code> if the image is already prepared for rendering,
* <code>false</code> otherwise.
*/
@@ -465,6 +518,7 @@ public abstract class Toolkit
* @param height The height of the image.
* @param observer The observer to receive events about the preparation
* process.
+ *
* @return A union of the bitmasks from
* <code>java.awt.image.ImageObserver</code> that indicates the current
* state of the imaging readying process.
@@ -476,6 +530,7 @@ public abstract class Toolkit
* Creates an image using the specified <code>ImageProducer</code>
*
* @param producer The <code>ImageProducer</code> to create the image from.
+ *
* @return The created image.
*/
public abstract Image createImage(ImageProducer producer);
@@ -485,6 +540,7 @@ public abstract class Toolkit
* a recognized format. Supported formats vary from toolkit to toolkit.
*
* @param data The raw image data.
+ *
* @return The created image.
*/
public Image createImage(byte[] data)
@@ -500,6 +556,7 @@ public abstract class Toolkit
* @param data The raw image data.
* @param offset The offset into the data where the image data starts.
* @param len The length of the image data.
+ *
* @return The created image.
*/
public abstract Image createImage(byte[] data, int offset, int len);
@@ -511,6 +568,7 @@ public abstract class Toolkit
* @param frame The window initiating the print job.
* @param title The print job title.
* @param props The print job properties.
+ *
* @return The requested print job, or <code>null</code> if the job
* was cancelled.
*/
@@ -536,10 +594,14 @@ public abstract class Toolkit
* Returns the system clipboard.
*
* @return THe system clipboard.
+ *
+ * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true.
*/
public abstract Clipboard getSystemClipboard();
/**
+ * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true.
+ *
* @since 1.4
*/
public Clipboard getSystemSelection()
@@ -553,6 +615,8 @@ public abstract class Toolkit
* to change the default.
*
* @return The key mask for the menu accelerator key.
+ *
+ * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true.
*/
public int getMenuShortcutKeyMask()
{
diff --git a/libjava/java/awt/Window.java b/libjava/java/awt/Window.java
index b8befaf0507..31e6b573f53 100644
--- a/libjava/java/awt/Window.java
+++ b/libjava/java/awt/Window.java
@@ -86,32 +86,56 @@ public class Window extends Container
* parent. The window will initially be invisible.
*
* @param parent The owning <code>Frame</code> of this window.
+ *
+ * @exception IllegalArgumentException If the owner's GraphicsConfiguration
+ * is not from a screen device, or if owner is null; this exception is always
+ * thrown when GraphicsEnvironment.isHeadless returns true.
*/
public Window(Frame owner)
{
- this((Window) owner);
+ this (owner, owner.getGraphicsConfiguration ());
}
- /** @since 1.2 */
+ /**
+ * Initializes a new instance of <code>Window</code> with the specified
+ * parent. The window will initially be invisible.
+ *
+ * @exception IllegalArgumentException If the owner's GraphicsConfiguration
+ * is not from a screen device, or if owner is null; this exception is always
+ * thrown when GraphicsEnvironment.isHeadless returns true.
+ *
+ * @since 1.2
+ */
public Window(Window owner)
{
- this();
- if (owner == null)
- throw new IllegalArgumentException("owner must not be null");
-
- this.parent = owner;
-
- // FIXME: add to owner's "owned window" list
- //owner.owned.add(this); // this should be a weak reference
+ this (owner, owner.getGraphicsConfiguration ());
}
- /** @since 1.3 */
+ /**
+ * Initializes a new instance of <code>Window</code> with the specified
+ * parent. The window will initially be invisible.
+ *
+ * @exception IllegalArgumentException If owner is null or if gc is not from a
+ * screen device; this exception is always thrown when
+ * GraphicsEnvironment.isHeadless returns true.
+ *
+ * @since 1.3
+ */
public Window(Window owner, GraphicsConfiguration gc)
{
- this(owner);
+ this ();
+
+ if (owner == null)
+ throw new IllegalArgumentException ("owner must not be null");
+ this.parent = owner;
+
+ // FIXME: add to owner's "owned window" list
+ //owner.owned.add(this); // this should be a weak reference
+
/* FIXME: Security check
SecurityManager.checkTopLevelWindow(...)
+ */
if (gc != null
&& gc.getDevice().getType() != GraphicsDevice.TYPE_RASTER_SCREEN)
@@ -119,11 +143,10 @@ public class Window extends Container
if (gc == null)
graphicsConfiguration = GraphicsEnvironment.getLocalGraphicsEnvironment()
- .getDefaultScreenDevice()
- .getDefaultConfiguration();
+ .getDefaultScreenDevice()
+ .getDefaultConfiguration();
else
- */
- graphicsConfiguration = gc;
+ graphicsConfiguration = gc;
}
GraphicsConfiguration getGraphicsConfigurationImpl()
@@ -134,6 +157,12 @@ public class Window extends Container
return super.getGraphicsConfigurationImpl();
}
+ /**
+ * Disposes of the input methods and context, and removes the WeakReference
+ * which formerly pointed to this Window from the parent's owned Window list.
+ *
+ * @exception Throwable The Exception raised by this method.
+ */
protected void finalize() throws Throwable
{
// FIXME: remove from owner's "owned window" list (Weak References)
@@ -185,7 +214,7 @@ public class Window extends Container
public void hide()
{
- // FIXME: call hide() on amy "owned" children here.
+ // FIXME: call hide() on any "owned" children here.
super.hide();
}
@@ -233,8 +262,8 @@ public class Window extends Container
{
if (peer != null)
{
- WindowPeer wp = (WindowPeer) peer;
- wp.toFront();
+ WindowPeer wp = (WindowPeer) peer;
+ wp.toFront();
}
}
@@ -265,12 +294,12 @@ public class Window extends Container
if (!secure)
{
if (warningString != null)
- return warningString;
- else
- {
- String warning = System.getProperty("awt.appletWarning");
- return warning;
- }
+ return warningString;
+ else
+ {
+ String warning = System.getProperty("awt.appletWarning");
+ return warning;
+ }
}
return null;
}
@@ -338,6 +367,11 @@ public class Window extends Container
windowListener = AWTEventMulticaster.remove(windowListener, listener);
}
+ /**
+ * Returns an array of all the window listeners registered on this window.
+ *
+ * @since 1.4
+ */
public synchronized WindowListener[] getWindowListeners()
{
return (WindowListener[])
@@ -345,7 +379,16 @@ public class Window extends Container
WindowListener.class);
}
- /** @since 1.3 */
+ /**
+ * Returns an array of all the objects currently registered as FooListeners
+ * upon this Window. FooListeners are registered using the addFooListener
+ * method.
+ *
+ * @exception ClassCastException If listenerType doesn't specify a class or
+ * interface that implements java.util.EventListener.
+ *
+ * @since 1.3
+ */
public EventListener[] getListeners(Class listenerType)
{
if (listenerType == WindowListener.class)
diff --git a/libjava/java/awt/color/CMMException.java b/libjava/java/awt/color/CMMException.java
index 0d146e6c6eb..a0948ef27eb 100644
--- a/libjava/java/awt/color/CMMException.java
+++ b/libjava/java/awt/color/CMMException.java
@@ -44,7 +44,7 @@ package java.awt.color;
* @author Eric Blake <ebb9@email.byu.edu>
* @status updated to 1.4
*/
-public class CMMException extends Exception
+public class CMMException extends RuntimeException
{
/**
* Compatible with JDK 1.2+.
diff --git a/libjava/java/awt/color/ColorSpace.java b/libjava/java/awt/color/ColorSpace.java
index 4f68fabcb7b..8bf0a8196c0 100644
--- a/libjava/java/awt/color/ColorSpace.java
+++ b/libjava/java/awt/color/ColorSpace.java
@@ -46,7 +46,7 @@ import java.io.Serializable;
* @author Rolf W. Rasmussen <rolfwr@ii.uib.no>
* @since 1.2
*/
-public abstract class ColorSpace
+public abstract class ColorSpace implements Serializable
{
/**
* Compatible with JDK 1.2+.
@@ -131,6 +131,13 @@ public abstract class ColorSpace
return false;
}
+ /**
+ * Transforms a color value assumed to be in this ColorSpace into a value in
+ * the default CS_sRGB color space.
+ *
+ * @exception ArrayIndexOutOfBoundsException If array length is not at least
+ * the number of components in this ColorSpace.
+ */
public abstract float[] toRGB(float[] colorvalue);
public abstract float[] fromRGB(float[] rgbvalue);
diff --git a/libjava/java/awt/color/ICC_ColorSpace.java b/libjava/java/awt/color/ICC_ColorSpace.java
index 1a144dbfbd2..2b7016742c9 100644
--- a/libjava/java/awt/color/ICC_ColorSpace.java
+++ b/libjava/java/awt/color/ICC_ColorSpace.java
@@ -81,6 +81,12 @@ public class ICC_ColorSpace extends ColorSpace
*/
private boolean needScaleInit;
+ /**
+ * Constructs a new ICC_ColorSpace from an ICC_Profile object.
+ *
+ * @exception IllegalArgumentException If profile is inappropriate for
+ * representing a ColorSpace.
+ */
public ICC_ColorSpace(ICC_Profile profile)
{
super(CS_sRGB, profile.getNumComponents());
@@ -92,18 +98,45 @@ public class ICC_ColorSpace extends ColorSpace
return thisProfile;
}
+ /**
+ * Transforms a color value assumed to be in this ColorSpace into a value in
+ * the default CS_sRGB color space.
+ *
+ * @exception ArrayIndexOutOfBoundsException If array length is not at least
+ * the number of components in this ColorSpace.
+ */
public float[] toRGB(float[] colorvalue)
{
+ if (colorvalue.length < numComponents)
+ throw new IllegalArgumentException ();
+
// FIXME: Always assumes sRGB:
return colorvalue;
}
+ /**
+ * Transforms a color value assumed to be in the default CS_sRGB color space
+ * into this ColorSpace.
+ *
+ * @exception ArrayIndexOutOfBoundsException If array length is not at
+ * least 3.
+ */
public float[] fromRGB(float[] rgbvalue)
{
+ if (rgbvalue.length < 3)
+ throw new IllegalArgumentException ();
+
// FIXME: Always assumes sRGB:
return rgbvalue;
}
+ /**
+ * Transforms a color value assumed to be in this ColorSpace into the
+ * CS_CIEXYZ conversion color space.
+ *
+ * @exception ArrayIndexOutOfBoundsException If array length is not at
+ * least the number of components in this ColorSpace.
+ */
public float[] toCIEXYZ(float[] colorvalue)
{
// FIXME: Not implemented
diff --git a/libjava/java/awt/color/ICC_Profile.java b/libjava/java/awt/color/ICC_Profile.java
index 7adaac06472..eb534ebffca 100644
--- a/libjava/java/awt/color/ICC_Profile.java
+++ b/libjava/java/awt/color/ICC_Profile.java
@@ -245,7 +245,7 @@ public class ICC_Profile implements Serializable
write(new FileOutputStream(filename));
}
- public void write(OutputStream out)
+ public void write(OutputStream out) throws IOException
{
throw new Error("not implemented");
}
diff --git a/libjava/java/awt/color/ProfileDataException.java b/libjava/java/awt/color/ProfileDataException.java
index 130781faf9b..89f47a207e1 100644
--- a/libjava/java/awt/color/ProfileDataException.java
+++ b/libjava/java/awt/color/ProfileDataException.java
@@ -45,7 +45,7 @@ package java.awt.color;
* @author Eric Blake <ebb9@email.byu.edu>
* @status updated to 1.4
*/
-public class ProfileDataException extends Exception
+public class ProfileDataException extends RuntimeException
{
/**
* Compatible with JDK 1.2+.
diff --git a/libjava/java/awt/datatransfer/Clipboard.java b/libjava/java/awt/datatransfer/Clipboard.java
index 6ef9e70b6aa..93bba7c1a3d 100644
--- a/libjava/java/awt/datatransfer/Clipboard.java
+++ b/libjava/java/awt/datatransfer/Clipboard.java
@@ -103,6 +103,8 @@ getName()
* Returns the contents of the clipboard.
*
* @param requestor The object requesting the contents.
+ *
+ * @exception IllegalStateException If the clipboard is currently unavailable
*/
public synchronized Transferable
getContents(Object requestor)
@@ -120,6 +122,8 @@ getContents(Object requestor)
*
* @param contents The new clipboard contents.
* @param owner The new clipboard owner
+ *
+ * @exception IllegalStateException If the clipboard is currently unavailable
*/
public synchronized void
setContents(Transferable contents, ClipboardOwner owner)
diff --git a/libjava/java/awt/datatransfer/DataFlavor.java b/libjava/java/awt/datatransfer/DataFlavor.java
index 85f6ae5d455..e1500a7926c 100644
--- a/libjava/java/awt/datatransfer/DataFlavor.java
+++ b/libjava/java/awt/datatransfer/DataFlavor.java
@@ -281,6 +281,7 @@ DataFlavor(Class representationClass, String humanPresentableName)
*
* @exception IllegalArgumentException If the representation class
* specified cannot be loaded.
+ * @exception ClassNotFoundException If the class is not loaded.
*/
public
DataFlavor(String mimeType, String humanPresentableName,
@@ -504,6 +505,8 @@ setHumanPresentableName(String humanPresentableName)
*
* @return <code>true</code> if the MIME type is equal to this object's
* MIME type, <code>false</code> otherwise.
+ *
+ * @exception NullPointerException If mimeType is null.
*/
public final boolean
isMimeTypeEqual(String mimeType)
@@ -652,6 +655,10 @@ isFlavorJavaFileListType()
* Returns a copy of this object.
*
* @return A copy of this object.
+ *
+ * @exception CloneNotSupportedException If the object's class does not support
+ * the Cloneable interface. Subclasses that override the clone method can also
+ * throw this exception to indicate that an instance cannot be cloned.
*/
public Object
clone()
@@ -813,6 +820,8 @@ normalizeMimeType(String type)
* Serialize this class.
*
* @param stream The <code>ObjectOutput</code> stream to serialize to.
+ *
+ * @exception IOException If an error occurs.
*/
public void
writeExternal(ObjectOutput stream) throws IOException
@@ -826,6 +835,10 @@ writeExternal(ObjectOutput stream) throws IOException
* De-serialize this class.
*
* @param stream The <code>ObjectInput</code> stream to deserialize from.
+ *
+ * @exception IOException If an error ocurs.
+ * @exception ClassNotFoundException If the class for an object being restored
+ * cannot be found.
*/
public void
readExternal(ObjectInput stream) throws IOException, ClassNotFoundException
@@ -950,6 +963,10 @@ selectBestTextFlavor(DataFlavor[] availableFlavors)
*
* @param transferable The <code>Transferable</code> for which a text
* <code>Reader</code> is requested.
+ *
+ * @exception IllegalArgumentException If the representation class is not one
+ * of the seven listed above or the Transferable has null data.
+ * @exception NullPointerException If the Transferable is null.
* @exception UnsupportedFlavorException when the transferable doesn't
* support this <code>DataFlavor</code>. Or if the representable class
* isn't a (subclass of) <code>Reader</code>, <code>String</code>,
diff --git a/libjava/java/awt/datatransfer/FlavorMap.java b/libjava/java/awt/datatransfer/FlavorMap.java
index 96b160842d9..a3926150631 100644
--- a/libjava/java/awt/datatransfer/FlavorMap.java
+++ b/libjava/java/awt/datatransfer/FlavorMap.java
@@ -41,42 +41,35 @@ package java.awt.datatransfer;
import java.util.Map;
/**
- * This interface maps between native platform type names and DataFlavors.
- *
- * @author Aaron M. Renn (arenn@urbanophile.com)
- */
+ * This interface maps between native platform type names and DataFlavors.
+ *
+ * @author Aaron M. Renn (arenn@urbanophile.com)
+ */
public interface FlavorMap
{
+ /**
+ * Maps the specified <code>DataFlavor</code> objects to the native
+ * data type name. The returned <code>Map</code> has keys that are
+ * the data flavors and values that are strings. The returned map
+ * may be modified. This can be useful for implementing nested mappings.
+ *
+ * @param flavors An array of data flavors to map
+ * or null for all data flavors.
+ *
+ * @return A <code>Map</code> of native data types.
+ */
+ public abstract Map getNativesForFlavors (DataFlavor[] flavors);
-/**
- * Maps the specified <code>DataFlavor</code> objects to the native
- * data type name. The returned <code>Map</code> has keys that are
- * the data flavors and values that are strings. The returned map
- * may be modified. This can be useful for implementing nested mappings.
- *
- * @param flavors An array of data flavors to map
- * or null for all data flavors.
- *
- * @return A <code>Map</code> of native data types.
- */
-public abstract Map
-getNativesForFlavors(DataFlavor[] flavors);
-
-/*************************************************************************/
-
-/**
- * Maps the specified native type names to <code>DataFlavor</code>'s.
- * The returned <code>Map</code> has keys that are strings and values
- * that are <code>DataFlavor</code>'s. The returned map may be
- * modified. This can be useful for implementing nested mappings.
- *
- * @param natives An array of native types to map
- * or null for all native types.
- *
- * @return A <code>Map</code> of data flavors.
- */
-public abstract Map
-getFlavorsForNatives(String[] natives);
-
-} // interface FlavorMap
-
+ /**
+ * Maps the specified native type names to <code>DataFlavor</code>'s.
+ * The returned <code>Map</code> has keys that are strings and values
+ * that are <code>DataFlavor</code>'s. The returned map may be
+ * modified. This can be useful for implementing nested mappings.
+ *
+ * @param natives An array of native types to map
+ * or null for all native types.
+ *
+ * @return A <code>Map</code> of data flavors.
+ */
+ public abstract Map getFlavorsForNatives (String[] natives);
+}
diff --git a/libjava/java/awt/datatransfer/SystemFlavorMap.java b/libjava/java/awt/datatransfer/SystemFlavorMap.java
index 50064db4c92..7d914120e8f 100644
--- a/libjava/java/awt/datatransfer/SystemFlavorMap.java
+++ b/libjava/java/awt/datatransfer/SystemFlavorMap.java
@@ -40,6 +40,7 @@ package java.awt.datatransfer;
import java.util.HashMap;
import java.util.Map;
+import java.util.List;
/**
* This class maps between native platform type names and DataFlavors.
@@ -47,134 +48,122 @@ import java.util.Map;
* XXX - The current implementation does no mapping at all.
*
* @author Mark Wielaard (mark@klomp.org)
- */
-public final class SystemFlavorMap implements FlavorMap
-{
-
-/**
- * The default (instance) flavor map.
- */
-private static FlavorMap defaultFlavorMap;
-
-/**
- * Private constructor.
- */
-private SystemFlavorMap()
-{
-}
-
-/*************************************************************************/
-
-/**
- * Maps the specified <code>DataFlavor</code> objects to the native
- * data type name. The returned <code>Map</code> has keys that are
- * the data flavors and values that are strings. The returned map
- * may be modified. This can be useful for implementing nested mappings.
- *
- * @param flavors An array of data flavors to map
- * or null for all data flavors.
*
- * @return A <code>Map</code> of native data types to data flavors.
- */
-public Map
-getNativesForFlavors(DataFlavor[] flavors)
-{
- return(new HashMap());
-}
-
-/*************************************************************************/
-
-/**
- * Maps the specified native type names to <code>DataFlavor</code>'s.
- * The returned <code>Map</code> has keys that are strings and values
- * that are <code>DataFlavor</code>'s. The returned map may be
- * modified. This can be useful for implementing nested mappings.
- *
- * @param natives An array of native types to map
- * or null for all native types.
- *
- * @return A <code>Map</code> of data flavors to native type names.
- */
-public Map
-getFlavorsForNatives(String[] natives)
-{
- return(new HashMap());
-}
-
-/*************************************************************************/
-
-/**
- * Returns the default (instance) (System)FlavorMap.
- */
-public static FlavorMap
-getDefaultFlavorMap()
-{
- if (defaultFlavorMap == null)
- defaultFlavorMap = new SystemFlavorMap();
-
- return(defaultFlavorMap);
-}
-
-/*************************************************************************/
-
-/**
- * Returns the native type name for the given java mime type.
- */
-public static String
-encodeJavaMIMEType(String mime)
-{
- return null;
-}
-
-/*************************************************************************/
-
-/**
- * Returns the native type name for the given data flavor.
- */
-public static String
-encodeDataFlavor(DataFlavor df)
-{
- return null;
-}
-
-/*************************************************************************/
-
-/**
- * Returns true if the native type name can be represented as
- * a java mime type.
- */
-public static boolean
-isJavaMIMEType(String name)
-{
- return(false);
-}
-
-/*************************************************************************/
-
-/**
- * Returns the java mime type for the given the native type name.
+ * @since 1.2
*/
-public static String
-decodeJavaMIMEType(String name)
+public final class SystemFlavorMap implements FlavorMap, FlavorTable
{
- return null;
-}
-
-/*************************************************************************/
-
-/**
- * Returns the data flavor given the native type name
- * or null when no such data flavor exists.
- */
-public static DataFlavor
-decodeDataFlavor(String name) throws ClassNotFoundException
-{
- String javaMIMEType = decodeJavaMIMEType(name);
- if (javaMIMEType != null)
- return(new DataFlavor(javaMIMEType));
- else
- return(null);
-}
+ /**
+ * The default (instance) flavor map.
+ */
+ private static FlavorMap defaultFlavorMap;
+
+ /**
+ * Private constructor.
+ */
+ private SystemFlavorMap ()
+ {
+ }
+
+ /**
+ * Maps the specified <code>DataFlavor</code> objects to the native
+ * data type name. The returned <code>Map</code> has keys that are
+ * the data flavors and values that are strings. The returned map
+ * may be modified. This can be useful for implementing nested mappings.
+ *
+ * @param flavors An array of data flavors to map
+ * or null for all data flavors.
+ *
+ * @return A <code>Map</code> of native data types to data flavors.
+ */
+ public Map getNativesForFlavors (DataFlavor[] flavors)
+ {
+ return new HashMap();
+ }
+
+ /**
+ * Maps the specified native type names to <code>DataFlavor</code>'s.
+ * The returned <code>Map</code> has keys that are strings and values
+ * that are <code>DataFlavor</code>'s. The returned map may be
+ * modified. This can be useful for implementing nested mappings.
+ *
+ * @param natives An array of native types to map
+ * or null for all native types.
+ *
+ * @return A <code>Map</code> of data flavors to native type names.
+ */
+ public Map getFlavorsForNatives (String[] natives)
+ {
+ return new HashMap();
+ }
+
+ /**
+ * Returns the default (instance) (System)FlavorMap.
+ */
+ public static FlavorMap getDefaultFlavorMap ()
+ {
+ if (defaultFlavorMap == null)
+ defaultFlavorMap = new SystemFlavorMap ();
+
+ return defaultFlavorMap;
+ }
+
+ /**
+ * Returns the native type name for the given java mime type.
+ */
+ public static String encodeJavaMIMEType (String mime)
+ {
+ return null;
+ }
+
+ /**
+ * Returns the native type name for the given data flavor.
+ */
+ public static String encodeDataFlavor (DataFlavor df)
+ {
+ return null;
+ }
+
+ /**
+ * Returns true if the native type name can be represented as
+ * a java mime type.
+ */
+ public static boolean isJavaMIMEType (String name)
+ {
+ return false;
+ }
+
+ /**
+ * Returns the java mime type for the given the native type name.
+ */
+ public static String decodeJavaMIMEType (String name)
+ {
+ return null;
+ }
+
+ /**
+ * Returns the data flavor given the native type name
+ * or null when no such data flavor exists.
+ */
+ public static DataFlavor decodeDataFlavor (String name)
+ throws ClassNotFoundException
+ {
+ String javaMIMEType = decodeJavaMIMEType (name);
+
+ if (javaMIMEType != null)
+ return new DataFlavor (javaMIMEType);
+ else
+ return null;
+ }
+
+ public List getFlavorsForNative (String nat)
+ {
+ throw new Error ("Not implemented");
+ }
+
+ public List getNativesForFlavor (DataFlavor flav)
+ {
+ throw new Error ("Not implemented");
+ }
} // class SystemFlavorMap
-
diff --git a/libjava/java/awt/dnd/DragGestureEvent.java b/libjava/java/awt/dnd/DragGestureEvent.java
index 84fa1cbb901..3d268820ba7 100644
--- a/libjava/java/awt/dnd/DragGestureEvent.java
+++ b/libjava/java/awt/dnd/DragGestureEvent.java
@@ -113,15 +113,42 @@ public class DragGestureEvent extends EventObject
{
return null;
}
+
+ /**
+ * Starts the drag given the initial Cursor to display, the Transferable
+ * object, and the DragSourceListener to use.
+ *
+ * @exception InvalidDnDOperationException If the Drag and Drop system is
+ * unable to initiate a drag operation, or if the user attempts to start
+ * a drag while an existing drag operation is still executing.
+ */
public void startDrag(Cursor dragCursor, Transferable trans)
{
startDrag(dragCursor, null, null, trans, null);
}
+
+ /**
+ * Starts the drag given the initial Cursor to display, the Transferable
+ * object, and the DragSourceListener to use.
+ *
+ * @exception InvalidDnDOperationException If the Drag and Drop system is
+ * unable to initiate a drag operation, or if the user attempts to start
+ * a drag while an existing drag operation is still executing.
+ */
public void startDrag(Cursor dragCursor, Transferable trans,
DragSourceListener l)
{
startDrag(dragCursor, null, null, trans, l);
}
+
+ /**
+ * Starts the drag given the initial Cursor to display, the Transferable
+ * object, and the DragSourceListener to use.
+ *
+ * @exception InvalidDnDOperationException If the Drag and Drop system is
+ * unable to initiate a drag operation, or if the user attempts to start
+ * a drag while an existing drag operation is still executing.
+ */
public void startDrag(Cursor dragCursor, Image dragImage, Point imageOffset,
Transferable trans, DragSourceListener l)
{
diff --git a/libjava/java/awt/dnd/DragGestureRecognizer.java b/libjava/java/awt/dnd/DragGestureRecognizer.java
index 674e26e8a3b..cd204b6fe93 100644
--- a/libjava/java/awt/dnd/DragGestureRecognizer.java
+++ b/libjava/java/awt/dnd/DragGestureRecognizer.java
@@ -130,6 +130,12 @@ public abstract class DragGestureRecognizer implements Serializable
throw new Error("not implemented");
}
+ /**
+ * Register a new DragGestureListener.
+ *
+ * @exception TooManyListenersException If a DragGestureListener has already
+ * been added.
+ */
public void addDragGestureListener(DragGestureListener dgl)
throws TooManyListenersException
{
diff --git a/libjava/java/awt/dnd/DragSource.java b/libjava/java/awt/dnd/DragSource.java
index 01cae00a3cf..740235ac83c 100644
--- a/libjava/java/awt/dnd/DragSource.java
+++ b/libjava/java/awt/dnd/DragSource.java
@@ -40,6 +40,8 @@ package java.awt.dnd;
import java.awt.Component;
import java.awt.Cursor;
+import java.awt.GraphicsEnvironment;
+import java.awt.HeadlessException;
import java.awt.Image;
import java.awt.Point;
import java.awt.datatransfer.FlavorMap;
@@ -62,10 +64,20 @@ public class DragSource implements Serializable
public static final Cursor DefaultMoveNoDrop = null;
public static final Cursor DefaultLinkNoDrop = null;
+ /**
+ * Initializes the drag source.
+ *
+ * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true.
+ */
public DragSource()
{
+ if (GraphicsEnvironment.isHeadless())
+ throw new HeadlessException ();
}
+ /**
+ * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true.
+ */
public static DragSource getDefaultDragSource()
{
return null;
@@ -76,6 +88,13 @@ public class DragSource implements Serializable
return false;
}
+ /**
+ * Start a drag, given the DragGestureEvent that initiated the drag.
+ *
+ * @exception InvalidDnDOperationException If the Drag and Drop system is
+ * unable to initiate a drag operation, or if the user attempts to start
+ * a drag while an existing drag operation is still executing.
+ */
public void startDrag(DragGestureEvent trigger, Cursor dragCursor,
Image dragImage, Point imageOffset,
Transferable trans, DragSourceListener dsl,
@@ -83,6 +102,13 @@ public class DragSource implements Serializable
{
}
+ /**
+ * Start a drag, given the DragGestureEvent that initiated the drag.
+ *
+ * @exception InvalidDnDOperationException If the Drag and Drop system is
+ * unable to initiate a drag operation, or if the user attempts to start
+ * a drag while an existing drag operation is still executing.
+ */
public void startDrag(DragGestureEvent trigger, Cursor dragCursor,
Transferable trans, DragSourceListener dsl,
FlavorMap map)
@@ -90,6 +116,13 @@ public class DragSource implements Serializable
startDrag(trigger, dragCursor, null, null, trans, dsl, map);
}
+ /**
+ * Start a drag, given the DragGestureEvent that initiated the drag.
+ *
+ * @exception InvalidDnDOperationException If the Drag and Drop system is
+ * unable to initiate a drag operation, or if the user attempts to start
+ * a drag while an existing drag operation is still executing.
+ */
public void startDrag(DragGestureEvent trigger, Cursor dragCursor,
Image dragImage, Point imageOffset,
Transferable trans, DragSourceListener dsl)
@@ -97,12 +130,25 @@ public class DragSource implements Serializable
startDrag(trigger, dragCursor, dragImage, imageOffset, trans, dsl, null);
}
+ /**
+ * Start a drag, given the DragGestureEvent that initiated the drag.
+ *
+ * @exception InvalidDnDOperationException If the Drag and Drop system is
+ * unable to initiate a drag operation, or if the user attempts to start
+ * a drag while an existing drag operation is still executing.
+ */
public void startDrag(DragGestureEvent trigger, Cursor dragCursor,
Transferable trans, DragSourceListener dsl)
{
startDrag(trigger, dragCursor, null, null, trans, dsl, null);
}
+ /**
+ * Creates the DragSourceContext to handle this drag.
+ *
+ * @exception IllegalArgumentException FIXME
+ * @exception NullPointerException If dscp, dgl, dragImage or t is null.
+ */
protected DragSourceContext
createDragSourceContext(DragSourceContextPeer peer, DragGestureEvent dge,
Cursor cursor, Image image, Point offset,
diff --git a/libjava/java/awt/dnd/DropTarget.java b/libjava/java/awt/dnd/DropTarget.java
index c469605b8b4..53c09178d32 100644
--- a/libjava/java/awt/dnd/DropTarget.java
+++ b/libjava/java/awt/dnd/DropTarget.java
@@ -42,10 +42,13 @@ import java.awt.Component;
import java.awt.datatransfer.FlavorMap;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
+import java.io.Serializable;
+import java.util.EventListener;
import java.util.TooManyListenersException;
/** STUB CLASS ONLY */
public class DropTarget
+ implements DropTargetListener, EventListener, Serializable
{
protected static class DropTargetAutoScroller
implements ActionListener
@@ -67,6 +70,9 @@ public class DropTarget
}
}
+ // FIXME: check the correctness of default value.
+ private boolean isActive = false;
+
/**
* FIXME
*
@@ -133,11 +139,12 @@ public class DropTarget
public void setActive(boolean isActive)
{
+ this.isActive = isActive;
}
public boolean isActive()
{
- return false;
+ return this.isActive;
}
/**
diff --git a/libjava/java/awt/event/WindowEvent.java b/libjava/java/awt/event/WindowEvent.java
index ca51ba545b4..6e40d5165b8 100644
--- a/libjava/java/awt/event/WindowEvent.java
+++ b/libjava/java/awt/event/WindowEvent.java
@@ -109,7 +109,7 @@ public class WindowEvent extends ComponentEvent
public static final int WINDOW_STATE_CHANGED = 209;
/** This is the last id in the range of event ids used by this class. */
- public static final int WINDOW_LAST = 207;
+ public static final int WINDOW_LAST = 209;
/**
* The other Window involved in a focus or activation change. For
diff --git a/libjava/java/awt/geom/Dimension2D.java b/libjava/java/awt/geom/Dimension2D.java
index e111e5434cf..dbbdf6b25b3 100644
--- a/libjava/java/awt/geom/Dimension2D.java
+++ b/libjava/java/awt/geom/Dimension2D.java
@@ -86,6 +86,7 @@ public abstract class Dimension2D implements Cloneable
* may occur.
*
* @param d the dimension containing the new values
+ *
* @throws NullPointerException if d is null
*/
public void setSize(Dimension2D d)
@@ -98,6 +99,10 @@ public abstract class Dimension2D implements Cloneable
* as this one.
*
* @return the clone
+ *
+ * @exception OutOfMemoryError If there is not enough memory available.
+ *
+ * @since 1.2
*/
public Object clone()
{
diff --git a/libjava/java/awt/geom/GeneralPath.java b/libjava/java/awt/geom/GeneralPath.java
index 267db6ca0e3..6c1b578fc19 100644
--- a/libjava/java/awt/geom/GeneralPath.java
+++ b/libjava/java/awt/geom/GeneralPath.java
@@ -338,6 +338,10 @@ public final class GeneralPath implements Shape, Cloneable
* this one.
*
* @return the clone
+ *
+ * @exception OutOfMemoryError If there is not enough memory available.
+ *
+ * @since 1.2
*/
public Object clone()
{
diff --git a/libjava/java/awt/geom/Line2D.java b/libjava/java/awt/geom/Line2D.java
index 9e551103332..d2dd65c4341 100644
--- a/libjava/java/awt/geom/Line2D.java
+++ b/libjava/java/awt/geom/Line2D.java
@@ -752,6 +752,10 @@ public abstract class Line2D implements Shape, Cloneable
* this one.
*
* @return the clone
+ *
+ * @exception OutOfMemoryError If there is not enough memory available.
+ *
+ * @since 1.2
*/
public Object clone()
{
diff --git a/libjava/java/awt/geom/PathIterator.java b/libjava/java/awt/geom/PathIterator.java
index 6cf77d74df2..c23eb351306 100644
--- a/libjava/java/awt/geom/PathIterator.java
+++ b/libjava/java/awt/geom/PathIterator.java
@@ -84,7 +84,7 @@ public interface PathIterator
* (P1), and final interpolated control point (P2):
* <pre>
* P(t) = B(2,0)*CP + B(2,1)*P1 + B(2,2)*P2
- * 0 <= t <= 1
+ * 0 &lt;= t &lt;= 1
* B(n,m) = mth coefficient of nth degree Bernstein polynomial
* = C(n,m) * t^(m) * (1 - t)^(n-m)
* C(n,m) = Combinations of n things, taken m at a time
@@ -100,7 +100,7 @@ public interface PathIterator
* (P2), and final interpolated control point (P3):
* <pre>
* P(t) = B(3,0)*CP + B(3,1)*P1 + B(3,2)*P2 + B(3,3)*P3
- * 0 <= t <= 1
+ * 0 &lt;= t &lt;= 1
* B(n,m) = mth coefficient of nth degree Bernstein polynomial
* = C(n,m) * t^(m) * (1 - t)^(n-m)
* C(n,m) = Combinations of n things, taken m at a time
diff --git a/libjava/java/awt/geom/QuadCurve2D.java b/libjava/java/awt/geom/QuadCurve2D.java
index 2f1aafad21b..05748fc979d 100644
--- a/libjava/java/awt/geom/QuadCurve2D.java
+++ b/libjava/java/awt/geom/QuadCurve2D.java
@@ -289,6 +289,10 @@ public abstract class QuadCurve2D implements Shape, Cloneable
* this one.
*
* @return the clone
+ *
+ * @exception OutOfMemoryError If there is not enough memory available.
+ *
+ * @since 1.2
*/
public Object clone()
{
diff --git a/libjava/java/awt/im/InputMethodHighlight.java b/libjava/java/awt/im/InputMethodHighlight.java
index 5398fc5de77..2946d259b91 100644
--- a/libjava/java/awt/im/InputMethodHighlight.java
+++ b/libjava/java/awt/im/InputMethodHighlight.java
@@ -178,7 +178,7 @@ public class InputMethodHighlight
* @return the style map
* @since 1.3
*/
- public Map getSytle()
+ public Map getStyle()
{
return style;
}
diff --git a/libjava/java/awt/image/ColorModel.java b/libjava/java/awt/image/ColorModel.java
index 14a1b2e73b9..fab51667edb 100644
--- a/libjava/java/awt/image/ColorModel.java
+++ b/libjava/java/awt/image/ColorModel.java
@@ -120,10 +120,32 @@ public abstract class ColorModel implements Transparency
Buffers.smallestAppropriateTransferType(bits * 4));
}
+ /**
+ * Constructs a ColorModel that translates pixel values to
+ * color/alpha components.
+ *
+ * @exception IllegalArgumentException If the length of the bit array is less
+ * than the number of color or alpha components in this ColorModel, or if the
+ * transparency is not a valid value, or if the sum of the number of bits in
+ * bits is less than 1 or if any of the elements in bits is less than 0.
+ */
protected ColorModel(int pixel_bits, int[] bits, ColorSpace cspace,
boolean hasAlpha, boolean isAlphaPremultiplied,
int transparency, int transferType)
{
+ int bits_sum = 0;
+ for (int i = 0; i < bits.length; i++)
+ {
+ if (bits [i] < 0)
+ throw new IllegalArgumentException ();
+
+ bits_sum |= bits [i];
+ }
+
+ if ((bits.length < cspace.numComponents)
+ || (bits_sum < 1))
+ throw new IllegalArgumentException ();
+
this.pixel_bits = pixel_bits;
this.bits = bits;
this.cspace = cspace;
diff --git a/libjava/java/awt/image/ImageFilter.java b/libjava/java/awt/image/ImageFilter.java
index b34bb7d9cd3..86bc0210a4b 100644
--- a/libjava/java/awt/image/ImageFilter.java
+++ b/libjava/java/awt/image/ImageFilter.java
@@ -81,9 +81,18 @@ public class ImageFilter implements ImageConsumer, Cloneable
*
* @see java.lang.Object#clone ()
*/
- public Object clone() throws CloneNotSupportedException
+ public Object clone()
{
- return (super.clone());
+ try
+ {
+ return super.clone();
+ }
+ catch (CloneNotSupportedException e)
+ {
+ // This should never happen as this class implements the
+ // Cloneable interface.
+ throw new InternalError ();
+ }
}
/**
diff --git a/libjava/java/beans/PropertyDescriptor.java b/libjava/java/beans/PropertyDescriptor.java
index b75cac9e766..00db4166ced 100644
--- a/libjava/java/beans/PropertyDescriptor.java
+++ b/libjava/java/beans/PropertyDescriptor.java
@@ -65,280 +65,312 @@ import java.lang.reflect.*;
**/
public class PropertyDescriptor extends FeatureDescriptor {
- Class propertyType;
- Method getMethod;
- Method setMethod;
-
- Class propertyEditorClass;
- boolean bound;
- boolean constrained;
-
- PropertyDescriptor(String name) {
- setName(name);
- }
-
- /** Create a new PropertyDescriptor by introspection.
- ** This form of constructor creates the PropertyDescriptor by
- ** looking for a getter method named <CODE>get&lt;name&gt;()</CODE>
- ** (or, optionally, if the property is boolean,
- ** <CODE>is&lt;name&gt;()</CODE>) and
- ** <CODE>set&lt;name&gt;()</CODE> in class
- ** <CODE>&lt;beanClass&gt;</CODE>, where &lt;name&gt; has its
- ** first letter capitalized by the constructor.<P>
- **
- ** <B>Implementation note:</B> If there is a get method (or
- ** boolean isXXX() method), then the return type of that method
- ** is used to find the set method. If there is no get method,
- ** then the set method is searched for exhaustively.<P>
- **
- ** <B>Spec note:</B>
- ** If there is no get method and multiple set methods with
- ** the same name and a single parameter (different type of course),
- ** then an IntrospectionException is thrown. While Sun's spec
- ** does not state this, it can make Bean behavior different on
- ** different systems (since method order is not guaranteed) and as
- ** such, can be treated as a bug in the spec. I am not aware of
- ** whether Sun's implementation catches this.
- **
- ** @param name the programmatic name of the property, usually
- ** starting with a lowercase letter (e.g. fooManChu
- ** instead of FooManChu).
- ** @param beanClass the class the get and set methods live in.
- ** @exception IntrospectionException if the methods are not found or invalid.
- **/
- public PropertyDescriptor(String name, Class beanClass) throws IntrospectionException {
- setName(name);
- String capitalized;
- try {
- capitalized = Character.toUpperCase(name.charAt(0)) + name.substring(1);
- } catch(StringIndexOutOfBoundsException e) {
- capitalized = "";
- }
- findMethods(beanClass, "is" + capitalized, "get" + capitalized, "set" + capitalized);
- }
-
- /** Create a new PropertyDescriptor by introspection.
- ** This form of constructor allows you to specify the
- ** names of the get and set methods to search for.<P>
- **
- ** <B>Implementation note:</B> If there is a get method (or
- ** boolean isXXX() method), then the return type of that method
- ** is used to find the set method. If there is no get method,
- ** then the set method is searched for exhaustively.<P>
- **
- ** <B>Spec note:</B>
- ** If there is no get method and multiple set methods with
- ** the same name and a single parameter (different type of course),
- ** then an IntrospectionException is thrown. While Sun's spec
- ** does not state this, it can make Bean behavior different on
- ** different systems (since method order is not guaranteed) and as
- ** such, can be treated as a bug in the spec. I am not aware of
- ** whether Sun's implementation catches this.
- **
- ** @param name the programmatic name of the property, usually
- ** starting with a lowercase letter (e.g. fooManChu
- ** instead of FooManChu).
- ** @param beanClass the class the get and set methods live in.
- ** @param getMethodName the name of the get method.
- ** @param setMethodName the name of the set method.
- ** @exception IntrospectionException if the methods are not found or invalid.
- **/
- public PropertyDescriptor(String name, Class beanClass, String getMethodName, String setMethodName) throws IntrospectionException {
- setName(name);
- findMethods(beanClass, getMethodName, null, setMethodName);
- }
-
- /** Create a new PropertyDescriptor using explicit Methods.
- ** Note that the methods will be checked for conformance to standard
- ** Property method rules, as described above at the top of this class.
- **
- ** @param name the programmatic name of the property, usually
- ** starting with a lowercase letter (e.g. fooManChu
- ** instead of FooManChu).
- ** @param getMethod the get method.
- ** @param setMethod the set method.
- ** @exception IntrospectionException if the methods are not found or invalid.
- **/
- public PropertyDescriptor(String name, Method getMethod, Method setMethod) throws IntrospectionException {
- setName(name);
- if(getMethod != null && getMethod.getParameterTypes().length > 0) {
- throw new IntrospectionException("get method has parameters");
- }
- if(setMethod != null && setMethod.getParameterTypes().length != 1) {
- throw new IntrospectionException("set method does not have exactly one parameter");
- }
- if(getMethod != null && setMethod != null) {
- if(!getMethod.getReturnType().equals(setMethod.getParameterTypes()[0])) {
- throw new IntrospectionException("set and get methods do not share the same type");
- }
- if(!getMethod.getDeclaringClass().isAssignableFrom(setMethod.getDeclaringClass())
- && !setMethod.getDeclaringClass().isAssignableFrom(getMethod.getDeclaringClass())) {
- throw new IntrospectionException("set and get methods are not in the same class.");
- }
- }
- this.getMethod = getMethod;
- this.setMethod = setMethod;
- if(getMethod != null) {
- this.propertyType = getMethod.getReturnType();
- } else {
- this.propertyType = setMethod.getParameterTypes()[0];
- }
- }
-
- /** Get the property type.
- ** This is the type the get method returns and the set method
- ** takes in.
- **/
- public Class getPropertyType() {
- return propertyType;
- }
-
- /** Get the get method. Why they call it readMethod here and
- ** get everywhere else is beyond me.
- **/
- public Method getReadMethod() {
- return getMethod;
- }
-
- /** Get the set method. Why they call it writeMethod here and
- ** set everywhere else is beyond me.
- **/
- public Method getWriteMethod() {
- return setMethod;
+ Class propertyType;
+ Method getMethod;
+ Method setMethod;
+
+ Class propertyEditorClass;
+ boolean bound;
+ boolean constrained;
+
+ PropertyDescriptor(String name) {
+ setName(name);
+ }
+
+ /** Create a new PropertyDescriptor by introspection.
+ ** This form of constructor creates the PropertyDescriptor by
+ ** looking for a getter method named <CODE>get&lt;name&gt;()</CODE>
+ ** (or, optionally, if the property is boolean,
+ ** <CODE>is&lt;name&gt;()</CODE>) and
+ ** <CODE>set&lt;name&gt;()</CODE> in class
+ ** <CODE>&lt;beanClass&gt;</CODE>, where &lt;name&gt; has its
+ ** first letter capitalized by the constructor.<P>
+ **
+ ** <B>Implementation note:</B> If there is both are both isXXX and
+ ** getXXX methods, the former is used in preference to the latter.
+ ** We do not check that an isXXX method returns a boolean. In both
+ ** cases, this matches the behaviour of JDK 1.4<P>
+ **
+ ** @param name the programmatic name of the property, usually
+ ** starting with a lowercase letter (e.g. fooManChu
+ ** instead of FooManChu).
+ ** @param beanClass the class the get and set methods live in.
+ ** @exception IntrospectionException if the methods are not found
+ ** or invalid.
+ **/
+ public PropertyDescriptor(String name, Class beanClass)
+ throws IntrospectionException
+ {
+ setName(name);
+ if (name.length() == 0) {
+ throw new IntrospectionException("empty property name");
+ }
+ String caps = Character.toUpperCase(name.charAt(0)) + name.substring(1);
+ findMethods(beanClass, "is" + caps, "get" + caps, "set" + caps);
+ if (getMethod == null) {
+ throw new IntrospectionException("Cannot find an is" + caps +
+ " or get" + caps + " method");
+ }
+ if (setMethod == null) {
+ throw new IntrospectionException("Cannot find a " + caps + " method");
+ }
+ checkMethods();
+ }
+
+ /** Create a new PropertyDescriptor by introspection.
+ ** This form of constructor allows you to specify the
+ ** names of the get and set methods to search for.<P>
+ **
+ ** <B>Implementation note:</B> If there is a get method (or
+ ** boolean isXXX() method), then the return type of that method
+ ** is used to find the set method. If there is no get method,
+ ** then the set method is searched for exhaustively.<P>
+ **
+ ** <B>Spec note:</B>
+ ** If there is no get method and multiple set methods with
+ ** the same name and a single parameter (different type of course),
+ ** then an IntrospectionException is thrown. While Sun's spec
+ ** does not state this, it can make Bean behavior different on
+ ** different systems (since method order is not guaranteed) and as
+ ** such, can be treated as a bug in the spec. I am not aware of
+ ** whether Sun's implementation catches this.
+ **
+ ** @param name the programmatic name of the property, usually
+ ** starting with a lowercase letter (e.g. fooManChu
+ ** instead of FooManChu).
+ ** @param beanClass the class the get and set methods live in.
+ ** @param getMethodName the name of the get method.
+ ** @param setMethodName the name of the set method.
+ ** @exception IntrospectionException if the methods are not found
+ ** or invalid.
+ **/
+ public PropertyDescriptor(String name, Class beanClass,
+ String getMethodName, String setMethodName)
+ throws IntrospectionException
+ {
+ setName(name);
+ findMethods(beanClass, getMethodName, null, setMethodName);
+ if (getMethod == null && getMethodName != null) {
+ throw new IntrospectionException("Cannot find a getter method called " +
+ getMethodName);
+ }
+ if (setMethod == null && setMethodName != null) {
+ throw new IntrospectionException("Cannot find a setter method called " +
+ setMethodName);
+ }
+ checkMethods();
+ }
+
+ /** Create a new PropertyDescriptor using explicit Methods.
+ ** Note that the methods will be checked for conformance to standard
+ ** Property method rules, as described above at the top of this class.
+ **
+ ** @param name the programmatic name of the property, usually
+ ** starting with a lowercase letter (e.g. fooManChu
+ ** instead of FooManChu).
+ ** @param getMethod the get method.
+ ** @param setMethod the set method.
+ ** @exception IntrospectionException if the methods are not found
+ ** or invalid.
+ **/
+ public PropertyDescriptor(String name, Method getMethod, Method setMethod)
+ throws IntrospectionException
+ {
+ setName(name);
+ this.getMethod = getMethod;
+ this.setMethod = setMethod;
+ if (getMethod != null) {
+ this.propertyType = getMethod.getReturnType();
+ }
+ else if (setMethod != null) {
+ this.propertyType = setMethod.getParameterTypes()[0];
+ }
+ checkMethods();
+ }
+
+ /** Get the property type.
+ ** This is the type the get method returns and the set method
+ ** takes in.
+ **/
+ public Class getPropertyType() {
+ return propertyType;
+ }
+
+ /** Get the get method. Why they call it readMethod here and
+ ** get everywhere else is beyond me.
+ **/
+ public Method getReadMethod() {
+ return getMethod;
+ }
+
+ /** Get the set method. Why they call it writeMethod here and
+ ** set everywhere else is beyond me.
+ **/
+ public Method getWriteMethod() {
+ return setMethod;
+ }
+
+ /** Get whether the property is bound. Defaults to false. **/
+ public boolean isBound() {
+ return bound;
+ }
+
+ /** Set whether the property is bound.
+ ** As long as the the bean implements addPropertyChangeListener() and
+ ** removePropertyChangeListener(), setBound(true) may safely be called.<P>
+ ** If these things are not true, then the behavior of the system
+ ** will be undefined.<P>
+ **
+ ** When a property is bound, its set method is required to fire the
+ ** <CODE>PropertyChangeListener.propertyChange())</CODE> event
+ ** after the value has changed.
+ ** @param bound whether the property is bound or not.
+ **/
+ public void setBound(boolean bound) {
+ this.bound = bound;
+ }
+
+ /** Get whether the property is constrained. Defaults to false. **/
+ public boolean isConstrained() {
+ return constrained;
+ }
+
+ /** Set whether the property is constrained.
+ ** If the set method throws <CODE>java.beans.PropertyVetoException</CODE>
+ ** (or subclass thereof) and the bean implements addVetoableChangeListener()
+ ** and removeVetoableChangeListener(), then setConstrained(true) may safely
+ ** be called. Otherwise, the system behavior is undefined.
+ ** <B>Spec note:</B> given those strict parameters, it would be nice if it
+ ** got set automatically by detection, but oh well.<P>
+ ** When a property is constrained, its set method is required to:<P>
+ ** <OL>
+ ** <LI>Fire the <CODE>VetoableChangeListener.vetoableChange()</CODE>
+ ** event notifying others of the change and allowing them a chance to
+ ** say it is a bad thing.</LI>
+ ** <LI>If any of the listeners throws a PropertyVetoException, then
+ ** it must fire another vetoableChange() event notifying the others
+ ** of a reversion to the old value (though, of course, the change
+ ** was never made). Then it rethrows the PropertyVetoException and
+ ** exits.</LI>
+ ** <LI>If all has gone well to this point, the value may be changed.</LI>
+ ** </OL>
+ ** @param constrained whether the property is constrained or not.
+ **/
+ public void setConstrained(boolean constrained) {
+ this.constrained = constrained;
+ }
+
+ /** Get the PropertyEditor class. Defaults to null. **/
+ public Class getPropertyEditorClass() {
+ return propertyEditorClass;
+ }
+
+ /** Set the PropertyEditor class. If the class does not implement
+ ** the PropertyEditor interface, you will likely get an exception
+ ** late in the game.
+ ** @param propertyEditorClass the PropertyEditor class for this
+ ** class to use.
+ **/
+ public void setPropertyEditorClass(Class propertyEditorClass) {
+ this.propertyEditorClass = propertyEditorClass;
+ }
+
+ private void findMethods(Class beanClass, String getMethodName1,
+ String getMethodName2, String setMethodName)
+ throws IntrospectionException
+ {
+ try {
+ // Try the first get method name
+ if (getMethodName1 != null) {
+ try {
+ getMethod = beanClass.getMethod(getMethodName1, new Class[0]);
+ }
+ catch (NoSuchMethodException e) {
}
+ }
- /** Get whether the property is bound. Defaults to false. **/
- public boolean isBound() {
- return bound;
+ // Fall back to the second get method name
+ if (getMethod == null && getMethodName2 != null) {
+ try {
+ getMethod = beanClass.getMethod(getMethodName2, new Class[0]);
+ }
+ catch (NoSuchMethodException e) {
}
+ }
- /** Set whether the property is bound.
- ** As long as the the bean implements addPropertyChangeListener() and
- ** removePropertyChangeListener(), setBound(true) may safely be called.<P>
- ** If these things are not true, then the behavior of the system
- ** will be undefined.<P>
- **
- ** When a property is bound, its set method is required to fire the
- ** <CODE>PropertyChangeListener.propertyChange())</CODE> event
- ** after the value has changed.
- ** @param bound whether the property is bound or not.
- **/
- public void setBound(boolean bound) {
- this.bound = bound;
+ // Try the set method name
+ if (setMethodName != null) {
+ if (getMethod != null) {
+ // If there is a get method, use its return type to help
+ // select the corresponding set method.
+ Class propertyType = getMethod.getReturnType();
+ if (propertyType == Void.TYPE) {
+ String msg = "The property's read method has return type 'void'";
+ throw new IntrospectionException(msg);
+ }
+
+ Class[] setArgs = new Class[]{propertyType};
+ try {
+ setMethod = beanClass.getMethod(setMethodName, setArgs);
+ }
+ catch (NoSuchMethodException e) {
+ }
}
-
- /** Get whether the property is constrained. Defaults to false. **/
- public boolean isConstrained() {
- return constrained;
- }
-
- /** Set whether the property is constrained.
- ** If the set method throws <CODE>java.beans.PropertyVetoException</CODE>
- ** (or subclass thereof) and the bean implements addVetoableChangeListener()
- ** and removeVetoableChangeListener(), then setConstrained(true) may safely
- ** be called. Otherwise, the system behavior is undefined.
- ** <B>Spec note:</B> given those strict parameters, it would be nice if it
- ** got set automatically by detection, but oh well.<P>
- ** When a property is constrained, its set method is required to:<P>
- ** <OL>
- ** <LI>Fire the <CODE>VetoableChangeListener.vetoableChange()</CODE>
- ** event notifying others of the change and allowing them a chance to
- ** say it is a bad thing.</LI>
- ** <LI>If any of the listeners throws a PropertyVetoException, then
- ** it must fire another vetoableChange() event notifying the others
- ** of a reversion to the old value (though, of course, the change
- ** was never made). Then it rethrows the PropertyVetoException and
- ** exits.</LI>
- ** <LI>If all has gone well to this point, the value may be changed.</LI>
- ** </OL>
- ** @param constrained whether the property is constrained or not.
- **/
- public void setConstrained(boolean constrained) {
- this.constrained = constrained;
+ else if (getMethodName1 == null && getMethodName2 == null) {
+ // If this is a write-only property, choose the first set method
+ // with the required name, one parameter and return type 'void'
+ Method[] methods = beanClass.getMethods();
+ for (int i = 0; i < methods.length; i++) {
+ if (methods[i].getName().equals(setMethodName) &&
+ methods[i].getParameterTypes().length == 1 &&
+ methods[i].getReturnType() == Void.TYPE) {
+ setMethod = methods[i];
+ break;
+ }
+ }
}
+ }
+ }
+ catch (SecurityException e) {
+ // FIXME -- shouldn't we just allow SecurityException to propagate?
+ String msg = "SecurityException thrown on attempt to access methods.";
+ throw new IntrospectionException(msg);
+ }
+ }
- /** Get the PropertyEditor class. Defaults to null. **/
- public Class getPropertyEditorClass() {
- return propertyEditorClass;
+ private void checkMethods()
+ throws IntrospectionException
+ {
+ if (getMethod != null) {
+ if (getMethod.getParameterTypes().length > 0) {
+ throw new IntrospectionException("get method has parameters");
+ }
+ this.propertyType = getMethod.getReturnType();
+ if (propertyType == Void.TYPE) {
+ throw new IntrospectionException("get method has void return type");
+ }
+ }
+ if (setMethod != null) {
+ if (setMethod.getParameterTypes().length != 1) {
+ String msg = "set method does not have exactly one parameter";
+ throw new IntrospectionException(msg);
+ }
+ if (getMethod == null) {
+ propertyType = setMethod.getParameterTypes()[0];
+ }
+ else {
+ if (!propertyType.equals(setMethod.getParameterTypes()[0])) {
+ String msg = "set and get methods do not share the same type";
+ throw new IntrospectionException(msg);
}
-
- /** Set the PropertyEditor class. If the class does not implement
- ** the PropertyEditor interface, you will likely get an exception
- ** late in the game.
- ** @param propertyEditorClass the PropertyEditor class for this class to use.
- **/
- public void setPropertyEditorClass(Class propertyEditorClass) {
- this.propertyEditorClass = propertyEditorClass;
- }
-
- private void findMethods(Class beanClass, String getMethodName1, String getMethodName2, String setMethodName) throws IntrospectionException {
- try {
- if(getMethodName1 != null) {
- try {
- getMethod = beanClass.getMethod(getMethodName1, new Class[0]);
- } catch(NoSuchMethodException E) {
- }
- if(getMethodName2 != null) {
- if(getMethod != null && !getMethod.getReturnType().equals(java.lang.Boolean.TYPE)) {
- // If the is() method exists but isn't boolean, we'll just go on and look for
- // an ordinary get() method.
- getMethod = null;
- }
-
- Method getMethod2;
- try {
- getMethod2 = beanClass.getMethod(getMethodName2, new Class[0]);
- } catch(NoSuchMethodException E) {
- getMethod2 = null;
- }
- if(getMethod2 != null) {
- if(getMethod != null) {
- if(!getMethod.getReturnType().equals(getMethod2.getReturnType())) {
- throw new IntrospectionException("Both " + getMethodName1 + " and " + getMethodName2 + " exist, and have contradictory return types.");
- }
- } else {
- getMethod = getMethod2;
- }
- }
- }
- }
-
- if(getMethod != null) {
- propertyType = getMethod.getReturnType();
- if(setMethodName != null) {
- Class[] setArgs = new Class[1];
- setArgs[0] = propertyType;
- try {
- setMethod = beanClass.getMethod(setMethodName, setArgs);
- if(!setMethod.getReturnType().equals(java.lang.Void.TYPE)) {
- throw new IntrospectionException(setMethodName + " has non-void return type");
- }
- } catch(NoSuchMethodException E) {
- }
- }
- } else if(setMethodName != null) {
- Method[] m = beanClass.getMethods();
- for(int i=0;i<m.length;i++) {
- Method current = m[i];
- if(current.getName().equals(setMethodName)
- && current.getParameterTypes().length == 1
- && current.getReturnType().equals(java.lang.Void.TYPE)) {
- if(setMethod != null) {
- throw new IntrospectionException("Multiple, different set methods found that fit the bill!");
- } else {
- setMethod = current;
- propertyType = current.getParameterTypes()[0];
- }
- }
- }
- if(setMethod == null) {
- throw new IntrospectionException("Cannot find get or set methods.");
- }
- } else {
- throw new IntrospectionException("Cannot find get or set methods.");
- }
- } catch(SecurityException E) {
- throw new IntrospectionException("SecurityException thrown on attempt to access methods.");
- }
+ if ((!getMethod.getDeclaringClass().
+ isAssignableFrom(setMethod.getDeclaringClass())) &&
+ (!setMethod.getDeclaringClass().
+ isAssignableFrom(getMethod.getDeclaringClass()))) {
+ String msg = "set and get methods are not in the same class.";
+ throw new IntrospectionException(msg);
}
+ }
+ }
+ }
}
diff --git a/libjava/java/io/BufferedOutputStream.java b/libjava/java/io/BufferedOutputStream.java
index 2cbdd4a1687..e324cbcf938 100644
--- a/libjava/java/io/BufferedOutputStream.java
+++ b/libjava/java/io/BufferedOutputStream.java
@@ -1,5 +1,5 @@
/* BufferedOutputStream.java -- Buffer output into large blocks before writing
- Copyright (C) 1998, 2000 Free Software Foundation, Inc.
+ Copyright (C) 1998, 2000, 2003 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -189,11 +189,11 @@ finalize() throws IOException
public synchronized void
write(int b) throws IOException
{
- buf[count] = (byte)(b & 0xFF);
-
- ++count;
if (count == buf.length)
flush();
+
+ buf[count] = (byte)(b & 0xFF);
+ ++count;
}
/*************************************************************************/
diff --git a/libjava/java/io/FileDescriptor.java b/libjava/java/io/FileDescriptor.java
index 08f8edfaa0d..f105c6f8ab0 100644
--- a/libjava/java/io/FileDescriptor.java
+++ b/libjava/java/io/FileDescriptor.java
@@ -1,6 +1,6 @@
// FileDescriptor.java - Open file or device
-/* Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation
+/* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation
This file is part of libgcj.
@@ -101,4 +101,6 @@ public final class FileDescriptor
// we want to make sure this has the value -1. This is the most
// efficient way to accomplish that.
private int fd = -1;
+
+ private long position = 0;
}
diff --git a/libjava/java/io/FileInputStream.java b/libjava/java/io/FileInputStream.java
index d7efc26db87..85d7bbe0879 100644
--- a/libjava/java/io/FileInputStream.java
+++ b/libjava/java/io/FileInputStream.java
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998, 1999, 2001, 2002 Free Software Foundation
+/* Copyright (C) 1998, 1999, 2001, 2002, 2003 Free Software Foundation
This file is part of libgcj.
@@ -61,8 +61,8 @@ public class FileInputStream extends InputStream
protected void finalize() throws IOException
{
- if (fd != null)
- fd.finalize();
+ // We don't actually need this, but we include it because it is
+ // mentioned in the JCL.
}
public final FileDescriptor getFD() throws IOException
diff --git a/libjava/java/io/InputStreamReader.java b/libjava/java/io/InputStreamReader.java
index fff979c97ac..80272d01a22 100644
--- a/libjava/java/io/InputStreamReader.java
+++ b/libjava/java/io/InputStreamReader.java
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998, 1999, 2001 Free Software Foundation
+/* Copyright (C) 1998, 1999, 2001, 2003 Free Software Foundation
This file is part of libgcj.
@@ -70,7 +70,10 @@ public class InputStreamReader extends Reader
}
}
- public String getEncoding() { return converter.getName(); }
+ public String getEncoding()
+ {
+ return in != null ? converter.getName() : null;
+ }
public boolean ready() throws IOException
{
diff --git a/libjava/java/io/ObjectStreamClass.java b/libjava/java/io/ObjectStreamClass.java
index ecdd91d00c6..2111635525a 100644
--- a/libjava/java/io/ObjectStreamClass.java
+++ b/libjava/java/io/ObjectStreamClass.java
@@ -1,6 +1,6 @@
/* ObjectStreamClass.java -- Class used to write class information
about serialized objects.
- Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2000, 2001, 2003 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -44,6 +44,7 @@ import java.lang.reflect.Field;
import java.lang.reflect.Member;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
+import java.lang.reflect.Proxy;
import java.security.DigestOutputStream;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
@@ -76,6 +77,19 @@ public class ObjectStreamClass implements Serializable
if (! (Serializable.class).isAssignableFrom (cl))
return null;
+ return lookupForClassObject (cl);
+ }
+
+ /**
+ * This lookup for internal use by ObjectOutputStream. Suppose
+ * we have a java.lang.Class object C for class A, though A is not
+ * serializable, but it's okay to serialize C.
+ */
+ static ObjectStreamClass lookupForClassObject (Class cl)
+ {
+ if (cl == null)
+ return null;
+
ObjectStreamClass osc = (ObjectStreamClass)classLookupTable.get (cl);
if (osc != null)
@@ -260,22 +274,29 @@ public class ObjectStreamClass implements Serializable
void setClass (Class cl) throws InvalidClassException
{
this.clazz = cl;
+
long class_uid = getClassUID (cl);
if (uid == 0)
+ uid = class_uid;
+ else
{
- uid = class_uid;
- return;
- }
-
- // Check that the actual UID of the resolved class matches the UID from
- // the stream.
- if (uid != class_uid)
- {
- String msg = cl +
- ": Local class not compatible: stream serialVersionUID="
- + uid + ", local serialVersionUID=" + class_uid;
- throw new InvalidClassException (msg);
+ // Check that the actual UID of the resolved class matches the UID from
+ // the stream.
+ if (uid != class_uid)
+ {
+ String msg = cl +
+ ": Local class not compatible: stream serialVersionUID="
+ + uid + ", local serialVersionUID=" + class_uid;
+ throw new InvalidClassException (msg);
+ }
}
+
+ isProxyClass = clazz != null && Proxy.isProxyClass (clazz);
+ ObjectStreamClass osc = (ObjectStreamClass)classLookupTable.get (clazz);
+ if (osc == null)
+ classLookupTable.put (clazz, this);
+ superClass = lookupForClassObject (clazz.getSuperclass ());
+ calculateOffsets ();
}
void setSuperclass (ObjectStreamClass osc)
@@ -328,12 +349,15 @@ public class ObjectStreamClass implements Serializable
{
uid = 0;
flags = 0;
+ isProxyClass = Proxy.isProxyClass (cl);
clazz = cl;
name = cl.getName ();
setFlags (cl);
setFields (cl);
- uid = getClassUID (cl);
+ // to those class nonserializable, its uid field is 0
+ if ( (Serializable.class).isAssignableFrom (cl) && !isProxyClass)
+ uid = getClassUID (cl);
superClass = lookup (cl.getSuperclass ());
}
@@ -377,6 +401,7 @@ public class ObjectStreamClass implements Serializable
{
Field serialPersistentFields
= cl.getDeclaredField ("serialPersistentFields");
+ serialPersistentFields.setAccessible(true);
int modifiers = serialPersistentFields.getModifiers ();
if (Modifier.isStatic (modifiers)
@@ -427,26 +452,27 @@ public class ObjectStreamClass implements Serializable
{
try
{
+ // Use getDeclaredField rather than getField, since serialVersionUID
+ // may not be public AND we only want the serialVersionUID of this
+ // class, not a superclass or interface.
Field suid = cl.getDeclaredField ("serialVersionUID");
+ suid.setAccessible(true);
int modifiers = suid.getModifiers ();
- if (Modifier.isStatic (modifiers) && Modifier.isFinal (modifiers))
- return suid.getLong (null);
+ if (Modifier.isStatic (modifiers)
+ && Modifier.isFinal (modifiers)
+ && suid.getType() == Long.TYPE)
+ return suid.getLong (null);
}
catch (NoSuchFieldException ignore)
- {
- }
+ {}
catch (IllegalAccessException ignore)
- {
- }
+ {}
// cl didn't define serialVersionUID, so we have to compute it
try
{
- MessageDigest md = null;
- DigestOutputStream digest_out = null;
- DataOutputStream data_out = null;
-
+ MessageDigest md;
try
{
md = MessageDigest.getInstance ("SHA");
@@ -459,8 +485,10 @@ public class ObjectStreamClass implements Serializable
md = MessageDigest.getInstance ("SHA");
}
- digest_out = new DigestOutputStream (nullOutputStream, md);
- data_out = new DataOutputStream (digest_out);
+ DigestOutputStream digest_out =
+ new DigestOutputStream (nullOutputStream, md);
+ DataOutputStream data_out = new DataOutputStream (digest_out);
+
data_out.writeUTF (cl.getName ());
int modifiers = cl.getModifiers ();
@@ -497,17 +525,7 @@ public class ObjectStreamClass implements Serializable
}
// write class initializer method if present
- boolean has_init;
- try
- {
- has_init = hasClassInitializer (cl);
- }
- catch (NoSuchMethodError e)
- {
- has_init = false;
- }
-
- if (has_init)
+ if (VMObjectStreamClass.hasClassInitializer (cl))
{
data_out.writeUTF ("<clinit>");
data_out.writeInt (Modifier.STATIC);
@@ -564,11 +582,11 @@ public class ObjectStreamClass implements Serializable
catch (NoSuchAlgorithmException e)
{
throw new RuntimeException ("The SHA algorithm was not found to use in computing the Serial Version UID for class "
- + cl.getName ());
+ + cl.getName (), e);
}
catch (IOException ioe)
{
- throw new RuntimeException (ioe.getMessage ());
+ throw new RuntimeException (ioe);
}
}
@@ -582,6 +600,7 @@ public class ObjectStreamClass implements Serializable
// Use getDeclaredField rather than getField for the same reason
// as above in getDefinedSUID.
Field f = clazz.getDeclaredField ("getSerialPersistentFields");
+ f.setAccessible(true);
o = (ObjectStreamField[])f.get (null);
}
catch (java.lang.NoSuchFieldException e)
@@ -594,29 +613,6 @@ public class ObjectStreamClass implements Serializable
return o;
}
-
- // Returns true if CLAZZ has a static class initializer
- // (a.k.a. <clinit>).
- //
- // A NoSuchMethodError is raised if CLAZZ has no such method.
- private static boolean hasClassInitializer (Class clazz)
- throws java.lang.NoSuchMethodError
- {
- Method m = null;
-
- try
- {
- Class classArgs[] = {};
- m = clazz.getDeclaredMethod ("<clinit>", classArgs);
- }
- catch (java.lang.NoSuchMethodException e)
- {
- throw new java.lang.NoSuchMethodError ();
- }
-
- return m != null;
- }
-
public static final ObjectStreamField[] NO_FIELDS = {};
private static Hashtable classLookupTable = new Hashtable ();
@@ -640,9 +636,12 @@ public class ObjectStreamClass implements Serializable
int primFieldSize = -1; // -1 if not yet calculated
int objectFieldCount;
+ boolean isProxyClass = false;
+
// This is probably not necessary because this class is special cased already
// but it will avoid showing up as a discrepancy when comparing SUIDs.
private static final long serialVersionUID = -6120832682080437368L;
+
}
diff --git a/libjava/java/io/OutputStreamWriter.java b/libjava/java/io/OutputStreamWriter.java
index 527ff75c66b..d49e104773a 100644
--- a/libjava/java/io/OutputStreamWriter.java
+++ b/libjava/java/io/OutputStreamWriter.java
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation
+/* Copyright (C) 1998, 1999, 2000, 2001, 2003 Free Software Foundation
This file is part of libgcj.
@@ -28,7 +28,10 @@ public class OutputStreamWriter extends Writer
private char[] work;
private int wcount;
- public String getEncoding() { return converter.getName(); }
+ public String getEncoding()
+ {
+ return out != null ? converter.getName() : null;
+ }
private OutputStreamWriter(OutputStream out, UnicodeToBytes encoder)
{
diff --git a/libjava/java/io/PipedOutputStream.java b/libjava/java/io/PipedOutputStream.java
index b819f309c2a..09d8db707e9 100644
--- a/libjava/java/io/PipedOutputStream.java
+++ b/libjava/java/io/PipedOutputStream.java
@@ -1,5 +1,5 @@
/* PipedOutputStream.java -- Write portion of piped streams.
- Copyright (C) 1998, 2000, 2001 Free Software Foundation, Inc.
+ Copyright (C) 1998, 2000, 2001, 2003 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -97,7 +97,7 @@ public class PipedOutputStream extends OutputStream
*/
public void connect(PipedInputStream sink) throws IOException
{
- if (sink != null)
+ if (this.sink != null || sink.source != null)
throw new IOException ("Already connected");
sink.connect(this);
}
@@ -154,7 +154,7 @@ public class PipedOutputStream extends OutputStream
* had read all available data. Thats not the case - this method
* appears to be a no-op?
*/
- public void flush()
+ public void flush() throws IOException
{
}
@@ -165,7 +165,7 @@ public class PipedOutputStream extends OutputStream
*
* @exception IOException If an error occurs
*/
- public void close()
+ public void close() throws IOException
{
// A close call on an unconnected PipedOutputStream has no effect.
if (sink != null)
diff --git a/libjava/java/io/PipedWriter.java b/libjava/java/io/PipedWriter.java
index a8844d746f2..e1a21156075 100644
--- a/libjava/java/io/PipedWriter.java
+++ b/libjava/java/io/PipedWriter.java
@@ -1,5 +1,5 @@
/* PipedWriter.java -- Write portion of piped character streams.
- Copyright (C) 1998, 2000, 2001 Free Software Foundation, Inc.
+ Copyright (C) 1998, 2000, 2001, 2003 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -100,7 +100,7 @@ public class PipedWriter extends Writer
*/
public void connect(PipedReader sink) throws IOException
{
- if (sink != null)
+ if (this.sink != null || sink.source != null)
throw new IOException ("Already connected");
sink.connect(this);
}
@@ -166,7 +166,7 @@ public class PipedWriter extends Writer
*
* @exception IOException If an error occurs
*/
- public void close()
+ public void close() throws IOException
{
// A close call on an unconnected PipedWriter has no effect.
if (sink != null)
diff --git a/libjava/java/io/StringWriter.java b/libjava/java/io/StringWriter.java
index edf85715612..660ef166a2e 100644
--- a/libjava/java/io/StringWriter.java
+++ b/libjava/java/io/StringWriter.java
@@ -1,5 +1,5 @@
/* StringWriter.java -- Writes bytes to a StringBuffer
- Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2000, 2001, 2003 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -61,7 +61,7 @@ public class StringWriter extends Writer
* This method closes the stream. The contents of the internal buffer
* can still be retrieved, but future writes are not guaranteed to work.
*/
- public void close ()
+ public void close () throws IOException
{
// JCL says this does nothing. This seems to violate the Writer
// contract, in that other methods should still throw an
diff --git a/libjava/java/io/VMObjectStreamClass.java b/libjava/java/io/VMObjectStreamClass.java
new file mode 100644
index 00000000000..fd4023e402b
--- /dev/null
+++ b/libjava/java/io/VMObjectStreamClass.java
@@ -0,0 +1,50 @@
+/* VMObjectStreamClass.java -- VM helper functions for ObjectStreamClass
+ Copyright (C) 2003 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package java.io;
+
+import java.lang.reflect.Method;
+
+final class VMObjectStreamClass
+{
+ /**
+ * Returns true if CLAZZ has a static class initializer
+ * (a.k.a. <clinit>).
+ */
+ static native boolean hasClassInitializer (Class clazz);
+}
diff --git a/libjava/java/io/natFileDescriptorPosix.cc b/libjava/java/io/natFileDescriptorPosix.cc
index 80e6bad97ae..e8ec9a7e733 100644
--- a/libjava/java/io/natFileDescriptorPosix.cc
+++ b/libjava/java/io/natFileDescriptorPosix.cc
@@ -1,6 +1,6 @@
// natFileDescriptor.cc - Native part of FileDescriptor class.
-/* Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation
+/* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation
This file is part of libgcj.
@@ -147,6 +147,7 @@ java::io::FileDescriptor::write (jint b)
throw new IOException (JvNewStringLatin1 (strerror (errno)));
}
}
+ position++;
}
void
@@ -177,6 +178,7 @@ java::io::FileDescriptor::write (jbyteArray b, jint offset, jint len)
written += r;
len -= r;
bytes += r;
+ position += r;
}
}
@@ -193,7 +195,6 @@ void
java::io::FileDescriptor::setLength (jlong pos)
{
struct stat sb;
- off_t orig;
#ifdef HAVE_FTRUNCATE
if (::fstat (fd, &sb))
@@ -202,10 +203,6 @@ java::io::FileDescriptor::setLength (jlong pos)
if ((jlong) sb.st_size == pos)
return;
- orig = ::lseek (fd, (off_t) 0, SEEK_CUR);
- if (orig == -1)
- throw new IOException (JvNewStringLatin1 (strerror (errno)));
-
// If the file is too short, we extend it. We can't rely on
// ftruncate() extending the file. So we lseek() to 1 byte less
// than we want, and then we write a single byte at the end.
@@ -215,11 +212,15 @@ java::io::FileDescriptor::setLength (jlong pos)
throw new IOException (JvNewStringLatin1 (strerror (errno)));
char out = '\0';
int r = ::write (fd, &out, 1);
- if (r <= 0 || ::lseek (fd, orig, SEEK_SET) == -1)
+ if (r <= 0 || ::lseek (fd, position, SEEK_SET) == -1)
throw new IOException (JvNewStringLatin1 (strerror (errno)));
}
- else if (::ftruncate (fd, (off_t) pos))
- throw new IOException (JvNewStringLatin1 (strerror (errno)));
+ else
+ {
+ if (::ftruncate (fd, (off_t) pos))
+ throw new IOException (JvNewStringLatin1 (strerror (errno)));
+ position = pos;
+ }
#else /* HAVE_FTRUNCATE */
throw new IOException (JvNewStringLatin1 ("FileDescriptor.setLength not implemented"));
#endif /* HAVE_FTRUNCATE */
@@ -230,19 +231,29 @@ java::io::FileDescriptor::seek (jlong pos, jint whence, jboolean eof_trunc)
{
JvAssert (whence == SET || whence == CUR);
- jlong len = length ();
- jlong here = getFilePointer ();
-
- if (eof_trunc
- && ((whence == SET && pos > len) || (whence == CUR && here + pos > len)))
+ if (eof_trunc)
{
- whence = SET;
- pos = len;
+ jlong len = length ();
+ if (whence == SET)
+ {
+ if (pos > len)
+ pos = len;
+ }
+ else
+ {
+ jlong here = getFilePointer ();
+ if (here + pos > len)
+ {
+ pos = len;
+ whence = SET;
+ }
+ }
}
off_t r = ::lseek (fd, (off_t) pos, whence == SET ? SEEK_SET : SEEK_CUR);
if (r == -1)
throw new IOException (JvNewStringLatin1 (strerror (errno)));
+ position = r;
return r;
}
@@ -258,10 +269,7 @@ java::io::FileDescriptor::length (void)
jlong
java::io::FileDescriptor::getFilePointer (void)
{
- off_t r = ::lseek (fd, 0, SEEK_CUR);
- if (r == -1)
- throw new IOException (JvNewStringLatin1 (strerror (errno)));
- return r;
+ return position;
}
jint
@@ -282,6 +290,7 @@ java::io::FileDescriptor::read (void)
}
throw new IOException (JvNewStringLatin1 (strerror (errno)));
}
+ position++;
return b & 0xFF;
}
@@ -313,6 +322,7 @@ java::io::FileDescriptor::read (jbyteArray buffer, jint offset, jint count)
}
throw new IOException (JvNewStringLatin1 (strerror (errno)));
}
+ position += r;
return r;
}
diff --git a/libjava/java/io/natFileDescriptorWin32.cc b/libjava/java/io/natFileDescriptorWin32.cc
index 4b157f7042c..87f94e81222 100644
--- a/libjava/java/io/natFileDescriptorWin32.cc
+++ b/libjava/java/io/natFileDescriptorWin32.cc
@@ -1,6 +1,7 @@
// natFileDescriptorWin32.cc - Native part of FileDescriptor class.
-/* Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+/* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Free Software
+ Foundation, Inc.
This file is part of libgcj.
@@ -288,7 +289,13 @@ java::io::FileDescriptor::read(void)
DWORD read;
if (! ReadFile ((HANDLE)fd, &buf, 1, &read, NULL))
- throw new IOException (JvNewStringLatin1 (winerr ()));
+ {
+ if (GetLastError () == ERROR_BROKEN_PIPE)
+ return -1;
+ else
+ throw new IOException (JvNewStringLatin1 (winerr ()));
+ }
+
if (! read)
return -1;
else
@@ -313,9 +320,15 @@ java::io::FileDescriptor::read(jbyteArray buffer, jint offset, jint count)
DWORD read;
if (! ReadFile((HANDLE)fd, bytes, count, &read, NULL))
- throw new IOException (JvNewStringLatin1 (winerr ()));
+ {
+ if (GetLastError () == ERROR_BROKEN_PIPE)
+ return -1;
+ else
+ throw new IOException (JvNewStringLatin1 (winerr ()));
+ }
if (read == 0) return -1;
+
return (jint)read;
}
diff --git a/libjava/java/io/natFilePosix.cc b/libjava/java/io/natFilePosix.cc
index f9fe78ef203..4946cfccae8 100644
--- a/libjava/java/io/natFilePosix.cc
+++ b/libjava/java/io/natFilePosix.cc
@@ -1,6 +1,6 @@
// natFile.cc - Native part of File class for POSIX.
-/* Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation
+/* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation
This file is part of libgcj.
@@ -60,14 +60,14 @@ java::io::File::_access (jint query)
jboolean
java::io::File::_stat (jint query)
{
+ if (query == ISHIDDEN)
+ return getName()->charAt(0) == '.';
+
+#ifdef HAVE_STAT
char *buf = (char *) __builtin_alloca (JvGetStringUTFLength (path) + 1);
jsize total = JvGetStringUTFRegion (path, 0, path->length(), buf);
buf[total] = '\0';
- if (query == ISHIDDEN)
- return (getName()->charAt(0) == '.');
-
-#ifdef HAVE_STAT
struct stat sb;
if (::stat (buf, &sb))
return false;
@@ -131,7 +131,7 @@ java::io::File::getCanonicalPath (void)
jboolean
java::io::File::isAbsolute (void)
{
- return path->charAt(0) == '/';
+ return path->length() > 0 && path->charAt(0) == '/';
}
jobjectArray
diff --git a/libjava/java/io/natFileWin32.cc b/libjava/java/io/natFileWin32.cc
index ebdaeab1d78..5245feb5a1e 100644
--- a/libjava/java/io/natFileWin32.cc
+++ b/libjava/java/io/natFileWin32.cc
@@ -1,6 +1,6 @@
// natFileWin32.cc - Native part of File class.
-/* Copyright (C) 1998, 1999, 2002 Red Hat, Inc.
+/* Copyright (C) 1998, 1999, 2002, 2003 Red Hat, Inc.
This file is part of libgcj.
@@ -119,7 +119,8 @@ java::io::File::getCanonicalPath (void)
jboolean
java::io::File::isAbsolute (void)
{
- if (path->charAt(0) == '/' || path->charAt(0) == '\\')
+ if (path->length() > 0
+ && (path->charAt(0) == '/' || path->charAt(0) == '\\'))
return true;
if (path->length() < 3)
return false;
@@ -145,8 +146,10 @@ java::io::File::performList (java::io::FilenameFilter *filter,
return NULL;
char *buf = (char *) __builtin_alloca (JvGetStringUTFLength (canon) + 5);
jsize total = JvGetStringUTFRegion (canon, 0, canon->length(), buf);
- // FIXME?
- strcpy(&buf[total], "\\*.*");
+ if (buf[total-1] == '\\')
+ strcpy (&buf[total], "*.*");
+ else
+ strcpy (&buf[total], "\\*.*");
WIN32_FIND_DATA data;
HANDLE handle = FindFirstFile (buf, &data);
diff --git a/libjava/java/io/natVMObjectStreamClass.cc b/libjava/java/io/natVMObjectStreamClass.cc
new file mode 100644
index 00000000000..b7a056c457f
--- /dev/null
+++ b/libjava/java/io/natVMObjectStreamClass.cc
@@ -0,0 +1,23 @@
+// natVMObjectStreamClass.cc - Native part of VMObjectStreamClass class.
+
+/* Copyright (C) 2003 Free Software Foundation
+
+ This VMObjectStreamClass is part of libgcj.
+
+This software is copyrighted work licensed under the terms of the
+Libgcj License. Please consult the ObjectInputStream "LIBGCJ_LICENSE" for
+details. */
+
+#include <gcj/cni.h>
+#include <jvm.h>
+
+#include <java/io/VMObjectStreamClass.h>
+#include <java/lang/Class.h>
+
+jboolean
+java::io::VMObjectStreamClass::hasClassInitializer (jclass klass)
+{
+ _Jv_Method *meth = _Jv_GetMethodLocal(klass, gcj::clinit_name,
+ gcj::void_signature);
+ return (meth != NULL);
+}
diff --git a/libjava/java/lang/Class.h b/libjava/java/lang/Class.h
index 4ccf3886431..0012fc24365 100644
--- a/libjava/java/lang/Class.h
+++ b/libjava/java/lang/Class.h
@@ -1,6 +1,6 @@
// Class.h - Header file for java.lang.Class. -*- c++ -*-
-/* Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation
+/* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation
This file is part of libgcj.
@@ -182,9 +182,9 @@ public:
JArray<java::lang::reflect::Method *> *getMethods (void);
inline jint getModifiers (void)
- {
- return accflags;
- }
+ {
+ return accflags & java::lang::reflect::Modifier::ALL_FLAGS;
+ }
jstring getName (void);
@@ -348,6 +348,7 @@ private:
_Jv_Utf8Const *method_signature);
friend void _Jv_PrepareClass (jclass);
+ friend void _Jv_PrepareMissingMethods (jclass base, jclass iface_class);
friend class _Jv_ClassReader;
friend class _Jv_InterpClass;
@@ -360,6 +361,7 @@ private:
friend class _Jv_BytecodeVerifier;
friend class gnu::gcj::runtime::StackTrace;
+ friend class java::io::VMObjectStreamClass;
// Chain for class pool.
jclass next;
diff --git a/libjava/java/lang/ClassLoader.java b/libjava/java/lang/ClassLoader.java
index 033b2cc4a6e..5d564dce747 100644
--- a/libjava/java/lang/ClassLoader.java
+++ b/libjava/java/lang/ClassLoader.java
@@ -1,6 +1,6 @@
// ClassLoader.java - Define policies for loading Java classes.
-/* Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation
+/* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation
This file is part of libgcj.
@@ -468,17 +468,18 @@ public abstract class ClassLoader
{
throw x; // rethrow
}
- catch (java.lang.VirtualMachineError x)
+ catch (VirtualMachineError x)
{
throw x; // rethrow
}
- catch (java.lang.Throwable x)
+ catch (Throwable x)
{
// This should never happen, or we are beyond spec.
- throw new InternalError ("Unexpected exception "
- + "while defining class "
- + name + ": "
- + x.toString ());
+ InternalError r = new InternalError ("Unexpected exception "
+ + "while defining class "
+ + name);
+ r.initCause(x);
+ throw r;
}
}
@@ -732,8 +733,7 @@ public abstract class ClassLoader
/**
* If a class named <code>name</code> was previously loaded using
* this <code>ClassLoader</code>, then it is returned. Otherwise
- * it returns <code>null</code>. (Unlike the JDK this is native,
- * since we implement the class table internally.)
+ * it returns <code>null</code>.
* @param name class to find.
* @return the class loaded, or null.
*/
diff --git a/libjava/java/lang/StringBuffer.java b/libjava/java/lang/StringBuffer.java
index bfaaaf92f23..922d6bb6d24 100644
--- a/libjava/java/lang/StringBuffer.java
+++ b/libjava/java/lang/StringBuffer.java
@@ -308,26 +308,27 @@ public final class StringBuffer implements Serializable, CharSequence
}
}
- /** Get the specified array of characters.
- * The characters will be copied into the array you pass in.
- * @param srcOffset the index to start copying from in the
- * <code>StringBuffer</code>.
- * @param srcEnd the number of characters to copy.
- * @param dst the array to copy into.
- * @param dstOffset the index to start copying into <code>dst</code>.
- * @exception NullPointerException if dst is null.
- * @exception IndexOutOfBoundsException if any source or target
- * indices are out of range.
- * @see java.lang.System#arraycopy(java.lang.Object,int,java.lang.Object,int,int)
- */
- public synchronized void getChars (int srcOffset, int srcEnd,
- char[] dst, int dstOffset)
- {
- if (srcOffset < 0 || srcOffset > srcEnd)
- throw new StringIndexOutOfBoundsException (srcOffset);
+ /**
+ * Get the specified array of characters. <code>srcOffset - srcEnd</code>
+ * characters will be copied into the array you pass in.
+ *
+ * @param srcOffset the index to start copying from (inclusive)
+ * @param srcEnd the index to stop copying from (exclusive)
+ * @param dst the array to copy into
+ * @param dstOffset the index to start copying into
+ * @throws NullPointerException if dst is null
+ * @throws IndexOutOfBoundsException if any source or target indices are
+ * out of range (while unspecified, source problems cause a
+ * StringIndexOutOfBoundsException, and dest problems cause an
+ * ArrayIndexOutOfBoundsException)
+ * @see System#arraycopy(Object, int, Object, int, int)
+ */
+ public synchronized void getChars(int srcOffset, int srcEnd,
+ char[] dst, int dstOffset)
+ {
int todo = srcEnd - srcOffset;
- if (srcEnd > count || dstOffset + todo > count)
- throw new StringIndexOutOfBoundsException (srcEnd);
+ if (srcOffset < 0 || srcEnd > count || todo < 0)
+ throw new StringIndexOutOfBoundsException();
System.arraycopy(value, srcOffset, dst, dstOffset, todo);
}
diff --git a/libjava/java/lang/System.java b/libjava/java/lang/System.java
index edc818fb181..2e7c031b16c 100644
--- a/libjava/java/lang/System.java
+++ b/libjava/java/lang/System.java
@@ -1,5 +1,5 @@
/* System.java -- useful methods to interface with the system
- Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -73,22 +73,41 @@ public final class System
loadLibrary("javalang");
Properties defaultProperties = Runtime.defaultProperties;
- defaultProperties.put("gnu.cpu.endian",
- isWordsBigEndian() ? "big" : "little");
+ // Set base URL if not already set.
+ if (defaultProperties.get("gnu.classpath.home.url") == null)
+ defaultProperties.put("gnu.classpath.home.url",
+ "file://"
+ + defaultProperties.get("gnu.classpath.home")
+ + "/lib");
+
+ // Set short name if not already set.
+ if (defaultProperties.get("gnu.classpath.vm.shortname") == null)
+ {
+ String value = defaultProperties.getProperty("java.vm.name");
+ int index = value.lastIndexOf(' ');
+ if (index != -1)
+ value = value.substring(index + 1);
+ defaultProperties.put("gnu.classpath.vm.shortname", value);
+ }
+
+ defaultProperties.put("gnu.cpu.endian",
+ isWordsBigEndian() ? "big" : "little");
// XXX FIXME - Temp hack for old systems that set the wrong property
if (defaultProperties.get("java.io.tmpdir") == null)
defaultProperties.put("java.io.tmpdir",
defaultProperties.get("java.tmpdir"));
}
-
+
/**
* Stores the current system properties. This can be modified by
* {@link #setProperties(Properties)}, but will never be null, because
* setProperties(null) sucks in the default properties.
*/
+ // Note that we use clone here and not new. Some programs assume
+ // that the system properties do not have a parent.
private static Properties properties
- = new Properties(Runtime.defaultProperties);
+ = (Properties) Runtime.defaultProperties.clone();
/**
* The standard InputStream. This is assigned at startup and starts its
@@ -101,7 +120,7 @@ public final class System
* however.
*/
public static final InputStream in
- = new BufferedInputStream (new FileInputStream(FileDescriptor.in));
+ = new BufferedInputStream(new FileInputStream(FileDescriptor.in));
/**
* The standard output PrintStream. This is assigned at startup and
* starts its life perfectly valid. Although it is marked final, you can
@@ -113,7 +132,7 @@ public final class System
* you, however.
*/
public static final PrintStream out
- = new PrintStream(new BufferedOutputStream (new FileOutputStream(FileDescriptor.out)), true);
+ = new PrintStream(new BufferedOutputStream(new FileOutputStream(FileDescriptor.out)), true);
/**
* The standard output PrintStream. This is assigned at startup and
* starts its life perfectly valid. Although it is marked final, you can
@@ -125,7 +144,7 @@ public final class System
* you, however.
*/
public static final PrintStream err
- = new PrintStream(new BufferedOutputStream (new FileOutputStream(FileDescriptor.err)), true);
+ = new PrintStream(new BufferedOutputStream(new FileOutputStream(FileDescriptor.err)), true);
/**
* This class is uninstantiable.
@@ -312,6 +331,10 @@ public final class System
* In addition, gnu defines several other properties, where ? stands for
* each character in '0' through '9':
* <dl>
+ * <dl> gnu.classpath.vm.shortname <dd> Succinct version of the VM name;
+ * used for finding property files in file system
+ * <dl> gnu.classpath.home.url <dd> Base URL; used for finding
+ * property files in file system
* <dt> gnu.cpu.endian <dd>big or little
* <dt> gnu.java.io.encoding_scheme_alias.ISO-8859-? <dd>8859_?
* <dt> gnu.java.io.encoding_scheme_alias.iso-8859-? <dd>8859_?
@@ -348,7 +371,11 @@ public final class System
if (sm != null)
sm.checkPropertiesAccess();
if (properties == null)
- properties = new Properties(Runtime.defaultProperties);
+ {
+ // Note that we use clone here and not new. Some programs
+ // assume that the system properties do not have a parent.
+ properties = (Properties) Runtime.defaultProperties.clone();
+ }
System.properties = properties;
}
diff --git a/libjava/java/lang/Win32Process.java b/libjava/java/lang/Win32Process.java
index 72911d2961b..b1c7e027379 100644
--- a/libjava/java/lang/Win32Process.java
+++ b/libjava/java/lang/Win32Process.java
@@ -1,6 +1,6 @@
// Win32Process.java - Subclass of Process for Win32 systems.
-/* Copyright (C) 2002 Free Software Foundation
+/* Copyright (C) 2002, 2003 Free Software Foundation
This file is part of libgcj.
@@ -22,51 +22,63 @@ import java.io.IOException;
// This is entirely internal to our implementation.
-// NOTE: when this is implemented, we'll need to add
-// HANDLE_FLAG_INHERIT in FileDescriptor and other places, to make
-// sure that file descriptors aren't inherited by the child process.
-// See _Jv_platform_close_on_exec.
-
// This file is copied to `ConcreteProcess.java' before compilation.
// Hence the class name apparently does not match the file name.
final class ConcreteProcess extends Process
{
- public void destroy ()
- {
- throw new Error("not implemented");
- }
-
+ public native void destroy ();
+
+ public native boolean hasExited ();
+
public int exitValue ()
{
- throw new Error("not implemented");
+ if (! hasExited ())
+ throw new IllegalThreadStateException ("Process has not exited");
+
+ return exitCode;
}
public InputStream getErrorStream ()
{
- throw new Error("not implemented");
+ return errorStream;
}
public InputStream getInputStream ()
{
- throw new Error("not implemented");
+ return inputStream;
}
public OutputStream getOutputStream ()
{
- throw new Error("not implemented");
+ return outputStream;
}
- public int waitFor () throws InterruptedException
- {
- throw new Error("not implemented");
- }
+ public native int waitFor () throws InterruptedException;
+
+ public native void startProcess (String[] progarray,
+ String[] envp,
+ File dir)
+ throws IOException;
+
+ public native void cleanup ();
public ConcreteProcess (String[] progarray,
String[] envp,
File dir)
throws IOException
{
- throw new IOException("not implemented");
+ startProcess (progarray, envp, dir);
}
+ // The standard streams (stdin, stdout and stderr, respectively)
+ // of the child as seen by the parent process.
+ private OutputStream outputStream;
+ private InputStream inputStream;
+ private InputStream errorStream;
+
+ // Handle to the child process - cast to HANDLE before use.
+ private int procHandle;
+
+ // Exit code of the child if it has exited.
+ private int exitCode;
}
diff --git a/libjava/java/lang/natClass.cc b/libjava/java/lang/natClass.cc
index bafac789b0d..768ced611ac 100644
--- a/libjava/java/lang/natClass.cc
+++ b/libjava/java/lang/natClass.cc
@@ -343,7 +343,9 @@ java::lang::Class::_getDeclaredMethod (jstring name,
while (--i >= 0)
{
if (_Jv_equalUtf8Consts (methods[i].name, utf_name)
- && _Jv_equaln (methods[i].signature, partial_sig, p_len))
+ && _Jv_equaln (methods[i].signature, partial_sig, p_len)
+ && (methods[i].accflags
+ & java::lang::reflect::Modifier::INVISIBLE) == 0)
{
// Found it.
using namespace java::lang::reflect;
@@ -368,7 +370,9 @@ java::lang::Class::getDeclaredMethods (void)
if (method->name == NULL
|| _Jv_equalUtf8Consts (method->name, clinit_name)
|| _Jv_equalUtf8Consts (method->name, init_name)
- || _Jv_equalUtf8Consts (method->name, finit_name))
+ || _Jv_equalUtf8Consts (method->name, finit_name)
+ || (methods[i].accflags
+ & java::lang::reflect::Modifier::INVISIBLE) != 0)
continue;
numMethods++;
}
@@ -382,7 +386,9 @@ java::lang::Class::getDeclaredMethods (void)
if (method->name == NULL
|| _Jv_equalUtf8Consts (method->name, clinit_name)
|| _Jv_equalUtf8Consts (method->name, init_name)
- || _Jv_equalUtf8Consts (method->name, finit_name))
+ || _Jv_equalUtf8Consts (method->name, finit_name)
+ || (methods[i].accflags
+ & java::lang::reflect::Modifier::INVISIBLE) != 0)
continue;
java::lang::reflect::Method* rmethod
= new java::lang::reflect::Method ();
@@ -514,7 +520,9 @@ java::lang::Class::_getMethod (jstring name, JArray<jclass> *param_types)
{
// FIXME: access checks.
if (_Jv_equalUtf8Consts (klass->methods[i].name, utf_name)
- && _Jv_equaln (klass->methods[i].signature, partial_sig, p_len))
+ && _Jv_equaln (klass->methods[i].signature, partial_sig, p_len)
+ && (klass->methods[i].accflags
+ & java::lang::reflect::Modifier::INVISIBLE) == 0)
{
// Found it.
using namespace java::lang::reflect;
@@ -565,7 +573,9 @@ java::lang::Class::_getMethods (JArray<java::lang::reflect::Method *> *result,
if (method->name == NULL
|| _Jv_equalUtf8Consts (method->name, clinit_name)
|| _Jv_equalUtf8Consts (method->name, init_name)
- || _Jv_equalUtf8Consts (method->name, finit_name))
+ || _Jv_equalUtf8Consts (method->name, finit_name)
+ || (method->accflags
+ & java::lang::reflect::Modifier::INVISIBLE) != 0)
continue;
// Only want public methods.
if (! java::lang::reflect::Modifier::isPublic (method->accflags))
@@ -1564,6 +1574,13 @@ isVirtualMethod (_Jv_Method *meth)
&& meth->name->data[0] != '<');
}
+// This is put in empty vtable slots.
+static void
+_Jv_abstractMethodError (void)
+{
+ throw new java::lang::AbstractMethodError();
+}
+
// Prepare virtual method declarations in KLASS, and any superclasses as
// required, by determining their vtable index, setting method->index, and
// finally setting the class's vtable_method_count. Must be called with the
@@ -1594,13 +1611,16 @@ _Jv_LayoutVTableMethods (jclass klass)
continue;
if (superclass != NULL)
- super_meth = _Jv_LookupDeclaredMethod (superclass, meth->name,
- meth->signature);
+ {
+ super_meth = _Jv_LookupDeclaredMethod (superclass, meth->name,
+ meth->signature);
+ }
if (super_meth)
meth->index = super_meth->index;
- else if (! (meth->accflags & java::lang::reflect::Modifier::FINAL))
- meth->index = index++;
+ else if (! (meth->accflags & java::lang::reflect::Modifier::FINAL)
+ && ! (klass->accflags & java::lang::reflect::Modifier::FINAL))
+ meth->index = index++;
}
klass->vtable_method_count = index;
@@ -1626,8 +1646,7 @@ _Jv_SetVTableEntries (jclass klass, _Jv_VTable *vtable, jboolean *flags)
continue;
if ((meth->accflags & Modifier::ABSTRACT))
{
- // FIXME: we should set abstract slots to a function that
- // throws AbstractMethodError. How can we do that on IA-64?
+ vtable->set_method(meth->index, (void *) &_Jv_abstractMethodError);
flags[meth->index] = false;
}
else
diff --git a/libjava/java/lang/natClassLoader.cc b/libjava/java/lang/natClassLoader.cc
index aeee08a6265..96a81812219 100644
--- a/libjava/java/lang/natClassLoader.cc
+++ b/libjava/java/lang/natClassLoader.cc
@@ -56,17 +56,18 @@ java::lang::ClassLoader::defineClass0 (jstring name,
sizeof (_Jv_InterpClass));
_Jv_InitNewClassFields (klass);
- // synchronize on the class, so that it is not
- // attempted initialized until we're done loading.
- _Jv_MonitorEnter (klass);
+ // Synchronize on the class, so that it is not attempted initialized
+ // until we're done loading.
+ JvSynchronize sync (klass);
- // record which is the defining loader
- klass->loader = this;
+ // Record the defining loader. For the system class loader, we
+ // record NULL.
+ if (this != java::lang::ClassLoader::getSystemClassLoader())
+ klass->loader = this;
- // register that we are the initiating loader...
if (name != 0)
{
- _Jv_Utf8Const * name2 = _Jv_makeUtf8Const (name);
+ _Jv_Utf8Const *name2 = _Jv_makeUtf8Const (name);
if (! _Jv_VerifyClassName (name2))
throw new java::lang::ClassFormatError
@@ -86,16 +87,8 @@ java::lang::ClassLoader::defineClass0 (jstring name,
_Jv_UnregisterClass (klass);
- _Jv_MonitorExit (klass);
-
- // FIXME: Here we may want to test that EX does
- // indeed represent a valid exception. That is,
- // anything but ClassNotFoundException,
- // or some kind of Error.
-
- // FIXME: Rewrite this as a cleanup instead of
- // as a catch handler.
-
+ // If EX is not a ClassNotFoundException, that's ok, because we
+ // account for the possibility in defineClass().
throw ex;
}
@@ -104,10 +97,6 @@ java::lang::ClassLoader::defineClass0 (jstring name,
// if everything proceeded sucessfully, we're loaded.
JvAssert (klass->state == JV_STATE_LOADED);
- // if an exception is generated, this is initially missed.
- // however, we come back here in handleException0 below...
- _Jv_MonitorExit (klass);
-
return klass;
#else // INTERPRETER
@@ -293,10 +282,11 @@ _Jv_PrepareCompiledClass (jclass klass)
// Hash function for Utf8Consts.
#define HASH_UTF(Utf) (((Utf)->hash) % HASH_LEN)
-struct _Jv_LoaderInfo {
- _Jv_LoaderInfo *next;
- java::lang::Class *klass;
- java::lang::ClassLoader *loader;
+struct _Jv_LoaderInfo
+{
+ _Jv_LoaderInfo *next;
+ java::lang::Class *klass;
+ java::lang::ClassLoader *loader;
};
static _Jv_LoaderInfo *initiated_classes[HASH_LEN];
@@ -309,9 +299,12 @@ static jclass loaded_classes[HASH_LEN];
jclass
_Jv_FindClassInCache (_Jv_Utf8Const *name, java::lang::ClassLoader *loader)
{
- _Jv_MonitorEnter (&java::lang::Class::class$);
+ JvSynchronize sync (&java::lang::Class::class$);
jint hash = HASH_UTF (name);
+ if (loader && loader == java::lang::ClassLoader::getSystemClassLoader())
+ loader = NULL;
+
// first, if LOADER is a defining loader, then it is also initiating
jclass klass;
for (klass = loaded_classes[hash]; klass; klass = klass->next)
@@ -337,15 +330,13 @@ _Jv_FindClassInCache (_Jv_Utf8Const *name, java::lang::ClassLoader *loader)
}
}
- _Jv_MonitorExit (&java::lang::Class::class$);
-
return klass;
}
void
_Jv_UnregisterClass (jclass the_class)
{
- _Jv_MonitorEnter (&java::lang::Class::class$);
+ JvSynchronize sync (&java::lang::Class::class$);
jint hash = HASH_UTF(the_class->name);
jclass *klass = &(loaded_classes[hash]);
@@ -363,29 +354,32 @@ _Jv_UnregisterClass (jclass the_class)
{
while (*info && (*info)->klass == the_class)
{
+ _Jv_LoaderInfo *old = *info;
*info = (*info)->next;
+ _Jv_Free (old);
}
if (*info == NULL)
break;
}
-
- _Jv_MonitorExit (&java::lang::Class::class$);
}
void
_Jv_RegisterInitiatingLoader (jclass klass, java::lang::ClassLoader *loader)
{
- // non-gc alloc!
- _Jv_LoaderInfo *info = (_Jv_LoaderInfo *) _Jv_Malloc (sizeof(_Jv_LoaderInfo));
+ if (loader && loader == java::lang::ClassLoader::getSystemClassLoader())
+ loader = NULL;
+
+ // This information can't be visible to the GC.
+ _Jv_LoaderInfo *info
+ = (_Jv_LoaderInfo *) _Jv_Malloc (sizeof(_Jv_LoaderInfo));
jint hash = HASH_UTF(klass->name);
- _Jv_MonitorEnter (&java::lang::Class::class$);
+ JvSynchronize sync (&java::lang::Class::class$);
info->loader = loader;
info->klass = klass;
info->next = initiated_classes[hash];
initiated_classes[hash] = info;
- _Jv_MonitorExit (&java::lang::Class::class$);
}
// This function is called many times during startup, before main() is
@@ -471,6 +465,9 @@ _Jv_FindClass (_Jv_Utf8Const *name, java::lang::ClassLoader *loader)
{
jstring sname = _Jv_NewStringUTF (name->data);
+ java::lang::ClassLoader *sys
+ = java::lang::ClassLoader::getSystemClassLoader ();
+
if (loader)
{
// Load using a user-defined loader, jvmspec 5.3.2
@@ -479,14 +476,14 @@ _Jv_FindClass (_Jv_Utf8Const *name, java::lang::ClassLoader *loader)
// If "loader" delegated the loadClass operation to another
// loader, explicitly register that it is also an initiating
// loader of the given class.
- if (klass && (klass->getClassLoader () != loader))
+ java::lang::ClassLoader *delegate = (loader == sys
+ ? NULL
+ : loader);
+ if (klass && klass->getClassLoaderInternal () != delegate)
_Jv_RegisterInitiatingLoader (klass, loader);
}
else
{
- java::lang::ClassLoader *sys
- = java::lang::ClassLoader::getSystemClassLoader ();
-
// Load using the bootstrap loader jvmspec 5.3.1.
klass = sys->loadClass (sname, false);
diff --git a/libjava/java/lang/natObject.cc b/libjava/java/lang/natObject.cc
index 4c2fd6cab03..33f3e8de27f 100644
--- a/libjava/java/lang/natObject.cc
+++ b/libjava/java/lang/natObject.cc
@@ -1,6 +1,6 @@
// natObject.cc - Implementation of the Object class.
-/* Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation
+/* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation
This file is part of libgcj.
@@ -9,6 +9,7 @@ Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
details. */
#include <config.h>
+#include <platform.h>
#include <string.h>
@@ -532,7 +533,7 @@ spin(unsigned n)
unsigned duration = MIN_SLEEP_USECS << (n - yield_limit);
if (n >= 15 + yield_limit || duration > MAX_SLEEP_USECS)
duration = MAX_SLEEP_USECS;
- java::lang::Thread::sleep(0, duration);
+ _Jv_platform_usleep(duration);
}
}
diff --git a/libjava/java/lang/natRuntime.cc b/libjava/java/lang/natRuntime.cc
index f5177b0aa35..9879b259dd5 100644
--- a/libjava/java/lang/natRuntime.cc
+++ b/libjava/java/lang/natRuntime.cc
@@ -1,6 +1,6 @@
// natRuntime.cc - Implementation of native side of Runtime class.
-/* Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation
+/* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation
This file is part of libgcj.
@@ -9,6 +9,7 @@ Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
details. */
#include <config.h>
+#include <platform.h>
#include <stdlib.h>
@@ -29,11 +30,10 @@ details. */
#include <java/lang/ConcreteProcess.h>
#include <java/lang/ClassLoader.h>
#include <gnu/gcj/runtime/StackTrace.h>
+#include <java/lang/ArrayIndexOutOfBoundsException.h>
#include <jni.h>
-#include "platform.h"
-
#ifdef HAVE_PWD_H
#include <pwd.h>
#endif
@@ -181,19 +181,26 @@ java::lang::Runtime::_load (jstring path, jboolean do_search)
ClassLoader *sys = ClassLoader::getSystemClassLoader();
ClassLoader *look = NULL;
gnu::gcj::runtime::StackTrace *t = new gnu::gcj::runtime::StackTrace(10);
- for (int i = 0; i < 10; ++i)
- {
- jclass klass = t->classAt(i);
- if (klass != NULL)
+ try
+ {
+ for (int i = 0; i < 10; ++i)
{
- ClassLoader *loader = klass->getClassLoaderInternal();
- if (loader != NULL && loader != sys)
+ jclass klass = t->classAt(i);
+ if (klass != NULL)
{
- look = loader;
- break;
+ ClassLoader *loader = klass->getClassLoaderInternal();
+ if (loader != NULL && loader != sys)
+ {
+ look = loader;
+ break;
+ }
}
}
}
+ catch (::java::lang::ArrayIndexOutOfBoundsException *e)
+ {
+ }
+
if (look != NULL)
{
// Don't include solib prefix in string passed to
@@ -233,6 +240,19 @@ java::lang::Runtime::_load (jstring path, jboolean do_search)
add_library (h);
void *onload = lt_dlsym (h, "JNI_OnLoad");
+
+#ifdef WIN32
+ // On Win32, JNI_OnLoad is an "stdcall" function taking two pointers
+ // (8 bytes) as arguments. It could also have been exported as
+ // "JNI_OnLoad@8" (MinGW) or "_JNI_OnLoad@8" (MSVC).
+ if (onload == NULL)
+ {
+ onload = lt_dlsym (h, "JNI_OnLoad@8");
+ if (onload == NULL)
+ onload = lt_dlsym (h, "_JNI_OnLoad@8");
+ }
+#endif /* WIN32 */
+
if (onload != NULL)
{
JavaVM *vm = _Jv_GetJavaVM ();
@@ -241,7 +261,7 @@ java::lang::Runtime::_load (jstring path, jboolean do_search)
// FIXME: what?
return;
}
- jint vers = ((jint (*) (JavaVM *, void *)) onload) (vm, NULL);
+ jint vers = ((jint (JNICALL *) (JavaVM *, void *)) onload) (vm, NULL);
if (vers != JNI_VERSION_1_1 && vers != JNI_VERSION_1_2
&& vers != JNI_VERSION_1_4)
{
diff --git a/libjava/java/lang/natSystem.cc b/libjava/java/lang/natSystem.cc
index ffa3f1a5053..e2d42324386 100644
--- a/libjava/java/lang/natSystem.cc
+++ b/libjava/java/lang/natSystem.cc
@@ -1,6 +1,6 @@
// natSystem.cc - Native code implementing System class.
-/* Copyright (C) 1998, 1999, 2000, 2001 , 2002 Free Software Foundation
+/* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation
This file is part of libgcj.
@@ -9,6 +9,7 @@ Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
details. */
#include <config.h>
+#include <platform.h>
#include <stdio.h>
#include <string.h>
@@ -24,8 +25,6 @@ details. */
#include <java/io/PrintStream.h>
#include <java/io/InputStream.h>
-#include "platform.h"
-
void
diff --git a/libjava/java/lang/natWin32Process.cc b/libjava/java/lang/natWin32Process.cc
index e69de29bb2d..38e6f919174 100644
--- a/libjava/java/lang/natWin32Process.cc
+++ b/libjava/java/lang/natWin32Process.cc
@@ -0,0 +1,294 @@
+// natWin32Process.cc - Native side of Win32 process code.
+
+/* Copyright (C) 2003 Free Software Foundation
+
+ This file is part of libgcj.
+
+This software is copyrighted work licensed under the terms of the
+Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
+details. */
+
+#include <config.h>
+
+#include <stdio.h>
+
+#define WIN32_LEAN_AND_MEAN
+#include <windows.h>
+
+// Conflicts with the definition in "java/lang/reflect/Modifier.h"
+#undef STRICT
+
+#include <gcj/cni.h>
+#include <jvm.h>
+
+#include <java/lang/ConcreteProcess.h>
+#include <java/lang/IllegalThreadStateException.h>
+#include <java/lang/InterruptedException.h>
+#include <java/lang/NullPointerException.h>
+#include <java/lang/Thread.h>
+#include <java/io/File.h>
+#include <java/io/FileDescriptor.h>
+#include <java/io/FileInputStream.h>
+#include <java/io/FileOutputStream.h>
+#include <java/io/IOException.h>
+#include <java/lang/OutOfMemoryError.h>
+
+void
+java::lang::ConcreteProcess::cleanup (void)
+{
+ if (inputStream != NULL)
+ {
+ inputStream->close ();
+ inputStream = NULL;
+ }
+
+ if (outputStream != NULL)
+ {
+ outputStream->close ();
+ outputStream = NULL;
+ }
+
+ if (errorStream != NULL)
+ {
+ errorStream->close ();
+ errorStream = NULL;
+ }
+}
+
+void
+java::lang::ConcreteProcess::destroy (void)
+{
+ if (! hasExited ())
+ {
+ // Kill it forcibly and assign an (arbitrary) exit code of 0.
+ TerminateProcess ((HANDLE) procHandle, 0);
+ exitCode = 0;
+
+ cleanup ();
+ }
+}
+
+jboolean
+java::lang::ConcreteProcess::hasExited (void)
+{
+ DWORD exitStatus;
+
+ if (GetExitCodeProcess ((HANDLE) procHandle, &exitStatus) != 0)
+ {
+ // NOTE: STILL_ACTIVE is defined as "259" by Win32 - if the
+ // child actually exits with this return code, we have a
+ // problem here. See MSDN documentation on GetExitCodeProcess( ).
+
+ if (exitStatus == STILL_ACTIVE)
+ return false;
+ else
+ {
+ cleanup ();
+ exitCode = exitStatus;
+ return true;
+ }
+ }
+ else
+ return true;
+}
+
+jint
+java::lang::ConcreteProcess::waitFor (void)
+{
+ if (! hasExited ())
+ {
+ DWORD exitStatus = 0UL;
+
+ // FIXME: The wait should be interruptible.
+ WaitForSingleObject ((HANDLE) procHandle, INFINITE);
+
+ GetExitCodeProcess ((HANDLE) procHandle, &exitStatus);
+ exitCode = exitStatus;
+
+ cleanup ();
+ }
+
+ return exitCode;
+}
+
+static char *
+new_string (jstring string)
+{
+ jsize s = _Jv_GetStringUTFLength (string);
+ char *buf = (char *) _Jv_Malloc (s + 1);
+ _Jv_GetStringUTFRegion (string, 0, s, buf);
+ buf[s] = '\0';
+ return buf;
+}
+
+void
+java::lang::ConcreteProcess::startProcess (jstringArray progarray,
+ jstringArray envp,
+ java::io::File *dir)
+{
+ using namespace java::io;
+
+ procHandle = (jint) INVALID_HANDLE_VALUE;
+
+ // Reconstruct the command line.
+ jstring *elts = elements (progarray);
+
+ int cmdLineLen = 0;
+
+ for (int i = 0; i < progarray->length; ++i)
+ cmdLineLen += (_Jv_GetStringUTFLength (elts[i]) + 1);
+
+ char *cmdLine = (char *) _Jv_Malloc (cmdLineLen + 1);
+
+ int j = 0;
+ for (int i = 0; i < progarray->length; ++i)
+ {
+ jsize s = _Jv_GetStringUTFLength (elts[i]);
+ _Jv_GetStringUTFRegion (elts[i], 0, s, (cmdLine + j));
+
+ j += s;
+ *(cmdLine + j) = ' ';
+ j++;
+ }
+ *(cmdLine + j) = '\0';
+
+ // Get the environment, if any.
+ char *env = NULL;
+ if (envp)
+ {
+ elts = elements (envp);
+
+ int envLen = 0;
+ for (int i = 0; i < envp->length; ++i)
+ envLen += (_Jv_GetStringUTFLength (elts[i]) + 1);
+
+ env = (char *) _Jv_Malloc (envLen + 1);
+
+ int j = 0;
+ for (int i = 0; i < envp->length; ++i)
+ {
+ jsize s = _Jv_GetStringUTFLength (elts[i]);
+ _Jv_GetStringUTFRegion (elts[i], 0, s, (env + j));
+
+ j += s;
+ *(env + j) = '\0';
+ j++;
+ }
+ *(env + j) = '\0';
+ }
+
+ // Get the working directory path, if specified.
+ char *wdir = NULL;
+ if (dir != NULL)
+ wdir = new_string (dir->getPath ());
+
+ errorStream = NULL;
+ inputStream = NULL;
+ outputStream = NULL;
+
+ java::lang::Throwable *exc = NULL;
+
+ try
+ {
+ // We create anonymous pipes to communicate with the child
+ // on each of standard streams.
+
+ HANDLE cldStdInRd, cldStdInWr;
+ HANDLE cldStdOutRd, cldStdOutWr;
+ HANDLE cldStdErrRd, cldStdErrWr;
+
+ SECURITY_ATTRIBUTES sAttrs;
+
+ // Explicitly allow the handles to the pipes to be inherited.
+ sAttrs.nLength = sizeof (SECURITY_ATTRIBUTES);
+ sAttrs.bInheritHandle = 1;
+ sAttrs.lpSecurityDescriptor = NULL;
+
+
+ char tmpBuff[64];
+ if (CreatePipe (&cldStdInRd, &cldStdInWr, &sAttrs, 0) == 0)
+ {
+ sprintf (tmpBuff,
+ "Error creating stdin pipe (Win32 Error Code: %lu)",
+ GetLastError ());
+ throw new IOException (JvNewStringLatin1 (tmpBuff));
+ }
+
+ if (CreatePipe (&cldStdOutRd, &cldStdOutWr, &sAttrs, 0) == 0)
+ {
+ sprintf (tmpBuff,
+ "Error creating stdout pipe (Win32 Error Code: %lu)",
+ GetLastError ());
+ throw new IOException (JvNewStringLatin1 (tmpBuff));
+ }
+
+ if (CreatePipe (&cldStdErrRd, &cldStdErrWr, &sAttrs, 0) == 0)
+ {
+ sprintf (tmpBuff,
+ "Error creating stderr pipe (Win32 Error Code: %lu)",
+ GetLastError ());
+ throw new IOException (JvNewStringLatin1 (tmpBuff));
+ }
+
+ outputStream = new FileOutputStream
+ (new FileDescriptor ((jint) cldStdInWr));
+ inputStream = new FileInputStream
+ (new FileDescriptor ((jint) cldStdOutRd));
+ errorStream = new FileInputStream
+ (new FileDescriptor ((jint) cldStdErrRd));
+
+ // Now create the child process.
+ PROCESS_INFORMATION pi;
+ STARTUPINFO si;
+
+ ZeroMemory (&pi, sizeof (PROCESS_INFORMATION));
+
+ ZeroMemory (&si, sizeof (STARTUPINFO));
+ si.cb = sizeof (STARTUPINFO);
+
+ // Explicitly specify the handles to the standard streams.
+ si.dwFlags |= STARTF_USESTDHANDLES;
+
+ si.hStdInput = cldStdInRd;
+ si.hStdOutput = cldStdOutWr;
+ si.hStdError = cldStdErrWr;
+
+ if (CreateProcess (NULL,
+ cmdLine,
+ NULL,
+ NULL,
+ 1,
+ 0,
+ env,
+ wdir,
+ &si,
+ &pi) == 0)
+ {
+ sprintf (tmpBuff,
+ "Error creating child process (Win32 Error Code: %lu)",
+ GetLastError ());
+ throw new IOException (JvNewStringLatin1 (tmpBuff));
+ }
+
+ procHandle = (jint ) pi.hProcess;
+
+ // Close the wrong ends (for the parent) of the pipes.
+ CloseHandle (cldStdInRd);
+ CloseHandle (cldStdOutWr);
+ CloseHandle (cldStdErrWr);
+
+ _Jv_Free (cmdLine);
+ if (env != NULL)
+ _Jv_Free (env);
+ if (wdir != NULL)
+ _Jv_Free (wdir);
+ }
+ catch (java::lang::Throwable *thrown)
+ {
+ cleanup ();
+ exc = thrown;
+ }
+
+ if (exc != NULL)
+ throw exc;
+}
diff --git a/libjava/java/lang/reflect/Modifier.java b/libjava/java/lang/reflect/Modifier.java
index 75d0c9b47f5..8171a88feb5 100644
--- a/libjava/java/lang/reflect/Modifier.java
+++ b/libjava/java/lang/reflect/Modifier.java
@@ -1,5 +1,5 @@
/* java.lang.reflect.Modifier
- 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.
@@ -158,6 +158,17 @@ public class Modifier
static final int ALL_FLAGS = 0xfff;
/**
+ * GCJ-LOCAL: This access flag is set on methods we declare
+ * internally but which must not be visible to reflection.
+ */
+ static final int INVISIBLE = 0x1000;
+
+ /**
+ * GCJ-LOCAL: This access flag is set on interpreted classes.
+ */
+ static final int INTERPRETED = 0x1000;
+
+ /**
* Check whether the given modifier is abstract.
* @param mod the modifier.
* @return <code>true</code> if abstract, <code>false</code> otherwise.
diff --git a/libjava/java/math/BigDecimal.java b/libjava/java/math/BigDecimal.java
index 713ba08e151..a4a4a560e94 100644
--- a/libjava/java/math/BigDecimal.java
+++ b/libjava/java/math/BigDecimal.java
@@ -178,15 +178,31 @@ public class BigDecimal extends Number implements Comparable
// Now parse exponent.
if (point < len)
{
- int exp = Integer.parseInt (num.substring (point + 1));
- exp -= scale;
- if (exp > 0)
+ point++;
+ if (num.charAt(point) == '+')
+ point++;
+
+ if (point >= len )
+ throw new NumberFormatException ("no exponent following e or E");
+
+ try
{
- intVal = intVal.multiply (BigInteger.valueOf (10).pow (exp));
- scale = 0;
+ int exp = Integer.parseInt (num.substring (point));
+ exp -= scale;
+ if (signum () == 0)
+ scale = 0;
+ else if (exp > 0)
+ {
+ intVal = intVal.multiply (BigInteger.valueOf (10).pow (exp));
+ scale = 0;
+ }
+ else
+ scale = - exp;
+ }
+ catch (NumberFormatException ex)
+ {
+ throw new NumberFormatException ("malformed exponent");
}
- else
- scale = - exp;
}
}
@@ -198,7 +214,7 @@ public class BigDecimal extends Number implements Comparable
public static BigDecimal valueOf (long val, int scale)
throws NumberFormatException
{
- if (scale == 0)
+ if ((scale == 0) && ((int)val == val))
switch ((int) val)
{
case 0:
@@ -252,7 +268,7 @@ public class BigDecimal extends Number implements Comparable
throw new ArithmeticException ("scale is negative: " + newScale);
if (intVal.signum () == 0) // handle special case of 0.0/0.0
- return ZERO;
+ return newScale == 0 ? ZERO : new BigDecimal (ZERO.intVal, newScale);
// Ensure that pow gets a non-negative value.
int valScale = val.scale;
@@ -431,19 +447,29 @@ public class BigDecimal extends Number implements Comparable
if (scale == 0)
return bigStr;
- int point = bigStr.length() - scale;
boolean negative = (bigStr.charAt(0) == '-');
- StringBuffer sb = new StringBuffer(bigStr.length() + 1 +
- (point <= 0 ? -point+1 : 0));
- if (negative)
- sb.append('-');
- while (point <= 0)
+
+ int point = bigStr.length() - scale - (negative ? 1 : 0);
+
+ StringBuffer sb = new StringBuffer(bigStr.length() + 2 +
+ (point <= 0 ? (-point + 1) : 0));
+ if (point <= 0)
+ {
+ if (negative)
+ sb.append('-');
+ sb.append('0').append('.');
+ while (point < 0)
+ {
+ sb.append('0');
+ point++;
+ }
+ sb.append(bigStr.substring(negative ? 1 : 0));
+ }
+ else
{
- sb.append('0');
- point++;
+ sb.append(bigStr);
+ sb.insert(point + (negative ? 1 : 0), '.');
}
- sb.append(bigStr.substring(negative ? 1 : 0));
- sb.insert(point, '.');
return sb.toString();
}
diff --git a/libjava/java/math/BigInteger.java b/libjava/java/math/BigInteger.java
index e8c6b1dfdc9..6f919f785cc 100644
--- a/libjava/java/math/BigInteger.java
+++ b/libjava/java/math/BigInteger.java
@@ -1,5 +1,5 @@
/* java.math.BigInteger -- Arbitary precision integers
- Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -110,6 +110,12 @@ public class BigInteger extends Number implements Comparable
109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181,
191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251 };
+ /** HAC (Handbook of Applied Cryptography), Alfred Menezes & al. Table 4.4. */
+ private static final int[] k =
+ {100,150,200,250,300,350,400,500,600,800,1250, Integer.MAX_VALUE};
+ private static final int[] t =
+ { 27, 18, 15, 12, 9, 8, 7, 6, 5, 4, 3, 2};
+
private BigInteger()
{
}
@@ -218,38 +224,29 @@ public class BigInteger extends Number implements Comparable
}
/** Return a (possibly-shared) BigInteger with a given long value. */
- private static BigInteger make(long value)
+ public static BigInteger valueOf(long val)
{
- if (value >= minFixNum && value <= maxFixNum)
- return smallFixNums[(int)value - minFixNum];
- int i = (int) value;
- if ((long)i == value)
+ if (val >= minFixNum && val <= maxFixNum)
+ return smallFixNums[(int) val - minFixNum];
+ int i = (int) val;
+ if ((long) i == val)
return new BigInteger(i);
BigInteger result = alloc(2);
result.ival = 2;
result.words[0] = i;
- result.words[1] = (int) (value >> 32);
+ result.words[1] = (int)(val >> 32);
return result;
}
- // FIXME: Could simply rename 'make' method above as valueOf while
- // changing all instances of 'make'. Don't do this until this class
- // is done as the Kawa class this is based on has 'make' methods
- // with other parameters; wait to see if they are used in BigInteger.
- public static BigInteger valueOf(long val)
- {
- return make(val);
- }
-
/** Make a canonicalized BigInteger from an array of words.
* The array may be reused (without copying). */
private static BigInteger make(int[] words, int len)
{
if (words == null)
- return make(len);
+ return valueOf(len);
len = BigInteger.wordsNeeded(words, len);
if (len <= 1)
- return len == 0 ? ZERO : make(words[0]);
+ return len == 0 ? ZERO : valueOf(words[0]);
BigInteger num = new BigInteger();
num.words = words;
num.ival = len;
@@ -267,15 +264,15 @@ public class BigInteger extends Number implements Comparable
int bptr = 0;
int word = sign;
for (int i = bytes.length % 4; i > 0; --i, bptr++)
- word = (word << 8) | (((int) bytes[bptr]) & 0xff);
+ word = (word << 8) | (bytes[bptr] & 0xff);
words[--nwords] = word;
// Elements remaining in byte[] are a multiple of 4.
while (nwords > 0)
words[--nwords] = bytes[bptr++] << 24 |
- (((int) bytes[bptr++]) & 0xff) << 16 |
- (((int) bytes[bptr++]) & 0xff) << 8 |
- (((int) bytes[bptr++]) & 0xff);
+ (bytes[bptr++] & 0xff) << 16 |
+ (bytes[bptr++] & 0xff) << 8 |
+ (bytes[bptr++] & 0xff);
return words;
}
@@ -284,9 +281,8 @@ public class BigInteger extends Number implements Comparable
*/
private static BigInteger alloc(int nwords)
{
- if (nwords <= 1)
- return new BigInteger();
BigInteger result = new BigInteger();
+ if (nwords > 1)
result.words = new int[nwords];
return result;
}
@@ -376,12 +372,6 @@ public class BigInteger extends Number implements Comparable
return compareTo(this, val) > 0 ? this : val;
}
- private final boolean isOdd()
- {
- int low = words == null ? ival : words[0];
- return (low & 1) != 0;
- }
-
private final boolean isZero()
{
return words == null && ival == 0;
@@ -392,11 +382,6 @@ public class BigInteger extends Number implements Comparable
return words == null && ival == 1;
}
- private final boolean isMinusOne()
- {
- return words == null && ival == -1;
- }
-
/** Calculate how many words are significant in words[0:len-1].
* Returns the least value x such that x>0 && words[0:x-1]==words[0:len-1],
* when words is viewed as a 2's complement integer.
@@ -433,14 +418,14 @@ public class BigInteger extends Number implements Comparable
words = null;
}
if (words == null && ival >= minFixNum && ival <= maxFixNum)
- return smallFixNums[(int) ival - minFixNum];
+ return smallFixNums[ival - minFixNum];
return this;
}
/** Add two ints, yielding a BigInteger. */
private static final BigInteger add(int x, int y)
{
- return BigInteger.make((long) x + (long) y);
+ return valueOf((long) x + (long) y);
}
/** Add a BigInteger and an int, yielding a new BigInteger. */
@@ -526,13 +511,13 @@ public class BigInteger extends Number implements Comparable
private static BigInteger add(BigInteger x, BigInteger y, int k)
{
if (x.words == null && y.words == null)
- return BigInteger.make((long) k * (long) y.ival + (long) x.ival);
+ return valueOf((long) k * (long) y.ival + (long) x.ival);
if (k != 1)
{
if (k == -1)
y = BigInteger.neg(y);
else
- y = BigInteger.times(y, BigInteger.make(k));
+ y = BigInteger.times(y, valueOf(k));
}
if (x.words == null)
return BigInteger.add(y, x.ival);
@@ -580,7 +565,7 @@ public class BigInteger extends Number implements Comparable
int[] xwords = x.words;
int xlen = x.ival;
if (xwords == null)
- return BigInteger.make((long) xlen * (long) y);
+ return valueOf((long) xlen * (long) y);
boolean negative;
BigInteger result = BigInteger.alloc(xlen + 1);
if (xwords[xlen - 1] < 0)
@@ -662,7 +647,7 @@ public class BigInteger extends Number implements Comparable
xNegative = true;
if (x == Long.MIN_VALUE)
{
- divide(BigInteger.make(x), BigInteger.make(y),
+ divide(valueOf(x), valueOf(y),
quotient, remainder, rounding_mode);
return;
}
@@ -684,7 +669,7 @@ public class BigInteger extends Number implements Comparable
remainder.set(x);
}
else
- divide(BigInteger.make(x), BigInteger.make(y),
+ divide(valueOf(x), valueOf(y),
quotient, remainder, rounding_mode);
return;
}
@@ -966,39 +951,6 @@ public class BigInteger extends Number implements Comparable
return rem.canonicalize();
}
- /** Calculate power for BigInteger exponents.
- * @param y exponent assumed to be non-negative. */
- private BigInteger pow(BigInteger y)
- {
- if (isOne())
- return this;
- if (isMinusOne())
- return y.isOdd () ? this : ONE;
- if (y.words == null && y.ival >= 0)
- return pow(y.ival);
-
- // Assume exponent is non-negative.
- if (isZero())
- return this;
-
- // Implemented by repeated squaring and multiplication.
- BigInteger pow2 = this;
- BigInteger r = null;
- for (;;) // for (i = 0; ; i++)
- {
- // pow2 == x**(2**i)
- // prod = x**(sum(j=0..i-1, (y>>j)&1))
- if (y.isOdd())
- r = r == null ? pow2 : times(r, pow2); // r *= pow2
- y = BigInteger.shift(y, -1);
- if (y.isZero())
- break;
- // pow2 *= pow2;
- pow2 = times(pow2, pow2);
- }
- return r == null ? ONE : r;
- }
-
/** Calculate the integral power of a BigInteger.
* @param exponent the exponent (must be non-negative)
*/
@@ -1008,7 +960,6 @@ public class BigInteger extends Number implements Comparable
{
if (exponent == 0)
return ONE;
- else
throw new ArithmeticException("negative exponent");
}
if (isZero())
@@ -1051,51 +1002,34 @@ public class BigInteger extends Number implements Comparable
private static final int[] euclidInv(int a, int b, int prevDiv)
{
- // Storage for return values, plus one slot for a temp int (see below).
- int[] xy;
-
if (b == 0)
throw new ArithmeticException("not invertible");
- else if (b == 1)
- {
+
+ if (b == 1)
// Success: values are indeed invertible!
// Bottom of the recursion reached; start unwinding.
- xy = new int[3];
- xy[0] = -prevDiv;
- xy[1] = 1;
- return xy;
- }
+ return new int[] { -prevDiv, 1 };
- xy = euclidInv(b, a % b, a / b); // Recursion happens here.
-
- // xy[2] is just temp storage for intermediate results in the following
- // calculation. This saves us a bit of space over having an int
- // allocated at every level of this recursive method.
- xy[2] = xy[0];
- xy[0] = xy[2] * -prevDiv + xy[1];
- xy[1] = xy[2];
+ int[] xy = euclidInv(b, a % b, a / b); // Recursion happens here.
+ a = xy[0]; // use our local copy of 'a' as a work var
+ xy[0] = a * -prevDiv + xy[1];
+ xy[1] = a;
return xy;
}
- private static final BigInteger[]
- euclidInv(BigInteger a, BigInteger b, BigInteger prevDiv)
+ private static final void euclidInv(BigInteger a, BigInteger b,
+ BigInteger prevDiv, BigInteger[] xy)
{
- // FIXME: This method could be more efficient memory-wise and should be
- // modified as such since it is recursive.
-
- // Storage for return values, plus one slot for a temp int (see below).
- BigInteger[] xy;
-
if (b.isZero())
throw new ArithmeticException("not invertible");
- else if (b.isOne())
+
+ if (b.isOne())
{
// Success: values are indeed invertible!
// Bottom of the recursion reached; start unwinding.
- xy = new BigInteger[3];
xy[0] = neg(prevDiv);
- xy[1] = ONE;
- return xy;
+ xy[1] = ONE;
+ return;
}
// Recursion happens in the following conditional!
@@ -1104,25 +1038,23 @@ public class BigInteger extends Number implements Comparable
if (a.words == null)
{
int[] xyInt = euclidInv(b.ival, a.ival % b.ival, a.ival / b.ival);
- xy = new BigInteger[3];
xy[0] = new BigInteger(xyInt[0]);
- xy[1] = new BigInteger(xyInt[1]);
+ xy[1] = new BigInteger(xyInt[1]);
}
else
{
BigInteger rem = new BigInteger();
BigInteger quot = new BigInteger();
divide(a, b, quot, rem, FLOOR);
- xy = euclidInv(b, rem, quot);
+ // quot and rem may not be in canonical form. ensure
+ rem.canonicalize();
+ quot.canonicalize();
+ euclidInv(b, rem, quot, xy);
}
- // xy[2] is just temp storage for intermediate results in the following
- // calculation. This saves us a bit of space over having a BigInteger
- // allocated at every level of this recursive method.
- xy[2] = xy[0];
- xy[0] = add(xy[1], times(xy[2], prevDiv), -1);
- xy[1] = xy[2];
- return xy;
+ BigInteger t = xy[0];
+ xy[0] = add(xy[1], times(t, prevDiv), -1);
+ xy[1] = t;
}
public BigInteger modInverse(BigInteger y)
@@ -1133,7 +1065,7 @@ public class BigInteger extends Number implements Comparable
// Degenerate cases.
if (y.isOne())
return ZERO;
- else if (isOne())
+ if (isOne())
return ONE;
// Use Euclid's algorithm as in gcd() but do this recursively
@@ -1141,8 +1073,6 @@ public class BigInteger extends Number implements Comparable
// unwind from the recursion.
// Used http://www.math.nmsu.edu/~crypto/EuclideanAlgo.html as reference.
BigInteger result = new BigInteger();
- int xval = ival;
- int yval = y.ival;
boolean swapped = false;
if (y.words == null)
@@ -1153,8 +1083,8 @@ public class BigInteger extends Number implements Comparable
// math. Note that BigInteger.mod() must be used even if this is
// already an int as the % operator would provide a negative result if
// this is negative, BigInteger.mod() never returns negative values.
- if (words != null || isNegative())
- xval = mod(y).ival;
+ int xval = (words != null || isNegative()) ? mod(y).ival : ival;
+ int yval = y.ival;
// Swap values so x > y.
if (yval > xval)
@@ -1175,16 +1105,13 @@ public class BigInteger extends Number implements Comparable
}
else
{
- BigInteger x = this;
-
// As above, force this to be a positive value via modulo math.
- if (isNegative())
- x = mod(y);
+ BigInteger x = isNegative() ? this.mod(y) : this;
// Swap values so x > y.
if (x.compareTo(y) < 0)
{
- BigInteger tmp = x; x = y; y = tmp;
+ result = x; x = y; y = result; // use 'result' as a work var
swapped = true;
}
// As above (for ints), result will be in the 2nd element unless
@@ -1192,7 +1119,12 @@ public class BigInteger extends Number implements Comparable
BigInteger rem = new BigInteger();
BigInteger quot = new BigInteger();
divide(x, y, quot, rem, FLOOR);
- result = euclidInv(y, rem, quot)[swapped ? 0 : 1];
+ // quot and rem may not be in canonical form. ensure
+ rem.canonicalize();
+ quot.canonicalize();
+ BigInteger[] xy = new BigInteger[2];
+ euclidInv(y, rem, quot, xy);
+ result = swapped ? xy[0] : xy[1];
// Result can't be negative, so make it positive by adding the
// original modulus, y (which is now x if they were swapped).
@@ -1216,16 +1148,13 @@ public class BigInteger extends Number implements Comparable
// To do this naively by first raising this to the power of exponent
// and then performing modulo m would be extremely expensive, especially
// for very large numbers. The solution is found in Number Theory
- // where a combination of partial powers and modulos can be done easily.
+ // where a combination of partial powers and moduli can be done easily.
//
// We'll use the algorithm for Additive Chaining which can be found on
// p. 244 of "Applied Cryptography, Second Edition" by Bruce Schneier.
- BigInteger s, t, u;
- int i;
-
- s = ONE;
- t = this;
- u = exponent;
+ BigInteger s = ONE;
+ BigInteger t = this;
+ BigInteger u = exponent;
while (!u.isZero())
{
@@ -1242,24 +1171,22 @@ public class BigInteger extends Number implements Comparable
private static final int gcd(int a, int b)
{
// Euclid's algorithm, copied from libg++.
+ int tmp;
if (b > a)
{
- int tmp = a; a = b; b = tmp;
+ tmp = a; a = b; b = tmp;
}
for(;;)
{
if (b == 0)
return a;
- else if (b == 1)
+ if (b == 1)
return b;
- else
- {
- int tmp = b;
+ tmp = b;
b = a % b;
a = tmp;
}
}
- }
public BigInteger gcd(BigInteger y)
{
@@ -1268,7 +1195,7 @@ public class BigInteger extends Number implements Comparable
if (words == null)
{
if (xval == 0)
- return BigInteger.abs(y);
+ return abs(y);
if (y.words == null
&& xval != Integer.MIN_VALUE && yval != Integer.MIN_VALUE)
{
@@ -1276,14 +1203,14 @@ public class BigInteger extends Number implements Comparable
xval = -xval;
if (yval < 0)
yval = -yval;
- return BigInteger.make(BigInteger.gcd(xval, yval));
+ return valueOf(gcd(xval, yval));
}
xval = 1;
}
if (y.words == null)
{
if (yval == 0)
- return BigInteger.abs(this);
+ return abs(this);
yval = 1;
}
int len = (xval > yval ? xval : yval) + 1;
@@ -1298,8 +1225,24 @@ public class BigInteger extends Number implements Comparable
return result.canonicalize();
}
+ /**
+ * <p>Returns <code>true</code> if this BigInteger is probably prime,
+ * <code>false</code> if it's definitely composite. If <code>certainty</code>
+ * is <code><= 0</code>, <code>true</code> is returned.</p>
+ *
+ * @param certainty a measure of the uncertainty that the caller is willing
+ * to tolerate: if the call returns <code>true</code> the probability that
+ * this BigInteger is prime exceeds <code>(1 - 1/2<sup>certainty</sup>)</code>.
+ * The execution time of this method is proportional to the value of this
+ * parameter.
+ * @return <code>true</code> if this BigInteger is probably prime,
+ * <code>false</code> if it's definitely composite.
+ */
public boolean isProbablePrime(int certainty)
{
+ if (certainty < 1)
+ return true;
+
/** We'll use the Rabin-Miller algorithm for doing a probabilistic
* primality test. It is fast, easy and has faster decreasing odds of a
* composite passing than with other tests. This means that this
@@ -1311,19 +1254,20 @@ public class BigInteger extends Number implements Comparable
* Cryptography, Second Edition" by Bruce Schneier.
*/
- // First rule out small prime factors and assure the number is odd.
- for (int i = 0; i < primes.length; i++)
+ // First rule out small prime factors
+ BigInteger rem = new BigInteger();
+ int i;
+ for (i = 0; i < primes.length; i++)
{
if (words == null && ival == primes[i])
return true;
- if (remainder(make(primes[i])).isZero())
+
+ divide(this, smallFixNums[primes[i] - minFixNum], null, rem, TRUNCATE);
+ if (rem.canonicalize().isZero())
return false;
}
// Now perform the Rabin-Miller test.
- // NB: I know that this can be simplified programatically, but
- // I have tried to keep it as close as possible to the algorithm
- // as written in the Schneier book for reference purposes.
// Set b to the number of times 2 evenly divides (this - 1).
// I.e. 2^b is the largest power of 2 that divides (this - 1).
@@ -1331,22 +1275,31 @@ public class BigInteger extends Number implements Comparable
int b = pMinus1.getLowestSetBit();
// Set m such that this = 1 + 2^b * m.
- BigInteger m = pMinus1.divide(make(2L << b - 1));
-
- Random rand = new Random();
- while (certainty-- > 0)
- {
- // Pick a random number greater than 1 and less than this.
- // The algorithm says to pick a small number to make the calculations
- // go faster, but it doesn't say how small; we'll use 2 to 1024.
- int a = rand.nextInt();
- a = (a < 0 ? -a : a) % 1023 + 2;
-
- BigInteger z = make(a).modPow(m, this);
+ BigInteger m = pMinus1.divide(valueOf(2L << b - 1));
+
+ // The HAC (Handbook of Applied Cryptography), Alfred Menezes & al. Note
+ // 4.49 (controlling the error probability) gives the number of trials
+ // for an error probability of 1/2**80, given the number of bits in the
+ // number to test. we shall use these numbers as is if/when 'certainty'
+ // is less or equal to 80, and twice as much if it's greater.
+ int bits = this.bitLength();
+ for (i = 0; i < k.length; i++)
+ if (bits <= k[i])
+ break;
+ int trials = t[i];
+ if (certainty > 80)
+ trials *= 2;
+ BigInteger z;
+ for (int t = 0; t < trials; t++)
+ {
+ // The HAC (Handbook of Applied Cryptography), Alfred Menezes & al.
+ // Remark 4.28 states: "...A strategy that is sometimes employed
+ // is to fix the bases a to be the first few primes instead of
+ // choosing them at random.
+ z = smallFixNums[primes[t] - minFixNum].modPow(m, this);
if (z.isOne() || z.equals(pMinus1))
continue; // Passes the test; may be prime.
- int i;
for (i = 0; i < b; )
{
if (z.isOne())
@@ -1355,7 +1308,7 @@ public class BigInteger extends Number implements Comparable
if (z.equals(pMinus1))
break; // Passes the test; may be prime.
- z = z.modPow(make(2), this);
+ z = z.modPow(valueOf(2), this);
}
if (i == b && !z.equals(pMinus1))
@@ -1456,9 +1409,9 @@ public class BigInteger extends Number implements Comparable
if (x.words == null)
{
if (count <= 0)
- return make(count > -32 ? x.ival >> (-count) : x.ival < 0 ? -1 : 0);
+ return valueOf(count > -32 ? x.ival >> (-count) : x.ival < 0 ? -1 : 0);
if (count < 32)
- return make((long) x.ival << count);
+ return valueOf((long) x.ival << count);
}
if (count == 0)
return x;
@@ -1496,7 +1449,6 @@ public class BigInteger extends Number implements Comparable
work = words;
int len = ival;
- int buf_size = len * (MPN.chars_per_word(radix) + 1);
if (radix == 16)
{
if (neg)
@@ -1549,7 +1501,7 @@ public class BigInteger extends Number implements Comparable
{
if (words == null)
return Integer.toString(ival, radix);
- else if (ival <= 2)
+ if (ival <= 2)
return Long.toString(longValue(), radix);
int buf_size = ival * (MPN.chars_per_word(radix) + 1);
StringBuffer buffer = new StringBuffer(buf_size);
@@ -1599,7 +1551,7 @@ public class BigInteger extends Number implements Comparable
{
if (obj == null || ! (obj instanceof BigInteger))
return false;
- return BigInteger.equals(this, (BigInteger) obj);
+ return equals(this, (BigInteger) obj);
}
private static BigInteger valueOf(String s, int radix)
@@ -1609,7 +1561,7 @@ public class BigInteger extends Number implements Comparable
// Testing (len < MPN.chars_per_word(radix)) would be more accurate,
// but slightly more expensive, for little practical gain.
if (len <= 15 && radix <= 16)
- return BigInteger.make(Long.parseLong(s, radix));
+ return valueOf(Long.parseLong(s, radix));
int byte_len = 0;
byte[] bytes = new byte[len];
@@ -1654,8 +1606,7 @@ public class BigInteger extends Number implements Comparable
if (ival <= 2)
return (double) longValue();
if (isNegative())
- return BigInteger.neg(this).roundToDouble(0, true, false);
- else
+ return neg(this).roundToDouble(0, true, false);
return roundToDouble(0, false, false);
}
@@ -1763,7 +1714,6 @@ public class BigInteger extends Number implements Comparable
* Assumes words.length >= (this.words == null ? 1 : this.ival).
* Result is zero-extended, but need not be a valid 2's complement number.
*/
-
private void getAbsolute(int[] words)
{
int len;
@@ -1814,7 +1764,7 @@ public class BigInteger extends Number implements Comparable
return;
}
realloc(len + 1);
- if (BigInteger.negate(words, x.words, len))
+ if (negate(words, x.words, len))
words[len++] = 0;
ival = len;
}
@@ -1838,7 +1788,7 @@ public class BigInteger extends Number implements Comparable
private static BigInteger neg(BigInteger x)
{
if (x.words == null && x.ival != Integer.MIN_VALUE)
- return make(- x.ival);
+ return valueOf(- x.ival);
BigInteger result = new BigInteger(0);
result.setNegative(x);
return result.canonicalize();
@@ -1846,7 +1796,7 @@ public class BigInteger extends Number implements Comparable
public BigInteger negate()
{
- return BigInteger.neg(this);
+ return neg(this);
}
/** Calculates ceiling(log2(this < 0 ? -this : this+1))
@@ -1856,7 +1806,6 @@ public class BigInteger extends Number implements Comparable
{
if (words == null)
return MPN.intLength(ival);
- else
return MPN.intLength(words, ival);
}
@@ -1907,7 +1856,7 @@ public class BigInteger extends Number implements Comparable
case 1: return x.and(y);
case 3: return x;
case 5: return y;
- case 15: return make(-1);
+ case 15: return valueOf(-1);
}
BigInteger result = new BigInteger();
setBitOp(result, op, x, y);
@@ -2105,15 +2054,15 @@ public class BigInteger extends Number implements Comparable
private static BigInteger and(BigInteger x, int y)
{
if (x.words == null)
- return BigInteger.make(x.ival & y);
+ return valueOf(x.ival & y);
if (y >= 0)
- return BigInteger.make(x.words[0] & y);
+ return valueOf(x.words[0] & y);
int len = x.ival;
int[] words = new int[len];
words[0] = x.words[0] & y;
while (--len > 0)
words[len] = x.words[len];
- return BigInteger.make(words, x.ival);
+ return make(words, x.ival);
}
/** Return the logical (bit-wise) "and" of two BigIntegers. */
@@ -2136,7 +2085,7 @@ public class BigInteger extends Number implements Comparable
words[i] = x.words[i] & y.words[i];
for ( ; i < len; i++)
words[i] = x.words[i];
- return BigInteger.make(words, len);
+ return make(words, len);
}
/** Return the logical (bit-wise) "(inclusive) or" of two BigIntegers. */
diff --git a/libjava/java/net/DatagramSocket.java b/libjava/java/net/DatagramSocket.java
index b2f2ca11ce3..334083a6f35 100644
--- a/libjava/java/net/DatagramSocket.java
+++ b/libjava/java/net/DatagramSocket.java
@@ -1,12 +1,39 @@
-// DatagramSocket.java
-
-/* 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. */
+/* DatagramSocket.java -- A class to model UDP sockets
+ 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. */
package java.net;
@@ -15,16 +42,23 @@ import java.nio.channels.DatagramChannel;
import java.nio.channels.IllegalBlockingModeException;
/**
- * @author Warren Levy <warrenl@cygnus.com>
- * @date May 3, 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 models a connectionless datagram socket that sends
+ * individual packets of data across the network. In the TCP/IP world,
+ * this means UDP. Datagram packets do not have guaranteed delivery,
+ * or any guarantee about the order the data will be received on the
+ * remote host.
+ *
+ * @author Aaron M. Renn (arenn@urbanophile.com)
+ * @author Warren Levy (warrenl@cygnus.com)
+ * @date May 3, 1999.
+ */
+
public class DatagramSocket
{
/**
@@ -33,24 +67,26 @@ public class DatagramSocket
*/
static DatagramSocketImplFactory factory;
+ /**
+ * This is the implementation object used by this socket.
+ */
DatagramSocketImpl impl;
+ /**
+ * The unique DatagramChannel object associated with this datagram socket,
+ * or null.
+ */
DatagramChannel ch;
+ /**
+ * This is the address we are "connected" to
+ */
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
+ * This is the port we are "connected" to
*/
- public DatagramSocket() throws SocketException
- {
- this(0, null);
- }
+ private int remotePort = -1;
/**
* Creates a DatagramSocket from a specified DatagramSocketImpl instance
@@ -67,31 +103,27 @@ public class DatagramSocket
}
/**
- * Creates a datagram socket that is bound to a given socket address
- *
- * @param bindaddr The socket address to bind to
+ * Initializes a new instance of <code>DatagramSocket</code> that binds to
+ * a random port and every address on the local machine.
*
- * @exception SocketException If an error occurs
+ * @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
+ * its checkListen method doesn't allow the operation.
*/
- public DatagramSocket (SocketAddress bindaddr)
- throws SocketException
+ public DatagramSocket() throws SocketException
{
- this (((InetSocketAddress) bindaddr).getPort (),
- ((InetSocketAddress) bindaddr).getAddress ());
+ this(0, null);
}
/**
- * Creates a datagram socket that is bound to a specific port
+ * Initializes a new instance of <code>DatagramSocket</code> that binds to
+ * the specified port and every address on the local machine.
*
- * @param port The port number to bind to
+ * @param port The local 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
+ * @exception SecurityException If a security manager exists and its
+ * checkListen method doesn't allow the operation.
+ * @exception SocketException If an error occurs.
*/
public DatagramSocket(int port) throws SocketException
{
@@ -99,14 +131,15 @@ public class DatagramSocket
}
/**
- * Creates a datagram socket that is bound to a specific port/inet address
+ * Initializes a new instance of <code>DatagramSocket</code> that binds to
+ * the specified local port and address.
*
- * @param port The port number to bind to
- * @param laddr The local address to bind to
+ * @param port The local 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
+ * @exception SecurityException If a security manager exists and its
+ * checkListen method doesn't allow the operation.
+ * @exception SocketException If an error occurs.
*/
public DatagramSocket(int port, InetAddress laddr) throws SocketException
{
@@ -123,8 +156,8 @@ public class DatagramSocket
else
try
{
- impl = (DatagramSocketImpl) Class.forName("java.net." + propVal +
- "DatagramSocketImpl").newInstance();
+ impl = (DatagramSocketImpl) Class.forName
+ ("java.net." + propVal + "DatagramSocketImpl").newInstance();
}
catch (Exception e)
{
@@ -145,34 +178,26 @@ public class DatagramSocket
}
/**
- * Binds the socket to the given socket addres
+ * Initializes a new instance of <code>DatagramSocket</code> that binds to
+ * the specified local port and address.
*
- * @param address The socket address to bind to
+ * @param port The local 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
- * @exception IllegalArgumentException If address type is not supported
+ * @exception SecurityException If a security manager exists and its
+ * checkListen method doesn't allow the operation.
+ * @exception SocketException If an error occurs.
*
* @since 1.4
*/
- public void bind (SocketAddress address)
- throws SocketException
+ public DatagramSocket (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 ());
+ this (((InetSocketAddress) address).getPort (),
+ ((InetSocketAddress) address).getAddress ());
}
/**
- * Closes the datagram socket
+ * Closes this datagram socket.
*/
public void close()
{
@@ -182,27 +207,41 @@ public class DatagramSocket
}
/**
- * Checks if the datagram socket is closed
+ * This method returns the remote address to which this socket is
+ * connected. If this socket is not connected, then this method will
+ * return <code>null</code>.
*
- * @since 1.4
+ * @return The remote address.
+ *
+ * @since 1.2
*/
- public boolean isClosed()
+ public InetAddress getInetAddress()
{
- return !impl.getFileDescriptor().valid();
+ if (!isConnected ())
+ return null;
+
+ return remoteAddress;
}
/**
- * Gets a datagram channel assoziated with the socket
+ * This method returns the remote port to which this socket is
+ * connected. If this socket is not connected, then this method will
+ * return -1.
*
- * @since 1.4
+ * @return The remote port.
+ *
+ * @since 1.2
*/
- public DatagramChannel getChannel()
+ public int getPort()
{
- return ch;
+ if (!isConnected ())
+ return -1;
+
+ return remotePort;
}
/**
- * Returns the local address of the datagram socket
+ * Returns the local address this datagram socket is bound to.
*
* @since 1.1
*/
@@ -244,9 +283,9 @@ public class DatagramSocket
}
/**
- * Returns the local port this socket uses
+ * Returns the local port this socket is bound to.
*
- * @return The local port number
+ * @return The local port number.
*/
public int getLocalPort()
{
@@ -257,11 +296,12 @@ public class DatagramSocket
}
/**
- * Gets the SO_TIMEOUT value
+ * Returns the value of the socket's SO_TIMEOUT setting. If this method
+ * returns 0 then SO_TIMEOUT is disabled.
*
- * @return The current timeout in milliseconds
+ * @return The current timeout in milliseconds.
*
- * @exception SocketException If an error occurs
+ * @exception SocketException If an error occurs.
*
* @since 1.1
*/
@@ -271,6 +311,7 @@ public class DatagramSocket
throw new SocketException ("Cannot initialize Socket implementation");
Object timeout = impl.getOption(SocketOptions.SO_TIMEOUT);
+
if (timeout instanceof Integer)
return ((Integer)timeout).intValue();
else
@@ -278,20 +319,184 @@ public class DatagramSocket
}
/**
- * Receive a datagram packet
+ * Sets the value of the socket's SO_TIMEOUT value. A value of 0 will
+ * disable SO_TIMEOUT. Any other value is the number of milliseconds
+ * a socket read/write will block before timing out.
+ *
+ * @param timeout The new SO_TIMEOUT value in milliseconds.
+ *
+ * @exception SocketException If an error occurs.
+ *
+ * @since 1.1
+ */
+ public synchronized void setSoTimeout(int timeout) throws SocketException
+ {
+ if (timeout < 0)
+ throw new IllegalArgumentException("Invalid timeout: " + timeout);
+
+ impl.setOption(SocketOptions.SO_TIMEOUT, new Integer(timeout));
+ }
+
+ /**
+ * 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.
+ *
+ * @return The send buffer size.
+ *
+ * @exception SocketException If an error occurs.
+ *
+ * @since 1.2
+ */
+ 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)
+ return(((Integer)obj).intValue());
+ else
+ throw new SocketException("Unexpected type");
+ }
+
+ /**
+ * This method sets the value for the system level socket option
+ * SO_SNDBUF to the specified value. Note that valid values for this
+ * option are specific to a given operating system.
*
- * @param p The datagram packet to put the incoming data into
+ * @param size The new send buffer size.
+ *
+ * @exception SocketException If an error occurs.
+ * @exception IllegalArgumentException If size is 0 or negative.
+ *
+ * @since 1.2
+ */
+ public void setSendBufferSize(int size) throws SocketException
+ {
+ if (size < 0)
+ throw new IllegalArgumentException("Buffer size is less than 0");
+
+ impl.setOption(SocketOptions.SO_SNDBUF, 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.
+ *
+ * @since 1.2
+ */
+ 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)
+ return(((Integer)obj).intValue());
+ else
+ throw new SocketException("Unexpected type");
+ }
+
+ /**
+ * 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.
+ * @exception IllegalArgumentException If size is 0 or negative.
*
- * @exception IOException If an error occurs
+ * @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");
+
+ impl.setOption(SocketOptions.SO_RCVBUF, new Integer(size));
+ }
+
+ /**
+ * This method connects this socket to the specified address and port.
+ * When a datagram socket is connected, it will only send or receive
+ * packets to and from the host to which it is connected. A multicast
+ * socket that is connected may only send and not receive packets.
+ *
+ * @param address The address to connect this socket to.
+ * @param port The port to connect this socket to.
+ *
+ * @exception SocketException If an error occurs.
+ * @exception IllegalArgumentException If address or port are invalid.
+ * @exception SecurityException If the caller is not allowed to send
+ * datagrams to or receive from this address and port.
+ *
+ * @since 1.2
+ */
+ public void connect(InetAddress address, int port)
+ {
+ if (address == null)
+ throw new IllegalArgumentException ("Connect address may not be null");
+
+ if ((port < 1) || (port > 65535))
+ throw new IllegalArgumentException ("Port number is illegal: " + port);
+
+ SecurityManager sm = System.getSecurityManager();
+ if (sm != null)
+ sm.checkConnect(address.getHostName(), port);
+
+ try
+ {
+ impl.connect (address, port);
+ remoteAddress = address;
+ remotePort = port;
+ }
+ catch (SocketException e)
+ {
+ }
+ }
+
+ /**
+ * This method disconnects this socket from the address/port it was
+ * conencted to. If the socket was not connected in the first place,
+ * this method does nothing.
+ *
+ * @since 1.2
+ */
+ public void disconnect()
+ {
+ impl.disconnect();
+ }
+
+ /**
+ * Reads a datagram packet from the socket. Note that this method
+ * will block until a packet is received from the network. On return,
+ * the passed in <code>DatagramPacket</code> is populated with the data
+ * received and all the other information about the 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
+ * 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 will be thrown.
* @exception IllegalBlockingModeException If this socket has an associated
- * channel, and the channel is in non-blocking mode
+ * 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
+ * checkAccept ethod doesn't allow the receive.
*/
public synchronized void receive(DatagramPacket p) throws IOException
{
@@ -313,18 +518,19 @@ public class DatagramSocket
}
/**
- * Sends a datagram packet
+ * Sends the specified packet. The host and port to which the packet
+ * are to be sent should be set inside the packet.
*
- * @param p The datagram packet to send
+ * @param p The datagram packet to send.
*
- * @exception IOException If an error occurs
+ * @exception IOException If an error occurs.
* @exception SecurityException If a security manager exists and its
- * checkMulticast or checkConnect method doesn't allow the send
+ * 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 will be thrown.
* @exception IllegalBlockingModeException If this socket has an associated
- * channel, and the channel is in non-blocking mode
+ * channel, and the channel is in non-blocking mode.
*/
public void send(DatagramPacket p) throws IOException
{
@@ -357,62 +563,59 @@ public class DatagramSocket
}
/**
- * Sets a new value for SO_TIMEOUT
+ * Binds the socket to the given socket address.
*
- * @param timeout The timeout in milliseconds
+ * @param address The socket address to bind to.
*
- * @exception SocketException If an error occurs
+ * @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.1
+ * @since 1.4
*/
- public synchronized void setSoTimeout(int timeout) throws SocketException
+ public void bind (SocketAddress address)
+ throws SocketException
{
- if (timeout < 0)
- throw new IllegalArgumentException("Invalid timeout: " + timeout);
+ if (! (address instanceof InetSocketAddress))
+ throw new IllegalArgumentException ();
- impl.setOption(SocketOptions.SO_TIMEOUT, new Integer(timeout));
+ InetSocketAddress tmp = (InetSocketAddress) address;
+
+ SecurityManager s = System.getSecurityManager ();
+ if (s != null)
+ s.checkListen(tmp.getPort ());
+
+ impl.bind (tmp.getPort (), tmp.getAddress ());
}
/**
- * 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
+ * Checks if the datagram socket is closed.
*
- * @since 1.2
+ * @since 1.4
*/
- public void connect(InetAddress address, int port)
- throws SocketException
+ public boolean isClosed()
{
- 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);
+ return !impl.getFileDescriptor().valid();
+ }
- remoteAddress = address;
- remotePort = port;
+ /**
+ * Returns the datagram channel assoziated with this datagram socket.
+ *
+ * @since 1.4
+ */
+ public DatagramChannel getChannel()
+ {
+ return ch;
}
/**
* Connects the datagram socket to a specified socket address.
*
- * @param address The socket address to connect to
+ * @param address The socket address to connect to.
*
- * @exception SocketException If an error occurs
- * @exception IllegalArgumentException If address type is not supported
+ * @exception SocketException If an error occurs.
+ * @exception IllegalArgumentException If address type is not supported.
*
* @since 1.4
*/
@@ -427,17 +630,7 @@ public class DatagramSocket
}
/**
- * Disconnects the datagram socket
- *
- * @since 1.2
- */
- public void disconnect()
- {
- impl.disconnect();
- }
-
- /**
- * Returns the binding state of the socket
+ * Returns the binding state of the socket.
*
* @since 1.4
*/
@@ -456,7 +649,7 @@ public class DatagramSocket
}
/**
- * Returns the connection state of the socket
+ * Returns the connection state of the socket.
*
* @since 1.4
*/
@@ -466,35 +659,8 @@ public class DatagramSocket
}
/**
- * 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;
-
- 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
+ * or null if this socket is not connected.
*
* @since 1.4
*/
@@ -508,7 +674,7 @@ public class DatagramSocket
/**
* Returns the local SocketAddress this socket is bound to
- * or null if it is not bound
+ * or null if it is not bound.
*
* @since 1.4
*/
@@ -529,36 +695,12 @@ public class DatagramSocket
}
/**
- * 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.
+ * Enables/Disables SO_REUSEADDR.
*
- * @return The receive buffer size.
+ * @param on Whether or not to have SO_REUSEADDR turned on.
*
* @exception SocketException If an error occurs.
*
- * @since 1.2
- */
- 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)
- return(((Integer)obj).intValue());
- else
- throw new SocketException("Unexpected type");
- }
-
- /**
- * 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
@@ -570,9 +712,9 @@ public class DatagramSocket
}
/**
- * Checks if SO_REUSEADDR is enabled
+ * Checks if SO_REUSEADDR is enabled.
*
- * @exception SocketException If an error occurs
+ * @exception SocketException If an error occurs.
*
* @since 1.4
*/
@@ -673,73 +815,6 @@ public class DatagramSocket
}
/**
- * 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.
- *
- * @return The send buffer size.
- *
- * @exception SocketException If an error occurs.
- *
- * @since 1.2
- */
- 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)
- return(((Integer)obj).intValue());
- else
- throw new SocketException("Unexpected type");
- }
-
- /**
- * 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.
- * @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");
-
- impl.setOption(SocketOptions.SO_RCVBUF, new Integer(size));
- }
-
- /**
- * This method sets the value for the system level socket option
- * SO_SNDBUF to the specified value. Note that valid values for this
- * option are specific to a given operating system.
- *
- * @param size The new send buffer size.
- *
- * @exception SocketException If an error occurs.
- * @exception IllegalArgumentException If size is 0 or negative
- *
- * @since 1.2
- */
- public void setSendBufferSize(int size) throws SocketException
- {
- if (size < 0)
- throw new IllegalArgumentException("Buffer size is less than 0");
-
- impl.setOption(SocketOptions.SO_SNDBUF, new Integer(size));
- }
-
- /**
* Sets the datagram socket implementation factory for the application
*
* @param fac The factory to set
diff --git a/libjava/java/net/HttpURLConnection.java b/libjava/java/net/HttpURLConnection.java
index e914b190203..ebc0f8175f4 100644
--- a/libjava/java/net/HttpURLConnection.java
+++ b/libjava/java/net/HttpURLConnection.java
@@ -142,6 +142,11 @@ public abstract class HttpURLConnection extends URLConnection
* a conditional GET.
*/
public static final int HTTP_NOT_MODIFIED = 304;
+
+ /**
+ * The requested resource needs to be accessed through a proxy.
+ */
+ public static final int HTTP_USE_PROXY = 305;
/* HTTP Client Error Response Codes */
@@ -250,7 +255,7 @@ public abstract class HttpURLConnection extends URLConnection
* The server does not support the requested functionality.
* @since 1.3
*/
- static final int HTTP_NOT_IMPLEMENTED = 501;
+ public static final int HTTP_NOT_IMPLEMENTED = 501;
/**
* The proxy encountered a bad response from the server it was proxy-ing for
@@ -459,31 +464,36 @@ public abstract class HttpURLConnection extends URLConnection
connect();
gotResponseVals = true;
- // Response is the first header received from the connection.
- String respField = getHeaderField(0);
-
- if (respField == null || ! respField.startsWith("HTTP/"))
- {
- // Set to default values on failure.
- responseCode = -1;
- responseMessage = null;
- return;
- }
- int firstSpc, nextSpc;
- firstSpc = respField.indexOf(' ');
- nextSpc = respField.indexOf(' ', firstSpc + 1);
- responseMessage = respField.substring(nextSpc + 1);
- String codeStr = respField.substring(firstSpc + 1, nextSpc);
- try
+ // If responseCode not yet explicitly set by subclass
+ if (responseCode == -1)
{
- responseCode = Integer.parseInt(codeStr);
- }
- catch (NumberFormatException e)
- {
- // Set to default values on failure.
- responseCode = -1;
- responseMessage = null;
+ // Response is the first header received from the connection.
+ String respField = getHeaderField(0);
+
+ if (respField == null || ! respField.startsWith("HTTP/"))
+ {
+ // Set to default values on failure.
+ responseCode = -1;
+ responseMessage = null;
+ return;
+ }
+
+ int firstSpc, nextSpc;
+ firstSpc = respField.indexOf(' ');
+ nextSpc = respField.indexOf(' ', firstSpc + 1);
+ responseMessage = respField.substring(nextSpc + 1);
+ String codeStr = respField.substring(firstSpc + 1, nextSpc);
+ try
+ {
+ responseCode = Integer.parseInt(codeStr);
+ }
+ catch (NumberFormatException e)
+ {
+ // Set to default values on failure.
+ responseCode = -1;
+ responseMessage = null;
+ }
}
}
diff --git a/libjava/java/net/InetSocketAddress.java b/libjava/java/net/InetSocketAddress.java
index 1b740dcc507..3c54b51a0f0 100644
--- a/libjava/java/net/InetSocketAddress.java
+++ b/libjava/java/net/InetSocketAddress.java
@@ -47,6 +47,11 @@ package java.net;
public class InetSocketAddress extends SocketAddress
{
+ /**
+ * Compatible with JDK 1.4+
+ */
+ private static final long serialVersionUID = 5076001401234631237L;
+
String hostname;
InetAddress addr;
int port;
diff --git a/libjava/java/net/MulticastSocket.java b/libjava/java/net/MulticastSocket.java
index 2700ebee511..dca1a85678b 100644
--- a/libjava/java/net/MulticastSocket.java
+++ b/libjava/java/net/MulticastSocket.java
@@ -1,5 +1,6 @@
/* MulticastSocket.java -- Class for using multicast sockets
- Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003
+ Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -160,16 +161,18 @@ public class MulticastSocket extends DatagramSocket
return impl.getTimeToLive();
}
- /**
- * 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
+ /**
+ * Sets the interface to use for sending multicast packets.
+ *
+ * @param addr The new interface to use.
+ *
+ * @exception SocketException If an error occurs.
+ *
+ * @since 1.4
+ */
+ public void setInterface(InetAddress addr) throws SocketException
{
- impl.setOption(SocketOptions.IP_MULTICAST_IF, inf);
+ impl.setOption(SocketOptions.IP_MULTICAST_IF, addr);
}
/**
diff --git a/libjava/java/net/NetPermission.java b/libjava/java/net/NetPermission.java
index f5b625a0d6f..1807d457d6c 100644
--- a/libjava/java/net/NetPermission.java
+++ b/libjava/java/net/NetPermission.java
@@ -48,7 +48,6 @@ import java.security.BasicPermission;
* @author Aaron M. Renn (arenn@urbanophile.com)
*/
public final class NetPermission extends BasicPermission
- implements java.io.Serializable
{
static final long serialVersionUID = -8343910153355041693L;
@@ -65,7 +64,7 @@ public final class NetPermission extends BasicPermission
/**
* Initializes a new instance of <code>NetPermission</code> with the
- * specified name and value. Note that the value field is irrelevant and is
+ * specified name and perms. Note that the perms field is irrelevant and is
* ignored. This constructor should never need to be used.
*
* @param name The name of this permission
diff --git a/libjava/java/net/NetworkInterface.java b/libjava/java/net/NetworkInterface.java
index 60a7d764cbc..32c2cd53db0 100644
--- a/libjava/java/net/NetworkInterface.java
+++ b/libjava/java/net/NetworkInterface.java
@@ -200,8 +200,9 @@ public final class NetworkInterface
return false;
NetworkInterface tmp = (NetworkInterface) obj;
- return name.equals (tmp.name) &&
- inetAddresses.equals (tmp.inetAddresses);
+
+ return (name.equals (tmp.name)
+ && inetAddresses.equals (tmp.inetAddresses));
}
/**
diff --git a/libjava/java/net/ServerSocket.java b/libjava/java/net/ServerSocket.java
index 62917b6a8a5..0285c128c77 100644
--- a/libjava/java/net/ServerSocket.java
+++ b/libjava/java/net/ServerSocket.java
@@ -77,6 +77,8 @@ public class ServerSocket
*/
private ServerSocketChannel ch;
+ private boolean closed = false;
+
/**
* Constructor that simply sets the implementation.
*
@@ -200,6 +202,9 @@ public class ServerSocket
*/
public void bind (SocketAddress endpoint, int backlog) throws IOException
{
+ if (closed)
+ throw new SocketException ("ServerSocket is closed");
+
if (impl == null)
throw new IOException ("Cannot initialize Socket implementation");
@@ -315,7 +320,13 @@ public class ServerSocket
*/
public void close () throws IOException
{
- impl.close();
+ if (impl != null)
+ impl.close ();
+
+ if (ch != null)
+ ch.close ();
+
+ closed = true;
}
/**
@@ -345,7 +356,7 @@ public class ServerSocket
}
catch (SocketException e)
{
- return false;
+ return false;
}
return true;
@@ -358,8 +369,7 @@ public class ServerSocket
*/
public boolean isClosed()
{
- // FIXME: implement this
- return false;
+ return closed;
}
/**
diff --git a/libjava/java/net/Socket.java b/libjava/java/net/Socket.java
index 592f39a3dd3..005fd0461b2 100644
--- a/libjava/java/net/Socket.java
+++ b/libjava/java/net/Socket.java
@@ -85,6 +85,8 @@ public class Socket
SocketChannel ch; // this field must have been set if created by SocketChannel
+ private boolean closed = false;
+
// Constructors
/**
@@ -93,6 +95,7 @@ public class Socket
* might want this behavior.
*
* @specnote This constructor is public since JDK 1.4
+ * @since 1.1
*/
public Socket ()
{
@@ -120,6 +123,8 @@ public class Socket
* <code>Socket</code>
*
* @exception SocketException If an error occurs
+ *
+ * @since 1.1
*/
protected Socket (SocketImpl impl) throws SocketException
{
@@ -178,6 +183,8 @@ public class Socket
* exists and does not allow a connection to the specified host/port or
* binding to the specified local host/port.
* @exception IOException If a connection error occurs.
+ *
+ * @since 1.1
*/
public Socket (String host, int port,
InetAddress localAddr, int localPort) throws IOException
@@ -198,6 +205,8 @@ public class Socket
* @exception IOException If an error occurs
* @exception SecurityException If a security manager exists and its
* checkConnect method doesn't allow the operation
+ *
+ * @since 1.1
*/
public Socket (InetAddress address, int port,
InetAddress localAddr, int localPort) throws IOException
@@ -308,6 +317,9 @@ public class Socket
*/
public void bind (SocketAddress bindpoint) throws IOException
{
+ if (closed)
+ throw new SocketException ("Socket is closed");
+
if ( !(bindpoint instanceof InetSocketAddress))
throw new IllegalArgumentException ();
@@ -330,6 +342,9 @@ public class Socket
public void connect (SocketAddress endpoint)
throws IOException
{
+ if (closed)
+ throw new SocketException ("Socket is closed");
+
if (! (endpoint instanceof InetSocketAddress))
throw new IllegalArgumentException ("Address type not supported");
@@ -357,6 +372,9 @@ public class Socket
public void connect (SocketAddress endpoint, int timeout)
throws IOException
{
+ if (closed)
+ throw new SocketException ("Socket is closed");
+
if (! (endpoint instanceof InetSocketAddress))
throw new IllegalArgumentException ("Address type not supported");
@@ -385,6 +403,8 @@ public class Socket
* is not connected, then <code>null</code> is returned.
*
* @return The local address
+ *
+ * @since 1.1
*/
public InetAddress getLocalAddress ()
{
@@ -510,6 +530,8 @@ public class Socket
* @param on true to enable, false to disable
*
* @exception SocketException If an error occurs or Socket is not connected
+ *
+ * @since 1.1
*/
public void setTcpNoDelay (boolean on) throws SocketException
{
@@ -528,6 +550,8 @@ public class Socket
* @return Whether or not TCP_NODELAY is set
*
* @exception SocketException If an error occurs or Socket not connected
+ *
+ * @since 1.1
*/
public boolean getTcpNoDelay() throws SocketException
{
@@ -556,6 +580,8 @@ public class Socket
*
* @exception SocketException If an error occurs or Socket not connected
* @exception IllegalArgumentException If linger is negative
+ *
+ * @since 1.1
*/
public void setSoLinger(boolean on, int linger) throws SocketException
{
@@ -591,6 +617,8 @@ public class Socket
* if SO_LINGER not set
*
* @exception SocketException If an error occurs or Socket is not connected
+ *
+ * @since 1.1
*/
public int getSoLinger() throws SocketException
{
@@ -670,6 +698,8 @@ public class Socket
* 0 if not set
*
* @exception SocketException If an error occurs or Socket not connected
+ *
+ * @since 1.1
*/
public synchronized void setSoTimeout (int timeout) throws SocketException
{
@@ -696,6 +726,8 @@ public class Socket
* if not set
*
* @exception SocketException If an error occurs or Socket not connected
+ *
+ * @since 1.1
*/
public synchronized int getSoTimeout () throws SocketException
{
@@ -811,7 +843,7 @@ public class Socket
*
* @exception SocketException If an error occurs or Socket is not connected
*
- * @since Java 1.3
+ * @since 1.3
*/
public void setKeepAlive (boolean on) throws SocketException
{
@@ -829,7 +861,7 @@ public class Socket
*
* @exception SocketException If an error occurs or Socket is not connected
*
- * @since Java 1.3
+ * @since 1.3
*/
public boolean getKeepAlive () throws SocketException
{
@@ -853,6 +885,11 @@ public class Socket
{
if (impl != null)
impl.close();
+
+ if (ch != null)
+ ch.close();
+
+ closed = true;
}
/**
@@ -902,6 +939,8 @@ public class Socket
* Closes the input side of the socket stream.
*
* @exception IOException If an error occurs.
+ *
+ * @since 1.3
*/
public void shutdownInput() throws IOException
{
@@ -915,6 +954,8 @@ public class Socket
* Closes the output side of the socket stream.
*
* @exception IOException If an error occurs.
+ *
+ * @since 1.3
*/
public void shutdownOutput() throws IOException
{
@@ -928,6 +969,8 @@ public class Socket
* Returns the socket channel associated with this socket.
*
* It returns null if no associated socket exists.
+ *
+ * @since 1.4
*/
public SocketChannel getChannel()
{
@@ -1016,6 +1059,8 @@ public class Socket
/**
* Checks if the socket is connected
+ *
+ * @since 1.4
*/
public boolean isConnected ()
{
@@ -1024,6 +1069,8 @@ public class Socket
/**
* Checks if the socket is already bound.
+ *
+ * @since 1.4
*/
public boolean isBound ()
{
@@ -1032,15 +1079,18 @@ public class Socket
/**
* Checks if the socket is closed.
+ *
+ * @since 1.4
*/
public boolean isClosed ()
{
- // FIXME: implement this.
- return false;
+ return closed;
}
/**
* Checks if the socket's input stream is shutdown
+ *
+ * @since 1.4
*/
public boolean isInputShutdown ()
{
@@ -1049,6 +1099,8 @@ public class Socket
/**
* Checks if the socket's output stream is shutdown
+ *
+ * @since 1.4
*/
public boolean isOutputShutdown ()
{
diff --git a/libjava/java/net/SocketAddress.java b/libjava/java/net/SocketAddress.java
index 370049d6fdc..f3e67d84cc0 100644
--- a/libjava/java/net/SocketAddress.java
+++ b/libjava/java/net/SocketAddress.java
@@ -48,6 +48,9 @@ import java.io.Serializable;
*/
public abstract class SocketAddress implements Serializable
{
+ /**
+ * Compatible with JDK 1.4+
+ */
static final long serialVersionUID = 5215720748342549866L;
/**
diff --git a/libjava/java/net/SocketImpl.java b/libjava/java/net/SocketImpl.java
index 795e7139bee..12dcb0b9a5c 100644
--- a/libjava/java/net/SocketImpl.java
+++ b/libjava/java/net/SocketImpl.java
@@ -74,7 +74,7 @@ public abstract class SocketImpl implements SocketOptions
/**
* The port number the socket is bound to locally
*/
- protected int localport;
+ protected int localport = -1;
/**
* The port number of the remote end of the socket connection
@@ -271,8 +271,9 @@ public abstract class SocketImpl implements SocketOptions
*/
public String toString()
{
- return "[addr=" + address.toString() + ",port=" + Integer.toString(port)
- + ",localport=" + Integer.toString(localport) + "]";
+ return "[addr=" + address
+ + ",port=" + port
+ + ",localport=" + localport + "]";
}
/**
diff --git a/libjava/java/net/SocketPermission.java b/libjava/java/net/SocketPermission.java
index 18fb7ef2f1f..6fa65f8793a 100644
--- a/libjava/java/net/SocketPermission.java
+++ b/libjava/java/net/SocketPermission.java
@@ -276,62 +276,62 @@ public final class SocketPermission extends Permission
// Get ours
if (hostport.indexOf(":") == -1)
{
- ourfirstport = 0;
- ourlastport = 65535;
+ ourfirstport = 0;
+ ourlastport = 65535;
}
else
{
- // FIXME: Needs bulletproofing.
- // This will dump if hostport if all sorts of bad data was passed to
- // the constructor
- String range = hostport.substring(hostport.indexOf(":") + 1);
- if (range.startsWith("-"))
- ourfirstport = 0;
- else if (range.indexOf("-") == -1)
- ourfirstport = Integer.parseInt(range);
- else
- ourfirstport =
- Integer.parseInt(range.substring(0, range.indexOf("-")));
-
- if (range.endsWith("-"))
- ourlastport = 65535;
- else if (range.indexOf("-") == -1)
- ourlastport = Integer.parseInt(range);
- else
- ourlastport =
- Integer.parseInt(range.
- substring(range.indexOf("-") + 1,
- range.length()));
+ // FIXME: Needs bulletproofing.
+ // This will dump if hostport if all sorts of bad data was passed to
+ // the constructor
+ String range = hostport.substring(hostport.indexOf(":") + 1);
+ if (range.startsWith("-"))
+ ourfirstport = 0;
+ else if (range.indexOf("-") == -1)
+ ourfirstport = Integer.parseInt(range);
+ else
+ ourfirstport =
+ Integer.parseInt(range.substring(0, range.indexOf("-")));
+
+ if (range.endsWith("-"))
+ ourlastport = 65535;
+ else if (range.indexOf("-") == -1)
+ ourlastport = Integer.parseInt(range);
+ else
+ ourlastport =
+ Integer.parseInt(range.
+ substring(range.indexOf("-") + 1,
+ range.length()));
}
// Get theirs
if (p.hostport.indexOf(":") == -1)
{
- theirfirstport = 0;
- ourlastport = 65535;
+ theirfirstport = 0;
+ ourlastport = 65535;
}
else
{
- // This will dump if hostport if all sorts of bad data was passed to
- // the constructor
- String range = p.hostport.substring(hostport.indexOf(":") + 1);
- if (range.startsWith("-"))
- theirfirstport = 0;
- else if (range.indexOf("-") == -1)
- theirfirstport = Integer.parseInt(range);
- else
- theirfirstport =
- Integer.parseInt(range.substring(0, range.indexOf("-")));
-
- if (range.endsWith("-"))
- theirlastport = 65535;
- else if (range.indexOf("-") == -1)
- theirlastport = Integer.parseInt(range);
- else
- theirlastport =
- Integer.parseInt(range.
- substring(range.indexOf("-") + 1,
- range.length()));
+ // This will dump if hostport if all sorts of bad data was passed to
+ // the constructor
+ String range = p.hostport.substring(hostport.indexOf(":") + 1);
+ if (range.startsWith("-"))
+ theirfirstport = 0;
+ else if (range.indexOf("-") == -1)
+ theirfirstport = Integer.parseInt(range);
+ else
+ theirfirstport =
+ Integer.parseInt(range.substring(0, range.indexOf("-")));
+
+ if (range.endsWith("-"))
+ theirlastport = 65535;
+ else if (range.indexOf("-") == -1)
+ theirlastport = Integer.parseInt(range);
+ else
+ theirlastport =
+ Integer.parseInt(range.
+ substring(range.indexOf("-") + 1,
+ range.length()));
}
// Now check them
@@ -361,17 +361,17 @@ public final class SocketPermission extends Permission
String ourcanonical = null, theircanonical = null;
try
{
- ourcanonical = InetAddress.getByName(ourhost).getHostName();
- theircanonical = InetAddress.getByName(theirhost).getHostName();
+ ourcanonical = InetAddress.getByName(ourhost).getHostName();
+ theircanonical = InetAddress.getByName(theirhost).getHostName();
}
catch (UnknownHostException e)
{
- // Who didn't resolve? Just assume current address is canonical enough
- // Is this ok to do?
- if (ourcanonical == null)
- ourcanonical = ourhost;
- if (theircanonical == null)
- theircanonical = theirhost;
+ // Who didn't resolve? Just assume current address is canonical enough
+ // Is this ok to do?
+ if (ourcanonical == null)
+ ourcanonical = ourhost;
+ if (theircanonical == null)
+ theircanonical = theirhost;
}
if (ourcanonical.equals(theircanonical))
@@ -380,9 +380,9 @@ public final class SocketPermission extends Permission
// Well, last chance. Try for a wildcard
if (ourhost.indexOf("*.") != -1)
{
- String wild_domain = ourhost.substring(ourhost.indexOf("*" + 1));
- if (theircanonical.endsWith(wild_domain))
- return (true);
+ String wild_domain = ourhost.substring(ourhost.indexOf("*" + 1));
+ if (theircanonical.endsWith(wild_domain))
+ return (true);
}
// Didn't make it
diff --git a/libjava/java/net/URLClassLoader.java b/libjava/java/net/URLClassLoader.java
index c6dc4b1d44d..d7fc77f8ab4 100644
--- a/libjava/java/net/URLClassLoader.java
+++ b/libjava/java/net/URLClassLoader.java
@@ -238,7 +238,7 @@ public class URLClassLoader extends SecureClassLoader
CodeSource getCodeSource()
{
Certificate[] certs = getCertificates();
- if (certs != null)
+ if (certs == null)
return loader.noCertCodeSource;
else
return new CodeSource(loader.baseURL, certs);
@@ -271,34 +271,18 @@ public class URLClassLoader extends SecureClassLoader
abstract InputStream getInputStream() throws IOException;
}
- static URL getCanonicalFileURL(URL url)
- {
- if ("file".equals(url.getProtocol()))
- {
- try
- {
- File f = new File(url.getFile()).getCanonicalFile();
- url = new URL("file", "", f.toString());
- }
- catch (IOException ignore)
- {
- }
- }
- return url;
- }
-
/**
* A <code>JarURLLoader</code> is a type of <code>URLLoader</code>
* only loading from jar url.
*/
final static class JarURLLoader extends URLLoader
{
- final JarFile jarfile; // The canonical jar file for this url
+ final JarFile jarfile; // The jar file for this url
final URL baseJarURL; // Base jar: url for all resources loaded from jar
public JarURLLoader(URLClassLoader classloader, URL baseURL)
{
- super(classloader, getCanonicalFileURL(baseURL));
+ super(classloader, baseURL);
// cache url prefix for all resources in this jar url
String external = baseURL.toExternalForm();
@@ -481,11 +465,11 @@ public class URLClassLoader extends SecureClassLoader
*/
final static class FileURLLoader extends URLLoader
{
- File dir; //the canonical file for this file url
+ File dir; //the file for this file url
FileURLLoader(URLClassLoader classloader, URL url)
{
- super(classloader, getCanonicalFileURL(url));
+ super(classloader, url);
dir = new File(baseURL.getFile());
}
@@ -493,13 +477,6 @@ public class URLClassLoader extends SecureClassLoader
Resource getResource(String name)
{
File file = new File(dir, name);
- try
- {
- file = file.getCanonicalFile();
- }
- catch (IOException ignore)
- {
- }
if (file.exists() && !file.isDirectory())
return new FileResource(this, name, file);
return null;
diff --git a/libjava/java/net/URLDecoder.java b/libjava/java/net/URLDecoder.java
index 36747409983..0a9067160b2 100644
--- a/libjava/java/net/URLDecoder.java
+++ b/libjava/java/net/URLDecoder.java
@@ -82,12 +82,12 @@ public class URLDecoder
{
try
{
- return decode(s, "UTF-8");
+ return decode(s, "UTF-8");
}
catch (UnsupportedEncodingException uee)
{
- // Should never happen since UTF-8 encoding should always be supported
- return s;
+ // Should never happen since UTF-8 encoding should always be supported
+ return s;
}
}
diff --git a/libjava/java/net/URLStreamHandler.java b/libjava/java/net/URLStreamHandler.java
index 128a0d2d3da..7f866440f2f 100644
--- a/libjava/java/net/URLStreamHandler.java
+++ b/libjava/java/net/URLStreamHandler.java
@@ -436,7 +436,7 @@ public abstract class URLStreamHandler
// 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.
- boolean port_needed = port >= 0 && port != getDefaultPort();
+ boolean port_needed = port > 0 && port != getDefaultPort();
if (port_needed)
sb.append(':').append(port);
diff --git a/libjava/java/nio/Buffer.java b/libjava/java/nio/Buffer.java
index 9474fb453f0..7d291bedbc1 100644
--- a/libjava/java/nio/Buffer.java
+++ b/libjava/java/nio/Buffer.java
@@ -39,11 +39,33 @@ package java.nio;
public abstract class Buffer
{
- int cap = 0;
- int limit = 0;
- int pos = 0;
- int mark = -1;
-
+ private int cap = 0;
+ private int limit = 0;
+ private int pos = 0;
+ private int mark = -1;
+
+ // Creates a new Buffer.
+ //
+ // Should be package private.
+ //
+ Buffer (int capacity, int limit, int position, int mark)
+ {
+ if (capacity < 0)
+ throw new IllegalArgumentException ();
+
+ cap = capacity;
+ limit (limit);
+ position (position);
+
+ if (mark > 0)
+ {
+ if (mark > pos)
+ throw new IllegalArgumentException ();
+
+ this.mark = mark;
+ }
+ }
+
/**
* Retrieves the capacity of the buffer.
*/
diff --git a/libjava/java/nio/ByteBuffer.java b/libjava/java/nio/ByteBuffer.java
index 874943a8757..8b7c6013019 100644
--- a/libjava/java/nio/ByteBuffer.java
+++ b/libjava/java/nio/ByteBuffer.java
@@ -37,43 +37,574 @@ exception statement from your version. */
package java.nio;
-public abstract class ByteBuffer extends Buffer
+import gnu.java.nio.ByteBufferImpl;
+
+/**
+ * @since 1.4
+ */
+public abstract class ByteBuffer extends Buffer implements Comparable
{
+ private ByteOrder endian = ByteOrder.BIG_ENDIAN;
+
+ int offset;
+ byte[] backing_buffer;
+
+ /**
+ * Allocates a new direct byte buffer.
+ */
+ public static ByteBuffer allocateDirect (int capacity)
+ {
+ throw new Error ("direct buffers are not implemented");
+ }
+
+ /**
+ * Allocates a new byte buffer.
+ */
public static ByteBuffer allocate (int capacity)
{
- return null;
+ return new ByteBufferImpl (capacity, 0, capacity);
}
+ /**
+ * Wraps a byte array into a buffer.
+ *
+ * @exception IndexOutOfBoundsException If the preconditions on the offset
+ * and length parameters do not hold
+ */
final public static ByteBuffer wrap (byte[] array, int offset, int length)
{
- return null;
+ return new ByteBufferImpl (array, offset, length);
}
+ /**
+ * Wraps a byte array into a buffer.
+ */
final public static ByteBuffer wrap (byte[] array)
{
return wrap (array, 0, array.length);
}
-
- final public ByteBuffer put (ByteBuffer src)
+
+ ByteBuffer (int capacity, int limit, int position, int mark)
+ {
+ super (capacity, limit, position, mark);
+ }
+
+ /**
+ * This method transfers bytes from this buffer into
+ * the given destination array.
+ *
+ * @param dst The destination array
+ * @param offset The offset within the array of the first byte to be written;
+ * must be non-negative and no larger than dst.length.
+ * @param length The maximum number of bytes to be written to the given array;
+ * must be non-negative and no larger than dst.length - offset.
+ *
+ * @exception BufferUnderflowException If there are fewer than length bytes
+ * remaining in this buffer.
+ * @exception IndexOutOfBoundsException - If the preconditions on the offset
+ * and length parameters do not hold.
+ */
+ public ByteBuffer get (byte[] dst, int offset, int length)
+ {
+ if ((offset < 0)
+ || (offset > dst.length)
+ || (length < 0)
+ || (length > (dst.length - offset)))
+ throw new IndexOutOfBoundsException ();
+
+ for (int i = offset; i < offset + length; i++)
+ {
+ dst [i] = get();
+ }
+
+ return this;
+ }
+
+ /**
+ * This method transfers bytes from this buffer into the given
+ * destination array.
+ *
+ * @param dst The byte array to write into.
+ *
+ * @exception BufferUnderflowException If there are fewer than dst.length
+ * bytes remaining in this buffer.
+ */
+ public ByteBuffer get (byte[] dst)
{
+ return get (dst, 0, dst.length);
+ }
+
+ /**
+ * Writes the content of src into the buffer.
+ *
+ * @param src The source data.
+ *
+ * @exception BufferOverflowException If there is insufficient space in this
+ * buffer for the remaining bytes in the source buffer.
+ * @exception IllegalArgumentException If the source buffer is this buffer.
+ * @exception ReadOnlyBufferException If this buffer is read only.
+ */
+ public ByteBuffer put (ByteBuffer src)
+ {
+ if (src == this)
+ throw new IllegalArgumentException ();
+
while (src.hasRemaining ())
put (src.get ());
return this;
}
-
- final public ByteBuffer put (byte[] src, int offset, int length)
+
+ /**
+ * Writes the content of the the array src into the buffer.
+ *
+ * @param src The array to copy into the buffer.
+ * @param offset The offset within the array of the first byte to be read;
+ * must be non-negative and no larger than src.length.
+ * @param length The number of bytes to be read from the given array;
+ * must be non-negative and no larger than src.length - offset.
+ *
+ * @exception BufferOverflowException If there is insufficient space in this
+ * buffer for the remaining bytes in the source buffer.
+ * @exception IndexOutOfBoundsException If the preconditions on the offset
+ * and length parameters do not hold.
+ * @exception ReadOnlyBufferException If this buffer is read only.
+ */
+ public ByteBuffer put (byte[] src, int offset, int length)
{
+ if ((offset < 0) ||
+ (offset > src.length) ||
+ (length < 0) ||
+ (length > src.length - offset))
+ throw new IndexOutOfBoundsException ();
+
for (int i = offset; i < offset + length; i++)
put (src [i]);
+
return this;
}
+
+ /**
+ * Writes the content of the the array src into the buffer.
+ *
+ * @param src The array to copy into the buffer.
+ *
+ * @exception BufferOverflowException If there is insufficient space in this
+ * buffer for the remaining bytes in the source buffer.
+ * @exception ReadOnlyBufferException If this buffer is read only.
+ */
public final ByteBuffer put (byte[] src)
{
return put (src, 0, src.length);
}
+ /**
+ * Tells whether or not this buffer is backed by an accessible byte array.
+ */
+ public final boolean hasArray ()
+ {
+ return (backing_buffer != null
+ && !isReadOnly ());
+ }
+
+ /**
+ * Returns the byte array that backs this buffer.
+ *
+ * @exception ReadOnlyBufferException If this buffer is backed by an array
+ * but is read-only.
+ * @exception UnsupportedOperationException If this buffer is not backed
+ * by an accessible array.
+ */
+ public final byte[] array ()
+ {
+ if (backing_buffer == null)
+ throw new UnsupportedOperationException ();
+
+ if (isReadOnly ())
+ throw new ReadOnlyBufferException ();
+
+ return backing_buffer;
+ }
+
+ /**
+ * Returns the offset within this buffer's backing array of the first element
+ * of the buffer
+ *
+ * @exception ReadOnlyBufferException If this buffer is backed by an array
+ * but is read-only.
+ * @exception UnsupportedOperationException If this buffer is not backed
+ * by an accessible array.
+ */
+ public final int arrayOffset ()
+ {
+ if (backing_buffer == null)
+ throw new UnsupportedOperationException ();
+
+ if (isReadOnly ())
+ throw new ReadOnlyBufferException ();
+
+ return offset;
+ }
+
+ /**
+ * Tells whether or not this buffer is equal to another object.
+ */
+ public boolean equals (Object obj)
+ {
+ if (obj != null &&
+ obj instanceof ByteBuffer)
+ {
+ return compareTo (obj) == 0;
+ }
+
+ return false;
+ }
+
+ /**
+ * Compares this buffer to another object.
+ *
+ * @exception ClassCastException If the argument is not a byte buffer
+ */
+ public int compareTo (Object obj)
+ {
+ ByteBuffer a = (ByteBuffer) obj;
+
+ 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;
+ }
+
+ /**
+ * Retrieves this buffer's byte order.
+ */
+ public final ByteOrder order()
+ {
+ return endian;
+ }
+
+ /**
+ * Modifies this buffer's byte order.
+ */
+ public final ByteBuffer order (ByteOrder endian)
+ {
+ this.endian = endian;
+ return this;
+ }
+
+ /**
+ * Reads the byte at this buffer's current position,
+ * and then increments the position.
+ *
+ * @exception BufferUnderflowException If the buffer's current position
+ * is not smaller than its limit.
+ */
public abstract byte get ();
+ /**
+ * Relative put method.
+ *
+ * @exception BufferOverflowException If this buffer's current position is
+ * not smaller than its limit.
+ * @exception ReadOnlyBufferException If this buffer is read-only.
+ */
public abstract ByteBuffer put (byte b);
+
+ /**
+ * Absolute get method.
+ *
+ * @exception IndexOutOfBoundsException FIXME
+ */
+ public abstract byte get (int index);
+
+ /**
+ * Absolute put method.
+ *
+ * @exception ReadOnlyBufferException If this buffer is read-only
+ * @exception IndexOutOfBoundsException FIXME
+ */
+ public abstract ByteBuffer put (int index, byte b);
+
+ /**
+ * Compacts this buffer.
+ *
+ * @exception ReadOnlyBufferException If this buffer is read-only
+ */
+ public abstract ByteBuffer compact();
+
+ /**
+ * Tells whether or not this buffer is direct.
+ */
+ public abstract boolean isDirect();
+
+ /**
+ * Creates a new byte buffer whose content is a shared subsequence of this
+ * buffer's content.
+ */
+ public abstract ByteBuffer slice();
+
+ /**
+ * Creates a new byte buffer that shares this buffer's content.
+ */
+ public abstract ByteBuffer duplicate();
+
+ /**
+ * Creates a new, read-only byte buffer that shares this buffer's content.
+ */
+ public abstract ByteBuffer asReadOnlyBuffer();
+
+ /**
+ * Creates a view of this byte buffer as a short buffer.
+ */
+ public abstract ShortBuffer asShortBuffer();
+
+ /**
+ * Creates a view of this byte buffer as a char buffer.
+ */
+ public abstract CharBuffer asCharBuffer();
+
+ /**
+ * Creates a view of this byte buffer as an integer buffer.
+ */
+ public abstract IntBuffer asIntBuffer();
+
+ /**
+ * Creates a view of this byte buffer as a long buffer.
+ */
+ public abstract LongBuffer asLongBuffer();
+
+ /**
+ * Creates a view of this byte buffer as a float buffer.
+ */
+ public abstract FloatBuffer asFloatBuffer();
+
+ /**
+ * Creates a view of this byte buffer as a double buffer.
+ */
+ public abstract DoubleBuffer asDoubleBuffer();
+
+ /**
+ * Relative get method for reading a character value.
+ *
+ * @exception BufferUnderflowException If there are fewer than two bytes
+ * remaining in this buffer.
+ */
+ public abstract char getChar();
+
+ /**
+ * Relative put method for writing a character value.
+ *
+ * @exception BufferOverflowException If this buffer's current position is
+ * not smaller than its limit.
+ */
+ public abstract ByteBuffer putChar(char value);
+
+ /**
+ * Absolute get method for reading a character value.
+ *
+ * @exception IndexOutOfBoundsException If there are fewer than two bytes
+ * remaining in this buffer
+ */
+ public abstract char getChar(int index);
+
+ /**
+ * Absolute put method for writing a character value.
+ *
+ * @exception IndexOutOfBoundsException If index is negative or not smaller
+ * than the buffer's limit, minus one.
+ */
+ public abstract ByteBuffer putChar(int index, char value);
+
+ /**
+ * Relative get method for reading a short value.
+ *
+ * @exception BufferUnderflowException If index is negative or not smaller
+ * than the buffer's limit, minus one.
+ */
+ public abstract short getShort();
+
+ /**
+ * Relative put method for writing a short value.
+ *
+ * @exception BufferOverflowException If this buffer's current position is
+ * not smaller than its limit.
+ */
+ public abstract ByteBuffer putShort(short value);
+
+ /**
+ * Absolute get method for reading a short value.
+ *
+ * @exception IndexOutOfBoundsException If there are fewer than two bytes
+ * remaining in this buffer
+ */
+ public abstract short getShort(int index);
+
+ /**
+ * Absolute put method for writing a short value.
+ *
+ * @exception IndexOutOfBoundsException If index is negative or not smaller
+ * than the buffer's limit, minus one.
+ */
+ public abstract ByteBuffer putShort(int index, short value);
+
+ /**
+ * Relative get method for reading an integer value.
+ *
+ * @exception BufferUnderflowException If there are fewer than four bytes
+ * remaining in this buffer.
+ */
+ public abstract int getInt();
+
+ /**
+ * Relative put method for writing an integer value.
+ *
+ * @exception BufferOverflowException If this buffer's current position is
+ * not smaller than its limit.
+ */
+ public abstract ByteBuffer putInt(int value);
+
+ /**
+ * Absolute get method for reading an integer value.
+ *
+ * @exception IndexOutOfBoundsException If index is negative or not smaller
+ * than the buffer's limit, minus three.
+ */
+ public abstract int getInt(int index);
+
+ /**
+ * Absolute put method for writing an integer value.
+ *
+ * @exception IndexOutOfBoundsException If index is negative or not smaller
+ * than the buffer's limit, minus three.
+ */
+ public abstract ByteBuffer putInt(int index, int value);
+
+ /**
+ * Relative get method for reading a long value.
+ *
+ * @exception BufferUnderflowException If there are fewer than eight bytes
+ * remaining in this buffer.
+ */
+ public abstract long getLong();
+
+ /**
+ * Relative put method for writing a long value.
+ *
+ * @exception BufferOverflowException If this buffer's current position is
+ * not smaller than its limit.
+ */
+ public abstract ByteBuffer putLong(long value);
+
+ /**
+ * Absolute get method for reading a long value.
+ *
+ * @exception IndexOutOfBoundsException If index is negative or not smaller
+ * than the buffer's limit, minus seven.
+ */
+ public abstract long getLong(int index);
+
+ /**
+ * Absolute put method for writing a float value.
+ *
+ * @exception IndexOutOfBoundsException If index is negative or not smaller
+ * than the buffer's limit, minus seven.
+ */
+ public abstract ByteBuffer putLong(int index, long value);
+
+ /**
+ * Relative get method for reading a float value.
+ *
+ * @exception BufferUnderflowException If there are fewer than four bytes
+ * remaining in this buffer.
+ */
+ public abstract float getFloat();
+
+ /**
+ * Relative put method for writing a float value.
+ *
+ * @exception BufferOverflowException If there are fewer than four bytes
+ * remaining in this buffer.
+ */
+ public abstract ByteBuffer putFloat(float value);
+
+ /**
+ * Absolute get method for reading a float value.
+ *
+ * @exception IndexOutOfBoundsException If index is negative or not smaller
+ * than the buffer's limit, minus three.
+ */
+ public abstract float getFloat(int index);
+
+ /**
+ * Relative put method for writing a float value.
+ *
+ * @exception IndexOutOfBoundsException If index is negative or not smaller
+ * than the buffer's limit, minus three.
+ */
+ public abstract ByteBuffer putFloat(int index, float value);
+
+ /**
+ * Relative get method for reading a double value.
+ *
+ * @exception BufferUnderflowException If there are fewer than eight bytes
+ * remaining in this buffer.
+ */
+ public abstract double getDouble();
+
+ /**
+ * Relative put method for writing a double value.
+ *
+ * @exception BufferOverflowException If this buffer's current position is
+ * not smaller than its limit.
+ */
+ public abstract ByteBuffer putDouble(double value);
+
+ /**
+ * Absolute get method for reading a double value.
+ *
+ * @exception IndexOutOfBoundsException If index is negative or not smaller
+ * than the buffer's limit, minus seven.
+ */
+ public abstract double getDouble(int index);
+
+ /**
+ * Absolute put method for writing a double value.
+ *
+ * @exception IndexOutOfBoundsException If index is negative or not smaller
+ * than the buffer's limit, minus seven.
+ */
+ public abstract ByteBuffer putDouble(int index, double value);
+
+ /**
+ * Returns a string summarizing the state of this buffer.
+ */
+ public String toString ()
+ {
+ return getClass ().getName () +
+ "[pos=" + position () +
+ " lim=" + limit () +
+ " cap=" + capacity () + "]";
+ }
}
diff --git a/libjava/java/nio/CharBuffer.java b/libjava/java/nio/CharBuffer.java
index 2a21ef93ff5..9d61be90b04 100644
--- a/libjava/java/nio/CharBuffer.java
+++ b/libjava/java/nio/CharBuffer.java
@@ -37,144 +37,225 @@ exception statement from your version. */
package java.nio;
+import gnu.java.nio.CharBufferImpl;
+
+/**
+ * @since 1.4
+ */
public abstract class CharBuffer extends Buffer
+ implements Comparable, CharSequence
{
- private ByteOrder endian = ByteOrder.BIG_ENDIAN;
-
protected char [] backing_buffer;
+ /**
+ * Allocates a new <code>CharBuffer</code> object with a given capacity.
+ */
public static CharBuffer allocate (int capacity)
{
- return null;
+ return new CharBufferImpl (capacity, 0, capacity);
}
/**
+ * Wraps a character array into a <code>CharBuffer</code> object.
+ *
* @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;
+ return new CharBufferImpl (array, offset, offset + length);
}
+ /**
+ * Wraps a character sequence into a <code>CharBuffer</code> object.
+ */
final public static CharBuffer wrap (CharSequence a)
{
return wrap (a, 0, a.length ());
}
/**
+ * Wraps a character sequence into a <code>CharBuffer</code> object.
+ *
* @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];
+ if ((offset < 0)
+ || (offset > a.length ())
+ || (length < 0)
+ || (length > (a.length () - offset)))
+ throw new IndexOutOfBoundsException ();
+
+ char [] buffer = new char [a.length ()];
for (int i = offset; i < length; i++)
{
buffer [i] = a.charAt (i);
}
- return wrap (buffer, 0, length);
+ return wrap (buffer, offset, length);
}
+ /**
+ * Wraps a character array into a <code>CharBuffer</code> object.
+ */
final public static CharBuffer wrap (char[] array)
{
- return wrap (array, 0, array.length);
+ return wrap (array, 0, array.length);
+ }
+
+ CharBuffer (int cap, int lim, int pos, int mark)
+ {
+ super (cap, lim, pos, mark);
}
/**
- * @exception BufferUnderflowException FIXME
+ * Relative get method.
+ *
+ * @exception BufferUnderflowException If the buffer's current position is
+ * not smaller than its limit.
* @exception IndexOutOfBoundsException If the preconditions on the offset
* and length parameters do not hold
*/
- final public CharBuffer get (char[] dst, int offset, int length)
+ 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
+ * Relative get method.
+ *
+ * @exception BufferUnderflowException If there are fewer than length
+ * characters remaining in this buffer.
*/
- final public CharBuffer get (char[] dst)
+ public CharBuffer get (char[] dst)
{
return get (dst, 0, dst.length);
}
/**
- * @exception BufferOverflowException FIXME
- * @exception IllegalArgumentException FIXME
- * @exception ReadOnlyBufferException FIXME
+ * @exception BufferOverflowException If there are fewer than length of
+ * source buffer characters remaining in this buffer.
+ * @exception IllegalArgumentException If the source buffer is this buffer.
+ * @exception ReadOnlyBufferException If this buffer is read-only.
*/
- final public CharBuffer put (CharBuffer src)
+ public CharBuffer put (CharBuffer src)
{
- while (src.hasRemaining ())
- put (src.get ());
+ if (src == this)
+ throw new IllegalArgumentException ();
+
+ if (src.length () > 0)
+ {
+ char [] toPut = new char [src.length ()];
+ src.get (toPut);
+ src.put (toPut);
+ }
return this;
}
/**
- * @exception BufferOverflowException FIXME
+ * @exception BufferOverflowException If there are fewer then length
+ * characters remaining in this buffer.
* @exception IndexOutOfBoundsException If the preconditions on the offset
* and length parameters do not hold
- * @exception ReadOnlyBufferException FIXME
+ * @exception ReadOnlyBufferException If this buffer is read-only.
*/
- final public CharBuffer put (char[] src, int offset, int length)
+ public CharBuffer put (char[] src, int offset, int length)
{
+ if (offset < 0
+ || offset >= src.length
+ || length < 0
+ || length >= (src.length - offset))
+ throw new IndexOutOfBoundsException ();
+
+ // Put nothing into this buffer when not enough space left.
+ if (length > remaining ())
+ throw new BufferOverflowException ();
+
for (int i = offset; i < offset + length; i++)
- put (src [i]);
+ {
+ put (src [i]);
+ }
return this;
}
/**
- * @exception BufferOverflowException FIXME
- * @exception ReadOnlyBufferException FIXME
+ * Relative put method.
+ *
+ * @exception BufferOverflowException If there are fewer then length of the
+ * array characters remaining in this buffer.
+ * @exception ReadOnlyBufferException If this buffer is read-only.
*/
public final CharBuffer put (char[] src)
{
return put (src, 0, src.length);
}
+ /**
+ * Tells wether this is buffer is backed by an array or not.
+ */
public final boolean hasArray ()
{
return backing_buffer != null;
}
/**
- * @exception ReadOnlyBufferException FIXME
- * @exception UnsupportedOperationException FIXME
+ * Returns the array that backs this buffer.
+ *
+ * @exception ReadOnlyBufferException If this buffer is read-only.
+ * @exception UnsupportedOperationException If this buffer is not backed
+ * by an accessible array.
*/
public final char[] array ()
{
+ if (backing_buffer == null)
+ throw new UnsupportedOperationException ();
+
+ if (isReadOnly ())
+ throw new ReadOnlyBufferException ();
+
return backing_buffer;
}
/**
- * @exception ReadOnlyBufferException FIXME
- * @exception UnsupportedOperationException FIXME
+ * Returns the offset to the position of a character in this buffer.
+ *
+ * @exception ReadOnlyBufferException If this buffer is read-only.
+ * @exception UnsupportedOperationException If this buffer is not backed
+ * by an accessible array.
*/
public final int arrayOffset ()
{
+ if (backing_buffer == null)
+ throw new UnsupportedOperationException ();
+
+ if (isReadOnly ())
+ throw new ReadOnlyBufferException ();
+
return 0;
}
+ /**
+ * Calculates a hash code for this buffer-
+ */
public int hashCode ()
{
+ // FIXME: Check what SUN calculates here.
return super.hashCode ();
}
+ /**
+ * Checks if this buffer is equal to obj.
+ */
public boolean equals (Object obj)
{
if (obj instanceof CharBuffer)
@@ -184,7 +265,10 @@ public abstract class CharBuffer extends Buffer
}
/**
- * @exception ClassCastException FIXME
+ * Compares two character buffer objects.
+ *
+ * @exception ClassCastException If obj is not an object derived from
+ * <code>CharBuffer</code>.
*/
public int compareTo(Object obj)
{
@@ -197,8 +281,8 @@ public abstract class CharBuffer extends Buffer
return 1;
int r = remaining ();
- int i1 = pos;
- int i2 = a.pos;
+ int i1 = position ();
+ int i2 = a.position ();
for (int i = 0; i < r; i++)
{
@@ -207,85 +291,128 @@ public abstract class CharBuffer extends Buffer
if (t != 0)
return (int) t;
}
+
return 0;
}
/**
- * @exception BufferUnderflowException FIXME
+ * Relative get method.
+ *
+ * @exception BufferUnderflowException If there are no remaining characters
+ * in this buffer.
*/
public abstract char get ();
/**
- * @exception BufferOverflowException FIXME
- * @exception ReadOnlyBufferException FIXME
+ * Relative put method.
+ *
+ * @exception BufferOverflowException If there no remaining characters in
+ * this buffer.
+ * @exception ReadOnlyBufferException If this buffer is read-only.
*/
public abstract CharBuffer put (char b);
/**
- * @exception IndexOutOfBoundsException FIXME
+ * Absolute get method.
+ *
+ * @exception IndexOutOfBoundsException If index is negative or not smaller
+ * than the buffer's limit.
*/
public abstract char get (int index);
/**
- * @exception IndexOutOfBoundsException FIXME
- * @exception ReadOnlyBufferException FIXME
+ * Absolute put method.
+ *
+ * @exception IndexOutOfBoundsException If index is negative or not smaller
+ * than the buffer's limit.
+ * @exception ReadOnlyBufferException If this buffer is read-only.
*/
public abstract CharBuffer put (int index, char b);
/**
- * @exception ReadOnlyBufferException FIXME
+ * @exception ReadOnlyBufferException If this buffer is read-only.
*/
public abstract CharBuffer compact ();
+ /**
+ * Tells wether this buffer is direct or not.
+ */
public abstract boolean isDirect ();
public abstract CharBuffer slice ();
+ /**
+ * Duplicates this buffer.
+ */
public abstract CharBuffer duplicate ();
+ /**
+ * Returns this buffer made read-only.
+ */
public abstract CharBuffer asReadOnlyBuffer ();
+ /**
+ * Returns the remaining content of the buffer as a string.
+ */
public String toString ()
{
- return "";
+ return new String (array (), position (), length ());
}
public final int length ()
{
- return 0;
+ return remaining ();
}
+ /**
+ * Returns the byte order of this buffer.
+ */
public abstract ByteOrder order ();
/**
- * @exception IndexOutOfBoundsException FIXME
+ * @exception IndexOutOfBoundsException If the preconditions on start and
+ * end do not hold.
*/
public abstract CharSequence subSequence (int start, int length);
/**
- * @exception BufferOverflowException FIXME
- * @exception IndexOutOfBoundsException FIXME
- * @exception ReadOnlyBufferException FIXME
+ * Relative put method.
+ *
+ * @exception BufferOverflowException If there is insufficient space in this
+ * buffer.
+ * @exception IndexOutOfBoundsException If the preconditions on the start
+ * and end parameters do not hold.
+ * @exception ReadOnlyBufferException If this buffer is read-only.
*/
public CharBuffer put (String str, int start, int length)
{
- return null;
+ return put (str.toCharArray (), start, length);
}
/**
- * @exception BufferOverflowException FIXME
- * @exception ReadOnlyBufferException FIXME
+ * Relative put method.
+ *
+ * @exception BufferOverflowException If there is insufficient space in this
+ * buffer.
+ * @exception ReadOnlyBufferException If this buffer is read-only.
*/
public final CharBuffer put (String str)
{
- return null;
+ return put (str, 0, str.length ());
}
/**
- * @exception IndexOutOfBoundsException FIXME
+ * Returns the character at <code>position() + index</code>.
+ *
+ * @exception IndexOutOfBoundsException If index is negative not smaller than
+ * <code>remaining()</code>.
*/
public final char charAt (int index)
{
- return ' ';
+ if (index < 0
+ || index >= remaining ())
+ throw new IndexOutOfBoundsException ();
+
+ return get (position () + index);
}
}
diff --git a/libjava/java/nio/DoubleBuffer.java b/libjava/java/nio/DoubleBuffer.java
index 7059b6e2430..036579a802b 100644
--- a/libjava/java/nio/DoubleBuffer.java
+++ b/libjava/java/nio/DoubleBuffer.java
@@ -39,14 +39,14 @@ package java.nio;
import gnu.java.nio.DoubleBufferImpl;
-public abstract class DoubleBuffer extends Buffer
+public abstract class DoubleBuffer extends Buffer implements Comparable
{
- private ByteOrder endian = ByteOrder.BIG_ENDIAN;
protected double [] backing_buffer;
+ protected int array_offset;
public static DoubleBuffer allocateDirect(int capacity)
{
- return new DoubleBufferImpl(capacity, 0, capacity);
+ throw new Error ("direct buffers are not implemented");
}
public static DoubleBuffer allocate(int capacity)
@@ -77,7 +77,12 @@ public abstract class DoubleBuffer extends Buffer
return wrap(array, 0, array.length);
}
- final public DoubleBuffer get (double[] dst, int offset, int length)
+ DoubleBuffer (int capacity, int limit, int position, int mark)
+ {
+ super (capacity, limit, position, mark);
+ }
+
+ public DoubleBuffer get (double[] dst, int offset, int length)
{
for (int i = offset; i < offset + length; i++)
{
@@ -87,12 +92,12 @@ public abstract class DoubleBuffer extends Buffer
return this;
}
- final public DoubleBuffer get(double[] dst)
+ public DoubleBuffer get (double[] dst)
{
return get(dst, 0, dst.length);
}
- final public DoubleBuffer put(DoubleBuffer src)
+ public DoubleBuffer put (DoubleBuffer src)
{
while (src.hasRemaining())
put(src.get());
@@ -100,7 +105,7 @@ public abstract class DoubleBuffer extends Buffer
return this;
}
- final public DoubleBuffer put (double[] src, int offset, int length)
+ public DoubleBuffer put (double[] src, int offset, int length)
{
for (int i = offset; i < offset + length; i++)
put(src[i]);
@@ -120,12 +125,24 @@ public abstract class DoubleBuffer extends Buffer
public final double[] array()
{
+ if (backing_buffer == null)
+ throw new UnsupportedOperationException ();
+
+ if (isReadOnly ())
+ throw new ReadOnlyBufferException ();
+
return backing_buffer;
}
public final int arrayOffset()
{
- return 0;
+ if (backing_buffer == null)
+ throw new UnsupportedOperationException ();
+
+ if (isReadOnly ())
+ throw new ReadOnlyBufferException ();
+
+ return array_offset;
}
public int hashCode()
@@ -172,17 +189,7 @@ public abstract class DoubleBuffer extends Buffer
return 0;
}
- public final ByteOrder order()
- {
- return endian;
- }
-
- public final DoubleBuffer order(ByteOrder bo)
- {
- endian = bo;
- return this;
- }
-
+ public abstract ByteOrder order ();
public abstract double get();
public abstract DoubleBuffer put (double b);
public abstract double get(int index);
@@ -192,34 +199,4 @@ public abstract class DoubleBuffer extends Buffer
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
index f06ef187791..8531cb99f9d 100644
--- a/libjava/java/nio/FloatBuffer.java
+++ b/libjava/java/nio/FloatBuffer.java
@@ -39,14 +39,14 @@ package java.nio;
import gnu.java.nio.FloatBufferImpl;
-public abstract class FloatBuffer extends Buffer
+public abstract class FloatBuffer extends Buffer implements Comparable
{
- private ByteOrder endian = ByteOrder.BIG_ENDIAN;
protected float [] backing_buffer;
+ protected int array_offset;
public static FloatBuffer allocateDirect(int capacity)
{
- return new FloatBufferImpl (capacity, 0, capacity);
+ throw new Error ("direct buffers not implemented");
}
public static FloatBuffer allocate(int capacity)
@@ -77,7 +77,13 @@ public abstract class FloatBuffer extends Buffer
return wrap(array, 0, array.length);
}
- final public FloatBuffer get(float[] dst, int offset, int length)
+ FloatBuffer (int capacity, int limit, int position, int mark)
+ {
+ super (capacity, limit, position, mark);
+ array_offset = 0;
+ }
+
+ public FloatBuffer get (float[] dst, int offset, int length)
{
for (int i = offset; i < offset + length; i++)
{
@@ -87,12 +93,12 @@ public abstract class FloatBuffer extends Buffer
return this;
}
- final public FloatBuffer get(float[] dst)
+ public FloatBuffer get (float[] dst)
{
return get(dst, 0, dst.length);
}
- final public FloatBuffer put(FloatBuffer src)
+ public FloatBuffer put (FloatBuffer src)
{
while (src.hasRemaining())
put(src.get());
@@ -100,7 +106,7 @@ public abstract class FloatBuffer extends Buffer
return this;
}
- final public FloatBuffer put(float[] src, int offset, int length)
+ public FloatBuffer put (float[] src, int offset, int length)
{
for (int i = offset; i < offset + length; i++)
put(src[i]);
@@ -120,12 +126,24 @@ public abstract class FloatBuffer extends Buffer
public final float[] array()
{
+ if (backing_buffer == null)
+ throw new UnsupportedOperationException ();
+
+ if (isReadOnly ())
+ throw new ReadOnlyBufferException ();
+
return backing_buffer;
}
public final int arrayOffset()
{
- return 0;
+ if (backing_buffer == null)
+ throw new UnsupportedOperationException ();
+
+ if (isReadOnly ())
+ throw new ReadOnlyBufferException ();
+
+ return array_offset;
}
public int hashCode()
@@ -139,6 +157,7 @@ public abstract class FloatBuffer extends Buffer
{
return compareTo(obj) == 0;
}
+
return false;
}
@@ -171,17 +190,7 @@ public abstract class FloatBuffer extends Buffer
return 0;
}
- public final ByteOrder order()
- {
- return endian;
- }
-
- public final FloatBuffer order(ByteOrder bo)
- {
- endian = bo;
- return this;
- }
-
+ public abstract ByteOrder order ();
public abstract float get();
public abstract java.nio. FloatBuffer put(float b);
public abstract float get(int index);
@@ -191,34 +200,4 @@ public abstract class FloatBuffer extends Buffer
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
index d2d28d36b10..ddf03d8364d 100644
--- a/libjava/java/nio/IntBuffer.java
+++ b/libjava/java/nio/IntBuffer.java
@@ -39,14 +39,14 @@ package java.nio;
import gnu.java.nio.IntBufferImpl;
-public abstract class IntBuffer extends Buffer
+public abstract class IntBuffer extends Buffer implements Comparable
{
- private ByteOrder endian = ByteOrder.BIG_ENDIAN;
protected int [] backing_buffer;
+ protected int array_offset;
public static IntBuffer allocateDirect(int capacity)
{
- return new IntBufferImpl (capacity, 0, capacity);
+ throw new Error ("direct buffers not implemented");
}
public static IntBuffer allocate(int capacity)
@@ -77,7 +77,13 @@ public abstract class IntBuffer extends Buffer
return wrap(array, 0, array.length);
}
- final public IntBuffer get(int[] dst, int offset, int length)
+ IntBuffer (int capacity, int limit, int position, int mark)
+ {
+ super (capacity, limit, position, mark);
+ array_offset = 0;
+ }
+
+ public IntBuffer get(int[] dst, int offset, int length)
{
for (int i = offset; i < offset + length; i++)
{
@@ -87,12 +93,12 @@ public abstract class IntBuffer extends Buffer
return this;
}
- final public IntBuffer get(int[] dst)
+ public IntBuffer get (int[] dst)
{
return get(dst, 0, dst.length);
}
- final public IntBuffer put(IntBuffer src)
+ public IntBuffer put (IntBuffer src)
{
while (src.hasRemaining())
put(src.get());
@@ -100,7 +106,7 @@ public abstract class IntBuffer extends Buffer
return this;
}
- final public IntBuffer put(int[] src, int offset, int length)
+ public IntBuffer put (int[] src, int offset, int length)
{
for (int i = offset; i < offset + length; i++)
put(src[i]);
@@ -120,12 +126,24 @@ public abstract class IntBuffer extends Buffer
public final int[] array()
{
+ if (backing_buffer == null)
+ throw new UnsupportedOperationException ();
+
+ if (isReadOnly ())
+ throw new ReadOnlyBufferException ();
+
return backing_buffer;
}
public final int arrayOffset()
{
- return 0;
+ if (backing_buffer == null)
+ throw new UnsupportedOperationException ();
+
+ if (isReadOnly ())
+ throw new ReadOnlyBufferException ();
+
+ return array_offset;
}
public int hashCode()
@@ -172,17 +190,7 @@ public abstract class IntBuffer extends Buffer
return 0;
}
- public final ByteOrder order()
- {
- return endian;
- }
-
- public final IntBuffer order(ByteOrder bo)
- {
- endian = bo;
- return this;
- }
-
+ public abstract ByteOrder order();
public abstract int get();
public abstract IntBuffer put(int b);
public abstract int get(int index);
@@ -192,34 +200,4 @@ public abstract class IntBuffer extends Buffer
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/LongBuffer.java b/libjava/java/nio/LongBuffer.java
index 5bca6d53b70..63eb5af1a11 100644
--- a/libjava/java/nio/LongBuffer.java
+++ b/libjava/java/nio/LongBuffer.java
@@ -39,14 +39,14 @@ package java.nio;
import gnu.java.nio.LongBufferImpl;
-public abstract class LongBuffer extends Buffer
+public abstract class LongBuffer extends Buffer implements Comparable
{
- private ByteOrder endian = ByteOrder.BIG_ENDIAN;
protected long [] backing_buffer;
+ protected int array_offset;
public static LongBuffer allocateDirect(int capacity)
{
- return new LongBufferImpl(capacity, 0, capacity);
+ throw new Error ("direct buffers not implemented");
}
public static LongBuffer allocate(int capacity)
@@ -77,7 +77,13 @@ public abstract class LongBuffer extends Buffer
return wrap(array, 0, array.length);
}
- final public LongBuffer get(long[] dst, int offset, int length)
+ LongBuffer (int capacity, int limit, int position, int mark)
+ {
+ super (capacity, limit, position, mark);
+ array_offset = 0;
+ }
+
+ public LongBuffer get (long[] dst, int offset, int length)
{
for (int i = offset; i < offset + length; i++)
{
@@ -87,12 +93,12 @@ public abstract class LongBuffer extends Buffer
return this;
}
- final public LongBuffer get(long[] dst)
+ public LongBuffer get (long[] dst)
{
return get(dst, 0, dst.length);
}
- final public LongBuffer put(LongBuffer src)
+ public LongBuffer put (LongBuffer src)
{
while (src.hasRemaining())
put(src.get());
@@ -100,7 +106,7 @@ public abstract class LongBuffer extends Buffer
return this;
}
- final public LongBuffer put(long[] src, int offset, int length)
+ public LongBuffer put (long[] src, int offset, int length)
{
for (int i = offset; i < offset + length; i++)
put(src[i]);
@@ -120,12 +126,24 @@ public abstract class LongBuffer extends Buffer
public final long[] array()
{
+ if (backing_buffer == null)
+ throw new UnsupportedOperationException ();
+
+ if (isReadOnly ())
+ throw new ReadOnlyBufferException ();
+
return backing_buffer;
}
public final int arrayOffset()
{
- return 0;
+ if (backing_buffer == null)
+ throw new UnsupportedOperationException ();
+
+ if (isReadOnly ())
+ throw new ReadOnlyBufferException ();
+
+ return array_offset;
}
public int hashCode()
@@ -173,17 +191,7 @@ public abstract class LongBuffer extends Buffer
return 0;
}
- public final ByteOrder order()
- {
- return endian;
- }
-
- public final LongBuffer order(ByteOrder bo)
- {
- endian = bo;
- return this;
- }
-
+ public abstract ByteOrder order();
public abstract long get();
public abstract java.nio. LongBuffer put(long b);
public abstract long get(int index);
@@ -193,34 +201,4 @@ public abstract class LongBuffer extends Buffer
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
index dc1b20d892c..305327b74c5 100644
--- a/libjava/java/nio/MappedByteBuffer.java
+++ b/libjava/java/nio/MappedByteBuffer.java
@@ -37,6 +37,29 @@ exception statement from your version. */
package java.nio;
+/**
+ * @author Michael Koch
+ * @since 1.4
+ */
public abstract class MappedByteBuffer extends ByteBuffer
{
+ MappedByteBuffer (int capacity, int limit, int position, int mark)
+ {
+ super (capacity, limit, position, mark);
+ }
+
+ public final MappedByteBuffer force ()
+ {
+ return this;
+ }
+
+ public final boolean isLoaded ()
+ {
+ return true;
+ }
+
+ public final MappedByteBuffer load ()
+ {
+ return this;
+ }
}
diff --git a/libjava/java/nio/ShortBuffer.java b/libjava/java/nio/ShortBuffer.java
index 5301366ceee..7a71cad6d85 100644
--- a/libjava/java/nio/ShortBuffer.java
+++ b/libjava/java/nio/ShortBuffer.java
@@ -39,14 +39,14 @@ package java.nio;
import gnu.java.nio.ShortBufferImpl;
-public abstract class ShortBuffer extends Buffer
+public abstract class ShortBuffer extends Buffer implements Comparable
{
- private ByteOrder endian = ByteOrder.BIG_ENDIAN;
protected short [] backing_buffer;
+ protected int array_offset;
public static ShortBuffer allocateDirect(int capacity)
{
- return new ShortBufferImpl(capacity, 0, capacity);
+ throw new Error ("direct buffers not implemented");
}
public static ShortBuffer allocate(int capacity)
@@ -77,7 +77,13 @@ public abstract class ShortBuffer extends Buffer
return wrap(array, 0, array.length);
}
- final public ShortBuffer get(short[] dst, int offset, int length)
+ ShortBuffer (int capacity, int limit, int position, int mark)
+ {
+ super (capacity, limit, position, mark);
+ array_offset = 0;
+ }
+
+ public ShortBuffer get (short[] dst, int offset, int length)
{
for (int i = offset; i < offset + length; i++)
{
@@ -87,12 +93,12 @@ public abstract class ShortBuffer extends Buffer
return this;
}
- final public ShortBuffer get(short[] dst)
+ public ShortBuffer get (short[] dst)
{
return get(dst, 0, dst.length);
}
- final public ShortBuffer put(ShortBuffer src)
+ public ShortBuffer put (ShortBuffer src)
{
while (src.hasRemaining())
put(src.get());
@@ -100,7 +106,7 @@ public abstract class ShortBuffer extends Buffer
return this;
}
- final public ShortBuffer put(short[] src, int offset, int length)
+ public ShortBuffer put (short[] src, int offset, int length)
{
for (int i = offset; i < offset + length; i++)
put(src[i]);
@@ -120,12 +126,24 @@ public abstract class ShortBuffer extends Buffer
public final short[] array()
{
+ if (backing_buffer == null)
+ throw new UnsupportedOperationException ();
+
+ if (isReadOnly ())
+ throw new ReadOnlyBufferException ();
+
return backing_buffer;
}
public final int arrayOffset()
{
- return 0;
+ if (backing_buffer == null)
+ throw new UnsupportedOperationException ();
+
+ if (isReadOnly ())
+ throw new ReadOnlyBufferException ();
+
+ return array_offset;
}
public int hashCode()
@@ -173,17 +191,7 @@ public abstract class ShortBuffer extends Buffer
return 0;
}
- public final ByteOrder order()
- {
- return endian;
- }
-
- public final ShortBuffer order(ByteOrder bo)
- {
- endian = bo;
- return this;
- }
-
+ public abstract ByteOrder order ();
public abstract short get();
public abstract java.nio. ShortBuffer put(short b);
public abstract short get(int index);
@@ -193,34 +201,4 @@ public abstract class ShortBuffer extends Buffer
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/Channels.java b/libjava/java/nio/channels/Channels.java
new file mode 100644
index 00000000000..d911b41d00b
--- /dev/null
+++ b/libjava/java/nio/channels/Channels.java
@@ -0,0 +1,130 @@
+/* Channels.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.InputStream;
+import java.io.OutputStream;
+import java.io.Reader;
+import java.io.Writer;
+import java.nio.channels.WritableByteChannel;
+import java.nio.charset.Charset;
+import java.nio.charset.CharsetDecoder;
+import java.nio.charset.CharsetEncoder;
+
+/**
+ * @since 1.4
+ */
+public final class Channels
+{
+ /**
+ * Constructs a stream that reads bytes from the given channel.
+ */
+ public static InputStream newInputStream (ReadableByteChannel ch)
+ {
+ throw new Error ("not implemented");
+ }
+
+ /**
+ * Constructs a stream that writes bytes to the given channel.
+ */
+ public static OutputStream newOutputStream (WritableByteChannel ch)
+ {
+ throw new Error ("not implemented");
+ }
+
+ /**
+ * Constructs a channel that reads bytes from the given stream.
+ */
+ public static ReadableByteChannel newChannel (InputStream in)
+ {
+ throw new Error ("not implemented");
+ }
+
+ /**
+ * Constructs a channel that writes bytes to the given stream.
+ */
+ public static WritableByteChannel newChannel (OutputStream out)
+ {
+ throw new Error ("not implemented");
+ }
+
+ /**
+ * Constructs a reader that decodes bytes from the given channel using the
+ * given decoder.
+ */
+ public static Reader newReader (ReadableByteChannel ch, CharsetDecoder dec,
+ int minBufferCap)
+ {
+ throw new Error ("not implemented");
+ }
+
+ /**
+ * Constructs a reader that decodes bytes from the given channel according to
+ * the named charset.
+ *
+ * @exception UnsupportedCharsetException If no support for the named charset
+ * is available in this instance of the Java virtual machine.
+ */
+ public static Reader newReader (ReadableByteChannel ch, String csName)
+ {
+ return newReader (ch, Charset.forName (csName).newDecoder (), -1);
+ }
+
+ /**
+ * Constructs a writer that encodes characters using the given encoder and
+ * writes the resulting bytes to the given channel.
+ */
+ public static Writer newWriter (WritableByteChannel ch, CharsetEncoder enc,
+ int minBufferCap)
+ {
+ throw new Error ("not implemented");
+ }
+
+ /**
+ * Constructs a writer that encodes characters according to the named charset
+ * and writes the resulting bytes to the given channel.
+ *
+ * @exception UnsupportedCharsetException If no support for the named charset
+ * is available in this instance of the Java virtual machine.
+ */
+ public static Writer newWriter (WritableByteChannel ch,
+ String csName)
+ {
+ return newWriter (ch, Charset.forName (csName).newEncoder (), -1);
+ }
+}
diff --git a/libjava/java/nio/channels/DatagramChannel.java b/libjava/java/nio/channels/DatagramChannel.java
index 6c457557b95..4a7ac9825f7 100644
--- a/libjava/java/nio/channels/DatagramChannel.java
+++ b/libjava/java/nio/channels/DatagramChannel.java
@@ -88,7 +88,7 @@ public abstract class DatagramChannel
* @exception IOException If an error occurs
* @exception NotYetConnectedException The channel's socket is not connected.
*/
- public final long write (ByteBuffer[] srcs)
+ public final long write (ByteBuffer[] srcs) throws IOException
{
long b = 0;
@@ -111,14 +111,15 @@ public abstract class DatagramChannel
* @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);
+ public abstract DatagramChannel connect (SocketAddress remote)
+ throws IOException;
/**
* Disonnects this channel's socket.
*
* @exception IOException If an error occurs
*/
- public abstract DatagramChannel disconnect ();
+ public abstract DatagramChannel disconnect () throws IOException;
/**
* Tells whether or not this channel's socket is connected.
@@ -131,7 +132,7 @@ public abstract class DatagramChannel
/**
* Reads data from this channel.
*/
- public abstract int read (ByteBuffer dst);
+ public abstract int read (ByteBuffer dst) throws IOException;
/**
* Reads data from this channel.
@@ -139,7 +140,8 @@ public abstract class DatagramChannel
* @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);
+ public abstract long read (ByteBuffer[] dsts, int offset, int length)
+ throws IOException;
/**
* Receives a datagram via this channel.
@@ -154,7 +156,7 @@ public abstract class DatagramChannel
* @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);
+ public abstract SocketAddress receive (ByteBuffer dst) throws IOException;
/**
* Sends a datagram via this channel.
@@ -169,7 +171,8 @@ public abstract class DatagramChannel
* @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);
+ public abstract int send (ByteBuffer src, SocketAddress target)
+ throws IOException;
/**
* Retrieves the channel's socket.
@@ -182,7 +185,7 @@ public abstract class DatagramChannel
* @exception IOException If an error occurs.
* @exception NotYetConnectedException The channel's socket is not connected.
*/
- public abstract int write (ByteBuffer src);
+ public abstract int write (ByteBuffer src) throws IOException;
/**
* Writes data to this channel.
@@ -190,7 +193,8 @@ public abstract class DatagramChannel
* @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);
+ public abstract long write (ByteBuffer[] srcs, int offset, int length)
+ throws IOException;
/**
* Retrieves the valid operations for this channel.
diff --git a/libjava/java/nio/channels/FileLock.java b/libjava/java/nio/channels/FileLock.java
new file mode 100644
index 00000000000..1b4595e5c43
--- /dev/null
+++ b/libjava/java/nio/channels/FileLock.java
@@ -0,0 +1,137 @@
+/* FileLock.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;
+
+/**
+ * @since 1.4
+ */
+public abstract class FileLock
+{
+ FileChannel channel;
+ long position;
+ long size;
+ boolean shared;
+
+ /**
+ * Initializes the file lock.
+ *
+ * @exception IllegalArgumentException If the preconditions on the parameters do not hold
+ */
+ protected FileLock (FileChannel channel, long position, long size,
+ boolean shared)
+ {
+ if (position < 0 ||
+ size < 0)
+ throw new IllegalArgumentException ();
+
+ this.channel = channel;
+ this.position = position;
+ this.size = size;
+ this.shared = shared;
+ }
+
+ /**
+ * Tells whether or not this lock is valid.
+ */
+ public abstract boolean isValid();
+
+ /**
+ * Releases this lock.
+ *
+ * @exception IOException If an error occurs
+ * @exception ClosedChannelException If the locked channel is no longer open.
+ */
+ public abstract void release () throws IOException;
+
+ /**
+ * Returns the file channel upon whose file this lock is held.
+ */
+ public final FileChannel channel ()
+ {
+ return channel;
+ }
+
+ /**
+ * Tells whether this lock is shared.
+ */
+ public final boolean isShared ()
+ {
+ return shared;
+ }
+
+ /**
+ * Tells whether or not this lock overlaps the given lock range.
+ */
+ public final boolean overlaps (long position, long size)
+ {
+ if (position > this.position +this.size)
+ return false;
+
+ if (position + size < this.position)
+ return false;
+
+ return true;
+ }
+
+ /**
+ * Returns the position within the file of the first byte of the
+ * locked region.
+ */
+ public final long position ()
+ {
+ return position;
+ }
+
+ /**
+ * Returns the size of the locked region in bytes.
+ */
+ public final long size ()
+ {
+ return size;
+ }
+
+ /**
+ * Returns a string describing the range, type, and validity of this lock.
+ */
+ public final String toString ()
+ {
+ return "file-lock:pos=" + position + "size=" + size;
+ }
+}
diff --git a/libjava/java/nio/channels/Pipe.java b/libjava/java/nio/channels/Pipe.java
index 22f3d156f68..939d7b52ad2 100644
--- a/libjava/java/nio/channels/Pipe.java
+++ b/libjava/java/nio/channels/Pipe.java
@@ -37,6 +37,7 @@ exception statement from your version. */
package java.nio.channels;
+import java.io.IOException;
import java.nio.channels.spi.AbstractSelectableChannel;
import java.nio.channels.spi.SelectorProvider;
@@ -104,7 +105,7 @@ public abstract class Pipe
*
* @exception IOException If an error occurs
*/
- public static Pipe open()
+ public static Pipe open() throws IOException
{
return SelectorProvider.provider ().openPipe();
}
diff --git a/libjava/java/nio/channels/SelectableChannel.java b/libjava/java/nio/channels/SelectableChannel.java
index 2bc5cc47e35..72abac89654 100644
--- a/libjava/java/nio/channels/SelectableChannel.java
+++ b/libjava/java/nio/channels/SelectableChannel.java
@@ -37,6 +37,7 @@ exception statement from your version. */
package java.nio.channels;
+import java.io.IOException;
import java.nio.channels.spi.AbstractInterruptibleChannel;
import java.nio.channels.spi.SelectorProvider;
@@ -67,7 +68,8 @@ public abstract class SelectableChannel
* is registered with one or more selectors.
* @exception IOException If an error occurs.
*/
- public abstract SelectableChannel configureBlocking (boolean block);
+ public abstract SelectableChannel configureBlocking (boolean block)
+ throws IOException;
/**
* Tells whether this channel is blocking or not.
diff --git a/libjava/java/nio/channels/SelectionKey.java b/libjava/java/nio/channels/SelectionKey.java
index 8d06a301143..39b66f1902a 100644
--- a/libjava/java/nio/channels/SelectionKey.java
+++ b/libjava/java/nio/channels/SelectionKey.java
@@ -43,10 +43,10 @@ package java.nio.channels;
*/
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;
+ public static final int OP_ACCEPT = 16;
+ public static final int OP_CONNECT = 8;
+ public static final int OP_READ = 1;
+ public static final int OP_WRITE = 4;
Object attached;
diff --git a/libjava/java/nio/channels/ServerSocketChannel.java b/libjava/java/nio/channels/ServerSocketChannel.java
index 16a3a82df5b..e41af212623 100644
--- a/libjava/java/nio/channels/ServerSocketChannel.java
+++ b/libjava/java/nio/channels/ServerSocketChannel.java
@@ -73,7 +73,7 @@ public abstract class ServerSocketChannel
* @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 ();
+ public abstract SocketChannel accept () throws IOException;
/**
* Retrieves the channels socket.
diff --git a/libjava/java/nio/channels/SocketChannel.java b/libjava/java/nio/channels/SocketChannel.java
index 368a8ee468c..c22eb1d1945 100644
--- a/libjava/java/nio/channels/SocketChannel.java
+++ b/libjava/java/nio/channels/SocketChannel.java
@@ -49,6 +49,7 @@ import java.net.SocketAddress;
* @since 1.4
*/
abstract public class SocketChannel extends AbstractSelectableChannel
+ implements ByteChannel, ScatteringByteChannel, GatheringByteChannel
{
/**
* Initializes this socket.
@@ -100,7 +101,7 @@ abstract public class SocketChannel extends AbstractSelectableChannel
* @exception IOException If an error occurs
* @exception NotYetConnectedException If this channel is not yet connected.
*/
- public final long read (ByteBuffer[] dsts)
+ public final long read (ByteBuffer[] dsts) throws IOException
{
long b = 0;
@@ -118,7 +119,7 @@ abstract public class SocketChannel extends AbstractSelectableChannel
* @exception IOException If an error occurs
* @exception NotYetConnectedException If this channel is not yet connected.
*/
- public final long write (ByteBuffer[] dsts)
+ public final long write (ByteBuffer[] dsts) throws IOException
{
long b = 0;
@@ -144,7 +145,7 @@ abstract public class SocketChannel extends AbstractSelectableChannel
* @exception IOException If an error occurs
* @exception NotYetConnectedException If this channel is not yet connected.
*/
- public abstract int read (ByteBuffer dst);
+ public abstract int read (ByteBuffer dst) throws IOException;
/**
* Connects the channel's socket to the remote address.
@@ -179,7 +180,7 @@ abstract public class SocketChannel extends AbstractSelectableChannel
* @exception NoConnectionPendingException If this channel is not connected
* and a connection operation has not been initiated.
*/
- public abstract boolean finishConnect ();
+ public abstract boolean finishConnect () throws IOException;
/**
* Tells whether or not the channel's socket is connected.
@@ -197,7 +198,8 @@ abstract public class SocketChannel extends AbstractSelectableChannel
* @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);
+ public abstract long read (ByteBuffer[] dsts, int offset, int length)
+ throws IOException;
/**
* Retrieves the channel's socket.
@@ -210,7 +212,7 @@ abstract public class SocketChannel extends AbstractSelectableChannel
* @exception IOException If an error occurs
* @exception NotYetConnectedException If this channel is not yet connected.
*/
- public abstract int write (ByteBuffer src);
+ public abstract int write (ByteBuffer src) throws IOException;
/**
* Writes data to the channel.
@@ -218,5 +220,6 @@ abstract public class SocketChannel extends AbstractSelectableChannel
* @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);
+ public abstract long write (ByteBuffer[] srcs, int offset, int length)
+ throws IOException;
}
diff --git a/libjava/java/nio/channels/spi/AbstractInterruptibleChannel.java b/libjava/java/nio/channels/spi/AbstractInterruptibleChannel.java
index 855087b5f07..dd4177a8a01 100644
--- a/libjava/java/nio/channels/spi/AbstractInterruptibleChannel.java
+++ b/libjava/java/nio/channels/spi/AbstractInterruptibleChannel.java
@@ -38,6 +38,7 @@ exception statement from your version. */
package java.nio.channels.spi;
import java.io.IOException;
+import java.nio.channels.AsynchronousCloseException;
import java.nio.channels.Channel;
import java.nio.channels.InterruptibleChannel;
@@ -84,6 +85,7 @@ public abstract class AbstractInterruptibleChannel
* I/O operation was interrupted.
*/
protected final void end (boolean completed)
+ throws AsynchronousCloseException
{
}
diff --git a/libjava/java/nio/channels/spi/AbstractSelectableChannel.java b/libjava/java/nio/channels/spi/AbstractSelectableChannel.java
index da03693d2cc..b13bb4af24f 100644
--- a/libjava/java/nio/channels/spi/AbstractSelectableChannel.java
+++ b/libjava/java/nio/channels/spi/AbstractSelectableChannel.java
@@ -75,6 +75,7 @@ public abstract class AbstractSelectableChannel extends SelectableChannel
* Adjusts this channel's blocking mode.
*/
public final SelectableChannel configureBlocking (boolean block)
+ throws IOException
{
synchronized (LOCK)
{
@@ -90,7 +91,7 @@ public abstract class AbstractSelectableChannel extends SelectableChannel
*
* @exception IOException If an error occurs
*/
- protected final void implCloseChannel ()
+ protected final void implCloseChannel () throws IOException
{
implCloseSelectableChannel ();
}
@@ -98,12 +99,13 @@ public abstract class AbstractSelectableChannel extends SelectableChannel
/**
* Closes this selectable channel.
*/
- protected abstract void implCloseSelectableChannel ();
+ protected abstract void implCloseSelectableChannel () throws IOException;
/**
* Adjusts this channel's blocking mode.
*/
- protected abstract void implConfigureBlocking (boolean block);
+ protected abstract void implConfigureBlocking (boolean block)
+ throws IOException;
/**
* Tells whether or not every I/O operation on this channel will block
diff --git a/libjava/java/nio/channels/spi/SelectorProvider.java b/libjava/java/nio/channels/spi/SelectorProvider.java
index 06017f76edb..157a3419467 100644
--- a/libjava/java/nio/channels/spi/SelectorProvider.java
+++ b/libjava/java/nio/channels/spi/SelectorProvider.java
@@ -38,6 +38,7 @@ exception statement from your version. */
package java.nio.channels.spi;
/* import gnu.java.nio.channels.SelectorProviderImpl; */
+import java.io.IOException;
import java.nio.channels.DatagramChannel;
import java.nio.channels.Pipe;
import java.nio.channels.ServerSocketChannel;
@@ -67,27 +68,28 @@ public abstract class SelectorProvider
/**
* Opens a datagram channel.
*/
- public abstract DatagramChannel openDatagramChannel ();
+ public abstract DatagramChannel openDatagramChannel () throws IOException;
/**
* Opens a pipe.
*/
- public abstract Pipe openPipe ();
+ public abstract Pipe openPipe () throws IOException;
/**
* Opens a selector.
*/
- public abstract AbstractSelector openSelector ();
+ public abstract AbstractSelector openSelector () throws IOException;
/**
* Opens a server socket channel.
*/
- public abstract ServerSocketChannel openServerSocketChannel ();
+ public abstract ServerSocketChannel openServerSocketChannel ()
+ throws IOException;
/**
* Opens a socket channel.
*/
- public abstract SocketChannel openSocketChannel ();
+ public abstract SocketChannel openSocketChannel () throws IOException;
/**
* Returns the system-wide default selector provider for this invocation
diff --git a/libjava/java/nio/charset/Charset.java b/libjava/java/nio/charset/Charset.java
index cc60c99b9b6..889267f302f 100644
--- a/libjava/java/nio/charset/Charset.java
+++ b/libjava/java/nio/charset/Charset.java
@@ -187,9 +187,10 @@ public abstract class Charset implements Comparable
return canonicalName;
}
- public final boolean isRegistered (String name)
+ public final boolean isRegistered ()
{
- return !name.startsWith ("x-") && !name.startsWith ("X-");
+ return (!canonicalName.startsWith ("x-")
+ && !canonicalName.startsWith ("X-"));
}
public abstract boolean contains (Charset cs);
diff --git a/libjava/java/nio/charset/CharsetEncoder.java b/libjava/java/nio/charset/CharsetEncoder.java
index dd434a79752..dc1fa99cd93 100644
--- a/libjava/java/nio/charset/CharsetEncoder.java
+++ b/libjava/java/nio/charset/CharsetEncoder.java
@@ -319,6 +319,11 @@ public abstract class CharsetEncoder
return this;
}
+ public CodingErrorAction unmappableCharacterAction ()
+ {
+ return unmappableCharacterAction;
+ }
+
public final CharsetEncoder onUnmappableCharacter
(CodingErrorAction newAction)
{
diff --git a/libjava/java/nio/charset/IllegalCharsetNameException.java b/libjava/java/nio/charset/IllegalCharsetNameException.java
index 762eb687fbf..f46e63aa14f 100644
--- a/libjava/java/nio/charset/IllegalCharsetNameException.java
+++ b/libjava/java/nio/charset/IllegalCharsetNameException.java
@@ -38,16 +38,25 @@ exception statement from your version. */
package java.nio.charset;
/**
+ * @author Michael Koch
* @since 1.4
*/
public class IllegalCharsetNameException extends IllegalArgumentException
{
/**
+ * Compatible with JDK 1.4+
+ */
+ private static final long serialVersionUID = 1457525358470002989L;
+
+ String charsetName;
+
+ /**
* Creates the exception
*/
public IllegalCharsetNameException (String charsetName)
{
- super (charsetName);
+ super ();
+ this.charsetName = charsetName;
}
/**
@@ -55,6 +64,6 @@ public class IllegalCharsetNameException extends IllegalArgumentException
*/
public String getCharsetName ()
{
- return getMessage ();
+ return charsetName;
}
}
diff --git a/libjava/java/nio/charset/UnsupportedCharsetException.java b/libjava/java/nio/charset/UnsupportedCharsetException.java
index 13aaa520524..beb0be96df3 100644
--- a/libjava/java/nio/charset/UnsupportedCharsetException.java
+++ b/libjava/java/nio/charset/UnsupportedCharsetException.java
@@ -38,16 +38,25 @@ exception statement from your version. */
package java.nio.charset;
/**
+ * @author Michael Koch
* @since 1.4
*/
public class UnsupportedCharsetException extends IllegalArgumentException
{
/**
+ * Compatible with JDK 1.4+
+ */
+ private static final long serialVersionUID = 1490765524727386367L;
+
+ String charsetName;
+
+ /**
* Creates the exception
*/
public UnsupportedCharsetException (String charsetName)
{
- super (charsetName);
+ super ();
+ this.charsetName = charsetName;
}
/**
@@ -55,6 +64,6 @@ public class UnsupportedCharsetException extends IllegalArgumentException
*/
public String getCharsetName ()
{
- return getMessage ();
+ return charsetName;
}
}
diff --git a/libjava/java/rmi/server/RMIClassLoader.java b/libjava/java/rmi/server/RMIClassLoader.java
index 1b00970e441..057ca0fd402 100644
--- a/libjava/java/rmi/server/RMIClassLoader.java
+++ b/libjava/java/rmi/server/RMIClassLoader.java
@@ -172,7 +172,7 @@ public class RMIClassLoader
}
}
- return loader != null ? loader.loadClass(name) : Class.forName(name);
+ return loader.loadClass(name);
}
public static String getClassAnnotation(Class cl)
diff --git a/libjava/java/rmi/server/RMIClassLoaderSpi.java b/libjava/java/rmi/server/RMIClassLoaderSpi.java
new file mode 100644
index 00000000000..2dbb3849c27
--- /dev/null
+++ b/libjava/java/rmi/server/RMIClassLoaderSpi.java
@@ -0,0 +1,64 @@
+/* RMIClassLoaderSpi.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.rmi.server;
+
+import java.net.MalformedURLException;
+
+/**
+ * @author Michael Koch
+ * @since 1.4
+ */
+public abstract class RMIClassLoaderSpi
+{
+ public RMIClassLoaderSpi()
+ {
+ }
+
+ public abstract Class loadClass (String codeBase, String name,
+ ClassLoader defaultLoader)
+ throws MalformedURLException, ClassNotFoundException;
+
+ public abstract Class loadProxyClass (String codeBase, String[] interfaces,
+ ClassLoader defaultLoader)
+ throws MalformedURLException, ClassNotFoundException;
+
+ public abstract ClassLoader getClassLoader (String codebase)
+ throws MalformedURLException;
+
+ public abstract String getClassAnnotation (Class cl);
+}
diff --git a/libjava/java/rmi/server/UnicastRemoteObject.java b/libjava/java/rmi/server/UnicastRemoteObject.java
index aefe9701ecd..4e2f06ae64b 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, 2002 Free Software Foundation, Inc.
+ Copyright (c) 1996, 1997, 1998, 1999, 2002, 2003 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -113,7 +113,7 @@ public static RemoteStub exportObject(Remote obj) throws RemoteException {
}
public static boolean unexportObject(Remote obj, boolean force)
- throws RemoteException, NoSuchObjectException
+ throws NoSuchObjectException
{
if (obj instanceof RemoteObject)
{
diff --git a/libjava/java/security/SecureRandom.java b/libjava/java/security/SecureRandom.java
index a0b7f95f397..d9ac153da2b 100644
--- a/libjava/java/security/SecureRandom.java
+++ b/libjava/java/security/SecureRandom.java
@@ -1,5 +1,5 @@
/* SecureRandom.java --- Secure Random class implmentation
- Copyright (C) 1999, 2001, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2001, 2002, 2003 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.io.Serializable;
import java.util.Random;
import java.util.Enumeration;
@@ -358,9 +359,10 @@ public class SecureRandom extends Random
int ret = 0;
for (int i = 0; i < tmp.length; i++)
- ret |= tmp[i] << (8 * i);
+ ret |= (tmp[i] & 0xFF) << (8 * i);
- return ret;
+ long mask = (1L << numBits) - 1;
+ return (int) (ret & mask);
}
/**
diff --git a/libjava/java/security/Security.java b/libjava/java/security/Security.java
index bf7a993ad47..39d75eef00c 100644
--- a/libjava/java/security/Security.java
+++ b/libjava/java/security/Security.java
@@ -37,9 +37,10 @@ exception statement from your version. */
package java.security;
import java.io.File;
-import java.io.FileInputStream;
+import java.io.InputStream;
import java.io.IOException;
import java.io.FileNotFoundException;
+import java.net.URL;
import java.security.Provider;
import java.util.Vector;
import java.util.Enumeration;
@@ -59,9 +60,9 @@ public final class Security extends Object
static
{
- loadProviders(System.getProperty("java.home"),
- System.getProperty("java.vm.name"));
- loadProviders(System.getProperty("gnu.classpath.home"), "classpath");
+ String base = System.getProperty("gnu.classpath.home.url");
+ loadProviders(base, System.getProperty("gnu.classpath.vm.shortname"));
+ loadProviders(base, "classpath");
}
// This class can't be instantiated.
@@ -69,20 +70,16 @@ public final class Security extends Object
{
}
- private static void loadProviders(String dir, String vendor)
+ private static void loadProviders(String baseUrl, String vendor)
{
- if (dir == null || vendor == null)
+ if (baseUrl == null || vendor == null)
return;
- String separator = System.getProperty("file.separator");
- String secfilestr = (dir +
- separator + "lib" +
- separator + "security" +
- separator + vendor + ".security");
+ String secfilestr = baseUrl + "/security/" + vendor + ".security";
try
{
- FileInputStream fin = new FileInputStream(secfilestr);
+ InputStream fin = new URL(secfilestr).openStream();
secprops = new Properties();
secprops.load(fin);
diff --git a/libjava/java/sql/Timestamp.java b/libjava/java/sql/Timestamp.java
index c42ff3ca9e9..0f8b44c43a6 100644
--- a/libjava/java/sql/Timestamp.java
+++ b/libjava/java/sql/Timestamp.java
@@ -1,5 +1,5 @@
/* Time.java -- Wrapper around java.util.Date
- Copyright (C) 1999, 2000 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2000, 2003 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -52,7 +52,7 @@ import java.text.SimpleDateFormat;
*/
public class Timestamp extends java.util.Date
{
- static final long serialVersionUID = 3581463369166924961L;
+ static final long serialVersionUID = 2745179027874758501L;
/**
* Used for parsing and formatting this date.
@@ -237,19 +237,37 @@ public class Timestamp extends java.util.Date
}
/**
+ * Compare two Timestamp
+ * @param when the other Timestamp.
+ * @return 0, if the date represented
+ * by obj is exactly the same as the time represented by this
+ * object, a negative if this Timestamp is before the other Timestamp, and
+ * a positive value otherwise.
* @since 1.2
*/
- /*
public int compareTo(Timestamp ts)
{
-
- }*/
-
+ int s = super.compareTo((java.util.Date) ts);
+ if (s != 0)
+ return s;
+ // If Date components were equal, then we check the nanoseconds.
+ return nanos - ts.nanos;
+ }
+
/**
+ * Compares this Timestamp to another. This behaves like
+ * <code>compareTo(Timestamp)</code>, but it may throw a
+ * <code>ClassCastException</code>
+ * @param obj the other Timestamp.
+ * @return 0, if the Timestamp represented
+ * by obj is exactly the same as the time represented by this
+ * object, a negative if this Timestamp is before the other Timestamp, and
+ * a positive value otherwise.
+ * @exception ClassCastException if obj is not of type Timestamp.
* @since 1.2
- *//*
+ */
public int compareTo(Object obj)
{
return compareTo((Timestamp) obj);
- }*/
+ }
}
diff --git a/libjava/java/util/Properties.java b/libjava/java/util/Properties.java
index adad25055ac..279cf1e7b82 100644
--- a/libjava/java/util/Properties.java
+++ b/libjava/java/util/Properties.java
@@ -1,5 +1,5 @@
/* Properties.java -- a set of persistent properties
- Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -271,6 +271,13 @@ label = Name:\\u0020</pre>
{
// The line continues on the next line.
line = reader.readLine();
+
+ // We might have seen a backslash at the end of
+ // the file. The JDK ignores the backslash in
+ // this case, so we follow for compatibility.
+ if (line == null)
+ break;
+
pos = 0;
while (pos < line.length()
&& Character.isWhitespace(c = line.charAt(pos)))
@@ -370,9 +377,21 @@ label = Name:\\u0020</pre>
= new PrintWriter(new OutputStreamWriter(out, "ISO-8859-1"));
if (header != null)
writer.println("#" + header);
- writer.println("#" + new Date());
- list(writer);
- writer.flush();
+ writer.println ("#" + Calendar.getInstance ().getTime ());
+
+ Iterator iter = entrySet ().iterator ();
+ int i = size ();
+ StringBuffer s = new StringBuffer (); // Reuse the same buffer.
+ while (--i >= 0)
+ {
+ Map.Entry entry = (Map.Entry) iter.next ();
+ formatForOutput ((String) entry.getKey (), s, true);
+ s.append ('=');
+ formatForOutput ((String) entry.getValue (), s, false);
+ writer.println (s);
+ }
+
+ writer.flush ();
}
/**
@@ -446,54 +465,50 @@ label = Name:\\u0020</pre>
}
/**
- * Writes the key/value pairs to the given print stream. They are
- * written in the way described in the method store. This does not visit
- * the keys in the default properties.
+ * Prints the key/value pairs to the given print stream. This is
+ * mainly useful for debugging purposes.
*
- * @param out the stream, where the key/value pairs are written to
- * @throws ClassCastException if this property contains any key or
+ * @param out the print stream, where the key/value pairs are written to
+ * @throws ClassCastException if this property contains a key or a
* value that isn't a string
- * @see #store(OutputStream, String)
+ * @see #list(PrintWriter)
*/
public void list(PrintStream out)
{
- Iterator iter = entrySet().iterator();
- int i = size();
- StringBuffer s = new StringBuffer(); // Reuse the same buffer.
- while (--i >= 0)
- {
- Map.Entry entry = (Map.Entry) iter.next();
- formatForOutput((String) entry.getKey(), s, true);
- s.append('=');
- formatForOutput((String) entry.getValue(), s, false);
- out.println(s);
- }
+ PrintWriter writer = new PrintWriter (out);
+ list (writer);
}
/**
- * Writes the key/value pairs to the given print writer. They are
- * written in the way, described in the method store.
+ * Prints the key/value pairs to the given print writer. This is
+ * mainly useful for debugging purposes.
*
- * @param out the writer, where the key/value pairs are written to
- * @throws ClassCastException if this property contains any key or
+ * @param out the print writer where the key/value pairs are written to
+ * @throws ClassCastException if this property contains a key or a
* value that isn't a string
- * @see #store(OutputStream, String)
* @see #list(PrintStream)
* @since 1.1
*/
public void list(PrintWriter out)
{
- Iterator iter = entrySet().iterator();
- int i = size();
- StringBuffer s = new StringBuffer(); // Reuse the same buffer.
+ out.println ("-- listing properties --");
+
+ Iterator iter = entrySet ().iterator ();
+ int i = size ();
while (--i >= 0)
{
- Map.Entry entry = (Map.Entry) iter.next();
- formatForOutput((String) entry.getKey(), s, true);
- s.append('=');
- formatForOutput((String) entry.getValue(), s, false);
- out.println(s);
+ Map.Entry entry = (Map.Entry) iter.next ();
+ out.print ((String) entry.getKey () + "=");
+
+ // JDK 1.3/1.4 restrict the printed value, but not the key,
+ // to 40 characters, including the truncating ellipsis.
+ String s = (String ) entry.getValue ();
+ if (s != null && s.length () > 40)
+ out.println (s.substring (0, 37) + "...");
+ else
+ out.println (s);
}
+ out.flush ();
}
/**
@@ -540,6 +555,7 @@ label = Name:\\u0020</pre>
case '=':
case ':':
buffer.append('\\').append(c);
+ break;
default:
if (c < ' ' || c > '~')
{
diff --git a/libjava/java/util/TreeMap.java b/libjava/java/util/TreeMap.java
index dfa9bc63881..e0cff28e02c 100644
--- a/libjava/java/util/TreeMap.java
+++ b/libjava/java/util/TreeMap.java
@@ -865,7 +865,7 @@ public class TreeMap extends AbstractMap
int rowsize;
// Fill each row that is completely full of nodes.
- for (rowsize = 2; rowsize + rowsize < count; rowsize <<= 1)
+ for (rowsize = 2; rowsize + rowsize <= count; rowsize <<= 1)
{
Node parent = row;
Node last = null;
@@ -1468,10 +1468,10 @@ public class TreeMap extends AbstractMap
*/
public void remove()
{
- if (knownMod != modCount)
- throw new ConcurrentModificationException();
if (last == null)
throw new IllegalStateException();
+ if (knownMod != modCount)
+ throw new ConcurrentModificationException();
removeNode(last);
last = null;
diff --git a/libjava/java/util/jar/JarFile.java b/libjava/java/util/jar/JarFile.java
index d6fd9846b6e..394b51af6d0 100644
--- a/libjava/java/util/jar/JarFile.java
+++ b/libjava/java/util/jar/JarFile.java
@@ -1,5 +1,5 @@
/* JarFile.java - Representation of a jar file
- Copyright (C) 2000 Free Software Foundation, Inc.
+ Copyright (C) 2000, 2003 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -71,10 +71,10 @@ public class JarFile extends ZipFile
*/
private Manifest manifest;
- /** Wether to verify the manifest and all entries. */
+ /** Whether to verify the manifest and all entries. */
private boolean verify;
- /** Wether the has already been loaded. */
+ /** Whether the has already been loaded. */
private boolean manifestRead = false;
// Constructors
@@ -109,6 +109,11 @@ public class JarFile extends ZipFile
FileNotFoundException, IOException
{
super(fileName);
+ if (verify)
+ {
+ manifest = readManifest();
+ verify();
+ }
}
/**
@@ -141,6 +146,11 @@ public class JarFile extends ZipFile
IOException
{
super(file);
+ if (verify)
+ {
+ manifest = readManifest();
+ verify();
+ }
}
/**
@@ -165,6 +175,11 @@ public class JarFile extends ZipFile
FileNotFoundException, IOException, IllegalArgumentException
{
super(file, mode);
+ if (verify)
+ {
+ manifest = readManifest();
+ verify();
+ }
}
// Methods
@@ -196,15 +211,18 @@ public class JarFile extends ZipFile
if (manEntry != null)
{
InputStream in = super.getInputStream(manEntry);
+ manifestRead = true;
return new Manifest(in);
}
else
{
+ manifestRead = true;
return null;
}
}
catch (IOException ioe)
{
+ manifestRead = true;
return null;
}
}
diff --git a/libjava/java/util/natResourceBundle.cc b/libjava/java/util/natResourceBundle.cc
index 21a9565c996..35e90ee23d3 100644
--- a/libjava/java/util/natResourceBundle.cc
+++ b/libjava/java/util/natResourceBundle.cc
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002 Free Software Foundation
+/* Copyright (C) 2002, 2003 Free Software Foundation
This file is part of libgcj.
@@ -16,17 +16,27 @@ details. */
#include <java/lang/SecurityManager.h>
#include <java/lang/ClassLoader.h>
#include <java/lang/Class.h>
+#include <java/lang/ArrayIndexOutOfBoundsException.h>
#include <gnu/gcj/runtime/StackTrace.h>
java::lang::ClassLoader *
java::util::ResourceBundle::getCallingClassLoader ()
{
gnu::gcj::runtime::StackTrace *t = new gnu::gcj::runtime::StackTrace(6);
- for (int i = 3; i < 6; ++i)
+ try
+ {
+ /* Frame 0 is this method, frame 1 is getBundle, so starting at
+ frame 2 we might see the user's class. FIXME: should account
+ for reflection, JNI, etc, here. */
+ for (int i = 2; ; ++i)
+ {
+ jclass klass = t->classAt(i);
+ if (klass != NULL)
+ return klass->getClassLoaderInternal();
+ }
+ }
+ catch (::java::lang::ArrayIndexOutOfBoundsException *e)
{
- jclass klass = t->classAt(i);
- if (klass != NULL)
- return klass->getClassLoaderInternal();
}
return NULL;
}
diff --git a/libjava/java/util/natTimeZone.cc b/libjava/java/util/natTimeZone.cc
index ea59293513d..cb564a97591 100644
--- a/libjava/java/util/natTimeZone.cc
+++ b/libjava/java/util/natTimeZone.cc
@@ -1,6 +1,6 @@
// natTimeZone.cc -- Native side of TimeZone class.
-/* Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation
+/* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation
This file is part of libgcj.
@@ -9,12 +9,11 @@ Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
details. */
#include <config.h>
+#include <platform.h>
#include <gcj/cni.h>
#include <jvm.h>
-#include "platform.h"
-
#include <java/util/TimeZone.h>
#include <java/lang/Character.h>
#include <java/lang/Integer.h>
diff --git a/libjava/java/util/zip/InflaterInputStream.java b/libjava/java/util/zip/InflaterInputStream.java
index 5aac73d7e5a..b04534977f1 100644
--- a/libjava/java/util/zip/InflaterInputStream.java
+++ b/libjava/java/util/zip/InflaterInputStream.java
@@ -1,5 +1,5 @@
/* InflaterInputStream.java - Input stream filter for decompressing
- Copyright (C) 1999, 2000, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2000, 2002, 2003 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -90,6 +90,8 @@ public class InflaterInputStream extends FilterInputStream
{
if (inf == null)
throw new IOException ("stream closed");
+ if (len == 0)
+ return 0;
if (inf.finished())
return -1;
diff --git a/libjava/java/util/zip/ZipEntry.java b/libjava/java/util/zip/ZipEntry.java
index c9f1b1d7d44..5284d793f6c 100644
--- a/libjava/java/util/zip/ZipEntry.java
+++ b/libjava/java/util/zip/ZipEntry.java
@@ -84,11 +84,15 @@ public class ZipEntry implements ZipConstants, Cloneable
* Creates a zip entry with the given name.
* @param name the name. May include directory components separated
* by '/'.
+ *
+ * @exception NullPointerException when name is null.
+ * @exception IllegalArgumentException when name is bigger then 65535 chars.
*/
public ZipEntry(String name)
{
- if (name == null)
- throw new NullPointerException();
+ int length = name.length();
+ if (length > 65535)
+ throw new IllegalArgumentException("name length is " + length);
this.name = name;
}
@@ -365,7 +369,7 @@ public class ZipEntry implements ZipConstants, Cloneable
*/
public void setComment(String comment)
{
- if (comment.length() > 0xffff)
+ if (comment != null && comment.length() > 0xffff)
throw new IllegalArgumentException();
this.comment = comment;
}
diff --git a/libjava/java/util/zip/ZipFile.java b/libjava/java/util/zip/ZipFile.java
index eb79d03e594..8f7ef6f8d6f 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, 2002 Free Software Foundation, Inc.
+ Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -37,6 +37,7 @@ exception statement from your version. */
package java.util.zip;
+import java.io.BufferedInputStream;
import java.io.ByteArrayInputStream;
import java.io.DataInput;
import java.io.DataInputStream;
@@ -46,7 +47,8 @@ import java.io.IOException;
import java.io.EOFException;
import java.io.RandomAccessFile;
import java.util.Enumeration;
-import java.util.Hashtable;
+import java.util.HashMap;
+import java.util.Iterator;
import java.util.NoSuchElementException;
/**
@@ -58,6 +60,7 @@ import java.util.NoSuchElementException;
* entries in different threads.
*
* @author Jochen Hoenicke
+ * @author Artur Biesiadowski
*/
public class ZipFile implements ZipConstants
{
@@ -79,7 +82,7 @@ public class ZipFile implements ZipConstants
private final RandomAccessFile raf;
// The entries of this zip file when initialized and not yet closed.
- private Hashtable entries;
+ private HashMap entries;
private boolean closed = false;
@@ -137,33 +140,74 @@ public class ZipFile implements ZipConstants
}
/**
- * Read an unsigned short in little endian byte order.
+ * Read an unsigned short in little endian byte order from the given
+ * DataInput stream using the given byte buffer.
+ *
+ * @param di DataInput stream to read from.
+ * @param b the byte buffer to read in (must be at least 2 bytes long).
+ * @return The value read.
+ *
* @exception IOException if a i/o error occured.
* @exception EOFException if the file ends prematurely
*/
- private final int readLeShort(DataInput di) throws IOException
+ private final int readLeShort(DataInput di, byte[] b) throws IOException
{
- byte[] b = new byte[2];
- di.readFully(b);
+ di.readFully(b, 0, 2);
return (b[0] & 0xff) | (b[1] & 0xff) << 8;
}
/**
- * Read an int in little endian byte order.
+ * Read an int in little endian byte order from the given
+ * DataInput stream using the given byte buffer.
+ *
+ * @param di DataInput stream to read from.
+ * @param b the byte buffer to read in (must be at least 4 bytes long).
+ * @return The value read.
+ *
* @exception IOException if a i/o error occured.
* @exception EOFException if the file ends prematurely
*/
- private final int readLeInt(DataInput di) throws IOException
+ private final int readLeInt(DataInput di, byte[] b) throws IOException
{
- byte[] b = new byte[4];
- di.readFully(b);
+ di.readFully(b, 0, 4);
return ((b[0] & 0xff) | (b[1] & 0xff) << 8)
| ((b[2] & 0xff) | (b[3] & 0xff) << 8) << 16;
}
+
+ /**
+ * Read an unsigned short in little endian byte order from the given
+ * byte buffer at the given offset.
+ *
+ * @param b the byte array to read from.
+ * @param off the offset to read from.
+ * @return The value read.
+ */
+ private final int readLeShort(byte[] b, int off)
+ {
+ return (b[off] & 0xff) | (b[off+1] & 0xff) << 8;
+ }
+
+ /**
+ * Read an int in little endian byte order from the given
+ * byte buffer at the given offset.
+ *
+ * @param b the byte array to read from.
+ * @param off the offset to read from.
+ * @return The value read.
+ */
+ private final int readLeInt(byte[] b, int off)
+ {
+ return ((b[off] & 0xff) | (b[off+1] & 0xff) << 8)
+ | ((b[off+2] & 0xff) | (b[off+3] & 0xff) << 8) << 16;
+ }
+
+
/**
* Read the central directory of a zip file and fill the entries
- * array. This is called exactly once when first needed.
+ * array. This is called exactly once when first needed. It is called
+ * while holding the lock on <code>raf</code>.
+ *
* @exception IOException if a i/o error occured.
* @exception ZipException if the central directory is malformed
*/
@@ -175,6 +219,8 @@ public class ZipFile implements ZipConstants
* file isn't a zip file.
*/
long pos = raf.length() - ENDHDR;
+ byte[] ebs = new byte[CENHDR];
+
do
{
if (pos < 0)
@@ -182,45 +228,42 @@ public class ZipFile implements ZipConstants
("central directory not found, probably not a zip file: " + name);
raf.seek(pos--);
}
- while (readLeInt(raf) != ENDSIG);
+ while (readLeInt(raf, ebs) != ENDSIG);
+
if (raf.skipBytes(ENDTOT - ENDNRD) != ENDTOT - ENDNRD)
throw new EOFException(name);
- int count = readLeShort(raf);
+ int count = readLeShort(raf, ebs);
if (raf.skipBytes(ENDOFF - ENDSIZ) != ENDOFF - ENDSIZ)
throw new EOFException(name);
- int centralOffset = readLeInt(raf);
+ int centralOffset = readLeInt(raf, ebs);
- entries = new Hashtable(count);
+ entries = new HashMap(count+count/2);
raf.seek(centralOffset);
- byte[] ebs = new byte[24];
- ByteArrayInputStream ebais = new ByteArrayInputStream(ebs);
- DataInputStream edip = new DataInputStream(ebais);
+
+ byte[] buffer = new byte[16];
for (int i = 0; i < count; i++)
{
- if (readLeInt(raf) != CENSIG)
+ raf.readFully(ebs);
+ if (readLeInt(ebs, 0) != CENSIG)
throw new ZipException("Wrong Central Directory signature: " + name);
- if (raf.skipBytes(CENHOW - CENVEM) != CENHOW - CENVEM)
- 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(name);
- int offset = readLeInt(raf);
-
- byte[] buffer = new byte[Math.max(nameLen, commentLen)];
+
+ int method = readLeShort(ebs, CENHOW);
+ int dostime = readLeInt(ebs, CENTIM);
+ int crc = readLeInt(ebs, CENCRC);
+ int csize = readLeInt(ebs, CENSIZ);
+ int size = readLeInt(ebs, CENLEN);
+ int nameLen = readLeShort(ebs, CENNAM);
+ int extraLen = readLeShort(ebs, CENEXT);
+ int commentLen = readLeShort(ebs, CENCOM);
+
+ int offset = readLeInt(ebs, CENOFF);
+
+ int needBuffer = Math.max(nameLen, commentLen);
+ if (buffer.length < needBuffer)
+ buffer = new byte[needBuffer];
raf.readFully(buffer, 0, nameLen);
- String name = new String(buffer, 0, nameLen);
+ String name = new String(buffer, 0, 0, nameLen);
ZipEntry entry = new ZipEntry(name);
entry.setMethod(method);
@@ -248,6 +291,7 @@ public class ZipFile implements ZipConstants
* Closes the ZipFile. This also closes all input streams given by
* this class. After this is called, no further method should be
* called.
+ *
* @exception IOException if a i/o error occured.
*/
public void close() throws IOException
@@ -261,13 +305,22 @@ public class ZipFile implements ZipConstants
}
/**
+ * Calls the <code>close()</code> method when this ZipFile has not yet
+ * been explicitly closed.
+ */
+ protected void finalize() throws IOException
+ {
+ if (!closed) close();
+ }
+
+ /**
* Returns an enumeration of all Zip entries in this Zip file.
*/
public Enumeration entries()
{
try
{
- return new ZipEntryEnumeration(getEntries().elements());
+ return new ZipEntryEnumeration(getEntries().values().iterator());
}
catch (IOException ioe)
{
@@ -281,7 +334,7 @@ public class ZipFile implements ZipConstants
* @exception IllegalStateException when the ZipFile has already been closed.
* @exception IOEexception when the entries could not be read.
*/
- private Hashtable getEntries() throws IOException
+ private HashMap getEntries() throws IOException
{
synchronized(raf)
{
@@ -297,15 +350,16 @@ public class ZipFile implements ZipConstants
/**
* Searches for a zip entry in this archive with the given name.
+ *
* @param the name. May contain directory components separated by
* slashes ('/').
* @return the zip entry, or null if no entry with that name exists.
- * @see #entries */
+ */
public ZipEntry getEntry(String name)
{
try
{
- Hashtable entries = getEntries();
+ HashMap entries = getEntries();
ZipEntry entry = (ZipEntry) entries.get(name);
return entry != null ? (ZipEntry) entry.clone() : null;
}
@@ -315,10 +369,17 @@ public class ZipFile implements ZipConstants
}
}
+
+ //access should be protected by synchronized(raf)
+ private byte[] locBuf = new byte[LOCHDR];
+
/**
* Checks, if the local header of the entry at index i matches the
* central directory, and returns the offset to the data.
+ *
+ * @param entry to check.
* @return the start offset of the (compressed) data.
+ *
* @exception IOException if a i/o error occured.
* @exception ZipException if the local header doesn't match the
* central directory header
@@ -328,24 +389,18 @@ public class ZipFile implements ZipConstants
synchronized (raf)
{
raf.seek(entry.offset);
- if (readLeInt(raf) != LOCSIG)
+ raf.readFully(locBuf);
+
+ if (readLeInt(locBuf, 0) != LOCSIG)
throw new ZipException("Wrong Local header signature: " + name);
- /* skip version and flags */
- if (raf.skipBytes(LOCHOW - LOCVER) != LOCHOW - LOCVER)
- throw new EOFException(name);
-
- if (entry.getMethod() != readLeShort(raf))
+ if (entry.getMethod() != readLeShort(locBuf, LOCHOW))
throw new ZipException("Compression method mismatch: " + name);
- /* Skip time, crc, size and csize */
- if (raf.skipBytes(LOCNAM - LOCTIM) != LOCNAM - LOCTIM)
- throw new EOFException(name);
-
- if (entry.getName().length() != readLeShort(raf))
+ if (entry.getName().length() != readLeShort(locBuf, LOCNAM))
throw new ZipException("file name length mismatch: " + name);
- int extraLen = entry.getName().length() + readLeShort(raf);
+ int extraLen = entry.getName().length() + readLeShort(locBuf, LOCEXT);
return entry.offset + LOCHDR + extraLen;
}
}
@@ -354,13 +409,16 @@ public class ZipFile implements ZipConstants
* Creates an input stream reading the given zip entry as
* uncompressed data. Normally zip entry should be an entry
* returned by getEntry() or entries().
+ *
+ * @param entry the entry to create an InputStream for.
* @return the input stream.
+ *
* @exception IOException if a i/o error occured.
* @exception ZipException if the Zip archive is malformed.
*/
public InputStream getInputStream(ZipEntry entry) throws IOException
{
- Hashtable entries = getEntries();
+ HashMap entries = getEntries();
String name = entry.getName();
ZipEntry zipEntry = (ZipEntry) entries.get(name);
if (zipEntry == null)
@@ -368,8 +426,8 @@ public class ZipFile implements ZipConstants
long start = checkLocalHeader(zipEntry);
int method = zipEntry.getMethod();
- InputStream is = new PartialInputStream
- (raf, start, zipEntry.getCompressedSize());
+ InputStream is = new BufferedInputStream(new PartialInputStream
+ (raf, start, zipEntry.getCompressedSize()));
switch (method)
{
case ZipOutputStream.STORED:
@@ -406,16 +464,16 @@ public class ZipFile implements ZipConstants
private static class ZipEntryEnumeration implements Enumeration
{
- private final Enumeration elements;
+ private final Iterator elements;
- public ZipEntryEnumeration(Enumeration elements)
+ public ZipEntryEnumeration(Iterator elements)
{
this.elements = elements;
}
public boolean hasMoreElements()
{
- return elements.hasMoreElements();
+ return elements.hasNext();
}
public Object nextElement()
@@ -423,13 +481,13 @@ public class ZipFile implements ZipConstants
/* We return a clone, just to be safe that the user doesn't
* change the entry.
*/
- return ((ZipEntry)elements.nextElement()).clone();
+ return ((ZipEntry)elements.next()).clone();
}
}
private static class PartialInputStream extends InputStream
{
- RandomAccessFile raf;
+ private final RandomAccessFile raf;
long filepos, end;
public PartialInputStream(RandomAccessFile raf, long start, long len)
diff --git a/libjava/java/util/zip/ZipInputStream.java b/libjava/java/util/zip/ZipInputStream.java
index c4905978d74..2fba9f556dc 100644
--- a/libjava/java/util/zip/ZipInputStream.java
+++ b/libjava/java/util/zip/ZipInputStream.java
@@ -1,5 +1,5 @@
/* java.util.zip.ZipInputStream
- Copyright (C) 2001, 2002 Free Software Foundation, Inc.
+ Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -286,6 +286,8 @@ public class ZipInputStream extends InflaterInputStream implements ZipConstants
*/
public int read(byte[] b, int off, int len) throws IOException
{
+ if (len == 0)
+ return 0;
if (crc == null)
throw new IOException("Stream closed.");
if (entry == null)
diff --git a/libjava/javax/naming/InitialContext.java b/libjava/javax/naming/InitialContext.java
index 99ae426e9ab..705e24ad1eb 100644
--- a/libjava/javax/naming/InitialContext.java
+++ b/libjava/javax/naming/InitialContext.java
@@ -1,5 +1,5 @@
/* InitialContext.java --
- Copyright (C) 2000 Free Software Foundation, Inc.
+ Copyright (C) 2000, 2002 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -126,18 +126,22 @@ public class InitialContext implements Context
}
catch (IOException e) {}
- String home = System.getProperty("java.home");
+ String home = System.getProperty("gnu.classpath.home.url");
if (home != null)
{
- String fileName = home + File.separator
- + "lib" + File.separator + "jndi.properties";
+ String url = home + "/jndi.properties";
Properties p = new Properties ();
- try {
- InputStream is = new FileInputStream (fileName);
- p.load (is);
- is.close ();
- } catch (IOException e) {}
+ try
+ {
+ InputStream is = new URL(url).openStream();
+ p.load (is);
+ is.close ();
+ }
+ catch (IOException e)
+ {
+ // Ignore.
+ }
merge (myProps, p);
}
diff --git a/libjava/javax/sql/ConnectionEvent.java b/libjava/javax/sql/ConnectionEvent.java
index 1c4b5ef5b71..b973dca3dc3 100644
--- a/libjava/javax/sql/ConnectionEvent.java
+++ b/libjava/javax/sql/ConnectionEvent.java
@@ -1,5 +1,5 @@
/* ConnectionEvent.java
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2003 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -46,8 +46,11 @@ import java.util.EventObject;
*/
public class ConnectionEvent extends EventObject
{
- private SQLException sqlException;
-
+ private static final long serialVersionUID = -4843217645290030002L;
+
+ // Note that the name is chosen for serialization.
+ private SQLException ex;
+
/**
* @since 1.4
*/
@@ -62,7 +65,7 @@ public class ConnectionEvent extends EventObject
public ConnectionEvent(PooledConnection con, SQLException ex)
{
super(con);
- this.sqlException = ex;
+ this.ex = ex;
}
/**
@@ -70,6 +73,6 @@ public class ConnectionEvent extends EventObject
*/
public SQLException getSQLException()
{
- return sqlException;
+ return ex;
}
}
diff --git a/libjava/jni.cc b/libjava/jni.cc
index b841b4fc481..7dd98364118 100644
--- a/libjava/jni.cc
+++ b/libjava/jni.cc
@@ -1,6 +1,6 @@
// jni.cc - JNI implementation, including the jump table.
-/* Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation
+/* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation
This file is part of libgcj.
@@ -10,6 +10,7 @@ details. */
#include <config.h>
+#include <stdio.h>
#include <stddef.h>
#include <string.h>
@@ -1388,6 +1389,7 @@ static jarray
elementClass = unwrap (elementClass);
init = unwrap (init);
+ _Jv_CheckCast (elementClass, init);
jarray result = JvNewObjectArray (length, elementClass, init);
return (jarray) wrap_value (env, result);
}
@@ -1402,6 +1404,8 @@ static jobject
(JNICALL _Jv_JNI_GetObjectArrayElement) (JNIEnv *env, jobjectArray array,
jsize index)
{
+ if ((unsigned) index >= (unsigned) array->length)
+ _Jv_ThrowBadArrayIndex (index);
jobject *elts = elements (unwrap (array));
return wrap_value (env, elts[index]);
}
@@ -1416,6 +1420,8 @@ static void
value = unwrap (value);
_Jv_CheckArrayStore (array, value);
+ if ((unsigned) index >= (unsigned) array->length)
+ _Jv_ThrowBadArrayIndex (index);
jobject *elts = elements (array);
elts[index] = value;
}
@@ -2023,9 +2029,9 @@ _Jv_GetJNIEnvNewFrame (jclass klass)
// This is `extern "C"' because the compiler uses it.
extern "C" void *
_Jv_LookupJNIMethod (jclass klass, _Jv_Utf8Const *name,
- _Jv_Utf8Const *signature)
+ _Jv_Utf8Const *signature, int args_size)
{
- char buf[10 + 6 * (name->length + signature->length)];
+ char buf[10 + 6 * (name->length + signature->length) + 12];
int long_start;
void *function;
@@ -2045,18 +2051,72 @@ _Jv_LookupJNIMethod (jclass klass, _Jv_Utf8Const *name,
return function;
// If there was no override, then look in the symbol table.
- mangled_name (klass, name, signature, buf, &long_start);
- char c = buf[long_start];
- buf[long_start] = '\0';
- function = _Jv_FindSymbolInExecutable (buf);
+ buf[0] = '_';
+ mangled_name (klass, name, signature, buf + 1, &long_start);
+ char c = buf[long_start + 1];
+ buf[long_start + 1] = '\0';
+
+ function = _Jv_FindSymbolInExecutable (buf + 1);
+#ifdef WIN32
+ // On Win32, we use the "stdcall" calling convention (see JNICALL
+ // in jni.h).
+ //
+ // For a function named 'fooBar' that takes 'nn' bytes as arguments,
+ // by default, MinGW GCC exports it as 'fooBar@nn', MSVC exports it
+ // as '_fooBar@nn' and Borland C exports it as 'fooBar'. We try to
+ // take care of all these variations here.
+
+ char asz_buf[12]; /* '@' + '2147483647' (32-bit INT_MAX) + '\0' */
+ char long_nm_sv[11]; /* Ditto, except for the '\0'. */
+
if (function == NULL)
{
- buf[long_start] = c;
+ // We have tried searching for the 'fooBar' form (BCC) - now
+ // try the others.
+
+ // First, save the part of the long name that will be damaged
+ // by appending '@nn'.
+ memcpy (long_nm_sv, (buf + long_start + 1 + 1), sizeof (long_nm_sv));
+
+ sprintf (asz_buf, "@%d", args_size);
+ strcat (buf, asz_buf);
+
+ // Search for the '_fooBar@nn' form (MSVC).
function = _Jv_FindSymbolInExecutable (buf);
+
+ if (function == NULL)
+ {
+ // Search for the 'fooBar@nn' form (MinGW GCC).
+ function = _Jv_FindSymbolInExecutable (buf + 1);
+ }
+ }
+#else /* WIN32 */
+ args_size; /* Dummy statement to avoid unused parameter warning */
+#endif /* ! WIN32 */
+
+ if (function == NULL)
+ {
+ buf[long_start + 1] = c;
+#ifdef WIN32
+ // Restore the part of the long name that was damaged by
+ // appending the '@nn'.
+ memcpy ((buf + long_start + 1 + 1), long_nm_sv, sizeof (long_nm_sv));
+#endif /* WIN32 */
+ function = _Jv_FindSymbolInExecutable (buf + 1);
if (function == NULL)
{
- jstring str = JvNewStringUTF (name->data);
- throw new java::lang::UnsatisfiedLinkError (str);
+#ifdef WIN32
+ strcat (buf, asz_buf);
+ function = _Jv_FindSymbolInExecutable (buf);
+ if (function == NULL)
+ function = _Jv_FindSymbolInExecutable (buf + 1);
+
+ if (function == NULL)
+#endif /* WIN32 */
+ {
+ jstring str = JvNewStringUTF (name->data);
+ throw new java::lang::UnsatisfiedLinkError (str);
+ }
}
}
@@ -2087,9 +2147,17 @@ _Jv_JNIMethod::call (ffi_cif *, void *ret, ffi_raw *args, void *__this)
// time.
JvSynchronize sync (global_ref_table);
if (_this->function == NULL)
- _this->function = _Jv_LookupJNIMethod (_this->defining_class,
- _this->self->name,
- _this->self->signature);
+ {
+ int args_size = sizeof (JNIEnv *) + _this->args_raw_size;
+
+ if (_this->self->accflags & java::lang::reflect::Modifier::STATIC)
+ args_size += sizeof (_this->defining_class);
+
+ _this->function = _Jv_LookupJNIMethod (_this->defining_class,
+ _this->self->name,
+ _this->self->signature,
+ args_size);
+ }
}
JvAssert (_this->args_raw_size % sizeof (ffi_raw) == 0);
diff --git a/libjava/libgcj.spec.in b/libjava/libgcj.spec.in
index e1b3526f9cb..93d449d904d 100644
--- a/libjava/libgcj.spec.in
+++ b/libjava/libgcj.spec.in
@@ -6,4 +6,4 @@
%rename lib liborig
*lib: -lgcj -lm @LIBICONV@ @GCSPEC@ @THREADSPEC@ @ZLIBSPEC@ @SYSTEMSPEC@ %(libgcc) %(liborig)
-*jc1: @HASH_SYNC_SPEC@ @DIVIDESPEC@ @CHECKREFSPEC@ @JC1GCSPEC@ @EXCEPTIONSPEC@ -fkeep-inline-functions
+*jc1: @HASH_SYNC_SPEC@ @DIVIDESPEC@ @CHECKREFSPEC@ @JC1GCSPEC@ @EXCEPTIONSPEC@ @BACKTRACESPEC@ @IEEESPEC@ -fkeep-inline-functions
diff --git a/libjava/libtool-version b/libjava/libtool-version
index 318fd04b258..8c0164a94a0 100644
--- a/libjava/libtool-version
+++ b/libjava/libtool-version
@@ -3,4 +3,4 @@
# a separate file so that version updates don't involve re-running
# automake.
# CURRENT:REVISION:AGE
-3:0:0
+4:0:0
diff --git a/libjava/org/xml/sax/AttributeList.java b/libjava/org/xml/sax/AttributeList.java
index 9ea9295e191..b1a647aa16e 100644
--- a/libjava/org/xml/sax/AttributeList.java
+++ b/libjava/org/xml/sax/AttributeList.java
@@ -1,191 +1,193 @@
-// SAX Attribute List Interface.
-// No warranty; no copyright -- use this as you will.
-// $Id: AttributeList.java,v 1.1 2000/10/02 02:43:16 sboag Exp $
-
-package org.xml.sax;
-
-/**
- * Interface for an element's attribute specifications.
- *
- * <blockquote>
- * <em>This module, both source code and documentation, is in the
- * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
- * </blockquote>
- *
- * <p>This is the original SAX1 interface for reporting an element's
- * attributes. Unlike the new {@link org.xml.sax.Attributes Attributes}
- * interface, it does not support Namespace-related information.</p>
- *
- * <p>When an attribute list is supplied as part of a
- * {@link org.xml.sax.DocumentHandler#startElement startElement}
- * event, the list will return valid results only during the
- * scope of the event; once the event handler returns control
- * to the parser, the attribute list is invalid. To save a
- * persistent copy of the attribute list, use the SAX1
- * {@link org.xml.sax.helpers.AttributeListImpl AttributeListImpl}
- * helper class.</p>
- *
- * <p>An attribute list includes only attributes that have been
- * specified or defaulted: #IMPLIED attributes will not be included.</p>
- *
- * <p>There are two ways for the SAX application to obtain information
- * from the AttributeList. First, it can iterate through the entire
- * list:</p>
- *
- * <pre>
- * public void startElement (String name, AttributeList atts) {
- * for (int i = 0; i < atts.getLength(); i++) {
- * String name = atts.getName(i);
- * String type = atts.getType(i);
- * String value = atts.getValue(i);
- * [...]
- * }
- * }
- * </pre>
- *
- * <p>(Note that the result of getLength() will be zero if there
- * are no attributes.)
- *
- * <p>As an alternative, the application can request the value or
- * type of specific attributes:</p>
- *
- * <pre>
- * public void startElement (String name, AttributeList atts) {
- * String identifier = atts.getValue("id");
- * String label = atts.getValue("label");
- * [...]
- * }
- * </pre>
- *
- * @deprecated This interface has been replaced by the SAX2
- * {@link org.xml.sax.Attributes Attributes}
- * interface, which includes Namespace support.
- * @since SAX 1.0
- * @author David Megginson,
- * <a href="mailto:sax@megginson.com">sax@megginson.com</a>
- * @version 2.0
- * @see org.xml.sax.DocumentHandler#startElement startElement
- * @see org.xml.sax.helpers.AttributeListImpl AttributeListImpl
- */
-public interface AttributeList {
-
-
- ////////////////////////////////////////////////////////////////////
- // Iteration methods.
- ////////////////////////////////////////////////////////////////////
-
-
- /**
- * Return the number of attributes in this list.
- *
- * <p>The SAX parser may provide attributes in any
- * arbitrary order, regardless of the order in which they were
- * declared or specified. The number of attributes may be
- * zero.</p>
- *
- * @return The number of attributes in the list.
- */
- public abstract int getLength ();
-
-
- /**
- * Return the name of an attribute in this list (by position).
- *
- * <p>The names must be unique: the SAX parser shall not include the
- * same attribute twice. Attributes without values (those declared
- * #IMPLIED without a value specified in the start tag) will be
- * omitted from the list.</p>
- *
- * <p>If the attribute name has a namespace prefix, the prefix
- * will still be attached.</p>
- *
- * @param i The index of the attribute in the list (starting at 0).
- * @return The name of the indexed attribute, or null
- * if the index is out of range.
- * @see #getLength
- */
- public abstract String getName (int i);
-
-
- /**
- * Return the type of an attribute in the list (by position).
- *
- * <p>The attribute type is one of the strings "CDATA", "ID",
- * "IDREF", "IDREFS", "NMTOKEN", "NMTOKENS", "ENTITY", "ENTITIES",
- * or "NOTATION" (always in upper case).</p>
- *
- * <p>If the parser has not read a declaration for the attribute,
- * or if the parser does not report attribute types, then it must
- * return the value "CDATA" as stated in the XML 1.0 Recommentation
- * (clause 3.3.3, "Attribute-Value Normalization").</p>
- *
- * <p>For an enumerated attribute that is not a notation, the
- * parser will report the type as "NMTOKEN".</p>
- *
- * @param i The index of the attribute in the list (starting at 0).
- * @return The attribute type as a string, or
- * null if the index is out of range.
- * @see #getLength
- * @see #getType(java.lang.String)
- */
- public abstract String getType (int i);
-
-
- /**
- * Return the value of an attribute in the list (by position).
- *
- * <p>If the attribute value is a list of tokens (IDREFS,
- * ENTITIES, or NMTOKENS), the tokens will be concatenated
- * into a single string separated by whitespace.</p>
- *
- * @param i The index of the attribute in the list (starting at 0).
- * @return The attribute value as a string, or
- * null if the index is out of range.
- * @see #getLength
- * @see #getValue(java.lang.String)
- */
- public abstract String getValue (int i);
-
-
-
- ////////////////////////////////////////////////////////////////////
- // Lookup methods.
- ////////////////////////////////////////////////////////////////////
-
-
- /**
- * Return the type of an attribute in the list (by name).
- *
- * <p>The return value is the same as the return value for
- * getType(int).</p>
- *
- * <p>If the attribute name has a namespace prefix in the document,
- * the application must include the prefix here.</p>
- *
- * @param name The name of the attribute.
- * @return The attribute type as a string, or null if no
- * such attribute exists.
- * @see #getType(int)
- */
- public abstract String getType (String name);
-
-
- /**
- * Return the value of an attribute in the list (by name).
- *
- * <p>The return value is the same as the return value for
- * getValue(int).</p>
- *
- * <p>If the attribute name has a namespace prefix in the document,
- * the application must include the prefix here.</p>
- *
- * @param i The index of the attribute in the list.
- * @return The attribute value as a string, or null if
- * no such attribute exists.
- * @see #getValue(int)
- */
- public abstract String getValue (String name);
-
-}
-
-// end of AttributeList.java
+// SAX Attribute List Interface.
+// http://www.saxproject.org
+// No warranty; no copyright -- use this as you will.
+// $Id: AttributeList.java,v 1.3.2.3 2002/01/29 21:34:14 dbrownell Exp $
+
+package org.xml.sax;
+
+/**
+ * Interface for an element's attribute specifications.
+ *
+ * <blockquote>
+ * <em>This module, both source code and documentation, is in the
+ * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
+ * See <a href='http://www.saxproject.org'>http://www.saxproject.org</a>
+ * for further information.
+ * </blockquote>
+ *
+ * <p>This is the original SAX1 interface for reporting an element's
+ * attributes. Unlike the new {@link org.xml.sax.Attributes Attributes}
+ * interface, it does not support Namespace-related information.</p>
+ *
+ * <p>When an attribute list is supplied as part of a
+ * {@link org.xml.sax.DocumentHandler#startElement startElement}
+ * event, the list will return valid results only during the
+ * scope of the event; once the event handler returns control
+ * to the parser, the attribute list is invalid. To save a
+ * persistent copy of the attribute list, use the SAX1
+ * {@link org.xml.sax.helpers.AttributeListImpl AttributeListImpl}
+ * helper class.</p>
+ *
+ * <p>An attribute list includes only attributes that have been
+ * specified or defaulted: #IMPLIED attributes will not be included.</p>
+ *
+ * <p>There are two ways for the SAX application to obtain information
+ * from the AttributeList. First, it can iterate through the entire
+ * list:</p>
+ *
+ * <pre>
+ * public void startElement (String name, AttributeList atts) {
+ * for (int i = 0; i < atts.getLength(); i++) {
+ * String name = atts.getName(i);
+ * String type = atts.getType(i);
+ * String value = atts.getValue(i);
+ * [...]
+ * }
+ * }
+ * </pre>
+ *
+ * <p>(Note that the result of getLength() will be zero if there
+ * are no attributes.)
+ *
+ * <p>As an alternative, the application can request the value or
+ * type of specific attributes:</p>
+ *
+ * <pre>
+ * public void startElement (String name, AttributeList atts) {
+ * String identifier = atts.getValue("id");
+ * String label = atts.getValue("label");
+ * [...]
+ * }
+ * </pre>
+ *
+ * @deprecated This interface has been replaced by the SAX2
+ * {@link org.xml.sax.Attributes Attributes}
+ * interface, which includes Namespace support.
+ * @since SAX 1.0
+ * @author David Megginson
+ * @version 2.0.1 (sax2r2)
+ * @see org.xml.sax.DocumentHandler#startElement startElement
+ * @see org.xml.sax.helpers.AttributeListImpl AttributeListImpl
+ */
+public interface AttributeList {
+
+
+ ////////////////////////////////////////////////////////////////////
+ // Iteration methods.
+ ////////////////////////////////////////////////////////////////////
+
+
+ /**
+ * Return the number of attributes in this list.
+ *
+ * <p>The SAX parser may provide attributes in any
+ * arbitrary order, regardless of the order in which they were
+ * declared or specified. The number of attributes may be
+ * zero.</p>
+ *
+ * @return The number of attributes in the list.
+ */
+ public abstract int getLength ();
+
+
+ /**
+ * Return the name of an attribute in this list (by position).
+ *
+ * <p>The names must be unique: the SAX parser shall not include the
+ * same attribute twice. Attributes without values (those declared
+ * #IMPLIED without a value specified in the start tag) will be
+ * omitted from the list.</p>
+ *
+ * <p>If the attribute name has a namespace prefix, the prefix
+ * will still be attached.</p>
+ *
+ * @param i The index of the attribute in the list (starting at 0).
+ * @return The name of the indexed attribute, or null
+ * if the index is out of range.
+ * @see #getLength
+ */
+ public abstract String getName (int i);
+
+
+ /**
+ * Return the type of an attribute in the list (by position).
+ *
+ * <p>The attribute type is one of the strings "CDATA", "ID",
+ * "IDREF", "IDREFS", "NMTOKEN", "NMTOKENS", "ENTITY", "ENTITIES",
+ * or "NOTATION" (always in upper case).</p>
+ *
+ * <p>If the parser has not read a declaration for the attribute,
+ * or if the parser does not report attribute types, then it must
+ * return the value "CDATA" as stated in the XML 1.0 Recommentation
+ * (clause 3.3.3, "Attribute-Value Normalization").</p>
+ *
+ * <p>For an enumerated attribute that is not a notation, the
+ * parser will report the type as "NMTOKEN".</p>
+ *
+ * @param i The index of the attribute in the list (starting at 0).
+ * @return The attribute type as a string, or
+ * null if the index is out of range.
+ * @see #getLength
+ * @see #getType(java.lang.String)
+ */
+ public abstract String getType (int i);
+
+
+ /**
+ * Return the value of an attribute in the list (by position).
+ *
+ * <p>If the attribute value is a list of tokens (IDREFS,
+ * ENTITIES, or NMTOKENS), the tokens will be concatenated
+ * into a single string separated by whitespace.</p>
+ *
+ * @param i The index of the attribute in the list (starting at 0).
+ * @return The attribute value as a string, or
+ * null if the index is out of range.
+ * @see #getLength
+ * @see #getValue(java.lang.String)
+ */
+ public abstract String getValue (int i);
+
+
+
+ ////////////////////////////////////////////////////////////////////
+ // Lookup methods.
+ ////////////////////////////////////////////////////////////////////
+
+
+ /**
+ * Return the type of an attribute in the list (by name).
+ *
+ * <p>The return value is the same as the return value for
+ * getType(int).</p>
+ *
+ * <p>If the attribute name has a namespace prefix in the document,
+ * the application must include the prefix here.</p>
+ *
+ * @param name The name of the attribute.
+ * @return The attribute type as a string, or null if no
+ * such attribute exists.
+ * @see #getType(int)
+ */
+ public abstract String getType (String name);
+
+
+ /**
+ * Return the value of an attribute in the list (by name).
+ *
+ * <p>The return value is the same as the return value for
+ * getValue(int).</p>
+ *
+ * <p>If the attribute name has a namespace prefix in the document,
+ * the application must include the prefix here.</p>
+ *
+ * @param i The index of the attribute in the list.
+ * @return The attribute value as a string, or null if
+ * no such attribute exists.
+ * @see #getValue(int)
+ */
+ public abstract String getValue (String name);
+
+}
+
+// end of AttributeList.java
diff --git a/libjava/org/xml/sax/Attributes.java b/libjava/org/xml/sax/Attributes.java
index f10067a9288..251fe206a00 100644
--- a/libjava/org/xml/sax/Attributes.java
+++ b/libjava/org/xml/sax/Attributes.java
@@ -1,243 +1,252 @@
-// Attributes.java - attribute list with Namespace support
-// Written by David Megginson, sax@megginson.com
-// NO WARRANTY! This class is in the public domain.
-
-// $Id: Attributes.java,v 1.1 2000/10/02 02:43:16 sboag Exp $
-
-
-package org.xml.sax;
-
-
-/**
- * Interface for a list of XML attributes.
- *
- * <blockquote>
- * <em>This module, both source code and documentation, is in the
- * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
- * </blockquote>
- *
- * <p>This interface allows access to a list of attributes in
- * three different ways:</p>
- *
- * <ol>
- * <li>by attribute index;</li>
- * <li>by Namespace-qualified name; or</li>
- * <li>by qualified (prefixed) name.</li>
- * </ol>
- *
- * <p>The list will not contain attributes that were declared
- * #IMPLIED but not specified in the start tag. It will also not
- * contain attributes used as Namespace declarations (xmlns*) unless
- * the <code>http://xml.org/sax/features/namespace-prefixes</code>
- * feature is set to <var>true</var> (it is <var>false</var> by
- * default).</p>
- *
- * <p>If the namespace-prefixes feature (see above) is <var>false</var>,
- * access by qualified name may not be available; if the
- * <code>http://xml.org/sax/features/namespaces</code>
- * feature is <var>false</var>, access by Namespace-qualified names
- * may not be available.</p>
- *
- * <p>This interface replaces the now-deprecated SAX1 {@link
- * org.xml.sax.AttributeList AttributeList} interface, which does not
- * contain Namespace support. In addition to Namespace support, it
- * adds the <var>getIndex</var> methods (below).</p>
- *
- * <p>The order of attributes in the list is unspecified, and will
- * vary from implementation to implementation.</p>
- *
- * @since SAX 2.0
- * @author David Megginson,
- * <a href="mailto:sax@megginson.com">sax@megginson.com</a>
- * @version 2.0
- * @see org.xml.sax.helpers.AttributeListImpl
- */
-public interface Attributes
-{
-
-
- ////////////////////////////////////////////////////////////////////
- // Indexed access.
- ////////////////////////////////////////////////////////////////////
-
-
- /**
- * Return the number of attributes in the list.
- *
- * <p>Once you know the number of attributes, you can iterate
- * through the list.</p>
- *
- * @return The number of attributes in the list.
- * @see #getURI(int)
- * @see #getLocalName(int)
- * @see #getQName(int)
- * @see #getType(int)
- * @see #getValue(int)
- */
- public abstract int getLength ();
-
-
- /**
- * Look up an attribute's Namespace URI by index.
- *
- * @param index The attribute index (zero-based).
- * @return The Namespace URI, or the empty string if none
- * is available, or null if the index is out of
- * range.
- * @see #getLength
- */
- public abstract String getURI (int index);
-
-
- /**
- * Look up an attribute's local name by index.
- *
- * @param index The attribute index (zero-based).
- * @return The local name, or the empty string if Namespace
- * processing is not being performed, or null
- * if the index is out of range.
- * @see #getLength
- */
- public abstract String getLocalName (int index);
-
-
- /**
- * Look up an attribute's XML 1.0 qualified name by index.
- *
- * @param index The attribute index (zero-based).
- * @return The XML 1.0 qualified name, or the empty string
- * if none is available, or null if the index
- * is out of range.
- * @see #getLength
- */
- public abstract String getQName (int index);
-
-
- /**
- * Look up an attribute's type by index.
- *
- * <p>The attribute type is one of the strings "CDATA", "ID",
- * "IDREF", "IDREFS", "NMTOKEN", "NMTOKENS", "ENTITY", "ENTITIES",
- * or "NOTATION" (always in upper case).</p>
- *
- * <p>If the parser has not read a declaration for the attribute,
- * or if the parser does not report attribute types, then it must
- * return the value "CDATA" as stated in the XML 1.0 Recommentation
- * (clause 3.3.3, "Attribute-Value Normalization").</p>
- *
- * <p>For an enumerated attribute that is not a notation, the
- * parser will report the type as "NMTOKEN".</p>
- *
- * @param index The attribute index (zero-based).
- * @return The attribute's type as a string, or null if the
- * index is out of range.
- * @see #getLength
- */
- public abstract String getType (int index);
-
-
- /**
- * Look up an attribute's value by index.
- *
- * <p>If the attribute value is a list of tokens (IDREFS,
- * ENTITIES, or NMTOKENS), the tokens will be concatenated
- * into a single string with each token separated by a
- * single space.</p>
- *
- * @param index The attribute index (zero-based).
- * @return The attribute's value as a string, or null if the
- * index is out of range.
- * @see #getLength
- */
- public abstract String getValue (int index);
-
-
-
- ////////////////////////////////////////////////////////////////////
- // Name-based query.
- ////////////////////////////////////////////////////////////////////
-
-
- /**
- * Look up the index of an attribute by Namespace name.
- *
- * @param uri The Namespace URI, or the empty string if
- * the name has no Namespace URI.
- * @param localName The attribute's local name.
- * @return The index of the attribute, or -1 if it does not
- * appear in the list.
- */
- public int getIndex (String uri, String localPart);
-
-
- /**
- * Look up the index of an attribute by XML 1.0 qualified name.
- *
- * @param qName The qualified (prefixed) name.
- * @return The index of the attribute, or -1 if it does not
- * appear in the list.
- */
- public int getIndex (String qName);
-
-
- /**
- * Look up an attribute's type by Namespace name.
- *
- * <p>See {@link #getType(int) getType(int)} for a description
- * of the possible types.</p>
- *
- * @param uri The Namespace URI, or the empty String if the
- * name has no Namespace URI.
- * @param localName The local name of the attribute.
- * @return The attribute type as a string, or null if the
- * attribute is not in the list or if Namespace
- * processing is not being performed.
- */
- public abstract String getType (String uri, String localName);
-
-
- /**
- * Look up an attribute's type by XML 1.0 qualified name.
- *
- * <p>See {@link #getType(int) getType(int)} for a description
- * of the possible types.</p>
- *
- * @param qName The XML 1.0 qualified name.
- * @return The attribute type as a string, or null if the
- * attribute is not in the list or if qualified names
- * are not available.
- */
- public abstract String getType (String qName);
-
-
- /**
- * Look up an attribute's value by Namespace name.
- *
- * <p>See {@link #getValue(int) getValue(int)} for a description
- * of the possible values.</p>
- *
- * @param uri The Namespace URI, or the empty String if the
- * name has no Namespace URI.
- * @param localName The local name of the attribute.
- * @return The attribute value as a string, or null if the
- * attribute is not in the list.
- */
- public abstract String getValue (String uri, String localName);
-
-
- /**
- * Look up an attribute's value by XML 1.0 qualified name.
- *
- * <p>See {@link #getValue(int) getValue(int)} for a description
- * of the possible values.</p>
- *
- * @param qName The XML 1.0 qualified name.
- * @return The attribute value as a string, or null if the
- * attribute is not in the list or if qualified names
- * are not available.
- */
- public abstract String getValue (String qName);
-
-}
-
-// end of Attributes.java
+// Attributes.java - attribute list with Namespace support
+// http://www.saxproject.org
+// Written by David Megginson
+// NO WARRANTY! This class is in the public domain.
+
+// $Id: Attributes.java,v 1.5.2.4 2002/01/29 21:34:14 dbrownell Exp $
+
+
+package org.xml.sax;
+
+
+/**
+ * Interface for a list of XML attributes.
+ *
+ * <blockquote>
+ * <em>This module, both source code and documentation, is in the
+ * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
+ * See <a href='http://www.saxproject.org'>http://www.saxproject.org</a>
+ * for further information.
+ * </blockquote>
+ *
+ * <p>This interface allows access to a list of attributes in
+ * three different ways:</p>
+ *
+ * <ol>
+ * <li>by attribute index;</li>
+ * <li>by Namespace-qualified name; or</li>
+ * <li>by qualified (prefixed) name.</li>
+ * </ol>
+ *
+ * <p>The list will not contain attributes that were declared
+ * #IMPLIED but not specified in the start tag. It will also not
+ * contain attributes used as Namespace declarations (xmlns*) unless
+ * the <code>http://xml.org/sax/features/namespace-prefixes</code>
+ * feature is set to <var>true</var> (it is <var>false</var> by
+ * default).
+ * Because SAX2 conforms to the "Namespaces in XML" specification,
+ * it does not give namespace declaration attributes a namespace URI.
+ * Some other W3C specifications are in conflict with that, expecting
+ * these declarations to be in a namespace.
+ * Handler code may need to resolve that conflict.
+ * </p>
+ *
+ * <p>If the namespace-prefixes feature (see above) is <var>false</var>,
+ * access by qualified name may not be available; if the
+ * <code>http://xml.org/sax/features/namespaces</code>
+ * feature is <var>false</var>, access by Namespace-qualified names
+ * may not be available.</p>
+ *
+ * <p>This interface replaces the now-deprecated SAX1 {@link
+ * org.xml.sax.AttributeList AttributeList} interface, which does not
+ * contain Namespace support. In addition to Namespace support, it
+ * adds the <var>getIndex</var> methods (below).</p>
+ *
+ * <p>The order of attributes in the list is unspecified, and will
+ * vary from implementation to implementation.</p>
+ *
+ * @since SAX 2.0
+ * @author David Megginson
+ * @version 2.0.1 (sax2r2)
+ * @see org.xml.sax.helpers.AttributesImpl
+ * @see org.xml.sax.ext.DeclHandler#attributeDecl
+ */
+public interface Attributes
+{
+
+
+ ////////////////////////////////////////////////////////////////////
+ // Indexed access.
+ ////////////////////////////////////////////////////////////////////
+
+
+ /**
+ * Return the number of attributes in the list.
+ *
+ * <p>Once you know the number of attributes, you can iterate
+ * through the list.</p>
+ *
+ * @return The number of attributes in the list.
+ * @see #getURI(int)
+ * @see #getLocalName(int)
+ * @see #getQName(int)
+ * @see #getType(int)
+ * @see #getValue(int)
+ */
+ public abstract int getLength ();
+
+
+ /**
+ * Look up an attribute's Namespace URI by index.
+ *
+ * @param index The attribute index (zero-based).
+ * @return The Namespace URI, or the empty string if none
+ * is available, or null if the index is out of
+ * range.
+ * @see #getLength
+ */
+ public abstract String getURI (int index);
+
+
+ /**
+ * Look up an attribute's local name by index.
+ *
+ * @param index The attribute index (zero-based).
+ * @return The local name, or the empty string if Namespace
+ * processing is not being performed, or null
+ * if the index is out of range.
+ * @see #getLength
+ */
+ public abstract String getLocalName (int index);
+
+
+ /**
+ * Look up an attribute's XML 1.0 qualified name by index.
+ *
+ * @param index The attribute index (zero-based).
+ * @return The XML 1.0 qualified name, or the empty string
+ * if none is available, or null if the index
+ * is out of range.
+ * @see #getLength
+ */
+ public abstract String getQName (int index);
+
+
+ /**
+ * Look up an attribute's type by index.
+ *
+ * <p>The attribute type is one of the strings "CDATA", "ID",
+ * "IDREF", "IDREFS", "NMTOKEN", "NMTOKENS", "ENTITY", "ENTITIES",
+ * or "NOTATION" (always in upper case).</p>
+ *
+ * <p>If the parser has not read a declaration for the attribute,
+ * or if the parser does not report attribute types, then it must
+ * return the value "CDATA" as stated in the XML 1.0 Recommentation
+ * (clause 3.3.3, "Attribute-Value Normalization").</p>
+ *
+ * <p>For an enumerated attribute that is not a notation, the
+ * parser will report the type as "NMTOKEN".</p>
+ *
+ * @param index The attribute index (zero-based).
+ * @return The attribute's type as a string, or null if the
+ * index is out of range.
+ * @see #getLength
+ */
+ public abstract String getType (int index);
+
+
+ /**
+ * Look up an attribute's value by index.
+ *
+ * <p>If the attribute value is a list of tokens (IDREFS,
+ * ENTITIES, or NMTOKENS), the tokens will be concatenated
+ * into a single string with each token separated by a
+ * single space.</p>
+ *
+ * @param index The attribute index (zero-based).
+ * @return The attribute's value as a string, or null if the
+ * index is out of range.
+ * @see #getLength
+ */
+ public abstract String getValue (int index);
+
+
+
+ ////////////////////////////////////////////////////////////////////
+ // Name-based query.
+ ////////////////////////////////////////////////////////////////////
+
+
+ /**
+ * Look up the index of an attribute by Namespace name.
+ *
+ * @param uri The Namespace URI, or the empty string if
+ * the name has no Namespace URI.
+ * @param localName The attribute's local name.
+ * @return The index of the attribute, or -1 if it does not
+ * appear in the list.
+ */
+ public int getIndex (String uri, String localName);
+
+
+ /**
+ * Look up the index of an attribute by XML 1.0 qualified name.
+ *
+ * @param qName The qualified (prefixed) name.
+ * @return The index of the attribute, or -1 if it does not
+ * appear in the list.
+ */
+ public int getIndex (String qName);
+
+
+ /**
+ * Look up an attribute's type by Namespace name.
+ *
+ * <p>See {@link #getType(int) getType(int)} for a description
+ * of the possible types.</p>
+ *
+ * @param uri The Namespace URI, or the empty String if the
+ * name has no Namespace URI.
+ * @param localName The local name of the attribute.
+ * @return The attribute type as a string, or null if the
+ * attribute is not in the list or if Namespace
+ * processing is not being performed.
+ */
+ public abstract String getType (String uri, String localName);
+
+
+ /**
+ * Look up an attribute's type by XML 1.0 qualified name.
+ *
+ * <p>See {@link #getType(int) getType(int)} for a description
+ * of the possible types.</p>
+ *
+ * @param qName The XML 1.0 qualified name.
+ * @return The attribute type as a string, or null if the
+ * attribute is not in the list or if qualified names
+ * are not available.
+ */
+ public abstract String getType (String qName);
+
+
+ /**
+ * Look up an attribute's value by Namespace name.
+ *
+ * <p>See {@link #getValue(int) getValue(int)} for a description
+ * of the possible values.</p>
+ *
+ * @param uri The Namespace URI, or the empty String if the
+ * name has no Namespace URI.
+ * @param localName The local name of the attribute.
+ * @return The attribute value as a string, or null if the
+ * attribute is not in the list.
+ */
+ public abstract String getValue (String uri, String localName);
+
+
+ /**
+ * Look up an attribute's value by XML 1.0 qualified name.
+ *
+ * <p>See {@link #getValue(int) getValue(int)} for a description
+ * of the possible values.</p>
+ *
+ * @param qName The XML 1.0 qualified name.
+ * @return The attribute value as a string, or null if the
+ * attribute is not in the list or if qualified names
+ * are not available.
+ */
+ public abstract String getValue (String qName);
+
+}
+
+// end of Attributes.java
diff --git a/libjava/org/xml/sax/ContentHandler.java b/libjava/org/xml/sax/ContentHandler.java
index 0d84d0eae99..06462c51eec 100644
--- a/libjava/org/xml/sax/ContentHandler.java
+++ b/libjava/org/xml/sax/ContentHandler.java
@@ -1,374 +1,408 @@
-// ContentHandler.java - handle main document content.
-// Written by David Megginson, sax@megginson.com
-// NO WARRANTY! This class is in the public domain.
-
-// $Id: ContentHandler.java,v 1.1 2000/10/02 02:43:16 sboag Exp $
-
-package org.xml.sax;
-
-
-/**
- * Receive notification of the logical content of a document.
- *
- * <blockquote>
- * <em>This module, both source code and documentation, is in the
- * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
- * </blockquote>
- *
- * <p>This is the main interface that most SAX applications
- * implement: if the application needs to be informed of basic parsing
- * events, it implements this interface and registers an instance with
- * the SAX parser using the {@link org.xml.sax.XMLReader#setContentHandler
- * setContentHandler} method. The parser uses the instance to report
- * basic document-related events like the start and end of elements
- * and character data.</p>
- *
- * <p>The order of events in this interface is very important, and
- * mirrors the order of information in the document itself. For
- * example, all of an element's content (character data, processing
- * instructions, and/or subelements) will appear, in order, between
- * the startElement event and the corresponding endElement event.</p>
- *
- * <p>This interface is similar to the now-deprecated SAX 1.0
- * DocumentHandler interface, but it adds support for Namespaces
- * and for reporting skipped entities (in non-validating XML
- * processors).</p>
- *
- * <p>Implementors should note that there is also a Java class
- * {@link java.net.ContentHandler ContentHandler} in the java.net
- * package; that means that it's probably a bad idea to do</p>
- *
- * <blockquote>
- * import java.net.*;
- * import org.xml.sax.*;
- * </blockquote>
- *
- * <p>In fact, "import ...*" is usually a sign of sloppy programming
- * anyway, so the user should consider this a feature rather than a
- * bug.</p>
- *
- * @since SAX 2.0
- * @author David Megginson,
- * <a href="mailto:sax@megginson.com">sax@megginson.com</a>
- * @version 2.0
- * @see org.xml.sax.XMLReader
- * @see org.xml.sax.DTDHandler
- * @see org.xml.sax.ErrorHandler
- */
-public interface ContentHandler
-{
-
- /**
- * Receive an object for locating the origin of SAX document events.
- *
- * <p>SAX parsers are strongly encouraged (though not absolutely
- * required) to supply a locator: if it does so, it must supply
- * the locator to the application by invoking this method before
- * invoking any of the other methods in the ContentHandler
- * interface.</p>
- *
- * <p>The locator allows the application to determine the end
- * position of any document-related event, even if the parser is
- * not reporting an error. Typically, the application will
- * use this information for reporting its own errors (such as
- * character content that does not match an application's
- * business rules). The information returned by the locator
- * is probably not sufficient for use with a search engine.</p>
- *
- * <p>Note that the locator will return correct information only
- * during the invocation of the events in this interface. The
- * application should not attempt to use it at any other time.</p>
- *
- * @param locator An object that can return the location of
- * any SAX document event.
- * @see org.xml.sax.Locator
- */
- public void setDocumentLocator (Locator locator);
-
-
- /**
- * Receive notification of the beginning of a document.
- *
- * <p>The SAX parser will invoke this method only once, before any
- * other methods in this interface or in {@link org.xml.sax.DTDHandler
- * DTDHandler} (except for {@link #setDocumentLocator
- * setDocumentLocator}).</p>
- *
- * @exception org.xml.sax.SAXException Any SAX exception, possibly
- * wrapping another exception.
- * @see #endDocument
- */
- public void startDocument ()
- throws SAXException;
-
-
- /**
- * Receive notification of the end of a document.
- *
- * <p>The SAX parser will invoke this method only once, and it will
- * be the last method invoked during the parse. The parser shall
- * not invoke this method until it has either abandoned parsing
- * (because of an unrecoverable error) or reached the end of
- * input.</p>
- *
- * @exception org.xml.sax.SAXException Any SAX exception, possibly
- * wrapping another exception.
- * @see #startDocument
- */
- public void endDocument()
- throws SAXException;
-
-
- /**
- * Begin the scope of a prefix-URI Namespace mapping.
- *
- * <p>The information from this event is not necessary for
- * normal Namespace processing: the SAX XML reader will
- * automatically replace prefixes for element and attribute
- * names when the <code>http://xml.org/sax/features/namespaces</code>
- * feature is <var>true</var> (the default).</p>
- *
- * <p>There are cases, however, when applications need to
- * use prefixes in character data or in attribute values,
- * where they cannot safely be expanded automatically; the
- * start/endPrefixMapping event supplies the information
- * to the application to expand prefixes in those contexts
- * itself, if necessary.</p>
- *
- * <p>Note that start/endPrefixMapping events are not
- * guaranteed to be properly nested relative to each-other:
- * all startPrefixMapping events will occur before the
- * corresponding {@link #startElement startElement} event,
- * and all {@link #endPrefixMapping endPrefixMapping}
- * events will occur after the corresponding {@link #endElement
- * endElement} event, but their order is not otherwise
- * guaranteed.</p>
- *
- * <p>There should never be start/endPrefixMapping events for the
- * "xml" prefix, since it is predeclared and immutable.</p>
- *
- * @param prefix The Namespace prefix being declared.
- * @param uri The Namespace URI the prefix is mapped to.
- * @exception org.xml.sax.SAXException The client may throw
- * an exception during processing.
- * @see #endPrefixMapping
- * @see #startElement
- */
- public void startPrefixMapping (String prefix, String uri)
- throws SAXException;
-
-
- /**
- * End the scope of a prefix-URI mapping.
- *
- * <p>See {@link #startPrefixMapping startPrefixMapping} for
- * details. This event will always occur after the corresponding
- * {@link #endElement endElement} event, but the order of
- * {@link #endPrefixMapping endPrefixMapping} events is not otherwise
- * guaranteed.</p>
- *
- * @param prefix The prefix that was being mapping.
- * @exception org.xml.sax.SAXException The client may throw
- * an exception during processing.
- * @see #startPrefixMapping
- * @see #endElement
- */
- public void endPrefixMapping (String prefix)
- throws SAXException;
-
-
- /**
- * Receive notification of the beginning of an element.
- *
- * <p>The Parser will invoke this method at the beginning of every
- * element in the XML document; there will be a corresponding
- * {@link #endElement endElement} event for every startElement event
- * (even when the element is empty). All of the element's content will be
- * reported, in order, before the corresponding endElement
- * event.</p>
- *
- * <p>This event allows up to three name components for each
- * element:</p>
- *
- * <ol>
- * <li>the Namespace URI;</li>
- * <li>the local name; and</li>
- * <li>the qualified (prefixed) name.</li>
- * </ol>
- *
- * <p>Any or all of these may be provided, depending on the
- * values of the <var>http://xml.org/sax/features/namespaces</var>
- * and the <var>http://xml.org/sax/features/namespace-prefixes</var>
- * properties:</p>
- *
- * <ul>
- * <li>the Namespace URI and local name are required when
- * the namespaces property is <var>true</var> (the default), and are
- * optional when the namespaces property is <var>false</var> (if one is
- * specified, both must be);</li>
- * <li>the qualified name is required when the namespace-prefixes property
- * is <var>true</var>, and is optional when the namespace-prefixes property
- * is <var>false</var> (the default).</li>
- * </ul>
- *
- * <p>Note that the attribute list provided will contain only
- * attributes with explicit values (specified or defaulted):
- * #IMPLIED attributes will be omitted. The attribute list
- * will contain attributes used for Namespace declarations
- * (xmlns* attributes) only if the
- * <code>http://xml.org/sax/features/namespace-prefixes</code>
- * property is true (it is false by default, and support for a
- * true value is optional).</p>
- *
- * @param uri The Namespace URI, or the empty string if the
- * element has no Namespace URI or if Namespace
- * processing is not being performed.
- * @param localName The local name (without prefix), or the
- * empty string if Namespace processing is not being
- * performed.
- * @param qName The qualified name (with prefix), or the
- * empty string if qualified names are not available.
- * @param atts The attributes attached to the element. If
- * there are no attributes, it shall be an empty
- * Attributes object.
- * @exception org.xml.sax.SAXException Any SAX exception, possibly
- * wrapping another exception.
- * @see #endElement
- * @see org.xml.sax.Attributes
- */
- public void startElement (String namespaceURI, String localName,
- String qName, Attributes atts)
- throws SAXException;
-
-
- /**
- * Receive notification of the end of an element.
- *
- * <p>The SAX parser will invoke this method at the end of every
- * element in the XML document; there will be a corresponding
- * {@link #startElement startElement} event for every endElement
- * event (even when the element is empty).</p>
- *
- * <p>For information on the names, see startElement.</p>
- *
- * @param uri The Namespace URI, or the empty string if the
- * element has no Namespace URI or if Namespace
- * processing is not being performed.
- * @param localName The local name (without prefix), or the
- * empty string if Namespace processing is not being
- * performed.
- * @param qName The qualified XML 1.0 name (with prefix), or the
- * empty string if qualified names are not available.
- * @exception org.xml.sax.SAXException Any SAX exception, possibly
- * wrapping another exception.
- */
- public void endElement (String namespaceURI, String localName,
- String qName)
- throws SAXException;
-
-
- /**
- * Receive notification of character data.
- *
- * <p>The Parser will call this method to report each chunk of
- * character data. SAX parsers may return all contiguous character
- * data in a single chunk, or they may split it into several
- * chunks; however, all of the characters in any single event
- * must come from the same external entity so that the Locator
- * provides useful information.</p>
- *
- * <p>The application must not attempt to read from the array
- * outside of the specified range.</p>
- *
- * <p>Note that some parsers will report whitespace in element
- * content using the {@link #ignorableWhitespace ignorableWhitespace}
- * method rather than this one (validating parsers <em>must</em>
- * do so).</p>
- *
- * @param ch The characters from the XML document.
- * @param start The start position in the array.
- * @param length The number of characters to read from the array.
- * @exception org.xml.sax.SAXException Any SAX exception, possibly
- * wrapping another exception.
- * @see #ignorableWhitespace
- * @see org.xml.sax.Locator
- */
- public void characters (char ch[], int start, int length)
- throws SAXException;
-
-
- /**
- * Receive notification of ignorable whitespace in element content.
- *
- * <p>Validating Parsers must use this method to report each chunk
- * of whitespace in element content (see the W3C XML 1.0 recommendation,
- * section 2.10): non-validating parsers may also use this method
- * if they are capable of parsing and using content models.</p>
- *
- * <p>SAX parsers may return all contiguous whitespace in a single
- * chunk, or they may split it into several chunks; however, all of
- * the characters in any single event must come from the same
- * external entity, so that the Locator provides useful
- * information.</p>
- *
- * <p>The application must not attempt to read from the array
- * outside of the specified range.</p>
- *
- * @param ch The characters from the XML document.
- * @param start The start position in the array.
- * @param length The number of characters to read from the array.
- * @exception org.xml.sax.SAXException Any SAX exception, possibly
- * wrapping another exception.
- * @see #characters
- */
- public void ignorableWhitespace (char ch[], int start, int length)
- throws SAXException;
-
-
- /**
- * Receive notification of a processing instruction.
- *
- * <p>The Parser will invoke this method once for each processing
- * instruction found: note that processing instructions may occur
- * before or after the main document element.</p>
- *
- * <p>A SAX parser must never report an XML declaration (XML 1.0,
- * section 2.8) or a text declaration (XML 1.0, section 4.3.1)
- * using this method.</p>
- *
- * @param target The processing instruction target.
- * @param data The processing instruction data, or null if
- * none was supplied. The data does not include any
- * whitespace separating it from the target.
- * @exception org.xml.sax.SAXException Any SAX exception, possibly
- * wrapping another exception.
- */
- public void processingInstruction (String target, String data)
- throws SAXException;
-
-
- /**
- * Receive notification of a skipped entity.
- *
- * <p>The Parser will invoke this method once for each entity
- * skipped. Non-validating processors may skip entities if they
- * have not seen the declarations (because, for example, the
- * entity was declared in an external DTD subset). All processors
- * may skip external entities, depending on the values of the
- * <code>http://xml.org/sax/features/external-general-entities</code>
- * and the
- * <code>http://xml.org/sax/features/external-parameter-entities</code>
- * properties.</p>
- *
- * @param name The name of the skipped entity. If it is a
- * parameter entity, the name will begin with '%', and if
- * it is the external DTD subset, it will be the string
- * "[dtd]".
- * @exception org.xml.sax.SAXException Any SAX exception, possibly
- * wrapping another exception.
- */
- public void skippedEntity (String name)
- throws SAXException;
-}
-
-// end of ContentHandler.java
+// ContentHandler.java - handle main document content.
+// http://www.saxproject.org
+// Written by David Megginson
+// NO WARRANTY! This class is in the public domain.
+
+// $Id: ContentHandler.java,v 1.4.2.9 2002/01/29 21:34:14 dbrownell Exp $
+
+package org.xml.sax;
+
+
+/**
+ * Receive notification of the logical content of a document.
+ *
+ * <blockquote>
+ * <em>This module, both source code and documentation, is in the
+ * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
+ * See <a href='http://www.saxproject.org'>http://www.saxproject.org</a>
+ * for further information.
+ * </blockquote>
+ *
+ * <p>This is the main interface that most SAX applications
+ * implement: if the application needs to be informed of basic parsing
+ * events, it implements this interface and registers an instance with
+ * the SAX parser using the {@link org.xml.sax.XMLReader#setContentHandler
+ * setContentHandler} method. The parser uses the instance to report
+ * basic document-related events like the start and end of elements
+ * and character data.</p>
+ *
+ * <p>The order of events in this interface is very important, and
+ * mirrors the order of information in the document itself. For
+ * example, all of an element's content (character data, processing
+ * instructions, and/or subelements) will appear, in order, between
+ * the startElement event and the corresponding endElement event.</p>
+ *
+ * <p>This interface is similar to the now-deprecated SAX 1.0
+ * DocumentHandler interface, but it adds support for Namespaces
+ * and for reporting skipped entities (in non-validating XML
+ * processors).</p>
+ *
+ * <p>Implementors should note that there is also a Java class
+ * {@link java.net.ContentHandler ContentHandler} in the java.net
+ * package; that means that it's probably a bad idea to do</p>
+ *
+ * <blockquote>
+ * import java.net.*;
+ * import org.xml.sax.*;
+ * </blockquote>
+ *
+ * <p>In fact, "import ...*" is usually a sign of sloppy programming
+ * anyway, so the user should consider this a feature rather than a
+ * bug.</p>
+ *
+ * @since SAX 2.0
+ * @author David Megginson
+ * @version 2.0.1 (sax2r2)
+ * @see org.xml.sax.XMLReader
+ * @see org.xml.sax.DTDHandler
+ * @see org.xml.sax.ErrorHandler
+ */
+public interface ContentHandler
+{
+
+ /**
+ * Receive an object for locating the origin of SAX document events.
+ *
+ * <p>SAX parsers are strongly encouraged (though not absolutely
+ * required) to supply a locator: if it does so, it must supply
+ * the locator to the application by invoking this method before
+ * invoking any of the other methods in the ContentHandler
+ * interface.</p>
+ *
+ * <p>The locator allows the application to determine the end
+ * position of any document-related event, even if the parser is
+ * not reporting an error. Typically, the application will
+ * use this information for reporting its own errors (such as
+ * character content that does not match an application's
+ * business rules). The information returned by the locator
+ * is probably not sufficient for use with a search engine.</p>
+ *
+ * <p>Note that the locator will return correct information only
+ * during the invocation of the events in this interface. The
+ * application should not attempt to use it at any other time.</p>
+ *
+ * @param locator An object that can return the location of
+ * any SAX document event.
+ * @see org.xml.sax.Locator
+ */
+ public void setDocumentLocator (Locator locator);
+
+
+ /**
+ * Receive notification of the beginning of a document.
+ *
+ * <p>The SAX parser will invoke this method only once, before any
+ * other event callbacks (except for {@link #setDocumentLocator
+ * setDocumentLocator}).</p>
+ *
+ * @exception org.xml.sax.SAXException Any SAX exception, possibly
+ * wrapping another exception.
+ * @see #endDocument
+ */
+ public void startDocument ()
+ throws SAXException;
+
+
+ /**
+ * Receive notification of the end of a document.
+ *
+ * <p>The SAX parser will invoke this method only once, and it will
+ * be the last method invoked during the parse. The parser shall
+ * not invoke this method until it has either abandoned parsing
+ * (because of an unrecoverable error) or reached the end of
+ * input.</p>
+ *
+ * @exception org.xml.sax.SAXException Any SAX exception, possibly
+ * wrapping another exception.
+ * @see #startDocument
+ */
+ public void endDocument()
+ throws SAXException;
+
+
+ /**
+ * Begin the scope of a prefix-URI Namespace mapping.
+ *
+ * <p>The information from this event is not necessary for
+ * normal Namespace processing: the SAX XML reader will
+ * automatically replace prefixes for element and attribute
+ * names when the <code>http://xml.org/sax/features/namespaces</code>
+ * feature is <var>true</var> (the default).</p>
+ *
+ * <p>There are cases, however, when applications need to
+ * use prefixes in character data or in attribute values,
+ * where they cannot safely be expanded automatically; the
+ * start/endPrefixMapping event supplies the information
+ * to the application to expand prefixes in those contexts
+ * itself, if necessary.</p>
+ *
+ * <p>Note that start/endPrefixMapping events are not
+ * guaranteed to be properly nested relative to each other:
+ * all startPrefixMapping events will occur immediately before the
+ * corresponding {@link #startElement startElement} event,
+ * and all {@link #endPrefixMapping endPrefixMapping}
+ * events will occur immediately after the corresponding
+ * {@link #endElement endElement} event,
+ * but their order is not otherwise
+ * guaranteed.</p>
+ *
+ * <p>There should never be start/endPrefixMapping events for the
+ * "xml" prefix, since it is predeclared and immutable.</p>
+ *
+ * @param prefix The Namespace prefix being declared.
+ * An empty string is used for the default element namespace,
+ * which has no prefix.
+ * @param uri The Namespace URI the prefix is mapped to.
+ * @exception org.xml.sax.SAXException The client may throw
+ * an exception during processing.
+ * @see #endPrefixMapping
+ * @see #startElement
+ */
+ public void startPrefixMapping (String prefix, String uri)
+ throws SAXException;
+
+
+ /**
+ * End the scope of a prefix-URI mapping.
+ *
+ * <p>See {@link #startPrefixMapping startPrefixMapping} for
+ * details. These events will always occur immediately after the
+ * corresponding {@link #endElement endElement} event, but the order of
+ * {@link #endPrefixMapping endPrefixMapping} events is not otherwise
+ * guaranteed.</p>
+ *
+ * @param prefix The prefix that was being mapping.
+ * This is the empty string when a default mapping scope ends.
+ * @exception org.xml.sax.SAXException The client may throw
+ * an exception during processing.
+ * @see #startPrefixMapping
+ * @see #endElement
+ */
+ public void endPrefixMapping (String prefix)
+ throws SAXException;
+
+
+ /**
+ * Receive notification of the beginning of an element.
+ *
+ * <p>The Parser will invoke this method at the beginning of every
+ * element in the XML document; there will be a corresponding
+ * {@link #endElement endElement} event for every startElement event
+ * (even when the element is empty). All of the element's content will be
+ * reported, in order, before the corresponding endElement
+ * event.</p>
+ *
+ * <p>This event allows up to three name components for each
+ * element:</p>
+ *
+ * <ol>
+ * <li>the Namespace URI;</li>
+ * <li>the local name; and</li>
+ * <li>the qualified (prefixed) name.</li>
+ * </ol>
+ *
+ * <p>Any or all of these may be provided, depending on the
+ * values of the <var>http://xml.org/sax/features/namespaces</var>
+ * and the <var>http://xml.org/sax/features/namespace-prefixes</var>
+ * properties:</p>
+ *
+ * <ul>
+ * <li>the Namespace URI and local name are required when
+ * the namespaces property is <var>true</var> (the default), and are
+ * optional when the namespaces property is <var>false</var> (if one is
+ * specified, both must be);</li>
+ * <li>the qualified name is required when the namespace-prefixes property
+ * is <var>true</var>, and is optional when the namespace-prefixes property
+ * is <var>false</var> (the default).</li>
+ * </ul>
+ *
+ * <p>Note that the attribute list provided will contain only
+ * attributes with explicit values (specified or defaulted):
+ * #IMPLIED attributes will be omitted. The attribute list
+ * will contain attributes used for Namespace declarations
+ * (xmlns* attributes) only if the
+ * <code>http://xml.org/sax/features/namespace-prefixes</code>
+ * property is true (it is false by default, and support for a
+ * true value is optional).</p>
+ *
+ * <p>Like {@link #characters characters()}, attribute values may have
+ * characters that need more than one <code>char</code> value. </p>
+ *
+ * @param uri The Namespace URI, or the empty string if the
+ * element has no Namespace URI or if Namespace
+ * processing is not being performed.
+ * @param localName The local name (without prefix), or the
+ * empty string if Namespace processing is not being
+ * performed.
+ * @param qName The qualified name (with prefix), or the
+ * empty string if qualified names are not available.
+ * @param atts The attributes attached to the element. If
+ * there are no attributes, it shall be an empty
+ * Attributes object.
+ * @exception org.xml.sax.SAXException Any SAX exception, possibly
+ * wrapping another exception.
+ * @see #endElement
+ * @see org.xml.sax.Attributes
+ */
+ public void startElement (String uri, String localName,
+ String qName, Attributes atts)
+ throws SAXException;
+
+
+ /**
+ * Receive notification of the end of an element.
+ *
+ * <p>The SAX parser will invoke this method at the end of every
+ * element in the XML document; there will be a corresponding
+ * {@link #startElement startElement} event for every endElement
+ * event (even when the element is empty).</p>
+ *
+ * <p>For information on the names, see startElement.</p>
+ *
+ * @param uri The Namespace URI, or the empty string if the
+ * element has no Namespace URI or if Namespace
+ * processing is not being performed.
+ * @param localName The local name (without prefix), or the
+ * empty string if Namespace processing is not being
+ * performed.
+ * @param qName The qualified XML 1.0 name (with prefix), or the
+ * empty string if qualified names are not available.
+ * @exception org.xml.sax.SAXException Any SAX exception, possibly
+ * wrapping another exception.
+ */
+ public void endElement (String uri, String localName,
+ String qName)
+ throws SAXException;
+
+
+ /**
+ * Receive notification of character data.
+ *
+ * <p>The Parser will call this method to report each chunk of
+ * character data. SAX parsers may return all contiguous character
+ * data in a single chunk, or they may split it into several
+ * chunks; however, all of the characters in any single event
+ * must come from the same external entity so that the Locator
+ * provides useful information.</p>
+ *
+ * <p>The application must not attempt to read from the array
+ * outside of the specified range.</p>
+ *
+ * <p>Individual characters may consist of more than one Java
+ * <code>char</code> value. There are two important cases where this
+ * happens, because characters can't be represented in just sixteen bits.
+ * In one case, characters are represented in a <em>Surrogate Pair</em>,
+ * using two special Unicode values. Such characters are in the so-called
+ * "Astral Planes", with a code point above U+FFFF. A second case involves
+ * composite characters, such as a base character combining with one or
+ * more accent characters. </p>
+ *
+ * <p> Your code should not assume that algorithms using
+ * <code>char</code>-at-a-time idioms will be working in character
+ * units; in some cases they will split characters. This is relevant
+ * wherever XML permits arbitrary characters, such as attribute values,
+ * processing instruction data, and comments as well as in data reported
+ * from this method. It's also generally relevant whenever Java code
+ * manipulates internationalized text; the issue isn't unique to XML.</p>
+ *
+ * <p>Note that some parsers will report whitespace in element
+ * content using the {@link #ignorableWhitespace ignorableWhitespace}
+ * method rather than this one (validating parsers <em>must</em>
+ * do so).</p>
+ *
+ * @param ch The characters from the XML document.
+ * @param start The start position in the array.
+ * @param length The number of characters to read from the array.
+ * @exception org.xml.sax.SAXException Any SAX exception, possibly
+ * wrapping another exception.
+ * @see #ignorableWhitespace
+ * @see org.xml.sax.Locator
+ */
+ public void characters (char ch[], int start, int length)
+ throws SAXException;
+
+
+ /**
+ * Receive notification of ignorable whitespace in element content.
+ *
+ * <p>Validating Parsers must use this method to report each chunk
+ * of whitespace in element content (see the W3C XML 1.0 recommendation,
+ * section 2.10): non-validating parsers may also use this method
+ * if they are capable of parsing and using content models.</p>
+ *
+ * <p>SAX parsers may return all contiguous whitespace in a single
+ * chunk, or they may split it into several chunks; however, all of
+ * the characters in any single event must come from the same
+ * external entity, so that the Locator provides useful
+ * information.</p>
+ *
+ * <p>The application must not attempt to read from the array
+ * outside of the specified range.</p>
+ *
+ * @param ch The characters from the XML document.
+ * @param start The start position in the array.
+ * @param length The number of characters to read from the array.
+ * @exception org.xml.sax.SAXException Any SAX exception, possibly
+ * wrapping another exception.
+ * @see #characters
+ */
+ public void ignorableWhitespace (char ch[], int start, int length)
+ throws SAXException;
+
+
+ /**
+ * Receive notification of a processing instruction.
+ *
+ * <p>The Parser will invoke this method once for each processing
+ * instruction found: note that processing instructions may occur
+ * before or after the main document element.</p>
+ *
+ * <p>A SAX parser must never report an XML declaration (XML 1.0,
+ * section 2.8) or a text declaration (XML 1.0, section 4.3.1)
+ * using this method.</p>
+ *
+ * <p>Like {@link #characters characters()}, processing instruction
+ * data may have characters that need more than one <code>char</code>
+ * value. </p>
+ *
+ * @param target The processing instruction target.
+ * @param data The processing instruction data, or null if
+ * none was supplied. The data does not include any
+ * whitespace separating it from the target.
+ * @exception org.xml.sax.SAXException Any SAX exception, possibly
+ * wrapping another exception.
+ */
+ public void processingInstruction (String target, String data)
+ throws SAXException;
+
+
+ /**
+ * Receive notification of a skipped entity.
+ * This is not called for entity references within markup constructs
+ * such as element start tags or markup declarations. (The XML
+ * recommendation requires reporting skipped external entities.
+ * SAX also reports internal entity expansion/non-expansion, except
+ * within markup constructs.)
+ *
+ * <p>The Parser will invoke this method each time the entity is
+ * skipped. Non-validating processors may skip entities if they
+ * have not seen the declarations (because, for example, the
+ * entity was declared in an external DTD subset). All processors
+ * may skip external entities, depending on the values of the
+ * <code>http://xml.org/sax/features/external-general-entities</code>
+ * and the
+ * <code>http://xml.org/sax/features/external-parameter-entities</code>
+ * properties.</p>
+ *
+ * @param name The name of the skipped entity. If it is a
+ * parameter entity, the name will begin with '%', and if
+ * it is the external DTD subset, it will be the string
+ * "[dtd]".
+ * @exception org.xml.sax.SAXException Any SAX exception, possibly
+ * wrapping another exception.
+ */
+ public void skippedEntity (String name)
+ throws SAXException;
+}
+
+// end of ContentHandler.java
diff --git a/libjava/org/xml/sax/DTDHandler.java b/libjava/org/xml/sax/DTDHandler.java
index 509a0069ba8..ee84bb24c45 100644
--- a/libjava/org/xml/sax/DTDHandler.java
+++ b/libjava/org/xml/sax/DTDHandler.java
@@ -1,108 +1,117 @@
-// SAX DTD handler.
-// No warranty; no copyright -- use this as you will.
-// $Id: DTDHandler.java,v 1.1 2000/10/02 02:43:17 sboag Exp $
-
-package org.xml.sax;
-
-/**
- * Receive notification of basic DTD-related events.
- *
- * <blockquote>
- * <em>This module, both source code and documentation, is in the
- * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
- * </blockquote>
- *
- * <p>If a SAX application needs information about notations and
- * unparsed entities, then the application implements this
- * interface and registers an instance with the SAX parser using
- * the parser's setDTDHandler method. The parser uses the
- * instance to report notation and unparsed entity declarations to
- * the application.</p>
- *
- * <p>Note that this interface includes only those DTD events that
- * the XML recommendation <em>requires</em> processors to report:
- * notation and unparsed entity declarations.</p>
- *
- * <p>The SAX parser may report these events in any order, regardless
- * of the order in which the notations and unparsed entities were
- * declared; however, all DTD events must be reported after the
- * document handler's startDocument event, and before the first
- * startElement event.</p>
- *
- * <p>It is up to the application to store the information for
- * future use (perhaps in a hash table or object tree).
- * If the application encounters attributes of type "NOTATION",
- * "ENTITY", or "ENTITIES", it can use the information that it
- * obtained through this interface to find the entity and/or
- * notation corresponding with the attribute value.</p>
- *
- * @since SAX 1.0
- * @author David Megginson,
- * <a href="mailto:sax@megginson.com">sax@megginson.com</a>
- * @version 2.0
- * @see org.xml.sax.Parser#setDTDHandler
- * @see org.xml.sax.HandlerBase
- */
-public interface DTDHandler {
-
-
- /**
- * Receive notification of a notation declaration event.
- *
- * <p>It is up to the application to record the notation for later
- * reference, if necessary.</p>
- *
- * <p>At least one of publicId and systemId must be non-null.
- * If a system identifier is present, and it is a URL, the SAX
- * parser must resolve it fully before passing it to the
- * application through this event.</p>
- *
- * <p>There is no guarantee that the notation declaration will be
- * reported before any unparsed entities that use it.</p>
- *
- * @param name The notation name.
- * @param publicId The notation's public identifier, or null if
- * none was given.
- * @param systemId The notation's system identifier, or null if
- * none was given.
- * @exception org.xml.sax.SAXException Any SAX exception, possibly
- * wrapping another exception.
- * @see #unparsedEntityDecl
- * @see org.xml.sax.AttributeList
- */
- public abstract void notationDecl (String name,
- String publicId,
- String systemId)
- throws SAXException;
-
-
- /**
- * Receive notification of an unparsed entity declaration event.
- *
- * <p>Note that the notation name corresponds to a notation
- * reported by the {@link #notationDecl notationDecl} event.
- * It is up to the application to record the entity for later
- * reference, if necessary.</p>
- *
- * <p>If the system identifier is a URL, the parser must resolve it
- * fully before passing it to the application.</p>
- *
- * @exception org.xml.sax.SAXException Any SAX exception, possibly
- * wrapping another exception.
- * @param name The unparsed entity's name.
- * @param publicId The entity's public identifier, or null if none
- * was given.
- * @param systemId The entity's system identifier.
- * @param notation name The name of the associated notation.
- * @see #notationDecl
- * @see org.xml.sax.AttributeList
- */
- public abstract void unparsedEntityDecl (String name,
- String publicId,
- String systemId,
- String notationName)
- throws SAXException;
-
-}
-
-// end of DTDHandler.java
+// SAX DTD handler.
+// http://www.saxproject.org
+// No warranty; no copyright -- use this as you will.
+// $Id: DTDHandler.java,v 1.5.2.4 2002/01/29 21:34:14 dbrownell Exp $
+
+package org.xml.sax;
+
+/**
+ * Receive notification of basic DTD-related events.
+ *
+ * <blockquote>
+ * <em>This module, both source code and documentation, is in the
+ * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
+ * See <a href='http://www.saxproject.org'>http://www.saxproject.org</a>
+ * for further information.
+ * </blockquote>
+ *
+ * <p>If a SAX application needs information about notations and
+ * unparsed entities, then the application implements this
+ * interface and registers an instance with the SAX parser using
+ * the parser's setDTDHandler method. The parser uses the
+ * instance to report notation and unparsed entity declarations to
+ * the application.</p>
+ *
+ * <p>Note that this interface includes only those DTD events that
+ * the XML recommendation <em>requires</em> processors to report:
+ * notation and unparsed entity declarations.</p>
+ *
+ * <p>The SAX parser may report these events in any order, regardless
+ * of the order in which the notations and unparsed entities were
+ * declared; however, all DTD events must be reported after the
+ * document handler's startDocument event, and before the first
+ * startElement event.
+ * (If the {@link org.xml.sax.ext.LexicalHandler LexicalHandler} is
+ * used, these events must also be reported before the endDTD event.)
+ * </p>
+ *
+ * <p>It is up to the application to store the information for
+ * future use (perhaps in a hash table or object tree).
+ * If the application encounters attributes of type "NOTATION",
+ * "ENTITY", or "ENTITIES", it can use the information that it
+ * obtained through this interface to find the entity and/or
+ * notation corresponding with the attribute value.</p>
+ *
+ * @since SAX 1.0
+ * @author David Megginson
+ * @version 2.0.1 (sax2r2)
+ * @see org.xml.sax.XMLReader#setDTDHandler
+ */
+public interface DTDHandler {
+
+
+ /**
+ * Receive notification of a notation declaration event.
+ *
+ * <p>It is up to the application to record the notation for later
+ * reference, if necessary;
+ * notations may appear as attribute values and in unparsed entity
+ * declarations, and are sometime used with processing instruction
+ * target names.</p>
+ *
+ * <p>At least one of publicId and systemId must be non-null.
+ * If a system identifier is present, and it is a URL, the SAX
+ * parser must resolve it fully before passing it to the
+ * application through this event.</p>
+ *
+ * <p>There is no guarantee that the notation declaration will be
+ * reported before any unparsed entities that use it.</p>
+ *
+ * @param name The notation name.
+ * @param publicId The notation's public identifier, or null if
+ * none was given.
+ * @param systemId The notation's system identifier, or null if
+ * none was given.
+ * @exception org.xml.sax.SAXException Any SAX exception, possibly
+ * wrapping another exception.
+ * @see #unparsedEntityDecl
+ * @see org.xml.sax.Attributes
+ */
+ public abstract void notationDecl (String name,
+ String publicId,
+ String systemId)
+ throws SAXException;
+
+
+ /**
+ * Receive notification of an unparsed entity declaration event.
+ *
+ * <p>Note that the notation name corresponds to a notation
+ * reported by the {@link #notationDecl notationDecl} event.
+ * It is up to the application to record the entity for later
+ * reference, if necessary;
+ * unparsed entities may appear as attribute values.
+ * </p>
+ *
+ * <p>If the system identifier is a URL, the parser must resolve it
+ * fully before passing it to the application.</p>
+ *
+ * @exception org.xml.sax.SAXException Any SAX exception, possibly
+ * wrapping another exception.
+ * @param name The unparsed entity's name.
+ * @param publicId The entity's public identifier, or null if none
+ * was given.
+ * @param systemId The entity's system identifier.
+ * @param notationName The name of the associated notation.
+ * @see #notationDecl
+ * @see org.xml.sax.Attributes
+ */
+ public abstract void unparsedEntityDecl (String name,
+ String publicId,
+ String systemId,
+ String notationName)
+ throws SAXException;
+
+}
+
+// end of DTDHandler.java
diff --git a/libjava/org/xml/sax/DocumentHandler.java b/libjava/org/xml/sax/DocumentHandler.java
index be0a189c45b..10c07b2f627 100644
--- a/libjava/org/xml/sax/DocumentHandler.java
+++ b/libjava/org/xml/sax/DocumentHandler.java
@@ -1,230 +1,232 @@
-// SAX document handler.
-// No warranty; no copyright -- use this as you will.
-// $Id: DocumentHandler.java,v 1.1 2000/10/02 02:43:17 sboag Exp $
-
-package org.xml.sax;
-
-/**
- * Receive notification of general document events.
- *
- * <blockquote>
- * <em>This module, both source code and documentation, is in the
- * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
- * </blockquote>
- *
- * <p>This was the main event-handling interface for SAX1; in
- * SAX2, it has been replaced by {@link org.xml.sax.ContentHandler
- * ContentHandler}, which provides Namespace support and reporting
- * of skipped entities. This interface is included in SAX2 only
- * to support legacy SAX1 applications.</p>
- *
- * <p>The order of events in this interface is very important, and
- * mirrors the order of information in the document itself. For
- * example, all of an element's content (character data, processing
- * instructions, and/or subelements) will appear, in order, between
- * the startElement event and the corresponding endElement event.</p>
- *
- * <p>Application writers who do not want to implement the entire
- * interface can derive a class from HandlerBase, which implements
- * the default functionality; parser writers can instantiate
- * HandlerBase to obtain a default handler. The application can find
- * the location of any document event using the Locator interface
- * supplied by the Parser through the setDocumentLocator method.</p>
- *
- * @deprecated This interface has been replaced by the SAX2
- * {@link org.xml.sax.ContentHandler ContentHandler}
- * interface, which includes Namespace support.
- * @since SAX 1.0
- * @author David Megginson,
- * <a href="mailto:sax@megginson.com">sax@megginson.com</a>
- * @version 2.0
- * @see org.xml.sax.Parser#setDocumentHandler
- * @see org.xml.sax.Locator
- * @see org.xml.sax.HandlerBase
- */
-public interface DocumentHandler {
-
-
- /**
- * Receive an object for locating the origin of SAX document events.
- *
- * <p>SAX parsers are strongly encouraged (though not absolutely
- * required) to supply a locator: if it does so, it must supply
- * the locator to the application by invoking this method before
- * invoking any of the other methods in the DocumentHandler
- * interface.</p>
- *
- * <p>The locator allows the application to determine the end
- * position of any document-related event, even if the parser is
- * not reporting an error. Typically, the application will
- * use this information for reporting its own errors (such as
- * character content that does not match an application's
- * business rules). The information returned by the locator
- * is probably not sufficient for use with a search engine.</p>
- *
- * <p>Note that the locator will return correct information only
- * during the invocation of the events in this interface. The
- * application should not attempt to use it at any other time.</p>
- *
- * @param locator An object that can return the location of
- * any SAX document event.
- * @see org.xml.sax.Locator
- */
- public abstract void setDocumentLocator (Locator locator);
-
-
- /**
- * Receive notification of the beginning of a document.
- *
- * <p>The SAX parser will invoke this method only once, before any
- * other methods in this interface or in DTDHandler (except for
- * setDocumentLocator).</p>
- *
- * @exception org.xml.sax.SAXException Any SAX exception, possibly
- * wrapping another exception.
- */
- public abstract void startDocument ()
- throws SAXException;
-
-
- /**
- * Receive notification of the end of a document.
- *
- * <p>The SAX parser will invoke this method only once, and it will
- * be the last method invoked during the parse. The parser shall
- * not invoke this method until it has either abandoned parsing
- * (because of an unrecoverable error) or reached the end of
- * input.</p>
- *
- * @exception org.xml.sax.SAXException Any SAX exception, possibly
- * wrapping another exception.
- */
- public abstract void endDocument ()
- throws SAXException;
-
-
- /**
- * Receive notification of the beginning of an element.
- *
- * <p>The Parser will invoke this method at the beginning of every
- * element in the XML document; there will be a corresponding
- * endElement() event for every startElement() event (even when the
- * element is empty). All of the element's content will be
- * reported, in order, before the corresponding endElement()
- * event.</p>
- *
- * <p>If the element name has a namespace prefix, the prefix will
- * still be attached. Note that the attribute list provided will
- * contain only attributes with explicit values (specified or
- * defaulted): #IMPLIED attributes will be omitted.</p>
- *
- * @param name The element type name.
- * @param atts The attributes attached to the element, if any.
- * @exception org.xml.sax.SAXException Any SAX exception, possibly
- * wrapping another exception.
- * @see #endElement
- * @see org.xml.sax.AttributeList
- */
- public abstract void startElement (String name, AttributeList atts)
- throws SAXException;
-
-
- /**
- * Receive notification of the end of an element.
- *
- * <p>The SAX parser will invoke this method at the end of every
- * element in the XML document; there will be a corresponding
- * startElement() event for every endElement() event (even when the
- * element is empty).</p>
- *
- * <p>If the element name has a namespace prefix, the prefix will
- * still be attached to the name.</p>
- *
- * @param name The element type name
- * @exception org.xml.sax.SAXException Any SAX exception, possibly
- * wrapping another exception.
- */
- public abstract void endElement (String name)
- throws SAXException;
-
-
- /**
- * Receive notification of character data.
- *
- * <p>The Parser will call this method to report each chunk of
- * character data. SAX parsers may return all contiguous character
- * data in a single chunk, or they may split it into several
- * chunks; however, all of the characters in any single event
- * must come from the same external entity, so that the Locator
- * provides useful information.</p>
- *
- * <p>The application must not attempt to read from the array
- * outside of the specified range.</p>
- *
- * <p>Note that some parsers will report whitespace using the
- * ignorableWhitespace() method rather than this one (validating
- * parsers must do so).</p>
- *
- * @param ch The characters from the XML document.
- * @param start The start position in the array.
- * @param length The number of characters to read from the array.
- * @exception org.xml.sax.SAXException Any SAX exception, possibly
- * wrapping another exception.
- * @see #ignorableWhitespace
- * @see org.xml.sax.Locator
- */
- public abstract void characters (char ch[], int start, int length)
- throws SAXException;
-
-
- /**
- * Receive notification of ignorable whitespace in element content.
- *
- * <p>Validating Parsers must use this method to report each chunk
- * of ignorable whitespace (see the W3C XML 1.0 recommendation,
- * section 2.10): non-validating parsers may also use this method
- * if they are capable of parsing and using content models.</p>
- *
- * <p>SAX parsers may return all contiguous whitespace in a single
- * chunk, or they may split it into several chunks; however, all of
- * the characters in any single event must come from the same
- * external entity, so that the Locator provides useful
- * information.</p>
- *
- * <p>The application must not attempt to read from the array
- * outside of the specified range.</p>
- *
- * @param ch The characters from the XML document.
- * @param start The start position in the array.
- * @param length The number of characters to read from the array.
- * @exception org.xml.sax.SAXException Any SAX exception, possibly
- * wrapping another exception.
- * @see #characters
- */
- public abstract void ignorableWhitespace (char ch[], int start, int length)
- throws SAXException;
-
-
- /**
- * Receive notification of a processing instruction.
- *
- * <p>The Parser will invoke this method once for each processing
- * instruction found: note that processing instructions may occur
- * before or after the main document element.</p>
- *
- * <p>A SAX parser should never report an XML declaration (XML 1.0,
- * section 2.8) or a text declaration (XML 1.0, section 4.3.1)
- * using this method.</p>
- *
- * @param target The processing instruction target.
- * @param data The processing instruction data, or null if
- * none was supplied.
- * @exception org.xml.sax.SAXException Any SAX exception, possibly
- * wrapping another exception.
- */
- public abstract void processingInstruction (String target, String data)
- throws SAXException;
-
-}
-
-// end of DocumentHandler.java
+// SAX document handler.
+// http://www.saxproject.org
+// No warranty; no copyright -- use this as you will.
+// $Id: DocumentHandler.java,v 1.3.2.3 2002/01/29 21:34:14 dbrownell Exp $
+
+package org.xml.sax;
+
+/**
+ * Receive notification of general document events.
+ *
+ * <blockquote>
+ * <em>This module, both source code and documentation, is in the
+ * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
+ * See <a href='http://www.saxproject.org'>http://www.saxproject.org</a>
+ * for further information.
+ * </blockquote>
+ *
+ * <p>This was the main event-handling interface for SAX1; in
+ * SAX2, it has been replaced by {@link org.xml.sax.ContentHandler
+ * ContentHandler}, which provides Namespace support and reporting
+ * of skipped entities. This interface is included in SAX2 only
+ * to support legacy SAX1 applications.</p>
+ *
+ * <p>The order of events in this interface is very important, and
+ * mirrors the order of information in the document itself. For
+ * example, all of an element's content (character data, processing
+ * instructions, and/or subelements) will appear, in order, between
+ * the startElement event and the corresponding endElement event.</p>
+ *
+ * <p>Application writers who do not want to implement the entire
+ * interface can derive a class from HandlerBase, which implements
+ * the default functionality; parser writers can instantiate
+ * HandlerBase to obtain a default handler. The application can find
+ * the location of any document event using the Locator interface
+ * supplied by the Parser through the setDocumentLocator method.</p>
+ *
+ * @deprecated This interface has been replaced by the SAX2
+ * {@link org.xml.sax.ContentHandler ContentHandler}
+ * interface, which includes Namespace support.
+ * @since SAX 1.0
+ * @author David Megginson
+ * @version 2.0.1 (sax2r2)
+ * @see org.xml.sax.Parser#setDocumentHandler
+ * @see org.xml.sax.Locator
+ * @see org.xml.sax.HandlerBase
+ */
+public interface DocumentHandler {
+
+
+ /**
+ * Receive an object for locating the origin of SAX document events.
+ *
+ * <p>SAX parsers are strongly encouraged (though not absolutely
+ * required) to supply a locator: if it does so, it must supply
+ * the locator to the application by invoking this method before
+ * invoking any of the other methods in the DocumentHandler
+ * interface.</p>
+ *
+ * <p>The locator allows the application to determine the end
+ * position of any document-related event, even if the parser is
+ * not reporting an error. Typically, the application will
+ * use this information for reporting its own errors (such as
+ * character content that does not match an application's
+ * business rules). The information returned by the locator
+ * is probably not sufficient for use with a search engine.</p>
+ *
+ * <p>Note that the locator will return correct information only
+ * during the invocation of the events in this interface. The
+ * application should not attempt to use it at any other time.</p>
+ *
+ * @param locator An object that can return the location of
+ * any SAX document event.
+ * @see org.xml.sax.Locator
+ */
+ public abstract void setDocumentLocator (Locator locator);
+
+
+ /**
+ * Receive notification of the beginning of a document.
+ *
+ * <p>The SAX parser will invoke this method only once, before any
+ * other methods in this interface or in DTDHandler (except for
+ * setDocumentLocator).</p>
+ *
+ * @exception org.xml.sax.SAXException Any SAX exception, possibly
+ * wrapping another exception.
+ */
+ public abstract void startDocument ()
+ throws SAXException;
+
+
+ /**
+ * Receive notification of the end of a document.
+ *
+ * <p>The SAX parser will invoke this method only once, and it will
+ * be the last method invoked during the parse. The parser shall
+ * not invoke this method until it has either abandoned parsing
+ * (because of an unrecoverable error) or reached the end of
+ * input.</p>
+ *
+ * @exception org.xml.sax.SAXException Any SAX exception, possibly
+ * wrapping another exception.
+ */
+ public abstract void endDocument ()
+ throws SAXException;
+
+
+ /**
+ * Receive notification of the beginning of an element.
+ *
+ * <p>The Parser will invoke this method at the beginning of every
+ * element in the XML document; there will be a corresponding
+ * endElement() event for every startElement() event (even when the
+ * element is empty). All of the element's content will be
+ * reported, in order, before the corresponding endElement()
+ * event.</p>
+ *
+ * <p>If the element name has a namespace prefix, the prefix will
+ * still be attached. Note that the attribute list provided will
+ * contain only attributes with explicit values (specified or
+ * defaulted): #IMPLIED attributes will be omitted.</p>
+ *
+ * @param name The element type name.
+ * @param atts The attributes attached to the element, if any.
+ * @exception org.xml.sax.SAXException Any SAX exception, possibly
+ * wrapping another exception.
+ * @see #endElement
+ * @see org.xml.sax.AttributeList
+ */
+ public abstract void startElement (String name, AttributeList atts)
+ throws SAXException;
+
+
+ /**
+ * Receive notification of the end of an element.
+ *
+ * <p>The SAX parser will invoke this method at the end of every
+ * element in the XML document; there will be a corresponding
+ * startElement() event for every endElement() event (even when the
+ * element is empty).</p>
+ *
+ * <p>If the element name has a namespace prefix, the prefix will
+ * still be attached to the name.</p>
+ *
+ * @param name The element type name
+ * @exception org.xml.sax.SAXException Any SAX exception, possibly
+ * wrapping another exception.
+ */
+ public abstract void endElement (String name)
+ throws SAXException;
+
+
+ /**
+ * Receive notification of character data.
+ *
+ * <p>The Parser will call this method to report each chunk of
+ * character data. SAX parsers may return all contiguous character
+ * data in a single chunk, or they may split it into several
+ * chunks; however, all of the characters in any single event
+ * must come from the same external entity, so that the Locator
+ * provides useful information.</p>
+ *
+ * <p>The application must not attempt to read from the array
+ * outside of the specified range.</p>
+ *
+ * <p>Note that some parsers will report whitespace using the
+ * ignorableWhitespace() method rather than this one (validating
+ * parsers must do so).</p>
+ *
+ * @param ch The characters from the XML document.
+ * @param start The start position in the array.
+ * @param length The number of characters to read from the array.
+ * @exception org.xml.sax.SAXException Any SAX exception, possibly
+ * wrapping another exception.
+ * @see #ignorableWhitespace
+ * @see org.xml.sax.Locator
+ */
+ public abstract void characters (char ch[], int start, int length)
+ throws SAXException;
+
+
+ /**
+ * Receive notification of ignorable whitespace in element content.
+ *
+ * <p>Validating Parsers must use this method to report each chunk
+ * of ignorable whitespace (see the W3C XML 1.0 recommendation,
+ * section 2.10): non-validating parsers may also use this method
+ * if they are capable of parsing and using content models.</p>
+ *
+ * <p>SAX parsers may return all contiguous whitespace in a single
+ * chunk, or they may split it into several chunks; however, all of
+ * the characters in any single event must come from the same
+ * external entity, so that the Locator provides useful
+ * information.</p>
+ *
+ * <p>The application must not attempt to read from the array
+ * outside of the specified range.</p>
+ *
+ * @param ch The characters from the XML document.
+ * @param start The start position in the array.
+ * @param length The number of characters to read from the array.
+ * @exception org.xml.sax.SAXException Any SAX exception, possibly
+ * wrapping another exception.
+ * @see #characters
+ */
+ public abstract void ignorableWhitespace (char ch[], int start, int length)
+ throws SAXException;
+
+
+ /**
+ * Receive notification of a processing instruction.
+ *
+ * <p>The Parser will invoke this method once for each processing
+ * instruction found: note that processing instructions may occur
+ * before or after the main document element.</p>
+ *
+ * <p>A SAX parser should never report an XML declaration (XML 1.0,
+ * section 2.8) or a text declaration (XML 1.0, section 4.3.1)
+ * using this method.</p>
+ *
+ * @param target The processing instruction target.
+ * @param data The processing instruction data, or null if
+ * none was supplied.
+ * @exception org.xml.sax.SAXException Any SAX exception, possibly
+ * wrapping another exception.
+ */
+ public abstract void processingInstruction (String target, String data)
+ throws SAXException;
+
+}
+
+// end of DocumentHandler.java
diff --git a/libjava/org/xml/sax/EntityResolver.java b/libjava/org/xml/sax/EntityResolver.java
index 3270471453a..acc365aad63 100644
--- a/libjava/org/xml/sax/EntityResolver.java
+++ b/libjava/org/xml/sax/EntityResolver.java
@@ -1,110 +1,119 @@
-// SAX entity resolver.
-// No warranty; no copyright -- use this as you will.
-// $Id: EntityResolver.java,v 1.1 2000/10/02 02:43:17 sboag Exp $
-
-package org.xml.sax;
-
-import java.io.IOException;
-
-
-/**
- * Basic interface for resolving entities.
- *
- * <blockquote>
- * <em>This module, both source code and documentation, is in the
- * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
- * </blockquote>
- *
- * <p>If a SAX application needs to implement customized handling
- * for external entities, it must implement this interface and
- * register an instance with the SAX driver using the
- * {@link org.xml.sax.XMLReader#setEntityResolver setEntityResolver}
- * method.</p>
- *
- * <p>The XML reader will then allow the application to intercept any
- * external entities (including the external DTD subset and external
- * parameter entities, if any) before including them.</p>
- *
- * <p>Many SAX applications will not need to implement this interface,
- * but it will be especially useful for applications that build
- * XML documents from databases or other specialised input sources,
- * or for applications that use URI types other than URLs.</p>
- *
- * <p>The following resolver would provide the application
- * with a special character stream for the entity with the system
- * identifier "http://www.myhost.com/today":</p>
- *
- * <pre>
- * import org.xml.sax.EntityResolver;
- * import org.xml.sax.InputSource;
- *
- * public class MyResolver implements EntityResolver {
- * public InputSource resolveEntity (String publicId, String systemId)
- * {
- * if (systemId.equals("http://www.myhost.com/today")) {
- * // return a special input source
- * MyReader reader = new MyReader();
- * return new InputSource(reader);
- * } else {
- * // use the default behaviour
- * return null;
- * }
- * }
- * }
- * </pre>
- *
- * <p>The application can also use this interface to redirect system
- * identifiers to local URIs or to look up replacements in a catalog
- * (possibly by using the public identifier).</p>
- *
- * @since SAX 1.0
- * @author David Megginson,
- * <a href="mailto:sax@megginson.com">sax@megginson.com</a>
- * @version 2.0
- * @see org.xml.sax.Parser#setEntityResolver
- * @see org.xml.sax.InputSource
- */
-public interface EntityResolver {
-
-
- /**
- * Allow the application to resolve external entities.
- *
- * <p>The Parser will call this method before opening any external
- * entity except the top-level document entity (including the
- * external DTD subset, external entities referenced within the
- * DTD, and external entities referenced within the document
- * element): the application may request that the parser resolve
- * the entity itself, that it use an alternative URI, or that it
- * use an entirely different input source.</p>
- *
- * <p>Application writers can use this method to redirect external
- * system identifiers to secure and/or local URIs, to look up
- * public identifiers in a catalogue, or to read an entity from a
- * database or other input source (including, for example, a dialog
- * box).</p>
- *
- * <p>If the system identifier is a URL, the SAX parser must
- * resolve it fully before reporting it to the application.</p>
- *
- * @param publicId The public identifier of the external entity
- * being referenced, or null if none was supplied.
- * @param systemId The system identifier of the external entity
- * being referenced.
- * @return An InputSource object describing the new input source,
- * or null to request that the parser open a regular
- * URI connection to the system identifier.
- * @exception org.xml.sax.SAXException Any SAX exception, possibly
- * wrapping another exception.
- * @exception java.io.IOException A Java-specific IO exception,
- * possibly the result of creating a new InputStream
- * or Reader for the InputSource.
- * @see org.xml.sax.InputSource
- */
- public abstract InputSource resolveEntity (String publicId,
- String systemId)
- throws SAXException, IOException;
-
-}
-
-// end of EntityResolver.java
+// SAX entity resolver.
+// http://www.saxproject.org
+// No warranty; no copyright -- use this as you will.
+// $Id: EntityResolver.java,v 1.7.2.3 2002/01/29 21:34:14 dbrownell Exp $
+
+package org.xml.sax;
+
+import java.io.IOException;
+
+
+/**
+ * Basic interface for resolving entities.
+ *
+ * <blockquote>
+ * <em>This module, both source code and documentation, is in the
+ * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
+ * See <a href='http://www.saxproject.org'>http://www.saxproject.org</a>
+ * for further information.
+ * </blockquote>
+ *
+ * <p>If a SAX application needs to implement customized handling
+ * for external entities, it must implement this interface and
+ * register an instance with the SAX driver using the
+ * {@link org.xml.sax.XMLReader#setEntityResolver setEntityResolver}
+ * method.</p>
+ *
+ * <p>The XML reader will then allow the application to intercept any
+ * external entities (including the external DTD subset and external
+ * parameter entities, if any) before including them.</p>
+ *
+ * <p>Many SAX applications will not need to implement this interface,
+ * but it will be especially useful for applications that build
+ * XML documents from databases or other specialised input sources,
+ * or for applications that use URI types other than URLs.</p>
+ *
+ * <p>The following resolver would provide the application
+ * with a special character stream for the entity with the system
+ * identifier "http://www.myhost.com/today":</p>
+ *
+ * <pre>
+ * import org.xml.sax.EntityResolver;
+ * import org.xml.sax.InputSource;
+ *
+ * public class MyResolver implements EntityResolver {
+ * public InputSource resolveEntity (String publicId, String systemId)
+ * {
+ * if (systemId.equals("http://www.myhost.com/today")) {
+ * // return a special input source
+ * MyReader reader = new MyReader();
+ * return new InputSource(reader);
+ * } else {
+ * // use the default behaviour
+ * return null;
+ * }
+ * }
+ * }
+ * </pre>
+ *
+ * <p>The application can also use this interface to redirect system
+ * identifiers to local URIs or to look up replacements in a catalog
+ * (possibly by using the public identifier).</p>
+ *
+ * @since SAX 1.0
+ * @author David Megginson
+ * @version 2.0.1 (sax2r2)
+ * @see org.xml.sax.XMLReader#setEntityResolver
+ * @see org.xml.sax.InputSource
+ */
+public interface EntityResolver {
+
+
+ /**
+ * Allow the application to resolve external entities.
+ *
+ * <p>The parser will call this method before opening any external
+ * entity except the top-level document entity. Such entities include
+ * the external DTD subset and external parameter entities referenced
+ * within the DTD (in either case, only if the parser reads external
+ * parameter entities), and external general entities referenced
+ * within the document element (if the parser reads external general
+ * entities). The application may request that the parser locate
+ * the entity itself, that it use an alternative URI, or that it
+ * use data provided by the application (as a character or byte
+ * input stream).</p>
+ *
+ * <p>Application writers can use this method to redirect external
+ * system identifiers to secure and/or local URIs, to look up
+ * public identifiers in a catalogue, or to read an entity from a
+ * database or other input source (including, for example, a dialog
+ * box). Neither XML nor SAX specifies a preferred policy for using
+ * public or system IDs to resolve resources. However, SAX specifies
+ * how to interpret any InputSource returned by this method, and that
+ * if none is returned, then the system ID will be dereferenced as
+ * a URL. </p>
+ *
+ * <p>If the system identifier is a URL, the SAX parser must
+ * resolve it fully before reporting it to the application.</p>
+ *
+ * @param publicId The public identifier of the external entity
+ * being referenced, or null if none was supplied.
+ * @param systemId The system identifier of the external entity
+ * being referenced.
+ * @return An InputSource object describing the new input source,
+ * or null to request that the parser open a regular
+ * URI connection to the system identifier.
+ * @exception org.xml.sax.SAXException Any SAX exception, possibly
+ * wrapping another exception.
+ * @exception java.io.IOException A Java-specific IO exception,
+ * possibly the result of creating a new InputStream
+ * or Reader for the InputSource.
+ * @see org.xml.sax.InputSource
+ */
+ public abstract InputSource resolveEntity (String publicId,
+ String systemId)
+ throws SAXException, IOException;
+
+}
+
+// end of EntityResolver.java
diff --git a/libjava/org/xml/sax/ErrorHandler.java b/libjava/org/xml/sax/ErrorHandler.java
index 8b3e090cd6d..e82302093ad 100644
--- a/libjava/org/xml/sax/ErrorHandler.java
+++ b/libjava/org/xml/sax/ErrorHandler.java
@@ -1,123 +1,125 @@
-// SAX error handler.
-// No warranty; no copyright -- use this as you will.
-// $Id: ErrorHandler.java,v 1.1 2000/10/02 02:43:17 sboag Exp $
-
-package org.xml.sax;
-
-
-/**
- * Basic interface for SAX error handlers.
- *
- * <blockquote>
- * <em>This module, both source code and documentation, is in the
- * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
- * </blockquote>
- *
- * <p>If a SAX application needs to implement customized error
- * handling, it must implement this interface and then register an
- * instance with the XML reader using the
- * {@link org.xml.sax.XMLReader#setErrorHandler setErrorHandler}
- * method. The parser will then report all errors and warnings
- * through this interface.</p>
- *
- * <p><strong>WARNING:</strong> If an application does <em>not</em>
- * register an ErrorHandler, XML parsing errors will go unreported
- * and bizarre behaviour may result.</p>
- *
- * <p>For XML processing errors, a SAX driver must use this interface
- * instead of throwing an exception: it is up to the application
- * to decide whether to throw an exception for different types of
- * errors and warnings. Note, however, that there is no requirement that
- * the parser continue to provide useful information after a call to
- * {@link #fatalError fatalError} (in other words, a SAX driver class
- * could catch an exception and report a fatalError).</p>
- *
- * @since SAX 1.0
- * @author David Megginson,
- * <a href="mailto:sax@megginson.com">sax@megginson.com</a>
- * @version 2.0
- * @see org.xml.sax.Parser#setErrorHandler
- * @see org.xml.sax.SAXParseException
- */
-public interface ErrorHandler {
-
-
- /**
- * Receive notification of a warning.
- *
- * <p>SAX parsers will use this method to report conditions that
- * are not errors or fatal errors as defined by the XML 1.0
- * recommendation. The default behaviour is to take no action.</p>
- *
- * <p>The SAX parser must continue to provide normal parsing events
- * after invoking this method: it should still be possible for the
- * application to process the document through to the end.</p>
- *
- * <p>Filters may use this method to report other, non-XML warnings
- * as well.</p>
- *
- * @param exception The warning information encapsulated in a
- * SAX parse exception.
- * @exception org.xml.sax.SAXException Any SAX exception, possibly
- * wrapping another exception.
- * @see org.xml.sax.SAXParseException
- */
- public abstract void warning (SAXParseException exception)
- throws SAXException;
-
-
- /**
- * Receive notification of a recoverable error.
- *
- * <p>This corresponds to the definition of "error" in section 1.2
- * of the W3C XML 1.0 Recommendation. For example, a validating
- * parser would use this callback to report the violation of a
- * validity constraint. The default behaviour is to take no
- * action.</p>
- *
- * <p>The SAX parser must continue to provide normal parsing events
- * after invoking this method: it should still be possible for the
- * application to process the document through to the end. If the
- * application cannot do so, then the parser should report a fatal
- * error even if the XML 1.0 recommendation does not require it to
- * do so.</p>
- *
- * <p>Filters may use this method to report other, non-XML errors
- * as well.</p>
- *
- * @param exception The error information encapsulated in a
- * SAX parse exception.
- * @exception org.xml.sax.SAXException Any SAX exception, possibly
- * wrapping another exception.
- * @see org.xml.sax.SAXParseException
- */
- public abstract void error (SAXParseException exception)
- throws SAXException;
-
-
- /**
- * Receive notification of a non-recoverable error.
- *
- * <p>This corresponds to the definition of "fatal error" in
- * section 1.2 of the W3C XML 1.0 Recommendation. For example, a
- * parser would use this callback to report the violation of a
- * well-formedness constraint.</p>
- *
- * <p>The application must assume that the document is unusable
- * after the parser has invoked this method, and should continue
- * (if at all) only for the sake of collecting addition error
- * messages: in fact, SAX parsers are free to stop reporting any
- * other events once this method has been invoked.</p>
- *
- * @param exception The error information encapsulated in a
- * SAX parse exception.
- * @exception org.xml.sax.SAXException Any SAX exception, possibly
- * wrapping another exception.
- * @see org.xml.sax.SAXParseException
- */
- public abstract void fatalError (SAXParseException exception)
- throws SAXException;
-
-}
-
-// end of ErrorHandler.java
+// SAX error handler.
+// http://www.saxproject.org
+// No warranty; no copyright -- use this as you will.
+// $Id: ErrorHandler.java,v 1.4.2.3 2002/01/29 21:34:14 dbrownell Exp $
+
+package org.xml.sax;
+
+
+/**
+ * Basic interface for SAX error handlers.
+ *
+ * <blockquote>
+ * <em>This module, both source code and documentation, is in the
+ * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
+ * See <a href='http://www.saxproject.org'>http://www.saxproject.org</a>
+ * for further information.
+ * </blockquote>
+ *
+ * <p>If a SAX application needs to implement customized error
+ * handling, it must implement this interface and then register an
+ * instance with the XML reader using the
+ * {@link org.xml.sax.XMLReader#setErrorHandler setErrorHandler}
+ * method. The parser will then report all errors and warnings
+ * through this interface.</p>
+ *
+ * <p><strong>WARNING:</strong> If an application does <em>not</em>
+ * register an ErrorHandler, XML parsing errors will go unreported
+ * and bizarre behaviour may result.</p>
+ *
+ * <p>For XML processing errors, a SAX driver must use this interface
+ * instead of throwing an exception: it is up to the application
+ * to decide whether to throw an exception for different types of
+ * errors and warnings. Note, however, that there is no requirement that
+ * the parser continue to provide useful information after a call to
+ * {@link #fatalError fatalError} (in other words, a SAX driver class
+ * could catch an exception and report a fatalError).</p>
+ *
+ * @since SAX 1.0
+ * @author David Megginson
+ * @version 2.0.1 (sax2r2)
+ * @see org.xml.sax.XMLReader#setErrorHandler
+ * @see org.xml.sax.SAXParseException
+ */
+public interface ErrorHandler {
+
+
+ /**
+ * Receive notification of a warning.
+ *
+ * <p>SAX parsers will use this method to report conditions that
+ * are not errors or fatal errors as defined by the XML 1.0
+ * recommendation. The default behaviour is to take no action.</p>
+ *
+ * <p>The SAX parser must continue to provide normal parsing events
+ * after invoking this method: it should still be possible for the
+ * application to process the document through to the end.</p>
+ *
+ * <p>Filters may use this method to report other, non-XML warnings
+ * as well.</p>
+ *
+ * @param exception The warning information encapsulated in a
+ * SAX parse exception.
+ * @exception org.xml.sax.SAXException Any SAX exception, possibly
+ * wrapping another exception.
+ * @see org.xml.sax.SAXParseException
+ */
+ public abstract void warning (SAXParseException exception)
+ throws SAXException;
+
+
+ /**
+ * Receive notification of a recoverable error.
+ *
+ * <p>This corresponds to the definition of "error" in section 1.2
+ * of the W3C XML 1.0 Recommendation. For example, a validating
+ * parser would use this callback to report the violation of a
+ * validity constraint. The default behaviour is to take no
+ * action.</p>
+ *
+ * <p>The SAX parser must continue to provide normal parsing events
+ * after invoking this method: it should still be possible for the
+ * application to process the document through to the end. If the
+ * application cannot do so, then the parser should report a fatal
+ * error even if the XML 1.0 recommendation does not require it to
+ * do so.</p>
+ *
+ * <p>Filters may use this method to report other, non-XML errors
+ * as well.</p>
+ *
+ * @param exception The error information encapsulated in a
+ * SAX parse exception.
+ * @exception org.xml.sax.SAXException Any SAX exception, possibly
+ * wrapping another exception.
+ * @see org.xml.sax.SAXParseException
+ */
+ public abstract void error (SAXParseException exception)
+ throws SAXException;
+
+
+ /**
+ * Receive notification of a non-recoverable error.
+ *
+ * <p>This corresponds to the definition of "fatal error" in
+ * section 1.2 of the W3C XML 1.0 Recommendation. For example, a
+ * parser would use this callback to report the violation of a
+ * well-formedness constraint.</p>
+ *
+ * <p>The application must assume that the document is unusable
+ * after the parser has invoked this method, and should continue
+ * (if at all) only for the sake of collecting addition error
+ * messages: in fact, SAX parsers are free to stop reporting any
+ * other events once this method has been invoked.</p>
+ *
+ * @param exception The error information encapsulated in a
+ * SAX parse exception.
+ * @exception org.xml.sax.SAXException Any SAX exception, possibly
+ * wrapping another exception.
+ * @see org.xml.sax.SAXParseException
+ */
+ public abstract void fatalError (SAXParseException exception)
+ throws SAXException;
+
+}
+
+// end of ErrorHandler.java
diff --git a/libjava/org/xml/sax/HandlerBase.java b/libjava/org/xml/sax/HandlerBase.java
index 34a8f7675d9..42c3a07e0e8 100644
--- a/libjava/org/xml/sax/HandlerBase.java
+++ b/libjava/org/xml/sax/HandlerBase.java
@@ -1,368 +1,370 @@
-// SAX default handler base class.
-// No warranty; no copyright -- use this as you will.
-// $Id: HandlerBase.java,v 1.1 2000/10/02 02:43:17 sboag Exp $
-
-package org.xml.sax;
-
-/**
- * Default base class for handlers.
- *
- * <blockquote>
- * <em>This module, both source code and documentation, is in the
- * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
- * </blockquote>
- *
- * <p>This class implements the default behaviour for four SAX1
- * interfaces: EntityResolver, DTDHandler, DocumentHandler,
- * and ErrorHandler. It is now obsolete, but is included in SAX2 to
- * support legacy SAX1 applications. SAX2 applications should use
- * the {@link org.xml.sax.helpers.DefaultHandler DefaultHandler}
- * class instead.</p>
- *
- * <p>Application writers can extend this class when they need to
- * implement only part of an interface; parser writers can
- * instantiate this class to provide default handlers when the
- * application has not supplied its own.</p>
- *
- * <p>Note that the use of this class is optional.</p>
- *
- * @deprecated This class works with the deprecated
- * {@link org.xml.sax.DocumentHandler DocumentHandler}
- * interface. It has been replaced by the SAX2
- * {@link org.xml.sax.helpers.DefaultHandler DefaultHandler}
- * class.
- * @since SAX 1.0
- * @author David Megginson,
- * <a href="mailto:sax@megginson.com">sax@megginson.com</a>
- * @version 2.0
- * @see org.xml.sax.EntityResolver
- * @see org.xml.sax.DTDHandler
- * @see org.xml.sax.DocumentHandler
- * @see org.xml.sax.ErrorHandler
- */
-public class HandlerBase
- implements EntityResolver, DTDHandler, DocumentHandler, ErrorHandler
-{
-
-
- ////////////////////////////////////////////////////////////////////
- // Default implementation of the EntityResolver interface.
- ////////////////////////////////////////////////////////////////////
-
- /**
- * Resolve an external entity.
- *
- * <p>Always return null, so that the parser will use the system
- * identifier provided in the XML document. This method implements
- * the SAX default behaviour: application writers can override it
- * in a subclass to do special translations such as catalog lookups
- * or URI redirection.</p>
- *
- * @param publicId The public identifier, or null if none is
- * available.
- * @param systemId The system identifier provided in the XML
- * document.
- * @return The new input source, or null to require the
- * default behaviour.
- * @exception org.xml.sax.SAXException Any SAX exception, possibly
- * wrapping another exception.
- * @see org.xml.sax.EntityResolver#resolveEntity
- */
- public InputSource resolveEntity (String publicId, String systemId)
- throws SAXException
- {
- return null;
- }
-
-
-
- ////////////////////////////////////////////////////////////////////
- // Default implementation of DTDHandler interface.
- ////////////////////////////////////////////////////////////////////
-
-
- /**
- * Receive notification of a notation declaration.
- *
- * <p>By default, do nothing. Application writers may override this
- * method in a subclass if they wish to keep track of the notations
- * declared in a document.</p>
- *
- * @param name The notation name.
- * @param publicId The notation public identifier, or null if not
- * available.
- * @param systemId The notation system identifier.
- * @see org.xml.sax.DTDHandler#notationDecl
- */
- public void notationDecl (String name, String publicId, String systemId)
- {
- // no op
- }
-
-
- /**
- * Receive notification of an unparsed entity declaration.
- *
- * <p>By default, do nothing. Application writers may override this
- * method in a subclass to keep track of the unparsed entities
- * declared in a document.</p>
- *
- * @param name The entity name.
- * @param publicId The entity public identifier, or null if not
- * available.
- * @param systemId The entity system identifier.
- * @param notationName The name of the associated notation.
- * @see org.xml.sax.DTDHandler#unparsedEntityDecl
- */
- public void unparsedEntityDecl (String name, String publicId,
- String systemId, String notationName)
- {
- // no op
- }
-
-
-
- ////////////////////////////////////////////////////////////////////
- // Default implementation of DocumentHandler interface.
- ////////////////////////////////////////////////////////////////////
-
-
- /**
- * Receive a Locator object for document events.
- *
- * <p>By default, do nothing. Application writers may override this
- * method in a subclass if they wish to store the locator for use
- * with other document events.</p>
- *
- * @param locator A locator for all SAX document events.
- * @see org.xml.sax.DocumentHandler#setDocumentLocator
- * @see org.xml.sax.Locator
- */
- public void setDocumentLocator (Locator locator)
- {
- // no op
- }
-
-
- /**
- * Receive notification of the beginning of the document.
- *
- * <p>By default, do nothing. Application writers may override this
- * method in a subclass to take specific actions at the beginning
- * of a document (such as allocating the root node of a tree or
- * creating an output file).</p>
- *
- * @exception org.xml.sax.SAXException Any SAX exception, possibly
- * wrapping another exception.
- * @see org.xml.sax.DocumentHandler#startDocument
- */
- public void startDocument ()
- throws SAXException
- {
- // no op
- }
-
-
- /**
- * Receive notification of the end of the document.
- *
- * <p>By default, do nothing. Application writers may override this
- * method in a subclass to take specific actions at the beginning
- * of a document (such as finalising a tree or closing an output
- * file).</p>
- *
- * @exception org.xml.sax.SAXException Any SAX exception, possibly
- * wrapping another exception.
- * @see org.xml.sax.DocumentHandler#endDocument
- */
- public void endDocument ()
- throws SAXException
- {
- // no op
- }
-
-
- /**
- * Receive notification of the start of an element.
- *
- * <p>By default, do nothing. Application writers may override this
- * method in a subclass to take specific actions at the start of
- * each element (such as allocating a new tree node or writing
- * output to a file).</p>
- *
- * @param name The element type name.
- * @param attributes The specified or defaulted attributes.
- * @exception org.xml.sax.SAXException Any SAX exception, possibly
- * wrapping another exception.
- * @see org.xml.sax.DocumentHandler#startElement
- */
- public void startElement (String name, AttributeList attributes)
- throws SAXException
- {
- // no op
- }
-
-
- /**
- * Receive notification of the end of an element.
- *
- * <p>By default, do nothing. Application writers may override this
- * method in a subclass to take specific actions at the end of
- * each element (such as finalising a tree node or writing
- * output to a file).</p>
- *
- * @param name The element type name.
- * @param attributes The specified or defaulted attributes.
- * @exception org.xml.sax.SAXException Any SAX exception, possibly
- * wrapping another exception.
- * @see org.xml.sax.DocumentHandler#endElement
- */
- public void endElement (String name)
- throws SAXException
- {
- // no op
- }
-
-
- /**
- * Receive notification of character data inside an element.
- *
- * <p>By default, do nothing. Application writers may override this
- * method to take specific actions for each chunk of character data
- * (such as adding the data to a node or buffer, or printing it to
- * a file).</p>
- *
- * @param ch The characters.
- * @param start The start position in the character array.
- * @param length The number of characters to use from the
- * character array.
- * @exception org.xml.sax.SAXException Any SAX exception, possibly
- * wrapping another exception.
- * @see org.xml.sax.DocumentHandler#characters
- */
- public void characters (char ch[], int start, int length)
- throws SAXException
- {
- // no op
- }
-
-
- /**
- * Receive notification of ignorable whitespace in element content.
- *
- * <p>By default, do nothing. Application writers may override this
- * method to take specific actions for each chunk of ignorable
- * whitespace (such as adding data to a node or buffer, or printing
- * it to a file).</p>
- *
- * @param ch The whitespace characters.
- * @param start The start position in the character array.
- * @param length The number of characters to use from the
- * character array.
- * @exception org.xml.sax.SAXException Any SAX exception, possibly
- * wrapping another exception.
- * @see org.xml.sax.DocumentHandler#ignorableWhitespace
- */
- public void ignorableWhitespace (char ch[], int start, int length)
- throws SAXException
- {
- // no op
- }
-
-
- /**
- * Receive notification of a processing instruction.
- *
- * <p>By default, do nothing. Application writers may override this
- * method in a subclass to take specific actions for each
- * processing instruction, such as setting status variables or
- * invoking other methods.</p>
- *
- * @param target The processing instruction target.
- * @param data The processing instruction data, or null if
- * none is supplied.
- * @exception org.xml.sax.SAXException Any SAX exception, possibly
- * wrapping another exception.
- * @see org.xml.sax.DocumentHandler#processingInstruction
- */
- public void processingInstruction (String target, String data)
- throws SAXException
- {
- // no op
- }
-
-
-
- ////////////////////////////////////////////////////////////////////
- // Default implementation of the ErrorHandler interface.
- ////////////////////////////////////////////////////////////////////
-
-
- /**
- * Receive notification of a parser warning.
- *
- * <p>The default implementation does nothing. Application writers
- * may override this method in a subclass to take specific actions
- * for each warning, such as inserting the message in a log file or
- * printing it to the console.</p>
- *
- * @param e The warning information encoded as an exception.
- * @exception org.xml.sax.SAXException Any SAX exception, possibly
- * wrapping another exception.
- * @see org.xml.sax.ErrorHandler#warning
- * @see org.xml.sax.SAXParseException
- */
- public void warning (SAXParseException e)
- throws SAXException
- {
- // no op
- }
-
-
- /**
- * Receive notification of a recoverable parser error.
- *
- * <p>The default implementation does nothing. Application writers
- * may override this method in a subclass to take specific actions
- * for each error, such as inserting the message in a log file or
- * printing it to the console.</p>
- *
- * @param e The warning information encoded as an exception.
- * @exception org.xml.sax.SAXException Any SAX exception, possibly
- * wrapping another exception.
- * @see org.xml.sax.ErrorHandler#warning
- * @see org.xml.sax.SAXParseException
- */
- public void error (SAXParseException e)
- throws SAXException
- {
- // no op
- }
-
-
- /**
- * Report a fatal XML parsing error.
- *
- * <p>The default implementation throws a SAXParseException.
- * Application writers may override this method in a subclass if
- * they need to take specific actions for each fatal error (such as
- * collecting all of the errors into a single report): in any case,
- * the application must stop all regular processing when this
- * method is invoked, since the document is no longer reliable, and
- * the parser may no longer report parsing events.</p>
- *
- * @param e The error information encoded as an exception.
- * @exception org.xml.sax.SAXException Any SAX exception, possibly
- * wrapping another exception.
- * @see org.xml.sax.ErrorHandler#fatalError
- * @see org.xml.sax.SAXParseException
- */
- public void fatalError (SAXParseException e)
- throws SAXException
- {
- throw e;
- }
-
-}
-
-// end of HandlerBase.java
+// SAX default handler base class.
+// http://www.saxproject.org
+// No warranty; no copyright -- use this as you will.
+// $Id: HandlerBase.java,v 1.3.2.3 2002/01/29 21:34:14 dbrownell Exp $
+
+package org.xml.sax;
+
+/**
+ * Default base class for handlers.
+ *
+ * <blockquote>
+ * <em>This module, both source code and documentation, is in the
+ * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
+ * See <a href='http://www.saxproject.org'>http://www.saxproject.org</a>
+ * for further information.
+ * </blockquote>
+ *
+ * <p>This class implements the default behaviour for four SAX1
+ * interfaces: EntityResolver, DTDHandler, DocumentHandler,
+ * and ErrorHandler. It is now obsolete, but is included in SAX2 to
+ * support legacy SAX1 applications. SAX2 applications should use
+ * the {@link org.xml.sax.helpers.DefaultHandler DefaultHandler}
+ * class instead.</p>
+ *
+ * <p>Application writers can extend this class when they need to
+ * implement only part of an interface; parser writers can
+ * instantiate this class to provide default handlers when the
+ * application has not supplied its own.</p>
+ *
+ * <p>Note that the use of this class is optional.</p>
+ *
+ * @deprecated This class works with the deprecated
+ * {@link org.xml.sax.DocumentHandler DocumentHandler}
+ * interface. It has been replaced by the SAX2
+ * {@link org.xml.sax.helpers.DefaultHandler DefaultHandler}
+ * class.
+ * @since SAX 1.0
+ * @author David Megginson
+ * @version 2.0.1 (sax2r2)
+ * @see org.xml.sax.EntityResolver
+ * @see org.xml.sax.DTDHandler
+ * @see org.xml.sax.DocumentHandler
+ * @see org.xml.sax.ErrorHandler
+ */
+public class HandlerBase
+ implements EntityResolver, DTDHandler, DocumentHandler, ErrorHandler
+{
+
+
+ ////////////////////////////////////////////////////////////////////
+ // Default implementation of the EntityResolver interface.
+ ////////////////////////////////////////////////////////////////////
+
+ /**
+ * Resolve an external entity.
+ *
+ * <p>Always return null, so that the parser will use the system
+ * identifier provided in the XML document. This method implements
+ * the SAX default behaviour: application writers can override it
+ * in a subclass to do special translations such as catalog lookups
+ * or URI redirection.</p>
+ *
+ * @param publicId The public identifer, or null if none is
+ * available.
+ * @param systemId The system identifier provided in the XML
+ * document.
+ * @return The new input source, or null to require the
+ * default behaviour.
+ * @exception org.xml.sax.SAXException Any SAX exception, possibly
+ * wrapping another exception.
+ * @see org.xml.sax.EntityResolver#resolveEntity
+ */
+ public InputSource resolveEntity (String publicId, String systemId)
+ throws SAXException
+ {
+ return null;
+ }
+
+
+
+ ////////////////////////////////////////////////////////////////////
+ // Default implementation of DTDHandler interface.
+ ////////////////////////////////////////////////////////////////////
+
+
+ /**
+ * Receive notification of a notation declaration.
+ *
+ * <p>By default, do nothing. Application writers may override this
+ * method in a subclass if they wish to keep track of the notations
+ * declared in a document.</p>
+ *
+ * @param name The notation name.
+ * @param publicId The notation public identifier, or null if not
+ * available.
+ * @param systemId The notation system identifier.
+ * @see org.xml.sax.DTDHandler#notationDecl
+ */
+ public void notationDecl (String name, String publicId, String systemId)
+ {
+ // no op
+ }
+
+
+ /**
+ * Receive notification of an unparsed entity declaration.
+ *
+ * <p>By default, do nothing. Application writers may override this
+ * method in a subclass to keep track of the unparsed entities
+ * declared in a document.</p>
+ *
+ * @param name The entity name.
+ * @param publicId The entity public identifier, or null if not
+ * available.
+ * @param systemId The entity system identifier.
+ * @param notationName The name of the associated notation.
+ * @see org.xml.sax.DTDHandler#unparsedEntityDecl
+ */
+ public void unparsedEntityDecl (String name, String publicId,
+ String systemId, String notationName)
+ {
+ // no op
+ }
+
+
+
+ ////////////////////////////////////////////////////////////////////
+ // Default implementation of DocumentHandler interface.
+ ////////////////////////////////////////////////////////////////////
+
+
+ /**
+ * Receive a Locator object for document events.
+ *
+ * <p>By default, do nothing. Application writers may override this
+ * method in a subclass if they wish to store the locator for use
+ * with other document events.</p>
+ *
+ * @param locator A locator for all SAX document events.
+ * @see org.xml.sax.DocumentHandler#setDocumentLocator
+ * @see org.xml.sax.Locator
+ */
+ public void setDocumentLocator (Locator locator)
+ {
+ // no op
+ }
+
+
+ /**
+ * Receive notification of the beginning of the document.
+ *
+ * <p>By default, do nothing. Application writers may override this
+ * method in a subclass to take specific actions at the beginning
+ * of a document (such as allocating the root node of a tree or
+ * creating an output file).</p>
+ *
+ * @exception org.xml.sax.SAXException Any SAX exception, possibly
+ * wrapping another exception.
+ * @see org.xml.sax.DocumentHandler#startDocument
+ */
+ public void startDocument ()
+ throws SAXException
+ {
+ // no op
+ }
+
+
+ /**
+ * Receive notification of the end of the document.
+ *
+ * <p>By default, do nothing. Application writers may override this
+ * method in a subclass to take specific actions at the beginning
+ * of a document (such as finalising a tree or closing an output
+ * file).</p>
+ *
+ * @exception org.xml.sax.SAXException Any SAX exception, possibly
+ * wrapping another exception.
+ * @see org.xml.sax.DocumentHandler#endDocument
+ */
+ public void endDocument ()
+ throws SAXException
+ {
+ // no op
+ }
+
+
+ /**
+ * Receive notification of the start of an element.
+ *
+ * <p>By default, do nothing. Application writers may override this
+ * method in a subclass to take specific actions at the start of
+ * each element (such as allocating a new tree node or writing
+ * output to a file).</p>
+ *
+ * @param name The element type name.
+ * @param attributes The specified or defaulted attributes.
+ * @exception org.xml.sax.SAXException Any SAX exception, possibly
+ * wrapping another exception.
+ * @see org.xml.sax.DocumentHandler#startElement
+ */
+ public void startElement (String name, AttributeList attributes)
+ throws SAXException
+ {
+ // no op
+ }
+
+
+ /**
+ * Receive notification of the end of an element.
+ *
+ * <p>By default, do nothing. Application writers may override this
+ * method in a subclass to take specific actions at the end of
+ * each element (such as finalising a tree node or writing
+ * output to a file).</p>
+ *
+ * @param name The element type name.
+ * @param attributes The specified or defaulted attributes.
+ * @exception org.xml.sax.SAXException Any SAX exception, possibly
+ * wrapping another exception.
+ * @see org.xml.sax.DocumentHandler#endElement
+ */
+ public void endElement (String name)
+ throws SAXException
+ {
+ // no op
+ }
+
+
+ /**
+ * Receive notification of character data inside an element.
+ *
+ * <p>By default, do nothing. Application writers may override this
+ * method to take specific actions for each chunk of character data
+ * (such as adding the data to a node or buffer, or printing it to
+ * a file).</p>
+ *
+ * @param ch The characters.
+ * @param start The start position in the character array.
+ * @param length The number of characters to use from the
+ * character array.
+ * @exception org.xml.sax.SAXException Any SAX exception, possibly
+ * wrapping another exception.
+ * @see org.xml.sax.DocumentHandler#characters
+ */
+ public void characters (char ch[], int start, int length)
+ throws SAXException
+ {
+ // no op
+ }
+
+
+ /**
+ * Receive notification of ignorable whitespace in element content.
+ *
+ * <p>By default, do nothing. Application writers may override this
+ * method to take specific actions for each chunk of ignorable
+ * whitespace (such as adding data to a node or buffer, or printing
+ * it to a file).</p>
+ *
+ * @param ch The whitespace characters.
+ * @param start The start position in the character array.
+ * @param length The number of characters to use from the
+ * character array.
+ * @exception org.xml.sax.SAXException Any SAX exception, possibly
+ * wrapping another exception.
+ * @see org.xml.sax.DocumentHandler#ignorableWhitespace
+ */
+ public void ignorableWhitespace (char ch[], int start, int length)
+ throws SAXException
+ {
+ // no op
+ }
+
+
+ /**
+ * Receive notification of a processing instruction.
+ *
+ * <p>By default, do nothing. Application writers may override this
+ * method in a subclass to take specific actions for each
+ * processing instruction, such as setting status variables or
+ * invoking other methods.</p>
+ *
+ * @param target The processing instruction target.
+ * @param data The processing instruction data, or null if
+ * none is supplied.
+ * @exception org.xml.sax.SAXException Any SAX exception, possibly
+ * wrapping another exception.
+ * @see org.xml.sax.DocumentHandler#processingInstruction
+ */
+ public void processingInstruction (String target, String data)
+ throws SAXException
+ {
+ // no op
+ }
+
+
+
+ ////////////////////////////////////////////////////////////////////
+ // Default implementation of the ErrorHandler interface.
+ ////////////////////////////////////////////////////////////////////
+
+
+ /**
+ * Receive notification of a parser warning.
+ *
+ * <p>The default implementation does nothing. Application writers
+ * may override this method in a subclass to take specific actions
+ * for each warning, such as inserting the message in a log file or
+ * printing it to the console.</p>
+ *
+ * @param e The warning information encoded as an exception.
+ * @exception org.xml.sax.SAXException Any SAX exception, possibly
+ * wrapping another exception.
+ * @see org.xml.sax.ErrorHandler#warning
+ * @see org.xml.sax.SAXParseException
+ */
+ public void warning (SAXParseException e)
+ throws SAXException
+ {
+ // no op
+ }
+
+
+ /**
+ * Receive notification of a recoverable parser error.
+ *
+ * <p>The default implementation does nothing. Application writers
+ * may override this method in a subclass to take specific actions
+ * for each error, such as inserting the message in a log file or
+ * printing it to the console.</p>
+ *
+ * @param e The warning information encoded as an exception.
+ * @exception org.xml.sax.SAXException Any SAX exception, possibly
+ * wrapping another exception.
+ * @see org.xml.sax.ErrorHandler#warning
+ * @see org.xml.sax.SAXParseException
+ */
+ public void error (SAXParseException e)
+ throws SAXException
+ {
+ // no op
+ }
+
+
+ /**
+ * Report a fatal XML parsing error.
+ *
+ * <p>The default implementation throws a SAXParseException.
+ * Application writers may override this method in a subclass if
+ * they need to take specific actions for each fatal error (such as
+ * collecting all of the errors into a single report): in any case,
+ * the application must stop all regular processing when this
+ * method is invoked, since the document is no longer reliable, and
+ * the parser may no longer report parsing events.</p>
+ *
+ * @param e The error information encoded as an exception.
+ * @exception org.xml.sax.SAXException Any SAX exception, possibly
+ * wrapping another exception.
+ * @see org.xml.sax.ErrorHandler#fatalError
+ * @see org.xml.sax.SAXParseException
+ */
+ public void fatalError (SAXParseException e)
+ throws SAXException
+ {
+ throw e;
+ }
+
+}
+
+// end of HandlerBase.java
diff --git a/libjava/org/xml/sax/InputSource.java b/libjava/org/xml/sax/InputSource.java
index 985ca220387..f6c09071d47 100644
--- a/libjava/org/xml/sax/InputSource.java
+++ b/libjava/org/xml/sax/InputSource.java
@@ -1,321 +1,336 @@
-// SAX input source.
-// No warranty; no copyright -- use this as you will.
-// $Id: InputSource.java,v 1.1 2000/10/02 02:43:17 sboag Exp $
-
-package org.xml.sax;
-
-import java.io.Reader;
-import java.io.InputStream;
-
-/**
- * A single input source for an XML entity.
- *
- * <blockquote>
- * <em>This module, both source code and documentation, is in the
- * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
- * </blockquote>
- *
- * <p>This class allows a SAX application to encapsulate information
- * about an input source in a single object, which may include
- * a public identifier, a system identifier, a byte stream (possibly
- * with a specified encoding), and/or a character stream.</p>
- *
- * <p>There are two places that the application will deliver this
- * input source to the parser: as the argument to the Parser.parse
- * method, or as the return value of the EntityResolver.resolveEntity
- * method.</p>
- *
- * <p>The SAX parser will use the InputSource object to determine how
- * to read XML input. If there is a character stream available, the
- * parser will read that stream directly; if not, the parser will use
- * a byte stream, if available; if neither a character stream nor a
- * byte stream is available, the parser will attempt to open a URI
- * connection to the resource identified by the system
- * identifier.</p>
- *
- * <p>An InputSource object belongs to the application: the SAX parser
- * shall never modify it in any way (it may modify a copy if
- * necessary).</p>
- *
- * @since SAX 1.0
- * @author David Megginson,
- * <a href="mailto:sax@megginson.com">sax@megginson.com</a>
- * @version 2.0
- * @see org.xml.sax.Parser#parse
- * @see org.xml.sax.EntityResolver#resolveEntity
- * @see java.io.InputStream
- * @see java.io.Reader
- */
-public class InputSource {
-
- /**
- * Zero-argument default constructor.
- *
- * @see #setPublicId
- * @see #setSystemId
- * @see #setByteStream
- * @see #setCharacterStream
- * @see #setEncoding
- */
- public InputSource ()
- {
- }
-
-
- /**
- * Create a new input source with a system identifier.
- *
- * <p>Applications may use setPublicId to include a
- * public identifier as well, or setEncoding to specify
- * the character encoding, if known.</p>
- *
- * <p>If the system identifier is a URL, it must be full resolved.</p>
- *
- * @param systemId The system identifier (URI).
- * @see #setPublicId
- * @see #setSystemId
- * @see #setByteStream
- * @see #setEncoding
- * @see #setCharacterStream
- */
- public InputSource (String systemId)
- {
- setSystemId(systemId);
- }
-
-
- /**
- * Create a new input source with a byte stream.
- *
- * <p>Application writers may use setSystemId to provide a base
- * for resolving relative URIs, setPublicId to include a
- * public identifier, and/or setEncoding to specify the object's
- * character encoding.</p>
- *
- * @param byteStream The raw byte stream containing the document.
- * @see #setPublicId
- * @see #setSystemId
- * @see #setEncoding
- * @see #setByteStream
- * @see #setCharacterStream
- */
- public InputSource (InputStream byteStream)
- {
- setByteStream(byteStream);
- }
-
-
- /**
- * Create a new input source with a character stream.
- *
- * <p>Application writers may use setSystemId() to provide a base
- * for resolving relative URIs, and setPublicId to include a
- * public identifier.</p>
- *
- * <p>The character stream shall not include a byte order mark.</p>
- *
- * @see #setPublicId
- * @see #setSystemId
- * @see #setByteStream
- * @see #setCharacterStream
- */
- public InputSource (Reader characterStream)
- {
- setCharacterStream(characterStream);
- }
-
-
- /**
- * Set the public identifier for this input source.
- *
- * <p>The public identifier is always optional: if the application
- * writer includes one, it will be provided as part of the
- * location information.</p>
- *
- * @param publicId The public identifier as a string.
- * @see #getPublicId
- * @see org.xml.sax.Locator#getPublicId
- * @see org.xml.sax.SAXParseException#getPublicId
- */
- public void setPublicId (String publicId)
- {
- this.publicId = publicId;
- }
-
-
- /**
- * Get the public identifier for this input source.
- *
- * @return The public identifier, or null if none was supplied.
- * @see #setPublicId
- */
- public String getPublicId ()
- {
- return publicId;
- }
-
-
- /**
- * Set the system identifier for this input source.
- *
- * <p>The system identifier is optional if there is a byte stream
- * or a character stream, but it is still useful to provide one,
- * since the application can use it to resolve relative URIs
- * and can include it in error messages and warnings (the parser
- * will attempt to open a connection to the URI only if
- * there is no byte stream or character stream specified).</p>
- *
- * <p>If the application knows the character encoding of the
- * object pointed to by the system identifier, it can register
- * the encoding using the setEncoding method.</p>
- *
- * <p>If the system ID is a URL, it must be fully resolved.</p>
- *
- * @param systemId The system identifier as a string.
- * @see #setEncoding
- * @see #getSystemId
- * @see org.xml.sax.Locator#getSystemId
- * @see org.xml.sax.SAXParseException#getSystemId
- */
- public void setSystemId (String systemId)
- {
- this.systemId = systemId;
- }
-
-
- /**
- * Get the system identifier for this input source.
- *
- * <p>The getEncoding method will return the character encoding
- * of the object pointed to, or null if unknown.</p>
- *
- * <p>If the system ID is a URL, it will be fully resolved.</p>
- *
- * @return The system identifier.
- * @see #setSystemId
- * @see #getEncoding
- */
- public String getSystemId ()
- {
- return systemId;
- }
-
-
- /**
- * Set the byte stream for this input source.
- *
- * <p>The SAX parser will ignore this if there is also a character
- * stream specified, but it will use a byte stream in preference
- * to opening a URI connection itself.</p>
- *
- * <p>If the application knows the character encoding of the
- * byte stream, it should set it with the setEncoding method.</p>
- *
- * @param byteStream A byte stream containing an XML document or
- * other entity.
- * @see #setEncoding
- * @see #getByteStream
- * @see #getEncoding
- * @see java.io.InputStream
- */
- public void setByteStream (InputStream byteStream)
- {
- this.byteStream = byteStream;
- }
-
-
- /**
- * Get the byte stream for this input source.
- *
- * <p>The getEncoding method will return the character
- * encoding for this byte stream, or null if unknown.</p>
- *
- * @return The byte stream, or null if none was supplied.
- * @see #getEncoding
- * @see #setByteStream
- */
- public InputStream getByteStream ()
- {
- return byteStream;
- }
-
-
- /**
- * Set the character encoding, if known.
- *
- * <p>The encoding must be a string acceptable for an
- * XML encoding declaration (see section 4.3.3 of the XML 1.0
- * recommendation).</p>
- *
- * <p>This method has no effect when the application provides a
- * character stream.</p>
- *
- * @param encoding A string describing the character encoding.
- * @see #setSystemId
- * @see #setByteStream
- * @see #getEncoding
- */
- public void setEncoding (String encoding)
- {
- this.encoding = encoding;
- }
-
-
- /**
- * Get the character encoding for a byte stream or URI.
- *
- * @return The encoding, or null if none was supplied.
- * @see #setByteStream
- * @see #getSystemId
- * @see #getByteStream
- */
- public String getEncoding ()
- {
- return encoding;
- }
-
-
- /**
- * Set the character stream for this input source.
- *
- * <p>If there is a character stream specified, the SAX parser
- * will ignore any byte stream and will not attempt to open
- * a URI connection to the system identifier.</p>
- *
- * @param characterStream The character stream containing the
- * XML document or other entity.
- * @see #getCharacterStream
- * @see java.io.Reader
- */
- public void setCharacterStream (Reader characterStream)
- {
- this.characterStream = characterStream;
- }
-
-
- /**
- * Get the character stream for this input source.
- *
- * @return The character stream, or null if none was supplied.
- * @see #setCharacterStream
- */
- public Reader getCharacterStream ()
- {
- return characterStream;
- }
-
-
-
- ////////////////////////////////////////////////////////////////////
- // Internal state.
- ////////////////////////////////////////////////////////////////////
-
- private String publicId;
- private String systemId;
- private InputStream byteStream;
- private String encoding;
- private Reader characterStream;
-
-}
-
-// end of InputSource.java
+// SAX input source.
+// http://www.saxproject.org
+// No warranty; no copyright -- use this as you will.
+// $Id: InputSource.java,v 1.5.2.4 2002/01/29 21:34:14 dbrownell Exp $
+
+package org.xml.sax;
+
+import java.io.Reader;
+import java.io.InputStream;
+
+/**
+ * A single input source for an XML entity.
+ *
+ * <blockquote>
+ * <em>This module, both source code and documentation, is in the
+ * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
+ * See <a href='http://www.saxproject.org'>http://www.saxproject.org</a>
+ * for further information.
+ * </blockquote>
+ *
+ * <p>This class allows a SAX application to encapsulate information
+ * about an input source in a single object, which may include
+ * a public identifier, a system identifier, a byte stream (possibly
+ * with a specified encoding), and/or a character stream.</p>
+ *
+ * <p>There are two places that the application can deliver an
+ * input source to the parser: as the argument to the Parser.parse
+ * method, or as the return value of the EntityResolver.resolveEntity
+ * method.</p>
+ *
+ * <p>The SAX parser will use the InputSource object to determine how
+ * to read XML input. If there is a character stream available, the
+ * parser will read that stream directly, disregarding any text
+ * encoding declaration found in that stream.
+ * If there is no character stream, but there is
+ * a byte stream, the parser will use that byte stream, using the
+ * encoding specified in the InputSource or else (if no encoding is
+ * specified) autodetecting the character encoding using an algorithm
+ * such as the one in the XML specification. If neither a character
+ * stream nor a
+ * byte stream is available, the parser will attempt to open a URI
+ * connection to the resource identified by the system
+ * identifier.</p>
+ *
+ * <p>An InputSource object belongs to the application: the SAX parser
+ * shall never modify it in any way (it may modify a copy if
+ * necessary). However, standard processing of both byte and
+ * character streams is to close them on as part of end-of-parse cleanup,
+ * so applications should not attempt to re-use such streams after they
+ * have been handed to a parser. </p>
+ *
+ * @since SAX 1.0
+ * @author David Megginson
+ * @version 2.0.1 (sax2r2)
+ * @see org.xml.sax.XMLReader#parse(org.xml.sax.InputSource)
+ * @see org.xml.sax.EntityResolver#resolveEntity
+ * @see java.io.InputStream
+ * @see java.io.Reader
+ */
+public class InputSource {
+
+ /**
+ * Zero-argument default constructor.
+ *
+ * @see #setPublicId
+ * @see #setSystemId
+ * @see #setByteStream
+ * @see #setCharacterStream
+ * @see #setEncoding
+ */
+ public InputSource ()
+ {
+ }
+
+
+ /**
+ * Create a new input source with a system identifier.
+ *
+ * <p>Applications may use setPublicId to include a
+ * public identifier as well, or setEncoding to specify
+ * the character encoding, if known.</p>
+ *
+ * <p>If the system identifier is a URL, it must be fully
+ * resolved (it may not be a relative URL).</p>
+ *
+ * @param systemId The system identifier (URI).
+ * @see #setPublicId
+ * @see #setSystemId
+ * @see #setByteStream
+ * @see #setEncoding
+ * @see #setCharacterStream
+ */
+ public InputSource (String systemId)
+ {
+ setSystemId(systemId);
+ }
+
+
+ /**
+ * Create a new input source with a byte stream.
+ *
+ * <p>Application writers should use setSystemId() to provide a base
+ * for resolving relative URIs, may use setPublicId to include a
+ * public identifier, and may use setEncoding to specify the object's
+ * character encoding.</p>
+ *
+ * @param byteStream The raw byte stream containing the document.
+ * @see #setPublicId
+ * @see #setSystemId
+ * @see #setEncoding
+ * @see #setByteStream
+ * @see #setCharacterStream
+ */
+ public InputSource (InputStream byteStream)
+ {
+ setByteStream(byteStream);
+ }
+
+
+ /**
+ * Create a new input source with a character stream.
+ *
+ * <p>Application writers should use setSystemId() to provide a base
+ * for resolving relative URIs, and may use setPublicId to include a
+ * public identifier.</p>
+ *
+ * <p>The character stream shall not include a byte order mark.</p>
+ *
+ * @see #setPublicId
+ * @see #setSystemId
+ * @see #setByteStream
+ * @see #setCharacterStream
+ */
+ public InputSource (Reader characterStream)
+ {
+ setCharacterStream(characterStream);
+ }
+
+
+ /**
+ * Set the public identifier for this input source.
+ *
+ * <p>The public identifier is always optional: if the application
+ * writer includes one, it will be provided as part of the
+ * location information.</p>
+ *
+ * @param publicId The public identifier as a string.
+ * @see #getPublicId
+ * @see org.xml.sax.Locator#getPublicId
+ * @see org.xml.sax.SAXParseException#getPublicId
+ */
+ public void setPublicId (String publicId)
+ {
+ this.publicId = publicId;
+ }
+
+
+ /**
+ * Get the public identifier for this input source.
+ *
+ * @return The public identifier, or null if none was supplied.
+ * @see #setPublicId
+ */
+ public String getPublicId ()
+ {
+ return publicId;
+ }
+
+
+ /**
+ * Set the system identifier for this input source.
+ *
+ * <p>The system identifier is optional if there is a byte stream
+ * or a character stream, but it is still useful to provide one,
+ * since the application can use it to resolve relative URIs
+ * and can include it in error messages and warnings (the parser
+ * will attempt to open a connection to the URI only if
+ * there is no byte stream or character stream specified).</p>
+ *
+ * <p>If the application knows the character encoding of the
+ * object pointed to by the system identifier, it can register
+ * the encoding using the setEncoding method.</p>
+ *
+ * <p>If the system identifier is a URL, it must be fully
+ * resolved (it may not be a relative URL).</p>
+ *
+ * @param systemId The system identifier as a string.
+ * @see #setEncoding
+ * @see #getSystemId
+ * @see org.xml.sax.Locator#getSystemId
+ * @see org.xml.sax.SAXParseException#getSystemId
+ */
+ public void setSystemId (String systemId)
+ {
+ this.systemId = systemId;
+ }
+
+
+ /**
+ * Get the system identifier for this input source.
+ *
+ * <p>The getEncoding method will return the character encoding
+ * of the object pointed to, or null if unknown.</p>
+ *
+ * <p>If the system ID is a URL, it will be fully resolved.</p>
+ *
+ * @return The system identifier, or null if none was supplied.
+ * @see #setSystemId
+ * @see #getEncoding
+ */
+ public String getSystemId ()
+ {
+ return systemId;
+ }
+
+
+ /**
+ * Set the byte stream for this input source.
+ *
+ * <p>The SAX parser will ignore this if there is also a character
+ * stream specified, but it will use a byte stream in preference
+ * to opening a URI connection itself.</p>
+ *
+ * <p>If the application knows the character encoding of the
+ * byte stream, it should set it with the setEncoding method.</p>
+ *
+ * @param byteStream A byte stream containing an XML document or
+ * other entity.
+ * @see #setEncoding
+ * @see #getByteStream
+ * @see #getEncoding
+ * @see java.io.InputStream
+ */
+ public void setByteStream (InputStream byteStream)
+ {
+ this.byteStream = byteStream;
+ }
+
+
+ /**
+ * Get the byte stream for this input source.
+ *
+ * <p>The getEncoding method will return the character
+ * encoding for this byte stream, or null if unknown.</p>
+ *
+ * @return The byte stream, or null if none was supplied.
+ * @see #getEncoding
+ * @see #setByteStream
+ */
+ public InputStream getByteStream ()
+ {
+ return byteStream;
+ }
+
+
+ /**
+ * Set the character encoding, if known.
+ *
+ * <p>The encoding must be a string acceptable for an
+ * XML encoding declaration (see section 4.3.3 of the XML 1.0
+ * recommendation).</p>
+ *
+ * <p>This method has no effect when the application provides a
+ * character stream.</p>
+ *
+ * @param encoding A string describing the character encoding.
+ * @see #setSystemId
+ * @see #setByteStream
+ * @see #getEncoding
+ */
+ public void setEncoding (String encoding)
+ {
+ this.encoding = encoding;
+ }
+
+
+ /**
+ * Get the character encoding for a byte stream or URI.
+ * This value will be ignored when the application provides a
+ * character stream.
+ *
+ * @return The encoding, or null if none was supplied.
+ * @see #setByteStream
+ * @see #getSystemId
+ * @see #getByteStream
+ */
+ public String getEncoding ()
+ {
+ return encoding;
+ }
+
+
+ /**
+ * Set the character stream for this input source.
+ *
+ * <p>If there is a character stream specified, the SAX parser
+ * will ignore any byte stream and will not attempt to open
+ * a URI connection to the system identifier.</p>
+ *
+ * @param characterStream The character stream containing the
+ * XML document or other entity.
+ * @see #getCharacterStream
+ * @see java.io.Reader
+ */
+ public void setCharacterStream (Reader characterStream)
+ {
+ this.characterStream = characterStream;
+ }
+
+
+ /**
+ * Get the character stream for this input source.
+ *
+ * @return The character stream, or null if none was supplied.
+ * @see #setCharacterStream
+ */
+ public Reader getCharacterStream ()
+ {
+ return characterStream;
+ }
+
+
+
+ ////////////////////////////////////////////////////////////////////
+ // Internal state.
+ ////////////////////////////////////////////////////////////////////
+
+ private String publicId;
+ private String systemId;
+ private InputStream byteStream;
+ private String encoding;
+ private Reader characterStream;
+
+}
+
+// end of InputSource.java
diff --git a/libjava/org/xml/sax/Locator.java b/libjava/org/xml/sax/Locator.java
index be55656042e..d94c3ea4abd 100644
--- a/libjava/org/xml/sax/Locator.java
+++ b/libjava/org/xml/sax/Locator.java
@@ -1,126 +1,136 @@
-// SAX locator interface for document events.
-// No warranty; no copyright -- use this as you will.
-// $Id: Locator.java,v 1.1 2000/10/02 02:43:17 sboag Exp $
-
-package org.xml.sax;
-
-
-/**
- * Interface for associating a SAX event with a document location.
- *
- * <blockquote>
- * <em>This module, both source code and documentation, is in the
- * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
- * </blockquote>
- *
- * <p>If a SAX parser provides location information to the SAX
- * application, it does so by implementing this interface and then
- * passing an instance to the application using the content
- * handler's {@link org.xml.sax.ContentHandler#setDocumentLocator
- * setDocumentLocator} method. The application can use the
- * object to obtain the location of any other content handler event
- * in the XML source document.</p>
- *
- * <p>Note that the results returned by the object will be valid only
- * during the scope of each content handler method: the application
- * will receive unpredictable results if it attempts to use the
- * locator at any other time.</p>
- *
- * <p>SAX parsers are not required to supply a locator, but they are
- * very strongly encouraged to do so. If the parser supplies a
- * locator, it must do so before reporting any other document events.
- * If no locator has been set by the time the application receives
- * the {@link org.xml.sax.ContentHandler#startDocument startDocument}
- * event, the application should assume that a locator is not
- * available.</p>
- *
- * @since SAX 1.0
- * @author David Megginson,
- * <a href="mailto:sax@megginson.com">sax@megginson.com</a>
- * @version 2.0
- * @see org.xml.sax.ContentHandler#setDocumentLocator
- */
-public interface Locator {
-
-
- /**
- * Return the public identifier for the current document event.
- *
- * <p>The return value is the public identifier of the document
- * entity or of the external parsed entity in which the markup
- * triggering the event appears.</p>
- *
- * @return A string containing the public identifier, or
- * null if none is available.
- * @see #getSystemId
- */
- public abstract String getPublicId ();
-
-
- /**
- * Return the system identifier for the current document event.
- *
- * <p>The return value is the system identifier of the document
- * entity or of the external parsed entity in which the markup
- * triggering the event appears.</p>
- *
- * <p>If the system identifier is a URL, the parser must resolve it
- * fully before passing it to the application.</p>
- *
- * @return A string containing the system identifier, or null
- * if none is available.
- * @see #getPublicId
- */
- public abstract String getSystemId ();
-
-
- /**
- * Return the line number where the current document event ends.
- *
- * <p><strong>Warning:</strong> The return value from the method
- * is intended only as an approximation for the sake of error
- * reporting; it is not intended to provide sufficient information
- * to edit the character content of the original XML document.</p>
- *
- * <p>The return value is an approximation of the line number
- * in the document entity or external parsed entity where the
- * markup triggering the event appears.</p>
- *
- * <p>If possible, the SAX driver should provide the line position
- * of the first character after the text associated with the document
- * event. The first line in the document is line 1.</p>
- *
- * @return The line number, or -1 if none is available.
- * @see #getColumnNumber
- */
- public abstract int getLineNumber ();
-
-
- /**
- * Return the column number where the current document event ends.
- *
- * <p><strong>Warning:</strong> The return value from the method
- * is intended only as an approximation for the sake of error
- * reporting; it is not intended to provide sufficient information
- * to edit the character content of the original XML document.</p>
- *
- * <p>The return value is an approximation of the column number
- * in the document entity or external parsed entity where the
- * markup triggering the event appears.</p>
- *
- * <p>If possible, the SAX driver should provide the line position
- * of the first character after the text associated with the document
- * event.</p>
- *
- * <p>If possible, the SAX driver should provide the line position
- * of the first character after the text associated with the document
- * event. The first column in each line is column 1.</p>
- *
- * @return The column number, or -1 if none is available.
- * @see #getLineNumber
- */
- public abstract int getColumnNumber ();
-
-}
-
-// end of Locator.java
+// SAX locator interface for document events.
+// http://www.saxproject.org
+// No warranty; no copyright -- use this as you will.
+// $Id: Locator.java,v 1.4.2.5 2002/01/29 21:34:14 dbrownell Exp $
+
+package org.xml.sax;
+
+
+/**
+ * Interface for associating a SAX event with a document location.
+ *
+ * <blockquote>
+ * <em>This module, both source code and documentation, is in the
+ * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
+ * See <a href='http://www.saxproject.org'>http://www.saxproject.org</a>
+ * for further information.
+ * </blockquote>
+ *
+ * <p>If a SAX parser provides location information to the SAX
+ * application, it does so by implementing this interface and then
+ * passing an instance to the application using the content
+ * handler's {@link org.xml.sax.ContentHandler#setDocumentLocator
+ * setDocumentLocator} method. The application can use the
+ * object to obtain the location of any other SAX event
+ * in the XML source document.</p>
+ *
+ * <p>Note that the results returned by the object will be valid only
+ * during the scope of each callback method: the application
+ * will receive unpredictable results if it attempts to use the
+ * locator at any other time, or after parsing completes.</p>
+ *
+ * <p>SAX parsers are not required to supply a locator, but they are
+ * very strongly encouraged to do so. If the parser supplies a
+ * locator, it must do so before reporting any other document events.
+ * If no locator has been set by the time the application receives
+ * the {@link org.xml.sax.ContentHandler#startDocument startDocument}
+ * event, the application should assume that a locator is not
+ * available.</p>
+ *
+ * @since SAX 1.0
+ * @author David Megginson
+ * @version 2.0.1 (sax2r2)
+ * @see org.xml.sax.ContentHandler#setDocumentLocator
+ */
+public interface Locator {
+
+
+ /**
+ * Return the public identifier for the current document event.
+ *
+ * <p>The return value is the public identifier of the document
+ * entity or of the external parsed entity in which the markup
+ * triggering the event appears.</p>
+ *
+ * @return A string containing the public identifier, or
+ * null if none is available.
+ * @see #getSystemId
+ */
+ public abstract String getPublicId ();
+
+
+ /**
+ * Return the system identifier for the current document event.
+ *
+ * <p>The return value is the system identifier of the document
+ * entity or of the external parsed entity in which the markup
+ * triggering the event appears.</p>
+ *
+ * <p>If the system identifier is a URL, the parser must resolve it
+ * fully before passing it to the application. For example, a file
+ * name must always be provided as a <em>file:...</em> URL, and other
+ * kinds of relative URI are also resolved against their bases.</p>
+ *
+ * @return A string containing the system identifier, or null
+ * if none is available.
+ * @see #getPublicId
+ */
+ public abstract String getSystemId ();
+
+
+ /**
+ * Return the line number where the current document event ends.
+ * Lines are delimited by line ends, which are defined in
+ * the XML specification.
+ *
+ * <p><strong>Warning:</strong> The return value from the method
+ * is intended only as an approximation for the sake of diagnostics;
+ * it is not intended to provide sufficient information
+ * to edit the character content of the original XML document.
+ * In some cases, these "line" numbers match what would be displayed
+ * as columns, and in others they may not match the source text
+ * due to internal entity expansion. </p>
+ *
+ * <p>The return value is an approximation of the line number
+ * in the document entity or external parsed entity where the
+ * markup triggering the event appears.</p>
+ *
+ * <p>If possible, the SAX driver should provide the line position
+ * of the first character after the text associated with the document
+ * event. The first line is line 1.</p>
+ *
+ * @return The line number, or -1 if none is available.
+ * @see #getColumnNumber
+ */
+ public abstract int getLineNumber ();
+
+
+ /**
+ * Return the column number where the current document event ends.
+ * This is one-based number of Java <code>char</code> values since
+ * the last line end.
+ *
+ * <p><strong>Warning:</strong> The return value from the method
+ * is intended only as an approximation for the sake of diagnostics;
+ * it is not intended to provide sufficient information
+ * to edit the character content of the original XML document.
+ * For example, when lines contain combining character sequences, wide
+ * characters, surrogate pairs, or bi-directional text, the value may
+ * not correspond to the column in a text editor's display. </p>
+ *
+ * <p>The return value is an approximation of the column number
+ * in the document entity or external parsed entity where the
+ * markup triggering the event appears.</p>
+ *
+ * <p>If possible, the SAX driver should provide the line position
+ * of the first character after the text associated with the document
+ * event. The first column in each line is column 1.</p>
+ *
+ * @return The column number, or -1 if none is available.
+ * @see #getLineNumber
+ */
+ public abstract int getColumnNumber ();
+
+}
+
+// end of Locator.java
diff --git a/libjava/org/xml/sax/Parser.java b/libjava/org/xml/sax/Parser.java
index e775ca97c87..2999265c4c3 100644
--- a/libjava/org/xml/sax/Parser.java
+++ b/libjava/org/xml/sax/Parser.java
@@ -1,207 +1,209 @@
-// SAX parser interface.
-// No warranty; no copyright -- use this as you will.
-// $Id: Parser.java,v 1.1 2000/10/02 02:43:17 sboag Exp $
-
-package org.xml.sax;
-
-import java.io.IOException;
-import java.util.Locale;
-
-
-/**
- * Basic interface for SAX (Simple API for XML) parsers.
- *
- * <blockquote>
- * <em>This module, both source code and documentation, is in the
- * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
- * </blockquote>
- *
- * <p>This was the main event supplier interface for SAX1; it has
- * been replaced in SAX2 by {@link org.xml.sax.XMLReader XMLReader},
- * which includes Namespace support and sophisticated configurability
- * and extensibility.</p>
- *
- * <p>All SAX1 parsers must implement this basic interface: it allows
- * applications to register handlers for different types of events
- * and to initiate a parse from a URI, or a character stream.</p>
- *
- * <p>All SAX1 parsers must also implement a zero-argument constructor
- * (though other constructors are also allowed).</p>
- *
- * <p>SAX1 parsers are reusable but not re-entrant: the application
- * may reuse a parser object (possibly with a different input source)
- * once the first parse has completed successfully, but it may not
- * invoke the parse() methods recursively within a parse.</p>
- *
- * @deprecated This interface has been replaced by the SAX2
- * {@link org.xml.sax.XMLReader XMLReader}
- * interface, which includes Namespace support.
- * @since SAX 1.0
- * @author David Megginson,
- * <a href="mailto:sax@megginson.com">sax@megginson.com</a>
- * @version 2.0
- * @see org.xml.sax.EntityResolver
- * @see org.xml.sax.DTDHandler
- * @see org.xml.sax.DocumentHandler
- * @see org.xml.sax.ErrorHandler
- * @see org.xml.sax.HandlerBase
- * @see org.xml.sax.InputSource
- */
-public interface Parser
-{
-
- /**
- * Allow an application to request a locale for errors and warnings.
- *
- * <p>SAX parsers are not required to provide localisation for errors
- * and warnings; if they cannot support the requested locale,
- * however, they must throw a SAX exception. Applications may
- * not request a locale change in the middle of a parse.</p>
- *
- * @param locale A Java Locale object.
- * @exception org.xml.sax.SAXException Throws an exception
- * (using the previous or default locale) if the
- * requested locale is not supported.
- * @see org.xml.sax.SAXException
- * @see org.xml.sax.SAXParseException
- */
- public abstract void setLocale (Locale locale)
- throws SAXException;
-
-
- /**
- * Allow an application to register a custom entity resolver.
- *
- * <p>If the application does not register an entity resolver, the
- * SAX parser will resolve system identifiers and open connections
- * to entities itself (this is the default behaviour implemented in
- * HandlerBase).</p>
- *
- * <p>Applications may register a new or different entity resolver
- * in the middle of a parse, and the SAX parser must begin using
- * the new resolver immediately.</p>
- *
- * @param resolver The object for resolving entities.
- * @see EntityResolver
- * @see HandlerBase
- */
- public abstract void setEntityResolver (EntityResolver resolver);
-
-
- /**
- * Allow an application to register a DTD event handler.
- *
- * <p>If the application does not register a DTD handler, all DTD
- * events reported by the SAX parser will be silently
- * ignored (this is the default behaviour implemented by
- * HandlerBase).</p>
- *
- * <p>Applications may register a new or different
- * handler in the middle of a parse, and the SAX parser must
- * begin using the new handler immediately.</p>
- *
- * @param handler The DTD handler.
- * @see DTDHandler
- * @see HandlerBase
- */
- public abstract void setDTDHandler (DTDHandler handler);
-
-
- /**
- * Allow an application to register a document event handler.
- *
- * <p>If the application does not register a document handler, all
- * document events reported by the SAX parser will be silently
- * ignored (this is the default behaviour implemented by
- * HandlerBase).</p>
- *
- * <p>Applications may register a new or different handler in the
- * middle of a parse, and the SAX parser must begin using the new
- * handler immediately.</p>
- *
- * @param handler The document handler.
- * @see DocumentHandler
- * @see HandlerBase
- */
- public abstract void setDocumentHandler (DocumentHandler handler);
-
-
- /**
- * Allow an application to register an error event handler.
- *
- * <p>If the application does not register an error event handler,
- * all error events reported by the SAX parser will be silently
- * ignored, except for fatalError, which will throw a SAXException
- * (this is the default behaviour implemented by HandlerBase).</p>
- *
- * <p>Applications may register a new or different handler in the
- * middle of a parse, and the SAX parser must begin using the new
- * handler immediately.</p>
- *
- * @param handler The error handler.
- * @see ErrorHandler
- * @see SAXException
- * @see HandlerBase
- */
- public abstract void setErrorHandler (ErrorHandler handler);
-
-
- /**
- * Parse an XML document.
- *
- * <p>The application can use this method to instruct the SAX parser
- * to begin parsing an XML document from any valid input
- * source (a character stream, a byte stream, or a URI).</p>
- *
- * <p>Applications may not invoke this method while a parse is in
- * progress (they should create a new Parser instead for each
- * additional XML document). Once a parse is complete, an
- * application may reuse the same Parser object, possibly with a
- * different input source.</p>
- *
- * @param source The input source for the top-level of the
- * XML document.
- * @exception org.xml.sax.SAXException Any SAX exception, possibly
- * wrapping another exception.
- * @exception java.io.IOException An IO exception from the parser,
- * possibly from a byte stream or character stream
- * supplied by the application.
- * @see org.xml.sax.InputSource
- * @see #parse(java.lang.String)
- * @see #setEntityResolver
- * @see #setDTDHandler
- * @see #setDocumentHandler
- * @see #setErrorHandler
- */
- public abstract void parse (InputSource source)
- throws SAXException, IOException;
-
-
- /**
- * Parse an XML document from a system identifier (URI).
- *
- * <p>This method is a shortcut for the common case of reading a
- * document from a system identifier. It is the exact
- * equivalent of the following:</p>
- *
- * <pre>
- * parse(new InputSource(systemId));
- * </pre>
- *
- * <p>If the system identifier is a URL, it must be fully resolved
- * by the application before it is passed to the parser.</p>
- *
- * @param systemId The system identifier (URI).
- * @exception org.xml.sax.SAXException Any SAX exception, possibly
- * wrapping another exception.
- * @exception java.io.IOException An IO exception from the parser,
- * possibly from a byte stream or character stream
- * supplied by the application.
- * @see #parse(org.xml.sax.InputSource)
- */
- public abstract void parse (String systemId)
- throws SAXException, IOException;
-
-}
-
-// end of Parser.java
+// SAX parser interface.
+// http://www.saxproject.org
+// No warranty; no copyright -- use this as you will.
+// $Id: Parser.java,v 1.3.2.3 2002/01/29 21:34:14 dbrownell Exp $
+
+package org.xml.sax;
+
+import java.io.IOException;
+import java.util.Locale;
+
+
+/**
+ * Basic interface for SAX (Simple API for XML) parsers.
+ *
+ * <blockquote>
+ * <em>This module, both source code and documentation, is in the
+ * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
+ * See <a href='http://www.saxproject.org'>http://www.saxproject.org</a>
+ * for further information.
+ * </blockquote>
+ *
+ * <p>This was the main event supplier interface for SAX1; it has
+ * been replaced in SAX2 by {@link org.xml.sax.XMLReader XMLReader},
+ * which includes Namespace support and sophisticated configurability
+ * and extensibility.</p>
+ *
+ * <p>All SAX1 parsers must implement this basic interface: it allows
+ * applications to register handlers for different types of events
+ * and to initiate a parse from a URI, or a character stream.</p>
+ *
+ * <p>All SAX1 parsers must also implement a zero-argument constructor
+ * (though other constructors are also allowed).</p>
+ *
+ * <p>SAX1 parsers are reusable but not re-entrant: the application
+ * may reuse a parser object (possibly with a different input source)
+ * once the first parse has completed successfully, but it may not
+ * invoke the parse() methods recursively within a parse.</p>
+ *
+ * @deprecated This interface has been replaced by the SAX2
+ * {@link org.xml.sax.XMLReader XMLReader}
+ * interface, which includes Namespace support.
+ * @since SAX 1.0
+ * @author David Megginson
+ * @version 2.0.1 (sax2r2)
+ * @see org.xml.sax.EntityResolver
+ * @see org.xml.sax.DTDHandler
+ * @see org.xml.sax.DocumentHandler
+ * @see org.xml.sax.ErrorHandler
+ * @see org.xml.sax.HandlerBase
+ * @see org.xml.sax.InputSource
+ */
+public interface Parser
+{
+
+ /**
+ * Allow an application to request a locale for errors and warnings.
+ *
+ * <p>SAX parsers are not required to provide localisation for errors
+ * and warnings; if they cannot support the requested locale,
+ * however, they must throw a SAX exception. Applications may
+ * not request a locale change in the middle of a parse.</p>
+ *
+ * @param locale A Java Locale object.
+ * @exception org.xml.sax.SAXException Throws an exception
+ * (using the previous or default locale) if the
+ * requested locale is not supported.
+ * @see org.xml.sax.SAXException
+ * @see org.xml.sax.SAXParseException
+ */
+ public abstract void setLocale (Locale locale)
+ throws SAXException;
+
+
+ /**
+ * Allow an application to register a custom entity resolver.
+ *
+ * <p>If the application does not register an entity resolver, the
+ * SAX parser will resolve system identifiers and open connections
+ * to entities itself (this is the default behaviour implemented in
+ * HandlerBase).</p>
+ *
+ * <p>Applications may register a new or different entity resolver
+ * in the middle of a parse, and the SAX parser must begin using
+ * the new resolver immediately.</p>
+ *
+ * @param resolver The object for resolving entities.
+ * @see EntityResolver
+ * @see HandlerBase
+ */
+ public abstract void setEntityResolver (EntityResolver resolver);
+
+
+ /**
+ * Allow an application to register a DTD event handler.
+ *
+ * <p>If the application does not register a DTD handler, all DTD
+ * events reported by the SAX parser will be silently
+ * ignored (this is the default behaviour implemented by
+ * HandlerBase).</p>
+ *
+ * <p>Applications may register a new or different
+ * handler in the middle of a parse, and the SAX parser must
+ * begin using the new handler immediately.</p>
+ *
+ * @param handler The DTD handler.
+ * @see DTDHandler
+ * @see HandlerBase
+ */
+ public abstract void setDTDHandler (DTDHandler handler);
+
+
+ /**
+ * Allow an application to register a document event handler.
+ *
+ * <p>If the application does not register a document handler, all
+ * document events reported by the SAX parser will be silently
+ * ignored (this is the default behaviour implemented by
+ * HandlerBase).</p>
+ *
+ * <p>Applications may register a new or different handler in the
+ * middle of a parse, and the SAX parser must begin using the new
+ * handler immediately.</p>
+ *
+ * @param handler The document handler.
+ * @see DocumentHandler
+ * @see HandlerBase
+ */
+ public abstract void setDocumentHandler (DocumentHandler handler);
+
+
+ /**
+ * Allow an application to register an error event handler.
+ *
+ * <p>If the application does not register an error event handler,
+ * all error events reported by the SAX parser will be silently
+ * ignored, except for fatalError, which will throw a SAXException
+ * (this is the default behaviour implemented by HandlerBase).</p>
+ *
+ * <p>Applications may register a new or different handler in the
+ * middle of a parse, and the SAX parser must begin using the new
+ * handler immediately.</p>
+ *
+ * @param handler The error handler.
+ * @see ErrorHandler
+ * @see SAXException
+ * @see HandlerBase
+ */
+ public abstract void setErrorHandler (ErrorHandler handler);
+
+
+ /**
+ * Parse an XML document.
+ *
+ * <p>The application can use this method to instruct the SAX parser
+ * to begin parsing an XML document from any valid input
+ * source (a character stream, a byte stream, or a URI).</p>
+ *
+ * <p>Applications may not invoke this method while a parse is in
+ * progress (they should create a new Parser instead for each
+ * additional XML document). Once a parse is complete, an
+ * application may reuse the same Parser object, possibly with a
+ * different input source.</p>
+ *
+ * @param source The input source for the top-level of the
+ * XML document.
+ * @exception org.xml.sax.SAXException Any SAX exception, possibly
+ * wrapping another exception.
+ * @exception java.io.IOException An IO exception from the parser,
+ * possibly from a byte stream or character stream
+ * supplied by the application.
+ * @see org.xml.sax.InputSource
+ * @see #parse(java.lang.String)
+ * @see #setEntityResolver
+ * @see #setDTDHandler
+ * @see #setDocumentHandler
+ * @see #setErrorHandler
+ */
+ public abstract void parse (InputSource source)
+ throws SAXException, IOException;
+
+
+ /**
+ * Parse an XML document from a system identifier (URI).
+ *
+ * <p>This method is a shortcut for the common case of reading a
+ * document from a system identifier. It is the exact
+ * equivalent of the following:</p>
+ *
+ * <pre>
+ * parse(new InputSource(systemId));
+ * </pre>
+ *
+ * <p>If the system identifier is a URL, it must be fully resolved
+ * by the application before it is passed to the parser.</p>
+ *
+ * @param systemId The system identifier (URI).
+ * @exception org.xml.sax.SAXException Any SAX exception, possibly
+ * wrapping another exception.
+ * @exception java.io.IOException An IO exception from the parser,
+ * possibly from a byte stream or character stream
+ * supplied by the application.
+ * @see #parse(org.xml.sax.InputSource)
+ */
+ public abstract void parse (String systemId)
+ throws SAXException, IOException;
+
+}
+
+// end of Parser.java
diff --git a/libjava/org/xml/sax/SAXException.java b/libjava/org/xml/sax/SAXException.java
index 69537e91706..b11d998edad 100644
--- a/libjava/org/xml/sax/SAXException.java
+++ b/libjava/org/xml/sax/SAXException.java
@@ -1,144 +1,153 @@
-// SAX exception class.
-// No warranty; no copyright -- use this as you will.
-// $Id: SAXException.java,v 1.1 2000/10/02 02:43:17 sboag Exp $
-
-package org.xml.sax;
-
-/**
- * Encapsulate a general SAX error or warning.
- *
- * <blockquote>
- * <em>This module, both source code and documentation, is in the
- * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
- * </blockquote>
- *
- * <p>This class can contain basic error or warning information from
- * either the XML parser or the application: a parser writer or
- * application writer can subclass it to provide additional
- * functionality. SAX handlers may throw this exception or
- * any exception subclassed from it.</p>
- *
- * <p>If the application needs to pass through other types of
- * exceptions, it must wrap those exceptions in a SAXException
- * or an exception derived from a SAXException.</p>
- *
- * <p>If the parser or application needs to include information about a
- * specific location in an XML document, it should use the
- * {@link org.xml.sax.SAXParseException SAXParseException} subclass.</p>
- *
- * @since SAX 1.0
- * @author David Megginson,
- * <a href="mailto:sax@megginson.com">sax@megginson.com</a>
- * @version 2.0
- * @see org.xml.sax.SAXParseException
- */
-public class SAXException extends Exception {
-
-
- /**
- * Create a new SAXException.
- *
- * @param message The error or warning message.
- * @see org.xml.sax.Parser#setLocale
- */
- public SAXException (String message) {
- super(message);
- this.exception = null;
- }
-
-
- /**
- * Create a new SAXException wrapping an existing exception.
- *
- * <p>The existing exception will be embedded in the new
- * one, and its message will become the default message for
- * the SAXException.</p>
- *
- * @param e The exception to be wrapped in a SAXException.
- */
- public SAXException (Exception e)
- {
- super();
- this.exception = e;
- }
-
-
- /**
- * Create a new SAXException from an existing exception.
- *
- * <p>The existing exception will be embedded in the new
- * one, but the new exception will have its own message.</p>
- *
- * @param message The detail message.
- * @param e The exception to be wrapped in a SAXException.
- * @see org.xml.sax.Parser#setLocale
- */
- public SAXException (String message, Exception e)
- {
- super(message);
- this.exception = e;
- }
-
-
- /**
- * Return a detail message for this exception.
- *
- * <p>If there is an embedded exception, and if the SAXException
- * has no detail message of its own, this method will return
- * the detail message from the embedded exception.</p>
- *
- * @return The error or warning message.
- * @see org.xml.sax.Parser#setLocale
- */
- public String getMessage ()
- {
- String message = super.getMessage();
-
- if (message == null && exception != null) {
- return exception.getMessage();
- } else {
- return message;
- }
- }
-
-
- /**
- * Return the embedded exception, if any.
- *
- * @return The embedded exception, or null if there is none.
- */
- public Exception getException ()
- {
- return exception;
- }
-
-
- /**
- * Override toString to pick up any embedded exception.
- *
- * @return A string representation of this exception.
- */
- public String toString ()
- {
- if (exception != null) {
- return exception.toString();
- } else {
- return super.toString();
- }
- }
-
-
-
- //////////////////////////////////////////////////////////////////////
- // Internal state.
- //////////////////////////////////////////////////////////////////////
-
-
- /**
- * @serial The embedded exception if tunnelling, or null.
- */
- private Exception exception;
-
-}
-
-// end of SAXException.java
+// SAX exception class.
+// http://www.saxproject.org
+// No warranty; no copyright -- use this as you will.
+// $Id: SAXException.java,v 1.4.2.4 2002/01/29 21:34:14 dbrownell Exp $
+
+package org.xml.sax;
+
+/**
+ * Encapsulate a general SAX error or warning.
+ *
+ * <blockquote>
+ * <em>This module, both source code and documentation, is in the
+ * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
+ * See <a href='http://www.saxproject.org'>http://www.saxproject.org</a>
+ * for further information.
+ * </blockquote>
+ *
+ * <p>This class can contain basic error or warning information from
+ * either the XML parser or the application: a parser writer or
+ * application writer can subclass it to provide additional
+ * functionality. SAX handlers may throw this exception or
+ * any exception subclassed from it.</p>
+ *
+ * <p>If the application needs to pass through other types of
+ * exceptions, it must wrap those exceptions in a SAXException
+ * or an exception derived from a SAXException.</p>
+ *
+ * <p>If the parser or application needs to include information about a
+ * specific location in an XML document, it should use the
+ * {@link org.xml.sax.SAXParseException SAXParseException} subclass.</p>
+ *
+ * @since SAX 1.0
+ * @author David Megginson
+ * @version 2.0.1 (sax2r2)
+ * @see org.xml.sax.SAXParseException
+ */
+public class SAXException extends Exception {
+
+
+ /**
+ * Create a new SAXException.
+ */
+ public SAXException ()
+ {
+ super();
+ this.exception = null;
+ }
+
+
+ /**
+ * Create a new SAXException.
+ *
+ * @param message The error or warning message.
+ */
+ public SAXException (String message) {
+ super(message);
+ this.exception = null;
+ }
+
+
+ /**
+ * Create a new SAXException wrapping an existing exception.
+ *
+ * <p>The existing exception will be embedded in the new
+ * one, and its message will become the default message for
+ * the SAXException.</p>
+ *
+ * @param e The exception to be wrapped in a SAXException.
+ */
+ public SAXException (Exception e)
+ {
+ super();
+ this.exception = e;
+ }
+
+
+ /**
+ * Create a new SAXException from an existing exception.
+ *
+ * <p>The existing exception will be embedded in the new
+ * one, but the new exception will have its own message.</p>
+ *
+ * @param message The detail message.
+ * @param e The exception to be wrapped in a SAXException.
+ */
+ public SAXException (String message, Exception e)
+ {
+ super(message);
+ this.exception = e;
+ }
+
+
+ /**
+ * Return a detail message for this exception.
+ *
+ * <p>If there is an embedded exception, and if the SAXException
+ * has no detail message of its own, this method will return
+ * the detail message from the embedded exception.</p>
+ *
+ * @return The error or warning message.
+ */
+ public String getMessage ()
+ {
+ String message = super.getMessage();
+
+ if (message == null && exception != null) {
+ return exception.getMessage();
+ } else {
+ return message;
+ }
+ }
+
+
+ /**
+ * Return the embedded exception, if any.
+ *
+ * @return The embedded exception, or null if there is none.
+ */
+ public Exception getException ()
+ {
+ return exception;
+ }
+
+
+ /**
+ * Override toString to pick up any embedded exception.
+ *
+ * @return A string representation of this exception.
+ */
+ public String toString ()
+ {
+ if (exception != null) {
+ return exception.toString();
+ } else {
+ return super.toString();
+ }
+ }
+
+
+
+ //////////////////////////////////////////////////////////////////////
+ // Internal state.
+ //////////////////////////////////////////////////////////////////////
+
+
+ /**
+ * @serial The embedded exception if tunnelling, or null.
+ */
+ private Exception exception;
+
+}
+
+// end of SAXException.java
diff --git a/libjava/org/xml/sax/SAXNotRecognizedException.java b/libjava/org/xml/sax/SAXNotRecognizedException.java
index 0fbc4c85ba9..83aac69a7d3 100644
--- a/libjava/org/xml/sax/SAXNotRecognizedException.java
+++ b/libjava/org/xml/sax/SAXNotRecognizedException.java
@@ -1,44 +1,55 @@
-// SAXNotRecognizedException.java - unrecognized feature or value.
-// Written by David Megginson, sax@megginson.com
-// NO WARRANTY! This class is in the Public Domain.
-
-// $Id: SAXNotRecognizedException.java,v 1.1 2000/10/02 02:43:17 sboag Exp $
-
-
-package org.xml.sax;
-
-
-/**
- * Exception class for an unrecognized identifier.
- *
- * <blockquote>
- * <em>This module, both source code and documentation, is in the
- * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
- * </blockquote>
- *
- * <p>An XMLReader will throw this exception when it finds an
- * unrecognized feature or property identifier; SAX applications and
- * extensions may use this class for other, similar purposes.</p>
- *
- * @since SAX 2.0
- * @author David Megginson,
- * <a href="mailto:sax@megginson.com">sax@megginson.com</a>
- * @version 2.0
- * @see org.xml.sax.SAXNotSupportedException
- */
-public class SAXNotRecognizedException extends SAXException
-{
-
- /**
- * Construct a new exception with the given message.
- *
- * @param message The text message of the exception.
- */
- public SAXNotRecognizedException (String message)
- {
- super(message);
- }
-
-}
-
-// end of SAXNotRecognizedException.java
+// SAXNotRecognizedException.java - unrecognized feature or value.
+// http://www.saxproject.org
+// Written by David Megginson
+// NO WARRANTY! This class is in the Public Domain.
+
+// $Id: SAXNotRecognizedException.java,v 1.4.2.3 2002/01/29 21:34:14 dbrownell Exp $
+
+
+package org.xml.sax;
+
+
+/**
+ * Exception class for an unrecognized identifier.
+ *
+ * <blockquote>
+ * <em>This module, both source code and documentation, is in the
+ * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
+ * See <a href='http://www.saxproject.org'>http://www.saxproject.org</a>
+ * for further information.
+ * </blockquote>
+ *
+ * <p>An XMLReader will throw this exception when it finds an
+ * unrecognized feature or property identifier; SAX applications and
+ * extensions may use this class for other, similar purposes.</p>
+ *
+ * @since SAX 2.0
+ * @author David Megginson
+ * @version 2.0.1 (sax2r2)
+ * @see org.xml.sax.SAXNotSupportedException
+ */
+public class SAXNotRecognizedException extends SAXException
+{
+
+ /**
+ * Default constructor.
+ */
+ public SAXNotRecognizedException ()
+ {
+ super();
+ }
+
+
+ /**
+ * Construct a new exception with the given message.
+ *
+ * @param message The text message of the exception.
+ */
+ public SAXNotRecognizedException (String message)
+ {
+ super(message);
+ }
+
+}
+
+// end of SAXNotRecognizedException.java
diff --git a/libjava/org/xml/sax/SAXNotSupportedException.java b/libjava/org/xml/sax/SAXNotSupportedException.java
index 3376d47cc5b..2939eb192a5 100644
--- a/libjava/org/xml/sax/SAXNotSupportedException.java
+++ b/libjava/org/xml/sax/SAXNotSupportedException.java
@@ -1,44 +1,55 @@
-// SAXNotSupportedException.java - unsupported feature or value.
-// Written by David Megginson, sax@megginson.com
-// NO WARRANTY! This class is in the Public Domain.
-
-// $Id: SAXNotSupportedException.java,v 1.1 2000/10/02 02:43:17 sboag Exp $
-
-
-package org.xml.sax;
-
-/**
- * Exception class for an unsupported operation.
- *
- * <blockquote>
- * <em>This module, both source code and documentation, is in the
- * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
- * </blockquote>
- *
- * <p>An XMLReader will throw this exception when it recognizes a
- * feature or property identifier, but cannot perform the requested
- * operation (setting a state or value). Other SAX2 applications and
- * extensions may use this class for similar purposes.</p>
- *
- * @since SAX 2.0
- * @author David Megginson,
- * <a href="mailto:sax@megginson.com">sax@megginson.com</a>
- * @version 2.0
- * @see org.xml.sax.SAXNotRecognizedException
- */
-public class SAXNotSupportedException extends SAXException
-{
-
- /**
- * Construct a new exception with the given message.
- *
- * @param message The text message of the exception.
- */
- public SAXNotSupportedException (String message)
- {
- super(message);
- }
-
-}
-
-// end of SAXNotSupportedException.java
+// SAXNotSupportedException.java - unsupported feature or value.
+// http://www.saxproject.org
+// Written by David Megginson
+// NO WARRANTY! This class is in the Public Domain.
+
+// $Id: SAXNotSupportedException.java,v 1.4.2.3 2002/01/29 21:34:14 dbrownell Exp $
+
+
+package org.xml.sax;
+
+/**
+ * Exception class for an unsupported operation.
+ *
+ * <blockquote>
+ * <em>This module, both source code and documentation, is in the
+ * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
+ * See <a href='http://www.saxproject.org'>http://www.saxproject.org</a>
+ * for further information.
+ * </blockquote>
+ *
+ * <p>An XMLReader will throw this exception when it recognizes a
+ * feature or property identifier, but cannot perform the requested
+ * operation (setting a state or value). Other SAX2 applications and
+ * extensions may use this class for similar purposes.</p>
+ *
+ * @since SAX 2.0
+ * @author David Megginson
+ * @version 2.0.1 (sax2r2)
+ * @see org.xml.sax.SAXNotRecognizedException
+ */
+public class SAXNotSupportedException extends SAXException
+{
+
+ /**
+ * Construct a new exception with no message.
+ */
+ public SAXNotSupportedException ()
+ {
+ super();
+ }
+
+
+ /**
+ * Construct a new exception with the given message.
+ *
+ * @param message The text message of the exception.
+ */
+ public SAXNotSupportedException (String message)
+ {
+ super(message);
+ }
+
+}
+
+// end of SAXNotSupportedException.java
diff --git a/libjava/org/xml/sax/SAXParseException.java b/libjava/org/xml/sax/SAXParseException.java
index a5dcc06f0fb..e87d79f3f74 100644
--- a/libjava/org/xml/sax/SAXParseException.java
+++ b/libjava/org/xml/sax/SAXParseException.java
@@ -1,264 +1,270 @@
-// SAX exception class.
-// No warranty; no copyright -- use this as you will.
-// $Id: SAXParseException.java,v 1.1 2000/10/02 02:43:17 sboag Exp $
-
-package org.xml.sax;
-
-/**
- * Encapsulate an XML parse error or warning.
- *
- * <blockquote>
- * <em>This module, both source code and documentation, is in the
- * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
- * </blockquote>
- *
- * <p>This exception will include information for locating the error
- * in the original XML document. Note that although the application
- * will receive a SAXParseException as the argument to the handlers
- * in the {@link org.xml.sax.ErrorHandler ErrorHandler} interface,
- * the application is not actually required to throw the exception;
- * instead, it can simply read the information in it and take a
- * different action.</p>
- *
- * <p>Since this exception is a subclass of {@link org.xml.sax.SAXException
- * SAXException}, it inherits the ability to wrap another exception.</p>
- *
- * @since SAX 1.0
- * @author David Megginson,
- * <a href="mailto:sax@megginson.com">sax@megginson.com</a>
- * @version 2.0
- * @see org.xml.sax.SAXException
- * @see org.xml.sax.Locator
- * @see org.xml.sax.ErrorHandler
- */
-public class SAXParseException extends SAXException {
-
-
- //////////////////////////////////////////////////////////////////////
- // Constructors.
- //////////////////////////////////////////////////////////////////////
-
-
- /**
- * Create a new SAXParseException from a message and a Locator.
- *
- * <p>This constructor is especially useful when an application is
- * creating its own exception from within a {@link org.xml.sax.ContentHandler
- * ContentHandler} callback.</p>
- *
- * @param message The error or warning message.
- * @param locator The locator object for the error or warning (may be
- * null).
- * @see org.xml.sax.Locator
- * @see org.xml.sax.Parser#setLocale
- */
- public SAXParseException (String message, Locator locator) {
- super(message);
- if (locator != null) {
- init(locator.getPublicId(), locator.getSystemId(),
- locator.getLineNumber(), locator.getColumnNumber());
- } else {
- init(null, null, -1, -1);
- }
- }
-
-
- /**
- * Wrap an existing exception in a SAXParseException.
- *
- * <p>This constructor is especially useful when an application is
- * creating its own exception from within a {@link org.xml.sax.ContentHandler
- * ContentHandler} callback, and needs to wrap an existing exception that is not a
- * subclass of {@link org.xml.sax.SAXException SAXException}.</p>
- *
- * @param message The error or warning message, or null to
- * use the message from the embedded exception.
- * @param locator The locator object for the error or warning (may be
- * null).
- * @param e Any exception.
- * @see org.xml.sax.Locator
- * @see org.xml.sax.Parser#setLocale
- */
- public SAXParseException (String message, Locator locator,
- Exception e) {
- super(message, e);
- if (locator != null) {
- init(locator.getPublicId(), locator.getSystemId(),
- locator.getLineNumber(), locator.getColumnNumber());
- } else {
- init(null, null, -1, -1);
- }
- }
-
-
- /**
- * Create a new SAXParseException.
- *
- * <p>This constructor is most useful for parser writers.</p>
- *
- * <p>If the system identifier is a URL, the parser must resolve it
- * fully before creating the exception.</p>
- *
- * @param message The error or warning message.
- * @param publicId The public identifier of the entity that generated
- * the error or warning.
- * @param systemId The system identifier of the entity that generated
- * the error or warning.
- * @param lineNumber The line number of the end of the text that
- * caused the error or warning.
- * @param columnNumber The column number of the end of the text that
- * cause the error or warning.
- * @see org.xml.sax.Parser#setLocale
- */
- public SAXParseException (String message, String publicId, String systemId,
- int lineNumber, int columnNumber)
- {
- super(message);
- init(publicId, systemId, lineNumber, columnNumber);
- }
-
-
- /**
- * Create a new SAXParseException with an embedded exception.
- *
- * <p>This constructor is most useful for parser writers who
- * need to wrap an exception that is not a subclass of
- * {@link org.xml.sax.SAXException SAXException}.</p>
- *
- * <p>If the system identifier is a URL, the parser must resolve it
- * fully before creating the exception.</p>
- *
- * @param message The error or warning message, or null to use
- * the message from the embedded exception.
- * @param publicId The public identifier of the entity that generated
- * the error or warning.
- * @param systemId The system identifier of the entity that generated
- * the error or warning.
- * @param lineNumber The line number of the end of the text that
- * caused the error or warning.
- * @param columnNumber The column number of the end of the text that
- * cause the error or warning.
- * @param e Another exception to embed in this one.
- * @see org.xml.sax.Parser#setLocale
- */
- public SAXParseException (String message, String publicId, String systemId,
- int lineNumber, int columnNumber, Exception e)
- {
- super(message, e);
- init(publicId, systemId, lineNumber, columnNumber);
- }
-
-
- /**
- * Internal initialization method.
- *
- * @param publicId The public identifier of the entity which generated the exception,
- * or null.
- * @param systemId The system identifier of the entity which generated the exception,
- * or null.
- * @param lineNumber The line number of the error, or -1.
- * @param columnNumber The column number of the error, or -1.
- */
- private void init (String publicId, String systemId,
- int lineNumber, int columnNumber)
- {
- this.publicId = publicId;
- this.systemId = systemId;
- this.lineNumber = lineNumber;
- this.columnNumber = columnNumber;
- }
-
-
- /**
- * Get the public identifier of the entity where the exception occurred.
- *
- * @return A string containing the public identifier, or null
- * if none is available.
- * @see org.xml.sax.Locator#getPublicId
- */
- public String getPublicId ()
- {
- return this.publicId;
- }
-
-
- /**
- * Get the system identifier of the entity where the exception occurred.
- *
- * <p>If the system identifier is a URL, it will be resolved
- * fully.</p>
- *
- * @return A string containing the system identifier, or null
- * if none is available.
- * @see org.xml.sax.Locator#getSystemId
- */
- public String getSystemId ()
- {
- return this.systemId;
- }
-
-
- /**
- * The line number of the end of the text where the exception occurred.
- *
- * @return An integer representing the line number, or -1
- * if none is available.
- * @see org.xml.sax.Locator#getLineNumber
- */
- public int getLineNumber ()
- {
- return this.lineNumber;
- }
-
-
- /**
- * The column number of the end of the text where the exception occurred.
- *
- * <p>The first column in a line is position 1.</p>
- *
- * @return An integer representing the column number, or -1
- * if none is available.
- * @see org.xml.sax.Locator#getColumnNumber
- */
- public int getColumnNumber ()
- {
- return this.columnNumber;
- }
-
-
-
- //////////////////////////////////////////////////////////////////////
- // Internal state.
- //////////////////////////////////////////////////////////////////////
-
-
- /**
- * @serial The public identifier, or null.
- * @see #getPublicId
- */
- private String publicId;
-
-
- /**
- * @serial The system identifier, or null.
- * @see #getSystemId
- */
- private String systemId;
-
-
- /**
- * @serial The line number, or -1.
- * @see #getLineNumber
- */
- private int lineNumber;
-
-
- /**
- * @serial The column number, or -1.
- * @see #getColumnNumber
- */
- private int columnNumber;
-
-}
-
-// end of SAXParseException.java
+// SAX exception class.
+// http://www.saxproject.org
+// No warranty; no copyright -- use this as you will.
+// $Id: SAXParseException.java,v 1.3.2.5 2002/01/29 21:34:14 dbrownell Exp $
+
+package org.xml.sax;
+
+/**
+ * Encapsulate an XML parse error or warning.
+ *
+ * <blockquote>
+ * <em>This module, both source code and documentation, is in the
+ * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
+ * See <a href='http://www.saxproject.org'>http://www.saxproject.org</a>
+ * for further information.
+ * </blockquote>
+ *
+ * <p>This exception may include information for locating the error
+ * in the original XML document, as if it came from a {@link Locator}
+ * object. Note that although the application
+ * will receive a SAXParseException as the argument to the handlers
+ * in the {@link org.xml.sax.ErrorHandler ErrorHandler} interface,
+ * the application is not actually required to throw the exception;
+ * instead, it can simply read the information in it and take a
+ * different action.</p>
+ *
+ * <p>Since this exception is a subclass of {@link org.xml.sax.SAXException
+ * SAXException}, it inherits the ability to wrap another exception.</p>
+ *
+ * @since SAX 1.0
+ * @author David Megginson
+ * @version 2.0.1 (sax2r2)
+ * @see org.xml.sax.SAXException
+ * @see org.xml.sax.Locator
+ * @see org.xml.sax.ErrorHandler
+ */
+public class SAXParseException extends SAXException {
+
+
+ //////////////////////////////////////////////////////////////////////
+ // Constructors.
+ //////////////////////////////////////////////////////////////////////
+
+
+ /**
+ * Create a new SAXParseException from a message and a Locator.
+ *
+ * <p>This constructor is especially useful when an application is
+ * creating its own exception from within a {@link org.xml.sax.ContentHandler
+ * ContentHandler} callback.</p>
+ *
+ * @param message The error or warning message.
+ * @param locator The locator object for the error or warning (may be
+ * null).
+ * @see org.xml.sax.Locator
+ */
+ public SAXParseException (String message, Locator locator) {
+ super(message);
+ if (locator != null) {
+ init(locator.getPublicId(), locator.getSystemId(),
+ locator.getLineNumber(), locator.getColumnNumber());
+ } else {
+ init(null, null, -1, -1);
+ }
+ }
+
+
+ /**
+ * Wrap an existing exception in a SAXParseException.
+ *
+ * <p>This constructor is especially useful when an application is
+ * creating its own exception from within a {@link org.xml.sax.ContentHandler
+ * ContentHandler} callback, and needs to wrap an existing exception that is not a
+ * subclass of {@link org.xml.sax.SAXException SAXException}.</p>
+ *
+ * @param message The error or warning message, or null to
+ * use the message from the embedded exception.
+ * @param locator The locator object for the error or warning (may be
+ * null).
+ * @param e Any exception.
+ * @see org.xml.sax.Locator
+ */
+ public SAXParseException (String message, Locator locator,
+ Exception e) {
+ super(message, e);
+ if (locator != null) {
+ init(locator.getPublicId(), locator.getSystemId(),
+ locator.getLineNumber(), locator.getColumnNumber());
+ } else {
+ init(null, null, -1, -1);
+ }
+ }
+
+
+ /**
+ * Create a new SAXParseException.
+ *
+ * <p>This constructor is most useful for parser writers.</p>
+ *
+ * <p>All parameters except the message are as if
+ * they were provided by a {@link Locator}. For example, if the
+ * system identifier is a URL (including relative filename), the
+ * caller must resolve it fully before creating the exception.</p>
+ *
+ *
+ * @param message The error or warning message.
+ * @param publicId The public identifer of the entity that generated
+ * the error or warning.
+ * @param systemId The system identifer of the entity that generated
+ * the error or warning.
+ * @param lineNumber The line number of the end of the text that
+ * caused the error or warning.
+ * @param columnNumber The column number of the end of the text that
+ * cause the error or warning.
+ */
+ public SAXParseException (String message, String publicId, String systemId,
+ int lineNumber, int columnNumber)
+ {
+ super(message);
+ init(publicId, systemId, lineNumber, columnNumber);
+ }
+
+
+ /**
+ * Create a new SAXParseException with an embedded exception.
+ *
+ * <p>This constructor is most useful for parser writers who
+ * need to wrap an exception that is not a subclass of
+ * {@link org.xml.sax.SAXException SAXException}.</p>
+ *
+ * <p>All parameters except the message and exception are as if
+ * they were provided by a {@link Locator}. For example, if the
+ * system identifier is a URL (including relative filename), the
+ * caller must resolve it fully before creating the exception.</p>
+ *
+ * @param message The error or warning message, or null to use
+ * the message from the embedded exception.
+ * @param publicId The public identifer of the entity that generated
+ * the error or warning.
+ * @param systemId The system identifer of the entity that generated
+ * the error or warning.
+ * @param lineNumber The line number of the end of the text that
+ * caused the error or warning.
+ * @param columnNumber The column number of the end of the text that
+ * cause the error or warning.
+ * @param e Another exception to embed in this one.
+ */
+ public SAXParseException (String message, String publicId, String systemId,
+ int lineNumber, int columnNumber, Exception e)
+ {
+ super(message, e);
+ init(publicId, systemId, lineNumber, columnNumber);
+ }
+
+
+ /**
+ * Internal initialization method.
+ *
+ * @param publicId The public identifier of the entity which generated the exception,
+ * or null.
+ * @param systemId The system identifier of the entity which generated the exception,
+ * or null.
+ * @param lineNumber The line number of the error, or -1.
+ * @param columnNumber The column number of the error, or -1.
+ */
+ private void init (String publicId, String systemId,
+ int lineNumber, int columnNumber)
+ {
+ this.publicId = publicId;
+ this.systemId = systemId;
+ this.lineNumber = lineNumber;
+ this.columnNumber = columnNumber;
+ }
+
+
+ /**
+ * Get the public identifier of the entity where the exception occurred.
+ *
+ * @return A string containing the public identifier, or null
+ * if none is available.
+ * @see org.xml.sax.Locator#getPublicId
+ */
+ public String getPublicId ()
+ {
+ return this.publicId;
+ }
+
+
+ /**
+ * Get the system identifier of the entity where the exception occurred.
+ *
+ * <p>If the system identifier is a URL, it will have been resolved
+ * fully.</p>
+ *
+ * @return A string containing the system identifier, or null
+ * if none is available.
+ * @see org.xml.sax.Locator#getSystemId
+ */
+ public String getSystemId ()
+ {
+ return this.systemId;
+ }
+
+
+ /**
+ * The line number of the end of the text where the exception occurred.
+ *
+ * <p>The first line is line 1.</p>
+ *
+ * @return An integer representing the line number, or -1
+ * if none is available.
+ * @see org.xml.sax.Locator#getLineNumber
+ */
+ public int getLineNumber ()
+ {
+ return this.lineNumber;
+ }
+
+
+ /**
+ * The column number of the end of the text where the exception occurred.
+ *
+ * <p>The first column in a line is position 1.</p>
+ *
+ * @return An integer representing the column number, or -1
+ * if none is available.
+ * @see org.xml.sax.Locator#getColumnNumber
+ */
+ public int getColumnNumber ()
+ {
+ return this.columnNumber;
+ }
+
+
+
+ //////////////////////////////////////////////////////////////////////
+ // Internal state.
+ //////////////////////////////////////////////////////////////////////
+
+
+ /**
+ * @serial The public identifier, or null.
+ * @see #getPublicId
+ */
+ private String publicId;
+
+
+ /**
+ * @serial The system identifier, or null.
+ * @see #getSystemId
+ */
+ private String systemId;
+
+
+ /**
+ * @serial The line number, or -1.
+ * @see #getLineNumber
+ */
+ private int lineNumber;
+
+
+ /**
+ * @serial The column number, or -1.
+ * @see #getColumnNumber
+ */
+ private int columnNumber;
+
+}
+
+// end of SAXParseException.java
diff --git a/libjava/org/xml/sax/XMLFilter.java b/libjava/org/xml/sax/XMLFilter.java
index b10e8647ff0..eaca11ca321 100644
--- a/libjava/org/xml/sax/XMLFilter.java
+++ b/libjava/org/xml/sax/XMLFilter.java
@@ -1,65 +1,67 @@
-// XMLFilter.java - filter SAX2 events.
-// Written by David Megginson, sax@megginson.com
-// NO WARRANTY! This class is in the Public Domain.
-
-// $Id: XMLFilter.java,v 1.1 2000/10/02 02:43:17 sboag Exp $
-
-
-package org.xml.sax;
-
-
-/**
- * Interface for an XML filter.
- *
- * <blockquote>
- * <em>This module, both source code and documentation, is in the
- * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
- * </blockquote>
- *
- * <p>An XML filter is like an XML reader, except that it obtains its
- * events from another XML reader rather than a primary source like
- * an XML document or database. Filters can modify a stream of
- * events as they pass on to the final application.</p>
- *
- * <p>The XMLFilterImpl helper class provides a convenient base
- * for creating SAX2 filters, by passing on all {@link org.xml.sax.EntityResolver
- * EntityResolver}, {@link org.xml.sax.DTDHandler DTDHandler},
- * {@link org.xml.sax.ContentHandler ContentHandler} and {@link org.xml.sax.ErrorHandler
- * ErrorHandler} events automatically.</p>
- *
- * @since SAX 2.0
- * @author David Megginson,
- * <a href="mailto:sax@megginson.com">sax@megginson.com</a>
- * @version 2.0
- * @see org.xml.sax.helpers.XMLFilterImpl
- */
-public interface XMLFilter extends XMLReader
-{
-
- /**
- * Set the parent reader.
- *
- * <p>This method allows the application to link the filter to
- * a parent reader (which may be another filter). The argument
- * may not be null.</p>
- *
- * @param parent The parent reader.
- */
- public abstract void setParent (XMLReader parent);
-
-
- /**
- * Get the parent reader.
- *
- * <p>This method allows the application to query the parent
- * reader (which may be another filter). It is generally a
- * bad idea to perform any operations on the parent reader
- * directly: they should all pass through this filter.</p>
- *
- * @return The parent filter, or null if none has been set.
- */
- public abstract XMLReader getParent ();
-
-}
-
-// end of XMLFilter.java
+// XMLFilter.java - filter SAX2 events.
+// http://www.saxproject.org
+// Written by David Megginson
+// NO WARRANTY! This class is in the Public Domain.
+
+// $Id: XMLFilter.java,v 1.3.2.3 2002/01/29 21:34:14 dbrownell Exp $
+
+
+package org.xml.sax;
+
+
+/**
+ * Interface for an XML filter.
+ *
+ * <blockquote>
+ * <em>This module, both source code and documentation, is in the
+ * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
+ * See <a href='http://www.saxproject.org'>http://www.saxproject.org</a>
+ * for further information.
+ * </blockquote>
+ *
+ * <p>An XML filter is like an XML reader, except that it obtains its
+ * events from another XML reader rather than a primary source like
+ * an XML document or database. Filters can modify a stream of
+ * events as they pass on to the final application.</p>
+ *
+ * <p>The XMLFilterImpl helper class provides a convenient base
+ * for creating SAX2 filters, by passing on all {@link org.xml.sax.EntityResolver
+ * EntityResolver}, {@link org.xml.sax.DTDHandler DTDHandler},
+ * {@link org.xml.sax.ContentHandler ContentHandler} and {@link org.xml.sax.ErrorHandler
+ * ErrorHandler} events automatically.</p>
+ *
+ * @since SAX 2.0
+ * @author David Megginson
+ * @version 2.0.1 (sax2r2)
+ * @see org.xml.sax.helpers.XMLFilterImpl
+ */
+public interface XMLFilter extends XMLReader
+{
+
+ /**
+ * Set the parent reader.
+ *
+ * <p>This method allows the application to link the filter to
+ * a parent reader (which may be another filter). The argument
+ * may not be null.</p>
+ *
+ * @param parent The parent reader.
+ */
+ public abstract void setParent (XMLReader parent);
+
+
+ /**
+ * Get the parent reader.
+ *
+ * <p>This method allows the application to query the parent
+ * reader (which may be another filter). It is generally a
+ * bad idea to perform any operations on the parent reader
+ * directly: they should all pass through this filter.</p>
+ *
+ * @return The parent filter, or null if none has been set.
+ */
+ public abstract XMLReader getParent ();
+
+}
+
+// end of XMLFilter.java
diff --git a/libjava/org/xml/sax/XMLReader.java b/libjava/org/xml/sax/XMLReader.java
index 26e382b9fa9..23f3daf3a9f 100644
--- a/libjava/org/xml/sax/XMLReader.java
+++ b/libjava/org/xml/sax/XMLReader.java
@@ -1,415 +1,398 @@
-// XMLReader.java - read an XML document.
-// Written by David Megginson, sax@megginson.com
-// NO WARRANTY! This class is in the Public Domain.
-
-// $Id: XMLReader.java,v 1.1 2000/10/02 02:43:17 sboag Exp $
-
-package org.xml.sax;
-
-import java.io.IOException;
-
-
-/**
- * Interface for reading an XML document using callbacks.
- *
- * <blockquote>
- * <em>This module, both source code and documentation, is in the
- * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
- * </blockquote>
- *
- * <p><strong>Note:</strong> despite its name, this interface does
- * <em>not</em> extend the standard Java {@link java.io.Reader Reader}
- * interface, because reading XML is a fundamentally different activity
- * than reading character data.</p>
- *
- * <p>XMLReader is the interface that an XML parser's SAX2 driver must
- * implement. This interface allows an application to set and
- * query features and properties in the parser, to register
- * event handlers for document processing, and to initiate
- * a document parse.</p>
- *
- * <p>All SAX interfaces are assumed to be synchronous: the
- * {@link #parse parse} methods must not return until parsing
- * is complete, and readers must wait for an event-handler callback
- * to return before reporting the next event.</p>
- *
- * <p>This interface replaces the (now deprecated) SAX 1.0 {@link
- * org.xml.sax.Parser Parser} interface. The XMLReader interface
- * contains two important enhancements over the old Parser
- * interface:</p>
- *
- * <ol>
- * <li>it adds a standard way to query and set features and
- * properties; and</li>
- * <li>it adds Namespace support, which is required for many
- * higher-level XML standards.</li>
- * </ol>
- *
- * <p>There are adapters available to convert a SAX1 Parser to
- * a SAX2 XMLReader and vice-versa.</p>
- *
- * @since SAX 2.0
- * @author David Megginson,
- * <a href="mailto:sax@megginson.com">sax@megginson.com</a>
- * @version 2.0
- * @see org.xml.sax.XMLFilter
- * @see org.xml.sax.helpers.ParserAdapter
- * @see org.xml.sax.helpers.XMLReaderAdapter
- */
-public interface XMLReader
-{
-
-
- ////////////////////////////////////////////////////////////////////
- // Configuration.
- ////////////////////////////////////////////////////////////////////
-
-
- /**
- * Look up the value of a feature.
- *
- * <p>The feature name is any fully-qualified URI. It is
- * possible for an XMLReader to recognize a feature name but
- * to be unable to return its value; this is especially true
- * in the case of an adapter for a SAX1 Parser, which has
- * no way of knowing whether the underlying parser is
- * performing validation or expanding external entities.</p>
- *
- * <p>All XMLReaders are required to recognize the
- * http://xml.org/sax/features/namespaces and the
- * http://xml.org/sax/features/namespace-prefixes feature names.</p>
- *
- * <p>Some feature values may be available only in specific
- * contexts, such as before, during, or after a parse.</p>
- *
- * <p>Typical usage is something like this:</p>
- *
- * <pre>
- * XMLReader r = new MySAXDriver();
- *
- * // try to activate validation
- * try {
- * r.setFeature("http://xml.org/sax/features/validation", true);
- * } catch (SAXException e) {
- * System.err.println("Cannot activate validation.");
- * }
- *
- * // register event handlers
- * r.setContentHandler(new MyContentHandler());
- * r.setErrorHandler(new MyErrorHandler());
- *
- * // parse the first document
- * try {
- * r.parse("http://www.foo.com/mydoc.xml");
- * } catch (IOException e) {
- * System.err.println("I/O exception reading XML document");
- * } catch (SAXException e) {
- * System.err.println("XML exception reading document.");
- * }
- * </pre>
- *
- * <p>Implementors are free (and encouraged) to invent their own features,
- * using names built on their own URIs.</p>
- *
- * @param name The feature name, which is a fully-qualified URI.
- * @return The current state of the feature (true or false).
- * @exception org.xml.sax.SAXNotRecognizedException When the
- * XMLReader does not recognize the feature name.
- * @exception org.xml.sax.SAXNotSupportedException When the
- * XMLReader recognizes the feature name but
- * cannot determine its value at this time.
- * @see #setFeature
- */
- public boolean getFeature (String name)
- throws SAXNotRecognizedException, SAXNotSupportedException;
-
-
- /**
- * Set the state of a feature.
- *
- * <p>The feature name is any fully-qualified URI. It is
- * possible for an XMLReader to recognize a feature name but
- * to be unable to set its value; this is especially true
- * in the case of an adapter for a SAX1 {@link org.xml.sax.Parser Parser},
- * which has no way of affecting whether the underlying parser is
- * validating, for example.</p>
- *
- * <p>All XMLReaders are required to support setting
- * http://xml.org/sax/features/namespaces to true and
- * http://xml.org/sax/features/namespace-prefixes to false.</p>
- *
- * <p>Some feature values may be immutable or mutable only
- * in specific contexts, such as before, during, or after
- * a parse.</p>
- *
- * @param name The feature name, which is a fully-qualified URI.
- * @param state The requested state of the feature (true or false).
- * @exception org.xml.sax.SAXNotRecognizedException When the
- * XMLReader does not recognize the feature name.
- * @exception org.xml.sax.SAXNotSupportedException When the
- * XMLReader recognizes the feature name but
- * cannot set the requested value.
- * @see #getFeature
- */
- public void setFeature (String name, boolean value)
- throws SAXNotRecognizedException, SAXNotSupportedException;
-
-
- /**
- * Look up the value of a property.
- *
- * <p>The property name is any fully-qualified URI. It is
- * possible for an XMLReader to recognize a property name but
- * to be unable to return its state; this is especially true
- * in the case of an adapter for a SAX1 {@link org.xml.sax.Parser
- * Parser}.</p>
- *
- * <p>XMLReaders are not required to recognize any specific
- * property names, though an initial core set is documented for
- * SAX2.</p>
- *
- * <p>Some property values may be available only in specific
- * contexts, such as before, during, or after a parse.</p>
- *
- * <p>Implementors are free (and encouraged) to invent their own properties,
- * using names built on their own URIs.</p>
- *
- * @param name The property name, which is a fully-qualified URI.
- * @return The current value of the property.
- * @exception org.xml.sax.SAXNotRecognizedException When the
- * XMLReader does not recognize the property name.
- * @exception org.xml.sax.SAXNotSupportedException When the
- * XMLReader recognizes the property name but
- * cannot determine its value at this time.
- * @see #setProperty
- */
- public Object getProperty (String name)
- throws SAXNotRecognizedException, SAXNotSupportedException;
-
-
- /**
- * Set the value of a property.
- *
- * <p>The property name is any fully-qualified URI. It is
- * possible for an XMLReader to recognize a property name but
- * to be unable to set its value; this is especially true
- * in the case of an adapter for a SAX1 {@link org.xml.sax.Parser
- * Parser}.</p>
- *
- * <p>XMLReaders are not required to recognize setting
- * any specific property names, though a core set is provided with
- * SAX2.</p>
- *
- * <p>Some property values may be immutable or mutable only
- * in specific contexts, such as before, during, or after
- * a parse.</p>
- *
- * <p>This method is also the standard mechanism for setting
- * extended handlers.</p>
- *
- * @param name The property name, which is a fully-qualified URI.
- * @param state The requested value for the property.
- * @exception org.xml.sax.SAXNotRecognizedException When the
- * XMLReader does not recognize the property name.
- * @exception org.xml.sax.SAXNotSupportedException When the
- * XMLReader recognizes the property name but
- * cannot set the requested value.
- */
- public void setProperty (String name, Object value)
- throws SAXNotRecognizedException, SAXNotSupportedException;
-
-
-
- ////////////////////////////////////////////////////////////////////
- // Event handlers.
- ////////////////////////////////////////////////////////////////////
-
-
- /**
- * Allow an application to register an entity resolver.
- *
- * <p>If the application does not register an entity resolver,
- * the XMLReader will perform its own default resolution.</p>
- *
- * <p>Applications may register a new or different resolver in the
- * middle of a parse, and the SAX parser must begin using the new
- * resolver immediately.</p>
- *
- * @param resolver The entity resolver.
- * @exception java.lang.NullPointerException If the resolver
- * argument is null.
- * @see #getEntityResolver
- */
- public void setEntityResolver (EntityResolver resolver);
-
-
- /**
- * Return the current entity resolver.
- *
- * @return The current entity resolver, or null if none
- * has been registered.
- * @see #setEntityResolver
- */
- public EntityResolver getEntityResolver ();
-
-
- /**
- * Allow an application to register a DTD event handler.
- *
- * <p>If the application does not register a DTD handler, all DTD
- * events reported by the SAX parser will be silently ignored.</p>
- *
- * <p>Applications may register a new or different handler in the
- * middle of a parse, and the SAX parser must begin using the new
- * handler immediately.</p>
- *
- * @param handler The DTD handler.
- * @exception java.lang.NullPointerException If the handler
- * argument is null.
- * @see #getDTDHandler
- */
- public void setDTDHandler (DTDHandler handler);
-
-
- /**
- * Return the current DTD handler.
- *
- * @return The current DTD handler, or null if none
- * has been registered.
- * @see #setDTDHandler
- */
- public DTDHandler getDTDHandler ();
-
-
- /**
- * Allow an application to register a content event handler.
- *
- * <p>If the application does not register a content handler, all
- * content events reported by the SAX parser will be silently
- * ignored.</p>
- *
- * <p>Applications may register a new or different handler in the
- * middle of a parse, and the SAX parser must begin using the new
- * handler immediately.</p>
- *
- * @param handler The content handler.
- * @exception java.lang.NullPointerException If the handler
- * argument is null.
- * @see #getContentHandler
- */
- public void setContentHandler (ContentHandler handler);
-
-
- /**
- * Return the current content handler.
- *
- * @return The current content handler, or null if none
- * has been registered.
- * @see #setContentHandler
- */
- public ContentHandler getContentHandler ();
-
-
- /**
- * Allow an application to register an error event handler.
- *
- * <p>If the application does not register an error handler, all
- * error events reported by the SAX parser will be silently
- * ignored; however, normal processing may not continue. It is
- * highly recommended that all SAX applications implement an
- * error handler to avoid unexpected bugs.</p>
- *
- * <p>Applications may register a new or different handler in the
- * middle of a parse, and the SAX parser must begin using the new
- * handler immediately.</p>
- *
- * @param handler The error handler.
- * @exception java.lang.NullPointerException If the handler
- * argument is null.
- * @see #getErrorHandler
- */
- public void setErrorHandler (ErrorHandler handler);
-
-
- /**
- * Return the current error handler.
- *
- * @return The current error handler, or null if none
- * has been registered.
- * @see #setErrorHandler
- */
- public ErrorHandler getErrorHandler ();
-
-
-
- ////////////////////////////////////////////////////////////////////
- // Parsing.
- ////////////////////////////////////////////////////////////////////
-
- /**
- * Parse an XML document.
- *
- * <p>The application can use this method to instruct the XML
- * reader to begin parsing an XML document from any valid input
- * source (a character stream, a byte stream, or a URI).</p>
- *
- * <p>Applications may not invoke this method while a parse is in
- * progress (they should create a new XMLReader instead for each
- * nested XML document). Once a parse is complete, an
- * application may reuse the same XMLReader object, possibly with a
- * different input source.</p>
- *
- * <p>During the parse, the XMLReader will provide information
- * about the XML document through the registered event
- * handlers.</p>
- *
- * <p>This method is synchronous: it will not return until parsing
- * has ended. If a client application wants to terminate
- * parsing early, it should throw an exception.</p>
- *
- * @param source The input source for the top-level of the
- * XML document.
- * @exception org.xml.sax.SAXException Any SAX exception, possibly
- * wrapping another exception.
- * @exception java.io.IOException An IO exception from the parser,
- * possibly from a byte stream or character stream
- * supplied by the application.
- * @see org.xml.sax.InputSource
- * @see #parse(java.lang.String)
- * @see #setEntityResolver
- * @see #setDTDHandler
- * @see #setContentHandler
- * @see #setErrorHandler
- */
- public void parse (InputSource input)
- throws IOException, SAXException;
-
-
- /**
- * Parse an XML document from a system identifier (URI).
- *
- * <p>This method is a shortcut for the common case of reading a
- * document from a system identifier. It is the exact
- * equivalent of the following:</p>
- *
- * <pre>
- * parse(new InputSource(systemId));
- * </pre>
- *
- * <p>If the system identifier is a URL, it must be fully resolved
- * by the application before it is passed to the parser.</p>
- *
- * @param systemId The system identifier (URI).
- * @exception org.xml.sax.SAXException Any SAX exception, possibly
- * wrapping another exception.
- * @exception java.io.IOException An IO exception from the parser,
- * possibly from a byte stream or character stream
- * supplied by the application.
- * @see #parse(org.xml.sax.InputSource)
- */
- public void parse (String systemId)
- throws IOException, SAXException;
-
-}
-
-// end of XMLReader.java
+// XMLReader.java - read an XML document.
+// http://www.saxproject.org
+// Written by David Megginson
+// NO WARRANTY! This class is in the Public Domain.
+
+// $Id: XMLReader.java,v 1.3.2.5 2002/01/29 21:34:14 dbrownell Exp $
+
+package org.xml.sax;
+
+import java.io.IOException;
+
+
+/**
+ * Interface for reading an XML document using callbacks.
+ *
+ * <blockquote>
+ * <em>This module, both source code and documentation, is in the
+ * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
+ * See <a href='http://www.saxproject.org'>http://www.saxproject.org</a>
+ * for further information.
+ * </blockquote>
+ *
+ * <p><strong>Note:</strong> despite its name, this interface does
+ * <em>not</em> extend the standard Java {@link java.io.Reader Reader}
+ * interface, because reading XML is a fundamentally different activity
+ * than reading character data.</p>
+ *
+ * <p>XMLReader is the interface that an XML parser's SAX2 driver must
+ * implement. This interface allows an application to set and
+ * query features and properties in the parser, to register
+ * event handlers for document processing, and to initiate
+ * a document parse.</p>
+ *
+ * <p>All SAX interfaces are assumed to be synchronous: the
+ * {@link #parse parse} methods must not return until parsing
+ * is complete, and readers must wait for an event-handler callback
+ * to return before reporting the next event.</p>
+ *
+ * <p>This interface replaces the (now deprecated) SAX 1.0 {@link
+ * org.xml.sax.Parser Parser} interface. The XMLReader interface
+ * contains two important enhancements over the old Parser
+ * interface (as well as some minor ones):</p>
+ *
+ * <ol>
+ * <li>it adds a standard way to query and set features and
+ * properties; and</li>
+ * <li>it adds Namespace support, which is required for many
+ * higher-level XML standards.</li>
+ * </ol>
+ *
+ * <p>There are adapters available to convert a SAX1 Parser to
+ * a SAX2 XMLReader and vice-versa.</p>
+ *
+ * @since SAX 2.0
+ * @author David Megginson
+ * @version 2.0.1 (sax2r2)
+ * @see org.xml.sax.XMLFilter
+ * @see org.xml.sax.helpers.ParserAdapter
+ * @see org.xml.sax.helpers.XMLReaderAdapter
+ */
+public interface XMLReader
+{
+
+
+ ////////////////////////////////////////////////////////////////////
+ // Configuration.
+ ////////////////////////////////////////////////////////////////////
+
+
+ /**
+ * Look up the value of a feature flag.
+ *
+ * <p>The feature name is any fully-qualified URI. It is
+ * possible for an XMLReader to recognize a feature name but
+ * temporarily be unable to return its value.
+ * Some feature values may be available only in specific
+ * contexts, such as before, during, or after a parse.
+ * Also, some feature values may not be programmatically accessible.
+ * (In the case of an adapter for SAX1 {@link Parser}, there is no
+ * implementation-independent way to expose whether the underlying
+ * parser is performing validation, expanding external entities,
+ * and so forth.) </p>
+ *
+ * <p>All XMLReaders are required to recognize the
+ * http://xml.org/sax/features/namespaces and the
+ * http://xml.org/sax/features/namespace-prefixes feature names.</p>
+ *
+ * <p>Typical usage is something like this:</p>
+ *
+ * <pre>
+ * XMLReader r = new MySAXDriver();
+ *
+ * // try to activate validation
+ * try {
+ * r.setFeature("http://xml.org/sax/features/validation", true);
+ * } catch (SAXException e) {
+ * System.err.println("Cannot activate validation.");
+ * }
+ *
+ * // register event handlers
+ * r.setContentHandler(new MyContentHandler());
+ * r.setErrorHandler(new MyErrorHandler());
+ *
+ * // parse the first document
+ * try {
+ * r.parse("http://www.foo.com/mydoc.xml");
+ * } catch (IOException e) {
+ * System.err.println("I/O exception reading XML document");
+ * } catch (SAXException e) {
+ * System.err.println("XML exception reading document.");
+ * }
+ * </pre>
+ *
+ * <p>Implementors are free (and encouraged) to invent their own features,
+ * using names built on their own URIs.</p>
+ *
+ * @param name The feature name, which is a fully-qualified URI.
+ * @return The current value of the feature (true or false).
+ * @exception org.xml.sax.SAXNotRecognizedException If the feature
+ * value can't be assigned or retrieved.
+ * @exception org.xml.sax.SAXNotSupportedException When the
+ * XMLReader recognizes the feature name but
+ * cannot determine its value at this time.
+ * @see #setFeature
+ */
+ public boolean getFeature (String name)
+ throws SAXNotRecognizedException, SAXNotSupportedException;
+
+
+ /**
+ * Set the value of a feature flag.
+ *
+ * <p>The feature name is any fully-qualified URI. It is
+ * possible for an XMLReader to expose a feature value but
+ * to be unable to change the current value.
+ * Some feature values may be immutable or mutable only
+ * in specific contexts, such as before, during, or after
+ * a parse.</p>
+ *
+ * <p>All XMLReaders are required to support setting
+ * http://xml.org/sax/features/namespaces to true and
+ * http://xml.org/sax/features/namespace-prefixes to false.</p>
+ *
+ * @param name The feature name, which is a fully-qualified URI.
+ * @param value The requested value of the feature (true or false).
+ * @exception org.xml.sax.SAXNotRecognizedException If the feature
+ * value can't be assigned or retrieved.
+ * @exception org.xml.sax.SAXNotSupportedException When the
+ * XMLReader recognizes the feature name but
+ * cannot set the requested value.
+ * @see #getFeature
+ */
+ public void setFeature (String name, boolean value)
+ throws SAXNotRecognizedException, SAXNotSupportedException;
+
+
+ /**
+ * Look up the value of a property.
+ *
+ * <p>The property name is any fully-qualified URI. It is
+ * possible for an XMLReader to recognize a property name but
+ * temporarily be unable to return its value.
+ * Some property values may be available only in specific
+ * contexts, such as before, during, or after a parse.</p>
+ *
+ * <p>XMLReaders are not required to recognize any specific
+ * property names, though an initial core set is documented for
+ * SAX2.</p>
+ *
+ * <p>Implementors are free (and encouraged) to invent their own properties,
+ * using names built on their own URIs.</p>
+ *
+ * @param name The property name, which is a fully-qualified URI.
+ * @return The current value of the property.
+ * @exception org.xml.sax.SAXNotRecognizedException If the property
+ * value can't be assigned or retrieved.
+ * @exception org.xml.sax.SAXNotSupportedException When the
+ * XMLReader recognizes the property name but
+ * cannot determine its value at this time.
+ * @see #setProperty
+ */
+ public Object getProperty (String name)
+ throws SAXNotRecognizedException, SAXNotSupportedException;
+
+
+ /**
+ * Set the value of a property.
+ *
+ * <p>The property name is any fully-qualified URI. It is
+ * possible for an XMLReader to recognize a property name but
+ * to be unable to change the current value.
+ * Some property values may be immutable or mutable only
+ * in specific contexts, such as before, during, or after
+ * a parse.</p>
+ *
+ * <p>XMLReaders are not required to recognize setting
+ * any specific property names, though a core set is defined by
+ * SAX2.</p>
+ *
+ * <p>This method is also the standard mechanism for setting
+ * extended handlers.</p>
+ *
+ * @param name The property name, which is a fully-qualified URI.
+ * @param value The requested value for the property.
+ * @exception org.xml.sax.SAXNotRecognizedException If the property
+ * value can't be assigned or retrieved.
+ * @exception org.xml.sax.SAXNotSupportedException When the
+ * XMLReader recognizes the property name but
+ * cannot set the requested value.
+ */
+ public void setProperty (String name, Object value)
+ throws SAXNotRecognizedException, SAXNotSupportedException;
+
+
+
+ ////////////////////////////////////////////////////////////////////
+ // Event handlers.
+ ////////////////////////////////////////////////////////////////////
+
+
+ /**
+ * Allow an application to register an entity resolver.
+ *
+ * <p>If the application does not register an entity resolver,
+ * the XMLReader will perform its own default resolution.</p>
+ *
+ * <p>Applications may register a new or different resolver in the
+ * middle of a parse, and the SAX parser must begin using the new
+ * resolver immediately.</p>
+ *
+ * @param resolver The entity resolver.
+ * @see #getEntityResolver
+ */
+ public void setEntityResolver (EntityResolver resolver);
+
+
+ /**
+ * Return the current entity resolver.
+ *
+ * @return The current entity resolver, or null if none
+ * has been registered.
+ * @see #setEntityResolver
+ */
+ public EntityResolver getEntityResolver ();
+
+
+ /**
+ * Allow an application to register a DTD event handler.
+ *
+ * <p>If the application does not register a DTD handler, all DTD
+ * events reported by the SAX parser will be silently ignored.</p>
+ *
+ * <p>Applications may register a new or different handler in the
+ * middle of a parse, and the SAX parser must begin using the new
+ * handler immediately.</p>
+ *
+ * @param handler The DTD handler.
+ * @see #getDTDHandler
+ */
+ public void setDTDHandler (DTDHandler handler);
+
+
+ /**
+ * Return the current DTD handler.
+ *
+ * @return The current DTD handler, or null if none
+ * has been registered.
+ * @see #setDTDHandler
+ */
+ public DTDHandler getDTDHandler ();
+
+
+ /**
+ * Allow an application to register a content event handler.
+ *
+ * <p>If the application does not register a content handler, all
+ * content events reported by the SAX parser will be silently
+ * ignored.</p>
+ *
+ * <p>Applications may register a new or different handler in the
+ * middle of a parse, and the SAX parser must begin using the new
+ * handler immediately.</p>
+ *
+ * @param handler The content handler.
+ * @see #getContentHandler
+ */
+ public void setContentHandler (ContentHandler handler);
+
+
+ /**
+ * Return the current content handler.
+ *
+ * @return The current content handler, or null if none
+ * has been registered.
+ * @see #setContentHandler
+ */
+ public ContentHandler getContentHandler ();
+
+
+ /**
+ * Allow an application to register an error event handler.
+ *
+ * <p>If the application does not register an error handler, all
+ * error events reported by the SAX parser will be silently
+ * ignored; however, normal processing may not continue. It is
+ * highly recommended that all SAX applications implement an
+ * error handler to avoid unexpected bugs.</p>
+ *
+ * <p>Applications may register a new or different handler in the
+ * middle of a parse, and the SAX parser must begin using the new
+ * handler immediately.</p>
+ *
+ * @param handler The error handler.
+ * @see #getErrorHandler
+ */
+ public void setErrorHandler (ErrorHandler handler);
+
+
+ /**
+ * Return the current error handler.
+ *
+ * @return The current error handler, or null if none
+ * has been registered.
+ * @see #setErrorHandler
+ */
+ public ErrorHandler getErrorHandler ();
+
+
+
+ ////////////////////////////////////////////////////////////////////
+ // Parsing.
+ ////////////////////////////////////////////////////////////////////
+
+ /**
+ * Parse an XML document.
+ *
+ * <p>The application can use this method to instruct the XML
+ * reader to begin parsing an XML document from any valid input
+ * source (a character stream, a byte stream, or a URI).</p>
+ *
+ * <p>Applications may not invoke this method while a parse is in
+ * progress (they should create a new XMLReader instead for each
+ * nested XML document). Once a parse is complete, an
+ * application may reuse the same XMLReader object, possibly with a
+ * different input source.</p>
+ *
+ * <p>During the parse, the XMLReader will provide information
+ * about the XML document through the registered event
+ * handlers.</p>
+ *
+ * <p>This method is synchronous: it will not return until parsing
+ * has ended. If a client application wants to terminate
+ * parsing early, it should throw an exception.</p>
+ *
+ * @param source The input source for the top-level of the
+ * XML document.
+ * @exception org.xml.sax.SAXException Any SAX exception, possibly
+ * wrapping another exception.
+ * @exception java.io.IOException An IO exception from the parser,
+ * possibly from a byte stream or character stream
+ * supplied by the application.
+ * @see org.xml.sax.InputSource
+ * @see #parse(java.lang.String)
+ * @see #setEntityResolver
+ * @see #setDTDHandler
+ * @see #setContentHandler
+ * @see #setErrorHandler
+ */
+ public void parse (InputSource input)
+ throws IOException, SAXException;
+
+
+ /**
+ * Parse an XML document from a system identifier (URI).
+ *
+ * <p>This method is a shortcut for the common case of reading a
+ * document from a system identifier. It is the exact
+ * equivalent of the following:</p>
+ *
+ * <pre>
+ * parse(new InputSource(systemId));
+ * </pre>
+ *
+ * <p>If the system identifier is a URL, it must be fully resolved
+ * by the application before it is passed to the parser.</p>
+ *
+ * @param systemId The system identifier (URI).
+ * @exception org.xml.sax.SAXException Any SAX exception, possibly
+ * wrapping another exception.
+ * @exception java.io.IOException An IO exception from the parser,
+ * possibly from a byte stream or character stream
+ * supplied by the application.
+ * @see #parse(org.xml.sax.InputSource)
+ */
+ public void parse (String systemId)
+ throws IOException, SAXException;
+
+}
diff --git a/libjava/org/xml/sax/ext/DeclHandler.java b/libjava/org/xml/sax/ext/DeclHandler.java
index 1fede3428de..742f4648c90 100644
--- a/libjava/org/xml/sax/ext/DeclHandler.java
+++ b/libjava/org/xml/sax/ext/DeclHandler.java
@@ -1,131 +1,143 @@
-// DeclHandler.java - Optional handler for DTD declaration events.
-// Public Domain: no warranty.
-// $Id: DeclHandler.java,v 1.1 2000/10/02 02:43:19 sboag Exp $
-
-package org.xml.sax.ext;
-
-import org.xml.sax.SAXException;
-
-
-/**
- * SAX2 extension handler for DTD declaration events.
- *
- * <blockquote>
- * <em>This module, both source code and documentation, is in the
- * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
- * </blockquote>
- *
- * <p>This is an optional extension handler for SAX2 to provide
- * information about DTD declarations in an XML document. XML
- * readers are not required to support this handler.</p>
- *
- * <p>Note that data-related DTD declarations (unparsed entities and
- * notations) are already reported through the {@link
- * org.xml.sax.DTDHandler DTDHandler} interface.</p>
- *
- * <p>If you are using the declaration handler together with a lexical
- * handler, all of the events will occur between the
- * {@link org.xml.sax.ext.LexicalHandler#startDTD startDTD} and the
- * {@link org.xml.sax.ext.LexicalHandler#endDTD endDTD} events.</p>
- *
- * <p>To set the DeclHandler for an XML reader, use the
- * {@link org.xml.sax.XMLReader#setProperty setProperty} method
- * with the propertyId "http://xml.org/sax/handlers/DeclHandler".
- * If the reader does not support declaration events, it will throw a
- * {@link org.xml.sax.SAXNotRecognizedException SAXNotRecognizedException}
- * or a
- * {@link org.xml.sax.SAXNotSupportedException SAXNotSupportedException}
- * when you attempt to register the handler.</p>
- *
- * @since SAX 2.0
- * @author David Megginson,
- * <a href="mailto:sax@megginson.com">sax@megginson.com</a>
- * @version 2.0beta
- * @see org.xml.sax.XMLReader
- */
-public interface DeclHandler
-{
-
- /**
- * Report an element type declaration.
- *
- * <p>The content model will consist of the string "EMPTY", the
- * string "ANY", or a parenthesised group, optionally followed
- * by an occurrence indicator. The model will be normalized so
- * that all whitespace is removed,and will include the enclosing
- * parentheses.</p>
- *
- * @param name The element type name.
- * @param model The content model as a normalized string.
- * @exception SAXException The application may raise an exception.
- */
- public abstract void elementDecl (String name, String model)
- throws SAXException;
-
-
- /**
- * Report an attribute type declaration.
- *
- * <p>Only the effective (first) declaration for an attribute will
- * be reported. The type will be one of the strings "CDATA",
- * "ID", "IDREF", "IDREFS", "NMTOKEN", "NMTOKENS", "ENTITY",
- * "ENTITIES", or "NOTATION", or a parenthesized token group with
- * the separator "|" and all whitespace removed.</p>
- *
- * @param eName The name of the associated element.
- * @param aName The name of the attribute.
- * @param type A string representing the attribute type.
- * @param valueDefault A string representing the attribute default
- * ("#IMPLIED", "#REQUIRED", or "#FIXED") or null if
- * none of these applies.
- * @param value A string representing the attribute's default value,
- * or null if there is none.
- * @exception SAXException The application may raise an exception.
- */
- public abstract void attributeDecl (String eName,
- String aName,
- String type,
- String valueDefault,
- String value)
- throws SAXException;
-
-
- /**
- * Report an internal entity declaration.
- *
- * <p>Only the effective (first) declaration for each entity
- * will be reported.</p>
- *
- * @param name The name of the entity. If it is a parameter
- * entity, the name will begin with '%'.
- * @param value The replacement text of the entity.
- * @exception SAXException The application may raise an exception.
- * @see #externalEntityDecl
- * @see org.xml.sax.DTDHandler#unparsedEntityDecl
- */
- public abstract void internalEntityDecl (String name, String value)
- throws SAXException;
-
-
- /**
- * Report a parsed external entity declaration.
- *
- * <p>Only the effective (first) declaration for each entity
- * will be reported.</p>
- *
- * @param name The name of the entity. If it is a parameter
- * entity, the name will begin with '%'.
- * @param publicId The declared public identifier of the entity, or
- * null if none was declared.
- * @param systemId The declared system identifier of the entity.
- * @exception SAXException The application may raise an exception.
- * @see #internalEntityDecl
- * @see org.xml.sax.DTDHandler#unparsedEntityDecl
- */
- public abstract void externalEntityDecl (String name, String publicId,
- String systemId)
- throws SAXException;
-
-}
-
-// end of DeclHandler.java
+// DeclHandler.java - Optional handler for DTD declaration events.
+// http://www.saxproject.org
+// Public Domain: no warranty.
+// $Id: DeclHandler.java,v 1.2.2.5 2002/01/29 21:34:14 dbrownell Exp $
+
+package org.xml.sax.ext;
+
+import org.xml.sax.SAXException;
+
+
+/**
+ * SAX2 extension handler for DTD declaration events.
+ *
+ * <blockquote>
+ * <em>This module, both source code and documentation, is in the
+ * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
+ * See <a href='http://www.saxproject.org'>http://www.saxproject.org</a>
+ * for further information.
+ * </blockquote>
+ *
+ * <p>This is an optional extension handler for SAX2 to provide more
+ * complete information about DTD declarations in an XML document.
+ * XML readers are not required to recognize this handler, and it
+ * is not part of core-only SAX2 distributions.</p>
+ *
+ * <p>Note that data-related DTD declarations (unparsed entities and
+ * notations) are already reported through the {@link
+ * org.xml.sax.DTDHandler DTDHandler} interface.</p>
+ *
+ * <p>If you are using the declaration handler together with a lexical
+ * handler, all of the events will occur between the
+ * {@link org.xml.sax.ext.LexicalHandler#startDTD startDTD} and the
+ * {@link org.xml.sax.ext.LexicalHandler#endDTD endDTD} events.</p>
+ *
+ * <p>To set the DeclHandler for an XML reader, use the
+ * {@link org.xml.sax.XMLReader#setProperty setProperty} method
+ * with the property name
+ * <code>http://xml.org/sax/properties/declaration-handler</code>
+ * and an object implementing this interface (or null) as the value.
+ * If the reader does not report declaration events, it will throw a
+ * {@link org.xml.sax.SAXNotRecognizedException SAXNotRecognizedException}
+ * when you attempt to register the handler.</p>
+ *
+ * @since SAX 2.0 (extensions 1.0)
+ * @author David Megginson
+ * @version 2.0.1 (sax2r2)
+ */
+public interface DeclHandler
+{
+
+ /**
+ * Report an element type declaration.
+ *
+ * <p>The content model will consist of the string "EMPTY", the
+ * string "ANY", or a parenthesised group, optionally followed
+ * by an occurrence indicator. The model will be normalized so
+ * that all parameter entities are fully resolved and all whitespace
+ * is removed,and will include the enclosing parentheses. Other
+ * normalization (such as removing redundant parentheses or
+ * simplifying occurrence indicators) is at the discretion of the
+ * parser.</p>
+ *
+ * @param name The element type name.
+ * @param model The content model as a normalized string.
+ * @exception SAXException The application may raise an exception.
+ */
+ public abstract void elementDecl (String name, String model)
+ throws SAXException;
+
+
+ /**
+ * Report an attribute type declaration.
+ *
+ * <p>Only the effective (first) declaration for an attribute will
+ * be reported. The type will be one of the strings "CDATA",
+ * "ID", "IDREF", "IDREFS", "NMTOKEN", "NMTOKENS", "ENTITY",
+ * "ENTITIES", a parenthesized token group with
+ * the separator "|" and all whitespace removed, or the word
+ * "NOTATION" followed by a space followed by a parenthesized
+ * token group with all whitespace removed.</p>
+ *
+ * <p>The value will be the value as reported to applications,
+ * appropriately normalized and with entity and character
+ * references expanded. </p>
+ *
+ * @param eName The name of the associated element.
+ * @param aName The name of the attribute.
+ * @param type A string representing the attribute type.
+ * @param mode A string representing the attribute defaulting mode
+ * ("#IMPLIED", "#REQUIRED", or "#FIXED") or null if
+ * none of these applies.
+ * @param value A string representing the attribute's default value,
+ * or null if there is none.
+ * @exception SAXException The application may raise an exception.
+ */
+ public abstract void attributeDecl (String eName,
+ String aName,
+ String type,
+ String mode,
+ String value)
+ throws SAXException;
+
+
+ /**
+ * Report an internal entity declaration.
+ *
+ * <p>Only the effective (first) declaration for each entity
+ * will be reported. All parameter entities in the value
+ * will be expanded, but general entities will not.</p>
+ *
+ * @param name The name of the entity. If it is a parameter
+ * entity, the name will begin with '%'.
+ * @param value The replacement text of the entity.
+ * @exception SAXException The application may raise an exception.
+ * @see #externalEntityDecl
+ * @see org.xml.sax.DTDHandler#unparsedEntityDecl
+ */
+ public abstract void internalEntityDecl (String name, String value)
+ throws SAXException;
+
+
+ /**
+ * Report a parsed external entity declaration.
+ *
+ * <p>Only the effective (first) declaration for each entity
+ * will be reported.</p>
+ *
+ * @param name The name of the entity. If it is a parameter
+ * entity, the name will begin with '%'.
+ * @param publicId The declared public identifier of the entity, or
+ * null if none was declared.
+ * @param systemId The declared system identifier of the entity.
+ * @exception SAXException The application may raise an exception.
+ * @see #internalEntityDecl
+ * @see org.xml.sax.DTDHandler#unparsedEntityDecl
+ */
+ public abstract void externalEntityDecl (String name, String publicId,
+ String systemId)
+ throws SAXException;
+
+}
+
+// end of DeclHandler.java
diff --git a/libjava/org/xml/sax/ext/LexicalHandler.java b/libjava/org/xml/sax/ext/LexicalHandler.java
index 4ac1617ca00..15b2557c504 100644
--- a/libjava/org/xml/sax/ext/LexicalHandler.java
+++ b/libjava/org/xml/sax/ext/LexicalHandler.java
@@ -1,161 +1,212 @@
-// LexicalHandler.java - optional handler for lexical parse events.
-// Public Domain: no warranty.
-// $Id: LexicalHandler.java,v 1.1 2000/10/02 02:43:20 sboag Exp $
-
-package org.xml.sax.ext;
-
-import org.xml.sax.SAXException;
-
-/**
- * SAX2 extension handler for lexical events.
- *
- * <blockquote>
- * <em>This module, both source code and documentation, is in the
- * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
- * </blockquote>
- *
- * <p>This is an optional extension handler for SAX2 to provide
- * lexical information about an XML document, such as comments
- * and CDATA section boundaries; XML readers are not required to
- * support this handler.</p>
- *
- * <p>The events in the lexical handler apply to the entire document,
- * not just to the document element, and all lexical handler events
- * must appear between the content handler's startDocument and
- * endDocument events.</p>
- *
- * <p>To set the LexicalHandler for an XML reader, use the
- * {@link org.xml.sax.XMLReader#setProperty setProperty} method
- * with the propertyId "http://xml.org/sax/handlers/LexicalHandler".
- * If the reader does not support lexical events, it will throw a
- * {@link org.xml.sax.SAXNotRecognizedException SAXNotRecognizedException}
- * or a
- * {@link org.xml.sax.SAXNotSupportedException SAXNotSupportedException}
- * when you attempt to register the handler.</p>
- *
- * @since SAX 2.0
- * @author David Megginson,
- * <a href="mailto:sax@megginson.com">sax@megginson.com</a>
- * @version 2.0beta
- * @see org.xml.sax.XMLReader#setProperty
- * @see org.xml.sax.SAXNotRecognizedException
- * @see org.xml.sax.SAXNotSupportedException
- */
-public interface LexicalHandler
-{
-
- /**
- * Report the start of DTD declarations, if any.
- *
- * <p>Any declarations are assumed to be in the internal subset
- * unless otherwise indicated by a {@link #startEntity startEntity}
- * event.</p>
- *
- * <p>Note that the start/endDTD events will appear within
- * the start/endDocument events from ContentHandler and
- * before the first startElement event.</p>
- *
- * @param name The document type name.
- * @param publicId The declared public identifier for the
- * external DTD subset, or null if none was declared.
- * @param systemId The declared system identifier for the
- * external DTD subset, or null if none was declared.
- * @exception SAXException The application may raise an
- * exception.
- * @see #endDTD
- * @see #startEntity
- */
- public abstract void startDTD (String name, String publicId,
- String systemId)
- throws SAXException;
-
-
- /**
- * Report the end of DTD declarations.
- *
- * @exception SAXException The application may raise an exception.
- * @see #startDTD
- */
- public abstract void endDTD ()
- throws SAXException;
-
-
- /**
- * Report the beginning of an entity in content.
- *
- * <p><strong>NOTE:</entity> entity references in attribute
- * values -- and the start and end of the document entity --
- * are never reported.</p>
- *
- * <p>The start and end of the external DTD subset are reported
- * using the pseudo-name "[dtd]". All other events must be
- * properly nested within start/end entity events.</p>
- *
- * <p>Note that skipped entities will be reported through the
- * {@link org.xml.sax.ContentHandler#skippedEntity skippedEntity}
- * event, which is part of the ContentHandler interface.</p>
- *
- * @param name The name of the entity. If it is a parameter
- * entity, the name will begin with '%'.
- * @exception SAXException The application may raise an exception.
- * @see #endEntity
- * @see org.xml.sax.ext.DeclHandler#internalEntityDecl
- * @see org.xml.sax.ext.DeclHandler#externalEntityDecl
- */
- public abstract void startEntity (String name)
- throws SAXException;
-
-
- /**
- * Report the end of an entity.
- *
- * @param name The name of the entity that is ending.
- * @exception SAXException The application may raise an exception.
- * @see #startEntity
- */
- public abstract void endEntity (String name)
- throws SAXException;
-
-
- /**
- * Report the start of a CDATA section.
- *
- * <p>The contents of the CDATA section will be reported through
- * the regular {@link org.xml.sax.ContentHandler#characters
- * characters} event.</p>
- *
- * @exception SAXException The application may raise an exception.
- * @see #endCDATA
- */
- public abstract void startCDATA ()
- throws SAXException;
-
-
- /**
- * Report the end of a CDATA section.
- *
- * @exception SAXException The application may raise an exception.
- * @see #startCDATA
- */
- public abstract void endCDATA ()
- throws SAXException;
-
-
- /**
- * Report an XML comment anywhere in the document.
- *
- * <p>This callback will be used for comments inside or outside the
- * document element, including comments in the external DTD
- * subset (if read).</p>
- *
- * @param ch An array holding the characters in the comment.
- * @param start The starting position in the array.
- * @param length The number of characters to use from the array.
- * @exception SAXException The application may raise an exception.
- */
- public abstract void comment (char ch[], int start, int length)
- throws SAXException;
-
-}
-
-// end of LexicalHandler.java
+// LexicalHandler.java - optional handler for lexical parse events.
+// http://www.saxproject.org
+// Public Domain: no warranty.
+// $Id: LexicalHandler.java,v 1.2.2.4 2002/01/29 21:34:14 dbrownell Exp $
+
+package org.xml.sax.ext;
+
+import org.xml.sax.SAXException;
+
+/**
+ * SAX2 extension handler for lexical events.
+ *
+ * <blockquote>
+ * <em>This module, both source code and documentation, is in the
+ * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
+ * See <a href='http://www.saxproject.org'>http://www.saxproject.org</a>
+ * for further information.
+ * </blockquote>
+ *
+ * <p>This is an optional extension handler for SAX2 to provide
+ * lexical information about an XML document, such as comments
+ * and CDATA section boundaries.
+ * XML readers are not required to recognize this handler, and it
+ * is not part of core-only SAX2 distributions.</p>
+ *
+ * <p>The events in the lexical handler apply to the entire document,
+ * not just to the document element, and all lexical handler events
+ * must appear between the content handler's startDocument and
+ * endDocument events.</p>
+ *
+ * <p>To set the LexicalHandler for an XML reader, use the
+ * {@link org.xml.sax.XMLReader#setProperty setProperty} method
+ * with the property name
+ * <code>http://xml.org/sax/properties/lexical-handler</code>
+ * and an object implementing this interface (or null) as the value.
+ * If the reader does not report lexical events, it will throw a
+ * {@link org.xml.sax.SAXNotRecognizedException SAXNotRecognizedException}
+ * when you attempt to register the handler.</p>
+ *
+ * @since SAX 2.0 (extensions 1.0)
+ * @author David Megginson
+ * @version 2.0.1 (sax2r2)
+ */
+public interface LexicalHandler
+{
+
+ /**
+ * Report the start of DTD declarations, if any.
+ *
+ * <p>This method is intended to report the beginning of the
+ * DOCTYPE declaration; if the document has no DOCTYPE declaration,
+ * this method will not be invoked.</p>
+ *
+ * <p>All declarations reported through
+ * {@link org.xml.sax.DTDHandler DTDHandler} or
+ * {@link org.xml.sax.ext.DeclHandler DeclHandler} events must appear
+ * between the startDTD and {@link #endDTD endDTD} events.
+ * Declarations are assumed to belong to the internal DTD subset
+ * unless they appear between {@link #startEntity startEntity}
+ * and {@link #endEntity endEntity} events. Comments and
+ * processing instructions from the DTD should also be reported
+ * between the startDTD and endDTD events, in their original
+ * order of (logical) occurrence; they are not required to
+ * appear in their correct locations relative to DTDHandler
+ * or DeclHandler events, however.</p>
+ *
+ * <p>Note that the start/endDTD events will appear within
+ * the start/endDocument events from ContentHandler and
+ * before the first
+ * {@link org.xml.sax.ContentHandler#startElement startElement}
+ * event.</p>
+ *
+ * @param name The document type name.
+ * @param publicId The declared public identifier for the
+ * external DTD subset, or null if none was declared.
+ * @param systemId The declared system identifier for the
+ * external DTD subset, or null if none was declared.
+ * (Note that this is not resolved against the document
+ * base URI.)
+ * @exception SAXException The application may raise an
+ * exception.
+ * @see #endDTD
+ * @see #startEntity
+ */
+ public abstract void startDTD (String name, String publicId,
+ String systemId)
+ throws SAXException;
+
+
+ /**
+ * Report the end of DTD declarations.
+ *
+ * <p>This method is intended to report the end of the
+ * DOCTYPE declaration; if the document has no DOCTYPE declaration,
+ * this method will not be invoked.</p>
+ *
+ * @exception SAXException The application may raise an exception.
+ * @see #startDTD
+ */
+ public abstract void endDTD ()
+ throws SAXException;
+
+
+ /**
+ * Report the beginning of some internal and external XML entities.
+ *
+ * <p>The reporting of parameter entities (including
+ * the external DTD subset) is optional, and SAX2 drivers that
+ * report LexicalHandler events may not implement it; you can use the
+ * <code
+ * >http://xml.org/sax/features/lexical-handler/parameter-entities</code>
+ * feature to query or control the reporting of parameter entities.</p>
+ *
+ * <p>General entities are reported with their regular names,
+ * parameter entities have '%' prepended to their names, and
+ * the external DTD subset has the pseudo-entity name "[dtd]".</p>
+ *
+ * <p>When a SAX2 driver is providing these events, all other
+ * events must be properly nested within start/end entity
+ * events. There is no additional requirement that events from
+ * {@link org.xml.sax.ext.DeclHandler DeclHandler} or
+ * {@link org.xml.sax.DTDHandler DTDHandler} be properly ordered.</p>
+ *
+ * <p>Note that skipped entities will be reported through the
+ * {@link org.xml.sax.ContentHandler#skippedEntity skippedEntity}
+ * event, which is part of the ContentHandler interface.</p>
+ *
+ * <p>Because of the streaming event model that SAX uses, some
+ * entity boundaries cannot be reported under any
+ * circumstances:</p>
+ *
+ * <ul>
+ * <li>general entities within attribute values</li>
+ * <li>parameter entities within declarations</li>
+ * </ul>
+ *
+ * <p>These will be silently expanded, with no indication of where
+ * the original entity boundaries were.</p>
+ *
+ * <p>Note also that the boundaries of character references (which
+ * are not really entities anyway) are not reported.</p>
+ *
+ * <p>All start/endEntity events must be properly nested.
+ *
+ * @param name The name of the entity. If it is a parameter
+ * entity, the name will begin with '%', and if it is the
+ * external DTD subset, it will be "[dtd]".
+ * @exception SAXException The application may raise an exception.
+ * @see #endEntity
+ * @see org.xml.sax.ext.DeclHandler#internalEntityDecl
+ * @see org.xml.sax.ext.DeclHandler#externalEntityDecl
+ */
+ public abstract void startEntity (String name)
+ throws SAXException;
+
+
+ /**
+ * Report the end of an entity.
+ *
+ * @param name The name of the entity that is ending.
+ * @exception SAXException The application may raise an exception.
+ * @see #startEntity
+ */
+ public abstract void endEntity (String name)
+ throws SAXException;
+
+
+ /**
+ * Report the start of a CDATA section.
+ *
+ * <p>The contents of the CDATA section will be reported through
+ * the regular {@link org.xml.sax.ContentHandler#characters
+ * characters} event; this event is intended only to report
+ * the boundary.</p>
+ *
+ * @exception SAXException The application may raise an exception.
+ * @see #endCDATA
+ */
+ public abstract void startCDATA ()
+ throws SAXException;
+
+
+ /**
+ * Report the end of a CDATA section.
+ *
+ * @exception SAXException The application may raise an exception.
+ * @see #startCDATA
+ */
+ public abstract void endCDATA ()
+ throws SAXException;
+
+
+ /**
+ * Report an XML comment anywhere in the document.
+ *
+ * <p>This callback will be used for comments inside or outside the
+ * document element, including comments in the external DTD
+ * subset (if read). Comments in the DTD must be properly
+ * nested inside start/endDTD and start/endEntity events (if
+ * used).</p>
+ *
+ * @param ch An array holding the characters in the comment.
+ * @param start The starting position in the array.
+ * @param length The number of characters to use from the array.
+ * @exception SAXException The application may raise an exception.
+ */
+ public abstract void comment (char ch[], int start, int length)
+ throws SAXException;
+
+}
+
+// end of LexicalHandler.java
diff --git a/libjava/org/xml/sax/ext/package.html b/libjava/org/xml/sax/ext/package.html
new file mode 100644
index 00000000000..bbb02f9276b
--- /dev/null
+++ b/libjava/org/xml/sax/ext/package.html
@@ -0,0 +1,49 @@
+<HTML><HEAD>
+
+</HEAD><BODY>
+
+<p>
+This package contains interfaces to optional SAX2 handlers.
+
+<p>See <a href='http://www.saxproject.org'>http://www.saxproject.org</a>
+for more information about SAX.</p>
+
+<p>
+The package is independent of the SAX2 core, though the functionality
+exposed generally needs to be implemented within a parser.
+That independence has several consequences:</p>
+
+<ul>
+
+<li>SAX2 drivers are <em>not</em> required to recognize these handlers,
+and you cannot assume that the class files will be present in every SAX2
+installation.</li>
+
+<li>This package may be updated independently of SAX2 (i.e. new
+handlers may be added without updating SAX2 itself).</li>
+
+<li>The handlers are not implemented by the SAX2
+<code>org.xml.sax.helpers.DefaultHandler</code> or
+<code>org.xml.sax.helpers.XMLFilterImpl</code> classes.
+You can subclass these if you need such behaviour.</li>
+
+<li>The handlers need to be registered differently than regular SAX2
+handlers.</li>
+
+</ul>
+
+<p>This package, SAX2-ext, is a standardized extension to SAX2. It is
+designed both to allow SAX parsers to pass certain types of information
+to applications, and to serve as a simple model for other SAX2 parser
+extension packages. Not all such extension packages should need to
+be recognized directly by parsers, however.
+As an example, most schema systems can be cleanly layered on top
+of parsers supporting the standardized SAX2 interfaces. </p>
+
+<p><strong>NOTE:</strong> this package alone does add any
+functionality; it simply provides optional interfaces for SAX2 drivers
+to use. You must use a SAX2 driver that recognizes these interfaces if
+you actually want to have access to lexical and declaration
+information.</p>
+
+</BODY></HTML>
diff --git a/libjava/org/xml/sax/helpers/AttributeListImpl.java b/libjava/org/xml/sax/helpers/AttributeListImpl.java
index 69754728c1f..6cabed4fe8b 100644
--- a/libjava/org/xml/sax/helpers/AttributeListImpl.java
+++ b/libjava/org/xml/sax/helpers/AttributeListImpl.java
@@ -1,310 +1,312 @@
-// SAX default implementation for AttributeList.
-// No warranty; no copyright -- use this as you will.
-// $Id: AttributeListImpl.java,v 1.1 2000/10/02 02:43:20 sboag Exp $
-
-package org.xml.sax.helpers;
-
-import org.xml.sax.AttributeList;
-
-import java.util.Vector;
-
-
-/**
- * Default implementation for AttributeList.
- *
- * <blockquote>
- * <em>This module, both source code and documentation, is in the
- * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
- * </blockquote>
- *
- * <p>AttributeList implements the deprecated SAX1 {@link
- * org.xml.sax.AttributeList AttributeList} interface, and has been
- * replaced by the new SAX2 {@link org.xml.sax.helpers.AttributesImpl
- * AttributesImpl} interface.</p>
- *
- * <p>This class provides a convenience implementation of the SAX
- * {@link org.xml.sax.AttributeList AttributeList} interface. This
- * implementation is useful both for SAX parser writers, who can use
- * it to provide attributes to the application, and for SAX application
- * writers, who can use it to create a persistent copy of an element's
- * attribute specifications:</p>
- *
- * <pre>
- * private AttributeList myatts;
- *
- * public void startElement (String name, AttributeList atts)
- * {
- * // create a persistent copy of the attribute list
- * // for use outside this method
- * myatts = new AttributeListImpl(atts);
- * [...]
- * }
- * </pre>
- *
- * <p>Please note that SAX parsers are not required to use this
- * class to provide an implementation of AttributeList; it is
- * supplied only as an optional convenience. In particular,
- * parser writers are encouraged to invent more efficient
- * implementations.</p>
- *
- * @deprecated This class implements a deprecated interface,
- * {@link org.xml.sax.AttributeList AttributeList};
- * that interface has been replaced by
- * {@link org.xml.sax.Attributes Attributes},
- * which is implemented in the
- * {@link org.xml.sax.helpers.AttributesImpl
- * AttributesImpl} helper class.
- * @since SAX 1.0
- * @author David Megginson,
- * <a href="mailto:sax@megginson.com">sax@megginson.com</a>
- * @version 2.0
- * @see org.xml.sax.AttributeList
- * @see org.xml.sax.DocumentHandler#startElement
- */
-public class AttributeListImpl implements AttributeList
-{
-
- /**
- * Create an empty attribute list.
- *
- * <p>This constructor is most useful for parser writers, who
- * will use it to create a single, reusable attribute list that
- * can be reset with the clear method between elements.</p>
- *
- * @see #addAttribute
- * @see #clear
- */
- public AttributeListImpl ()
- {
- }
-
-
- /**
- * Construct a persistent copy of an existing attribute list.
- *
- * <p>This constructor is most useful for application writers,
- * who will use it to create a persistent copy of an existing
- * attribute list.</p>
- *
- * @param atts The attribute list to copy
- * @see org.xml.sax.DocumentHandler#startElement
- */
- public AttributeListImpl (AttributeList atts)
- {
- setAttributeList(atts);
- }
-
-
-
- ////////////////////////////////////////////////////////////////////
- // Methods specific to this class.
- ////////////////////////////////////////////////////////////////////
-
-
- /**
- * Set the attribute list, discarding previous contents.
- *
- * <p>This method allows an application writer to reuse an
- * attribute list easily.</p>
- *
- * @param atts The attribute list to copy.
- */
- public void setAttributeList (AttributeList atts)
- {
- int count = atts.getLength();
-
- clear();
-
- for (int i = 0; i < count; i++) {
- addAttribute(atts.getName(i), atts.getType(i), atts.getValue(i));
- }
- }
-
-
- /**
- * Add an attribute to an attribute list.
- *
- * <p>This method is provided for SAX parser writers, to allow them
- * to build up an attribute list incrementally before delivering
- * it to the application.</p>
- *
- * @param name The attribute name.
- * @param type The attribute type ("NMTOKEN" for an enumeration).
- * @param value The attribute value (must not be null).
- * @see #removeAttribute
- * @see org.xml.sax.DocumentHandler#startElement
- */
- public void addAttribute (String name, String type, String value)
- {
- names.addElement(name);
- types.addElement(type);
- values.addElement(value);
- }
-
-
- /**
- * Remove an attribute from the list.
- *
- * <p>SAX application writers can use this method to filter an
- * attribute out of an AttributeList. Note that invoking this
- * method will change the length of the attribute list and
- * some of the attribute's indices.</p>
- *
- * <p>If the requested attribute is not in the list, this is
- * a no-op.</p>
- *
- * @param name The attribute name.
- * @see #addAttribute
- */
- public void removeAttribute (String name)
- {
- int i = names.indexOf(name);
-
- if (i >= 0) {
- names.removeElementAt(i);
- types.removeElementAt(i);
- values.removeElementAt(i);
- }
- }
-
-
- /**
- * Clear the attribute list.
- *
- * <p>SAX parser writers can use this method to reset the attribute
- * list between DocumentHandler.startElement events. Normally,
- * it will make sense to reuse the same AttributeListImpl object
- * rather than allocating a new one each time.</p>
- *
- * @see org.xml.sax.DocumentHandler#startElement
- */
- public void clear ()
- {
- names.removeAllElements();
- types.removeAllElements();
- values.removeAllElements();
- }
-
-
-
- ////////////////////////////////////////////////////////////////////
- // Implementation of org.xml.sax.AttributeList
- ////////////////////////////////////////////////////////////////////
-
-
- /**
- * Return the number of attributes in the list.
- *
- * @return The number of attributes in the list.
- * @see org.xml.sax.AttributeList#getLength
- */
- public int getLength ()
- {
- return names.size();
- }
-
-
- /**
- * Get the name of an attribute (by position).
- *
- * @param i The position of the attribute in the list.
- * @return The attribute name as a string, or null if there
- * is no attribute at that position.
- * @see org.xml.sax.AttributeList#getName(int)
- */
- public String getName (int i)
- {
- if (i < 0) {
- return null;
- }
- try {
- return (String)names.elementAt(i);
- } catch (ArrayIndexOutOfBoundsException e) {
- return null;
- }
- }
-
-
- /**
- * Get the type of an attribute (by position).
- *
- * @param i The position of the attribute in the list.
- * @return The attribute type as a string ("NMTOKEN" for an
- * enumeration, and "CDATA" if no declaration was
- * read), or null if there is no attribute at
- * that position.
- * @see org.xml.sax.AttributeList#getType(int)
- */
- public String getType (int i)
- {
- if (i < 0) {
- return null;
- }
- try {
- return (String)types.elementAt(i);
- } catch (ArrayIndexOutOfBoundsException e) {
- return null;
- }
- }
-
-
- /**
- * Get the value of an attribute (by position).
- *
- * @param i The position of the attribute in the list.
- * @return The attribute value as a string, or null if
- * there is no attribute at that position.
- * @see org.xml.sax.AttributeList#getValue(int)
- */
- public String getValue (int i)
- {
- if (i < 0) {
- return null;
- }
- try {
- return (String)values.elementAt(i);
- } catch (ArrayIndexOutOfBoundsException e) {
- return null;
- }
- }
-
-
- /**
- * Get the type of an attribute (by name).
- *
- * @param name The attribute name.
- * @return The attribute type as a string ("NMTOKEN" for an
- * enumeration, and "CDATA" if no declaration was
- * read).
- * @see org.xml.sax.AttributeList#getType(java.lang.String)
- */
- public String getType (String name)
- {
- return getType(names.indexOf(name));
- }
-
-
- /**
- * Get the value of an attribute (by name).
- *
- * @param name The attribute name.
- * @see org.xml.sax.AttributeList#getValue(java.lang.String)
- */
- public String getValue (String name)
- {
- return getValue(names.indexOf(name));
- }
-
-
-
- ////////////////////////////////////////////////////////////////////
- // Internal state.
- ////////////////////////////////////////////////////////////////////
-
- Vector names = new Vector();
- Vector types = new Vector();
- Vector values = new Vector();
-
-}
-
-// end of AttributeListImpl.java
+// SAX default implementation for AttributeList.
+// http://www.saxproject.org
+// No warranty; no copyright -- use this as you will.
+// $Id: AttributeListImpl.java,v 1.3.2.3 2002/01/29 21:34:14 dbrownell Exp $
+
+package org.xml.sax.helpers;
+
+import org.xml.sax.AttributeList;
+
+import java.util.Vector;
+
+
+/**
+ * Default implementation for AttributeList.
+ *
+ * <blockquote>
+ * <em>This module, both source code and documentation, is in the
+ * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
+ * See <a href='http://www.saxproject.org'>http://www.saxproject.org</a>
+ * for further information.
+ * </blockquote>
+ *
+ * <p>AttributeList implements the deprecated SAX1 {@link
+ * org.xml.sax.AttributeList AttributeList} interface, and has been
+ * replaced by the new SAX2 {@link org.xml.sax.helpers.AttributesImpl
+ * AttributesImpl} interface.</p>
+ *
+ * <p>This class provides a convenience implementation of the SAX
+ * {@link org.xml.sax.AttributeList AttributeList} interface. This
+ * implementation is useful both for SAX parser writers, who can use
+ * it to provide attributes to the application, and for SAX application
+ * writers, who can use it to create a persistent copy of an element's
+ * attribute specifications:</p>
+ *
+ * <pre>
+ * private AttributeList myatts;
+ *
+ * public void startElement (String name, AttributeList atts)
+ * {
+ * // create a persistent copy of the attribute list
+ * // for use outside this method
+ * myatts = new AttributeListImpl(atts);
+ * [...]
+ * }
+ * </pre>
+ *
+ * <p>Please note that SAX parsers are not required to use this
+ * class to provide an implementation of AttributeList; it is
+ * supplied only as an optional convenience. In particular,
+ * parser writers are encouraged to invent more efficient
+ * implementations.</p>
+ *
+ * @deprecated This class implements a deprecated interface,
+ * {@link org.xml.sax.AttributeList AttributeList};
+ * that interface has been replaced by
+ * {@link org.xml.sax.Attributes Attributes},
+ * which is implemented in the
+ * {@link org.xml.sax.helpers.AttributesImpl
+ * AttributesImpl} helper class.
+ * @since SAX 1.0
+ * @author David Megginson
+ * @version 2.0.1 (sax2r2)
+ * @see org.xml.sax.AttributeList
+ * @see org.xml.sax.DocumentHandler#startElement
+ */
+public class AttributeListImpl implements AttributeList
+{
+
+ /**
+ * Create an empty attribute list.
+ *
+ * <p>This constructor is most useful for parser writers, who
+ * will use it to create a single, reusable attribute list that
+ * can be reset with the clear method between elements.</p>
+ *
+ * @see #addAttribute
+ * @see #clear
+ */
+ public AttributeListImpl ()
+ {
+ }
+
+
+ /**
+ * Construct a persistent copy of an existing attribute list.
+ *
+ * <p>This constructor is most useful for application writers,
+ * who will use it to create a persistent copy of an existing
+ * attribute list.</p>
+ *
+ * @param atts The attribute list to copy
+ * @see org.xml.sax.DocumentHandler#startElement
+ */
+ public AttributeListImpl (AttributeList atts)
+ {
+ setAttributeList(atts);
+ }
+
+
+
+ ////////////////////////////////////////////////////////////////////
+ // Methods specific to this class.
+ ////////////////////////////////////////////////////////////////////
+
+
+ /**
+ * Set the attribute list, discarding previous contents.
+ *
+ * <p>This method allows an application writer to reuse an
+ * attribute list easily.</p>
+ *
+ * @param atts The attribute list to copy.
+ */
+ public void setAttributeList (AttributeList atts)
+ {
+ int count = atts.getLength();
+
+ clear();
+
+ for (int i = 0; i < count; i++) {
+ addAttribute(atts.getName(i), atts.getType(i), atts.getValue(i));
+ }
+ }
+
+
+ /**
+ * Add an attribute to an attribute list.
+ *
+ * <p>This method is provided for SAX parser writers, to allow them
+ * to build up an attribute list incrementally before delivering
+ * it to the application.</p>
+ *
+ * @param name The attribute name.
+ * @param type The attribute type ("NMTOKEN" for an enumeration).
+ * @param value The attribute value (must not be null).
+ * @see #removeAttribute
+ * @see org.xml.sax.DocumentHandler#startElement
+ */
+ public void addAttribute (String name, String type, String value)
+ {
+ names.addElement(name);
+ types.addElement(type);
+ values.addElement(value);
+ }
+
+
+ /**
+ * Remove an attribute from the list.
+ *
+ * <p>SAX application writers can use this method to filter an
+ * attribute out of an AttributeList. Note that invoking this
+ * method will change the length of the attribute list and
+ * some of the attribute's indices.</p>
+ *
+ * <p>If the requested attribute is not in the list, this is
+ * a no-op.</p>
+ *
+ * @param name The attribute name.
+ * @see #addAttribute
+ */
+ public void removeAttribute (String name)
+ {
+ int i = names.indexOf(name);
+
+ if (i >= 0) {
+ names.removeElementAt(i);
+ types.removeElementAt(i);
+ values.removeElementAt(i);
+ }
+ }
+
+
+ /**
+ * Clear the attribute list.
+ *
+ * <p>SAX parser writers can use this method to reset the attribute
+ * list between DocumentHandler.startElement events. Normally,
+ * it will make sense to reuse the same AttributeListImpl object
+ * rather than allocating a new one each time.</p>
+ *
+ * @see org.xml.sax.DocumentHandler#startElement
+ */
+ public void clear ()
+ {
+ names.removeAllElements();
+ types.removeAllElements();
+ values.removeAllElements();
+ }
+
+
+
+ ////////////////////////////////////////////////////////////////////
+ // Implementation of org.xml.sax.AttributeList
+ ////////////////////////////////////////////////////////////////////
+
+
+ /**
+ * Return the number of attributes in the list.
+ *
+ * @return The number of attributes in the list.
+ * @see org.xml.sax.AttributeList#getLength
+ */
+ public int getLength ()
+ {
+ return names.size();
+ }
+
+
+ /**
+ * Get the name of an attribute (by position).
+ *
+ * @param i The position of the attribute in the list.
+ * @return The attribute name as a string, or null if there
+ * is no attribute at that position.
+ * @see org.xml.sax.AttributeList#getName(int)
+ */
+ public String getName (int i)
+ {
+ if (i < 0) {
+ return null;
+ }
+ try {
+ return (String)names.elementAt(i);
+ } catch (ArrayIndexOutOfBoundsException e) {
+ return null;
+ }
+ }
+
+
+ /**
+ * Get the type of an attribute (by position).
+ *
+ * @param i The position of the attribute in the list.
+ * @return The attribute type as a string ("NMTOKEN" for an
+ * enumeration, and "CDATA" if no declaration was
+ * read), or null if there is no attribute at
+ * that position.
+ * @see org.xml.sax.AttributeList#getType(int)
+ */
+ public String getType (int i)
+ {
+ if (i < 0) {
+ return null;
+ }
+ try {
+ return (String)types.elementAt(i);
+ } catch (ArrayIndexOutOfBoundsException e) {
+ return null;
+ }
+ }
+
+
+ /**
+ * Get the value of an attribute (by position).
+ *
+ * @param i The position of the attribute in the list.
+ * @return The attribute value as a string, or null if
+ * there is no attribute at that position.
+ * @see org.xml.sax.AttributeList#getValue(int)
+ */
+ public String getValue (int i)
+ {
+ if (i < 0) {
+ return null;
+ }
+ try {
+ return (String)values.elementAt(i);
+ } catch (ArrayIndexOutOfBoundsException e) {
+ return null;
+ }
+ }
+
+
+ /**
+ * Get the type of an attribute (by name).
+ *
+ * @param name The attribute name.
+ * @return The attribute type as a string ("NMTOKEN" for an
+ * enumeration, and "CDATA" if no declaration was
+ * read).
+ * @see org.xml.sax.AttributeList#getType(java.lang.String)
+ */
+ public String getType (String name)
+ {
+ return getType(names.indexOf(name));
+ }
+
+
+ /**
+ * Get the value of an attribute (by name).
+ *
+ * @param name The attribute name.
+ * @see org.xml.sax.AttributeList#getValue(java.lang.String)
+ */
+ public String getValue (String name)
+ {
+ return getValue(names.indexOf(name));
+ }
+
+
+
+ ////////////////////////////////////////////////////////////////////
+ // Internal state.
+ ////////////////////////////////////////////////////////////////////
+
+ Vector names = new Vector();
+ Vector types = new Vector();
+ Vector values = new Vector();
+
+}
+
+// end of AttributeListImpl.java
diff --git a/libjava/org/xml/sax/helpers/AttributesImpl.java b/libjava/org/xml/sax/helpers/AttributesImpl.java
index b714f39fdb8..d16cb335664 100644
--- a/libjava/org/xml/sax/helpers/AttributesImpl.java
+++ b/libjava/org/xml/sax/helpers/AttributesImpl.java
@@ -1,606 +1,620 @@
-// AttributesImpl.java - default implementation of Attributes.
-// Written by David Megginson, sax@megginson.com
-// NO WARRANTY! This class is in the public domain.
-
-// $Id: AttributesImpl.java,v 1.2 2001/05/31 16:03:17 garyp Exp $
-
-
-package org.xml.sax.helpers;
-
-import org.xml.sax.Attributes;
-
-
-/**
- * Default implementation of the Attributes interface.
- *
- * <blockquote>
- * <em>This module, both source code and documentation, is in the
- * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
- * </blockquote>
- *
- * <p>This class provides a default implementation of the SAX2
- * {@link org.xml.sax.Attributes Attributes} interface, with the
- * addition of manipulators so that the list can be modified or
- * reused.</p>
- *
- * <p>There are two typical uses of this class:</p>
- *
- * <ol>
- * <li>to take a persistent snapshot of an Attributes object
- * in a {@link org.xml.sax.ContentHandler#startElement startElement} event; or</li>
- * <li>to construct or modify an Attributes object in a SAX2 driver or filter.</li>
- * </ol>
- *
- * <p>This class replaces the now-deprecated SAX1 {@link
- * org.xml.sax.helpers.AttributeListImpl AttributeListImpl}
- * class; in addition to supporting the updated Attributes
- * interface rather than the deprecated {@link org.xml.sax.AttributeList
- * AttributeList} interface, it also includes a much more efficient
- * implementation using a single array rather than a set of Vectors.</p>
- *
- * @since SAX 2.0
- * @author David Megginson,
- * <a href="mailto:sax@megginson.com">sax@megginson.com</a>
- * @version 2.0
- */
-public class AttributesImpl implements Attributes
-{
-
-
- ////////////////////////////////////////////////////////////////////
- // Constructors.
- ////////////////////////////////////////////////////////////////////
-
-
- /**
- * Construct a new, empty AttributesImpl object.
- */
- public AttributesImpl ()
- {
- length = 0;
- data = null;
- }
-
-
- /**
- * Copy an existing Attributes object.
- *
- * <p>This constructor is especially useful inside a
- * {@link org.xml.sax.ContentHandler#startElement startElement} event.</p>
- *
- * @param atts The existing Attributes object.
- */
- public AttributesImpl (Attributes atts)
- {
- setAttributes(atts);
- }
-
-
-
- ////////////////////////////////////////////////////////////////////
- // Implementation of org.xml.sax.Attributes.
- ////////////////////////////////////////////////////////////////////
-
-
- /**
- * Return the number of attributes in the list.
- *
- * @return The number of attributes in the list.
- * @see org.xml.sax.Attributes#getLength
- */
- public int getLength ()
- {
- return length;
- }
-
-
- /**
- * Return an attribute's Namespace URI.
- *
- * @param index The attribute's index (zero-based).
- * @return The Namespace URI, the empty string if none is
- * available, or null if the index is out of range.
- * @see org.xml.sax.Attributes#getURI
- */
- public String getURI (int index)
- {
- if (index >= 0 && index < length) {
- return data[index*5];
- } else {
- return null;
- }
- }
-
-
- /**
- * Return an attribute's local name.
- *
- * @param index The attribute's index (zero-based).
- * @return The attribute's local name, the empty string if
- * none is available, or null if the index if out of range.
- * @see org.xml.sax.Attributes#getLocalName
- */
- public String getLocalName (int index)
- {
- if (index >= 0 && index < length) {
- return data[index*5+1];
- } else {
- return null;
- }
- }
-
-
- /**
- * Return an attribute's qualified (prefixed) name.
- *
- * @param index The attribute's index (zero-based).
- * @return The attribute's qualified name, the empty string if
- * none is available, or null if the index is out of bounds.
- * @see org.xml.sax.Attributes#getQName
- */
- public String getQName (int index)
- {
- if (index >= 0 && index < length) {
- return data[index*5+2];
- } else {
- return null;
- }
- }
-
-
- /**
- * Return an attribute's type by index.
- *
- * @param index The attribute's index (zero-based).
- * @return The attribute's type, "CDATA" if the type is unknown, or null
- * if the index is out of bounds.
- * @see org.xml.sax.Attributes#getType(int)
- */
- public String getType (int index)
- {
- if (index >= 0 && index < length) {
- return data[index*5+3];
- } else {
- return null;
- }
- }
-
-
- /**
- * Return an attribute's value by index.
- *
- * @param index The attribute's index (zero-based).
- * @return The attribute's value or null if the index is out of bounds.
- * @see org.xml.sax.Attributes#getValue(int)
- */
- public String getValue (int index)
- {
- if (index >= 0 && index < length) {
- return data[index*5+4];
- } else {
- return null;
- }
- }
-
-
- /**
- * Look up an attribute's index by Namespace name.
- *
- * <p>In many cases, it will be more efficient to look up the name once and
- * use the index query methods rather than using the name query methods
- * repeatedly.</p>
- *
- * @param uri The attribute's Namespace URI, or the empty
- * string if none is available.
- * @param localName The attribute's local name.
- * @return The attribute's index, or -1 if none matches.
- * @see org.xml.sax.Attributes#getIndex(java.lang.String,java.lang.String)
- */
- public int getIndex (String uri, String localName)
- {
- int max = length * 5;
- for (int i = 0; i < max; i += 5) {
- if (data[i].equals(uri) && data[i+1].equals(localName)) {
- return i / 5;
- }
- }
- return -1;
- }
-
-
- /**
- * Look up an attribute's index by qualified (prefixed) name.
- *
- * @param qName The qualified name.
- * @return The attribute's index, or -1 if none matches.
- * @see org.xml.sax.Attributes#getIndex(java.lang.String)
- */
- public int getIndex (String qName)
- {
- int max = length * 5;
- for (int i = 0; i < max; i += 5) {
- if (data[i+2].equals(qName)) {
- return i / 5;
- }
- }
- return -1;
- }
-
-
- /**
- * Look up an attribute's type by Namespace-qualified name.
- *
- * @param uri The Namespace URI, or the empty string for a name
- * with no explicit Namespace URI.
- * @param localName The local name.
- * @return The attribute's type, or null if there is no
- * matching attribute.
- * @see org.xml.sax.Attributes#getType(java.lang.String,java.lang.String)
- */
- public String getType (String uri, String localName)
- {
- int max = length * 5;
- for (int i = 0; i < max; i += 5) {
- if (data[i].equals(uri) && data[i+1].equals(localName)) {
- return data[i+3];
- }
- }
- return null;
- }
-
-
- /**
- * Look up an attribute's type by qualified (prefixed) name.
- *
- * @param qName The qualified name.
- * @return The attribute's type, or null if there is no
- * matching attribute.
- * @see org.xml.sax.Attributes#getType(java.lang.String)
- */
- public String getType (String qName)
- {
- int max = length * 5;
- for (int i = 0; i < max; i += 5) {
- if (data[i+2].equals(qName)) {
- return data[i+3];
- }
- }
- return null;
- }
-
-
- /**
- * Look up an attribute's value by Namespace-qualified name.
- *
- * @param uri The Namespace URI, or the empty string for a name
- * with no explicit Namespace URI.
- * @param localName The local name.
- * @return The attribute's value, or null if there is no
- * matching attribute.
- * @see org.xml.sax.Attributes#getValue(java.lang.String,java.lang.String)
- */
- public String getValue (String uri, String localName)
- {
- int max = length * 5;
- for (int i = 0; i < max; i += 5) {
- if (data[i].equals(uri) && data[i+1].equals(localName)) {
- return data[i+4];
- }
- }
- return null;
- }
-
-
- /**
- * Look up an attribute's value by qualified (prefixed) name.
- *
- * @param qName The qualified name.
- * @return The attribute's value, or null if there is no
- * matching attribute.
- * @see org.xml.sax.Attributes#getValue(java.lang.String)
- */
- public String getValue (String qName)
- {
- int max = length * 5;
- for (int i = 0; i < max; i += 5) {
- if (data[i+2].equals(qName)) {
- return data[i+4];
- }
- }
- return null;
- }
-
-
-
- ////////////////////////////////////////////////////////////////////
- // Manipulators.
- ////////////////////////////////////////////////////////////////////
-
-
- /**
- * Clear the attribute list for reuse.
- *
- * <p>Note that no memory is actually freed by this call:
- * the current arrays are kept so that they can be
- * reused.</p>
- */
- public void clear ()
- {
- length = 0;
- }
-
-
- /**
- * Copy an entire Attributes object.
- *
- * <p>It may be more efficient to reuse an existing object
- * rather than constantly allocating new ones.</p>
- *
- * @param atts The attributes to copy.
- */
- public void setAttributes (Attributes atts)
- {
- clear();
- length = atts.getLength();
- data = new String[length*5];
- for (int i = 0; i < length; i++) {
- data[i*5] = atts.getURI(i);
- data[i*5+1] = atts.getLocalName(i);
- data[i*5+2] = atts.getQName(i);
- data[i*5+3] = atts.getType(i);
- data[i*5+4] = atts.getValue(i);
- }
- }
-
-
- /**
- * Add an attribute to the end of the list.
- *
- * <p>For the sake of speed, this method does no checking
- * to see if the attribute is already in the list: that is
- * the responsibility of the application.</p>
- *
- * @param uri The Namespace URI, or the empty string if
- * none is available or Namespace processing is not
- * being performed.
- * @param localName The local name, or the empty string if
- * Namespace processing is not being performed.
- * @param qName The qualified (prefixed) name, or the empty string
- * if qualified names are not available.
- * @param type The attribute type as a string.
- * @param value The attribute value.
- */
- public void addAttribute (String uri, String localName, String qName,
- String type, String value)
- {
- ensureCapacity(length+1);
- data[length*5] = uri;
- data[length*5+1] = localName;
- data[length*5+2] = qName;
- data[length*5+3] = type;
- data[length*5+4] = value;
- length++;
- }
-
-
- /**
- * Set an attribute in the list.
- *
- * <p>For the sake of speed, this method does no checking
- * for name conflicts or well-formedness: such checks are the
- * responsibility of the application.</p>
- *
- * @param index The index of the attribute (zero-based).
- * @param uri The Namespace URI, or the empty string if
- * none is available or Namespace processing is not
- * being performed.
- * @param localName The local name, or the empty string if
- * Namespace processing is not being performed.
- * @param qName The qualified name, or the empty string
- * if qualified names are not available.
- * @param type The attribute type as a string.
- * @param value The attribute value.
- * @exception java.lang.ArrayIndexOutOfBoundsException When the
- * supplied index does not point to an attribute
- * in the list.
- */
- public void setAttribute (int index, String uri, String localName,
- String qName, String type, String value)
- {
- if (index >= 0 && index < length) {
- data[index*5] = uri;
- data[index*5+1] = localName;
- data[index*5+2] = qName;
- data[index*5+3] = type;
- data[index*5+4] = value;
- } else {
- badIndex(index);
- }
- }
-
-
- /**
- * Remove an attribute from the list.
- *
- * @param index The index of the attribute (zero-based).
- * @exception java.lang.ArrayIndexOutOfBoundsException When the
- * supplied index does not point to an attribute
- * in the list.
- */
- public void removeAttribute (int index)
- {
- if (index >= 0 && index < length) {
- data[index*5] = null;
- data[index*5+1] = null;
- data[index*5+2] = null;
- data[index*5+3] = null;
- data[index*5+4] = null;
- if (index < length - 1) {
- System.arraycopy(data, (index+1)*5, data, index*5,
- (length-index-1)*5);
- }
- length--;
- } else {
- badIndex(index);
- }
- }
-
-
- /**
- * Set the Namespace URI of a specific attribute.
- *
- * @param index The index of the attribute (zero-based).
- * @param uri The attribute's Namespace URI, or the empty
- * string for none.
- * @exception java.lang.ArrayIndexOutOfBoundsException When the
- * supplied index does not point to an attribute
- * in the list.
- */
- public void setURI (int index, String uri)
- {
- if (index >= 0 && index < length) {
- data[index*5] = uri;
- } else {
- badIndex(index);
- }
- }
-
-
- /**
- * Set the local name of a specific attribute.
- *
- * @param index The index of the attribute (zero-based).
- * @param localName The attribute's local name, or the empty
- * string for none.
- * @exception java.lang.ArrayIndexOutOfBoundsException When the
- * supplied index does not point to an attribute
- * in the list.
- */
- public void setLocalName (int index, String localName)
- {
- if (index >= 0 && index < length) {
- data[index*5+1] = localName;
- } else {
- badIndex(index);
- }
- }
-
-
- /**
- * Set the qualified name of a specific attribute.
- *
- * @param index The index of the attribute (zero-based).
- * @param qName The attribute's qualified name, or the empty
- * string for none.
- * @exception java.lang.ArrayIndexOutOfBoundsException When the
- * supplied index does not point to an attribute
- * in the list.
- */
- public void setQName (int index, String qName)
- {
- if (index >= 0 && index < length) {
- data[index*5+2] = qName;
- } else {
- badIndex(index);
- }
- }
-
-
- /**
- * Set the type of a specific attribute.
- *
- * @param index The index of the attribute (zero-based).
- * @param type The attribute's type.
- * @exception java.lang.ArrayIndexOutOfBoundsException When the
- * supplied index does not point to an attribute
- * in the list.
- */
- public void setType (int index, String type)
- {
- if (index >= 0 && index < length) {
- data[index*5+3] = type;
- } else {
- badIndex(index);
- }
- }
-
-
- /**
- * Set the value of a specific attribute.
- *
- * @param index The index of the attribute (zero-based).
- * @param value The attribute's value.
- * @exception java.lang.ArrayIndexOutOfBoundsException When the
- * supplied index does not point to an attribute
- * in the list.
- */
- public void setValue (int index, String value)
- {
- if (index >= 0 && index < length) {
- data[index*5+4] = value;
- } else {
- badIndex(index);
- }
- }
-
-
-
- ////////////////////////////////////////////////////////////////////
- // Internal methods.
- ////////////////////////////////////////////////////////////////////
-
-
- /**
- * Ensure the internal array's capacity.
- *
- * @param n The minimum number of attributes that the array must
- * be able to hold.
- */
- private void ensureCapacity (int n)
- {
- if (n > 0 && data == null) {
- data = new String[25];
- }
-
- int max = data.length;
- if (max >= n * 5) {
- return;
- }
-
-
- while (max < n * 5) {
- max *= 2;
- }
- String newData[] = new String[max];
- System.arraycopy(data, 0, newData, 0, length*5);
- data = newData;
- }
-
-
- /**
- * Report a bad array index in a manipulator.
- *
- * @param index The index to report.
- * @exception java.lang.ArrayIndexOutOfBoundsException Always.
- */
- private void badIndex (int index)
- throws ArrayIndexOutOfBoundsException
- {
- String msg =
- "Attempt to modify attribute at illegal index: " + index;
- throw new ArrayIndexOutOfBoundsException(msg);
- }
-
-
-
- ////////////////////////////////////////////////////////////////////
- // Internal state.
- ////////////////////////////////////////////////////////////////////
-
- int length;
- String data [];
-
-}
-
-// end of AttributesImpl.java
-
+// AttributesImpl.java - default implementation of Attributes.
+// http://www.saxproject.org
+// Written by David Megginson
+// NO WARRANTY! This class is in the public domain.
+
+// $Id: AttributesImpl.java,v 1.6.2.3 2002/01/29 21:34:14 dbrownell Exp $
+
+
+package org.xml.sax.helpers;
+
+import org.xml.sax.Attributes;
+
+
+/**
+ * Default implementation of the Attributes interface.
+ *
+ * <blockquote>
+ * <em>This module, both source code and documentation, is in the
+ * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
+ * See <a href='http://www.saxproject.org'>http://www.saxproject.org</a>
+ * for further information.
+ * </blockquote>
+ *
+ * <p>This class provides a default implementation of the SAX2
+ * {@link org.xml.sax.Attributes Attributes} interface, with the
+ * addition of manipulators so that the list can be modified or
+ * reused.</p>
+ *
+ * <p>There are two typical uses of this class:</p>
+ *
+ * <ol>
+ * <li>to take a persistent snapshot of an Attributes object
+ * in a {@link org.xml.sax.ContentHandler#startElement startElement} event; or</li>
+ * <li>to construct or modify an Attributes object in a SAX2 driver or filter.</li>
+ * </ol>
+ *
+ * <p>This class replaces the now-deprecated SAX1 {@link
+ * org.xml.sax.helpers.AttributeListImpl AttributeListImpl}
+ * class; in addition to supporting the updated Attributes
+ * interface rather than the deprecated {@link org.xml.sax.AttributeList
+ * AttributeList} interface, it also includes a much more efficient
+ * implementation using a single array rather than a set of Vectors.</p>
+ *
+ * @since SAX 2.0
+ * @author David Megginson
+ * @version 2.0.1 (sax2r2)
+ */
+public class AttributesImpl implements Attributes
+{
+
+
+ ////////////////////////////////////////////////////////////////////
+ // Constructors.
+ ////////////////////////////////////////////////////////////////////
+
+
+ /**
+ * Construct a new, empty AttributesImpl object.
+ */
+ public AttributesImpl ()
+ {
+ length = 0;
+ data = null;
+ }
+
+
+ /**
+ * Copy an existing Attributes object.
+ *
+ * <p>This constructor is especially useful inside a
+ * {@link org.xml.sax.ContentHandler#startElement startElement} event.</p>
+ *
+ * @param atts The existing Attributes object.
+ */
+ public AttributesImpl (Attributes atts)
+ {
+ setAttributes(atts);
+ }
+
+
+
+ ////////////////////////////////////////////////////////////////////
+ // Implementation of org.xml.sax.Attributes.
+ ////////////////////////////////////////////////////////////////////
+
+
+ /**
+ * Return the number of attributes in the list.
+ *
+ * @return The number of attributes in the list.
+ * @see org.xml.sax.Attributes#getLength
+ */
+ public int getLength ()
+ {
+ return length;
+ }
+
+
+ /**
+ * Return an attribute's Namespace URI.
+ *
+ * @param index The attribute's index (zero-based).
+ * @return The Namespace URI, the empty string if none is
+ * available, or null if the index is out of range.
+ * @see org.xml.sax.Attributes#getURI
+ */
+ public String getURI (int index)
+ {
+ if (index >= 0 && index < length) {
+ return data[index*5];
+ } else {
+ return null;
+ }
+ }
+
+
+ /**
+ * Return an attribute's local name.
+ *
+ * @param index The attribute's index (zero-based).
+ * @return The attribute's local name, the empty string if
+ * none is available, or null if the index if out of range.
+ * @see org.xml.sax.Attributes#getLocalName
+ */
+ public String getLocalName (int index)
+ {
+ if (index >= 0 && index < length) {
+ return data[index*5+1];
+ } else {
+ return null;
+ }
+ }
+
+
+ /**
+ * Return an attribute's qualified (prefixed) name.
+ *
+ * @param index The attribute's index (zero-based).
+ * @return The attribute's qualified name, the empty string if
+ * none is available, or null if the index is out of bounds.
+ * @see org.xml.sax.Attributes#getQName
+ */
+ public String getQName (int index)
+ {
+ if (index >= 0 && index < length) {
+ return data[index*5+2];
+ } else {
+ return null;
+ }
+ }
+
+
+ /**
+ * Return an attribute's type by index.
+ *
+ * @param index The attribute's index (zero-based).
+ * @return The attribute's type, "CDATA" if the type is unknown, or null
+ * if the index is out of bounds.
+ * @see org.xml.sax.Attributes#getType(int)
+ */
+ public String getType (int index)
+ {
+ if (index >= 0 && index < length) {
+ return data[index*5+3];
+ } else {
+ return null;
+ }
+ }
+
+
+ /**
+ * Return an attribute's value by index.
+ *
+ * @param index The attribute's index (zero-based).
+ * @return The attribute's value or null if the index is out of bounds.
+ * @see org.xml.sax.Attributes#getValue(int)
+ */
+ public String getValue (int index)
+ {
+ if (index >= 0 && index < length) {
+ return data[index*5+4];
+ } else {
+ return null;
+ }
+ }
+
+
+ /**
+ * Look up an attribute's index by Namespace name.
+ *
+ * <p>In many cases, it will be more efficient to look up the name once and
+ * use the index query methods rather than using the name query methods
+ * repeatedly.</p>
+ *
+ * @param uri The attribute's Namespace URI, or the empty
+ * string if none is available.
+ * @param localName The attribute's local name.
+ * @return The attribute's index, or -1 if none matches.
+ * @see org.xml.sax.Attributes#getIndex(java.lang.String,java.lang.String)
+ */
+ public int getIndex (String uri, String localName)
+ {
+ int max = length * 5;
+ for (int i = 0; i < max; i += 5) {
+ if (data[i].equals(uri) && data[i+1].equals(localName)) {
+ return i / 5;
+ }
+ }
+ return -1;
+ }
+
+
+ /**
+ * Look up an attribute's index by qualified (prefixed) name.
+ *
+ * @param qName The qualified name.
+ * @return The attribute's index, or -1 if none matches.
+ * @see org.xml.sax.Attributes#getIndex(java.lang.String)
+ */
+ public int getIndex (String qName)
+ {
+ int max = length * 5;
+ for (int i = 0; i < max; i += 5) {
+ if (data[i+2].equals(qName)) {
+ return i / 5;
+ }
+ }
+ return -1;
+ }
+
+
+ /**
+ * Look up an attribute's type by Namespace-qualified name.
+ *
+ * @param uri The Namespace URI, or the empty string for a name
+ * with no explicit Namespace URI.
+ * @param localName The local name.
+ * @return The attribute's type, or null if there is no
+ * matching attribute.
+ * @see org.xml.sax.Attributes#getType(java.lang.String,java.lang.String)
+ */
+ public String getType (String uri, String localName)
+ {
+ int max = length * 5;
+ for (int i = 0; i < max; i += 5) {
+ if (data[i].equals(uri) && data[i+1].equals(localName)) {
+ return data[i+3];
+ }
+ }
+ return null;
+ }
+
+
+ /**
+ * Look up an attribute's type by qualified (prefixed) name.
+ *
+ * @param qName The qualified name.
+ * @return The attribute's type, or null if there is no
+ * matching attribute.
+ * @see org.xml.sax.Attributes#getType(java.lang.String)
+ */
+ public String getType (String qName)
+ {
+ int max = length * 5;
+ for (int i = 0; i < max; i += 5) {
+ if (data[i+2].equals(qName)) {
+ return data[i+3];
+ }
+ }
+ return null;
+ }
+
+
+ /**
+ * Look up an attribute's value by Namespace-qualified name.
+ *
+ * @param uri The Namespace URI, or the empty string for a name
+ * with no explicit Namespace URI.
+ * @param localName The local name.
+ * @return The attribute's value, or null if there is no
+ * matching attribute.
+ * @see org.xml.sax.Attributes#getValue(java.lang.String,java.lang.String)
+ */
+ public String getValue (String uri, String localName)
+ {
+ int max = length * 5;
+ for (int i = 0; i < max; i += 5) {
+ if (data[i].equals(uri) && data[i+1].equals(localName)) {
+ return data[i+4];
+ }
+ }
+ return null;
+ }
+
+
+ /**
+ * Look up an attribute's value by qualified (prefixed) name.
+ *
+ * @param qName The qualified name.
+ * @return The attribute's value, or null if there is no
+ * matching attribute.
+ * @see org.xml.sax.Attributes#getValue(java.lang.String)
+ */
+ public String getValue (String qName)
+ {
+ int max = length * 5;
+ for (int i = 0; i < max; i += 5) {
+ if (data[i+2].equals(qName)) {
+ return data[i+4];
+ }
+ }
+ return null;
+ }
+
+
+
+ ////////////////////////////////////////////////////////////////////
+ // Manipulators.
+ ////////////////////////////////////////////////////////////////////
+
+
+ /**
+ * Clear the attribute list for reuse.
+ *
+ * <p>Note that little memory is freed by this call:
+ * the current array is kept so it can be
+ * reused.</p>
+ */
+ public void clear ()
+ {
+ if (data != null) {
+ for (int i = 0; i < (length * 5); i++)
+ data [i] = null;
+ }
+ length = 0;
+ }
+
+
+ /**
+ * Copy an entire Attributes object.
+ *
+ * <p>It may be more efficient to reuse an existing object
+ * rather than constantly allocating new ones.</p>
+ *
+ * @param atts The attributes to copy.
+ */
+ public void setAttributes (Attributes atts)
+ {
+ clear();
+ length = atts.getLength();
+ if (length > 0) {
+ data = new String[length*5];
+ for (int i = 0; i < length; i++) {
+ data[i*5] = atts.getURI(i);
+ data[i*5+1] = atts.getLocalName(i);
+ data[i*5+2] = atts.getQName(i);
+ data[i*5+3] = atts.getType(i);
+ data[i*5+4] = atts.getValue(i);
+ }
+ }
+ }
+
+
+ /**
+ * Add an attribute to the end of the list.
+ *
+ * <p>For the sake of speed, this method does no checking
+ * to see if the attribute is already in the list: that is
+ * the responsibility of the application.</p>
+ *
+ * @param uri The Namespace URI, or the empty string if
+ * none is available or Namespace processing is not
+ * being performed.
+ * @param localName The local name, or the empty string if
+ * Namespace processing is not being performed.
+ * @param qName The qualified (prefixed) name, or the empty string
+ * if qualified names are not available.
+ * @param type The attribute type as a string.
+ * @param value The attribute value.
+ */
+ public void addAttribute (String uri, String localName, String qName,
+ String type, String value)
+ {
+ ensureCapacity(length+1);
+ data[length*5] = uri;
+ data[length*5+1] = localName;
+ data[length*5+2] = qName;
+ data[length*5+3] = type;
+ data[length*5+4] = value;
+ length++;
+ }
+
+
+ /**
+ * Set an attribute in the list.
+ *
+ * <p>For the sake of speed, this method does no checking
+ * for name conflicts or well-formedness: such checks are the
+ * responsibility of the application.</p>
+ *
+ * @param index The index of the attribute (zero-based).
+ * @param uri The Namespace URI, or the empty string if
+ * none is available or Namespace processing is not
+ * being performed.
+ * @param localName The local name, or the empty string if
+ * Namespace processing is not being performed.
+ * @param qName The qualified name, or the empty string
+ * if qualified names are not available.
+ * @param type The attribute type as a string.
+ * @param value The attribute value.
+ * @exception java.lang.ArrayIndexOutOfBoundsException When the
+ * supplied index does not point to an attribute
+ * in the list.
+ */
+ public void setAttribute (int index, String uri, String localName,
+ String qName, String type, String value)
+ {
+ if (index >= 0 && index < length) {
+ data[index*5] = uri;
+ data[index*5+1] = localName;
+ data[index*5+2] = qName;
+ data[index*5+3] = type;
+ data[index*5+4] = value;
+ } else {
+ badIndex(index);
+ }
+ }
+
+
+ /**
+ * Remove an attribute from the list.
+ *
+ * @param index The index of the attribute (zero-based).
+ * @exception java.lang.ArrayIndexOutOfBoundsException When the
+ * supplied index does not point to an attribute
+ * in the list.
+ */
+ public void removeAttribute (int index)
+ {
+ if (index >= 0 && index < length) {
+ if (index < length - 1) {
+ System.arraycopy(data, (index+1)*5, data, index*5,
+ (length-index-1)*5);
+ }
+ index = (length - 1) * 5;
+ data [index++] = null;
+ data [index++] = null;
+ data [index++] = null;
+ data [index++] = null;
+ data [index] = null;
+ length--;
+ } else {
+ badIndex(index);
+ }
+ }
+
+
+ /**
+ * Set the Namespace URI of a specific attribute.
+ *
+ * @param index The index of the attribute (zero-based).
+ * @param uri The attribute's Namespace URI, or the empty
+ * string for none.
+ * @exception java.lang.ArrayIndexOutOfBoundsException When the
+ * supplied index does not point to an attribute
+ * in the list.
+ */
+ public void setURI (int index, String uri)
+ {
+ if (index >= 0 && index < length) {
+ data[index*5] = uri;
+ } else {
+ badIndex(index);
+ }
+ }
+
+
+ /**
+ * Set the local name of a specific attribute.
+ *
+ * @param index The index of the attribute (zero-based).
+ * @param localName The attribute's local name, or the empty
+ * string for none.
+ * @exception java.lang.ArrayIndexOutOfBoundsException When the
+ * supplied index does not point to an attribute
+ * in the list.
+ */
+ public void setLocalName (int index, String localName)
+ {
+ if (index >= 0 && index < length) {
+ data[index*5+1] = localName;
+ } else {
+ badIndex(index);
+ }
+ }
+
+
+ /**
+ * Set the qualified name of a specific attribute.
+ *
+ * @param index The index of the attribute (zero-based).
+ * @param qName The attribute's qualified name, or the empty
+ * string for none.
+ * @exception java.lang.ArrayIndexOutOfBoundsException When the
+ * supplied index does not point to an attribute
+ * in the list.
+ */
+ public void setQName (int index, String qName)
+ {
+ if (index >= 0 && index < length) {
+ data[index*5+2] = qName;
+ } else {
+ badIndex(index);
+ }
+ }
+
+
+ /**
+ * Set the type of a specific attribute.
+ *
+ * @param index The index of the attribute (zero-based).
+ * @param type The attribute's type.
+ * @exception java.lang.ArrayIndexOutOfBoundsException When the
+ * supplied index does not point to an attribute
+ * in the list.
+ */
+ public void setType (int index, String type)
+ {
+ if (index >= 0 && index < length) {
+ data[index*5+3] = type;
+ } else {
+ badIndex(index);
+ }
+ }
+
+
+ /**
+ * Set the value of a specific attribute.
+ *
+ * @param index The index of the attribute (zero-based).
+ * @param value The attribute's value.
+ * @exception java.lang.ArrayIndexOutOfBoundsException When the
+ * supplied index does not point to an attribute
+ * in the list.
+ */
+ public void setValue (int index, String value)
+ {
+ if (index >= 0 && index < length) {
+ data[index*5+4] = value;
+ } else {
+ badIndex(index);
+ }
+ }
+
+
+
+ ////////////////////////////////////////////////////////////////////
+ // Internal methods.
+ ////////////////////////////////////////////////////////////////////
+
+
+ /**
+ * Ensure the internal array's capacity.
+ *
+ * @param n The minimum number of attributes that the array must
+ * be able to hold.
+ */
+ private void ensureCapacity (int n) {
+ if (n <= 0) {
+ return;
+ }
+ int max;
+ if (data == null || data.length == 0) {
+ max = 25;
+ }
+ else if (data.length >= n * 5) {
+ return;
+ }
+ else {
+ max = data.length;
+ }
+ while (max < n * 5) {
+ max *= 2;
+ }
+
+ String newData[] = new String[max];
+ if (length > 0) {
+ System.arraycopy(data, 0, newData, 0, length*5);
+ }
+ data = newData;
+ }
+
+
+ /**
+ * Report a bad array index in a manipulator.
+ *
+ * @param index The index to report.
+ * @exception java.lang.ArrayIndexOutOfBoundsException Always.
+ */
+ private void badIndex (int index)
+ throws ArrayIndexOutOfBoundsException
+ {
+ String msg =
+ "Attempt to modify attribute at illegal index: " + index;
+ throw new ArrayIndexOutOfBoundsException(msg);
+ }
+
+
+
+ ////////////////////////////////////////////////////////////////////
+ // Internal state.
+ ////////////////////////////////////////////////////////////////////
+
+ int length;
+ String data [];
+
+}
+
+// end of AttributesImpl.java
+
diff --git a/libjava/org/xml/sax/helpers/DefaultHandler.java b/libjava/org/xml/sax/helpers/DefaultHandler.java
index 957d44d882e..873e754a1a5 100644
--- a/libjava/org/xml/sax/helpers/DefaultHandler.java
+++ b/libjava/org/xml/sax/helpers/DefaultHandler.java
@@ -1,447 +1,468 @@
-// DefaultHandler.java - default implementation of the core handlers.
-// Written by David Megginson, sax@megginson.com
-// NO WARRANTY! This class is in the public domain.
-
-// $Id: DefaultHandler.java,v 1.1 2000/10/02 02:43:20 sboag Exp $
-
-package org.xml.sax.helpers;
-
-import org.xml.sax.InputSource;
-import org.xml.sax.Locator;
-import org.xml.sax.Attributes;
-import org.xml.sax.EntityResolver;
-import org.xml.sax.DTDHandler;
-import org.xml.sax.ContentHandler;
-import org.xml.sax.ErrorHandler;
-import org.xml.sax.SAXException;
-import org.xml.sax.SAXParseException;
-
-
-/**
- * Default base class for SAX2 event handlers.
- *
- * <blockquote>
- * <em>This module, both source code and documentation, is in the
- * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
- * </blockquote>
- *
- * <p>This class is available as a convenience base class for SAX2
- * applications: it provides default implementations for all of the
- * callbacks in the four core SAX2 handler classes:</p>
- *
- * <ul>
- * <li>{@link org.xml.sax.EntityResolver EntityResolver}</li>
- * <li>{@link org.xml.sax.DTDHandler DTDHandler}</li>
- * <li>{@link org.xml.sax.ContentHandler ContentHandler}</li>
- * <li>{@link org.xml.sax.ErrorHandler ErrorHandler}</li>
- * </ul>
- *
- * <p>Application writers can extend this class when they need to
- * implement only part of an interface; parser writers can
- * instantiate this class to provide default handlers when the
- * application has not supplied its own.</p>
- *
- * <p>This class replaces the deprecated SAX1
- * {@link org.xml.sax.HandlerBase HandlerBase} class.</p>
- *
- * @since SAX 2.0
- * @author David Megginson,
- * <a href="mailto:sax@megginson.com">sax@megginson.com</a>
- * @version 2.0
- * @see org.xml.sax.EntityResolver
- * @see org.xml.sax.DTDHandler
- * @see org.xml.sax.ContentHandler
- * @see org.xml.sax.ErrorHandler
- */
-public class DefaultHandler
- implements EntityResolver, DTDHandler, ContentHandler, ErrorHandler
-{
-
-
- ////////////////////////////////////////////////////////////////////
- // Default implementation of the EntityResolver interface.
- ////////////////////////////////////////////////////////////////////
-
- /**
- * Resolve an external entity.
- *
- * <p>Always return null, so that the parser will use the system
- * identifier provided in the XML document. This method implements
- * the SAX default behaviour: application writers can override it
- * in a subclass to do special translations such as catalog lookups
- * or URI redirection.</p>
- *
- * @param publicId The public identifier, or null if none is
- * available.
- * @param systemId The system identifier provided in the XML
- * document.
- * @return The new input source, or null to require the
- * default behaviour.
- * @exception org.xml.sax.SAXException Any SAX exception, possibly
- * wrapping another exception.
- * @see org.xml.sax.EntityResolver#resolveEntity
- */
- public InputSource resolveEntity (String publicId, String systemId)
- throws SAXException
- {
- return null;
- }
-
-
-
- ////////////////////////////////////////////////////////////////////
- // Default implementation of DTDHandler interface.
- ////////////////////////////////////////////////////////////////////
-
-
- /**
- * Receive notification of a notation declaration.
- *
- * <p>By default, do nothing. Application writers may override this
- * method in a subclass if they wish to keep track of the notations
- * declared in a document.</p>
- *
- * @param name The notation name.
- * @param publicId The notation public identifier, or null if not
- * available.
- * @param systemId The notation system identifier.
- * @exception org.xml.sax.SAXException Any SAX exception, possibly
- * wrapping another exception.
- * @see org.xml.sax.DTDHandler#notationDecl
- */
- public void notationDecl (String name, String publicId, String systemId)
- throws SAXException
- {
- // no op
- }
-
-
- /**
- * Receive notification of an unparsed entity declaration.
- *
- * <p>By default, do nothing. Application writers may override this
- * method in a subclass to keep track of the unparsed entities
- * declared in a document.</p>
- *
- * @param name The entity name.
- * @param publicId The entity public identifier, or null if not
- * available.
- * @param systemId The entity system identifier.
- * @param notationName The name of the associated notation.
- * @exception org.xml.sax.SAXException Any SAX exception, possibly
- * wrapping another exception.
- * @see org.xml.sax.DTDHandler#unparsedEntityDecl
- */
- public void unparsedEntityDecl (String name, String publicId,
- String systemId, String notationName)
- throws SAXException
- {
- // no op
- }
-
-
-
- ////////////////////////////////////////////////////////////////////
- // Default implementation of ContentHandler interface.
- ////////////////////////////////////////////////////////////////////
-
-
- /**
- * Receive a Locator object for document events.
- *
- * <p>By default, do nothing. Application writers may override this
- * method in a subclass if they wish to store the locator for use
- * with other document events.</p>
- *
- * @param locator A locator for all SAX document events.
- * @see org.xml.sax.ContentHandler#setDocumentLocator
- * @see org.xml.sax.Locator
- */
- public void setDocumentLocator (Locator locator)
- {
- // no op
- }
-
-
- /**
- * Receive notification of the beginning of the document.
- *
- * <p>By default, do nothing. Application writers may override this
- * method in a subclass to take specific actions at the beginning
- * of a document (such as allocating the root node of a tree or
- * creating an output file).</p>
- *
- * @exception org.xml.sax.SAXException Any SAX exception, possibly
- * wrapping another exception.
- * @see org.xml.sax.ContentHandler#startDocument
- */
- public void startDocument ()
- throws SAXException
- {
- // no op
- }
-
-
- /**
- * Receive notification of the end of the document.
- *
- * <p>By default, do nothing. Application writers may override this
- * method in a subclass to take specific actions at the end
- * of a document (such as finalising a tree or closing an output
- * file).</p>
- *
- * @exception org.xml.sax.SAXException Any SAX exception, possibly
- * wrapping another exception.
- * @see org.xml.sax.ContentHandler#endDocument
- */
- public void endDocument ()
- throws SAXException
- {
- // no op
- }
-
-
- /**
- * Receive notification of the start of a Namespace mapping.
- *
- * <p>By default, do nothing. Application writers may override this
- * method in a subclass to take specific actions at the start of
- * each Namespace prefix scope (such as storing the prefix mapping).</p>
- *
- * @param prefix The Namespace prefix being declared.
- * @param uri The Namespace URI mapped to the prefix.
- * @exception org.xml.sax.SAXException Any SAX exception, possibly
- * wrapping another exception.
- * @see org.xml.sax.ContentHandler#startPrefixMapping
- */
- public void startPrefixMapping (String prefix, String uri)
- throws SAXException
- {
- // no op
- }
-
-
- /**
- * Receive notification of the end of a Namespace mapping.
- *
- * <p>By default, do nothing. Application writers may override this
- * method in a subclass to take specific actions at the end of
- * each prefix mapping.</p>
- *
- * @param prefix The Namespace prefix being declared.
- * @exception org.xml.sax.SAXException Any SAX exception, possibly
- * wrapping another exception.
- * @see org.xml.sax.ContentHandler#endPrefixMapping
- */
- public void endPrefixMapping (String prefix)
- throws SAXException
- {
- // no op
- }
-
-
- /**
- * Receive notification of the start of an element.
- *
- * <p>By default, do nothing. Application writers may override this
- * method in a subclass to take specific actions at the start of
- * each element (such as allocating a new tree node or writing
- * output to a file).</p>
- *
- * @param name The element type name.
- * @param attributes The specified or defaulted attributes.
- * @exception org.xml.sax.SAXException Any SAX exception, possibly
- * wrapping another exception.
- * @see org.xml.sax.ContentHandler#startElement
- */
- public void startElement (String uri, String localName,
- String qName, Attributes attributes)
- throws SAXException
- {
- // no op
- }
-
-
- /**
- * Receive notification of the end of an element.
- *
- * <p>By default, do nothing. Application writers may override this
- * method in a subclass to take specific actions at the end of
- * each element (such as finalising a tree node or writing
- * output to a file).</p>
- *
- * @param name The element type name.
- * @param attributes The specified or defaulted attributes.
- * @exception org.xml.sax.SAXException Any SAX exception, possibly
- * wrapping another exception.
- * @see org.xml.sax.ContentHandler#endElement
- */
- public void endElement (String uri, String localName, String qName)
- throws SAXException
- {
- // no op
- }
-
-
- /**
- * Receive notification of character data inside an element.
- *
- * <p>By default, do nothing. Application writers may override this
- * method to take specific actions for each chunk of character data
- * (such as adding the data to a node or buffer, or printing it to
- * a file).</p>
- *
- * @param ch The characters.
- * @param start The start position in the character array.
- * @param length The number of characters to use from the
- * character array.
- * @exception org.xml.sax.SAXException Any SAX exception, possibly
- * wrapping another exception.
- * @see org.xml.sax.ContentHandler#characters
- */
- public void characters (char ch[], int start, int length)
- throws SAXException
- {
- // no op
- }
-
-
- /**
- * Receive notification of ignorable whitespace in element content.
- *
- * <p>By default, do nothing. Application writers may override this
- * method to take specific actions for each chunk of ignorable
- * whitespace (such as adding data to a node or buffer, or printing
- * it to a file).</p>
- *
- * @param ch The whitespace characters.
- * @param start The start position in the character array.
- * @param length The number of characters to use from the
- * character array.
- * @exception org.xml.sax.SAXException Any SAX exception, possibly
- * wrapping another exception.
- * @see org.xml.sax.ContentHandler#ignorableWhitespace
- */
- public void ignorableWhitespace (char ch[], int start, int length)
- throws SAXException
- {
- // no op
- }
-
-
- /**
- * Receive notification of a processing instruction.
- *
- * <p>By default, do nothing. Application writers may override this
- * method in a subclass to take specific actions for each
- * processing instruction, such as setting status variables or
- * invoking other methods.</p>
- *
- * @param target The processing instruction target.
- * @param data The processing instruction data, or null if
- * none is supplied.
- * @exception org.xml.sax.SAXException Any SAX exception, possibly
- * wrapping another exception.
- * @see org.xml.sax.ContentHandler#processingInstruction
- */
- public void processingInstruction (String target, String data)
- throws SAXException
- {
- // no op
- }
-
-
- /**
- * Receive notification of a skipped entity.
- *
- * <p>By default, do nothing. Application writers may override this
- * method in a subclass to take specific actions for each
- * processing instruction, such as setting status variables or
- * invoking other methods.</p>
- *
- * @param name The name of the skipped entity.
- * @exception org.xml.sax.SAXException Any SAX exception, possibly
- * wrapping another exception.
- * @see org.xml.sax.ContentHandler#processingInstruction
- */
- public void skippedEntity (String name)
- throws SAXException
- {
- // no op
- }
-
-
-
- ////////////////////////////////////////////////////////////////////
- // Default implementation of the ErrorHandler interface.
- ////////////////////////////////////////////////////////////////////
-
-
- /**
- * Receive notification of a parser warning.
- *
- * <p>The default implementation does nothing. Application writers
- * may override this method in a subclass to take specific actions
- * for each warning, such as inserting the message in a log file or
- * printing it to the console.</p>
- *
- * @param e The warning information encoded as an exception.
- * @exception org.xml.sax.SAXException Any SAX exception, possibly
- * wrapping another exception.
- * @see org.xml.sax.ErrorHandler#warning
- * @see org.xml.sax.SAXParseException
- */
- public void warning (SAXParseException e)
- throws SAXException
- {
- // no op
- }
-
-
- /**
- * Receive notification of a recoverable parser error.
- *
- * <p>The default implementation does nothing. Application writers
- * may override this method in a subclass to take specific actions
- * for each error, such as inserting the message in a log file or
- * printing it to the console.</p>
- *
- * @param e The warning information encoded as an exception.
- * @exception org.xml.sax.SAXException Any SAX exception, possibly
- * wrapping another exception.
- * @see org.xml.sax.ErrorHandler#warning
- * @see org.xml.sax.SAXParseException
- */
- public void error (SAXParseException e)
- throws SAXException
- {
- // no op
- }
-
-
- /**
- * Report a fatal XML parsing error.
- *
- * <p>The default implementation throws a SAXParseException.
- * Application writers may override this method in a subclass if
- * they need to take specific actions for each fatal error (such as
- * collecting all of the errors into a single report): in any case,
- * the application must stop all regular processing when this
- * method is invoked, since the document is no longer reliable, and
- * the parser may no longer report parsing events.</p>
- *
- * @param e The error information encoded as an exception.
- * @exception org.xml.sax.SAXException Any SAX exception, possibly
- * wrapping another exception.
- * @see org.xml.sax.ErrorHandler#fatalError
- * @see org.xml.sax.SAXParseException
- */
- public void fatalError (SAXParseException e)
- throws SAXException
- {
- throw e;
- }
-
-}
-
-// end of DefaultHandler.java
+// DefaultHandler.java - default implementation of the core handlers.
+// http://www.saxproject.org
+// Written by David Megginson
+// NO WARRANTY! This class is in the public domain.
+
+// $Id: DefaultHandler.java,v 1.5.2.3 2002/01/29 21:34:14 dbrownell Exp $
+
+package org.xml.sax.helpers;
+
+import java.io.IOException;
+
+import org.xml.sax.InputSource;
+import org.xml.sax.Locator;
+import org.xml.sax.Attributes;
+import org.xml.sax.EntityResolver;
+import org.xml.sax.DTDHandler;
+import org.xml.sax.ContentHandler;
+import org.xml.sax.ErrorHandler;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXParseException;
+
+
+/**
+ * Default base class for SAX2 event handlers.
+ *
+ * <blockquote>
+ * <em>This module, both source code and documentation, is in the
+ * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
+ * See <a href='http://www.saxproject.org'>http://www.saxproject.org</a>
+ * for further information.
+ * </blockquote>
+ *
+ * <p>This class is available as a convenience base class for SAX2
+ * applications: it provides default implementations for all of the
+ * callbacks in the four core SAX2 handler classes:</p>
+ *
+ * <ul>
+ * <li>{@link org.xml.sax.EntityResolver EntityResolver}</li>
+ * <li>{@link org.xml.sax.DTDHandler DTDHandler}</li>
+ * <li>{@link org.xml.sax.ContentHandler ContentHandler}</li>
+ * <li>{@link org.xml.sax.ErrorHandler ErrorHandler}</li>
+ * </ul>
+ *
+ * <p>Application writers can extend this class when they need to
+ * implement only part of an interface; parser writers can
+ * instantiate this class to provide default handlers when the
+ * application has not supplied its own.</p>
+ *
+ * <p>This class replaces the deprecated SAX1
+ * {@link org.xml.sax.HandlerBase HandlerBase} class.</p>
+ *
+ * @since SAX 2.0
+ * @author David Megginson,
+ * @version 2.0.1 (sax2r2)
+ * @see org.xml.sax.EntityResolver
+ * @see org.xml.sax.DTDHandler
+ * @see org.xml.sax.ContentHandler
+ * @see org.xml.sax.ErrorHandler
+ */
+public class DefaultHandler
+ implements EntityResolver, DTDHandler, ContentHandler, ErrorHandler
+{
+
+
+ ////////////////////////////////////////////////////////////////////
+ // Default implementation of the EntityResolver interface.
+ ////////////////////////////////////////////////////////////////////
+
+ /**
+ * Resolve an external entity.
+ *
+ * <p>Always return null, so that the parser will use the system
+ * identifier provided in the XML document. This method implements
+ * the SAX default behaviour: application writers can override it
+ * in a subclass to do special translations such as catalog lookups
+ * or URI redirection.</p>
+ *
+ * @param publicId The public identifer, or null if none is
+ * available.
+ * @param systemId The system identifier provided in the XML
+ * document.
+ * @return The new input source, or null to require the
+ * default behaviour.
+ * @exception java.io.IOException If there is an error setting
+ * up the new input source.
+ * @exception org.xml.sax.SAXException Any SAX exception, possibly
+ * wrapping another exception.
+ * @see org.xml.sax.EntityResolver#resolveEntity
+ */
+ public InputSource resolveEntity (String publicId, String systemId)
+ throws IOException, SAXException
+ {
+ return null;
+ }
+
+
+
+ ////////////////////////////////////////////////////////////////////
+ // Default implementation of DTDHandler interface.
+ ////////////////////////////////////////////////////////////////////
+
+
+ /**
+ * Receive notification of a notation declaration.
+ *
+ * <p>By default, do nothing. Application writers may override this
+ * method in a subclass if they wish to keep track of the notations
+ * declared in a document.</p>
+ *
+ * @param name The notation name.
+ * @param publicId The notation public identifier, or null if not
+ * available.
+ * @param systemId The notation system identifier.
+ * @exception org.xml.sax.SAXException Any SAX exception, possibly
+ * wrapping another exception.
+ * @see org.xml.sax.DTDHandler#notationDecl
+ */
+ public void notationDecl (String name, String publicId, String systemId)
+ throws SAXException
+ {
+ // no op
+ }
+
+
+ /**
+ * Receive notification of an unparsed entity declaration.
+ *
+ * <p>By default, do nothing. Application writers may override this
+ * method in a subclass to keep track of the unparsed entities
+ * declared in a document.</p>
+ *
+ * @param name The entity name.
+ * @param publicId The entity public identifier, or null if not
+ * available.
+ * @param systemId The entity system identifier.
+ * @param notationName The name of the associated notation.
+ * @exception org.xml.sax.SAXException Any SAX exception, possibly
+ * wrapping another exception.
+ * @see org.xml.sax.DTDHandler#unparsedEntityDecl
+ */
+ public void unparsedEntityDecl (String name, String publicId,
+ String systemId, String notationName)
+ throws SAXException
+ {
+ // no op
+ }
+
+
+
+ ////////////////////////////////////////////////////////////////////
+ // Default implementation of ContentHandler interface.
+ ////////////////////////////////////////////////////////////////////
+
+
+ /**
+ * Receive a Locator object for document events.
+ *
+ * <p>By default, do nothing. Application writers may override this
+ * method in a subclass if they wish to store the locator for use
+ * with other document events.</p>
+ *
+ * @param locator A locator for all SAX document events.
+ * @see org.xml.sax.ContentHandler#setDocumentLocator
+ * @see org.xml.sax.Locator
+ */
+ public void setDocumentLocator (Locator locator)
+ {
+ // no op
+ }
+
+
+ /**
+ * Receive notification of the beginning of the document.
+ *
+ * <p>By default, do nothing. Application writers may override this
+ * method in a subclass to take specific actions at the beginning
+ * of a document (such as allocating the root node of a tree or
+ * creating an output file).</p>
+ *
+ * @exception org.xml.sax.SAXException Any SAX exception, possibly
+ * wrapping another exception.
+ * @see org.xml.sax.ContentHandler#startDocument
+ */
+ public void startDocument ()
+ throws SAXException
+ {
+ // no op
+ }
+
+
+ /**
+ * Receive notification of the end of the document.
+ *
+ * <p>By default, do nothing. Application writers may override this
+ * method in a subclass to take specific actions at the end
+ * of a document (such as finalising a tree or closing an output
+ * file).</p>
+ *
+ * @exception org.xml.sax.SAXException Any SAX exception, possibly
+ * wrapping another exception.
+ * @see org.xml.sax.ContentHandler#endDocument
+ */
+ public void endDocument ()
+ throws SAXException
+ {
+ // no op
+ }
+
+
+ /**
+ * Receive notification of the start of a Namespace mapping.
+ *
+ * <p>By default, do nothing. Application writers may override this
+ * method in a subclass to take specific actions at the start of
+ * each Namespace prefix scope (such as storing the prefix mapping).</p>
+ *
+ * @param prefix The Namespace prefix being declared.
+ * @param uri The Namespace URI mapped to the prefix.
+ * @exception org.xml.sax.SAXException Any SAX exception, possibly
+ * wrapping another exception.
+ * @see org.xml.sax.ContentHandler#startPrefixMapping
+ */
+ public void startPrefixMapping (String prefix, String uri)
+ throws SAXException
+ {
+ // no op
+ }
+
+
+ /**
+ * Receive notification of the end of a Namespace mapping.
+ *
+ * <p>By default, do nothing. Application writers may override this
+ * method in a subclass to take specific actions at the end of
+ * each prefix mapping.</p>
+ *
+ * @param prefix The Namespace prefix being declared.
+ * @exception org.xml.sax.SAXException Any SAX exception, possibly
+ * wrapping another exception.
+ * @see org.xml.sax.ContentHandler#endPrefixMapping
+ */
+ public void endPrefixMapping (String prefix)
+ throws SAXException
+ {
+ // no op
+ }
+
+
+ /**
+ * Receive notification of the start of an element.
+ *
+ * <p>By default, do nothing. Application writers may override this
+ * method in a subclass to take specific actions at the start of
+ * each element (such as allocating a new tree node or writing
+ * output to a file).</p>
+ *
+ * @param uri The Namespace URI, or the empty string if the
+ * element has no Namespace URI or if Namespace
+ * processing is not being performed.
+ * @param localName The local name (without prefix), or the
+ * empty string if Namespace processing is not being
+ * performed.
+ * @param qName The qualified name (with prefix), or the
+ * empty string if qualified names are not available.
+ * @param atts The attributes attached to the element. If
+ * there are no attributes, it shall be an empty
+ * Attributes object.
+ * @exception org.xml.sax.SAXException Any SAX exception, possibly
+ * wrapping another exception.
+ * @see org.xml.sax.ContentHandler#startElement
+ */
+ public void startElement (String uri, String localName,
+ String qName, Attributes attributes)
+ throws SAXException
+ {
+ // no op
+ }
+
+
+ /**
+ * Receive notification of the end of an element.
+ *
+ * <p>By default, do nothing. Application writers may override this
+ * method in a subclass to take specific actions at the end of
+ * each element (such as finalising a tree node or writing
+ * output to a file).</p>
+ *
+ * @param uri The Namespace URI, or the empty string if the
+ * element has no Namespace URI or if Namespace
+ * processing is not being performed.
+ * @param localName The local name (without prefix), or the
+ * empty string if Namespace processing is not being
+ * performed.
+ * @param qName The qualified name (with prefix), or the
+ * empty string if qualified names are not available.
+ * @exception org.xml.sax.SAXException Any SAX exception, possibly
+ * wrapping another exception.
+ * @see org.xml.sax.ContentHandler#endElement
+ */
+ public void endElement (String uri, String localName, String qName)
+ throws SAXException
+ {
+ // no op
+ }
+
+
+ /**
+ * Receive notification of character data inside an element.
+ *
+ * <p>By default, do nothing. Application writers may override this
+ * method to take specific actions for each chunk of character data
+ * (such as adding the data to a node or buffer, or printing it to
+ * a file).</p>
+ *
+ * @param ch The characters.
+ * @param start The start position in the character array.
+ * @param length The number of characters to use from the
+ * character array.
+ * @exception org.xml.sax.SAXException Any SAX exception, possibly
+ * wrapping another exception.
+ * @see org.xml.sax.ContentHandler#characters
+ */
+ public void characters (char ch[], int start, int length)
+ throws SAXException
+ {
+ // no op
+ }
+
+
+ /**
+ * Receive notification of ignorable whitespace in element content.
+ *
+ * <p>By default, do nothing. Application writers may override this
+ * method to take specific actions for each chunk of ignorable
+ * whitespace (such as adding data to a node or buffer, or printing
+ * it to a file).</p>
+ *
+ * @param ch The whitespace characters.
+ * @param start The start position in the character array.
+ * @param length The number of characters to use from the
+ * character array.
+ * @exception org.xml.sax.SAXException Any SAX exception, possibly
+ * wrapping another exception.
+ * @see org.xml.sax.ContentHandler#ignorableWhitespace
+ */
+ public void ignorableWhitespace (char ch[], int start, int length)
+ throws SAXException
+ {
+ // no op
+ }
+
+
+ /**
+ * Receive notification of a processing instruction.
+ *
+ * <p>By default, do nothing. Application writers may override this
+ * method in a subclass to take specific actions for each
+ * processing instruction, such as setting status variables or
+ * invoking other methods.</p>
+ *
+ * @param target The processing instruction target.
+ * @param data The processing instruction data, or null if
+ * none is supplied.
+ * @exception org.xml.sax.SAXException Any SAX exception, possibly
+ * wrapping another exception.
+ * @see org.xml.sax.ContentHandler#processingInstruction
+ */
+ public void processingInstruction (String target, String data)
+ throws SAXException
+ {
+ // no op
+ }
+
+
+ /**
+ * Receive notification of a skipped entity.
+ *
+ * <p>By default, do nothing. Application writers may override this
+ * method in a subclass to take specific actions for each
+ * processing instruction, such as setting status variables or
+ * invoking other methods.</p>
+ *
+ * @param name The name of the skipped entity.
+ * @exception org.xml.sax.SAXException Any SAX exception, possibly
+ * wrapping another exception.
+ * @see org.xml.sax.ContentHandler#processingInstruction
+ */
+ public void skippedEntity (String name)
+ throws SAXException
+ {
+ // no op
+ }
+
+
+
+ ////////////////////////////////////////////////////////////////////
+ // Default implementation of the ErrorHandler interface.
+ ////////////////////////////////////////////////////////////////////
+
+
+ /**
+ * Receive notification of a parser warning.
+ *
+ * <p>The default implementation does nothing. Application writers
+ * may override this method in a subclass to take specific actions
+ * for each warning, such as inserting the message in a log file or
+ * printing it to the console.</p>
+ *
+ * @param e The warning information encoded as an exception.
+ * @exception org.xml.sax.SAXException Any SAX exception, possibly
+ * wrapping another exception.
+ * @see org.xml.sax.ErrorHandler#warning
+ * @see org.xml.sax.SAXParseException
+ */
+ public void warning (SAXParseException e)
+ throws SAXException
+ {
+ // no op
+ }
+
+
+ /**
+ * Receive notification of a recoverable parser error.
+ *
+ * <p>The default implementation does nothing. Application writers
+ * may override this method in a subclass to take specific actions
+ * for each error, such as inserting the message in a log file or
+ * printing it to the console.</p>
+ *
+ * @param e The warning information encoded as an exception.
+ * @exception org.xml.sax.SAXException Any SAX exception, possibly
+ * wrapping another exception.
+ * @see org.xml.sax.ErrorHandler#warning
+ * @see org.xml.sax.SAXParseException
+ */
+ public void error (SAXParseException e)
+ throws SAXException
+ {
+ // no op
+ }
+
+
+ /**
+ * Report a fatal XML parsing error.
+ *
+ * <p>The default implementation throws a SAXParseException.
+ * Application writers may override this method in a subclass if
+ * they need to take specific actions for each fatal error (such as
+ * collecting all of the errors into a single report): in any case,
+ * the application must stop all regular processing when this
+ * method is invoked, since the document is no longer reliable, and
+ * the parser may no longer report parsing events.</p>
+ *
+ * @param e The error information encoded as an exception.
+ * @exception org.xml.sax.SAXException Any SAX exception, possibly
+ * wrapping another exception.
+ * @see org.xml.sax.ErrorHandler#fatalError
+ * @see org.xml.sax.SAXParseException
+ */
+ public void fatalError (SAXParseException e)
+ throws SAXException
+ {
+ throw e;
+ }
+
+}
+
+// end of DefaultHandler.java
diff --git a/libjava/org/xml/sax/helpers/LocatorImpl.java b/libjava/org/xml/sax/helpers/LocatorImpl.java
index 634044ccff2..4b297eabd9c 100644
--- a/libjava/org/xml/sax/helpers/LocatorImpl.java
+++ b/libjava/org/xml/sax/helpers/LocatorImpl.java
@@ -1,212 +1,214 @@
-// SAX default implementation for Locator.
-// No warranty; no copyright -- use this as you will.
-// $Id: LocatorImpl.java,v 1.1 2000/10/02 02:43:20 sboag Exp $
-
-package org.xml.sax.helpers;
-
-import org.xml.sax.Locator;
-
-
-/**
- * Provide an optional convenience implementation of Locator.
- *
- * <blockquote>
- * <em>This module, both source code and documentation, is in the
- * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
- * </blockquote>
- *
- * <p>This class is available mainly for application writers, who
- * can use it to make a persistent snapshot of a locator at any
- * point during a document parse:</p>
- *
- * <pre>
- * Locator locator;
- * Locator startloc;
- *
- * public void setLocator (Locator locator)
- * {
- * // note the locator
- * this.locator = locator;
- * }
- *
- * public void startDocument ()
- * {
- * // save the location of the start of the document
- * // for future use.
- * Locator startloc = new LocatorImpl(locator);
- * }
- *</pre>
- *
- * <p>Normally, parser writers will not use this class, since it
- * is more efficient to provide location information only when
- * requested, rather than constantly updating a Locator object.</p>
- *
- * @since SAX 1.0
- * @author David Megginson,
- * <a href="mailto:sax@megginson.com">sax@megginson.com</a>
- * @version 2.0
- * @see org.xml.sax.Locator Locator
- */
-public class LocatorImpl implements Locator
-{
-
-
- /**
- * Zero-argument constructor.
- *
- * <p>This will not normally be useful, since the main purpose
- * of this class is to make a snapshot of an existing Locator.</p>
- */
- public LocatorImpl ()
- {
- }
-
-
- /**
- * Copy constructor.
- *
- * <p>Create a persistent copy of the current state of a locator.
- * When the original locator changes, this copy will still keep
- * the original values (and it can be used outside the scope of
- * DocumentHandler methods).</p>
- *
- * @param locator The locator to copy.
- */
- public LocatorImpl (Locator locator)
- {
- setPublicId(locator.getPublicId());
- setSystemId(locator.getSystemId());
- setLineNumber(locator.getLineNumber());
- setColumnNumber(locator.getColumnNumber());
- }
-
-
-
- ////////////////////////////////////////////////////////////////////
- // Implementation of org.xml.sax.Locator
- ////////////////////////////////////////////////////////////////////
-
-
- /**
- * Return the saved public identifier.
- *
- * @return The public identifier as a string, or null if none
- * is available.
- * @see org.xml.sax.Locator#getPublicId
- * @see #setPublicId
- */
- public String getPublicId ()
- {
- return publicId;
- }
-
-
- /**
- * Return the saved system identifier.
- *
- * @return The system identifier as a string, or null if none
- * is available.
- * @see org.xml.sax.Locator#getSystemId
- * @see #setSystemId
- */
- public String getSystemId ()
- {
- return systemId;
- }
-
-
- /**
- * Return the saved line number (1-based).
- *
- * @return The line number as an integer, or -1 if none is available.
- * @see org.xml.sax.Locator#getLineNumber
- * @see #setLineNumber
- */
- public int getLineNumber ()
- {
- return lineNumber;
- }
-
-
- /**
- * Return the saved column number (1-based).
- *
- * @return The column number as an integer, or -1 if none is available.
- * @see org.xml.sax.Locator#getColumnNumber
- * @see #setColumnNumber
- */
- public int getColumnNumber ()
- {
- return columnNumber;
- }
-
-
-
- ////////////////////////////////////////////////////////////////////
- // Setters for the properties (not in org.xml.sax.Locator)
- ////////////////////////////////////////////////////////////////////
-
-
- /**
- * Set the public identifier for this locator.
- *
- * @param publicId The new public identifier, or null
- * if none is available.
- * @see #getPublicId
- */
- public void setPublicId (String publicId)
- {
- this.publicId = publicId;
- }
-
-
- /**
- * Set the system identifier for this locator.
- *
- * @param systemId The new system identifier, or null
- * if none is available.
- * @see #getSystemId
- */
- public void setSystemId (String systemId)
- {
- this.systemId = systemId;
- }
-
-
- /**
- * Set the line number for this locator (1-based).
- *
- * @param lineNumber The line number, or -1 if none is available.
- * @see #getLineNumber
- */
- public void setLineNumber (int lineNumber)
- {
- this.lineNumber = lineNumber;
- }
-
-
- /**
- * Set the column number for this locator (1-based).
- *
- * @param columnNumber The column number, or -1 if none is available.
- * @see #getColumnNumber
- */
- public void setColumnNumber (int columnNumber)
- {
- this.columnNumber = columnNumber;
- }
-
-
-
- ////////////////////////////////////////////////////////////////////
- // Internal state.
- ////////////////////////////////////////////////////////////////////
-
- private String publicId;
- private String systemId;
- private int lineNumber;
- private int columnNumber;
-
-}
-
-// end of LocatorImpl.java
+// SAX default implementation for Locator.
+// http://www.saxproject.org
+// No warranty; no copyright -- use this as you will.
+// $Id: LocatorImpl.java,v 1.3.2.3 2002/01/29 21:34:14 dbrownell Exp $
+
+package org.xml.sax.helpers;
+
+import org.xml.sax.Locator;
+
+
+/**
+ * Provide an optional convenience implementation of Locator.
+ *
+ * <blockquote>
+ * <em>This module, both source code and documentation, is in the
+ * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
+ * See <a href='http://www.saxproject.org'>http://www.saxproject.org</a>
+ * for further information.
+ * </blockquote>
+ *
+ * <p>This class is available mainly for application writers, who
+ * can use it to make a persistent snapshot of a locator at any
+ * point during a document parse:</p>
+ *
+ * <pre>
+ * Locator locator;
+ * Locator startloc;
+ *
+ * public void setLocator (Locator locator)
+ * {
+ * // note the locator
+ * this.locator = locator;
+ * }
+ *
+ * public void startDocument ()
+ * {
+ * // save the location of the start of the document
+ * // for future use.
+ * Locator startloc = new LocatorImpl(locator);
+ * }
+ *</pre>
+ *
+ * <p>Normally, parser writers will not use this class, since it
+ * is more efficient to provide location information only when
+ * requested, rather than constantly updating a Locator object.</p>
+ *
+ * @since SAX 1.0
+ * @author David Megginson
+ * @version 2.0.1 (sax2r2)
+ * @see org.xml.sax.Locator Locator
+ */
+public class LocatorImpl implements Locator
+{
+
+
+ /**
+ * Zero-argument constructor.
+ *
+ * <p>This will not normally be useful, since the main purpose
+ * of this class is to make a snapshot of an existing Locator.</p>
+ */
+ public LocatorImpl ()
+ {
+ }
+
+
+ /**
+ * Copy constructor.
+ *
+ * <p>Create a persistent copy of the current state of a locator.
+ * When the original locator changes, this copy will still keep
+ * the original values (and it can be used outside the scope of
+ * DocumentHandler methods).</p>
+ *
+ * @param locator The locator to copy.
+ */
+ public LocatorImpl (Locator locator)
+ {
+ setPublicId(locator.getPublicId());
+ setSystemId(locator.getSystemId());
+ setLineNumber(locator.getLineNumber());
+ setColumnNumber(locator.getColumnNumber());
+ }
+
+
+
+ ////////////////////////////////////////////////////////////////////
+ // Implementation of org.xml.sax.Locator
+ ////////////////////////////////////////////////////////////////////
+
+
+ /**
+ * Return the saved public identifier.
+ *
+ * @return The public identifier as a string, or null if none
+ * is available.
+ * @see org.xml.sax.Locator#getPublicId
+ * @see #setPublicId
+ */
+ public String getPublicId ()
+ {
+ return publicId;
+ }
+
+
+ /**
+ * Return the saved system identifier.
+ *
+ * @return The system identifier as a string, or null if none
+ * is available.
+ * @see org.xml.sax.Locator#getSystemId
+ * @see #setSystemId
+ */
+ public String getSystemId ()
+ {
+ return systemId;
+ }
+
+
+ /**
+ * Return the saved line number (1-based).
+ *
+ * @return The line number as an integer, or -1 if none is available.
+ * @see org.xml.sax.Locator#getLineNumber
+ * @see #setLineNumber
+ */
+ public int getLineNumber ()
+ {
+ return lineNumber;
+ }
+
+
+ /**
+ * Return the saved column number (1-based).
+ *
+ * @return The column number as an integer, or -1 if none is available.
+ * @see org.xml.sax.Locator#getColumnNumber
+ * @see #setColumnNumber
+ */
+ public int getColumnNumber ()
+ {
+ return columnNumber;
+ }
+
+
+
+ ////////////////////////////////////////////////////////////////////
+ // Setters for the properties (not in org.xml.sax.Locator)
+ ////////////////////////////////////////////////////////////////////
+
+
+ /**
+ * Set the public identifier for this locator.
+ *
+ * @param publicId The new public identifier, or null
+ * if none is available.
+ * @see #getPublicId
+ */
+ public void setPublicId (String publicId)
+ {
+ this.publicId = publicId;
+ }
+
+
+ /**
+ * Set the system identifier for this locator.
+ *
+ * @param systemId The new system identifier, or null
+ * if none is available.
+ * @see #getSystemId
+ */
+ public void setSystemId (String systemId)
+ {
+ this.systemId = systemId;
+ }
+
+
+ /**
+ * Set the line number for this locator (1-based).
+ *
+ * @param lineNumber The line number, or -1 if none is available.
+ * @see #getLineNumber
+ */
+ public void setLineNumber (int lineNumber)
+ {
+ this.lineNumber = lineNumber;
+ }
+
+
+ /**
+ * Set the column number for this locator (1-based).
+ *
+ * @param columnNumber The column number, or -1 if none is available.
+ * @see #getColumnNumber
+ */
+ public void setColumnNumber (int columnNumber)
+ {
+ this.columnNumber = columnNumber;
+ }
+
+
+
+ ////////////////////////////////////////////////////////////////////
+ // Internal state.
+ ////////////////////////////////////////////////////////////////////
+
+ private String publicId;
+ private String systemId;
+ private int lineNumber;
+ private int columnNumber;
+
+}
+
+// end of LocatorImpl.java
diff --git a/libjava/org/xml/sax/helpers/NamespaceSupport.java b/libjava/org/xml/sax/helpers/NamespaceSupport.java
index a4588c3d2c7..917a7f75dce 100644
--- a/libjava/org/xml/sax/helpers/NamespaceSupport.java
+++ b/libjava/org/xml/sax/helpers/NamespaceSupport.java
@@ -1,689 +1,770 @@
-// NamespaceSupport.java - generic Namespace support for SAX.
-// Written by David Megginson, sax@megginson.com
-// This class is in the Public Domain. NO WARRANTY!
-
-// $Id: NamespaceSupport.java,v 1.1 2000/10/02 02:43:20 sboag Exp $
-
-package org.xml.sax.helpers;
-
-import java.util.EmptyStackException;
-import java.util.Enumeration;
-import java.util.Hashtable;
-import java.util.Vector;
-
-
-/**
- * Encapsulate Namespace logic for use by SAX drivers.
- *
- * <blockquote>
- * <em>This module, both source code and documentation, is in the
- * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
- * </blockquote>
- *
- * <p>This class encapsulates the logic of Namespace processing:
- * it tracks the declarations currently in force for each context
- * and automatically processes qualified XML 1.0 names into their
- * Namespace parts; it can also be used in reverse for generating
- * XML 1.0 from Namespaces.</p>
- *
- * <p>Namespace support objects are reusable, but the reset method
- * must be invoked between each session.</p>
- *
- * <p>Here is a simple session:</p>
- *
- * <pre>
- * String parts[] = new String[3];
- * NamespaceSupport support = new NamespaceSupport();
- *
- * support.pushContext();
- * support.declarePrefix("", "http://www.w3.org/1999/xhtml");
- * support.declarePrefix("dc", "http://www.purl.org/dc#");
- *
- * String parts[] = support.processName("p", parts, false);
- * System.out.println("Namespace URI: " + parts[0]);
- * System.out.println("Local name: " + parts[1]);
- * System.out.println("Raw name: " + parts[2]);
-
- * String parts[] = support.processName("dc:title", parts, false);
- * System.out.println("Namespace URI: " + parts[0]);
- * System.out.println("Local name: " + parts[1]);
- * System.out.println("Raw name: " + parts[2]);
-
- * support.popContext();
- * </pre>
- *
- * <p>Note that this class is optimized for the use case where most
- * elements do not contain Namespace declarations: if the same
- * prefix/URI mapping is repeated for each context (for example), this
- * class will be somewhat less efficient.</p>
- *
- * @since SAX 2.0
- * @author David Megginson,
- * <a href="mailto:sax@megginson.com">sax@megginson.com</a>
- * @version 2.0
- */
-public class NamespaceSupport
-{
-
-
- ////////////////////////////////////////////////////////////////////
- // Constants.
- ////////////////////////////////////////////////////////////////////
-
-
- /**
- * The XML Namespace as a constant.
- *
- * <p>This is the Namespace URI that is automatically mapped
- * to the "xml" prefix.</p>
- */
- public final static String XMLNS =
- "http://www.w3.org/XML/1998/namespace";
-
-
- /**
- * An empty enumeration.
- */
- private final static Enumeration EMPTY_ENUMERATION =
- new Vector().elements();
-
-
- ////////////////////////////////////////////////////////////////////
- // Constructor.
- ////////////////////////////////////////////////////////////////////
-
-
- /**
- * Create a new Namespace support object.
- */
- public NamespaceSupport ()
- {
- reset();
- }
-
-
-
- ////////////////////////////////////////////////////////////////////
- // Context management.
- ////////////////////////////////////////////////////////////////////
-
-
- /**
- * Reset this Namespace support object for reuse.
- *
- * <p>It is necessary to invoke this method before reusing the
- * Namespace support object for a new session.</p>
- */
- public void reset ()
- {
- contexts = new Context[32];
- contextPos = 0;
- contexts[contextPos] = currentContext = new Context();
- currentContext.declarePrefix("xml", XMLNS);
- }
-
-
- /**
- * Start a new Namespace context.
- *
- * <p>Normally, you should push a new context at the beginning
- * of each XML element: the new context will automatically inherit
- * the declarations of its parent context, but it will also keep
- * track of which declarations were made within this context.</p>
- *
- * <p>The Namespace support object always starts with a base context
- * already in force: in this context, only the "xml" prefix is
- * declared.</p>
- *
- * @see #popContext
- */
- public void pushContext ()
- {
- int max = contexts.length;
- contextPos++;
-
- // Extend the array if necessary
- if (contextPos >= max) {
- Context newContexts[] = new Context[max*2];
- System.arraycopy(contexts, 0, newContexts, 0, max);
- max *= 2;
- contexts = newContexts;
- }
-
- // Allocate the context if necessary.
- currentContext = contexts[contextPos];
- if (currentContext == null) {
- contexts[contextPos] = currentContext = new Context();
- }
-
- // Set the parent, if any.
- if (contextPos > 0) {
- currentContext.setParent(contexts[contextPos - 1]);
- }
- }
-
-
- /**
- * Revert to the previous Namespace context.
- *
- * <p>Normally, you should pop the context at the end of each
- * XML element. After popping the context, all Namespace prefix
- * mappings that were previously in force are restored.</p>
- *
- * <p>You must not attempt to declare additional Namespace
- * prefixes after popping a context, unless you push another
- * context first.</p>
- *
- * @see #pushContext
- */
- public void popContext ()
- {
- contextPos--;
- if (contextPos < 0) {
- throw new EmptyStackException();
- }
- currentContext = contexts[contextPos];
- }
-
-
-
- ////////////////////////////////////////////////////////////////////
- // Operations within a context.
- ////////////////////////////////////////////////////////////////////
-
-
- /**
- * Declare a Namespace prefix.
- *
- * <p>This method declares a prefix in the current Namespace
- * context; the prefix will remain in force until this context
- * is popped, unless it is shadowed in a descendant context.</p>
- *
- * <p>To declare a default Namespace, use the empty string. The
- * prefix must not be "xml" or "xmlns".</p>
- *
- * <p>Note that you must <em>not</em> declare a prefix after
- * you've pushed and popped another Namespace.</p>
- *
- * <p>Note that there is an asymmetry in this library: while {@link
- * #getPrefix getPrefix} will not return the default "" prefix,
- * even if you have declared one; to check for a default prefix,
- * you have to look it up explicitly using {@link #getURI getURI}.
- * This asymmetry exists to make it easier to look up prefixes
- * for attribute names, where the default prefix is not allowed.</p>
- *
- * @param prefix The prefix to declare, or null for the empty
- * string.
- * @param uri The Namespace URI to associate with the prefix.
- * @return true if the prefix was legal, false otherwise
- * @see #processName
- * @see #getURI
- * @see #getPrefix
- */
- public boolean declarePrefix (String prefix, String uri)
- {
- if (prefix.equals("xml") || prefix.equals("xmlns")) {
- return false;
- } else {
- currentContext.declarePrefix(prefix, uri);
- return true;
- }
- }
-
-
- /**
- * Process a raw XML 1.0 name.
- *
- * <p>This method processes a raw XML 1.0 name in the current
- * context by removing the prefix and looking it up among the
- * prefixes currently declared. The return value will be the
- * array supplied by the caller, filled in as follows:</p>
- *
- * <dl>
- * <dt>parts[0]</dt>
- * <dd>The Namespace URI, or an empty string if none is
- * in use.</dd>
- * <dt>parts[1]</dt>
- * <dd>The local name (without prefix).</dd>
- * <dt>parts[2]</dt>
- * <dd>The original raw name.</dd>
- * </dl>
- *
- * <p>All of the strings in the array will be internalized. If
- * the raw name has a prefix that has not been declared, then
- * the return value will be null.</p>
- *
- * <p>Note that attribute names are processed differently than
- * element names: an unprefixed element name will received the
- * default Namespace (if any), while an unprefixed element name
- * will not.</p>
- *
- * @param qName The raw XML 1.0 name to be processed.
- * @param parts An array supplied by the caller, capable of
- * holding at least three members.
- * @param isAttribute A flag indicating whether this is an
- * attribute name (true) or an element name (false).
- * @return The supplied array holding three internalized strings
- * representing the Namespace URI (or empty string), the
- * local name, and the raw XML 1.0 name; or null if there
- * is an undeclared prefix.
- * @see #declarePrefix
- * @see java.lang.String#intern */
- public String [] processName (String qName, String parts[],
- boolean isAttribute)
- {
- String myParts[] = currentContext.processName(qName, isAttribute);
- if (myParts == null) {
- return null;
- } else {
- parts[0] = myParts[0];
- parts[1] = myParts[1];
- parts[2] = myParts[2];
- return parts;
- }
- }
-
-
- /**
- * Look up a prefix and get the currently-mapped Namespace URI.
- *
- * <p>This method looks up the prefix in the current context.
- * Use the empty string ("") for the default Namespace.</p>
- *
- * @param prefix The prefix to look up.
- * @return The associated Namespace URI, or null if the prefix
- * is undeclared in this context.
- * @see #getPrefix
- * @see #getPrefixes
- */
- public String getURI (String prefix)
- {
- return currentContext.getURI(prefix);
- }
-
-
- /**
- * Return an enumeration of all prefixes currently declared.
- *
- * <p><strong>Note:</strong> if there is a default prefix, it will not be
- * returned in this enumeration; check for the default prefix
- * using the {@link #getURI getURI} with an argument of "".</p>
- *
- * @return An enumeration of all prefixes declared in the
- * current context except for the empty (default)
- * prefix.
- * @see #getDeclaredPrefixes
- * @see #getURI
- */
- public Enumeration getPrefixes ()
- {
- return currentContext.getPrefixes();
- }
-
-
- /**
- * Return one of the prefixes mapped to a Namespace URI.
- *
- * <p>If more than one prefix is currently mapped to the same
- * URI, this method will make an arbitrary selection; if you
- * want all of the prefixes, use the {@link #getPrefixes}
- * method instead.</p>
- *
- * <p><strong>Note:</strong> this will never return the empty (default) prefix;
- * to check for a default prefix, use the {@link #getURI getURI}
- * method with an argument of "".</p>
- *
- * @param uri The Namespace URI.
- * @param isAttribute true if this prefix is for an attribute
- * (and the default Namespace is not allowed).
- * @return One of the prefixes currently mapped to the URI supplied,
- * or null if none is mapped or if the URI is assigned to
- * the default Namespace.
- * @see #getPrefixes(java.lang.String)
- * @see #getURI
- */
- public String getPrefix (String uri)
- {
- return currentContext.getPrefix(uri);
- }
-
-
- /**
- * Return an enumeration of all prefixes currently declared for a URI.
- *
- * <p>This method returns prefixes mapped to a specific Namespace
- * URI. The xml: prefix will be included. If you want only one
- * prefix that's mapped to the Namespace URI, and you don't care
- * which one you get, use the {@link #getPrefix getPrefix}
- * method instead.</p>
- *
- * <p><strong>Note:</strong> the empty (default) prefix is <em>never</em> included
- * in this enumeration; to check for the presence of a default
- * Namespace, use the {@link #getURI getURI} method with an
- * argument of "".</p>
- *
- * @param uri The Namespace URI.
- * @return An enumeration of all prefixes declared in the
- * current context.
- * @see #getPrefix
- * @see #getDeclaredPrefixes
- * @see #getURI
- */
- public Enumeration getPrefixes (String uri)
- {
- Vector prefixes = new Vector();
- Enumeration allPrefixes = getPrefixes();
- while (allPrefixes.hasMoreElements()) {
- String prefix = (String)allPrefixes.nextElement();
- if (uri.equals(getURI(prefix))) {
- prefixes.addElement(prefix);
- }
- }
- return prefixes.elements();
- }
-
-
- /**
- * Return an enumeration of all prefixes declared in this context.
- *
- * <p>The empty (default) prefix will be included in this
- * enumeration; note that this behaviour differs from that of
- * {@link #getPrefix} and {@link #getPrefixes}.</p>
- *
- * @return An enumeration of all prefixes declared in this
- * context.
- * @see #getPrefixes
- * @see #getURI
- */
- public Enumeration getDeclaredPrefixes ()
- {
- return currentContext.getDeclaredPrefixes();
- }
-
-
-
- ////////////////////////////////////////////////////////////////////
- // Internal state.
- ////////////////////////////////////////////////////////////////////
-
- private Context contexts[];
- private Context currentContext;
- private int contextPos;
-
-
-
- ////////////////////////////////////////////////////////////////////
- // Internal classes.
- ////////////////////////////////////////////////////////////////////
-
- /**
- * Internal class for a single Namespace context.
- *
- * <p>This module caches and reuses Namespace contexts, so the number allocated
- * will be equal to the element depth of the document, not to the total
- * number of elements (i.e. 5-10 rather than tens of thousands).</p>
- */
- final class Context {
-
- /**
- * Create the root-level Namespace context.
- */
- Context ()
- {
- copyTables();
- }
-
-
- /**
- * (Re)set the parent of this Namespace context.
- *
- * @param context The parent Namespace context object.
- */
- void setParent (Context parent)
- {
- this.parent = parent;
- declarations = null;
- prefixTable = parent.prefixTable;
- uriTable = parent.uriTable;
- elementNameTable = parent.elementNameTable;
- attributeNameTable = parent.attributeNameTable;
- defaultNS = parent.defaultNS;
- tablesDirty = false;
- }
-
-
- /**
- * Declare a Namespace prefix for this context.
- *
- * @param prefix The prefix to declare.
- * @param uri The associated Namespace URI.
- * @see org.xml.sax.helpers.NamespaceSupport#declarePrefix
- */
- void declarePrefix (String prefix, String uri)
- {
- // Lazy processing...
- if (!tablesDirty) {
- copyTables();
- }
- if (declarations == null) {
- declarations = new Vector();
- }
-
- prefix = prefix.intern();
- uri = uri.intern();
- if ("".equals(prefix)) {
- if ("".equals(uri)) {
- defaultNS = null;
- } else {
- defaultNS = uri;
- }
- } else {
- prefixTable.put(prefix, uri);
- uriTable.put(uri, prefix); // may wipe out another prefix
- }
- declarations.addElement(prefix);
- }
-
-
- /**
- * Process a raw XML 1.0 name in this context.
- *
- * @param qName The raw XML 1.0 name.
- * @param isAttribute true if this is an attribute name.
- * @return An array of three strings containing the
- * URI part (or empty string), the local part,
- * and the raw name, all internalized, or null
- * if there is an undeclared prefix.
- * @see org.xml.sax.helpers.NamespaceSupport#processName
- */
- String [] processName (String qName, boolean isAttribute)
- {
- String name[];
- Hashtable table;
-
- // Select the appropriate table.
- if (isAttribute) {
- table = elementNameTable;
- } else {
- table = attributeNameTable;
- }
-
- // Start by looking in the cache, and
- // return immediately if the name
- // is already known in this content
- name = (String[])table.get(qName);
- if (name != null) {
- return name;
- }
-
- // We haven't seen this name in this
- // context before.
- name = new String[3];
- int index = qName.indexOf(':');
-
-
- // No prefix.
- if (index == -1) {
- if (isAttribute || defaultNS == null) {
- name[0] = "";
- } else {
- name[0] = defaultNS;
- }
- name[1] = qName.intern();
- name[2] = name[1];
- }
-
- // Prefix
- else {
- String prefix = qName.substring(0, index);
- String local = qName.substring(index+1);
- String uri;
- if ("".equals(prefix)) {
- uri = defaultNS;
- } else {
- uri = (String)prefixTable.get(prefix);
- }
- if (uri == null) {
- return null;
- }
- name[0] = uri;
- name[1] = local.intern();
- name[2] = qName.intern();
- }
-
- // Save in the cache for future use.
- table.put(name[2], name);
- tablesDirty = true;
- return name;
- }
-
-
- /**
- * Look up the URI associated with a prefix in this context.
- *
- * @param prefix The prefix to look up.
- * @return The associated Namespace URI, or null if none is
- * declared.
- * @see org.xml.sax.helpers.NamespaceSupport#getURI
- */
- String getURI (String prefix)
- {
- if ("".equals(prefix)) {
- return defaultNS;
- } else if (prefixTable == null) {
- return null;
- } else {
- return (String)prefixTable.get(prefix);
- }
- }
-
-
- /**
- * Look up one of the prefixes associated with a URI in this context.
- *
- * <p>Since many prefixes may be mapped to the same URI,
- * the return value may be unreliable.</p>
- *
- * @param uri The URI to look up.
- * @return The associated prefix, or null if none is declared.
- * @see org.xml.sax.helpers.NamespaceSupport#getPrefix
- */
- String getPrefix (String uri)
- {
- if (uriTable == null) {
- return null;
- } else {
- return (String)uriTable.get(uri);
- }
- }
-
-
- /**
- * Return an enumeration of prefixes declared in this context.
- *
- * @return An enumeration of prefixes (possibly empty).
- * @see org.xml.sax.helpers.NamespaceSupport#getDeclaredPrefixes
- */
- Enumeration getDeclaredPrefixes ()
- {
- if (declarations == null) {
- return EMPTY_ENUMERATION;
- } else {
- return declarations.elements();
- }
- }
-
-
- /**
- * Return an enumeration of all prefixes currently in force.
- *
- * <p>The default prefix, if in force, is <em>not</em>
- * returned, and will have to be checked for separately.</p>
- *
- * @return An enumeration of prefixes (never empty).
- * @see org.xml.sax.helpers.NamespaceSupport#getPrefixes
- */
- Enumeration getPrefixes ()
- {
- if (prefixTable == null) {
- return EMPTY_ENUMERATION;
- } else {
- return prefixTable.keys();
- }
- }
-
-
-
- ////////////////////////////////////////////////////////////////
- // Internal methods.
- ////////////////////////////////////////////////////////////////
-
-
- /**
- * Copy on write for the internal tables in this context.
- *
- * <p>This class is optimized for the normal case where most
- * elements do not contain Namespace declarations.</p>
- */
- private void copyTables ()
- {
- if (prefixTable != null) {
- prefixTable = (Hashtable)prefixTable.clone();
- } else {
- prefixTable = new Hashtable();
- }
- if (uriTable != null) {
- uriTable = (Hashtable)uriTable.clone();
- } else {
- uriTable = new Hashtable();
- }
- elementNameTable = new Hashtable();
- attributeNameTable = new Hashtable();
- tablesDirty = true;
- }
-
-
-
- ////////////////////////////////////////////////////////////////
- // Protected state.
- ////////////////////////////////////////////////////////////////
-
- Hashtable prefixTable;
- Hashtable uriTable;
- Hashtable elementNameTable;
- Hashtable attributeNameTable;
- String defaultNS = null;
-
-
-
- ////////////////////////////////////////////////////////////////
- // Internal state.
- ////////////////////////////////////////////////////////////////
-
- private Vector declarations = null;
- private boolean tablesDirty = false;
- private Context parent = null;
- }
-}
-
-// end of NamespaceSupport.java
+// NamespaceSupport.java - generic Namespace support for SAX.
+// http://www.saxproject.org
+// Written by David Megginson
+// This class is in the Public Domain. NO WARRANTY!
+
+// $Id: NamespaceSupport.java,v 1.6.2.5 2002/01/29 21:34:14 dbrownell Exp $
+
+package org.xml.sax.helpers;
+
+import java.util.EmptyStackException;
+import java.util.Enumeration;
+import java.util.Hashtable;
+import java.util.Vector;
+
+
+/**
+ * Encapsulate Namespace logic for use by applications using SAX,
+ * or internally by SAX drivers.
+ *
+ * <blockquote>
+ * <em>This module, both source code and documentation, is in the
+ * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
+ * See <a href='http://www.saxproject.org'>http://www.saxproject.org</a>
+ * for further information.
+ * </blockquote>
+ *
+ * <p>This class encapsulates the logic of Namespace processing:
+ * it tracks the declarations currently in force for each context
+ * and automatically processes qualified XML 1.0 names into their
+ * Namespace parts; it can also be used in reverse for generating
+ * XML 1.0 from Namespaces.</p>
+ *
+ * <p>Namespace support objects are reusable, but the reset method
+ * must be invoked between each session.</p>
+ *
+ * <p>Here is a simple session:</p>
+ *
+ * <pre>
+ * String parts[] = new String[3];
+ * NamespaceSupport support = new NamespaceSupport();
+ *
+ * support.pushContext();
+ * support.declarePrefix("", "http://www.w3.org/1999/xhtml");
+ * support.declarePrefix("dc", "http://www.purl.org/dc#");
+ *
+ * parts = support.processName("p", parts, false);
+ * System.out.println("Namespace URI: " + parts[0]);
+ * System.out.println("Local name: " + parts[1]);
+ * System.out.println("Raw name: " + parts[2]);
+ *
+ * parts = support.processName("dc:title", parts, false);
+ * System.out.println("Namespace URI: " + parts[0]);
+ * System.out.println("Local name: " + parts[1]);
+ * System.out.println("Raw name: " + parts[2]);
+ *
+ * support.popContext();
+ * </pre>
+ *
+ * <p>Note that this class is optimized for the use case where most
+ * elements do not contain Namespace declarations: if the same
+ * prefix/URI mapping is repeated for each context (for example), this
+ * class will be somewhat less efficient.</p>
+ *
+ * <p>Although SAX drivers (parsers) may choose to use this class to
+ * implement namespace handling, they are not required to do so.
+ * Applications must track namespace information themselves if they
+ * want to use namespace information.
+ *
+ * @since SAX 2.0
+ * @author David Megginson
+ * @version 2.0.1 (sax2r2)
+ */
+public class NamespaceSupport
+{
+
+
+ ////////////////////////////////////////////////////////////////////
+ // Constants.
+ ////////////////////////////////////////////////////////////////////
+
+
+ /**
+ * The XML Namespace URI as a constant.
+ * The value is <code>http://www.w3.org/XML/1998/namespace</code>
+ * as defined in the XML Namespaces specification.
+ *
+ * <p>This is the Namespace URI that is automatically mapped
+ * to the "xml" prefix.</p>
+ */
+ public final static String XMLNS =
+ "http://www.w3.org/XML/1998/namespace";
+
+
+ /**
+ * An empty enumeration.
+ */
+ private final static Enumeration EMPTY_ENUMERATION =
+ new Vector().elements();
+
+
+ ////////////////////////////////////////////////////////////////////
+ // Constructor.
+ ////////////////////////////////////////////////////////////////////
+
+
+ /**
+ * Create a new Namespace support object.
+ */
+ public NamespaceSupport ()
+ {
+ reset();
+ }
+
+
+
+ ////////////////////////////////////////////////////////////////////
+ // Context management.
+ ////////////////////////////////////////////////////////////////////
+
+
+ /**
+ * Reset this Namespace support object for reuse.
+ *
+ * <p>It is necessary to invoke this method before reusing the
+ * Namespace support object for a new session.</p>
+ */
+ public void reset ()
+ {
+ contexts = new Context[32];
+ contextPos = 0;
+ contexts[contextPos] = currentContext = new Context();
+ currentContext.declarePrefix("xml", XMLNS);
+ }
+
+
+ /**
+ * Start a new Namespace context.
+ * The new context will automatically inherit
+ * the declarations of its parent context, but it will also keep
+ * track of which declarations were made within this context.
+ *
+ * <p>Event callback code should start a new context once per element.
+ * This means being ready to call this in either of two places.
+ * For elements that don't include namespace declarations, the
+ * <em>ContentHandler.startElement()</em> callback is the right place.
+ * For elements with such a declaration, it'd done in the first
+ * <em>ContentHandler.startPrefixMapping()</em> callback.
+ * A boolean flag can be used to
+ * track whether a context has been started yet. When either of
+ * those methods is called, it checks the flag to see if a new context
+ * needs to be started. If so, it starts the context and sets the
+ * flag. After <em>ContentHandler.startElement()</em>
+ * does that, it always clears the flag.
+ *
+ * <p>Normally, SAX drivers would push a new context at the beginning
+ * of each XML element. Then they perform a first pass over the
+ * attributes to process all namespace declarations, making
+ * <em>ContentHandler.startPrefixMapping()</em> callbacks.
+ * Then a second pass is made, to determine the namespace-qualified
+ * names for all attributes and for the element name.
+ * Finally all the information for the
+ * <em>ContentHandler.startElement()</em> callback is available,
+ * so it can then be made.
+ *
+ * <p>The Namespace support object always starts with a base context
+ * already in force: in this context, only the "xml" prefix is
+ * declared.</p>
+ *
+ * @see org.xml.sax.ContentHandler
+ * @see #popContext
+ */
+ public void pushContext ()
+ {
+ int max = contexts.length;
+
+ contexts [contextPos].declsOK = false;
+ contextPos++;
+
+ // Extend the array if necessary
+ if (contextPos >= max) {
+ Context newContexts[] = new Context[max*2];
+ System.arraycopy(contexts, 0, newContexts, 0, max);
+ max *= 2;
+ contexts = newContexts;
+ }
+
+ // Allocate the context if necessary.
+ currentContext = contexts[contextPos];
+ if (currentContext == null) {
+ contexts[contextPos] = currentContext = new Context();
+ }
+
+ // Set the parent, if any.
+ if (contextPos > 0) {
+ currentContext.setParent(contexts[contextPos - 1]);
+ }
+ }
+
+
+ /**
+ * Revert to the previous Namespace context.
+ *
+ * <p>Normally, you should pop the context at the end of each
+ * XML element. After popping the context, all Namespace prefix
+ * mappings that were previously in force are restored.</p>
+ *
+ * <p>You must not attempt to declare additional Namespace
+ * prefixes after popping a context, unless you push another
+ * context first.</p>
+ *
+ * @see #pushContext
+ */
+ public void popContext ()
+ {
+ contexts[contextPos].clear();
+ contextPos--;
+ if (contextPos < 0) {
+ throw new EmptyStackException();
+ }
+ currentContext = contexts[contextPos];
+ }
+
+
+
+ ////////////////////////////////////////////////////////////////////
+ // Operations within a context.
+ ////////////////////////////////////////////////////////////////////
+
+
+ /**
+ * Declare a Namespace prefix. All prefixes must be declared
+ * before they are referenced. For example, a SAX driver (parser)
+ * would scan an element's attributes
+ * in two passes: first for namespace declarations,
+ * then a second pass using {@link #processName processName()} to
+ * interpret prefixes against (potentially redefined) prefixes.
+ *
+ * <p>This method declares a prefix in the current Namespace
+ * context; the prefix will remain in force until this context
+ * is popped, unless it is shadowed in a descendant context.</p>
+ *
+ * <p>To declare the default element Namespace, use the empty string as
+ * the prefix.</p>
+ *
+ * <p>Note that you must <em>not</em> declare a prefix after
+ * you've pushed and popped another Namespace context, or
+ * treated the declarations phase as complete by processing
+ * a prefixed name.</p>
+ *
+ * <p>Note that there is an asymmetry in this library: {@link
+ * #getPrefix getPrefix} will not return the "" prefix,
+ * even if you have declared a default element namespace.
+ * To check for a default namespace,
+ * you have to look it up explicitly using {@link #getURI getURI}.
+ * This asymmetry exists to make it easier to look up prefixes
+ * for attribute names, where the default prefix is not allowed.</p>
+ *
+ * @param prefix The prefix to declare, or the empty string to
+ * indicate the default element namespace. This may never have
+ * the value "xml" or "xmlns".
+ * @param uri The Namespace URI to associate with the prefix.
+ * @return true if the prefix was legal, false otherwise
+ * @exception IllegalStateException when a prefix is declared
+ * after looking up a name in the context, or after pushing
+ * another context on top of it.
+ *
+ * @see #processName
+ * @see #getURI
+ * @see #getPrefix
+ */
+ public boolean declarePrefix (String prefix, String uri)
+ {
+ if (prefix.equals("xml") || prefix.equals("xmlns")) {
+ return false;
+ } else {
+ currentContext.declarePrefix(prefix, uri);
+ return true;
+ }
+ }
+
+
+ /**
+ * Process a raw XML 1.0 name, after all declarations in the current
+ * context have been handled by {@link #declarePrefix declarePrefix()}.
+ *
+ * <p>This method processes a raw XML 1.0 name in the current
+ * context by removing the prefix and looking it up among the
+ * prefixes currently declared. The return value will be the
+ * array supplied by the caller, filled in as follows:</p>
+ *
+ * <dl>
+ * <dt>parts[0]</dt>
+ * <dd>The Namespace URI, or an empty string if none is
+ * in use.</dd>
+ * <dt>parts[1]</dt>
+ * <dd>The local name (without prefix).</dd>
+ * <dt>parts[2]</dt>
+ * <dd>The original raw name.</dd>
+ * </dl>
+ *
+ * <p>All of the strings in the array will be internalized. If
+ * the raw name has a prefix that has not been declared, then
+ * the return value will be null.</p>
+ *
+ * <p>Note that attribute names are processed differently than
+ * element names: an unprefixed element name will received the
+ * default Namespace (if any), while an unprefixed attribute name
+ * will not.</p>
+ *
+ * @param qName The raw XML 1.0 name to be processed.
+ * @param parts An array supplied by the caller, capable of
+ * holding at least three members.
+ * @param isAttribute A flag indicating whether this is an
+ * attribute name (true) or an element name (false).
+ * @return The supplied array holding three internalized strings
+ * representing the Namespace URI (or empty string), the
+ * local name, and the raw XML 1.0 name; or null if there
+ * is an undeclared prefix.
+ * @see #declarePrefix
+ * @see java.lang.String#intern */
+ public String [] processName (String qName, String parts[],
+ boolean isAttribute)
+ {
+ String myParts[] = currentContext.processName(qName, isAttribute);
+ if (myParts == null) {
+ return null;
+ } else {
+ parts[0] = myParts[0];
+ parts[1] = myParts[1];
+ parts[2] = myParts[2];
+ return parts;
+ }
+ }
+
+
+ /**
+ * Look up a prefix and get the currently-mapped Namespace URI.
+ *
+ * <p>This method looks up the prefix in the current context.
+ * Use the empty string ("") for the default Namespace.</p>
+ *
+ * @param prefix The prefix to look up.
+ * @return The associated Namespace URI, or null if the prefix
+ * is undeclared in this context.
+ * @see #getPrefix
+ * @see #getPrefixes
+ */
+ public String getURI (String prefix)
+ {
+ return currentContext.getURI(prefix);
+ }
+
+
+ /**
+ * Return an enumeration of all prefixes currently declared.
+ *
+ * <p><strong>Note:</strong> if there is a default prefix, it will not be
+ * returned in this enumeration; check for the default prefix
+ * using the {@link #getURI getURI} with an argument of "".</p>
+ *
+ * @return An enumeration of all prefixes declared in the
+ * current context except for the empty (default)
+ * prefix.
+ * @see #getDeclaredPrefixes
+ * @see #getURI
+ */
+ public Enumeration getPrefixes ()
+ {
+ return currentContext.getPrefixes();
+ }
+
+
+ /**
+ * Return one of the prefixes mapped to a Namespace URI.
+ *
+ * <p>If more than one prefix is currently mapped to the same
+ * URI, this method will make an arbitrary selection; if you
+ * want all of the prefixes, use the {@link #getPrefixes}
+ * method instead.</p>
+ *
+ * <p><strong>Note:</strong> this will never return the empty (default) prefix;
+ * to check for a default prefix, use the {@link #getURI getURI}
+ * method with an argument of "".</p>
+ *
+ * @param uri The Namespace URI.
+ * @param isAttribute true if this prefix is for an attribute
+ * (and the default Namespace is not allowed).
+ * @return One of the prefixes currently mapped to the URI supplied,
+ * or null if none is mapped or if the URI is assigned to
+ * the default Namespace.
+ * @see #getPrefixes(java.lang.String)
+ * @see #getURI
+ */
+ public String getPrefix (String uri)
+ {
+ return currentContext.getPrefix(uri);
+ }
+
+
+ /**
+ * Return an enumeration of all prefixes currently declared for a URI.
+ *
+ * <p>This method returns prefixes mapped to a specific Namespace
+ * URI. The xml: prefix will be included. If you want only one
+ * prefix that's mapped to the Namespace URI, and you don't care
+ * which one you get, use the {@link #getPrefix getPrefix}
+ * method instead.</p>
+ *
+ * <p><strong>Note:</strong> the empty (default) prefix is <em>never</em> included
+ * in this enumeration; to check for the presence of a default
+ * Namespace, use the {@link #getURI getURI} method with an
+ * argument of "".</p>
+ *
+ * @param uri The Namespace URI.
+ * @return An enumeration of all prefixes declared in the
+ * current context.
+ * @see #getPrefix
+ * @see #getDeclaredPrefixes
+ * @see #getURI
+ */
+ public Enumeration getPrefixes (String uri)
+ {
+ Vector prefixes = new Vector();
+ Enumeration allPrefixes = getPrefixes();
+ while (allPrefixes.hasMoreElements()) {
+ String prefix = (String)allPrefixes.nextElement();
+ if (uri.equals(getURI(prefix))) {
+ prefixes.addElement(prefix);
+ }
+ }
+ return prefixes.elements();
+ }
+
+
+ /**
+ * Return an enumeration of all prefixes declared in this context.
+ *
+ * <p>The empty (default) prefix will be included in this
+ * enumeration; note that this behaviour differs from that of
+ * {@link #getPrefix} and {@link #getPrefixes}.</p>
+ *
+ * @return An enumeration of all prefixes declared in this
+ * context.
+ * @see #getPrefixes
+ * @see #getURI
+ */
+ public Enumeration getDeclaredPrefixes ()
+ {
+ return currentContext.getDeclaredPrefixes();
+ }
+
+
+
+ ////////////////////////////////////////////////////////////////////
+ // Internal state.
+ ////////////////////////////////////////////////////////////////////
+
+ private Context contexts[];
+ private Context currentContext;
+ private int contextPos;
+
+
+
+ ////////////////////////////////////////////////////////////////////
+ // Internal classes.
+ ////////////////////////////////////////////////////////////////////
+
+ /**
+ * Internal class for a single Namespace context.
+ *
+ * <p>This module caches and reuses Namespace contexts,
+ * so the number allocated
+ * will be equal to the element depth of the document, not to the total
+ * number of elements (i.e. 5-10 rather than tens of thousands).
+ * Also, data structures used to represent contexts are shared when
+ * possible (child contexts without declarations) to further reduce
+ * the amount of memory that's consumed.
+ * </p>
+ */
+ final class Context {
+
+ /**
+ * Create the root-level Namespace context.
+ */
+ Context ()
+ {
+ copyTables();
+ }
+
+
+ /**
+ * (Re)set the parent of this Namespace context.
+ * The context must either have been freshly constructed,
+ * or must have been cleared.
+ *
+ * @param context The parent Namespace context object.
+ */
+ void setParent (Context parent)
+ {
+ this.parent = parent;
+ declarations = null;
+ prefixTable = parent.prefixTable;
+ uriTable = parent.uriTable;
+ elementNameTable = parent.elementNameTable;
+ attributeNameTable = parent.attributeNameTable;
+ defaultNS = parent.defaultNS;
+ declSeen = false;
+ declsOK = true;
+ }
+
+ /**
+ * Makes associated state become collectible,
+ * invalidating this context.
+ * {@link #setParent} must be called before
+ * this context may be used again.
+ */
+ void clear ()
+ {
+ parent = null;
+ prefixTable = null;
+ uriTable = null;
+ elementNameTable = null;
+ attributeNameTable = null;
+ defaultNS = null;
+ }
+
+
+ /**
+ * Declare a Namespace prefix for this context.
+ *
+ * @param prefix The prefix to declare.
+ * @param uri The associated Namespace URI.
+ * @see org.xml.sax.helpers.NamespaceSupport#declarePrefix
+ */
+ void declarePrefix (String prefix, String uri)
+ {
+ // Lazy processing...
+ if (!declsOK)
+ throw new IllegalStateException (
+ "can't declare any more prefixes in this context");
+ if (!declSeen) {
+ copyTables();
+ }
+ if (declarations == null) {
+ declarations = new Vector();
+ }
+
+ prefix = prefix.intern();
+ uri = uri.intern();
+ if ("".equals(prefix)) {
+ if ("".equals(uri)) {
+ defaultNS = null;
+ } else {
+ defaultNS = uri;
+ }
+ } else {
+ prefixTable.put(prefix, uri);
+ uriTable.put(uri, prefix); // may wipe out another prefix
+ }
+ declarations.addElement(prefix);
+ }
+
+
+ /**
+ * Process a raw XML 1.0 name in this context.
+ *
+ * @param qName The raw XML 1.0 name.
+ * @param isAttribute true if this is an attribute name.
+ * @return An array of three strings containing the
+ * URI part (or empty string), the local part,
+ * and the raw name, all internalized, or null
+ * if there is an undeclared prefix.
+ * @see org.xml.sax.helpers.NamespaceSupport#processName
+ */
+ String [] processName (String qName, boolean isAttribute)
+ {
+ String name[];
+ Hashtable table;
+
+ // detect errors in call sequence
+ declsOK = false;
+
+ // Select the appropriate table.
+ if (isAttribute) {
+ table = attributeNameTable;
+ } else {
+ table = elementNameTable;
+ }
+
+ // Start by looking in the cache, and
+ // return immediately if the name
+ // is already known in this content
+ name = (String[])table.get(qName);
+ if (name != null) {
+ return name;
+ }
+
+ // We haven't seen this name in this
+ // context before. Maybe in the parent
+ // context, but we can't assume prefix
+ // bindings are the same.
+ name = new String[3];
+ name[2] = qName.intern();
+ int index = qName.indexOf(':');
+
+
+ // No prefix.
+ if (index == -1) {
+ if (isAttribute || defaultNS == null) {
+ name[0] = "";
+ } else {
+ name[0] = defaultNS;
+ }
+ name[1] = name[2];
+ }
+
+ // Prefix
+ else {
+ String prefix = qName.substring(0, index);
+ String local = qName.substring(index+1);
+ String uri;
+ if ("".equals(prefix)) {
+ uri = defaultNS;
+ } else {
+ uri = (String)prefixTable.get(prefix);
+ }
+ if (uri == null) {
+ return null;
+ }
+ name[0] = uri;
+ name[1] = local.intern();
+ }
+
+ // Save in the cache for future use.
+ // (Could be shared with parent context...)
+ table.put(name[2], name);
+ return name;
+ }
+
+
+ /**
+ * Look up the URI associated with a prefix in this context.
+ *
+ * @param prefix The prefix to look up.
+ * @return The associated Namespace URI, or null if none is
+ * declared.
+ * @see org.xml.sax.helpers.NamespaceSupport#getURI
+ */
+ String getURI (String prefix)
+ {
+ if ("".equals(prefix)) {
+ return defaultNS;
+ } else if (prefixTable == null) {
+ return null;
+ } else {
+ return (String)prefixTable.get(prefix);
+ }
+ }
+
+
+ /**
+ * Look up one of the prefixes associated with a URI in this context.
+ *
+ * <p>Since many prefixes may be mapped to the same URI,
+ * the return value may be unreliable.</p>
+ *
+ * @param uri The URI to look up.
+ * @return The associated prefix, or null if none is declared.
+ * @see org.xml.sax.helpers.NamespaceSupport#getPrefix
+ */
+ String getPrefix (String uri)
+ {
+ if (uriTable == null) {
+ return null;
+ } else {
+ return (String)uriTable.get(uri);
+ }
+ }
+
+
+ /**
+ * Return an enumeration of prefixes declared in this context.
+ *
+ * @return An enumeration of prefixes (possibly empty).
+ * @see org.xml.sax.helpers.NamespaceSupport#getDeclaredPrefixes
+ */
+ Enumeration getDeclaredPrefixes ()
+ {
+ if (declarations == null) {
+ return EMPTY_ENUMERATION;
+ } else {
+ return declarations.elements();
+ }
+ }
+
+
+ /**
+ * Return an enumeration of all prefixes currently in force.
+ *
+ * <p>The default prefix, if in force, is <em>not</em>
+ * returned, and will have to be checked for separately.</p>
+ *
+ * @return An enumeration of prefixes (never empty).
+ * @see org.xml.sax.helpers.NamespaceSupport#getPrefixes
+ */
+ Enumeration getPrefixes ()
+ {
+ if (prefixTable == null) {
+ return EMPTY_ENUMERATION;
+ } else {
+ return prefixTable.keys();
+ }
+ }
+
+
+
+ ////////////////////////////////////////////////////////////////
+ // Internal methods.
+ ////////////////////////////////////////////////////////////////
+
+
+ /**
+ * Copy on write for the internal tables in this context.
+ *
+ * <p>This class is optimized for the normal case where most
+ * elements do not contain Namespace declarations.</p>
+ */
+ private void copyTables ()
+ {
+ if (prefixTable != null) {
+ prefixTable = (Hashtable)prefixTable.clone();
+ } else {
+ prefixTable = new Hashtable();
+ }
+ if (uriTable != null) {
+ uriTable = (Hashtable)uriTable.clone();
+ } else {
+ uriTable = new Hashtable();
+ }
+ elementNameTable = new Hashtable();
+ attributeNameTable = new Hashtable();
+ declSeen = true;
+ }
+
+
+
+ ////////////////////////////////////////////////////////////////
+ // Protected state.
+ ////////////////////////////////////////////////////////////////
+
+ Hashtable prefixTable;
+ Hashtable uriTable;
+ Hashtable elementNameTable;
+ Hashtable attributeNameTable;
+ String defaultNS = null;
+ boolean declsOK = true;
+
+
+
+ ////////////////////////////////////////////////////////////////
+ // Internal state.
+ ////////////////////////////////////////////////////////////////
+
+ private Vector declarations = null;
+ private boolean declSeen = false;
+ private Context parent = null;
+ }
+}
+
+// end of NamespaceSupport.java
diff --git a/libjava/org/xml/sax/helpers/NewInstance.java b/libjava/org/xml/sax/helpers/NewInstance.java
new file mode 100644
index 00000000000..7d107a65239
--- /dev/null
+++ b/libjava/org/xml/sax/helpers/NewInstance.java
@@ -0,0 +1,80 @@
+// NewInstance.java - create a new instance of a class by name.
+// http://www.saxproject.org
+// Written by Edwin Goei, edwingo@apache.org
+// and by David Brownell, dbrownell@users.sourceforge.net
+// NO WARRANTY! This class is in the Public Domain.
+
+// $Id: NewInstance.java,v 1.1.2.4 2002/01/29 21:34:14 dbrownell Exp $
+
+package org.xml.sax.helpers;
+
+import java.lang.reflect.Method;
+import java.lang.reflect.InvocationTargetException;
+
+/**
+ * Create a new instance of a class by name.
+ *
+ * <blockquote>
+ * <em>This module, both source code and documentation, is in the
+ * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
+ * See <a href='http://www.saxproject.org'>http://www.saxproject.org</a>
+ * for further information.
+ * </blockquote>
+ *
+ * <p>This class contains a static method for creating an instance of a
+ * class from an explicit class name. It tries to use the thread's context
+ * ClassLoader if possible and falls back to using
+ * Class.forName(String).</p>
+ *
+ * <p>This code is designed to compile and run on JDK version 1.1 and later
+ * including versions of Java 2.</p>
+ *
+ * @author Edwin Goei, David Brownell
+ * @version 2.0.1 (sax2r2)
+ */
+class NewInstance {
+
+ /**
+ * Creates a new instance of the specified class name
+ *
+ * Package private so this code is not exposed at the API level.
+ */
+ static Object newInstance (ClassLoader classLoader, String className)
+ throws ClassNotFoundException, IllegalAccessException,
+ InstantiationException
+ {
+ Class driverClass;
+ if (classLoader == null) {
+ driverClass = Class.forName(className);
+ } else {
+ driverClass = classLoader.loadClass(className);
+ }
+ return driverClass.newInstance();
+ }
+
+ /**
+ * Figure out which ClassLoader to use. For JDK 1.2 and later use
+ * the context ClassLoader.
+ */
+ static ClassLoader getClassLoader ()
+ {
+ Method m = null;
+
+ try {
+ m = Thread.class.getMethod("getContextClassLoader", null);
+ } catch (NoSuchMethodException e) {
+ // Assume that we are running JDK 1.1, use the current ClassLoader
+ return NewInstance.class.getClassLoader();
+ }
+
+ try {
+ return (ClassLoader) m.invoke(Thread.currentThread(), null);
+ } catch (IllegalAccessException e) {
+ // assert(false)
+ throw new UnknownError(e.getMessage());
+ } catch (InvocationTargetException e) {
+ // assert(e.getTargetException() instanceof SecurityException)
+ throw new UnknownError(e.getMessage());
+ }
+ }
+}
diff --git a/libjava/org/xml/sax/helpers/ParserAdapter.java b/libjava/org/xml/sax/helpers/ParserAdapter.java
index 06071b7bdd5..ca66a9e2dc7 100644
--- a/libjava/org/xml/sax/helpers/ParserAdapter.java
+++ b/libjava/org/xml/sax/helpers/ParserAdapter.java
@@ -1,1008 +1,1026 @@
-// ParserAdapter.java - adapt a SAX1 Parser to a SAX2 XMLReader.
-// Written by David Megginson, sax@megginson.com
-// NO WARRANTY! This class is in the public domain.
-
-// $Id: ParserAdapter.java,v 1.1 2000/10/02 02:43:20 sboag Exp $
-
-package org.xml.sax.helpers;
-
-import java.io.IOException;
-import java.util.Enumeration;
-
-import org.xml.sax.Parser; // deprecated
-import org.xml.sax.InputSource;
-import org.xml.sax.Locator;
-import org.xml.sax.AttributeList; // deprecated
-import org.xml.sax.EntityResolver;
-import org.xml.sax.DTDHandler;
-import org.xml.sax.DocumentHandler; // deprecated
-import org.xml.sax.ErrorHandler;
-import org.xml.sax.SAXException;
-import org.xml.sax.SAXParseException;
-
-import org.xml.sax.XMLReader;
-import org.xml.sax.Attributes;
-import org.xml.sax.ContentHandler;
-import org.xml.sax.SAXNotRecognizedException;
-import org.xml.sax.SAXNotSupportedException;
-
-
-/**
- * Adapt a SAX1 Parser as a SAX2 XMLReader.
- *
- * <blockquote>
- * <em>This module, both source code and documentation, is in the
- * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
- * </blockquote>
- *
- * <p>This class wraps a SAX1 {@link org.xml.sax.Parser Parser}
- * and makes it act as a SAX2 {@link org.xml.sax.XMLReader XMLReader},
- * with feature, property, and Namespace support. Note
- * that it is not possible to report {@link org.xml.sax.ContentHandler#skippedEntity
- * skippedEntity} events, since SAX1 does not make that information available.</p>
- *
- * <p>This adapter does not test for duplicate Namespace-qualified
- * attribute names.</p>
- *
- * @since SAX 2.0
- * @author David Megginson,
- * <a href="mailto:sax@megginson.com">sax@megginson.com</a>
- * @version 2.0
- * @see org.xml.sax.helpers.XMLReaderAdapter
- * @see org.xml.sax.XMLReader
- * @see org.xml.sax.Parser
- */
-public class ParserAdapter implements XMLReader, DocumentHandler
-{
-
-
- ////////////////////////////////////////////////////////////////////
- // Constructors.
- ////////////////////////////////////////////////////////////////////
-
-
- /**
- * Construct a new parser adapter.
- *
- * <p>Use the "org.xml.sax.parser" property to locate the
- * embedded SAX1 driver.</p>
- *
- * @exception org.xml.sax.SAXException If the embedded driver
- * cannot be instantiated or if the
- * org.xml.sax.parser property is not specified.
- */
- public ParserAdapter ()
- throws SAXException
- {
- super();
-
- String driver = System.getProperty("org.xml.sax.parser");
-
- try {
- setup(ParserFactory.makeParser());
- } catch (ClassNotFoundException e1) {
- throw new
- SAXException("Cannot find SAX1 driver class " +
- driver, e1);
- } catch (IllegalAccessException e2) {
- throw new
- SAXException("SAX1 driver class " +
- driver +
- " found but cannot be loaded", e2);
- } catch (InstantiationException e3) {
- throw new
- SAXException("SAX1 driver class " +
- driver +
- " loaded but cannot be instantiated", e3);
- } catch (ClassCastException e4) {
- throw new
- SAXException("SAX1 driver class " +
- driver +
- " does not implement org.xml.sax.Parser");
- } catch (NullPointerException e5) {
- throw new
- SAXException("System property org.xml.sax.parser not specified");
- }
- }
-
-
- /**
- * Construct a new parser adapter.
- *
- * <p>Note that the embedded parser cannot be changed once the
- * adapter is created; to embed a different parser, allocate
- * a new ParserAdapter.</p>
- *
- * @param parser The SAX1 parser to embed.
- * @exception java.lang.NullPointerException If the parser parameter
- * is null.
- */
- public ParserAdapter (Parser parser)
- {
- super();
- setup(parser);
- }
-
-
- /**
- * Internal setup method.
- *
- * @param parser The embedded parser.
- * @exception java.lang.NullPointerException If the parser parameter
- * is null.
- */
- private void setup (Parser parser)
- {
- if (parser == null) {
- throw new
- NullPointerException("Parser argument must not be null");
- }
- this.parser = parser;
- atts = new AttributesImpl();
- nsSupport = new NamespaceSupport();
- attAdapter = new AttributeListAdapter();
- }
-
-
-
- ////////////////////////////////////////////////////////////////////
- // Implementation of org.xml.sax.XMLReader.
- ////////////////////////////////////////////////////////////////////
-
-
- //
- // Internal constants for the sake of convenience.
- //
- private final static String FEATURES = "http://xml.org/sax/features/";
- private final static String NAMESPACES = FEATURES + "namespaces";
- private final static String NAMESPACE_PREFIXES = FEATURES + "namespace-prefixes";
- private final static String VALIDATION = FEATURES + "validation";
- private final static String EXTERNAL_GENERAL =
- FEATURES + "external-general-entities";
- private final static String EXTERNAL_PARAMETER =
- FEATURES + "external-parameter-entities";
-
-
- /**
- * Set a feature for the parser.
- *
- * <p>The only features supported are namespaces and
- * namespace-prefixes.</p>
- *
- * @param name The feature name, as a complete URI.
- * @param state The requested feature state.
- * @exception org.xml.sax.SAXNotRecognizedException If the feature
- * name is not known.
- * @exception org.xml.sax.SAXNotSupportedException If the feature
- * state is not supported.
- * @see org.xml.sax.XMLReader#setFeature
- */
- public void setFeature (String name, boolean state)
- throws SAXNotRecognizedException, SAXNotSupportedException
- {
- if (name.equals(NAMESPACES)) {
- checkNotParsing("feature", name);
- namespaces = state;
- if (!namespaces && !prefixes) {
- prefixes = true;
- }
- } else if (name.equals(NAMESPACE_PREFIXES)) {
- checkNotParsing("feature", name);
- prefixes = state;
- if (!prefixes && !namespaces) {
- namespaces = true;
- }
- } else if (name.equals(VALIDATION) ||
- name.equals(EXTERNAL_GENERAL) ||
- name.equals(EXTERNAL_PARAMETER)) {
- throw new SAXNotSupportedException("Feature: " + name);
- } else {
- throw new SAXNotRecognizedException("Feature: " + name);
- }
- }
-
-
- /**
- * Check a parser feature.
- *
- * <p>The only features supported are namespaces and
- * namespace-prefixes.</p>
- *
- * @param name The feature name, as a complete URI.
- * @return The current feature state.
- * @exception org.xml.sax.SAXNotRecognizedException If the feature
- * name is not known.
- * @exception org.xml.sax.SAXNotSupportedException If querying the
- * feature state is not supported.
- * @see org.xml.sax.XMLReader#setFeature
- */
- public boolean getFeature (String name)
- throws SAXNotRecognizedException, SAXNotSupportedException
- {
- if (name.equals(NAMESPACES)) {
- return namespaces;
- } else if (name.equals(NAMESPACE_PREFIXES)) {
- return prefixes;
- } else if (name.equals(VALIDATION) ||
- name.equals(EXTERNAL_GENERAL) ||
- name.equals(EXTERNAL_PARAMETER)) {
- throw new SAXNotSupportedException("Feature: " + name);
- } else {
- throw new SAXNotRecognizedException("Feature: " + name);
- }
- }
-
-
- /**
- * Set a parser property.
- *
- * <p>No special properties are currently supported.</p>
- *
- * @param name The property name.
- * @param value The property value.
- * @exception org.xml.sax.SAXNotRecognizedException If the feature
- * name is not known.
- * @exception org.xml.sax.SAXNotSupportedException If the feature
- * state is not supported.
- * @see org.xml.sax.XMLReader#setProperty
- */
- public void setProperty (String name, Object value)
- throws SAXNotRecognizedException, SAXNotSupportedException
- {
- throw new SAXNotRecognizedException("Property: " + name);
- }
-
-
- /**
- * Get a parser property.
- *
- * <p>No special properties are currently supported.</p>
- *
- * @param name The property name.
- * @return The property value.
- * @exception org.xml.sax.SAXNotRecognizedException If the feature
- * name is not known.
- * @exception org.xml.sax.SAXNotSupportedException If the feature
- * state is not supported.
- * @see org.xml.sax.XMLReader#getProperty
- */
- public Object getProperty (String name)
- throws SAXNotRecognizedException, SAXNotSupportedException
- {
- throw new SAXNotRecognizedException("Property: " + name);
- }
-
-
- /**
- * Set the entity resolver.
- *
- * @param resolver The new entity resolver.
- * @exception java.lang.NullPointerException If the entity resolver
- * parameter is null.
- * @see org.xml.sax.XMLReader#setEntityResolver
- */
- public void setEntityResolver (EntityResolver resolver)
- {
- if (resolver == null) {
- throw new NullPointerException("Null entity resolver");
- }
- entityResolver = resolver;
- }
-
-
- /**
- * Return the current entity resolver.
- *
- * @return The current entity resolver, or null if none was supplied.
- * @see org.xml.sax.XMLReader#getEntityResolver
- */
- public EntityResolver getEntityResolver ()
- {
- return entityResolver;
- }
-
-
- /**
- * Set the DTD handler.
- *
- * @param resolver The new DTD handler.
- * @exception java.lang.NullPointerException If the DTD handler
- * parameter is null.
- * @see org.xml.sax.XMLReader#setEntityResolver
- */
- public void setDTDHandler (DTDHandler handler)
- {
- if (handler == null) {
- throw new NullPointerException("Null DTD handler");
- }
- dtdHandler = handler;
- }
-
-
- /**
- * Return the current DTD handler.
- *
- * @return The current DTD handler, or null if none was supplied.
- * @see org.xml.sax.XMLReader#getEntityResolver
- */
- public DTDHandler getDTDHandler ()
- {
- return dtdHandler;
- }
-
-
- /**
- * Set the content handler.
- *
- * @param resolver The new content handler.
- * @exception java.lang.NullPointerException If the content handler
- * parameter is null.
- * @see org.xml.sax.XMLReader#setEntityResolver
- */
- public void setContentHandler (ContentHandler handler)
- {
- if (handler == null) {
- throw new NullPointerException("Null content handler");
- }
- contentHandler = handler;
- }
-
-
- /**
- * Return the current content handler.
- *
- * @return The current content handler, or null if none was supplied.
- * @see org.xml.sax.XMLReader#getEntityResolver
- */
- public ContentHandler getContentHandler ()
- {
- return contentHandler;
- }
-
-
- /**
- * Set the error handler.
- *
- * @param resolver The new error handler.
- * @exception java.lang.NullPointerException If the error handler
- * parameter is null.
- * @see org.xml.sax.XMLReader#setEntityResolver
- */
- public void setErrorHandler (ErrorHandler handler)
- {
- if (handler == null) {
- throw new NullPointerException("Null error handler");
- }
- errorHandler = handler;
- }
-
-
- /**
- * Return the current error handler.
- *
- * @return The current error handler, or null if none was supplied.
- * @see org.xml.sax.XMLReader#getEntityResolver
- */
- public ErrorHandler getErrorHandler ()
- {
- return errorHandler;
- }
-
-
- /**
- * Parse an XML document.
- *
- * @param systemId The absolute URL of the document.
- * @exception java.io.IOException If there is a problem reading
- * the raw content of the document.
- * @exception org.xml.sax.SAXException If there is a problem
- * processing the document.
- * @see #parse(org.xml.sax.InputSource)
- * @see org.xml.sax.Parser#parse(java.lang.String)
- */
- public void parse (String systemId)
- throws IOException, SAXException
- {
- parse(new InputSource(systemId));
- }
-
-
- /**
- * Parse an XML document.
- *
- * @param input An input source for the document.
- * @exception java.io.IOException If there is a problem reading
- * the raw content of the document.
- * @exception org.xml.sax.SAXException If there is a problem
- * processing the document.
- * @see #parse(java.lang.String)
- * @see org.xml.sax.Parser#parse(org.xml.sax.InputSource)
- */
- public void parse (InputSource input)
- throws IOException, SAXException
- {
- if (parsing) {
- throw new SAXException("Parser is already in use");
- }
- setupParser();
- parsing = true;
- try {
- parser.parse(input);
- } finally {
- parsing = false;
- }
- parsing = false;
- }
-
-
-
- ////////////////////////////////////////////////////////////////////
- // Implementation of org.xml.sax.DocumentHandler.
- ////////////////////////////////////////////////////////////////////
-
-
- /**
- * Adapt a SAX1 document locator event.
- *
- * @param locator A document locator.
- * @see org.xml.sax.ContentHandler#setDocumentLocator
- */
- public void setDocumentLocator (Locator locator)
- {
- this.locator = locator;
- if (contentHandler != null) {
- contentHandler.setDocumentLocator(locator);
- }
- }
-
-
- /**
- * Adapt a SAX1 start document event.
- *
- * @exception org.xml.sax.SAXException The client may raise a
- * processing exception.
- * @see org.xml.sax.DocumentHandler#startDocument
- */
- public void startDocument ()
- throws SAXException
- {
- if (contentHandler != null) {
- contentHandler.startDocument();
- }
- }
-
-
- /**
- * Adapt a SAX1 end document event.
- *
- * @exception org.xml.sax.SAXException The client may raise a
- * processing exception.
- * @see org.xml.sax.DocumentHandler#endDocument
- */
- public void endDocument ()
- throws SAXException
- {
- if (contentHandler != null) {
- contentHandler.endDocument();
- }
- }
-
-
- /**
- * Adapt a SAX1 startElement event.
- *
- * <p>If necessary, perform Namespace processing.</p>
- *
- * @param qName The qualified (prefixed) name.
- * @param qAtts The XML 1.0 attribute list (with qnames).
- */
- public void startElement (String qName, AttributeList qAtts)
- throws SAXException
- {
- // If we're not doing Namespace
- // processing, dispatch this quickly.
- if (!namespaces) {
- if (contentHandler != null) {
- attAdapter.setAttributeList(qAtts);
- contentHandler.startElement("", "", qName.intern(),
- attAdapter);
- }
- return;
- }
-
-
- // OK, we're doing Namespace processing.
- nsSupport.pushContext();
- boolean seenDecl = false;
- atts.clear();
-
- // Take a first pass and copy all
- // attributes into the SAX2 attribute
- // list, noting any Namespace
- // declarations.
- int length = qAtts.getLength();
- for (int i = 0; i < length; i++) {
- String attQName = qAtts.getName(i);
- String type = qAtts.getType(i);
- String value = qAtts.getValue(i);
-
- // Found a declaration...
- if (attQName.startsWith("xmlns")) {
- String prefix;
- int n = attQName.indexOf(':');
- if (n == -1) {
- prefix = "";
- } else {
- prefix = attQName.substring(n+1);
- }
- if (!nsSupport.declarePrefix(prefix, value)) {
- reportError("Illegal Namespace prefix: " + prefix);
- }
- if (contentHandler != null) {
- contentHandler.startPrefixMapping(prefix, value);
- }
- // We may still have to add this to
- // the list.
- if (prefixes) {
- atts.addAttribute("", "", attQName.intern(),
- type, value);
- }
- seenDecl = true;
-
- // This isn't a declaration.
- } else {
- String attName[] = processName(attQName, true);
- atts.addAttribute(attName[0], attName[1], attName[2],
- type, value);
- }
- }
-
- // If there was a Namespace declaration,
- // we have to make a second pass just
- // to be safe -- this will happen very
- // rarely, possibly only once for each
- // document.
- if (seenDecl) {
- length = atts.getLength();
- for (int i = 0; i < length; i++) {
- String attQName = atts.getQName(i);
- if (!attQName.startsWith("xmlns")) {
- String attName[] = processName(attQName, true);
- atts.setURI(i, attName[0]);
- atts.setLocalName(i, attName[1]);
- }
- }
- }
-
- // OK, finally report the event.
- if (contentHandler != null) {
- String name[] = processName(qName, false);
- contentHandler.startElement(name[0], name[1], name[2], atts);
- }
- }
-
-
- /**
- * Adapt a SAX1 end element event.
- *
- * @param qName The qualified (prefixed) name.
- * @exception org.xml.sax.SAXException The client may raise a
- * processing exception.
- * @see org.xml.sax.DocumentHandler#endElement
- */
- public void endElement (String qName)
- throws SAXException
- {
- // If we're not doing Namespace
- // processing, dispatch this quickly.
- if (!namespaces) {
- if (contentHandler != null) {
- contentHandler.endElement("", "", qName.intern());
- }
- return;
- }
-
- // Split the name.
- String names[] = processName(qName, false);
- if (contentHandler != null) {
- contentHandler.endElement(names[0], names[1], names[2]);
- Enumeration prefixes = nsSupport.getDeclaredPrefixes();
- while (prefixes.hasMoreElements()) {
- String prefix = (String)prefixes.nextElement();
- contentHandler.endPrefixMapping(prefix);
- }
- }
- nsSupport.popContext();
- }
-
-
- /**
- * Adapt a SAX1 characters event.
- *
- * @param ch An array of characters.
- * @param start The starting position in the array.
- * @param length The number of characters to use.
- * @exception org.xml.sax.SAXException The client may raise a
- * processing exception.
- * @see org.xml.sax.DocumentHandler#characters
- */
- public void characters (char ch[], int start, int length)
- throws SAXException
- {
- if (contentHandler != null) {
- contentHandler.characters(ch, start, length);
- }
- }
-
-
- /**
- * Adapt a SAX1 ignorable whitespace event.
- *
- * @param ch An array of characters.
- * @param start The starting position in the array.
- * @param length The number of characters to use.
- * @exception org.xml.sax.SAXException The client may raise a
- * processing exception.
- * @see org.xml.sax.DocumentHandler#ignorableWhitespace
- */
- public void ignorableWhitespace (char ch[], int start, int length)
- throws SAXException
- {
- if (contentHandler != null) {
- contentHandler.ignorableWhitespace(ch, start, length);
- }
- }
-
-
- /**
- * Adapt a SAX1 processing instruction event.
- *
- * @param target The processing instruction target.
- * @param data The remainder of the processing instruction
- * @exception org.xml.sax.SAXException The client may raise a
- * processing exception.
- * @see org.xml.sax.DocumentHandler#processingInstruction
- */
- public void processingInstruction (String target, String data)
- throws SAXException
- {
- if (contentHandler != null) {
- contentHandler.processingInstruction(target, data);
- }
- }
-
-
-
- ////////////////////////////////////////////////////////////////////
- // Internal utility methods.
- ////////////////////////////////////////////////////////////////////
-
-
- /**
- * Initialize the parser before each run.
- */
- private void setupParser ()
- {
- nsSupport.reset();
-
- if (entityResolver != null) {
- parser.setEntityResolver(entityResolver);
- }
- if (dtdHandler != null) {
- parser.setDTDHandler(dtdHandler);
- }
- if (errorHandler != null) {
- parser.setErrorHandler(errorHandler);
- }
- parser.setDocumentHandler(this);
- locator = null;
- }
-
-
- /**
- * Process a qualified (prefixed) name.
- *
- * <p>If the name has an undeclared prefix, use only the qname
- * and make an ErrorHandler.error callback in case the app is
- * interested.</p>
- *
- * @param qName The qualified (prefixed) name.
- * @param isAttribute true if this is an attribute name.
- * @return The name split into three parts.
- * @exception org.xml.sax.SAXException The client may throw
- * an exception if there is an error callback.
- */
- private String [] processName (String qName, boolean isAttribute)
- throws SAXException
- {
- String parts[] = nsSupport.processName(qName, nameParts,
- isAttribute);
- if (parts == null) {
- parts = new String[3];
- parts[2] = qName.intern();
- reportError("Undeclared prefix: " + qName);
- }
- return parts;
- }
-
-
- /**
- * Report a non-fatal error.
- *
- * @param message The error message.
- * @exception org.xml.sax.SAXException The client may throw
- * an exception.
- */
- void reportError (String message)
- throws SAXException
- {
- if (errorHandler == null) {
- return;
- }
-
- SAXParseException e;
- if (locator != null) {
- e = new SAXParseException(message, locator);
- } else {
- e = new SAXParseException(message, null, null, -1, -1);
- }
- errorHandler.error(e);
- }
-
-
- /**
- * Throw an exception if we are parsing.
- *
- * <p>Use this method to detect illegal feature or
- * property changes.</p>
- *
- * @param type The type of thing (feature or property).
- * @param name The feature or property name.
- * @exception org.xml.sax.SAXNotSupportedException If a
- * document is currently being parsed.
- */
- private void checkNotParsing (String type, String name)
- throws SAXNotSupportedException
- {
- if (parsing) {
- throw new SAXNotSupportedException("Cannot change " +
- type + ' ' +
- name + " while parsing");
-
- }
- }
-
-
-
- ////////////////////////////////////////////////////////////////////
- // Internal state.
- ////////////////////////////////////////////////////////////////////
-
- private NamespaceSupport nsSupport;
- private AttributeListAdapter attAdapter;
-
- private boolean parsing = false;
- private String nameParts[] = new String[3];
-
- private Parser parser = null;
-
- private AttributesImpl atts = null;
-
- // Features
- private boolean namespaces = true;
- private boolean prefixes = false;
-
- // Properties
-
- // Handlers
- Locator locator;
-
- EntityResolver entityResolver = null;
- DTDHandler dtdHandler = null;
- ContentHandler contentHandler = null;
- ErrorHandler errorHandler = null;
-
-
-
- ////////////////////////////////////////////////////////////////////
- // Inner class to wrap an AttributeList when not doing NS proc.
- ////////////////////////////////////////////////////////////////////
-
-
- /**
- * Adapt a SAX1 AttributeList as a SAX2 Attributes object.
- *
- * <p>This class is in the Public Domain, and comes with NO
- * WARRANTY of any kind.</p>
- *
- * <p>This wrapper class is used only when Namespace support
- * is disabled -- it provides pretty much a direct mapping
- * from SAX1 to SAX2, except that names and types are
- * interned whenever requested.</p>
- */
- final class AttributeListAdapter implements Attributes
- {
-
- /**
- * Construct a new adapter.
- */
- AttributeListAdapter ()
- {
- }
-
-
- /**
- * Set the embedded AttributeList.
- *
- * <p>This method must be invoked before any of the others
- * can be used.</p>
- *
- * @param The SAX1 attribute list (with qnames).
- */
- void setAttributeList (AttributeList qAtts)
- {
- this.qAtts = qAtts;
- }
-
-
- /**
- * Return the length of the attribute list.
- *
- * @return The number of attributes in the list.
- * @see org.xml.sax.Attributes#getLength
- */
- public int getLength ()
- {
- return qAtts.getLength();
- }
-
-
- /**
- * Return the Namespace URI of the specified attribute.
- *
- * @param The attribute's index.
- * @return Always the empty string.
- * @see org.xml.sax.Attributes#getURI
- */
- public String getURI (int i)
- {
- return "";
- }
-
-
- /**
- * Return the local name of the specified attribute.
- *
- * @param The attribute's index.
- * @return Always the empty string.
- * @see org.xml.sax.Attributes#getLocalName
- */
- public String getLocalName (int i)
- {
- return "";
- }
-
-
- /**
- * Return the qualified (prefixed) name of the specified attribute.
- *
- * @param The attribute's index.
- * @return The attribute's qualified name, internalized.
- */
- public String getQName (int i)
- {
- return qAtts.getName(i).intern();
- }
-
-
- /**
- * Return the type of the specified attribute.
- *
- * @param The attribute's index.
- * @return The attribute's type as an internalized string.
- */
- public String getType (int i)
- {
- return qAtts.getType(i).intern();
- }
-
-
- /**
- * Return the value of the specified attribute.
- *
- * @param The attribute's index.
- * @return The attribute's value.
- */
- public String getValue (int i)
- {
- return qAtts.getValue(i);
- }
-
-
- /**
- * Look up an attribute index by Namespace name.
- *
- * @param uri The Namespace URI or the empty string.
- * @param localName The local name.
- * @return The attributes index, or -1 if none was found.
- * @see org.xml.sax.Attributes#getIndex(java.lang.String,java.lang.String)
- */
- public int getIndex (String uri, String localName)
- {
- return -1;
- }
-
-
- /**
- * Look up an attribute index by qualified (prefixed) name.
- *
- * @param qName The qualified name.
- * @return The attributes index, or -1 if none was found.
- * @see org.xml.sax.Attributes#getIndex(java.lang.String)
- */
- public int getIndex (String qName)
- {
- int max = atts.getLength();
- for (int i = 0; i < max; i++) {
- if (qAtts.getName(i).equals(qName)) {
- return i;
- }
- }
- return -1;
- }
-
-
- /**
- * Look up the type of an attribute by Namespace name.
- *
- * @param uri The Namespace URI
- * @param localName The local name.
- * @return The attribute's type as an internalized string.
- */
- public String getType (String uri, String localName)
- {
- return null;
- }
-
-
- /**
- * Look up the type of an attribute by qualified (prefixed) name.
- *
- * @param qName The qualified name.
- * @return The attribute's type as an internalized string.
- */
- public String getType (String qName)
- {
- return qAtts.getType(qName).intern();
- }
-
-
- /**
- * Look up the value of an attribute by Namespace name.
- *
- * @param uri The Namespace URI
- * @param localName The local name.
- * @return The attribute's value.
- */
- public String getValue (String uri, String localName)
- {
- return null;
- }
-
-
- /**
- * Look up the value of an attribute by qualified (prefixed) name.
- *
- * @param qName The qualified name.
- * @return The attribute's value.
- */
- public String getValue (String qName)
- {
- return qAtts.getValue(qName);
- }
-
- private AttributeList qAtts;
- }
-}
-
-// end of ParserAdapter.java
+// ParserAdapter.java - adapt a SAX1 Parser to a SAX2 XMLReader.
+// http://www.saxproject.org
+// Written by David Megginson
+// NO WARRANTY! This class is in the public domain.
+
+// $Id: ParserAdapter.java,v 1.8.2.4 2002/01/29 21:34:14 dbrownell Exp $
+
+package org.xml.sax.helpers;
+
+import java.io.IOException;
+import java.util.Enumeration;
+import java.util.Vector;
+
+import org.xml.sax.Parser; // deprecated
+import org.xml.sax.InputSource;
+import org.xml.sax.Locator;
+import org.xml.sax.AttributeList; // deprecated
+import org.xml.sax.EntityResolver;
+import org.xml.sax.DTDHandler;
+import org.xml.sax.DocumentHandler; // deprecated
+import org.xml.sax.ErrorHandler;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXParseException;
+
+import org.xml.sax.XMLReader;
+import org.xml.sax.Attributes;
+import org.xml.sax.ContentHandler;
+import org.xml.sax.SAXNotRecognizedException;
+import org.xml.sax.SAXNotSupportedException;
+
+
+/**
+ * Adapt a SAX1 Parser as a SAX2 XMLReader.
+ *
+ * <blockquote>
+ * <em>This module, both source code and documentation, is in the
+ * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
+ * See <a href='http://www.saxproject.org'>http://www.saxproject.org</a>
+ * for further information.
+ * </blockquote>
+ *
+ * <p>This class wraps a SAX1 {@link org.xml.sax.Parser Parser}
+ * and makes it act as a SAX2 {@link org.xml.sax.XMLReader XMLReader},
+ * with feature, property, and Namespace support. Note
+ * that it is not possible to report {@link org.xml.sax.ContentHandler#skippedEntity
+ * skippedEntity} events, since SAX1 does not make that information available.</p>
+ *
+ * <p>This adapter does not test for duplicate Namespace-qualified
+ * attribute names.</p>
+ *
+ * @since SAX 2.0
+ * @author David Megginson
+ * @version 2.0.1 (sax2r2)
+ * @see org.xml.sax.helpers.XMLReaderAdapter
+ * @see org.xml.sax.XMLReader
+ * @see org.xml.sax.Parser
+ */
+public class ParserAdapter implements XMLReader, DocumentHandler
+{
+
+
+ ////////////////////////////////////////////////////////////////////
+ // Constructors.
+ ////////////////////////////////////////////////////////////////////
+
+
+ /**
+ * Construct a new parser adapter.
+ *
+ * <p>Use the "org.xml.sax.parser" property to locate the
+ * embedded SAX1 driver.</p>
+ *
+ * @exception SAXException If the embedded driver
+ * cannot be instantiated or if the
+ * org.xml.sax.parser property is not specified.
+ */
+ public ParserAdapter ()
+ throws SAXException
+ {
+ super();
+
+ String driver = System.getProperty("org.xml.sax.parser");
+
+ try {
+ setup(ParserFactory.makeParser());
+ } catch (ClassNotFoundException e1) {
+ throw new
+ SAXException("Cannot find SAX1 driver class " +
+ driver, e1);
+ } catch (IllegalAccessException e2) {
+ throw new
+ SAXException("SAX1 driver class " +
+ driver +
+ " found but cannot be loaded", e2);
+ } catch (InstantiationException e3) {
+ throw new
+ SAXException("SAX1 driver class " +
+ driver +
+ " loaded but cannot be instantiated", e3);
+ } catch (ClassCastException e4) {
+ throw new
+ SAXException("SAX1 driver class " +
+ driver +
+ " does not implement org.xml.sax.Parser");
+ } catch (NullPointerException e5) {
+ throw new
+ SAXException("System property org.xml.sax.parser not specified");
+ }
+ }
+
+
+ /**
+ * Construct a new parser adapter.
+ *
+ * <p>Note that the embedded parser cannot be changed once the
+ * adapter is created; to embed a different parser, allocate
+ * a new ParserAdapter.</p>
+ *
+ * @param parser The SAX1 parser to embed.
+ * @exception java.lang.NullPointerException If the parser parameter
+ * is null.
+ */
+ public ParserAdapter (Parser parser)
+ {
+ super();
+ setup(parser);
+ }
+
+
+ /**
+ * Internal setup method.
+ *
+ * @param parser The embedded parser.
+ * @exception java.lang.NullPointerException If the parser parameter
+ * is null.
+ */
+ private void setup (Parser parser)
+ {
+ if (parser == null) {
+ throw new
+ NullPointerException("Parser argument must not be null");
+ }
+ this.parser = parser;
+ atts = new AttributesImpl();
+ nsSupport = new NamespaceSupport();
+ attAdapter = new AttributeListAdapter();
+ }
+
+
+
+ ////////////////////////////////////////////////////////////////////
+ // Implementation of org.xml.sax.XMLReader.
+ ////////////////////////////////////////////////////////////////////
+
+
+ //
+ // Internal constants for the sake of convenience.
+ //
+ private final static String FEATURES = "http://xml.org/sax/features/";
+ private final static String NAMESPACES = FEATURES + "namespaces";
+ private final static String NAMESPACE_PREFIXES = FEATURES + "namespace-prefixes";
+
+
+ /**
+ * Set a feature flag for the parser.
+ *
+ * <p>The only features recognized are namespaces and
+ * namespace-prefixes.</p>
+ *
+ * @param name The feature name, as a complete URI.
+ * @param value The requested feature value.
+ * @exception SAXNotRecognizedException If the feature
+ * can't be assigned or retrieved.
+ * @exception SAXNotSupportedException If the feature
+ * can't be assigned that value.
+ * @see org.xml.sax.XMLReader#setFeature
+ */
+ public void setFeature (String name, boolean value)
+ throws SAXNotRecognizedException, SAXNotSupportedException
+ {
+ if (name.equals(NAMESPACES)) {
+ checkNotParsing("feature", name);
+ namespaces = value;
+ if (!namespaces && !prefixes) {
+ prefixes = true;
+ }
+ } else if (name.equals(NAMESPACE_PREFIXES)) {
+ checkNotParsing("feature", name);
+ prefixes = value;
+ if (!prefixes && !namespaces) {
+ namespaces = true;
+ }
+ } else {
+ throw new SAXNotRecognizedException("Feature: " + name);
+ }
+ }
+
+
+ /**
+ * Check a parser feature flag.
+ *
+ * <p>The only features recognized are namespaces and
+ * namespace-prefixes.</p>
+ *
+ * @param name The feature name, as a complete URI.
+ * @return The current feature value.
+ * @exception SAXNotRecognizedException If the feature
+ * value can't be assigned or retrieved.
+ * @exception SAXNotSupportedException If the
+ * feature is not currently readable.
+ * @see org.xml.sax.XMLReader#setFeature
+ */
+ public boolean getFeature (String name)
+ throws SAXNotRecognizedException, SAXNotSupportedException
+ {
+ if (name.equals(NAMESPACES)) {
+ return namespaces;
+ } else if (name.equals(NAMESPACE_PREFIXES)) {
+ return prefixes;
+ } else {
+ throw new SAXNotRecognizedException("Feature: " + name);
+ }
+ }
+
+
+ /**
+ * Set a parser property.
+ *
+ * <p>No properties are currently recognized.</p>
+ *
+ * @param name The property name.
+ * @param value The property value.
+ * @exception SAXNotRecognizedException If the property
+ * value can't be assigned or retrieved.
+ * @exception SAXNotSupportedException If the property
+ * can't be assigned that value.
+ * @see org.xml.sax.XMLReader#setProperty
+ */
+ public void setProperty (String name, Object value)
+ throws SAXNotRecognizedException, SAXNotSupportedException
+ {
+ throw new SAXNotRecognizedException("Property: " + name);
+ }
+
+
+ /**
+ * Get a parser property.
+ *
+ * <p>No properties are currently recognized.</p>
+ *
+ * @param name The property name.
+ * @return The property value.
+ * @exception SAXNotRecognizedException If the property
+ * value can't be assigned or retrieved.
+ * @exception SAXNotSupportedException If the property
+ * value is not currently readable.
+ * @see org.xml.sax.XMLReader#getProperty
+ */
+ public Object getProperty (String name)
+ throws SAXNotRecognizedException, SAXNotSupportedException
+ {
+ throw new SAXNotRecognizedException("Property: " + name);
+ }
+
+
+ /**
+ * Set the entity resolver.
+ *
+ * @param resolver The new entity resolver.
+ * @see org.xml.sax.XMLReader#setEntityResolver
+ */
+ public void setEntityResolver (EntityResolver resolver)
+ {
+ entityResolver = resolver;
+ }
+
+
+ /**
+ * Return the current entity resolver.
+ *
+ * @return The current entity resolver, or null if none was supplied.
+ * @see org.xml.sax.XMLReader#getEntityResolver
+ */
+ public EntityResolver getEntityResolver ()
+ {
+ return entityResolver;
+ }
+
+
+ /**
+ * Set the DTD handler.
+ *
+ * @param resolver The new DTD handler.
+ * @see org.xml.sax.XMLReader#setEntityResolver
+ */
+ public void setDTDHandler (DTDHandler handler)
+ {
+ dtdHandler = handler;
+ }
+
+
+ /**
+ * Return the current DTD handler.
+ *
+ * @return The current DTD handler, or null if none was supplied.
+ * @see org.xml.sax.XMLReader#getEntityResolver
+ */
+ public DTDHandler getDTDHandler ()
+ {
+ return dtdHandler;
+ }
+
+
+ /**
+ * Set the content handler.
+ *
+ * @param resolver The new content handler.
+ * @see org.xml.sax.XMLReader#setEntityResolver
+ */
+ public void setContentHandler (ContentHandler handler)
+ {
+ contentHandler = handler;
+ }
+
+
+ /**
+ * Return the current content handler.
+ *
+ * @return The current content handler, or null if none was supplied.
+ * @see org.xml.sax.XMLReader#getEntityResolver
+ */
+ public ContentHandler getContentHandler ()
+ {
+ return contentHandler;
+ }
+
+
+ /**
+ * Set the error handler.
+ *
+ * @param resolver The new error handler.
+ * @see org.xml.sax.XMLReader#setEntityResolver
+ */
+ public void setErrorHandler (ErrorHandler handler)
+ {
+ errorHandler = handler;
+ }
+
+
+ /**
+ * Return the current error handler.
+ *
+ * @return The current error handler, or null if none was supplied.
+ * @see org.xml.sax.XMLReader#getEntityResolver
+ */
+ public ErrorHandler getErrorHandler ()
+ {
+ return errorHandler;
+ }
+
+
+ /**
+ * Parse an XML document.
+ *
+ * @param systemId The absolute URL of the document.
+ * @exception java.io.IOException If there is a problem reading
+ * the raw content of the document.
+ * @exception SAXException If there is a problem
+ * processing the document.
+ * @see #parse(org.xml.sax.InputSource)
+ * @see org.xml.sax.Parser#parse(java.lang.String)
+ */
+ public void parse (String systemId)
+ throws IOException, SAXException
+ {
+ parse(new InputSource(systemId));
+ }
+
+
+ /**
+ * Parse an XML document.
+ *
+ * @param input An input source for the document.
+ * @exception java.io.IOException If there is a problem reading
+ * the raw content of the document.
+ * @exception SAXException If there is a problem
+ * processing the document.
+ * @see #parse(java.lang.String)
+ * @see org.xml.sax.Parser#parse(org.xml.sax.InputSource)
+ */
+ public void parse (InputSource input)
+ throws IOException, SAXException
+ {
+ if (parsing) {
+ throw new SAXException("Parser is already in use");
+ }
+ setupParser();
+ parsing = true;
+ try {
+ parser.parse(input);
+ } finally {
+ parsing = false;
+ }
+ parsing = false;
+ }
+
+
+
+ ////////////////////////////////////////////////////////////////////
+ // Implementation of org.xml.sax.DocumentHandler.
+ ////////////////////////////////////////////////////////////////////
+
+
+ /**
+ * Adapter implementation method; do not call.
+ * Adapt a SAX1 document locator event.
+ *
+ * @param locator A document locator.
+ * @see org.xml.sax.ContentHandler#setDocumentLocator
+ */
+ public void setDocumentLocator (Locator locator)
+ {
+ this.locator = locator;
+ if (contentHandler != null) {
+ contentHandler.setDocumentLocator(locator);
+ }
+ }
+
+
+ /**
+ * Adapter implementation method; do not call.
+ * Adapt a SAX1 start document event.
+ *
+ * @exception SAXException The client may raise a
+ * processing exception.
+ * @see org.xml.sax.DocumentHandler#startDocument
+ */
+ public void startDocument ()
+ throws SAXException
+ {
+ if (contentHandler != null) {
+ contentHandler.startDocument();
+ }
+ }
+
+
+ /**
+ * Adapter implementation method; do not call.
+ * Adapt a SAX1 end document event.
+ *
+ * @exception SAXException The client may raise a
+ * processing exception.
+ * @see org.xml.sax.DocumentHandler#endDocument
+ */
+ public void endDocument ()
+ throws SAXException
+ {
+ if (contentHandler != null) {
+ contentHandler.endDocument();
+ }
+ }
+
+
+ /**
+ * Adapter implementation method; do not call.
+ * Adapt a SAX1 startElement event.
+ *
+ * <p>If necessary, perform Namespace processing.</p>
+ *
+ * @param qName The qualified (prefixed) name.
+ * @param qAtts The XML 1.0 attribute list (with qnames).
+ * @exception SAXException The client may raise a
+ * processing exception.
+ */
+ public void startElement (String qName, AttributeList qAtts)
+ throws SAXException
+ {
+ // These are exceptions from the
+ // first pass; they should be
+ // ignored if there's a second pass,
+ // but reported otherwise.
+ Vector exceptions = null;
+
+ // If we're not doing Namespace
+ // processing, dispatch this quickly.
+ if (!namespaces) {
+ if (contentHandler != null) {
+ attAdapter.setAttributeList(qAtts);
+ contentHandler.startElement("", "", qName.intern(),
+ attAdapter);
+ }
+ return;
+ }
+
+
+ // OK, we're doing Namespace processing.
+ nsSupport.pushContext();
+ int length = qAtts.getLength();
+
+ // First pass: handle NS decls
+ for (int i = 0; i < length; i++) {
+ String attQName = qAtts.getName(i);
+
+ if (!attQName.startsWith("xmlns"))
+ continue;
+ // Could be a declaration...
+ String prefix;
+ int n = attQName.indexOf(':');
+
+ // xmlns=...
+ if (n == -1 && attQName.length () == 5) {
+ prefix = "";
+ } else if (n != 5) {
+ // XML namespaces spec doesn't discuss "xmlnsf:oo"
+ // (and similarly named) attributes ... at most, warn
+ continue;
+ } else // xmlns:foo=...
+ prefix = attQName.substring(n+1);
+
+ String value = qAtts.getValue(i);
+ if (!nsSupport.declarePrefix(prefix, value)) {
+ reportError("Illegal Namespace prefix: " + prefix);
+ continue;
+ }
+ if (contentHandler != null)
+ contentHandler.startPrefixMapping(prefix, value);
+ }
+
+ // Second pass: copy all relevant
+ // attributes into the SAX2 AttributeList
+ // using updated prefix bindings
+ atts.clear();
+ for (int i = 0; i < length; i++) {
+ String attQName = qAtts.getName(i);
+ String type = qAtts.getType(i);
+ String value = qAtts.getValue(i);
+
+ // Declaration?
+ if (attQName.startsWith("xmlns")) {
+ String prefix;
+ int n = attQName.indexOf(':');
+
+ if (n == -1 && attQName.length () == 5) {
+ prefix = "";
+ } else if (n != 5) {
+ // XML namespaces spec doesn't discuss "xmlnsf:oo"
+ // (and similarly named) attributes ... ignore
+ prefix = null;
+ } else {
+ prefix = attQName.substring(n+1);
+ }
+ // Yes, decl: report or prune
+ if (prefix != null) {
+ if (prefixes)
+ atts.addAttribute("", "", attQName.intern(),
+ type, value);
+ continue;
+ }
+ }
+
+ // Not a declaration -- report
+ try {
+ String attName[] = processName(attQName, true, true);
+ atts.addAttribute(attName[0], attName[1], attName[2],
+ type, value);
+ } catch (SAXException e) {
+ if (exceptions == null)
+ exceptions = new Vector();
+ exceptions.addElement(e);
+ atts.addAttribute("", attQName, attQName, type, value);
+ }
+ }
+
+ // now handle the deferred exception reports
+ if (exceptions != null && errorHandler != null) {
+ for (int i = 0; i < exceptions.size(); i++)
+ errorHandler.error((SAXParseException)
+ (exceptions.elementAt(i)));
+ }
+
+ // OK, finally report the event.
+ if (contentHandler != null) {
+ String name[] = processName(qName, false, false);
+ contentHandler.startElement(name[0], name[1], name[2], atts);
+ }
+ }
+
+
+ /**
+ * Adapter implementation method; do not call.
+ * Adapt a SAX1 end element event.
+ *
+ * @param qName The qualified (prefixed) name.
+ * @exception SAXException The client may raise a
+ * processing exception.
+ * @see org.xml.sax.DocumentHandler#endElement
+ */
+ public void endElement (String qName)
+ throws SAXException
+ {
+ // If we're not doing Namespace
+ // processing, dispatch this quickly.
+ if (!namespaces) {
+ if (contentHandler != null) {
+ contentHandler.endElement("", "", qName.intern());
+ }
+ return;
+ }
+
+ // Split the name.
+ String names[] = processName(qName, false, false);
+ if (contentHandler != null) {
+ contentHandler.endElement(names[0], names[1], names[2]);
+ Enumeration prefixes = nsSupport.getDeclaredPrefixes();
+ while (prefixes.hasMoreElements()) {
+ String prefix = (String)prefixes.nextElement();
+ contentHandler.endPrefixMapping(prefix);
+ }
+ }
+ nsSupport.popContext();
+ }
+
+
+ /**
+ * Adapter implementation method; do not call.
+ * Adapt a SAX1 characters event.
+ *
+ * @param ch An array of characters.
+ * @param start The starting position in the array.
+ * @param length The number of characters to use.
+ * @exception SAXException The client may raise a
+ * processing exception.
+ * @see org.xml.sax.DocumentHandler#characters
+ */
+ public void characters (char ch[], int start, int length)
+ throws SAXException
+ {
+ if (contentHandler != null) {
+ contentHandler.characters(ch, start, length);
+ }
+ }
+
+
+ /**
+ * Adapter implementation method; do not call.
+ * Adapt a SAX1 ignorable whitespace event.
+ *
+ * @param ch An array of characters.
+ * @param start The starting position in the array.
+ * @param length The number of characters to use.
+ * @exception SAXException The client may raise a
+ * processing exception.
+ * @see org.xml.sax.DocumentHandler#ignorableWhitespace
+ */
+ public void ignorableWhitespace (char ch[], int start, int length)
+ throws SAXException
+ {
+ if (contentHandler != null) {
+ contentHandler.ignorableWhitespace(ch, start, length);
+ }
+ }
+
+
+ /**
+ * Adapter implementation method; do not call.
+ * Adapt a SAX1 processing instruction event.
+ *
+ * @param target The processing instruction target.
+ * @param data The remainder of the processing instruction
+ * @exception SAXException The client may raise a
+ * processing exception.
+ * @see org.xml.sax.DocumentHandler#processingInstruction
+ */
+ public void processingInstruction (String target, String data)
+ throws SAXException
+ {
+ if (contentHandler != null) {
+ contentHandler.processingInstruction(target, data);
+ }
+ }
+
+
+
+ ////////////////////////////////////////////////////////////////////
+ // Internal utility methods.
+ ////////////////////////////////////////////////////////////////////
+
+
+ /**
+ * Initialize the parser before each run.
+ */
+ private void setupParser ()
+ {
+ nsSupport.reset();
+
+ if (entityResolver != null) {
+ parser.setEntityResolver(entityResolver);
+ }
+ if (dtdHandler != null) {
+ parser.setDTDHandler(dtdHandler);
+ }
+ if (errorHandler != null) {
+ parser.setErrorHandler(errorHandler);
+ }
+ parser.setDocumentHandler(this);
+ locator = null;
+ }
+
+
+ /**
+ * Process a qualified (prefixed) name.
+ *
+ * <p>If the name has an undeclared prefix, use only the qname
+ * and make an ErrorHandler.error callback in case the app is
+ * interested.</p>
+ *
+ * @param qName The qualified (prefixed) name.
+ * @param isAttribute true if this is an attribute name.
+ * @return The name split into three parts.
+ * @exception SAXException The client may throw
+ * an exception if there is an error callback.
+ */
+ private String [] processName (String qName, boolean isAttribute,
+ boolean useException)
+ throws SAXException
+ {
+ String parts[] = nsSupport.processName(qName, nameParts,
+ isAttribute);
+ if (parts == null) {
+ if (useException)
+ throw makeException("Undeclared prefix: " + qName);
+ reportError("Undeclared prefix: " + qName);
+ parts = new String[3];
+ parts[0] = parts[1] = "";
+ parts[2] = qName.intern();
+ }
+ return parts;
+ }
+
+
+ /**
+ * Report a non-fatal error.
+ *
+ * @param message The error message.
+ * @exception SAXException The client may throw
+ * an exception.
+ */
+ void reportError (String message)
+ throws SAXException
+ {
+ if (errorHandler != null)
+ errorHandler.error(makeException(message));
+ }
+
+
+ /**
+ * Construct an exception for the current context.
+ *
+ * @param message The error message.
+ */
+ private SAXParseException makeException (String message)
+ {
+ if (locator != null) {
+ return new SAXParseException(message, locator);
+ } else {
+ return new SAXParseException(message, null, null, -1, -1);
+ }
+ }
+
+
+ /**
+ * Throw an exception if we are parsing.
+ *
+ * <p>Use this method to detect illegal feature or
+ * property changes.</p>
+ *
+ * @param type The type of thing (feature or property).
+ * @param name The feature or property name.
+ * @exception SAXNotSupportedException If a
+ * document is currently being parsed.
+ */
+ private void checkNotParsing (String type, String name)
+ throws SAXNotSupportedException
+ {
+ if (parsing) {
+ throw new SAXNotSupportedException("Cannot change " +
+ type + ' ' +
+ name + " while parsing");
+
+ }
+ }
+
+
+
+ ////////////////////////////////////////////////////////////////////
+ // Internal state.
+ ////////////////////////////////////////////////////////////////////
+
+ private NamespaceSupport nsSupport;
+ private AttributeListAdapter attAdapter;
+
+ private boolean parsing = false;
+ private String nameParts[] = new String[3];
+
+ private Parser parser = null;
+
+ private AttributesImpl atts = null;
+
+ // Features
+ private boolean namespaces = true;
+ private boolean prefixes = false;
+
+ // Properties
+
+ // Handlers
+ Locator locator;
+
+ EntityResolver entityResolver = null;
+ DTDHandler dtdHandler = null;
+ ContentHandler contentHandler = null;
+ ErrorHandler errorHandler = null;
+
+
+
+ ////////////////////////////////////////////////////////////////////
+ // Inner class to wrap an AttributeList when not doing NS proc.
+ ////////////////////////////////////////////////////////////////////
+
+
+ /**
+ * Adapt a SAX1 AttributeList as a SAX2 Attributes object.
+ *
+ * <p>This class is in the Public Domain, and comes with NO
+ * WARRANTY of any kind.</p>
+ *
+ * <p>This wrapper class is used only when Namespace support
+ * is disabled -- it provides pretty much a direct mapping
+ * from SAX1 to SAX2, except that names and types are
+ * interned whenever requested.</p>
+ */
+ final class AttributeListAdapter implements Attributes
+ {
+
+ /**
+ * Construct a new adapter.
+ */
+ AttributeListAdapter ()
+ {
+ }
+
+
+ /**
+ * Set the embedded AttributeList.
+ *
+ * <p>This method must be invoked before any of the others
+ * can be used.</p>
+ *
+ * @param The SAX1 attribute list (with qnames).
+ */
+ void setAttributeList (AttributeList qAtts)
+ {
+ this.qAtts = qAtts;
+ }
+
+
+ /**
+ * Return the length of the attribute list.
+ *
+ * @return The number of attributes in the list.
+ * @see org.xml.sax.Attributes#getLength
+ */
+ public int getLength ()
+ {
+ return qAtts.getLength();
+ }
+
+
+ /**
+ * Return the Namespace URI of the specified attribute.
+ *
+ * @param The attribute's index.
+ * @return Always the empty string.
+ * @see org.xml.sax.Attributes#getURI
+ */
+ public String getURI (int i)
+ {
+ return "";
+ }
+
+
+ /**
+ * Return the local name of the specified attribute.
+ *
+ * @param The attribute's index.
+ * @return Always the empty string.
+ * @see org.xml.sax.Attributes#getLocalName
+ */
+ public String getLocalName (int i)
+ {
+ return "";
+ }
+
+
+ /**
+ * Return the qualified (prefixed) name of the specified attribute.
+ *
+ * @param The attribute's index.
+ * @return The attribute's qualified name, internalized.
+ */
+ public String getQName (int i)
+ {
+ return qAtts.getName(i).intern();
+ }
+
+
+ /**
+ * Return the type of the specified attribute.
+ *
+ * @param The attribute's index.
+ * @return The attribute's type as an internalized string.
+ */
+ public String getType (int i)
+ {
+ return qAtts.getType(i).intern();
+ }
+
+
+ /**
+ * Return the value of the specified attribute.
+ *
+ * @param The attribute's index.
+ * @return The attribute's value.
+ */
+ public String getValue (int i)
+ {
+ return qAtts.getValue(i);
+ }
+
+
+ /**
+ * Look up an attribute index by Namespace name.
+ *
+ * @param uri The Namespace URI or the empty string.
+ * @param localName The local name.
+ * @return The attributes index, or -1 if none was found.
+ * @see org.xml.sax.Attributes#getIndex(java.lang.String,java.lang.String)
+ */
+ public int getIndex (String uri, String localName)
+ {
+ return -1;
+ }
+
+
+ /**
+ * Look up an attribute index by qualified (prefixed) name.
+ *
+ * @param qName The qualified name.
+ * @return The attributes index, or -1 if none was found.
+ * @see org.xml.sax.Attributes#getIndex(java.lang.String)
+ */
+ public int getIndex (String qName)
+ {
+ int max = atts.getLength();
+ for (int i = 0; i < max; i++) {
+ if (qAtts.getName(i).equals(qName)) {
+ return i;
+ }
+ }
+ return -1;
+ }
+
+
+ /**
+ * Look up the type of an attribute by Namespace name.
+ *
+ * @param uri The Namespace URI
+ * @param localName The local name.
+ * @return The attribute's type as an internalized string.
+ */
+ public String getType (String uri, String localName)
+ {
+ return null;
+ }
+
+
+ /**
+ * Look up the type of an attribute by qualified (prefixed) name.
+ *
+ * @param qName The qualified name.
+ * @return The attribute's type as an internalized string.
+ */
+ public String getType (String qName)
+ {
+ return qAtts.getType(qName).intern();
+ }
+
+
+ /**
+ * Look up the value of an attribute by Namespace name.
+ *
+ * @param uri The Namespace URI
+ * @param localName The local name.
+ * @return The attribute's value.
+ */
+ public String getValue (String uri, String localName)
+ {
+ return null;
+ }
+
+
+ /**
+ * Look up the value of an attribute by qualified (prefixed) name.
+ *
+ * @param qName The qualified name.
+ * @return The attribute's value.
+ */
+ public String getValue (String qName)
+ {
+ return qAtts.getValue(qName);
+ }
+
+ private AttributeList qAtts;
+ }
+}
+
+// end of ParserAdapter.java
diff --git a/libjava/org/xml/sax/helpers/ParserFactory.java b/libjava/org/xml/sax/helpers/ParserFactory.java
index 9ca7b55002f..acedfd13ae4 100644
--- a/libjava/org/xml/sax/helpers/ParserFactory.java
+++ b/libjava/org/xml/sax/helpers/ParserFactory.java
@@ -1,129 +1,129 @@
-// SAX parser factory.
-// No warranty; no copyright -- use this as you will.
-// $Id: ParserFactory.java,v 1.1 2000/10/02 02:43:20 sboag Exp $
-
-package org.xml.sax.helpers;
-
-import java.lang.ClassNotFoundException;
-import java.lang.IllegalAccessException;
-import java.lang.InstantiationException;
-import java.lang.SecurityException;
-import java.lang.ClassCastException;
-
-import org.xml.sax.Parser;
-
-
-/**
- * Java-specific class for dynamically loading SAX parsers.
- *
- * <blockquote>
- * <em>This module, both source code and documentation, is in the
- * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
- * </blockquote>
- *
- * <p><strong>Note:</strong> This class is designed to work with the now-deprecated
- * SAX1 {@link org.xml.sax.Parser Parser} class. SAX2 applications should use
- * {@link org.xml.sax.helpers.XMLReaderFactory XMLReaderFactory} instead.</p>
- *
- * <p>ParserFactory is not part of the platform-independent definition
- * of SAX; it is an additional convenience class designed
- * specifically for Java XML application writers. SAX applications
- * can use the static methods in this class to allocate a SAX parser
- * dynamically at run-time based either on the value of the
- * `org.xml.sax.parser' system property or on a string containing the class
- * name.</p>
- *
- * <p>Note that the application still requires an XML parser that
- * implements SAX1.</p>
- *
- * @deprecated This class works with the deprecated
- * {@link org.xml.sax.Parser Parser}
- * interface.
- * @since SAX 1.0
- * @author David Megginson,
- * <a href="mailto:sax@megginson.com">sax@megginson.com</a>
- * @version 2.0
- * @see org.xml.sax.Parser
- * @see java.lang.Class
- */
-public class ParserFactory {
-
-
- /**
- * Private null constructor.
- */
- private ParserFactory ()
- {
- }
-
-
- /**
- * Create a new SAX parser using the `org.xml.sax.parser' system property.
- *
- * <p>The named class must exist and must implement the
- * {@link org.xml.sax.Parser Parser} interface.</p>
- *
- * @exception java.lang.NullPointerException There is no value
- * for the `org.xml.sax.parser' system property.
- * @exception java.lang.ClassNotFoundException The SAX parser
- * class was not found (check your CLASSPATH).
- * @exception IllegalAccessException The SAX parser class was
- * found, but you do not have permission to load
- * it.
- * @exception InstantiationException The SAX parser class was
- * found but could not be instantiated.
- * @exception java.lang.ClassCastException The SAX parser class
- * was found and instantiated, but does not implement
- * org.xml.sax.Parser.
- * @see #makeParser(java.lang.String)
- * @see org.xml.sax.Parser
- */
- public static Parser makeParser ()
- throws ClassNotFoundException,
- IllegalAccessException,
- InstantiationException,
- NullPointerException,
- ClassCastException
- {
- String className = System.getProperty("org.xml.sax.parser");
- if (className == null) {
- throw new NullPointerException("No value for sax.parser property");
- } else {
- return makeParser(className);
- }
- }
-
-
- /**
- * Create a new SAX parser object using the class name provided.
- *
- * <p>The named class must exist and must implement the
- * {@link org.xml.sax.Parser Parser} interface.</p>
- *
- * @param className A string containing the name of the
- * SAX parser class.
- * @exception java.lang.ClassNotFoundException The SAX parser
- * class was not found (check your CLASSPATH).
- * @exception IllegalAccessException The SAX parser class was
- * found, but you do not have permission to load
- * it.
- * @exception InstantiationException The SAX parser class was
- * found but could not be instantiated.
- * @exception java.lang.ClassCastException The SAX parser class
- * was found and instantiated, but does not implement
- * org.xml.sax.Parser.
- * @see #makeParser()
- * @see org.xml.sax.Parser
- */
- public static Parser makeParser (String className)
- throws ClassNotFoundException,
- IllegalAccessException,
- InstantiationException,
- ClassCastException
- {
- return (Parser)(Class.forName(className).newInstance());
- }
-
-}
-
-// end of ParserFactory.java
+// SAX parser factory.
+// http://www.saxproject.org
+// No warranty; no copyright -- use this as you will.
+// $Id: ParserFactory.java,v 1.4.2.3 2002/01/29 21:34:14 dbrownell Exp $
+
+package org.xml.sax.helpers;
+
+import java.lang.ClassNotFoundException;
+import java.lang.IllegalAccessException;
+import java.lang.InstantiationException;
+import java.lang.SecurityException;
+import java.lang.ClassCastException;
+
+import org.xml.sax.Parser;
+
+
+/**
+ * Java-specific class for dynamically loading SAX parsers.
+ *
+ * <blockquote>
+ * <em>This module, both source code and documentation, is in the
+ * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
+ * See <a href='http://www.saxproject.org'>http://www.saxproject.org</a>
+ * for further information.
+ * </blockquote>
+ *
+ * <p><strong>Note:</strong> This class is designed to work with the now-deprecated
+ * SAX1 {@link org.xml.sax.Parser Parser} class. SAX2 applications should use
+ * {@link org.xml.sax.helpers.XMLReaderFactory XMLReaderFactory} instead.</p>
+ *
+ * <p>ParserFactory is not part of the platform-independent definition
+ * of SAX; it is an additional convenience class designed
+ * specifically for Java XML application writers. SAX applications
+ * can use the static methods in this class to allocate a SAX parser
+ * dynamically at run-time based either on the value of the
+ * `org.xml.sax.parser' system property or on a string containing the class
+ * name.</p>
+ *
+ * <p>Note that the application still requires an XML parser that
+ * implements SAX1.</p>
+ *
+ * @deprecated This class works with the deprecated
+ * {@link org.xml.sax.Parser Parser}
+ * interface.
+ * @since SAX 1.0
+ * @author David Megginson
+ * @version 2.0.1 (sax2r2)
+ */
+public class ParserFactory {
+
+
+ /**
+ * Private null constructor.
+ */
+ private ParserFactory ()
+ {
+ }
+
+
+ /**
+ * Create a new SAX parser using the `org.xml.sax.parser' system property.
+ *
+ * <p>The named class must exist and must implement the
+ * {@link org.xml.sax.Parser Parser} interface.</p>
+ *
+ * @exception java.lang.NullPointerException There is no value
+ * for the `org.xml.sax.parser' system property.
+ * @exception java.lang.ClassNotFoundException The SAX parser
+ * class was not found (check your CLASSPATH).
+ * @exception IllegalAccessException The SAX parser class was
+ * found, but you do not have permission to load
+ * it.
+ * @exception InstantiationException The SAX parser class was
+ * found but could not be instantiated.
+ * @exception java.lang.ClassCastException The SAX parser class
+ * was found and instantiated, but does not implement
+ * org.xml.sax.Parser.
+ * @see #makeParser(java.lang.String)
+ * @see org.xml.sax.Parser
+ */
+ public static Parser makeParser ()
+ throws ClassNotFoundException,
+ IllegalAccessException,
+ InstantiationException,
+ NullPointerException,
+ ClassCastException
+ {
+ String className = System.getProperty("org.xml.sax.parser");
+ if (className == null) {
+ throw new NullPointerException("No value for sax.parser property");
+ } else {
+ return makeParser(className);
+ }
+ }
+
+
+ /**
+ * Create a new SAX parser object using the class name provided.
+ *
+ * <p>The named class must exist and must implement the
+ * {@link org.xml.sax.Parser Parser} interface.</p>
+ *
+ * @param className A string containing the name of the
+ * SAX parser class.
+ * @exception java.lang.ClassNotFoundException The SAX parser
+ * class was not found (check your CLASSPATH).
+ * @exception IllegalAccessException The SAX parser class was
+ * found, but you do not have permission to load
+ * it.
+ * @exception InstantiationException The SAX parser class was
+ * found but could not be instantiated.
+ * @exception java.lang.ClassCastException The SAX parser class
+ * was found and instantiated, but does not implement
+ * org.xml.sax.Parser.
+ * @see #makeParser()
+ * @see org.xml.sax.Parser
+ */
+ public static Parser makeParser (String className)
+ throws ClassNotFoundException,
+ IllegalAccessException,
+ InstantiationException,
+ ClassCastException
+ {
+ return (Parser) NewInstance.newInstance (
+ NewInstance.getClassLoader (), className);
+ }
+
+}
+
diff --git a/libjava/org/xml/sax/helpers/XMLFilterImpl.java b/libjava/org/xml/sax/helpers/XMLFilterImpl.java
index 5b1afaf6c2f..2f848089131 100644
--- a/libjava/org/xml/sax/helpers/XMLFilterImpl.java
+++ b/libjava/org/xml/sax/helpers/XMLFilterImpl.java
@@ -1,769 +1,714 @@
-// XMLFilterImpl.java - base SAX2 filter implementation.
-// Written by David Megginson, sax@megginson.com
-// NO WARRANTY! This class is in the Public Domain.
-
-// $Id: XMLFilterImpl.java,v 1.1 2000/10/02 02:43:20 sboag Exp $
-
-package org.xml.sax.helpers;
-
-import java.io.IOException;
-
-import org.xml.sax.XMLReader;
-import org.xml.sax.XMLFilter;
-import org.xml.sax.InputSource;
-import org.xml.sax.Locator;
-import org.xml.sax.Attributes;
-import org.xml.sax.EntityResolver;
-import org.xml.sax.DTDHandler;
-import org.xml.sax.ContentHandler;
-import org.xml.sax.ErrorHandler;
-import org.xml.sax.SAXException;
-import org.xml.sax.SAXParseException;
-import org.xml.sax.SAXNotSupportedException;
-import org.xml.sax.SAXNotRecognizedException;
-
-
-/**
- * Base class for deriving an XML filter.
- *
- * <blockquote>
- * <em>This module, both source code and documentation, is in the
- * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
- * </blockquote>
- *
- * <p>This class is designed to sit between an {@link org.xml.sax.XMLReader
- * XMLReader} and the client application's event handlers. By default, it
- * does nothing but pass requests up to the reader and events
- * on to the handlers unmodified, but subclasses can override
- * specific methods to modify the event stream or the configuration
- * requests as they pass through.</p>
- *
- * @since SAX 2.0
- * @author David Megginson,
- * <a href="mailto:sax@megginson.com">sax@megginson.com</a>
- * @version 2.0
- * @see org.xml.sax.XMLFilter
- * @see org.xml.sax.XMLReader
- * @see org.xml.sax.EntityResolver
- * @see org.xml.sax.DTDHandler
- * @see org.xml.sax.ContentHandler
- * @see org.xml.sax.ErrorHandler
- */
-public class XMLFilterImpl
- implements XMLFilter, EntityResolver, DTDHandler, ContentHandler, ErrorHandler
-{
-
-
- ////////////////////////////////////////////////////////////////////
- // Constructors.
- ////////////////////////////////////////////////////////////////////
-
-
- /**
- * Construct an empty XML filter, with no parent.
- *
- * <p>This filter will have no parent: you must assign a parent
- * before you start a parse or do any configuration with
- * setFeature or setProperty.</p>
- *
- * @see org.xml.sax.XMLReader#setFeature
- * @see org.xml.sax.XMLReader#setProperty
- */
- public XMLFilterImpl ()
- {
- super();
- }
-
-
- /**
- * Construct an XML filter with the specified parent.
- *
- * @see #setParent
- * @see #getParent
- */
- public XMLFilterImpl (XMLReader parent)
- {
- super();
- setParent(parent);
- }
-
-
-
- ////////////////////////////////////////////////////////////////////
- // Implementation of org.xml.sax.XMLFilter.
- ////////////////////////////////////////////////////////////////////
-
-
- /**
- * Set the parent reader.
- *
- * <p>This is the {@link org.xml.sax.XMLReader XMLReader} from which
- * this filter will obtain its events and to which it will pass its
- * configuration requests. The parent may itself be another filter.</p>
- *
- * <p>If there is no parent reader set, any attempt to parse
- * or to set or get a feature or property will fail.</p>
- *
- * @param parent The parent XML reader.
- * @exception java.lang.NullPointerException If the parent is null.
- * @see #getParent
- */
- public void setParent (XMLReader parent)
- {
- if (parent == null) {
- throw new NullPointerException("Null parent");
- }
- this.parent = parent;
- }
-
-
- /**
- * Get the parent reader.
- *
- * @return The parent XML reader, or null if none is set.
- * @see #setParent
- */
- public XMLReader getParent ()
- {
- return parent;
- }
-
-
-
- ////////////////////////////////////////////////////////////////////
- // Implementation of org.xml.sax.XMLReader.
- ////////////////////////////////////////////////////////////////////
-
-
- /**
- * Set the state of a feature.
- *
- * <p>This will always fail if the parent is null.</p>
- *
- * @param name The feature name.
- * @param state The requested feature state.
- * @exception org.xml.sax.SAXNotRecognizedException When the
- * XMLReader does not recognize the feature name.
- * @exception org.xml.sax.SAXNotSupportedException When the
- * XMLReader recognizes the feature name but
- * cannot set the requested value.
- * @see org.xml.sax.XMLReader#setFeature
- */
- public void setFeature (String name, boolean state)
- throws SAXNotRecognizedException, SAXNotSupportedException
- {
- if (parent != null) {
- parent.setFeature(name, state);
- } else {
- throw new SAXNotRecognizedException("Feature: " + name);
- }
- }
-
-
- /**
- * Look up the state of a feature.
- *
- * <p>This will always fail if the parent is null.</p>
- *
- * @param name The feature name.
- * @return The current state of the feature.
- * @exception org.xml.sax.SAXNotRecognizedException When the
- * XMLReader does not recognize the feature name.
- * @exception org.xml.sax.SAXNotSupportedException When the
- * XMLReader recognizes the feature name but
- * cannot determine its state at this time.
- * @see org.xml.sax.XMLReader#getFeature
- */
- public boolean getFeature (String name)
- throws SAXNotRecognizedException, SAXNotSupportedException
- {
- if (parent != null) {
- return parent.getFeature(name);
- } else {
- throw new SAXNotRecognizedException("Feature: " + name);
- }
- }
-
-
- /**
- * Set the value of a property.
- *
- * <p>This will always fail if the parent is null.</p>
- *
- * @param name The property name.
- * @param state The requested property value.
- * @exception org.xml.sax.SAXNotRecognizedException When the
- * XMLReader does not recognize the property name.
- * @exception org.xml.sax.SAXNotSupportedException When the
- * XMLReader recognizes the property name but
- * cannot set the requested value.
- * @see org.xml.sax.XMLReader#setProperty
- */
- public void setProperty (String name, Object value)
- throws SAXNotRecognizedException, SAXNotSupportedException
- {
- if (parent != null) {
- parent.setProperty(name, value);
- } else {
- throw new SAXNotRecognizedException("Property: " + name);
- }
- }
-
-
- /**
- * Look up the value of a property.
- *
- * @param name The property name.
- * @return The current value of the property.
- * @exception org.xml.sax.SAXNotRecognizedException When the
- * XMLReader does not recognize the feature name.
- * @exception org.xml.sax.SAXNotSupportedException When the
- * XMLReader recognizes the property name but
- * cannot determine its value at this time.
- * @see org.xml.sax.XMLReader#setFeature
- */
- public Object getProperty (String name)
- throws SAXNotRecognizedException, SAXNotSupportedException
- {
- if (parent != null) {
- return parent.getProperty(name);
- } else {
- throw new SAXNotRecognizedException("Property: " + name);
- }
- }
-
-
- /**
- * Set the entity resolver.
- *
- * @param resolver The new entity resolver.
- * @exception java.lang.NullPointerException If the resolver
- * is null.
- * @see org.xml.sax.XMLReader#setEntityResolver
- */
- public void setEntityResolver (EntityResolver resolver)
- {
- if (resolver == null) {
- throw new NullPointerException("Null entity resolver");
- } else {
- entityResolver = resolver;
- }
- }
-
-
- /**
- * Get the current entity resolver.
- *
- * @return The current entity resolver, or null if none was set.
- * @see org.xml.sax.XMLReader#getEntityResolver
- */
- public EntityResolver getEntityResolver ()
- {
- return entityResolver;
- }
-
-
- /**
- * Set the DTD event handler.
- *
- * @param resolver The new DTD handler.
- * @exception java.lang.NullPointerException If the handler
- * is null.
- * @see org.xml.sax.XMLReader#setDTDHandler
- */
- public void setDTDHandler (DTDHandler handler)
- {
- if (handler == null) {
- throw new NullPointerException("Null DTD handler");
- } else {
- dtdHandler = handler;
- }
- }
-
-
- /**
- * Get the current DTD event handler.
- *
- * @return The current DTD handler, or null if none was set.
- * @see org.xml.sax.XMLReader#getDTDHandler
- */
- public DTDHandler getDTDHandler ()
- {
- return dtdHandler;
- }
-
-
- /**
- * Set the content event handler.
- *
- * @param resolver The new content handler.
- * @exception java.lang.NullPointerException If the handler
- * is null.
- * @see org.xml.sax.XMLReader#setContentHandler
- */
- public void setContentHandler (ContentHandler handler)
- {
- if (handler == null) {
- throw new NullPointerException("Null content handler");
- } else {
- contentHandler = handler;
- }
- }
-
-
- /**
- * Get the content event handler.
- *
- * @return The current content handler, or null if none was set.
- * @see org.xml.sax.XMLReader#getContentHandler
- */
- public ContentHandler getContentHandler ()
- {
- return contentHandler;
- }
-
-
- /**
- * Set the error event handler.
- *
- * @param handle The new error handler.
- * @exception java.lang.NullPointerException If the handler
- * is null.
- * @see org.xml.sax.XMLReader#setErrorHandler
- */
- public void setErrorHandler (ErrorHandler handler)
- {
- if (handler == null) {
- throw new NullPointerException("Null error handler");
- } else {
- errorHandler = handler;
- }
- }
-
-
- /**
- * Get the current error event handler.
- *
- * @return The current error handler, or null if none was set.
- * @see org.xml.sax.XMLReader#getErrorHandler
- */
- public ErrorHandler getErrorHandler ()
- {
- return errorHandler;
- }
-
-
- /**
- * Parse a document.
- *
- * @param input The input source for the document entity.
- * @exception org.xml.sax.SAXException Any SAX exception, possibly
- * wrapping another exception.
- * @exception java.io.IOException An IO exception from the parser,
- * possibly from a byte stream or character stream
- * supplied by the application.
- * @see org.xml.sax.XMLReader#parse(org.xml.sax.InputSource)
- */
- public void parse (InputSource input)
- throws SAXException, IOException
- {
- setupParse();
- parent.parse(input);
- }
-
-
- /**
- * Parse a document.
- *
- * @param systemId The system identifier as a fully-qualified URI.
- * @exception org.xml.sax.SAXException Any SAX exception, possibly
- * wrapping another exception.
- * @exception java.io.IOException An IO exception from the parser,
- * possibly from a byte stream or character stream
- * supplied by the application.
- * @see org.xml.sax.XMLReader#parse(java.lang.String)
- */
- public void parse (String systemId)
- throws SAXException, IOException
- {
- parse(new InputSource(systemId));
- }
-
-
-
- ////////////////////////////////////////////////////////////////////
- // Implementation of org.xml.sax.EntityResolver.
- ////////////////////////////////////////////////////////////////////
-
-
- /**
- * Filter an external entity resolution.
- *
- * @param publicId The entity's public identifier, or null.
- * @param systemId The entity's system identifier.
- * @return A new InputSource or null for the default.
- * @exception org.xml.sax.SAXException The client may throw
- * an exception during processing.
- * @exception java.io.IOException The client may throw an
- * I/O-related exception while obtaining the
- * new InputSource.
- * @see org.xml.sax.EntityResolver#resolveEntity
- */
- public InputSource resolveEntity (String publicId, String systemId)
- throws SAXException, IOException
- {
- if (entityResolver != null) {
- return entityResolver.resolveEntity(publicId, systemId);
- } else {
- return null;
- }
- }
-
-
-
- ////////////////////////////////////////////////////////////////////
- // Implementation of org.xml.sax.DTDHandler.
- ////////////////////////////////////////////////////////////////////
-
-
- /**
- * Filter a notation declaration event.
- *
- * @param name The notation name.
- * @param publicId The notation's public identifier, or null.
- * @param systemId The notation's system identifier, or null.
- * @exception org.xml.sax.SAXException The client may throw
- * an exception during processing.
- * @see org.xml.sax.DTDHandler#notationDecl
- */
- public void notationDecl (String name, String publicId, String systemId)
- throws SAXException
- {
- if (dtdHandler != null) {
- dtdHandler.notationDecl(name, publicId, systemId);
- }
- }
-
-
- /**
- * Filter an unparsed entity declaration event.
- *
- * @param name The entity name.
- * @param publicId The entity's public identifier, or null.
- * @param systemId The entity's system identifier, or null.
- * @param notationName The name of the associated notation.
- * @exception org.xml.sax.SAXException The client may throw
- * an exception during processing.
- * @see org.xml.sax.DTDHandler#unparsedEntityDecl
- */
- public void unparsedEntityDecl (String name, String publicId,
- String systemId, String notationName)
- throws SAXException
- {
- if (dtdHandler != null) {
- dtdHandler.unparsedEntityDecl(name, publicId, systemId,
- notationName);
- }
- }
-
-
-
- ////////////////////////////////////////////////////////////////////
- // Implementation of org.xml.sax.ContentHandler.
- ////////////////////////////////////////////////////////////////////
-
-
- /**
- * Filter a new document locator event.
- *
- * @param locator The document locator.
- * @see org.xml.sax.ContentHandler#setDocumentLocator
- */
- public void setDocumentLocator (Locator locator)
- {
- this.locator = locator;
- if (contentHandler != null) {
- contentHandler.setDocumentLocator(locator);
- }
- }
-
-
- /**
- * Filter a start document event.
- *
- * @exception org.xml.sax.SAXException The client may throw
- * an exception during processing.
- * @see org.xml.sax.ContentHandler#startDocument
- */
- public void startDocument ()
- throws SAXException
- {
- if (contentHandler != null) {
- contentHandler.startDocument();
- }
- }
-
-
- /**
- * Filter an end document event.
- *
- * @exception org.xml.sax.SAXException The client may throw
- * an exception during processing.
- * @see org.xml.sax.ContentHandler#endDocument
- */
- public void endDocument ()
- throws SAXException
- {
- if (contentHandler != null) {
- contentHandler.endDocument();
- }
- }
-
-
- /**
- * Filter a start Namespace prefix mapping event.
- *
- * @param prefix The Namespace prefix.
- * @param uri The Namespace URI.
- * @exception org.xml.sax.SAXException The client may throw
- * an exception during processing.
- * @see org.xml.sax.ContentHandler#startPrefixMapping
- */
- public void startPrefixMapping (String prefix, String uri)
- throws SAXException
- {
- if (contentHandler != null) {
- contentHandler.startPrefixMapping(prefix, uri);
- }
- }
-
-
- /**
- * Filter an end Namespace prefix mapping event.
- *
- * @param prefix The Namespace prefix.
- * @exception org.xml.sax.SAXException The client may throw
- * an exception during processing.
- * @see org.xml.sax.ContentHandler#endPrefixMapping
- */
- public void endPrefixMapping (String prefix)
- throws SAXException
- {
- if (contentHandler != null) {
- contentHandler.endPrefixMapping(prefix);
- }
- }
-
-
- /**
- * Filter a start element event.
- *
- * @param uri The element's Namespace URI, or the empty string.
- * @param localName The element's local name, or the empty string.
- * @param qName The element's qualified (prefixed) name, or the empty
- * string.
- * @param atts The element's attributes.
- * @exception org.xml.sax.SAXException The client may throw
- * an exception during processing.
- * @see org.xml.sax.ContentHandler#startElement
- */
- public void startElement (String uri, String localName, String qName,
- Attributes atts)
- throws SAXException
- {
- if (contentHandler != null) {
- contentHandler.startElement(uri, localName, qName, atts);
- }
- }
-
-
- /**
- * Filter an end element event.
- *
- * @param uri The element's Namespace URI, or the empty string.
- * @param localName The element's local name, or the empty string.
- * @param qName The element's qualified (prefixed) name, or the empty
- * string.
- * @exception org.xml.sax.SAXException The client may throw
- * an exception during processing.
- * @see org.xml.sax.ContentHandler#endElement
- */
- public void endElement (String uri, String localName, String qName)
- throws SAXException
- {
- if (contentHandler != null) {
- contentHandler.endElement(uri, localName, qName);
- }
- }
-
-
- /**
- * Filter a character data event.
- *
- * @param ch An array of characters.
- * @param start The starting position in the array.
- * @param length The number of characters to use from the array.
- * @exception org.xml.sax.SAXException The client may throw
- * an exception during processing.
- * @see org.xml.sax.ContentHandler#characters
- */
- public void characters (char ch[], int start, int length)
- throws SAXException
- {
- if (contentHandler != null) {
- contentHandler.characters(ch, start, length);
- }
- }
-
-
- /**
- * Filter an ignorable whitespace event.
- *
- * @param ch An array of characters.
- * @param start The starting position in the array.
- * @param length The number of characters to use from the array.
- * @exception org.xml.sax.SAXException The client may throw
- * an exception during processing.
- * @see org.xml.sax.ContentHandler#ignorableWhitespace
- */
- public void ignorableWhitespace (char ch[], int start, int length)
- throws SAXException
- {
- if (contentHandler != null) {
- contentHandler.ignorableWhitespace(ch, start, length);
- }
- }
-
-
- /**
- * Filter a processing instruction event.
- *
- * @param target The processing instruction target.
- * @param data The text following the target.
- * @exception org.xml.sax.SAXException The client may throw
- * an exception during processing.
- * @see org.xml.sax.ContentHandler#processingInstruction
- */
- public void processingInstruction (String target, String data)
- throws SAXException
- {
- if (contentHandler != null) {
- contentHandler.processingInstruction(target, data);
- }
- }
-
-
- /**
- * Filter a skipped entity event.
- *
- * @param name The name of the skipped entity.
- * @exception org.xml.sax.SAXException The client may throw
- * an exception during processing.
- * @see org.xml.sax.ContentHandler#skippedEntity
- */
- public void skippedEntity (String name)
- throws SAXException
- {
- if (contentHandler != null) {
- contentHandler.skippedEntity(name);
- }
- }
-
-
-
- ////////////////////////////////////////////////////////////////////
- // Implementation of org.xml.sax.ErrorHandler.
- ////////////////////////////////////////////////////////////////////
-
-
- /**
- * Filter a warning event.
- *
- * @param e The nwarning as an exception.
- * @exception org.xml.sax.SAXException The client may throw
- * an exception during processing.
- * @see org.xml.sax.ErrorHandler#warning
- */
- public void warning (SAXParseException e)
- throws SAXException
- {
- if (errorHandler != null) {
- errorHandler.warning(e);
- }
- }
-
-
- /**
- * Filter an error event.
- *
- * @param e The error as an exception.
- * @exception org.xml.sax.SAXException The client may throw
- * an exception during processing.
- * @see org.xml.sax.ErrorHandler#error
- */
- public void error (SAXParseException e)
- throws SAXException
- {
- if (errorHandler != null) {
- errorHandler.error(e);
- }
- }
-
-
- /**
- * Filter a fatal error event.
- *
- * @param e The error as an exception.
- * @exception org.xml.sax.SAXException The client may throw
- * an exception during processing.
- * @see org.xml.sax.ErrorHandler#fatalError
- */
- public void fatalError (SAXParseException e)
- throws SAXException
- {
- if (errorHandler != null) {
- errorHandler.fatalError(e);
- }
- }
-
-
-
- ////////////////////////////////////////////////////////////////////
- // Internal methods.
- ////////////////////////////////////////////////////////////////////
-
-
- /**
- * Set up before a parse.
- *
- * <p>Before every parse, check whether the parent is
- * non-null, and re-register the filter for all of the
- * events.</p>
- */
- private void setupParse ()
- {
- if (parent == null) {
- throw new NullPointerException("No parent for filter");
- }
- parent.setEntityResolver(this);
- parent.setDTDHandler(this);
- parent.setContentHandler(this);
- parent.setErrorHandler(this);
- }
-
-
-
- ////////////////////////////////////////////////////////////////////
- // Internal state.
- ////////////////////////////////////////////////////////////////////
-
- private XMLReader parent = null;
- private Locator locator = null;
- private EntityResolver entityResolver = null;
- private DTDHandler dtdHandler = null;
- private ContentHandler contentHandler = null;
- private ErrorHandler errorHandler = null;
-
-}
-
-// end of XMLFilterImpl.java
+// XMLFilterImpl.java - base SAX2 filter implementation.
+// http://www.saxproject.org
+// Written by David Megginson
+// NO WARRANTY! This class is in the Public Domain.
+
+// $Id: XMLFilterImpl.java,v 1.3.2.7 2002/01/29 21:34:14 dbrownell Exp $
+
+package org.xml.sax.helpers;
+
+import java.io.IOException;
+
+import org.xml.sax.XMLReader;
+import org.xml.sax.XMLFilter;
+import org.xml.sax.InputSource;
+import org.xml.sax.Locator;
+import org.xml.sax.Attributes;
+import org.xml.sax.EntityResolver;
+import org.xml.sax.DTDHandler;
+import org.xml.sax.ContentHandler;
+import org.xml.sax.ErrorHandler;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXParseException;
+import org.xml.sax.SAXNotSupportedException;
+import org.xml.sax.SAXNotRecognizedException;
+
+
+/**
+ * Base class for deriving an XML filter.
+ *
+ * <blockquote>
+ * <em>This module, both source code and documentation, is in the
+ * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
+ * See <a href='http://www.saxproject.org'>http://www.saxproject.org</a>
+ * for further information.
+ * </blockquote>
+ *
+ * <p>This class is designed to sit between an {@link org.xml.sax.XMLReader
+ * XMLReader} and the client application's event handlers. By default, it
+ * does nothing but pass requests up to the reader and events
+ * on to the handlers unmodified, but subclasses can override
+ * specific methods to modify the event stream or the configuration
+ * requests as they pass through.</p>
+ *
+ * @since SAX 2.0
+ * @author David Megginson
+ * @version 2.0.1 (sax2r2)
+ * @see org.xml.sax.XMLFilter
+ * @see org.xml.sax.XMLReader
+ * @see org.xml.sax.EntityResolver
+ * @see org.xml.sax.DTDHandler
+ * @see org.xml.sax.ContentHandler
+ * @see org.xml.sax.ErrorHandler
+ */
+public class XMLFilterImpl
+ implements XMLFilter, EntityResolver, DTDHandler, ContentHandler, ErrorHandler
+{
+
+
+ ////////////////////////////////////////////////////////////////////
+ // Constructors.
+ ////////////////////////////////////////////////////////////////////
+
+
+ /**
+ * Construct an empty XML filter, with no parent.
+ *
+ * <p>This filter will have no parent: you must assign a parent
+ * before you start a parse or do any configuration with
+ * setFeature or setProperty, unless you use this as a pure event
+ * consumer rather than as an {@link XMLReader}.</p>
+ *
+ * @see org.xml.sax.XMLReader#setFeature
+ * @see org.xml.sax.XMLReader#setProperty
+ * @see #setParent
+ */
+ public XMLFilterImpl ()
+ {
+ super();
+ }
+
+
+ /**
+ * Construct an XML filter with the specified parent.
+ *
+ * @see #setParent
+ * @see #getParent
+ */
+ public XMLFilterImpl (XMLReader parent)
+ {
+ super();
+ setParent(parent);
+ }
+
+
+
+ ////////////////////////////////////////////////////////////////////
+ // Implementation of org.xml.sax.XMLFilter.
+ ////////////////////////////////////////////////////////////////////
+
+
+ /**
+ * Set the parent reader.
+ *
+ * <p>This is the {@link org.xml.sax.XMLReader XMLReader} from which
+ * this filter will obtain its events and to which it will pass its
+ * configuration requests. The parent may itself be another filter.</p>
+ *
+ * <p>If there is no parent reader set, any attempt to parse
+ * or to set or get a feature or property will fail.</p>
+ *
+ * @param parent The parent XML reader.
+ * @see #getParent
+ */
+ public void setParent (XMLReader parent)
+ {
+ this.parent = parent;
+ }
+
+
+ /**
+ * Get the parent reader.
+ *
+ * @return The parent XML reader, or null if none is set.
+ * @see #setParent
+ */
+ public XMLReader getParent ()
+ {
+ return parent;
+ }
+
+
+
+ ////////////////////////////////////////////////////////////////////
+ // Implementation of org.xml.sax.XMLReader.
+ ////////////////////////////////////////////////////////////////////
+
+
+ /**
+ * Set the value of a feature.
+ *
+ * <p>This will always fail if the parent is null.</p>
+ *
+ * @param name The feature name.
+ * @param value The requested feature value.
+ * @exception org.xml.sax.SAXNotRecognizedException If the feature
+ * value can't be assigned or retrieved from the parent.
+ * @exception org.xml.sax.SAXNotSupportedException When the
+ * parent recognizes the feature name but
+ * cannot set the requested value.
+ */
+ public void setFeature (String name, boolean value)
+ throws SAXNotRecognizedException, SAXNotSupportedException
+ {
+ if (parent != null) {
+ parent.setFeature(name, value);
+ } else {
+ throw new SAXNotRecognizedException("Feature: " + name);
+ }
+ }
+
+
+ /**
+ * Look up the value of a feature.
+ *
+ * <p>This will always fail if the parent is null.</p>
+ *
+ * @param name The feature name.
+ * @return The current value of the feature.
+ * @exception org.xml.sax.SAXNotRecognizedException If the feature
+ * value can't be assigned or retrieved from the parent.
+ * @exception org.xml.sax.SAXNotSupportedException When the
+ * parent recognizes the feature name but
+ * cannot determine its value at this time.
+ */
+ public boolean getFeature (String name)
+ throws SAXNotRecognizedException, SAXNotSupportedException
+ {
+ if (parent != null) {
+ return parent.getFeature(name);
+ } else {
+ throw new SAXNotRecognizedException("Feature: " + name);
+ }
+ }
+
+
+ /**
+ * Set the value of a property.
+ *
+ * <p>This will always fail if the parent is null.</p>
+ *
+ * @param name The property name.
+ * @param value The requested property value.
+ * @exception org.xml.sax.SAXNotRecognizedException If the property
+ * value can't be assigned or retrieved from the parent.
+ * @exception org.xml.sax.SAXNotSupportedException When the
+ * parent recognizes the property name but
+ * cannot set the requested value.
+ */
+ public void setProperty (String name, Object value)
+ throws SAXNotRecognizedException, SAXNotSupportedException
+ {
+ if (parent != null) {
+ parent.setProperty(name, value);
+ } else {
+ throw new SAXNotRecognizedException("Property: " + name);
+ }
+ }
+
+
+ /**
+ * Look up the value of a property.
+ *
+ * @param name The property name.
+ * @return The current value of the property.
+ * @exception org.xml.sax.SAXNotRecognizedException If the property
+ * value can't be assigned or retrieved from the parent.
+ * @exception org.xml.sax.SAXNotSupportedException When the
+ * parent recognizes the property name but
+ * cannot determine its value at this time.
+ */
+ public Object getProperty (String name)
+ throws SAXNotRecognizedException, SAXNotSupportedException
+ {
+ if (parent != null) {
+ return parent.getProperty(name);
+ } else {
+ throw new SAXNotRecognizedException("Property: " + name);
+ }
+ }
+
+
+ /**
+ * Set the entity resolver.
+ *
+ * @param resolver The new entity resolver.
+ */
+ public void setEntityResolver (EntityResolver resolver)
+ {
+ entityResolver = resolver;
+ }
+
+
+ /**
+ * Get the current entity resolver.
+ *
+ * @return The current entity resolver, or null if none was set.
+ */
+ public EntityResolver getEntityResolver ()
+ {
+ return entityResolver;
+ }
+
+
+ /**
+ * Set the DTD event handler.
+ *
+ * @param resolver The new DTD handler.
+ */
+ public void setDTDHandler (DTDHandler handler)
+ {
+ dtdHandler = handler;
+ }
+
+
+ /**
+ * Get the current DTD event handler.
+ *
+ * @return The current DTD handler, or null if none was set.
+ */
+ public DTDHandler getDTDHandler ()
+ {
+ return dtdHandler;
+ }
+
+
+ /**
+ * Set the content event handler.
+ *
+ * @param resolver The new content handler.
+ */
+ public void setContentHandler (ContentHandler handler)
+ {
+ contentHandler = handler;
+ }
+
+
+ /**
+ * Get the content event handler.
+ *
+ * @return The current content handler, or null if none was set.
+ */
+ public ContentHandler getContentHandler ()
+ {
+ return contentHandler;
+ }
+
+
+ /**
+ * Set the error event handler.
+ *
+ * @param handle The new error handler.
+ */
+ public void setErrorHandler (ErrorHandler handler)
+ {
+ errorHandler = handler;
+ }
+
+
+ /**
+ * Get the current error event handler.
+ *
+ * @return The current error handler, or null if none was set.
+ */
+ public ErrorHandler getErrorHandler ()
+ {
+ return errorHandler;
+ }
+
+
+ /**
+ * Parse a document.
+ *
+ * @param input The input source for the document entity.
+ * @exception org.xml.sax.SAXException Any SAX exception, possibly
+ * wrapping another exception.
+ * @exception java.io.IOException An IO exception from the parser,
+ * possibly from a byte stream or character stream
+ * supplied by the application.
+ */
+ public void parse (InputSource input)
+ throws SAXException, IOException
+ {
+ setupParse();
+ parent.parse(input);
+ }
+
+
+ /**
+ * Parse a document.
+ *
+ * @param systemId The system identifier as a fully-qualified URI.
+ * @exception org.xml.sax.SAXException Any SAX exception, possibly
+ * wrapping another exception.
+ * @exception java.io.IOException An IO exception from the parser,
+ * possibly from a byte stream or character stream
+ * supplied by the application.
+ */
+ public void parse (String systemId)
+ throws SAXException, IOException
+ {
+ parse(new InputSource(systemId));
+ }
+
+
+
+ ////////////////////////////////////////////////////////////////////
+ // Implementation of org.xml.sax.EntityResolver.
+ ////////////////////////////////////////////////////////////////////
+
+
+ /**
+ * Filter an external entity resolution.
+ *
+ * @param publicId The entity's public identifier, or null.
+ * @param systemId The entity's system identifier.
+ * @return A new InputSource or null for the default.
+ * @exception org.xml.sax.SAXException The client may throw
+ * an exception during processing.
+ * @exception java.io.IOException The client may throw an
+ * I/O-related exception while obtaining the
+ * new InputSource.
+ */
+ public InputSource resolveEntity (String publicId, String systemId)
+ throws SAXException, IOException
+ {
+ if (entityResolver != null) {
+ return entityResolver.resolveEntity(publicId, systemId);
+ } else {
+ return null;
+ }
+ }
+
+
+
+ ////////////////////////////////////////////////////////////////////
+ // Implementation of org.xml.sax.DTDHandler.
+ ////////////////////////////////////////////////////////////////////
+
+
+ /**
+ * Filter a notation declaration event.
+ *
+ * @param name The notation name.
+ * @param publicId The notation's public identifier, or null.
+ * @param systemId The notation's system identifier, or null.
+ * @exception org.xml.sax.SAXException The client may throw
+ * an exception during processing.
+ */
+ public void notationDecl (String name, String publicId, String systemId)
+ throws SAXException
+ {
+ if (dtdHandler != null) {
+ dtdHandler.notationDecl(name, publicId, systemId);
+ }
+ }
+
+
+ /**
+ * Filter an unparsed entity declaration event.
+ *
+ * @param name The entity name.
+ * @param publicId The entity's public identifier, or null.
+ * @param systemId The entity's system identifier, or null.
+ * @param notationName The name of the associated notation.
+ * @exception org.xml.sax.SAXException The client may throw
+ * an exception during processing.
+ */
+ public void unparsedEntityDecl (String name, String publicId,
+ String systemId, String notationName)
+ throws SAXException
+ {
+ if (dtdHandler != null) {
+ dtdHandler.unparsedEntityDecl(name, publicId, systemId,
+ notationName);
+ }
+ }
+
+
+
+ ////////////////////////////////////////////////////////////////////
+ // Implementation of org.xml.sax.ContentHandler.
+ ////////////////////////////////////////////////////////////////////
+
+
+ /**
+ * Filter a new document locator event.
+ *
+ * @param locator The document locator.
+ */
+ public void setDocumentLocator (Locator locator)
+ {
+ this.locator = locator;
+ if (contentHandler != null) {
+ contentHandler.setDocumentLocator(locator);
+ }
+ }
+
+
+ /**
+ * Filter a start document event.
+ *
+ * @exception org.xml.sax.SAXException The client may throw
+ * an exception during processing.
+ */
+ public void startDocument ()
+ throws SAXException
+ {
+ if (contentHandler != null) {
+ contentHandler.startDocument();
+ }
+ }
+
+
+ /**
+ * Filter an end document event.
+ *
+ * @exception org.xml.sax.SAXException The client may throw
+ * an exception during processing.
+ */
+ public void endDocument ()
+ throws SAXException
+ {
+ if (contentHandler != null) {
+ contentHandler.endDocument();
+ }
+ }
+
+
+ /**
+ * Filter a start Namespace prefix mapping event.
+ *
+ * @param prefix The Namespace prefix.
+ * @param uri The Namespace URI.
+ * @exception org.xml.sax.SAXException The client may throw
+ * an exception during processing.
+ */
+ public void startPrefixMapping (String prefix, String uri)
+ throws SAXException
+ {
+ if (contentHandler != null) {
+ contentHandler.startPrefixMapping(prefix, uri);
+ }
+ }
+
+
+ /**
+ * Filter an end Namespace prefix mapping event.
+ *
+ * @param prefix The Namespace prefix.
+ * @exception org.xml.sax.SAXException The client may throw
+ * an exception during processing.
+ */
+ public void endPrefixMapping (String prefix)
+ throws SAXException
+ {
+ if (contentHandler != null) {
+ contentHandler.endPrefixMapping(prefix);
+ }
+ }
+
+
+ /**
+ * Filter a start element event.
+ *
+ * @param uri The element's Namespace URI, or the empty string.
+ * @param localName The element's local name, or the empty string.
+ * @param qName The element's qualified (prefixed) name, or the empty
+ * string.
+ * @param atts The element's attributes.
+ * @exception org.xml.sax.SAXException The client may throw
+ * an exception during processing.
+ */
+ public void startElement (String uri, String localName, String qName,
+ Attributes atts)
+ throws SAXException
+ {
+ if (contentHandler != null) {
+ contentHandler.startElement(uri, localName, qName, atts);
+ }
+ }
+
+
+ /**
+ * Filter an end element event.
+ *
+ * @param uri The element's Namespace URI, or the empty string.
+ * @param localName The element's local name, or the empty string.
+ * @param qName The element's qualified (prefixed) name, or the empty
+ * string.
+ * @exception org.xml.sax.SAXException The client may throw
+ * an exception during processing.
+ */
+ public void endElement (String uri, String localName, String qName)
+ throws SAXException
+ {
+ if (contentHandler != null) {
+ contentHandler.endElement(uri, localName, qName);
+ }
+ }
+
+
+ /**
+ * Filter a character data event.
+ *
+ * @param ch An array of characters.
+ * @param start The starting position in the array.
+ * @param length The number of characters to use from the array.
+ * @exception org.xml.sax.SAXException The client may throw
+ * an exception during processing.
+ */
+ public void characters (char ch[], int start, int length)
+ throws SAXException
+ {
+ if (contentHandler != null) {
+ contentHandler.characters(ch, start, length);
+ }
+ }
+
+
+ /**
+ * Filter an ignorable whitespace event.
+ *
+ * @param ch An array of characters.
+ * @param start The starting position in the array.
+ * @param length The number of characters to use from the array.
+ * @exception org.xml.sax.SAXException The client may throw
+ * an exception during processing.
+ */
+ public void ignorableWhitespace (char ch[], int start, int length)
+ throws SAXException
+ {
+ if (contentHandler != null) {
+ contentHandler.ignorableWhitespace(ch, start, length);
+ }
+ }
+
+
+ /**
+ * Filter a processing instruction event.
+ *
+ * @param target The processing instruction target.
+ * @param data The text following the target.
+ * @exception org.xml.sax.SAXException The client may throw
+ * an exception during processing.
+ */
+ public void processingInstruction (String target, String data)
+ throws SAXException
+ {
+ if (contentHandler != null) {
+ contentHandler.processingInstruction(target, data);
+ }
+ }
+
+
+ /**
+ * Filter a skipped entity event.
+ *
+ * @param name The name of the skipped entity.
+ * @exception org.xml.sax.SAXException The client may throw
+ * an exception during processing.
+ */
+ public void skippedEntity (String name)
+ throws SAXException
+ {
+ if (contentHandler != null) {
+ contentHandler.skippedEntity(name);
+ }
+ }
+
+
+
+ ////////////////////////////////////////////////////////////////////
+ // Implementation of org.xml.sax.ErrorHandler.
+ ////////////////////////////////////////////////////////////////////
+
+
+ /**
+ * Filter a warning event.
+ *
+ * @param e The warning as an exception.
+ * @exception org.xml.sax.SAXException The client may throw
+ * an exception during processing.
+ */
+ public void warning (SAXParseException e)
+ throws SAXException
+ {
+ if (errorHandler != null) {
+ errorHandler.warning(e);
+ }
+ }
+
+
+ /**
+ * Filter an error event.
+ *
+ * @param e The error as an exception.
+ * @exception org.xml.sax.SAXException The client may throw
+ * an exception during processing.
+ */
+ public void error (SAXParseException e)
+ throws SAXException
+ {
+ if (errorHandler != null) {
+ errorHandler.error(e);
+ }
+ }
+
+
+ /**
+ * Filter a fatal error event.
+ *
+ * @param e The error as an exception.
+ * @exception org.xml.sax.SAXException The client may throw
+ * an exception during processing.
+ */
+ public void fatalError (SAXParseException e)
+ throws SAXException
+ {
+ if (errorHandler != null) {
+ errorHandler.fatalError(e);
+ }
+ }
+
+
+
+ ////////////////////////////////////////////////////////////////////
+ // Internal methods.
+ ////////////////////////////////////////////////////////////////////
+
+
+ /**
+ * Set up before a parse.
+ *
+ * <p>Before every parse, check whether the parent is
+ * non-null, and re-register the filter for all of the
+ * events.</p>
+ */
+ private void setupParse ()
+ {
+ if (parent == null) {
+ throw new NullPointerException("No parent for filter");
+ }
+ parent.setEntityResolver(this);
+ parent.setDTDHandler(this);
+ parent.setContentHandler(this);
+ parent.setErrorHandler(this);
+ }
+
+
+
+ ////////////////////////////////////////////////////////////////////
+ // Internal state.
+ ////////////////////////////////////////////////////////////////////
+
+ private XMLReader parent = null;
+ private Locator locator = null;
+ private EntityResolver entityResolver = null;
+ private DTDHandler dtdHandler = null;
+ private ContentHandler contentHandler = null;
+ private ErrorHandler errorHandler = null;
+
+}
+
+// end of XMLFilterImpl.java
diff --git a/libjava/org/xml/sax/helpers/XMLReaderAdapter.java b/libjava/org/xml/sax/helpers/XMLReaderAdapter.java
index 4fb44d91d8e..19c8d3f8e88 100644
--- a/libjava/org/xml/sax/helpers/XMLReaderAdapter.java
+++ b/libjava/org/xml/sax/helpers/XMLReaderAdapter.java
@@ -1,526 +1,539 @@
-// XMLReaderAdapter.java - adapt an SAX2 XMLReader to a SAX1 Parser
-// Written by David Megginson, sax@megginson.com
-// NO WARRANTY! This class is in the public domain.
-
-// $Id: XMLReaderAdapter.java,v 1.1 2000/10/02 02:43:20 sboag Exp $
-
-package org.xml.sax.helpers;
-
-import java.io.IOException;
-import java.util.Locale;
-
-import org.xml.sax.Parser; // deprecated
-import org.xml.sax.Locator;
-import org.xml.sax.InputSource;
-import org.xml.sax.AttributeList; // deprecated
-import org.xml.sax.EntityResolver;
-import org.xml.sax.DTDHandler;
-import org.xml.sax.DocumentHandler; // deprecated
-import org.xml.sax.ErrorHandler;
-import org.xml.sax.SAXException;
-
-import org.xml.sax.XMLReader;
-import org.xml.sax.Attributes;
-import org.xml.sax.ContentHandler;
-import org.xml.sax.SAXNotSupportedException;
-
-
-/**
- * Adapt a SAX2 XMLReader as a SAX1 Parser.
- *
- * <blockquote>
- * <em>This module, both source code and documentation, is in the
- * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
- * </blockquote>
- *
- * <p>This class wraps a SAX2 {@link org.xml.sax.XMLReader XMLReader}
- * and makes it act as a SAX1 {@link org.xml.sax.Parser Parser}. The XMLReader
- * must support a true value for the
- * http://xml.org/sax/features/namespace-prefixes property or parsing will fail
- * with a {@link org.xml.sax.SAXException SAXException}; if the XMLReader
- * supports a false value for the http://xml.org/sax/features/namespaces
- * property, that will also be used to improve efficiency.</p>
- *
- * @since SAX 2.0
- * @author David Megginson,
- * <a href="mailto:sax@megginson.com">sax@megginson.com</a>
- * @version 2.0
- * @see org.xml.sax.Parser
- * @see org.xml.sax.XMLReader
- */
-public class XMLReaderAdapter implements Parser, ContentHandler
-{
-
-
- ////////////////////////////////////////////////////////////////////
- // Constructor.
- ////////////////////////////////////////////////////////////////////
-
-
- /**
- * Create a new adapter.
- *
- * <p>Use the "org.xml.sax.driver" property to locate the SAX2
- * driver to embed.</p>
- *
- * @exception org.xml.sax.SAXException If the embedded driver
- * cannot be instantiated or if the
- * org.xml.sax.driver property is not specified.
- */
- public XMLReaderAdapter ()
- throws SAXException
- {
- setup(XMLReaderFactory.createXMLReader());
- }
-
-
- /**
- * Create a new adapter.
- *
- * <p>Create a new adapter, wrapped around a SAX2 XMLReader.
- * The adapter will make the XMLReader act like a SAX1
- * Parser.</p>
- *
- * @param xmlReader The SAX2 XMLReader to wrap.
- * @exception java.lang.NullPointerException If the argument is null.
- */
- public XMLReaderAdapter (XMLReader xmlReader)
- {
- setup(xmlReader);
- }
-
-
-
- /**
- * Internal setup.
- *
- * @param xmlReader The embedded XMLReader.
- */
- private void setup (XMLReader xmlReader)
- {
- if (xmlReader == null) {
- throw new NullPointerException("XMLReader must not be null");
- }
- this.xmlReader = xmlReader;
- qAtts = new AttributesAdapter();
- }
-
-
-
- ////////////////////////////////////////////////////////////////////
- // Implementation of org.xml.sax.Parser.
- ////////////////////////////////////////////////////////////////////
-
-
- /**
- * Set the locale for error reporting.
- *
- * <p>This is not supported in SAX2, and will always throw
- * an exception.</p>
- *
- * @param The locale for error reporting.
- * @see org.xml.sax.Parser#setLocale
- */
- public void setLocale (Locale locale)
- throws SAXException
- {
- throw new SAXNotSupportedException("setLocale not supported");
- }
-
-
- /**
- * Register the entity resolver.
- *
- * @param resolver The new resolver.
- * @see org.xml.sax.Parser#setEntityResolver
- */
- public void setEntityResolver (EntityResolver resolver)
- {
- xmlReader.setEntityResolver(resolver);
- }
-
-
- /**
- * Register the DTD event handler.
- *
- * @param handler The new DTD event handler.
- * @see org.xml.sax.Parser#setDTDHandler
- */
- public void setDTDHandler (DTDHandler handler)
- {
- xmlReader.setDTDHandler(handler);
- }
-
-
- /**
- * Register the SAX1 document event handler.
- *
- * <p>Note that the SAX1 document handler has no Namespace
- * support.</p>
- *
- * @param handler The new SAX1 document event handler.
- * @see org.xml.sax.Parser#setDocumentHandler
- */
- public void setDocumentHandler (DocumentHandler handler)
- {
- documentHandler = handler;
- }
-
-
- /**
- * Register the error event handler.
- *
- * @param handler The new error event handler.
- * @see org.xml.sax.Parser#setErrorHandler
- */
- public void setErrorHandler (ErrorHandler handler)
- {
- xmlReader.setErrorHandler(handler);
- }
-
-
- /**
- * Parse the document.
- *
- * <p>This method will throw an exception if the embedded
- * XMLReader does not support the
- * http://xml.org/sax/features/namespace-prefixes property.</p>
- *
- * @param systemId The absolute URL of the document.
- * @exception java.io.IOException If there is a problem reading
- * the raw content of the document.
- * @exception org.xml.sax.SAXException If there is a problem
- * processing the document.
- * @see #parse(org.xml.sax.InputSource)
- * @see org.xml.sax.Parser#parse(java.lang.String)
- */
- public void parse (String systemId)
- throws IOException, SAXException
- {
- parse(new InputSource(systemId));
- }
-
-
- /**
- * Parse the document.
- *
- * <p>This method will throw an exception if the embedded
- * XMLReader does not support the
- * http://xml.org/sax/features/namespace-prefixes property.</p>
- *
- * @param input An input source for the document.
- * @exception java.io.IOException If there is a problem reading
- * the raw content of the document.
- * @exception org.xml.sax.SAXException If there is a problem
- * processing the document.
- * @see #parse(java.lang.String)
- * @see org.xml.sax.Parser#parse(org.xml.sax.InputSource)
- */
- public void parse (InputSource input)
- throws IOException, SAXException
- {
- setupXMLReader();
- xmlReader.parse(input);
- }
-
-
- /**
- * Set up the XML reader.
- */
- private void setupXMLReader ()
- throws SAXException
- {
- xmlReader.setFeature("http://xml.org/sax/features/namespace-prefixes", true);
- try {
- xmlReader.setFeature("http://xml.org/sax/features/namespaces",
- false);
- } catch (SAXException e) {
- // NO OP: it's just extra information, and we can ignore it
- }
- xmlReader.setContentHandler(this);
- }
-
-
-
- ////////////////////////////////////////////////////////////////////
- // Implementation of org.xml.sax.ContentHandler.
- ////////////////////////////////////////////////////////////////////
-
-
- /**
- * Set a document locator.
- *
- * @param locator The document locator.
- * @see org.xml.sax.ContentHandler#setDocumentLocator
- */
- public void setDocumentLocator (Locator locator)
- {
- documentHandler.setDocumentLocator(locator);
- }
-
-
- /**
- * Start document event.
- *
- * @exception org.xml.sax.SAXException The client may raise a
- * processing exception.
- * @see org.xml.sax.ContentHandler#startDocument
- */
- public void startDocument ()
- throws SAXException
- {
- documentHandler.startDocument();
- }
-
-
- /**
- * End document event.
- *
- * @exception org.xml.sax.SAXException The client may raise a
- * processing exception.
- * @see org.xml.sax.ContentHandler#endDocument
- */
- public void endDocument ()
- throws SAXException
- {
- documentHandler.endDocument();
- }
-
-
- /**
- * Adapt a SAX2 start prefix mapping event.
- *
- * @param prefix The prefix being mapped.
- * @param uri The Namespace URI being mapped to.
- * @see org.xml.sax.ContentHandler#startPrefixMapping
- */
- public void startPrefixMapping (String prefix, String uri)
- {
- }
-
-
- /**
- * Adapt a SAX2 end prefix mapping event.
- *
- * @param prefix The prefix being mapped.
- * @see org.xml.sax.ContentHandler#endPrefixMapping
- */
- public void endPrefixMapping (String prefix)
- {
- }
-
-
- /**
- * Adapt a SAX2 start element event.
- *
- * @param uri The Namespace URI.
- * @param localName The Namespace local name.
- * @param qName The qualified (prefixed) name.
- * @param atts The SAX2 attributes.
- * @exception org.xml.sax.SAXException The client may raise a
- * processing exception.
- * @see org.xml.sax.ContentHandler#endDocument
- */
- public void startElement (String uri, String localName,
- String qName, Attributes atts)
- throws SAXException
- {
- qAtts.setAttributes(atts);
- documentHandler.startElement(qName, qAtts);
- }
-
-
- /**
- * Adapt a SAX2 end element event.
- *
- * @param uri The Namespace URI.
- * @param localName The Namespace local name.
- * @param qName The qualified (prefixed) name.
- * @exception org.xml.sax.SAXException The client may raise a
- * processing exception.
- * @see org.xml.sax.ContentHandler#endElement
- */
- public void endElement (String uri, String localName,
- String qName)
- throws SAXException
- {
- documentHandler.endElement(qName);
- }
-
-
- /**
- * Adapt a SAX2 characters event.
- *
- * @param ch An array of characters.
- * @param start The starting position in the array.
- * @param length The number of characters to use.
- * @exception org.xml.sax.SAXException The client may raise a
- * processing exception.
- * @see org.xml.sax.ContentHandler#characters
- */
- public void characters (char ch[], int start, int length)
- throws SAXException
- {
- documentHandler.characters(ch, start, length);
- }
-
-
- /**
- * Adapt a SAX2 ignorable whitespace event.
- *
- * @param ch An array of characters.
- * @param start The starting position in the array.
- * @param length The number of characters to use.
- * @exception org.xml.sax.SAXException The client may raise a
- * processing exception.
- * @see org.xml.sax.ContentHandler#ignorableWhitespace
- */
- public void ignorableWhitespace (char ch[], int start, int length)
- throws SAXException
- {
- documentHandler.ignorableWhitespace(ch, start, length);
- }
-
-
- /**
- * Adapt a SAX2 processing instruction event.
- *
- * @param target The processing instruction target.
- * @param data The remainder of the processing instruction
- * @exception org.xml.sax.SAXException The client may raise a
- * processing exception.
- * @see org.xml.sax.ContentHandler#processingInstruction
- */
- public void processingInstruction (String target, String data)
- throws SAXException
- {
- documentHandler.processingInstruction(target, data);
- }
-
-
- /**
- * Adapt a SAX2 skipped entity event.
- *
- * @param name The name of the skipped entity.
- * @see org.xml.sax.ContentHandler#skippedEntity
- */
- public void skippedEntity (String name)
- throws SAXException
- {
- }
-
-
-
- ////////////////////////////////////////////////////////////////////
- // Internal state.
- ////////////////////////////////////////////////////////////////////
-
- XMLReader xmlReader;
- DocumentHandler documentHandler;
- AttributesAdapter qAtts;
-
-
-
- ////////////////////////////////////////////////////////////////////
- // Internal class.
- ////////////////////////////////////////////////////////////////////
-
-
- /**
- * Internal class to wrap a SAX2 Attributes object for SAX1.
- */
- final class AttributesAdapter implements AttributeList
- {
- AttributesAdapter ()
- {
- }
-
-
- /**
- * Set the embedded Attributes object.
- *
- * @param The embedded SAX2 Attributes.
- */
- void setAttributes (Attributes attributes)
- {
- this.attributes = attributes;
- }
-
-
- /**
- * Return the number of attributes.
- *
- * @return The length of the attribute list.
- * @see org.xml.sax.AttributeList#getLength
- */
- public int getLength ()
- {
- return attributes.getLength();
- }
-
-
- /**
- * Return the qualified (prefixed) name of an attribute by position.
- *
- * @return The qualified name.
- * @see org.xml.sax.AttributeList#getName
- */
- public String getName (int i)
- {
- return attributes.getQName(i);
- }
-
-
- /**
- * Return the type of an attribute by position.
- *
- * @return The type.
- * @see org.xml.sax.AttributeList#getType(int)
- */
- public String getType (int i)
- {
- return attributes.getType(i);
- }
-
-
- /**
- * Return the value of an attribute by position.
- *
- * @return The value.
- * @see org.xml.sax.AttributeList#getValue(int)
- */
- public String getValue (int i)
- {
- return attributes.getValue(i);
- }
-
-
- /**
- * Return the type of an attribute by qualified (prefixed) name.
- *
- * @return The type.
- * @see org.xml.sax.AttributeList#getType(java.lang.String)
- */
- public String getType (String qName)
- {
- return attributes.getType(qName);
- }
-
-
- /**
- * Return the value of an attribute by qualified (prefixed) name.
- *
- * @return The value.
- * @see org.xml.sax.AttributeList#getValue(java.lang.String)
- */
- public String getValue (String qName)
- {
- return attributes.getValue(qName);
- }
-
- private Attributes attributes;
- }
-
-}
-
-// end of XMLReaderAdapter.java
+// XMLReaderAdapter.java - adapt an SAX2 XMLReader to a SAX1 Parser
+// http://www.saxproject.org
+// Written by David Megginson
+// NO WARRANTY! This class is in the public domain.
+
+// $Id: XMLReaderAdapter.java,v 1.5.2.3 2002/01/29 21:34:15 dbrownell Exp $
+
+package org.xml.sax.helpers;
+
+import java.io.IOException;
+import java.util.Locale;
+
+import org.xml.sax.Parser; // deprecated
+import org.xml.sax.Locator;
+import org.xml.sax.InputSource;
+import org.xml.sax.AttributeList; // deprecated
+import org.xml.sax.EntityResolver;
+import org.xml.sax.DTDHandler;
+import org.xml.sax.DocumentHandler; // deprecated
+import org.xml.sax.ErrorHandler;
+import org.xml.sax.SAXException;
+
+import org.xml.sax.XMLReader;
+import org.xml.sax.Attributes;
+import org.xml.sax.ContentHandler;
+import org.xml.sax.SAXNotSupportedException;
+
+
+/**
+ * Adapt a SAX2 XMLReader as a SAX1 Parser.
+ *
+ * <blockquote>
+ * <em>This module, both source code and documentation, is in the
+ * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
+ * See <a href='http://www.saxproject.org'>http://www.saxproject.org</a>
+ * for further information.
+ * </blockquote>
+ *
+ * <p>This class wraps a SAX2 {@link org.xml.sax.XMLReader XMLReader}
+ * and makes it act as a SAX1 {@link org.xml.sax.Parser Parser}. The XMLReader
+ * must support a true value for the
+ * http://xml.org/sax/features/namespace-prefixes property or parsing will fail
+ * with a {@link org.xml.sax.SAXException SAXException}; if the XMLReader
+ * supports a false value for the http://xml.org/sax/features/namespaces
+ * property, that will also be used to improve efficiency.</p>
+ *
+ * @since SAX 2.0
+ * @author David Megginson
+ * @version 2.0.1 (sax2r2)
+ * @see org.xml.sax.Parser
+ * @see org.xml.sax.XMLReader
+ */
+public class XMLReaderAdapter implements Parser, ContentHandler
+{
+
+
+ ////////////////////////////////////////////////////////////////////
+ // Constructor.
+ ////////////////////////////////////////////////////////////////////
+
+
+ /**
+ * Create a new adapter.
+ *
+ * <p>Use the "org.xml.sax.driver" property to locate the SAX2
+ * driver to embed.</p>
+ *
+ * @exception org.xml.sax.SAXException If the embedded driver
+ * cannot be instantiated or if the
+ * org.xml.sax.driver property is not specified.
+ */
+ public XMLReaderAdapter ()
+ throws SAXException
+ {
+ setup(XMLReaderFactory.createXMLReader());
+ }
+
+
+ /**
+ * Create a new adapter.
+ *
+ * <p>Create a new adapter, wrapped around a SAX2 XMLReader.
+ * The adapter will make the XMLReader act like a SAX1
+ * Parser.</p>
+ *
+ * @param xmlReader The SAX2 XMLReader to wrap.
+ * @exception java.lang.NullPointerException If the argument is null.
+ */
+ public XMLReaderAdapter (XMLReader xmlReader)
+ {
+ setup(xmlReader);
+ }
+
+
+
+ /**
+ * Internal setup.
+ *
+ * @param xmlReader The embedded XMLReader.
+ */
+ private void setup (XMLReader xmlReader)
+ {
+ if (xmlReader == null) {
+ throw new NullPointerException("XMLReader must not be null");
+ }
+ this.xmlReader = xmlReader;
+ qAtts = new AttributesAdapter();
+ }
+
+
+
+ ////////////////////////////////////////////////////////////////////
+ // Implementation of org.xml.sax.Parser.
+ ////////////////////////////////////////////////////////////////////
+
+
+ /**
+ * Set the locale for error reporting.
+ *
+ * <p>This is not supported in SAX2, and will always throw
+ * an exception.</p>
+ *
+ * @param The locale for error reporting.
+ * @see org.xml.sax.Parser#setLocale
+ * @exception org.xml.sax.SAXException Thrown unless overridden.
+ */
+ public void setLocale (Locale locale)
+ throws SAXException
+ {
+ throw new SAXNotSupportedException("setLocale not supported");
+ }
+
+
+ /**
+ * Register the entity resolver.
+ *
+ * @param resolver The new resolver.
+ * @see org.xml.sax.Parser#setEntityResolver
+ */
+ public void setEntityResolver (EntityResolver resolver)
+ {
+ xmlReader.setEntityResolver(resolver);
+ }
+
+
+ /**
+ * Register the DTD event handler.
+ *
+ * @param handler The new DTD event handler.
+ * @see org.xml.sax.Parser#setDTDHandler
+ */
+ public void setDTDHandler (DTDHandler handler)
+ {
+ xmlReader.setDTDHandler(handler);
+ }
+
+
+ /**
+ * Register the SAX1 document event handler.
+ *
+ * <p>Note that the SAX1 document handler has no Namespace
+ * support.</p>
+ *
+ * @param handler The new SAX1 document event handler.
+ * @see org.xml.sax.Parser#setDocumentHandler
+ */
+ public void setDocumentHandler (DocumentHandler handler)
+ {
+ documentHandler = handler;
+ }
+
+
+ /**
+ * Register the error event handler.
+ *
+ * @param handler The new error event handler.
+ * @see org.xml.sax.Parser#setErrorHandler
+ */
+ public void setErrorHandler (ErrorHandler handler)
+ {
+ xmlReader.setErrorHandler(handler);
+ }
+
+
+ /**
+ * Parse the document.
+ *
+ * <p>This method will throw an exception if the embedded
+ * XMLReader does not support the
+ * http://xml.org/sax/features/namespace-prefixes property.</p>
+ *
+ * @param systemId The absolute URL of the document.
+ * @exception java.io.IOException If there is a problem reading
+ * the raw content of the document.
+ * @exception org.xml.sax.SAXException If there is a problem
+ * processing the document.
+ * @see #parse(org.xml.sax.InputSource)
+ * @see org.xml.sax.Parser#parse(java.lang.String)
+ */
+ public void parse (String systemId)
+ throws IOException, SAXException
+ {
+ parse(new InputSource(systemId));
+ }
+
+
+ /**
+ * Parse the document.
+ *
+ * <p>This method will throw an exception if the embedded
+ * XMLReader does not support the
+ * http://xml.org/sax/features/namespace-prefixes property.</p>
+ *
+ * @param input An input source for the document.
+ * @exception java.io.IOException If there is a problem reading
+ * the raw content of the document.
+ * @exception org.xml.sax.SAXException If there is a problem
+ * processing the document.
+ * @see #parse(java.lang.String)
+ * @see org.xml.sax.Parser#parse(org.xml.sax.InputSource)
+ */
+ public void parse (InputSource input)
+ throws IOException, SAXException
+ {
+ setupXMLReader();
+ xmlReader.parse(input);
+ }
+
+
+ /**
+ * Set up the XML reader.
+ */
+ private void setupXMLReader ()
+ throws SAXException
+ {
+ xmlReader.setFeature("http://xml.org/sax/features/namespace-prefixes", true);
+ try {
+ xmlReader.setFeature("http://xml.org/sax/features/namespaces",
+ false);
+ } catch (SAXException e) {
+ // NO OP: it's just extra information, and we can ignore it
+ }
+ xmlReader.setContentHandler(this);
+ }
+
+
+
+ ////////////////////////////////////////////////////////////////////
+ // Implementation of org.xml.sax.ContentHandler.
+ ////////////////////////////////////////////////////////////////////
+
+
+ /**
+ * Set a document locator.
+ *
+ * @param locator The document locator.
+ * @see org.xml.sax.ContentHandler#setDocumentLocator
+ */
+ public void setDocumentLocator (Locator locator)
+ {
+ if (documentHandler != null)
+ documentHandler.setDocumentLocator(locator);
+ }
+
+
+ /**
+ * Start document event.
+ *
+ * @exception org.xml.sax.SAXException The client may raise a
+ * processing exception.
+ * @see org.xml.sax.ContentHandler#startDocument
+ */
+ public void startDocument ()
+ throws SAXException
+ {
+ if (documentHandler != null)
+ documentHandler.startDocument();
+ }
+
+
+ /**
+ * End document event.
+ *
+ * @exception org.xml.sax.SAXException The client may raise a
+ * processing exception.
+ * @see org.xml.sax.ContentHandler#endDocument
+ */
+ public void endDocument ()
+ throws SAXException
+ {
+ if (documentHandler != null)
+ documentHandler.endDocument();
+ }
+
+
+ /**
+ * Adapt a SAX2 start prefix mapping event.
+ *
+ * @param prefix The prefix being mapped.
+ * @param uri The Namespace URI being mapped to.
+ * @see org.xml.sax.ContentHandler#startPrefixMapping
+ */
+ public void startPrefixMapping (String prefix, String uri)
+ {
+ }
+
+
+ /**
+ * Adapt a SAX2 end prefix mapping event.
+ *
+ * @param prefix The prefix being mapped.
+ * @see org.xml.sax.ContentHandler#endPrefixMapping
+ */
+ public void endPrefixMapping (String prefix)
+ {
+ }
+
+
+ /**
+ * Adapt a SAX2 start element event.
+ *
+ * @param uri The Namespace URI.
+ * @param localName The Namespace local name.
+ * @param qName The qualified (prefixed) name.
+ * @param atts The SAX2 attributes.
+ * @exception org.xml.sax.SAXException The client may raise a
+ * processing exception.
+ * @see org.xml.sax.ContentHandler#endDocument
+ */
+ public void startElement (String uri, String localName,
+ String qName, Attributes atts)
+ throws SAXException
+ {
+ if (documentHandler != null) {
+ qAtts.setAttributes(atts);
+ documentHandler.startElement(qName, qAtts);
+ }
+ }
+
+
+ /**
+ * Adapt a SAX2 end element event.
+ *
+ * @param uri The Namespace URI.
+ * @param localName The Namespace local name.
+ * @param qName The qualified (prefixed) name.
+ * @exception org.xml.sax.SAXException The client may raise a
+ * processing exception.
+ * @see org.xml.sax.ContentHandler#endElement
+ */
+ public void endElement (String uri, String localName,
+ String qName)
+ throws SAXException
+ {
+ if (documentHandler != null)
+ documentHandler.endElement(qName);
+ }
+
+
+ /**
+ * Adapt a SAX2 characters event.
+ *
+ * @param ch An array of characters.
+ * @param start The starting position in the array.
+ * @param length The number of characters to use.
+ * @exception org.xml.sax.SAXException The client may raise a
+ * processing exception.
+ * @see org.xml.sax.ContentHandler#characters
+ */
+ public void characters (char ch[], int start, int length)
+ throws SAXException
+ {
+ if (documentHandler != null)
+ documentHandler.characters(ch, start, length);
+ }
+
+
+ /**
+ * Adapt a SAX2 ignorable whitespace event.
+ *
+ * @param ch An array of characters.
+ * @param start The starting position in the array.
+ * @param length The number of characters to use.
+ * @exception org.xml.sax.SAXException The client may raise a
+ * processing exception.
+ * @see org.xml.sax.ContentHandler#ignorableWhitespace
+ */
+ public void ignorableWhitespace (char ch[], int start, int length)
+ throws SAXException
+ {
+ if (documentHandler != null)
+ documentHandler.ignorableWhitespace(ch, start, length);
+ }
+
+
+ /**
+ * Adapt a SAX2 processing instruction event.
+ *
+ * @param target The processing instruction target.
+ * @param data The remainder of the processing instruction
+ * @exception org.xml.sax.SAXException The client may raise a
+ * processing exception.
+ * @see org.xml.sax.ContentHandler#processingInstruction
+ */
+ public void processingInstruction (String target, String data)
+ throws SAXException
+ {
+ if (documentHandler != null)
+ documentHandler.processingInstruction(target, data);
+ }
+
+
+ /**
+ * Adapt a SAX2 skipped entity event.
+ *
+ * @param name The name of the skipped entity.
+ * @see org.xml.sax.ContentHandler#skippedEntity
+ * @exception org.xml.sax.SAXException Throwable by subclasses.
+ */
+ public void skippedEntity (String name)
+ throws SAXException
+ {
+ }
+
+
+
+ ////////////////////////////////////////////////////////////////////
+ // Internal state.
+ ////////////////////////////////////////////////////////////////////
+
+ XMLReader xmlReader;
+ DocumentHandler documentHandler;
+ AttributesAdapter qAtts;
+
+
+
+ ////////////////////////////////////////////////////////////////////
+ // Internal class.
+ ////////////////////////////////////////////////////////////////////
+
+
+ /**
+ * Internal class to wrap a SAX2 Attributes object for SAX1.
+ */
+ final class AttributesAdapter implements AttributeList
+ {
+ AttributesAdapter ()
+ {
+ }
+
+
+ /**
+ * Set the embedded Attributes object.
+ *
+ * @param The embedded SAX2 Attributes.
+ */
+ void setAttributes (Attributes attributes)
+ {
+ this.attributes = attributes;
+ }
+
+
+ /**
+ * Return the number of attributes.
+ *
+ * @return The length of the attribute list.
+ * @see org.xml.sax.AttributeList#getLength
+ */
+ public int getLength ()
+ {
+ return attributes.getLength();
+ }
+
+
+ /**
+ * Return the qualified (prefixed) name of an attribute by position.
+ *
+ * @return The qualified name.
+ * @see org.xml.sax.AttributeList#getName
+ */
+ public String getName (int i)
+ {
+ return attributes.getQName(i);
+ }
+
+
+ /**
+ * Return the type of an attribute by position.
+ *
+ * @return The type.
+ * @see org.xml.sax.AttributeList#getType(int)
+ */
+ public String getType (int i)
+ {
+ return attributes.getType(i);
+ }
+
+
+ /**
+ * Return the value of an attribute by position.
+ *
+ * @return The value.
+ * @see org.xml.sax.AttributeList#getValue(int)
+ */
+ public String getValue (int i)
+ {
+ return attributes.getValue(i);
+ }
+
+
+ /**
+ * Return the type of an attribute by qualified (prefixed) name.
+ *
+ * @return The type.
+ * @see org.xml.sax.AttributeList#getType(java.lang.String)
+ */
+ public String getType (String qName)
+ {
+ return attributes.getType(qName);
+ }
+
+
+ /**
+ * Return the value of an attribute by qualified (prefixed) name.
+ *
+ * @return The value.
+ * @see org.xml.sax.AttributeList#getValue(java.lang.String)
+ */
+ public String getValue (String qName)
+ {
+ return attributes.getValue(qName);
+ }
+
+ private Attributes attributes;
+ }
+
+}
+
+// end of XMLReaderAdapter.java
diff --git a/libjava/org/xml/sax/helpers/XMLReaderFactory.java b/libjava/org/xml/sax/helpers/XMLReaderFactory.java
index 9443b27dcca..e1fa80c84cf 100644
--- a/libjava/org/xml/sax/helpers/XMLReaderFactory.java
+++ b/libjava/org/xml/sax/helpers/XMLReaderFactory.java
@@ -1,136 +1,203 @@
-// XMLReaderFactory.java - factory for creating a new reader.
-// Written by David Megginson, sax@megginson.com
-// NO WARRANTY! This class is in the Public Domain.
-
-// $Id: XMLReaderFactory.java,v 1.1 2000/10/02 02:43:20 sboag Exp $
-
-package org.xml.sax.helpers;
-import org.xml.sax.Parser;
-import org.xml.sax.XMLReader;
-import org.xml.sax.SAXException;
-
-
-/**
- * Factory for creating an XML reader.
- *
- * <blockquote>
- * <em>This module, both source code and documentation, is in the
- * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
- * </blockquote>
- *
- * <p>This class contains static methods for creating an XML reader
- * from an explicit class name, or for creating an XML reader based
- * on the value of the <code>org.xml.sax.driver</code> system
- * property:</p>
- *
- * <pre>
- * try {
- * XMLReader myReader = XMLReaderFactory.createXMLReader();
- * } catch (SAXException e) {
- * System.err.println(e.getMessage());
- * }
- * </pre>
- *
- * <p>Note that these methods will not be usable in environments where
- * system properties are not accessible or where the application or
- * applet is not permitted to load classes dynamically.</p>
- *
- * <p><strong>Note to implementors:</strong> SAX implementations in specialized
- * environments may replace this class with a different one optimized for the
- * environment, as long as its method signatures remain the same.</p>
- *
- * @since SAX 2.0
- * @author David Megginson,
- * <a href="mailto:sax@megginson.com">sax@megginson.com</a>
- * @version 2.0
- * @see org.xml.sax.XMLReader
- */
-final public class XMLReaderFactory
-{
-
- /**
- * Private constructor.
- *
- * <p>This constructor prevents the class from being instantiated.</p>
- */
- private XMLReaderFactory ()
- {
- }
-
-
- /**
- * Attempt to create an XML reader from a system property.
- *
- * <p>This method uses the value of the system property
- * "org.xml.sax.driver" as the full name of a Java class
- * and tries to instantiate that class as a SAX2
- * XMLReader.</p>
- *
- * <p>Note that many Java interpreters allow system properties
- * to be specified on the command line.</p>
- *
- * @return A new XMLReader.
- * @exception org.xml.sax.SAXException If the value of the
- * "org.xml.sax.driver" system property is null,
- * or if the class cannot be loaded and instantiated.
- * @see #createXMLReader(java.lang.String)
- */
- public static XMLReader createXMLReader ()
- throws SAXException
- {
- String className = System.getProperty("org.xml.sax.driver");
- if (className == null) {
- Parser parser;
- try {
- parser = ParserFactory.makeParser();
- } catch (Exception e) {
- parser = null;
- }
- if (parser == null) {
- throw new
- SAXException("System property org.xml.sax.driver not specified");
- } else {
- return new ParserAdapter(parser);
- }
- } else {
- return createXMLReader(className);
- }
- }
-
-
- /**
- * Attempt to create an XML reader from a class name.
- *
- * <p>Given a class name, this method attempts to load
- * and instantiate the class as an XML reader.</p>
- *
- * @return A new XML reader.
- * @exception org.xml.sax.SAXException If the class cannot be
- * loaded, instantiated, and cast to XMLReader.
- * @see #createXMLReader()
- */
- public static XMLReader createXMLReader (String className)
- throws SAXException
- {
- try {
- return (XMLReader)(Class.forName(className).newInstance());
- } catch (ClassNotFoundException e1) {
- throw new SAXException("SAX2 driver class " + className +
- " not found", e1);
- } catch (IllegalAccessException e2) {
- throw new SAXException("SAX2 driver class " + className +
- " found but cannot be loaded", e2);
- } catch (InstantiationException e3) {
- throw new SAXException("SAX2 driver class " + className +
- " loaded but cannot be instantiated (no empty public constructor?)",
- e3);
- } catch (ClassCastException e4) {
- throw new SAXException("SAX2 driver class " + className +
- " does not implement XMLReader", e4);
- }
-
- }
-
-}
-
-// end of XMLReaderFactory.java
+// XMLReaderFactory.java - factory for creating a new reader.
+// http://www.saxproject.org
+// Written by David Megginson
+// and by David Brownell
+// NO WARRANTY! This class is in the Public Domain.
+
+// $Id: XMLReaderFactory.java,v 1.5.2.4 2002/01/29 21:34:15 dbrownell Exp $
+
+package org.xml.sax.helpers;
+import java.io.BufferedReader;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import org.xml.sax.XMLReader;
+import org.xml.sax.SAXException;
+
+
+/**
+ * Factory for creating an XML reader.
+ *
+ * <blockquote>
+ * <em>This module, both source code and documentation, is in the
+ * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
+ * See <a href='http://www.saxproject.org'>http://www.saxproject.org</a>
+ * for further information.
+ * </blockquote>
+ *
+ * <p>This class contains static methods for creating an XML reader
+ * from an explicit class name, or based on runtime defaults:</p>
+ *
+ * <pre>
+ * try {
+ * XMLReader myReader = XMLReaderFactory.createXMLReader();
+ * } catch (SAXException e) {
+ * System.err.println(e.getMessage());
+ * }
+ * </pre>
+ *
+ * <p><strong>Note to Distributions bundled with parsers:</strong>
+ * You should modify the implementation of the no-arguments
+ * <em>createXMLReader</em> to handle cases where the external
+ * configuration mechanisms aren't set up. That method should do its
+ * best to return a parser when one is in the class path, even when
+ * nothing bound its class name to <code>org.xml.sax.driver</code> so
+ * those configuration mechanisms would see it.</p>
+ *
+ * @since SAX 2.0
+ * @author David Megginson, David Brownell
+ * @version 2.0.1 (sax2r2)
+ */
+final public class XMLReaderFactory
+{
+ /**
+ * Private constructor.
+ *
+ * <p>This constructor prevents the class from being instantiated.</p>
+ */
+ private XMLReaderFactory ()
+ {
+ }
+
+ private static final String property = "org.xml.sax.driver";
+
+ /**
+ * Attempt to create an XMLReader from system defaults.
+ * In environments which can support it, the name of the XMLReader
+ * class is determined by trying each these options in order, and
+ * using the first one which succeeds:</p> <ul>
+ *
+ * <li>If the system property <code>org.xml.sax.driver</code>
+ * has a value, that is used as an XMLReader class name. </li>
+ *
+ * <li>The JAR "Services API" is used to look for a class name
+ * in the <em>META-INF/services/org.xml.sax.driver</em> file in
+ * jarfiles available to the runtime.</li>
+ *
+ * <li> SAX parser distributions are strongly encouraged to provide
+ * a default XMLReader class name that will take effect only when
+ * previous options (on this list) are not successful.</li>
+ *
+ * <li>Finally, if {@link ParserFactory#makeParser()} can
+ * return a system default SAX1 parser, that parser is wrapped in
+ * a {@link ParserAdapter}. (This is a migration aid for SAX1
+ * environments, where the <code>org.xml.sax.parser</code> system
+ * property will often be usable.) </li>
+ *
+ * </ul>
+ *
+ * <p> In environments such as small embedded systems, which can not
+ * support that flexibility, other mechanisms to determine the default
+ * may be used. </p>
+ *
+ * <p>Note that many Java environments allow system properties to be
+ * initialized on a command line. This means that <em>in most cases</em>
+ * setting a good value for that property ensures that calls to this
+ * method will succeed, except when security policies intervene.
+ * This will also maximize application portability to older SAX
+ * environments, with less robust implementations of this method.
+ * </p>
+ *
+ * @return A new XMLReader.
+ * @exception org.xml.sax.SAXException If no default XMLReader class
+ * can be identified and instantiated.
+ * @see #createXMLReader(java.lang.String)
+ */
+ public static XMLReader createXMLReader ()
+ throws SAXException
+ {
+ String className = null;
+ ClassLoader loader = NewInstance.getClassLoader ();
+
+ // 1. try the JVM-instance-wide system property
+ try { className = System.getProperty (property); }
+ catch (Exception e) { /* normally fails for applets */ }
+
+ // 2. if that fails, try META-INF/services/
+ if (className == null) {
+ try {
+ String service = "META-INF/services/" + property;
+ InputStream in;
+ BufferedReader reader;
+
+ if (loader == null)
+ in = ClassLoader.getSystemResourceAsStream (service);
+ else
+ in = loader.getResourceAsStream (service);
+
+ if (in != null) {
+ reader = new BufferedReader (
+ new InputStreamReader (in, "UTF8"));
+ className = reader.readLine ();
+ in.close ();
+ }
+ } catch (Exception e) {
+ }
+ }
+
+ // 3. Distro-specific fallback
+ if (className == null) {
+// BEGIN DISTRIBUTION-SPECIFIC
+
+ // EXAMPLE:
+ // className = "com.example.sax.XmlReader";
+ // or a $JAVA_HOME/jre/lib/*properties setting...
+
+// END DISTRIBUTION-SPECIFIC
+ }
+
+ // do we know the XMLReader implementation class yet?
+ if (className != null)
+ return loadClass (loader, className);
+
+ // 4. panic -- adapt any SAX1 parser
+ try {
+ return new ParserAdapter (ParserFactory.makeParser ());
+ } catch (Exception e) {
+ throw new SAXException ("Can't create default XMLReader; "
+ + "is system property org.xml.sax.driver set?");
+ }
+ }
+
+
+ /**
+ * Attempt to create an XML reader from a class name.
+ *
+ * <p>Given a class name, this method attempts to load
+ * and instantiate the class as an XML reader.</p>
+ *
+ * <p>Note that this method will not be usable in environments where
+ * the caller (perhaps an applet) is not permitted to load classes
+ * dynamically.</p>
+ *
+ * @return A new XML reader.
+ * @exception org.xml.sax.SAXException If the class cannot be
+ * loaded, instantiated, and cast to XMLReader.
+ * @see #createXMLReader()
+ */
+ public static XMLReader createXMLReader (String className)
+ throws SAXException
+ {
+ return loadClass (NewInstance.getClassLoader (), className);
+ }
+
+ private static XMLReader loadClass (ClassLoader loader, String className)
+ throws SAXException
+ {
+ try {
+ return (XMLReader) NewInstance.newInstance (loader, className);
+ } catch (ClassNotFoundException e1) {
+ throw new SAXException("SAX2 driver class " + className +
+ " not found", e1);
+ } catch (IllegalAccessException e2) {
+ throw new SAXException("SAX2 driver class " + className +
+ " found but cannot be loaded", e2);
+ } catch (InstantiationException e3) {
+ throw new SAXException("SAX2 driver class " + className +
+ " loaded but cannot be instantiated (no empty public constructor?)",
+ e3);
+ } catch (ClassCastException e4) {
+ throw new SAXException("SAX2 driver class " + className +
+ " does not implement XMLReader", e4);
+ }
+ }
+}
diff --git a/libjava/org/xml/sax/helpers/package.html b/libjava/org/xml/sax/helpers/package.html
new file mode 100644
index 00000000000..458d1229c47
--- /dev/null
+++ b/libjava/org/xml/sax/helpers/package.html
@@ -0,0 +1,13 @@
+<HTML><HEAD>
+
+<!-- $Id: package.html,v 1.3.2.1 2001/11/09 20:32:58 dbrownell Exp $ -->
+
+</HEAD><BODY>
+
+<p>This package contains "helper" classes, including
+support for bootstrapping SAX-based applications.
+
+<p>See <a href='http://www.saxproject.org'>http://www.saxproject.org</a>
+for more information about SAX.</p>
+
+</BODY></HTML>
diff --git a/libjava/org/xml/sax/package.html b/libjava/org/xml/sax/package.html
new file mode 100644
index 00000000000..25f4b86cdf3
--- /dev/null
+++ b/libjava/org/xml/sax/package.html
@@ -0,0 +1,164 @@
+<html><head>
+
+<!-- $Id: package.html,v 1.2.2.2 2002/01/12 21:42:21 dbrownell Exp $ -->
+
+</head><body>
+
+<p> This package provides the core SAX APIs.
+Some SAX1 APIs are deprecated to encourage integration of
+namespace-awareness into designs of new applications
+and into maintainance of existing infrastructure. </p>
+
+<p>See <a href='http://www.saxproject.org'>http://www.saxproject.org</a>
+for more information about SAX.</p>
+
+
+<h2> SAX2 Standard Feature Flags </h2>
+
+<p> One of the essential characteristics of SAX2 is that it added
+feature flags which can be used to examine and perhaps modify
+parser modes, in particular modes such as validation.
+Since features are identified by (absolute) URIs, anyone
+can define such features.
+Currently defined standard feature URIs have the prefix
+<code>http://xml.org/sax/features/</code> before an identifier such as
+<code>validation</code>. Turn features on or off using
+<em>setFeature</em>. Those standard identifiers are: </p>
+
+
+<table border="1" cellpadding="3" cellspacing="0" width="100%">
+ <tr align="center" bgcolor="#ccccff">
+ <th>Feature ID</th>
+ <th>Default</th>
+ <th>Description</th>
+ </tr>
+
+ <tr>
+ <td>external-general-entities</td>
+ <td><em>unspecified</em></td>
+ <td> Reports whether this parser processes external
+ general entities; always true if validating</td>
+ </tr>
+
+ <tr>
+ <td>external-parameter-entities</td>
+ <td><em>unspecified</em></td>
+ <td> Reports whether this parser processes external
+ parameter entities; always true if validating</td>
+ </tr>
+
+ <tr>
+ <td>lexical-handler/parameter-entities</td>
+ <td><em>unspecified</em></td>
+ <td> true indicates that the LexicalHandler will report the
+ beginning and end of parameter entities
+ </td>
+ </tr>
+
+ <tr>
+ <td>namespaces</td>
+ <td>true</td>
+ <td> true indicates namespace URIs and unprefixed local names
+ for element and attribute names will be available </td>
+ </tr>
+
+ <tr>
+ <td>namespace-prefixes</td>
+ <td>false</td>
+ <td> true indicates XML 1.0 names (with prefixes) and attributes
+ (including <em>xmlns*</em> attributes) will be available </td>
+ </tr>
+
+ <tr>
+ <td>string-interning</td>
+ <td><em>unspecified</em></td>
+ <td> true if all XML names (for elements, prefixes, attributes,
+ entities, notations, and local names),
+ as well as Namespace URIs, will have been interned
+ using <em>java.lang.String.intern</em>. This supports fast
+ testing of equality/inequality against string constants.</td>
+ </tr>
+
+ <tr>
+ <td>validation</td>
+ <td><em>unspecified</em></td>
+ <td> controls whether the parser is reporting all validity
+ errors; if true, all external entities will be read. </td>
+ </tr>
+
+</table>
+
+<p> Support for the default values of the
+<em>namespaces</em> and <em>namespace-prefixes</em>
+properties is required.
+</p>
+
+<p> For default values not specified by SAX2,
+each XMLReader implementation specifies its default,
+or may choose not to expose the feature flag.
+Unless otherwise specified here,
+implementations may support changing current values
+of these standard feature flags, but not while parsing.
+</p>
+
+<h2> SAX2 Standard Handler and Property IDs </h2>
+
+<p> For parser interface characteristics that are described
+as objects, a separate namespace is defined. The
+objects in this namespace are again identified by URI, and
+the standard property URIs have the prefix
+<code>http://xml.org/sax/properties/</code> before an identifier such as
+<code>lexical-handler</code> or
+<code>dom-node</code>. Manage those properties using
+<em>setProperty()</em>. Those identifiers are: </p>
+
+<table border="1" cellpadding="3" cellspacing="0" width="100%">
+ <tr align="center" bgcolor="#ccccff">
+ <th>Property ID</th>
+ <th>Description</th>
+ </tr>
+
+ <tr>
+ <td>declaration-handler</td>
+ <td> Used to see most DTD declarations except those treated
+ as lexical ("document element name is ...") or which are
+ mandatory for all SAX parsers (<em>DTDHandler</em>).
+ The Object must implement <a href="ext/DeclHandler.html"
+ ><em>org.xml.sax.ext.DeclHandler</em></a>.
+ </td>
+ </tr>
+
+ <tr>
+ <td>dom-node</td>
+ <td> For "DOM Walker" style parsers, which ignore their
+ <em>parser.parse()</em> parameters, this is used to
+ specify the DOM (sub)tree being walked by the parser.
+ The Object must implement the
+ <em>org.w3c.dom.Node</em> interface.
+ </td>
+ </tr>
+
+ <tr>
+ <td>lexical-handler</td>
+ <td> Used to see some syntax events that are essential in some
+ applications: comments, CDATA delimeters, selected general
+ entity inclusions, and the start and end of the DTD
+ (and declaration of document element name).
+ The Object must implement <a href="ext/LexicalHandler.html"
+ ><em>org.xml.sax.ext.LexicalHandler</em></a>.
+ </td>
+ </tr>
+
+ <tr>
+ <td>xml-string</td>
+ <td> Readable only during a parser callback, this exposes a <b>TBS</b>
+ chunk of characters responsible for the current event. </td>
+ </tr>
+
+</table>
+
+<p> All of these standard properties are optional;
+XMLReader implementations need not support them.
+</p>
+
+</body></html>
diff --git a/libjava/resolve.cc b/libjava/resolve.cc
index e195c333cc8..8f24c9126b9 100644
--- a/libjava/resolve.cc
+++ b/libjava/resolve.cc
@@ -1,6 +1,6 @@
// resolve.cc - Code for linking and resolving classes and pool entries.
-/* Copyright (C) 1999, 2000, 2001 , 2002 Free Software Foundation
+/* Copyright (C) 1999, 2000, 2001 , 2002, 2003 Free Software Foundation
This file is part of libgcj.
@@ -238,7 +238,7 @@ _Jv_ResolvePoolEntry (jclass klass, int index)
// First search the class itself.
the_method = _Jv_SearchMethodInClass (owner, klass,
- method_name, method_signature);
+ method_name, method_signature);
if (the_method != 0)
{
@@ -246,9 +246,10 @@ _Jv_ResolvePoolEntry (jclass klass, int index)
goto end_of_method_search;
}
- // If we are resolving an interface method, search the interface's
- // superinterfaces (A superinterface is not an interface's superclass -
- // a superinterface is implemented by the interface).
+ // If we are resolving an interface method, search the
+ // interface's superinterfaces (A superinterface is not an
+ // interface's superclass - a superinterface is implemented by
+ // the interface).
if (pool->tags[index] == JV_CONSTANT_InterfaceMethodref)
{
_Jv_ifaces ifaces;
@@ -257,8 +258,8 @@ _Jv_ResolvePoolEntry (jclass klass, int index)
ifaces.list = (jclass *) _Jv_Malloc (ifaces.len * sizeof (jclass *));
_Jv_GetInterfaces (owner, &ifaces);
-
- for (int i=0; i < ifaces.count; i++)
+
+ for (int i = 0; i < ifaces.count; i++)
{
jclass cls = ifaces.list[i];
the_method = _Jv_SearchMethodInClass (cls, klass, method_name,
@@ -269,9 +270,9 @@ _Jv_ResolvePoolEntry (jclass klass, int index)
break;
}
}
-
+
_Jv_Free (ifaces.list);
-
+
if (the_method != 0)
goto end_of_method_search;
}
@@ -281,7 +282,7 @@ _Jv_ResolvePoolEntry (jclass klass, int index)
cls = cls->getSuperclass ())
{
the_method = _Jv_SearchMethodInClass (cls, klass,
- method_name, method_signature);
+ method_name, method_signature);
if (the_method != 0)
{
found_class = cls;
@@ -363,6 +364,58 @@ _Jv_SearchMethodInClass (jclass cls, jclass klass,
return 0;
}
+// A helper for _Jv_PrepareClass. This adds missing `Miranda methods'
+// to a class.
+void
+_Jv_PrepareMissingMethods (jclass base2, jclass iface_class)
+{
+ _Jv_InterpClass *base = reinterpret_cast<_Jv_InterpClass *> (base2);
+ for (int i = 0; i < iface_class->interface_count; ++i)
+ {
+ for (int j = 0; j < iface_class->interfaces[i]->method_count; ++j)
+ {
+ _Jv_Method *meth = &iface_class->interfaces[i]->methods[j];
+ // Don't bother with <clinit>.
+ if (meth->name->data[0] == '<')
+ continue;
+ _Jv_Method *new_meth = _Jv_LookupDeclaredMethod (base, meth->name,
+ meth->signature);
+ if (! new_meth)
+ {
+ // We assume that such methods are very unlikely, so we
+ // just reallocate the method array each time one is
+ // found. This greatly simplifies the searching --
+ // otherwise we have to make sure that each such method
+ // found is really unique among all superinterfaces.
+ int new_count = base->method_count + 1;
+ _Jv_Method *new_m
+ = (_Jv_Method *) _Jv_AllocBytes (sizeof (_Jv_Method)
+ * new_count);
+ memcpy (new_m, base->methods,
+ sizeof (_Jv_Method) * base->method_count);
+
+ // Add new method.
+ new_m[base->method_count] = *meth;
+ new_m[base->method_count].index = (_Jv_ushort) -1;
+ new_m[base->method_count].accflags
+ |= java::lang::reflect::Modifier::INVISIBLE;
+
+ _Jv_MethodBase **new_im
+ = (_Jv_MethodBase **) _Jv_AllocBytes (sizeof (_Jv_MethodBase *)
+ * new_count);
+ memcpy (new_im, base->interpreted_methods,
+ sizeof (_Jv_MethodBase *) * base->method_count);
+
+ base->methods = new_m;
+ base->interpreted_methods = new_im;
+ base->method_count = new_count;
+ }
+ }
+
+ _Jv_PrepareMissingMethods (base, iface_class->interfaces[i]);
+ }
+}
+
void
_Jv_PrepareClass(jclass klass)
{
@@ -516,13 +569,24 @@ _Jv_PrepareClass(jclass klass)
}
}
- if (clz->accflags & Modifier::INTERFACE)
+ if ((clz->accflags & Modifier::INTERFACE))
{
clz->state = JV_STATE_PREPARED;
clz->notifyAll ();
return;
}
+ // A class might have so-called "Miranda methods". This is a method
+ // that is declared in an interface and not re-declared in an
+ // abstract class. Some compilers don't emit declarations for such
+ // methods in the class; this will give us problems since we expect
+ // a declaration for any method requiring a vtable entry. We handle
+ // this here by searching for such methods and constructing new
+ // internal declarations for them. We only need to do this for
+ // abstract classes.
+ if ((clz->accflags & Modifier::ABSTRACT))
+ _Jv_PrepareMissingMethods (clz, clz);
+
clz->vtable_method_count = -1;
_Jv_MakeVTable (clz);
@@ -937,7 +1001,14 @@ _Jv_JNIMethod::ncode ()
memcpy (&jni_arg_types[offset], &closure->arg_types[0],
arg_count * sizeof (ffi_type *));
- if (ffi_prep_cif (&jni_cif, FFI_DEFAULT_ABI,
+ // NOTE: This must agree with the JNICALL definition in jni.h
+#ifdef WIN32
+#define FFI_JNI_ABI FFI_STDCALL
+#else
+#define FFI_JNI_ABI FFI_DEFAULT_ABI
+#endif
+
+ if (ffi_prep_cif (&jni_cif, FFI_JNI_ABI,
extra_args + arg_count, rtype,
jni_arg_types) != FFI_OK)
throw_internal_error ("ffi_prep_cif failed for JNI function");
diff --git a/libjava/testsuite/ChangeLog b/libjava/testsuite/ChangeLog
index 8791dd4ec85..cb4a803d6d2 100644
--- a/libjava/testsuite/ChangeLog
+++ b/libjava/testsuite/ChangeLog
@@ -1,3 +1,104 @@
+2003-02-16 Mark Wielaard <mark@klomp.org>
+
+ * libjava.mauve/xfails: Add Class.reflect2 and String.getBytes FAILs.
+
+2003-02-15 Mark Wielaard <mark@klomp.org>
+
+ * lib/libjava.exp (test_libjava_from_javac): Use regsub not string map.
+ * libjava.mauve/mauve.exp (mauve_compute_uses): Likewise.
+ (test_mauve): Likewise.
+
+2003-02-14 Mark Wielaard <mark@klomp.org>
+
+ * lib/libjava.exp (test_libjava_from_javac): Don't create .o files
+ containing $ characters and always quote class files with "'"s.
+
+2003-02-14 Mark Wielaard <mark@klomp.org>
+
+ * libjava.mauve/mauve.exp (mauve_compute_uses): Add inner class
+ object files by changing all occurances of $ to ^.
+ (test_mauve): Replace ^ with $ for class file names and quote
+ them with "'"s.
+
+2003-02-13 Tom Tromey <tromey@redhat.com>
+
+ * libjava.mauve/xfails: Added entries for an unimplemented Class
+ method.
+
+2003-02-07 Mark Wielaard <mark@klomp.org>
+
+ * libjava.mauve/xfails: Add new entries for
+ gnu.testlet.java.text.CollationElementIterator.jdk11
+
+2003-02-03 Ulrich Weigand <uweigand@de.ibm.com>
+
+ * libjava.jacks/jacks.exp (gcj_jacks_write): Set LD_LIBRARY_PATH
+ to find libgcc_s. Set JAVA_CLASSPATH to find libgcj.jar.
+
+2003-01-31 Mark Wielaard <mark@klomp.org>
+
+ * lib/libjava.exp (libjava_prune_warnings): Remove all unreachable
+ bytecode warnings.
+
+2003-01-28 Tom Tromey <tromey@redhat.com>
+
+ * libjava.jacks/jacks.xfail: More lexer tests now pass.
+
+2003-01-27 Tom Tromey <tromey@redhat.com>
+
+ * libjava.compile/consthrow.java: New file.
+ * libjava.compile/consthrow.xfail: New file.
+
+2003-01-27 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * libjava.lang/pr8823.xfail: New file, add "xfail-byte".
+
+2003-01-24 Ranjit Mathew <rmathew@hotmail.com>
+
+ * libjava.jni/calls.c (Java_calls_docall): Define with
+ JNIEXPORT and JNICALL method attributes.
+ * libjava.jni/field.c (Java_field_fetch): Likewise.
+ * libjava.jni/final_method.c (Java_final_1method_meth): Likewise.
+ * libjava.jni/findclass.c (Java_findclass_doit): Likewise.
+ * libjava.jni/invoke.c (Java_invoke_val): Likewise.
+ * libjava.jni/martin.c (Java_martin_myNative): Likewise.
+ * libjava.jni/noclass.c (Java_noclass_find_1it): Likewise.
+ * libjava.jni/overload.c (Java_overload_over__I): Likewise.
+ (Java_overload_over__II): Likewise.
+ * libjava.jni/register.c (JNI_OnLoad): Likewise.
+ * libjava.jni/simple_int.c (Java_simple_1int_nat): Likewise.
+ * libjava.jni/throwit.c (Java_throwit_throwit): Likewise.
+ * libjava.jni/virtual.c (Java_virtual_equals): Likewise.
+
+2003-01-21 Tom Tromey <tromey@redhat.com>
+
+ * libjava.jacks/jacks.xfail: All 8.4.3 tests and 9.4-modifier-10
+ now pass.
+
+2003-01-12 Tom Tromey <tromey@redhat.com>
+
+ Fix for PR libgcj/9139:
+ * lib/libjava.exp (find_javac): Put value of libgcj_jar into
+ return value when gcj is used.
+ * libjava.mauve/mauve.exp (test_mauve): Use libgcj_jar global.
+
+2003-01-03 Tom Tromey <tromey@redhat.com>
+
+ * libjava.compile/pr8712.java: New file, for PR java/8712.
+
+2003-01-01 Tom Tromey <tromey@redhat.com>
+
+ * libjava.compile/pr8955.java: New test, for PR java/8955.
+
+2002-12-19 Tom Tromey <tromey@redhat.com>
+
+ * libjava.jacks/jacks.xfail: Updated.
+
+2002-12-18 Tom Tromey <tromey@redhat.com>
+
+ * libjava.lang/pr8945.java: New file.
+ * libjava.lang/pr8945.out: New file.
+
2002-12-12 Tom Tromey <tromey@redhat.com>
* libjava.loader/loader.exp (gcj_loader_test_one): Use
diff --git a/libjava/testsuite/Makefile.in b/libjava/testsuite/Makefile.in
index e5ed9768763..2a03eb229a5 100644
--- a/libjava/testsuite/Makefile.in
+++ b/libjava/testsuite/Makefile.in
@@ -65,6 +65,7 @@ target_alias = @target_alias@
target_triplet = @target@
AR = @AR@
AS = @AS@
+BACKTRACESPEC = @BACKTRACESPEC@
CC = @CC@
CHECKREFSPEC = @CHECKREFSPEC@
COMPPATH = @COMPPATH@
@@ -129,6 +130,9 @@ here = @here@
libgcj_basedir = @libgcj_basedir@
mkinstalldirs = @mkinstalldirs@
tool_include_dir = @tool_include_dir@
+toolexecdir = @toolexecdir@
+toolexeclibdir = @toolexeclibdir@
+toolexecmainlibdir = @toolexecmainlibdir@
AUTOMAKE_OPTIONS = foreign dejagnu
diff --git a/libjava/testsuite/lib/libjava.exp b/libjava/testsuite/lib/libjava.exp
index a807c4c8d60..6be5ec67662 100644
--- a/libjava/testsuite/lib/libjava.exp
+++ b/libjava/testsuite/lib/libjava.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation
+# Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation
load_lib "libgloss.exp"
@@ -18,9 +18,15 @@ proc libjava_prune_warnings {text} {
set len [llength $tlist]
for {set i [expr {$len - 1}]} {$i >= 2} {incr i -1} {
if {[string match "*unreachable bytecode*" [lindex $tlist $i]]} {
- # Delete this line and the previous two lines.
- set tlist [lreplace $tlist [expr {$i - 2}] $i]
- incr i -2
+ # Delete this line, all other unreachable warnings and the previous
+ # two lines containing the method and class.
+ set j [expr {$i - 1}]
+ while {[string match "*unreachable bytecode*" [lindex $tlist $j]]} {
+ incr j -1
+ }
+ incr j -1
+ set tlist [lreplace $tlist $j $i]
+ set i $j
}
}
return [join $tlist \n]
@@ -74,7 +80,7 @@ proc find_gcjh {} {
}
proc find_javac {} {
- global SUN_JAVAC GCJ_UNDER_TEST env
+ global SUN_JAVAC GCJ_UNDER_TEST env libgcj_jar
# If JDK doesn't run on your platform but some other
# JDK-compatible javac does, you may set SUN_JAVAC to point to it.
# One of the most important properties of a SUN_JAVAC is that it
@@ -87,7 +93,7 @@ proc find_javac {} {
if {[info exists env(SUN_JAVAC)]} {
set SUN_JAVAC $env(SUN_JAVAC)
} else {
- set SUN_JAVAC "$GCJ_UNDER_TEST -C"
+ set SUN_JAVAC "$GCJ_UNDER_TEST -C -I$libgcj_jar"
}
}
return $SUN_JAVAC
@@ -781,8 +787,10 @@ proc test_libjava_from_javac { options srcfile compile_args inpfile resultfile e
if {$mode == "compile"} {
foreach c_file $class_files {
set executable [file rootname [file tail $c_file]].o
+ # Don't write files which contain $ chars.
+ regsub -all "\\$" $executable "\^" executable
set x [libjava_prune_warnings \
- [libjava_tcompile $c_file "$executable" $type $args]]
+ [libjava_tcompile '$c_file' "$executable" $type $args]]
lappend removeList $executable
if {$x != ""} {
break
diff --git a/libjava/testsuite/libjava.compile/consthrow.java b/libjava/testsuite/libjava.compile/consthrow.java
new file mode 100644
index 00000000000..02d1afc01dd
--- /dev/null
+++ b/libjava/testsuite/libjava.compile/consthrow.java
@@ -0,0 +1,6 @@
+public class consthrow
+{
+ public consthrow () throws Object
+ {
+ }
+}
diff --git a/libjava/testsuite/libjava.compile/consthrow.xfail b/libjava/testsuite/libjava.compile/consthrow.xfail
new file mode 100644
index 00000000000..f34b59d3181
--- /dev/null
+++ b/libjava/testsuite/libjava.compile/consthrow.xfail
@@ -0,0 +1,2 @@
+no-link
+shouldfail
diff --git a/libjava/testsuite/libjava.compile/pr8712.java b/libjava/testsuite/libjava.compile/pr8712.java
new file mode 100644
index 00000000000..7a6eb754d90
--- /dev/null
+++ b/libjava/testsuite/libjava.compile/pr8712.java
@@ -0,0 +1,7 @@
+public class pr8712
+{
+ boolean x(pr8712 a)
+ {
+ return (!(a instanceof pr8712));
+ }
+}
diff --git a/libjava/testsuite/libjava.compile/pr8955.java b/libjava/testsuite/libjava.compile/pr8955.java
new file mode 100644
index 00000000000..ae78f503f9c
--- /dev/null
+++ b/libjava/testsuite/libjava.compile/pr8955.java
@@ -0,0 +1,13 @@
+public class pr8955
+{
+ static final int val = Integer.MIN_VALUE;
+ void foo()
+ {
+ switch(1) {
+ case val:
+ break;
+ case 1:
+ break;
+ }
+ }
+}
diff --git a/libjava/testsuite/libjava.jacks/jacks.exp b/libjava/testsuite/libjava.jacks/jacks.exp
index b7f87eb6316..d8611f5e438 100644
--- a/libjava/testsuite/libjava.jacks/jacks.exp
+++ b/libjava/testsuite/libjava.jacks/jacks.exp
@@ -14,6 +14,9 @@ proc gcj_jacks_setup_xfail {ary} {
proc gcj_jacks_write {filename} {
global GCJ_UNDER_TEST
+ global libgcj_jar
+ global libjava_libgcc_s_path
+ global original_ld_library_path
set gcjl [split $GCJ_UNDER_TEST]
set gcj_cmd [lindex $gcjl 0]
@@ -22,7 +25,7 @@ proc gcj_jacks_write {filename} {
set fd [open $filename w]
puts $fd "set JAVAC $gcj_cmd"
- puts $fd "set JAVA_CLASSPATH \"\""
+ puts $fd "set JAVA_CLASSPATH \"$libgcj_jar\""
puts $fd "set JAVAC_FLAGS [list $rest]"
puts $fd "set JAVA [list [libjava_find_gij]]"
puts $fd "set JAVA_FLAGS \"\""
@@ -32,6 +35,8 @@ proc gcj_jacks_write {filename} {
# "Time-consuming JVM limitation tests".
# puts $fd "set tcltest::testConstraints(jvm) 1"
close $fd
+
+ setenv LD_LIBRARY_PATH $libjava_libgcc_s_path:$original_ld_library_path
}
proc gcj_jacks_parse {file} {
diff --git a/libjava/testsuite/libjava.jacks/jacks.xfail b/libjava/testsuite/libjava.jacks/jacks.xfail
index 8e2ebe77f0e..74dd9196187 100644
--- a/libjava/testsuite/libjava.jacks/jacks.xfail
+++ b/libjava/testsuite/libjava.jacks/jacks.xfail
@@ -151,12 +151,8 @@
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.1.3-superclass-5
+8.1.3-superclass-6
8.2-accessibility-inherited-member-5
8.8.5.1-example-1
8.8.5.1-example-3
@@ -218,9 +214,14 @@
8.6-checked-exception-10
8.6-checked-exception-11
8.6-checked-exception-12
+8.6-complete-1
+8.6-complete-4
+8.6-complete-5
8.6-abrupt-1
8.6-abrupt-4
-8.5-inheritance-4
+8.5-inheritance-1
+8.5-inheritance-2
+8.5-inheritance-3
8.5-inheritance-6
8.5.2-non-static-member-usage-2
8.4.6-miranda-2
@@ -257,11 +258,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
+8.7-complete-1
+8.7-complete-3
5.1.3-dti-1
5.1.3-dti-2
5.1.3-fti-1
@@ -448,7 +447,7 @@
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-unqualified-concrete-14
15.9.1-qualified-concrete-6
15.9.1-qualified-concrete-7
15.9.1-qualified-concrete-10
@@ -456,7 +455,7 @@
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.9.1-qualified-concrete-24
15.28-primitive-9
15.28-primitive-15
15.28-primitive-16
@@ -589,7 +588,6 @@
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
@@ -601,9 +599,6 @@
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
@@ -616,46 +611,7 @@
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
@@ -666,10 +622,6 @@
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
@@ -680,10 +632,6 @@
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
@@ -711,14 +659,14 @@
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.4.1-simple-10
+6.5.4.1-simple-11
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-4
6.5.5.2-type-5
6.5.5.2-type-6
6.5.5.2-type-7
@@ -733,9 +681,10 @@
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.4.2-subpackage-1
+7.4.2-subpackage-2
7.5.1-canonical-3
7.5.1-accessible-1
7.5.1-duplicate-4
@@ -743,8 +692,6 @@
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
@@ -805,7 +752,6 @@ non-jls-zip-2
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
@@ -831,11 +777,11 @@ non-jls-zip-2
15.11.1-runtime-static-1
15.11.1-runtime-static-2
15.11.1-runtime-static-3
+15.11.1-runtime-static-4
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
diff --git a/libjava/testsuite/libjava.jni/calls.c b/libjava/testsuite/libjava.jni/calls.c
index 080e5271cfb..dd54005ba18 100644
--- a/libjava/testsuite/libjava.jni/calls.c
+++ b/libjava/testsuite/libjava.jni/calls.c
@@ -1,7 +1,7 @@
#include <stdio.h>
#include <calls.h>
-jint
+JNIEXPORT jint JNICALL
Java_calls_docall (JNIEnv *env, jobject _this)
{
jmethodID method;
diff --git a/libjava/testsuite/libjava.jni/field.c b/libjava/testsuite/libjava.jni/field.c
index 358c293e7c5..bce0cc896e6 100644
--- a/libjava/testsuite/libjava.jni/field.c
+++ b/libjava/testsuite/libjava.jni/field.c
@@ -1,7 +1,7 @@
#include <jni.h>
#include <field.h>
-jobjectArray
+JNIEXPORT jobjectArray JNICALL
Java_field_fetch (JNIEnv *env, jobject this)
{
jclass cls;
diff --git a/libjava/testsuite/libjava.jni/final_method.c b/libjava/testsuite/libjava.jni/final_method.c
index 82977374bcb..76d5ae52827 100644
--- a/libjava/testsuite/libjava.jni/final_method.c
+++ b/libjava/testsuite/libjava.jni/final_method.c
@@ -1,6 +1,6 @@
#include <final_method.h>
-jstring
+JNIEXPORT jstring JNICALL
Java_final_1method_meth (JNIEnv *env, jobject thisv)
{
return (*env)->NewStringUTF (env, "zardoz has spoken");
diff --git a/libjava/testsuite/libjava.jni/findclass.c b/libjava/testsuite/libjava.jni/findclass.c
index 9a71508ab3f..1a58a55fee4 100644
--- a/libjava/testsuite/libjava.jni/findclass.c
+++ b/libjava/testsuite/libjava.jni/findclass.c
@@ -2,7 +2,7 @@
#include <findclass.h>
-jclass
+JNIEXPORT jclass JNICALL
Java_findclass_doit (JNIEnv *env, jclass klass, jstring name)
{
const char *buf = (*env)->GetStringUTFChars (env, name, NULL);
diff --git a/libjava/testsuite/libjava.jni/invoke.c b/libjava/testsuite/libjava.jni/invoke.c
index 35a446eae25..c2b78d239cb 100644
--- a/libjava/testsuite/libjava.jni/invoke.c
+++ b/libjava/testsuite/libjava.jni/invoke.c
@@ -1,6 +1,6 @@
#include <invoke.h>
-jint
+JNIEXPORT jint JNICALL
Java_invoke_val (JNIEnv *env, jclass klass)
{
return 23;
diff --git a/libjava/testsuite/libjava.jni/martin.c b/libjava/testsuite/libjava.jni/martin.c
index 947bd452c04..0fbb8d0aa73 100644
--- a/libjava/testsuite/libjava.jni/martin.c
+++ b/libjava/testsuite/libjava.jni/martin.c
@@ -2,7 +2,8 @@
#include "martin.h"
#include <stdio.h>
-void Java_martin_myNative(JNIEnv* env, jobject this, jstring s)
+JNIEXPORT void JNICALL
+Java_martin_myNative(JNIEnv* env, jobject this, jstring s)
{
jclass cls;
jfieldID fid;
diff --git a/libjava/testsuite/libjava.jni/noclass.c b/libjava/testsuite/libjava.jni/noclass.c
index 5f2caf428ae..87c649c30e6 100644
--- a/libjava/testsuite/libjava.jni/noclass.c
+++ b/libjava/testsuite/libjava.jni/noclass.c
@@ -1,6 +1,6 @@
#include <noclass.h>
-void
+JNIEXPORT void JNICALL
Java_noclass_find_1it (JNIEnv *env, jclass k)
{
/* We cause an exception by asking for a class we know does not
diff --git a/libjava/testsuite/libjava.jni/overload.c b/libjava/testsuite/libjava.jni/overload.c
index d171fc3ac9b..4e7a2d9289b 100644
--- a/libjava/testsuite/libjava.jni/overload.c
+++ b/libjava/testsuite/libjava.jni/overload.c
@@ -1,13 +1,13 @@
#include <overload.h>
-jint
+JNIEXPORT jint JNICALL
Java_overload_over__I (JNIEnv *env, jclass klass, jint val)
{
return val;
}
-jint
+JNIEXPORT jint JNICALL
Java_overload_over__II (JNIEnv *env, jclass klass, jint one, jint two)
{
return one + two;
diff --git a/libjava/testsuite/libjava.jni/register.c b/libjava/testsuite/libjava.jni/register.c
index 738182cf0f6..0490902420e 100644
--- a/libjava/testsuite/libjava.jni/register.c
+++ b/libjava/testsuite/libjava.jni/register.c
@@ -8,7 +8,7 @@ some_random_name (JNIEnv *env, jclass k, jint v)
return v - 1;
}
-jint
+JNIEXPORT jint JNICALL
JNI_OnLoad (JavaVM *vm, void *nothing)
{
JNIEnv *env;
diff --git a/libjava/testsuite/libjava.jni/simple_int.c b/libjava/testsuite/libjava.jni/simple_int.c
index a86f2d2babd..a7c64b0cd5f 100644
--- a/libjava/testsuite/libjava.jni/simple_int.c
+++ b/libjava/testsuite/libjava.jni/simple_int.c
@@ -1,6 +1,6 @@
#include <simple_int.h>
-jint
+JNIEXPORT jint JNICALL
Java_simple_1int_nat (JNIEnv *env, jclass klass, jint val)
{
return 2 * val;
diff --git a/libjava/testsuite/libjava.jni/throwit.c b/libjava/testsuite/libjava.jni/throwit.c
index 0b02459b464..34a3ca07676 100644
--- a/libjava/testsuite/libjava.jni/throwit.c
+++ b/libjava/testsuite/libjava.jni/throwit.c
@@ -1,7 +1,7 @@
#include <stdlib.h>
#include <throwit.h>
-void
+JNIEXPORT void JNICALL
Java_throwit_throwit (JNIEnv *env, jclass klass, jstring name,
jboolean is_new)
{
diff --git a/libjava/testsuite/libjava.jni/virtual.c b/libjava/testsuite/libjava.jni/virtual.c
index bda837df102..0246970835b 100644
--- a/libjava/testsuite/libjava.jni/virtual.c
+++ b/libjava/testsuite/libjava.jni/virtual.c
@@ -1,6 +1,6 @@
#include <virtual.h>
-jboolean
+JNIEXPORT jboolean JNICALL
Java_virtual_equals (JNIEnv *env, jobject thisv, jobject other)
{
return JNI_FALSE;
diff --git a/libjava/testsuite/libjava.lang/pr8823.xfail b/libjava/testsuite/libjava.lang/pr8823.xfail
new file mode 100644
index 00000000000..81d6df0a027
--- /dev/null
+++ b/libjava/testsuite/libjava.lang/pr8823.xfail
@@ -0,0 +1 @@
+xfail-byte
diff --git a/libjava/testsuite/libjava.lang/pr8945.java b/libjava/testsuite/libjava.lang/pr8945.java
new file mode 100644
index 00000000000..9c5dce89a4a
--- /dev/null
+++ b/libjava/testsuite/libjava.lang/pr8945.java
@@ -0,0 +1,9 @@
+public class pr8945
+{
+ public static void main(String[] args)
+ {
+ String foo = "hello";
+ int pos = 3;
+ System.out.println(foo.substring(pos,++pos));
+ }
+}
diff --git a/libjava/testsuite/libjava.lang/pr8945.out b/libjava/testsuite/libjava.lang/pr8945.out
new file mode 100644
index 00000000000..1f9d725a9de
--- /dev/null
+++ b/libjava/testsuite/libjava.lang/pr8945.out
@@ -0,0 +1 @@
+l
diff --git a/libjava/testsuite/libjava.mauve/mauve.exp b/libjava/testsuite/libjava.mauve/mauve.exp
index 1ca2884249c..cdc7e21f2dd 100644
--- a/libjava/testsuite/libjava.mauve/mauve.exp
+++ b/libjava/testsuite/libjava.mauve/mauve.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation.
+# Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation.
# Written by Tom Tromey <tromey@cygnus.com>.
# Incorporate Mauve into libjava's DejaGNU test suite framework.
@@ -46,6 +46,13 @@ proc mauve_compute_uses {aName} {
foreach file $ufiles {
set file [file rootname $file].o
lappend uses($item) $file
+ # Now add all inner classes
+ foreach inner [glob -nocomplain [file rootname $file]$*.class] {
+ # Prevent excessive escaping by replacing $ with a ^ in the .o name
+ set inner [file rootname $inner].o
+ regsub -all "\\$" $inner "\^" inner
+ lappend uses($item) $inner
+ }
}
}
@@ -86,25 +93,25 @@ proc test_mauve {} {
set full_srcdir [pwd]
cd $here/mauve-build
- global env
- global GCJ_UNDER_TEST
- global TOOL_EXECUTABLE
+ global env libgcj_jar
+ global GCJ_UNDER_TEST
+ global TOOL_EXECUTABLE
- if ![info exists GCJ_UNDER_TEST] {
- if [info exists TOOL_EXECUTABLE] {
- set GCJ_UNDER_TEST $TOOL_EXECUTABLE;
- } else {
- if [info exists env(GCJ)] {
- set GCJ_UNDER_TEST env(GCJ)
- } else {
- set GCJ_UNDER_TEST "[find_gcj]"
- }
- }
+ if ![info exists GCJ_UNDER_TEST] {
+ if [info exists TOOL_EXECUTABLE] {
+ set GCJ_UNDER_TEST $TOOL_EXECUTABLE;
+ } else {
+ if [info exists env(GCJ)] {
+ set GCJ_UNDER_TEST env(GCJ)
+ } else {
+ set GCJ_UNDER_TEST "[find_gcj]"
+ }
}
+ }
- # Append -B and -I so that libgcj.spec and libgcj.zip are found
- # before they're installed.
- set env(GCJ) "$GCJ_UNDER_TEST -B$objdir/../ -I$objdir/../libgcj.jar"
+ # Append -B and -I so that libgcj.spec and libgcj.jar are found
+ # before they're installed.
+ set env(GCJ) "$GCJ_UNDER_TEST -B$objdir/../ -I$libgcj_jar"
if {[catch {
system "$env(MAUVEDIR)/configure --with-gcj 2>&1"
@@ -179,9 +186,11 @@ proc test_mauve {} {
foreach obj $uses($file) {
if {! [file exists $obj]} then {
verbose "compiling $obj for test of $class"
+ # The .class file does contain a $, but we can quote it between "'"s.
set srcfile [file rootname $obj].class
+ regsub -all "\\^" $srcfile "\$" srcfile
set x [libjava_prune_warnings \
- [target_compile [pwd]/$srcfile $obj object $compile_args]]
+ [libjava_tcompile '[pwd]/$srcfile' $obj object $compile_args]]
if {$x != ""} then {
fail "Compile $obj for $class"
set ok 0
@@ -196,7 +205,7 @@ proc test_mauve {} {
}
set x [libjava_prune_warnings \
- [target_compile [concat $uses($file) $objlist] \
+ [libjava_tcompile [concat $uses($file) $objlist] \
$Executable executable $link_args]]
if {$x != ""} then {
set proc_ok 0
diff --git a/libjava/testsuite/libjava.mauve/xfails b/libjava/testsuite/libjava.mauve/xfails
index 270c28a0378..dda740eee44 100644
--- a/libjava/testsuite/libjava.mauve/xfails
+++ b/libjava/testsuite/libjava.mauve/xfails
@@ -25,8 +25,25 @@ FAIL: gnu.testlet.java.lang.Character.getType (number 20)
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.Class.reflect2: getClasses (number 2)
+FAIL: gnu.testlet.java.lang.Class.reflect2: getClasses (number 3)
+FAIL: gnu.testlet.java.lang.Class.reflect2: getClasses (number 5)
+FAIL: gnu.testlet.java.lang.Class.reflect2: getDeclaringClass (number 3)
+FAIL: gnu.testlet.java.lang.Class.reflect2: getDeclaringClass (number 4)
+FAIL: gnu.testlet.java.lang.Class.reflect2: getDeclaringClass (number 5)
+FAIL: gnu.testlet.java.lang.Class.reflect2: getDeclaredClasses (number 1)
+FAIL: gnu.testlet.java.lang.Class.reflect2: getDeclaredClasses (number 2)
+FAIL: gnu.testlet.java.lang.Class.reflect2: getDeclaredClasses (number 3)
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.Float.FloatTest: Error: test_intValue returned wrong results - 1 (number 1)
+FAIL: gnu.testlet.java.lang.String.getBytes13: String.getBytes("UTF-16") (number 1)
+FAIL: gnu.testlet.java.lang.String.getBytes13: String.getBytes("UnicodeBig") (number 1)
+FAIL: gnu.testlet.java.lang.String.getBytes13: String.getBytes("UnicodeBigUnmarked") (number 1)
+FAIL: gnu.testlet.java.lang.String.getBytes13: String.getBytes("UnicodeLittle") (number 1)
+FAIL: gnu.testlet.java.lang.String.getBytes13: String.getBytes("UnicodeLittleUnmarked") (number 1)
+FAIL: gnu.testlet.java.lang.String.getBytes14: String.getBytes("ISO8859_15") (number 1)
+FAIL: gnu.testlet.java.lang.String.getBytes14: String.getBytes("UTF-16BE") (number 1)
+FAIL: gnu.testlet.java.lang.String.getBytes14: String.getBytes("UTF-16LE") (number 1)
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)
@@ -37,6 +54,40 @@ FAIL: gnu.testlet.java.text.SimpleDateFormat.regress: EDT (number 1)
FAIL: gnu.testlet.java.text.SimpleDateFormat.regress: EST (number 1)
FAIL: gnu.testlet.java.text.SimpleDateFormat.regress: PDT (number 1)
FAIL: gnu.testlet.java.text.DateFormatSymbols.Test: invalid locale (number 1)
+FAIL: gnu.testlet.java.text.CollationElementIterator.jdk11: CollationElementIterator (number 1)
+FAIL: gnu.testlet.java.text.CollationElementIterator.jdk11: next() 0 (number 1)
+FAIL: gnu.testlet.java.text.CollationElementIterator.jdk11: next() 1 (number 1)
+FAIL: gnu.testlet.java.text.CollationElementIterator.jdk11: next() 10 (number 1)
+FAIL: gnu.testlet.java.text.CollationElementIterator.jdk11: next() 11 (number 1)
+FAIL: gnu.testlet.java.text.CollationElementIterator.jdk11: next() 12 (number 1)
+FAIL: gnu.testlet.java.text.CollationElementIterator.jdk11: next() 13 (number 1)
+FAIL: gnu.testlet.java.text.CollationElementIterator.jdk11: next() 2 (number 1)
+FAIL: gnu.testlet.java.text.CollationElementIterator.jdk11: next() 3 (number 1)
+FAIL: gnu.testlet.java.text.CollationElementIterator.jdk11: next() 4 (number 1)
+FAIL: gnu.testlet.java.text.CollationElementIterator.jdk11: next() 5 (number 1)
+FAIL: gnu.testlet.java.text.CollationElementIterator.jdk11: next() 6 (number 1)
+FAIL: gnu.testlet.java.text.CollationElementIterator.jdk11: next() 7 (number 1)
+FAIL: gnu.testlet.java.text.CollationElementIterator.jdk11: next() 8 (number 1)
+FAIL: gnu.testlet.java.text.CollationElementIterator.jdk11: next() 9 (number 1)
+FAIL: gnu.testlet.java.text.CollationElementIterator.jdk11: primaryOrder() 0 (number 1)
+FAIL: gnu.testlet.java.text.CollationElementIterator.jdk11: primaryOrder() 1 (number 1)
+FAIL: gnu.testlet.java.text.CollationElementIterator.jdk11: primaryOrder() 10 (number 1)
+FAIL: gnu.testlet.java.text.CollationElementIterator.jdk11: primaryOrder() 11 (number 1)
+FAIL: gnu.testlet.java.text.CollationElementIterator.jdk11: primaryOrder() 12 (number 1)
+FAIL: gnu.testlet.java.text.CollationElementIterator.jdk11: primaryOrder() 13 (number 1)
+FAIL: gnu.testlet.java.text.CollationElementIterator.jdk11: primaryOrder() 2 (number 1)
+FAIL: gnu.testlet.java.text.CollationElementIterator.jdk11: primaryOrder() 3 (number 1)
+FAIL: gnu.testlet.java.text.CollationElementIterator.jdk11: primaryOrder() 4 (number 1)
+FAIL: gnu.testlet.java.text.CollationElementIterator.jdk11: primaryOrder() 5 (number 1)
+FAIL: gnu.testlet.java.text.CollationElementIterator.jdk11: primaryOrder() 6 (number 1)
+FAIL: gnu.testlet.java.text.CollationElementIterator.jdk11: primaryOrder() 7 (number 1)
+FAIL: gnu.testlet.java.text.CollationElementIterator.jdk11: primaryOrder() 8 (number 1)
+FAIL: gnu.testlet.java.text.CollationElementIterator.jdk11: secondaryOrder() 12 (number 1)
+FAIL: gnu.testlet.java.text.CollationElementIterator.jdk11: secondaryOrder() 4 (number 1)
+FAIL: gnu.testlet.java.text.CollationElementIterator.jdk11: secondaryOrder() 5 (number 1)
+FAIL: gnu.testlet.java.text.CollationElementIterator.jdk11: secondaryOrder() 7 (number 1)
+FAIL: gnu.testlet.java.text.CollationElementIterator.jdk11: secondaryOrder() 9 (number 1)
+FAIL: gnu.testlet.java.text.CollationElementIterator.jdk11: tertiaryOrder() 10 (number 1)
FAIL: gnu.testlet.java.net.ServerSocket.ServerSocketTest: Error : test_params failed - 5getInetAddress did not return proper values (number 1)
FAIL: gnu.testlet.java.net.Socket.SocketTest: Error : test_BasicServer failed - 11 exception was thrown :Illegal seek (number 1)
FAIL: gnu.testlet.java.net.URLConnection.URLConnectionTest: Error in test_Basics - 2 should not have raised Throwable here (number 1)
diff --git a/libjava/verify.cc b/libjava/verify.cc
index dbf80d4bf03..dcb003dfb22 100644
--- a/libjava/verify.cc
+++ b/libjava/verify.cc
@@ -1,6 +1,6 @@
// defineclass.cc - defining a class from .class format.
-/* Copyright (C) 2001, 2002 Free Software Foundation
+/* Copyright (C) 2001, 2002, 2003 Free Software Foundation
This file is part of libgcj.
@@ -128,6 +128,34 @@ private:
return r;
}
+ __attribute__ ((__noreturn__)) void verify_fail (char *s, jint pc = -1)
+ {
+ using namespace java::lang;
+ StringBuffer *buf = new StringBuffer ();
+
+ buf->append (JvNewStringLatin1 ("verification failed"));
+ if (pc == -1)
+ pc = start_PC;
+ if (pc != -1)
+ {
+ buf->append (JvNewStringLatin1 (" at PC "));
+ buf->append (pc);
+ }
+
+ _Jv_InterpMethod *method = current_method;
+ buf->append (JvNewStringLatin1 (" in "));
+ buf->append (current_class->getName());
+ buf->append ((jchar) ':');
+ buf->append (JvNewStringUTF (method->get_method()->name->data));
+ buf->append ((jchar) '(');
+ buf->append (JvNewStringUTF (method->get_method()->signature->data));
+ buf->append ((jchar) ')');
+
+ buf->append (JvNewStringLatin1 (": "));
+ buf->append (JvNewStringLatin1 (s));
+ throw new java::lang::VerifyError (buf->toString ());
+ }
+
// This enum holds a list of tags for all the different types we
// need to handle. Reference types are treated specially by the
// type class.
@@ -793,6 +821,12 @@ private:
// assigns to locals[0] (overwriting `this') and then returns
// without really initializing.
type this_type;
+ // This is a list of all subroutines that have been seen at this
+ // point. Ordinarily this is NULL; it is only allocated and used
+ // in relatively weird situations involving non-ret exit from a
+ // subroutine. We have to keep track of this in this way to avoid
+ // endless recursion in these cases.
+ subr_info *seen_subrs;
// INVALID marks a state which is not on the linked list of states
// requiring reverification.
@@ -811,6 +845,7 @@ private:
stack = NULL;
locals = NULL;
local_changed = NULL;
+ seen_subrs = NULL;
}
state (int max_stack, int max_locals)
@@ -823,6 +858,7 @@ private:
stack[i] = unsuitable_type;
locals = new type[max_locals];
local_changed = (bool *) _Jv_Malloc (sizeof (bool) * max_locals);
+ seen_subrs = NULL;
for (int i = 0; i < max_locals; ++i)
{
locals[i] = unsuitable_type;
@@ -838,6 +874,7 @@ private:
stack = new type[max_stack];
locals = new type[max_locals];
local_changed = (bool *) _Jv_Malloc (sizeof (bool) * max_locals);
+ seen_subrs = NULL;
copy (orig, max_stack, max_locals, ret_semantics);
next = INVALID;
}
@@ -850,6 +887,7 @@ private:
delete[] locals;
if (local_changed)
_Jv_Free (local_changed);
+ clean_subrs ();
}
void *operator new[] (size_t bytes)
@@ -872,6 +910,17 @@ private:
_Jv_Free (mem);
}
+ void clean_subrs ()
+ {
+ subr_info *info = seen_subrs;
+ while (info != NULL)
+ {
+ subr_info *next = info->next;
+ _Jv_Free (info);
+ info = next;
+ }
+ }
+
void copy (const state *copy, int max_stack, int max_locals,
bool ret_semantics = false)
{
@@ -891,6 +940,16 @@ private:
locals[i] = copy->locals[i];
local_changed[i] = copy->local_changed[i];
}
+
+ clean_subrs ();
+ if (copy->seen_subrs)
+ {
+ for (subr_info *info = seen_subrs; info != NULL; info = info->next)
+ add_subr (info->pc);
+ }
+ else
+ seen_subrs = NULL;
+
this_type = copy->this_type;
// Don't modify `next'.
}
@@ -917,6 +976,15 @@ private:
local_changed[i] = false;
}
+ // Indicate that we've been in this this subroutine.
+ void add_subr (int pc)
+ {
+ subr_info *n = (subr_info *) _Jv_Malloc (sizeof (subr_info));
+ n->pc = pc;
+ n->next = seen_subrs;
+ seen_subrs = n;
+ }
+
// Merge STATE_OLD into this state. Destructively modifies this
// state. Returns true if the new state was in fact changed.
// Will throw an exception if the states are not mergeable.
@@ -944,10 +1012,23 @@ private:
}
else
{
- // If the subroutines differ, indicate that the state
- // changed. This is needed to detect when subroutines have
- // merged.
- changed = true;
+ // If the subroutines differ, and we haven't seen this
+ // subroutine before, indicate that the state changed. This
+ // is needed to detect when subroutines have merged.
+ bool found = false;
+ for (subr_info *info = seen_subrs; info != NULL; info = info->next)
+ {
+ if (info->pc == state_old->subroutine)
+ {
+ found = true;
+ break;
+ }
+ }
+ if (! found)
+ {
+ add_subr (state_old->subroutine);
+ changed = true;
+ }
}
// Merge stacks. Special handling for NO_STACK case.
@@ -1351,7 +1432,6 @@ private:
{
int *prev_loc = &next_verify_pc;
int npc = next_verify_pc;
- bool skipped = false;
while (npc != state::NO_NEXT)
{
@@ -1368,7 +1448,6 @@ private:
return npc;
}
- skipped = true;
prev_loc = &states[npc]->next;
npc = states[npc]->next;
}
@@ -3064,34 +3143,6 @@ private:
}
}
- __attribute__ ((__noreturn__)) void verify_fail (char *s, jint pc = -1)
- {
- using namespace java::lang;
- StringBuffer *buf = new StringBuffer ();
-
- buf->append (JvNewStringLatin1 ("verification failed"));
- if (pc == -1)
- pc = start_PC;
- if (pc != -1)
- {
- buf->append (JvNewStringLatin1 (" at PC "));
- buf->append (pc);
- }
-
- _Jv_InterpMethod *method = current_method;
- buf->append (JvNewStringLatin1 (" in "));
- buf->append (current_class->getName());
- buf->append ((jchar) ':');
- buf->append (JvNewStringUTF (method->get_method()->name->data));
- buf->append ((jchar) '(');
- buf->append (JvNewStringUTF (method->get_method()->signature->data));
- buf->append ((jchar) ')');
-
- buf->append (JvNewStringLatin1 (": "));
- buf->append (JvNewStringLatin1 (s));
- throw new java::lang::VerifyError (buf->toString ());
- }
-
public:
void verify_instructions ()
diff --git a/libjava/win32-threads.cc b/libjava/win32-threads.cc
index d31c1919a1e..3a3999a8f2d 100644
--- a/libjava/win32-threads.cc
+++ b/libjava/win32-threads.cc
@@ -1,6 +1,7 @@
// win32-threads.cc - interface between libjava and Win32 threads.
-/* Copyright (C) 1998, 1999 Free Software Foundation, Inc.
+/* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Free Software
+ Foundation, Inc.
This file is part of libgcj.
@@ -70,12 +71,14 @@ DWORD _Jv_ThreadDataKey;
inline void
ensure_condvar_initialized(_Jv_ConditionVariable_t *cv)
{
- if (cv->ev[0] == 0) {
- cv->ev[0] = CreateEvent (NULL, 0, 0, NULL);
- if (cv->ev[0] == 0) JvFail("CreateEvent() failed");
- cv->ev[1] = CreateEvent (NULL, 1, 0, NULL);
- if (cv->ev[1] == 0) JvFail("CreateEvent() failed");
- }
+ if (cv->ev[0] == 0)
+ {
+ cv->ev[0] = CreateEvent (NULL, 0, 0, NULL);
+ if (cv->ev[0] == 0) JvFail("CreateEvent() failed");
+
+ cv->ev[1] = CreateEvent (NULL, 1, 0, NULL);
+ if (cv->ev[1] == 0) JvFail("CreateEvent() failed");
+ }
}
// Reimplementation of the general algorithm described at
@@ -85,11 +88,13 @@ ensure_condvar_initialized(_Jv_ConditionVariable_t *cv)
int
_Jv_CondWait(_Jv_ConditionVariable_t *cv, _Jv_Mutex_t *mu, jlong millis, jint nanos)
{
+ if (mu->owner != GetCurrentThreadId ( ))
+ return _JV_NOT_OWNER;
- EnterCriticalSection(&cv->count_mutex);
- ensure_condvar_initialized(cv);
+ EnterCriticalSection (&cv->count_mutex);
+ ensure_condvar_initialized (cv);
cv->blocked_count++;
- LeaveCriticalSection(&cv->count_mutex);
+ LeaveCriticalSection (&cv->count_mutex);
DWORD time;
if ((millis == 0) && (nanos > 0)) time = 1;
@@ -102,18 +107,17 @@ _Jv_CondWait(_Jv_ConditionVariable_t *cv, _Jv_Mutex_t *mu, jlong millis, jint na
EnterCriticalSection(&cv->count_mutex);
cv->blocked_count--;
- // If we were unblocked by the second event (the broadcast one) and nobody is
- // left, then reset the signal.
- int last_waiter = rval == WAIT_OBJECT_0 + 1 && cv->blocked_count == 0;
+ // If we were unblocked by the second event (the broadcast one)
+ // and nobody is left, then reset the event.
+ int last_waiter = (rval == (WAIT_OBJECT_0 + 1)) && (cv->blocked_count == 0);
LeaveCriticalSection(&cv->count_mutex);
- if (last_waiter) ResetEvent(&cv->ev[1]);
+ if (last_waiter)
+ ResetEvent (cv->ev[1]);
_Jv_MutexLock (mu);
- if (rval == WAIT_FAILED) return GetLastError();
- else if (rval == WAIT_TIMEOUT) return ETIMEDOUT;
- else return 0;
+ return 0;
}
void
@@ -121,39 +125,56 @@ _Jv_CondInit (_Jv_ConditionVariable_t *cv)
{
// we do lazy creation of Events since CreateEvent() is insanely expensive
cv->ev[0] = 0;
- InitializeCriticalSection(&cv->count_mutex);
+ InitializeCriticalSection (&cv->count_mutex);
cv->blocked_count = 0;
}
void
_Jv_CondDestroy (_Jv_ConditionVariable_t *cv)
{
- if (cv->ev[0] != 0) CloseHandle(cv->ev[0]);
- cv = NULL;
+ if (cv->ev[0] != 0)
+ {
+ CloseHandle (cv->ev[0]);
+ CloseHandle (cv->ev[1]);
+
+ cv->ev[0] = 0;
+ }
+
+ DeleteCriticalSection (&cv->count_mutex);
}
int
-_Jv_CondNotify (_Jv_ConditionVariable_t *cv, _Jv_Mutex_t *)
+_Jv_CondNotify (_Jv_ConditionVariable_t *cv, _Jv_Mutex_t *mu)
{
- EnterCriticalSection(&cv->count_mutex);
- ensure_condvar_initialized(cv);
+ if (mu->owner != GetCurrentThreadId ( ))
+ return _JV_NOT_OWNER;
+
+ EnterCriticalSection (&cv->count_mutex);
+ ensure_condvar_initialized (cv);
int somebody_is_blocked = cv->blocked_count > 0;
- LeaveCriticalSection(&cv->count_mutex);
+ LeaveCriticalSection (&cv->count_mutex);
+
+ if (somebody_is_blocked)
+ SetEvent (cv->ev[0]);
- if (somebody_is_blocked) return SetEvent (cv->ev[0]) ? 0 : GetLastError();
- else return 0;
+ return 0;
}
int
-_Jv_CondNotifyAll (_Jv_ConditionVariable_t *cv, _Jv_Mutex_t *)
+_Jv_CondNotifyAll (_Jv_ConditionVariable_t *cv, _Jv_Mutex_t *mu)
{
- EnterCriticalSection(&cv->count_mutex);
- ensure_condvar_initialized(cv);
+ if (mu->owner != GetCurrentThreadId ( ))
+ return _JV_NOT_OWNER;
+
+ EnterCriticalSection (&cv->count_mutex);
+ ensure_condvar_initialized (cv);
int somebody_is_blocked = cv->blocked_count > 0;
- LeaveCriticalSection(&cv->count_mutex);
+ LeaveCriticalSection (&cv->count_mutex);
- if (somebody_is_blocked) return SetEvent (cv->ev[1]) ? 0 : GetLastError();
- else return 0;
+ if (somebody_is_blocked)
+ SetEvent (cv->ev[1]);
+
+ return 0;
}
//
@@ -165,8 +186,8 @@ _Jv_InitThreads (void)
{
_Jv_ThreadKey = TlsAlloc();
_Jv_ThreadDataKey = TlsAlloc();
- daemon_mutex = CreateMutex(NULL, 0, NULL);
- daemon_cond = CreateEvent(NULL, 0, 0, NULL);
+ daemon_mutex = CreateMutex (NULL, 0, NULL);
+ daemon_cond = CreateEvent (NULL, 1, 0, NULL);
non_daemon_count = 0;
}
@@ -255,7 +276,7 @@ really_start (void* x)
WaitForSingleObject (daemon_mutex, INFINITE);
non_daemon_count--;
if (! non_daemon_count)
- PulseEvent (daemon_cond);
+ SetEvent (daemon_cond);
ReleaseMutex (daemon_mutex);
}
@@ -297,10 +318,12 @@ _Jv_ThreadStart (java::lang::Thread *thread, _Jv_Thread_t *data, _Jv_ThreadStart
void
_Jv_ThreadWait (void)
{
- WaitForSingleObject(daemon_mutex, INFINITE);
- if(non_daemon_count)
- SignalObjectAndWait(daemon_mutex, daemon_cond, INFINITE, 0);
- ReleaseMutex(daemon_mutex);
+ WaitForSingleObject (daemon_mutex, INFINITE);
+ if (non_daemon_count)
+ {
+ ReleaseMutex (daemon_mutex);
+ WaitForSingleObject (daemon_cond, INFINITE);
+ }
}
void
diff --git a/libjava/win32.cc b/libjava/win32.cc
index af1163fbfa9..59c3be244b6 100644
--- a/libjava/win32.cc
+++ b/libjava/win32.cc
@@ -1,6 +1,6 @@
// win32.cc - Helper functions for Microsoft-flavored OSs.
-/* Copyright (C) 2002 Free Software Foundation
+/* Copyright (C) 2002, 2003 Free Software Foundation
This file is part of libgcj.
@@ -9,11 +9,11 @@ Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
details. */
#include <config.h>
+#include <platform.h>
#include <jvm.h>
#include <sys/timeb.h>
#include <stdlib.h>
-#include "platform.h"
#include <java/lang/ArithmeticException.h>
#include <java/util/Properties.h>