aboutsummaryrefslogtreecommitdiff
path: root/libjava/java
diff options
context:
space:
mode:
Diffstat (limited to 'libjava/java')
-rw-r--r--libjava/java/applet/Applet.java8
-rw-r--r--libjava/java/awt/AWTError.java4
-rw-r--r--libjava/java/awt/AWTEvent.java4
-rw-r--r--libjava/java/awt/AWTEventMulticaster.java4
-rw-r--r--libjava/java/awt/AWTException.java4
-rw-r--r--libjava/java/awt/AWTKeyStroke.java21
-rw-r--r--libjava/java/awt/AWTPermission.java2
-rw-r--r--libjava/java/awt/ActiveEvent.java2
-rw-r--r--libjava/java/awt/Adjustable.java4
-rw-r--r--libjava/java/awt/AlphaComposite.java4
-rw-r--r--libjava/java/awt/AttributeValue.java4
-rw-r--r--libjava/java/awt/BasicStroke.java28
-rw-r--r--libjava/java/awt/BorderLayout.java4
-rw-r--r--libjava/java/awt/BufferCapabilities.java4
-rw-r--r--libjava/java/awt/Button.java21
-rw-r--r--libjava/java/awt/Canvas.java9
-rw-r--r--libjava/java/awt/Checkbox.java182
-rw-r--r--libjava/java/awt/CheckboxGroup.java4
-rw-r--r--libjava/java/awt/CheckboxMenuItem.java42
-rw-r--r--libjava/java/awt/Choice.java86
-rw-r--r--libjava/java/awt/Color.java4
-rw-r--r--libjava/java/awt/ColorPaintContext.java4
-rw-r--r--libjava/java/awt/Component.java81
-rw-r--r--libjava/java/awt/ComponentOrientation.java2
-rw-r--r--libjava/java/awt/Composite.java4
-rw-r--r--libjava/java/awt/CompositeContext.java4
-rw-r--r--libjava/java/awt/Container.java69
-rw-r--r--libjava/java/awt/ContainerOrderFocusTraversalPolicy.java4
-rw-r--r--libjava/java/awt/DefaultFocusTraversalPolicy.java4
-rw-r--r--libjava/java/awt/DefaultKeyboardFocusManager.java2
-rw-r--r--libjava/java/awt/Dialog.java44
-rw-r--r--libjava/java/awt/Dimension.java6
-rw-r--r--libjava/java/awt/DisplayMode.java4
-rw-r--r--libjava/java/awt/EventDispatchThread.java11
-rw-r--r--libjava/java/awt/EventQueue.java100
-rw-r--r--libjava/java/awt/FileDialog.java4
-rw-r--r--libjava/java/awt/Font.java7
-rw-r--r--libjava/java/awt/FontFormatException.java4
-rw-r--r--libjava/java/awt/Frame.java124
-rw-r--r--libjava/java/awt/Graphics.java4
-rw-r--r--libjava/java/awt/Graphics2D.java2
-rw-r--r--libjava/java/awt/GraphicsConfigTemplate.java4
-rw-r--r--libjava/java/awt/GraphicsConfiguration.java2
-rw-r--r--libjava/java/awt/GraphicsDevice.java4
-rw-r--r--libjava/java/awt/GridBagLayout.java6
-rw-r--r--libjava/java/awt/GridBagLayoutInfo.java4
-rw-r--r--libjava/java/awt/GridLayout.java2
-rw-r--r--libjava/java/awt/HeadlessException.java4
-rw-r--r--libjava/java/awt/IllegalComponentStateException.java4
-rw-r--r--libjava/java/awt/Image.java4
-rw-r--r--libjava/java/awt/Insets.java6
-rw-r--r--libjava/java/awt/ItemSelectable.java4
-rw-r--r--libjava/java/awt/JobAttributes.java4
-rw-r--r--libjava/java/awt/KeyEventDispatcher.java4
-rw-r--r--libjava/java/awt/KeyEventPostProcessor.java4
-rw-r--r--libjava/java/awt/KeyboardFocusManager.java6
-rw-r--r--libjava/java/awt/Label.java11
-rw-r--r--libjava/java/awt/LayoutManager.java4
-rw-r--r--libjava/java/awt/List.java184
-rw-r--r--libjava/java/awt/Menu.java12
-rw-r--r--libjava/java/awt/MenuBar.java13
-rw-r--r--libjava/java/awt/MenuComponent.java8
-rw-r--r--libjava/java/awt/MenuContainer.java4
-rw-r--r--libjava/java/awt/MenuItem.java21
-rw-r--r--libjava/java/awt/PageAttributes.java4
-rw-r--r--libjava/java/awt/Paint.java2
-rw-r--r--libjava/java/awt/PaintContext.java2
-rw-r--r--libjava/java/awt/Panel.java4
-rw-r--r--libjava/java/awt/Point.java6
-rw-r--r--libjava/java/awt/Polygon.java6
-rw-r--r--libjava/java/awt/PopupMenu.java11
-rw-r--r--libjava/java/awt/PrintGraphics.java4
-rw-r--r--libjava/java/awt/PrintJob.java4
-rw-r--r--libjava/java/awt/Rectangle.java6
-rw-r--r--libjava/java/awt/RenderingHints.java4
-rw-r--r--libjava/java/awt/Robot.java368
-rw-r--r--libjava/java/awt/ScrollPane.java24
-rw-r--r--libjava/java/awt/Scrollbar.java1296
-rw-r--r--libjava/java/awt/Shape.java4
-rw-r--r--libjava/java/awt/Stroke.java4
-rw-r--r--libjava/java/awt/SystemColor.java6
-rw-r--r--libjava/java/awt/TextArea.java11
-rw-r--r--libjava/java/awt/TextComponent.java16
-rw-r--r--libjava/java/awt/Toolkit.java8
-rw-r--r--libjava/java/awt/Transparency.java2
-rw-r--r--libjava/java/awt/Window.java114
-rw-r--r--libjava/java/awt/color/CMMException.java4
-rw-r--r--libjava/java/awt/color/ColorSpace.java2
-rw-r--r--libjava/java/awt/color/ICC_ColorSpace.java2
-rw-r--r--libjava/java/awt/color/ICC_Profile.java4
-rw-r--r--libjava/java/awt/color/ProfileDataException.java4
-rw-r--r--libjava/java/awt/datatransfer/FlavorTable.java4
-rw-r--r--libjava/java/awt/datatransfer/MimeTypeParseException.java4
-rw-r--r--libjava/java/awt/datatransfer/Transferable.java4
-rw-r--r--libjava/java/awt/datatransfer/UnsupportedFlavorException.java4
-rw-r--r--libjava/java/awt/dnd/Autoscroll.java4
-rw-r--r--libjava/java/awt/dnd/DnDConstants.java11
-rw-r--r--libjava/java/awt/dnd/DragGestureListener.java4
-rw-r--r--libjava/java/awt/dnd/DragSourceAdapter.java4
-rw-r--r--libjava/java/awt/dnd/DragSourceDropEvent.java4
-rw-r--r--libjava/java/awt/dnd/DragSourceListener.java4
-rw-r--r--libjava/java/awt/dnd/DragSourceMotionListener.java4
-rw-r--r--libjava/java/awt/dnd/DropTarget.java9
-rw-r--r--libjava/java/awt/dnd/DropTargetAdapter.java4
-rw-r--r--libjava/java/awt/dnd/DropTargetContext.java2
-rw-r--r--libjava/java/awt/dnd/DropTargetListener.java4
-rw-r--r--libjava/java/awt/dnd/InvalidDnDOperationException.java4
-rw-r--r--libjava/java/awt/dnd/MouseDragGestureRecognizer.java4
-rw-r--r--libjava/java/awt/dnd/peer/DropTargetContextPeer.java4
-rw-r--r--libjava/java/awt/event/AWTEventListener.java4
-rw-r--r--libjava/java/awt/event/AWTEventListenerProxy.java4
-rw-r--r--libjava/java/awt/event/ActionEvent.java4
-rw-r--r--libjava/java/awt/event/AdjustmentEvent.java4
-rw-r--r--libjava/java/awt/event/AdjustmentListener.java4
-rw-r--r--libjava/java/awt/event/ComponentAdapter.java4
-rw-r--r--libjava/java/awt/event/ComponentEvent.java4
-rw-r--r--libjava/java/awt/event/ComponentListener.java4
-rw-r--r--libjava/java/awt/event/ContainerAdapter.java4
-rw-r--r--libjava/java/awt/event/ContainerEvent.java4
-rw-r--r--libjava/java/awt/event/ContainerListener.java4
-rw-r--r--libjava/java/awt/event/FocusAdapter.java4
-rw-r--r--libjava/java/awt/event/FocusEvent.java4
-rw-r--r--libjava/java/awt/event/FocusListener.java4
-rw-r--r--libjava/java/awt/event/InputEvent.java4
-rw-r--r--libjava/java/awt/event/InputMethodEvent.java4
-rw-r--r--libjava/java/awt/event/InputMethodListener.java4
-rw-r--r--libjava/java/awt/event/InvocationEvent.java4
-rw-r--r--libjava/java/awt/event/ItemEvent.java4
-rw-r--r--libjava/java/awt/event/ItemListener.java4
-rw-r--r--libjava/java/awt/event/KeyAdapter.java4
-rw-r--r--libjava/java/awt/event/KeyEvent.java6
-rw-r--r--libjava/java/awt/event/KeyListener.java4
-rw-r--r--libjava/java/awt/event/MouseAdapter.java4
-rw-r--r--libjava/java/awt/event/MouseEvent.java6
-rw-r--r--libjava/java/awt/event/MouseListener.java4
-rw-r--r--libjava/java/awt/event/MouseMotionAdapter.java4
-rw-r--r--libjava/java/awt/event/MouseMotionListener.java4
-rw-r--r--libjava/java/awt/event/MouseWheelEvent.java4
-rw-r--r--libjava/java/awt/event/MouseWheelListener.java4
-rw-r--r--libjava/java/awt/event/PaintEvent.java4
-rw-r--r--libjava/java/awt/event/TextEvent.java4
-rw-r--r--libjava/java/awt/event/TextListener.java4
-rw-r--r--libjava/java/awt/event/WindowAdapter.java4
-rw-r--r--libjava/java/awt/event/WindowEvent.java4
-rw-r--r--libjava/java/awt/event/WindowFocusListener.java4
-rw-r--r--libjava/java/awt/event/WindowListener.java4
-rw-r--r--libjava/java/awt/event/WindowStateListener.java4
-rw-r--r--libjava/java/awt/font/TextAttribute.java300
-rw-r--r--libjava/java/awt/font/TextHitInfo.java4
-rw-r--r--libjava/java/awt/font/TransformAttribute.java37
-rw-r--r--libjava/java/awt/geom/Area.java4
-rw-r--r--libjava/java/awt/geom/CubicCurve2D.java8
-rw-r--r--libjava/java/awt/geom/Dimension2D.java4
-rw-r--r--libjava/java/awt/geom/Ellipse2D.java6
-rw-r--r--libjava/java/awt/geom/IllegalPathStateException.java2
-rw-r--r--libjava/java/awt/geom/Line2D.java8
-rw-r--r--libjava/java/awt/geom/NoninvertibleTransformException.java2
-rw-r--r--libjava/java/awt/geom/PathIterator.java4
-rw-r--r--libjava/java/awt/geom/Point2D.java4
-rw-r--r--libjava/java/awt/geom/QuadCurve2D.java9
-rw-r--r--libjava/java/awt/geom/Rectangle2D.java14
-rw-r--r--libjava/java/awt/geom/RectangularShape.java4
-rw-r--r--libjava/java/awt/geom/RoundRectangle2D.java2
-rw-r--r--libjava/java/awt/im/InputContext.java8
-rw-r--r--libjava/java/awt/im/InputMethodHighlight.java4
-rw-r--r--libjava/java/awt/im/InputMethodRequests.java4
-rw-r--r--libjava/java/awt/im/InputSubset.java4
-rw-r--r--libjava/java/awt/im/spi/InputMethod.java4
-rw-r--r--libjava/java/awt/im/spi/InputMethodDescriptor.java4
-rw-r--r--libjava/java/awt/image/BandCombineOp.java2
-rw-r--r--libjava/java/awt/image/BandedSampleModel.java2
-rw-r--r--libjava/java/awt/image/ByteLookupTable.java4
-rw-r--r--libjava/java/awt/image/ComponentSampleModel.java2
-rw-r--r--libjava/java/awt/image/DataBuffer.java2
-rw-r--r--libjava/java/awt/image/DataBufferByte.java2
-rw-r--r--libjava/java/awt/image/DataBufferDouble.java4
-rw-r--r--libjava/java/awt/image/DataBufferFloat.java4
-rw-r--r--libjava/java/awt/image/DataBufferInt.java2
-rw-r--r--libjava/java/awt/image/DataBufferShort.java2
-rw-r--r--libjava/java/awt/image/DataBufferUShort.java2
-rw-r--r--libjava/java/awt/image/ImagingOpException.java4
-rw-r--r--libjava/java/awt/image/IndexColorModel.java12
-rw-r--r--libjava/java/awt/image/Kernel.java4
-rw-r--r--libjava/java/awt/image/LookupTable.java4
-rw-r--r--libjava/java/awt/image/MemoryImageSource.java656
-rw-r--r--libjava/java/awt/image/MultiPixelPackedSampleModel.java11
-rw-r--r--libjava/java/awt/image/PackedColorModel.java2
-rw-r--r--libjava/java/awt/image/PixelInterleavedSampleModel.java4
-rw-r--r--libjava/java/awt/image/RGBImageFilter.java6
-rw-r--r--libjava/java/awt/image/Raster.java2
-rw-r--r--libjava/java/awt/image/RasterFormatException.java4
-rw-r--r--libjava/java/awt/image/ReplicateScaleFilter.java16
-rw-r--r--libjava/java/awt/image/SampleModel.java2
-rw-r--r--libjava/java/awt/image/ShortLookupTable.java4
-rw-r--r--libjava/java/awt/image/SinglePixelPackedSampleModel.java2
-rw-r--r--libjava/java/awt/image/WritableRaster.java2
-rw-r--r--libjava/java/awt/peer/RobotPeer.java12
-rw-r--r--libjava/java/awt/print/Book.java255
-rw-r--r--libjava/java/awt/print/PrinterAbortException.java4
-rw-r--r--libjava/java/awt/print/PrinterException.java4
-rw-r--r--libjava/java/awt/print/PrinterIOException.java6
-rw-r--r--libjava/java/awt/print/PrinterJob.java18
-rw-r--r--libjava/java/beans/AppletInitializer.java4
-rw-r--r--libjava/java/beans/Beans.java481
-rw-r--r--libjava/java/beans/ExceptionListener.java4
-rw-r--r--libjava/java/beans/PropertyChangeEvent.java4
-rw-r--r--libjava/java/beans/PropertyChangeListenerProxy.java4
-rw-r--r--libjava/java/beans/PropertyChangeSupport.java4
-rw-r--r--libjava/java/beans/PropertyDescriptor.java24
-rw-r--r--libjava/java/beans/VetoableChangeListenerProxy.java4
-rw-r--r--libjava/java/beans/VetoableChangeSupport.java4
-rw-r--r--libjava/java/beans/XMLDecoder.java307
-rw-r--r--libjava/java/io/BufferedInputStream.java100
-rw-r--r--libjava/java/io/BufferedReader.java6
-rw-r--r--libjava/java/io/ByteArrayInputStream.java4
-rw-r--r--libjava/java/io/ByteArrayOutputStream.java4
-rw-r--r--libjava/java/io/CharArrayReader.java4
-rw-r--r--libjava/java/io/CharArrayWriter.java4
-rw-r--r--libjava/java/io/CharConversionException.java4
-rw-r--r--libjava/java/io/DataInput.java4
-rw-r--r--libjava/java/io/DataInputStream.java4
-rw-r--r--libjava/java/io/DataOutput.java4
-rw-r--r--libjava/java/io/DataOutputStream.java6
-rw-r--r--libjava/java/io/EOFException.java4
-rw-r--r--libjava/java/io/Externalizable.java2
-rw-r--r--libjava/java/io/FileDescriptor.java2
-rw-r--r--libjava/java/io/FileInputStream.java6
-rw-r--r--libjava/java/io/FileNotFoundException.java6
-rw-r--r--libjava/java/io/FileOutputStream.java6
-rw-r--r--libjava/java/io/FilenameFilter.java4
-rw-r--r--libjava/java/io/FilterInputStream.java4
-rw-r--r--libjava/java/io/FilterOutputStream.java4
-rw-r--r--libjava/java/io/FilterReader.java4
-rw-r--r--libjava/java/io/FilterWriter.java4
-rw-r--r--libjava/java/io/IOException.java4
-rw-r--r--libjava/java/io/InputStream.java4
-rw-r--r--libjava/java/io/InputStreamReader.java6
-rw-r--r--libjava/java/io/InterruptedIOException.java6
-rw-r--r--libjava/java/io/LineNumberInputStream.java4
-rw-r--r--libjava/java/io/LineNumberReader.java6
-rw-r--r--libjava/java/io/ObjectInputStream.java169
-rw-r--r--libjava/java/io/ObjectOutputStream.java62
-rw-r--r--libjava/java/io/ObjectStreamClass.java102
-rw-r--r--libjava/java/io/ObjectStreamException.java4
-rw-r--r--libjava/java/io/ObjectStreamField.java81
-rw-r--r--libjava/java/io/OptionalDataException.java4
-rw-r--r--libjava/java/io/OutputStream.java4
-rw-r--r--libjava/java/io/OutputStreamWriter.java4
-rw-r--r--libjava/java/io/PipedInputStream.java23
-rw-r--r--libjava/java/io/PrintStream.java6
-rw-r--r--libjava/java/io/PrintWriter.java4
-rw-r--r--libjava/java/io/PushbackInputStream.java4
-rw-r--r--libjava/java/io/PushbackReader.java4
-rw-r--r--libjava/java/io/RandomAccessFile.java6
-rw-r--r--libjava/java/io/Reader.java2
-rw-r--r--libjava/java/io/SequenceInputStream.java4
-rw-r--r--libjava/java/io/Serializable.java5
-rw-r--r--libjava/java/io/StreamCorruptedException.java4
-rw-r--r--libjava/java/io/StreamTokenizer.java2
-rw-r--r--libjava/java/io/StringBufferInputStream.java4
-rw-r--r--libjava/java/io/StringWriter.java4
-rw-r--r--libjava/java/io/SyncFailedException.java4
-rw-r--r--libjava/java/io/UTFDataFormatException.java4
-rw-r--r--libjava/java/io/UnsupportedEncodingException.java4
-rw-r--r--libjava/java/io/VMObjectStreamClass.java92
-rw-r--r--libjava/java/io/WriteAbortedException.java4
-rw-r--r--libjava/java/io/Writer.java4
-rw-r--r--libjava/java/io/natObjectInputStream.cc44
-rw-r--r--libjava/java/io/natVMObjectStreamClass.cc64
-rw-r--r--libjava/java/lang/AbstractMethodError.java4
-rw-r--r--libjava/java/lang/ArithmeticException.java4
-rw-r--r--libjava/java/lang/ArrayIndexOutOfBoundsException.java4
-rw-r--r--libjava/java/lang/ArrayStoreException.java4
-rw-r--r--libjava/java/lang/AssertionError.java4
-rw-r--r--libjava/java/lang/Boolean.java4
-rw-r--r--libjava/java/lang/Byte.java4
-rw-r--r--libjava/java/lang/Class.h10
-rw-r--r--libjava/java/lang/Class.java4
-rw-r--r--libjava/java/lang/ClassCastException.java4
-rw-r--r--libjava/java/lang/ClassCircularityError.java4
-rw-r--r--libjava/java/lang/ClassLoader.java52
-rw-r--r--libjava/java/lang/ClassNotFoundException.java4
-rw-r--r--libjava/java/lang/CloneNotSupportedException.java6
-rw-r--r--libjava/java/lang/Cloneable.java6
-rw-r--r--libjava/java/lang/Comparable.java4
-rw-r--r--libjava/java/lang/Compiler.java4
-rw-r--r--libjava/java/lang/Double.java6
-rw-r--r--libjava/java/lang/Error.java6
-rw-r--r--libjava/java/lang/Exception.java6
-rw-r--r--libjava/java/lang/ExceptionInInitializerError.java6
-rw-r--r--libjava/java/lang/Float.java6
-rw-r--r--libjava/java/lang/IllegalAccessError.java4
-rw-r--r--libjava/java/lang/IllegalAccessException.java4
-rw-r--r--libjava/java/lang/IllegalArgumentException.java4
-rw-r--r--libjava/java/lang/IllegalMonitorStateException.java4
-rw-r--r--libjava/java/lang/IllegalStateException.java4
-rw-r--r--libjava/java/lang/IllegalThreadStateException.java4
-rw-r--r--libjava/java/lang/IncompatibleClassChangeError.java4
-rw-r--r--libjava/java/lang/IndexOutOfBoundsException.java4
-rw-r--r--libjava/java/lang/InheritableThreadLocal.java6
-rw-r--r--libjava/java/lang/InstantiationError.java4
-rw-r--r--libjava/java/lang/InstantiationException.java4
-rw-r--r--libjava/java/lang/Integer.java4
-rw-r--r--libjava/java/lang/InternalError.java4
-rw-r--r--libjava/java/lang/InterruptedException.java4
-rw-r--r--libjava/java/lang/LinkageError.java4
-rw-r--r--libjava/java/lang/Long.java4
-rw-r--r--libjava/java/lang/NegativeArraySizeException.java4
-rw-r--r--libjava/java/lang/NoClassDefFoundError.java4
-rw-r--r--libjava/java/lang/NoSuchFieldError.java4
-rw-r--r--libjava/java/lang/NoSuchFieldException.java4
-rw-r--r--libjava/java/lang/NoSuchMethodError.java4
-rw-r--r--libjava/java/lang/NoSuchMethodException.java4
-rw-r--r--libjava/java/lang/NullPointerException.java4
-rw-r--r--libjava/java/lang/Number.java4
-rw-r--r--libjava/java/lang/NumberFormatException.java4
-rw-r--r--libjava/java/lang/Object.h5
-rw-r--r--libjava/java/lang/OutOfMemoryError.java4
-rw-r--r--libjava/java/lang/Process.java4
-rw-r--r--libjava/java/lang/Runnable.java4
-rw-r--r--libjava/java/lang/Runtime.java4
-rw-r--r--libjava/java/lang/RuntimeException.java6
-rw-r--r--libjava/java/lang/RuntimePermission.java4
-rw-r--r--libjava/java/lang/SecurityException.java4
-rw-r--r--libjava/java/lang/SecurityManager.java4
-rw-r--r--libjava/java/lang/Short.java4
-rw-r--r--libjava/java/lang/StackOverflowError.java4
-rw-r--r--libjava/java/lang/StackTraceElement.java6
-rw-r--r--libjava/java/lang/StringBuffer.java4
-rw-r--r--libjava/java/lang/StringIndexOutOfBoundsException.java4
-rw-r--r--libjava/java/lang/ThreadDeath.java4
-rw-r--r--libjava/java/lang/ThreadGroup.java4
-rw-r--r--libjava/java/lang/Throwable.java4
-rw-r--r--libjava/java/lang/UnsatisfiedLinkError.java4
-rw-r--r--libjava/java/lang/UnsupportedOperationException.java4
-rw-r--r--libjava/java/lang/VMClassLoader.java56
-rw-r--r--libjava/java/lang/VMCompiler.java36
-rw-r--r--libjava/java/lang/VerifyError.java4
-rw-r--r--libjava/java/lang/VirtualMachineError.java4
-rw-r--r--libjava/java/lang/natClass.cc8
-rw-r--r--libjava/java/lang/natClassLoader.cc61
-rw-r--r--libjava/java/lang/natDouble.cc19
-rw-r--r--libjava/java/lang/natRuntime.cc56
-rw-r--r--libjava/java/lang/natVMClassLoader.cc99
-rw-r--r--libjava/java/lang/reflect/AccessibleObject.java6
-rw-r--r--libjava/java/lang/reflect/Array.java6
-rw-r--r--libjava/java/lang/reflect/Field.java58
-rw-r--r--libjava/java/lang/reflect/InvocationTargetException.java6
-rw-r--r--libjava/java/lang/reflect/Member.java6
-rw-r--r--libjava/java/lang/reflect/Modifier.java6
-rw-r--r--libjava/java/lang/reflect/Proxy.java12
-rw-r--r--libjava/java/lang/reflect/ReflectPermission.java6
-rw-r--r--libjava/java/lang/reflect/UndeclaredThrowableException.java4
-rw-r--r--libjava/java/lang/reflect/natField.cc94
-rw-r--r--libjava/java/lang/reflect/natMethod.cc4
-rw-r--r--libjava/java/math/BigInteger.java6
-rw-r--r--libjava/java/net/NetworkInterface.java4
-rw-r--r--libjava/java/net/URL.java8
-rw-r--r--libjava/java/net/URLClassLoader.java54
-rw-r--r--libjava/java/nio/ByteBufferHelper.java4
-rw-r--r--libjava/java/nio/ByteBufferImpl.java11
-rw-r--r--libjava/java/nio/CharBufferImpl.java3
-rw-r--r--libjava/java/nio/CharViewBufferImpl.java5
-rw-r--r--libjava/java/nio/DirectByteBufferImpl.java38
-rw-r--r--libjava/java/nio/DoubleBufferImpl.java7
-rw-r--r--libjava/java/nio/DoubleViewBufferImpl.java5
-rw-r--r--libjava/java/nio/FloatBufferImpl.java7
-rw-r--r--libjava/java/nio/FloatViewBufferImpl.java5
-rw-r--r--libjava/java/nio/IntBufferImpl.java7
-rw-r--r--libjava/java/nio/IntViewBufferImpl.java5
-rw-r--r--libjava/java/nio/LongBufferImpl.java7
-rw-r--r--libjava/java/nio/LongViewBufferImpl.java5
-rw-r--r--libjava/java/nio/MappedByteBufferImpl.java7
-rw-r--r--libjava/java/nio/ShortBufferImpl.java7
-rw-r--r--libjava/java/nio/ShortViewBufferImpl.java5
-rw-r--r--libjava/java/nio/channels/Channel.java4
-rw-r--r--libjava/java/nio/channels/Channels.java12
-rw-r--r--libjava/java/nio/channels/IllegalBlockingModeException.java4
-rw-r--r--libjava/java/nio/charset/Charset.java31
-rw-r--r--libjava/java/nio/charset/spi/CharsetProvider.java2
-rw-r--r--libjava/java/rmi/server/RemoteObject.java34
-rw-r--r--libjava/java/rmi/server/RemoteRef.java2
-rw-r--r--libjava/java/rmi/server/ServerRef.java2
-rw-r--r--libjava/java/rmi/server/UID.java2
-rw-r--r--libjava/java/rmi/server/UnicastRemoteObject.java11
-rw-r--r--libjava/java/security/AccessControlException.java4
-rw-r--r--libjava/java/security/AlgorithmParameterGenerator.java2
-rw-r--r--libjava/java/security/AlgorithmParameters.java2
-rw-r--r--libjava/java/security/AllPermission.java114
-rw-r--r--libjava/java/security/BasicPermission.java203
-rw-r--r--libjava/java/security/DigestException.java4
-rw-r--r--libjava/java/security/DigestInputStream.java4
-rw-r--r--libjava/java/security/DigestOutputStream.java4
-rw-r--r--libjava/java/security/GeneralSecurityException.java4
-rw-r--r--libjava/java/security/Guard.java4
-rw-r--r--libjava/java/security/GuardedObject.java4
-rw-r--r--libjava/java/security/InvalidAlgorithmParameterException.java4
-rw-r--r--libjava/java/security/InvalidKeyException.java2
-rw-r--r--libjava/java/security/InvalidParameterException.java2
-rw-r--r--libjava/java/security/Key.java4
-rw-r--r--libjava/java/security/KeyException.java4
-rw-r--r--libjava/java/security/KeyFactory.java2
-rw-r--r--libjava/java/security/KeyManagementException.java4
-rw-r--r--libjava/java/security/KeyStore.java2
-rw-r--r--libjava/java/security/KeyStoreException.java4
-rw-r--r--libjava/java/security/MessageDigestSpi.java4
-rw-r--r--libjava/java/security/NoSuchAlgorithmException.java4
-rw-r--r--libjava/java/security/NoSuchProviderException.java4
-rw-r--r--libjava/java/security/Permission.java4
-rw-r--r--libjava/java/security/PermissionCollection.java6
-rw-r--r--libjava/java/security/Permissions.java113
-rw-r--r--libjava/java/security/Principal.java4
-rw-r--r--libjava/java/security/PrivateKey.java4
-rw-r--r--libjava/java/security/PrivilegedActionException.java6
-rw-r--r--libjava/java/security/ProviderException.java4
-rw-r--r--libjava/java/security/PublicKey.java4
-rw-r--r--libjava/java/security/SecureClassLoader.java26
-rw-r--r--libjava/java/security/SecureRandom.java10
-rw-r--r--libjava/java/security/SecureRandomSpi.java4
-rw-r--r--libjava/java/security/SignatureException.java4
-rw-r--r--libjava/java/security/SignatureSpi.java2
-rw-r--r--libjava/java/security/SignedObject.java2
-rw-r--r--libjava/java/security/Signer.java2
-rw-r--r--libjava/java/security/UnrecoverableKeyException.java4
-rw-r--r--libjava/java/security/UnresolvedPermission.java4
-rw-r--r--libjava/java/security/acl/AclNotFoundException.java4
-rw-r--r--libjava/java/security/acl/LastOwnerException.java4
-rw-r--r--libjava/java/security/acl/NotOwnerException.java4
-rw-r--r--libjava/java/security/cert/CertPath.java6
-rw-r--r--libjava/java/security/cert/CertPathBuilderException.java4
-rw-r--r--libjava/java/security/cert/CertPathValidatorException.java4
-rw-r--r--libjava/java/security/cert/CertStoreException.java4
-rw-r--r--libjava/java/security/cert/CertificateFactory.java2
-rw-r--r--libjava/java/security/interfaces/DSAPrivateKey.java5
-rw-r--r--libjava/java/security/interfaces/DSAPublicKey.java5
-rw-r--r--libjava/java/security/interfaces/RSAMultiPrimePrivateCrtKey.java1
-rw-r--r--libjava/java/security/interfaces/RSAPrivateCrtKey.java2
-rw-r--r--libjava/java/security/interfaces/RSAPrivateKey.java2
-rw-r--r--libjava/java/security/interfaces/RSAPublicKey.java2
-rw-r--r--libjava/java/text/BreakIterator.java4
-rw-r--r--libjava/java/text/ChoiceFormat.java4
-rw-r--r--libjava/java/text/CollationElementIterator.java11
-rw-r--r--libjava/java/text/CollationKey.java6
-rw-r--r--libjava/java/text/Collator.java4
-rw-r--r--libjava/java/text/DateFormat.java224
-rw-r--r--libjava/java/text/DateFormatSymbols.java4
-rw-r--r--libjava/java/text/DecimalFormat.java3
-rw-r--r--libjava/java/text/DecimalFormatSymbols.java2
-rw-r--r--libjava/java/text/FieldPosition.java4
-rw-r--r--libjava/java/text/Format.java4
-rw-r--r--libjava/java/text/MessageFormat.java194
-rw-r--r--libjava/java/text/NumberFormat.java2
-rw-r--r--libjava/java/text/ParseException.java4
-rw-r--r--libjava/java/text/ParsePosition.java4
-rw-r--r--libjava/java/text/RuleBasedCollator.java101
-rw-r--r--libjava/java/text/SimpleDateFormat.java906
-rw-r--r--libjava/java/text/StringCharacterIterator.java4
-rw-r--r--libjava/java/util/AbstractCollection.java4
-rw-r--r--libjava/java/util/AbstractList.java925
-rw-r--r--libjava/java/util/AbstractMap.java6
-rw-r--r--libjava/java/util/AbstractSequentialList.java4
-rw-r--r--libjava/java/util/AbstractSet.java4
-rw-r--r--libjava/java/util/ArrayList.java4
-rw-r--r--libjava/java/util/Arrays.java8
-rw-r--r--libjava/java/util/BitSet.java6
-rw-r--r--libjava/java/util/Calendar.java283
-rw-r--r--libjava/java/util/Collection.java4
-rw-r--r--libjava/java/util/Collections.java58
-rw-r--r--libjava/java/util/Comparator.java6
-rw-r--r--libjava/java/util/ConcurrentModificationException.java6
-rw-r--r--libjava/java/util/Currency.java10
-rw-r--r--libjava/java/util/Date.java3
-rw-r--r--libjava/java/util/EmptyStackException.java6
-rw-r--r--libjava/java/util/Enumeration.java6
-rw-r--r--libjava/java/util/EventListener.java4
-rw-r--r--libjava/java/util/EventListenerProxy.java4
-rw-r--r--libjava/java/util/EventObject.java4
-rw-r--r--libjava/java/util/GregorianCalendar.java816
-rw-r--r--libjava/java/util/HashMap.java6
-rw-r--r--libjava/java/util/HashSet.java4
-rw-r--r--libjava/java/util/Hashtable.java4
-rw-r--r--libjava/java/util/IdentityHashMap.java12
-rw-r--r--libjava/java/util/Iterator.java4
-rw-r--r--libjava/java/util/LinkedHashMap.java2
-rw-r--r--libjava/java/util/LinkedHashSet.java4
-rw-r--r--libjava/java/util/LinkedList.java6
-rw-r--r--libjava/java/util/List.java4
-rw-r--r--libjava/java/util/ListIterator.java4
-rw-r--r--libjava/java/util/ListResourceBundle.java4
-rw-r--r--libjava/java/util/Map.java6
-rw-r--r--libjava/java/util/MissingResourceException.java4
-rw-r--r--libjava/java/util/NoSuchElementException.java6
-rw-r--r--libjava/java/util/Observable.java6
-rw-r--r--libjava/java/util/Observer.java4
-rw-r--r--libjava/java/util/Properties.java4
-rw-r--r--libjava/java/util/PropertyPermission.java25
-rw-r--r--libjava/java/util/PropertyPermissionCollection.java4
-rw-r--r--libjava/java/util/RandomAccess.java4
-rw-r--r--libjava/java/util/Set.java4
-rw-r--r--libjava/java/util/SimpleTimeZone.java334
-rw-r--r--libjava/java/util/SortedMap.java4
-rw-r--r--libjava/java/util/SortedSet.java4
-rw-r--r--libjava/java/util/Stack.java6
-rw-r--r--libjava/java/util/StringTokenizer.java4
-rw-r--r--libjava/java/util/TimeZone.java1
-rw-r--r--libjava/java/util/Timer.java11
-rw-r--r--libjava/java/util/TooManyListenersException.java4
-rw-r--r--libjava/java/util/TreeMap.java10
-rw-r--r--libjava/java/util/TreeSet.java4
-rw-r--r--libjava/java/util/Vector.java4
-rw-r--r--libjava/java/util/jar/JarFile.java736
-rw-r--r--libjava/java/util/logging/FileHandler.java4
-rw-r--r--libjava/java/util/logging/Level.java4
-rw-r--r--libjava/java/util/logging/Logger.java16
-rw-r--r--libjava/java/util/logging/natLogger.cc55
-rw-r--r--libjava/java/util/prefs/AbstractPreferences.java2
-rw-r--r--libjava/java/util/prefs/BackingStoreException.java4
-rw-r--r--libjava/java/util/prefs/InvalidPreferencesFormatException.java5
-rw-r--r--libjava/java/util/prefs/Preferences.java6
519 files changed, 8658 insertions, 4864 deletions
diff --git a/libjava/java/applet/Applet.java b/libjava/java/applet/Applet.java
index a7609d9ab63..3adc5ce0a4b 100644
--- a/libjava/java/applet/Applet.java
+++ b/libjava/java/applet/Applet.java
@@ -1,5 +1,5 @@
/* Applet.java -- Java base applet class
- Copyright (C) 1999, 2002, 2004 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -63,8 +63,8 @@ import javax.accessibility.AccessibleStateSet;
* are init, stop, and destroy for control purposes, and getAppletInfo and
* getParameterInfo for descriptive purposes.
*
- * @author Aaron M. Renn <arenn@urbanophile.com>
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Aaron M. Renn (arenn@urbanophile.com)
+ * @author Eric Blake (ebb9@email.byu.edu)
* @since 1.0
* @status updated to 1.4
*/
@@ -477,7 +477,7 @@ public class Applet extends Panel
* This class provides accessibility support for Applets, and is the
* runtime type returned by {@link #getAccessibleContext()}.
*
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Eric Blake (ebb9@email.byu.edu)
* @since 1.3
*/
protected class AccessibleApplet extends AccessibleAWTPanel
diff --git a/libjava/java/awt/AWTError.java b/libjava/java/awt/AWTError.java
index 1c253cb41a6..e92bc01e67c 100644
--- a/libjava/java/awt/AWTError.java
+++ b/libjava/java/awt/AWTError.java
@@ -1,5 +1,5 @@
/* AWTError.java -- A serious AWT error occurred.
- Copyright (C) 1999, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -42,7 +42,7 @@ package java.awt;
* This error is thrown when a critical Abstract Window Toolkit (AWT) error
* occurs.
*
- * @author Aaron M. Renn <arenn@urbanophile.com>
+ * @author Aaron M. Renn (arenn@urbanophile.com)
* @status updated to 1.4
*/
public class AWTError extends Error
diff --git a/libjava/java/awt/AWTEvent.java b/libjava/java/awt/AWTEvent.java
index 675c27f9511..faa6dac25ef 100644
--- a/libjava/java/awt/AWTEvent.java
+++ b/libjava/java/awt/AWTEvent.java
@@ -50,8 +50,8 @@ import java.util.EventObject;
* listeners. Event masks are appropriately set when registering on
* components.
*
- * @author Warren Levy <warrenl@cygnus.com>
- * @author Aaron M. Renn <arenn@urbanophile.com>
+ * @author Warren Levy (warrenl@cygnus.com)
+ * @author Aaron M. Renn (arenn@urbanophile.com)
* @since 1.1
* @status updated to 1.4
*/
diff --git a/libjava/java/awt/AWTEventMulticaster.java b/libjava/java/awt/AWTEventMulticaster.java
index b26d1f35d05..943ffacfad3 100644
--- a/libjava/java/awt/AWTEventMulticaster.java
+++ b/libjava/java/awt/AWTEventMulticaster.java
@@ -107,8 +107,8 @@ import java.util.EventListener;
* new listener is then chained to the old.
*
* @author Bryce McKinlay
- * @author Aaron M. Renn <arenn@urbanophile.com>
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Aaron M. Renn (arenn@urbanophile.com)
+ * @author Eric Blake (ebb9@email.byu.edu)
* @since 1.1
* @status updated to 1.4
*/
diff --git a/libjava/java/awt/AWTException.java b/libjava/java/awt/AWTException.java
index e4ab6c9961f..49462a460e1 100644
--- a/libjava/java/awt/AWTException.java
+++ b/libjava/java/awt/AWTException.java
@@ -1,5 +1,5 @@
/* AWTException.java -- Generic AWT exception
- Copyright (C) 1999, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -42,7 +42,7 @@ package java.awt;
* This is a generic exception that indicates an exception occurred in the
* Abstract Window Toolkit (AWT) system.
*
- * @author Aaron M. Renn <arenn@urbanophile.com>
+ * @author Aaron M. Renn (arenn@urbanophile.com)
* @status updated to 1.4
*/
public class AWTException extends Exception
diff --git a/libjava/java/awt/AWTKeyStroke.java b/libjava/java/awt/AWTKeyStroke.java
index 53e64b7fb1b..977b3848d6d 100644
--- a/libjava/java/awt/AWTKeyStroke.java
+++ b/libjava/java/awt/AWTKeyStroke.java
@@ -1,5 +1,5 @@
/* AWTKeyStroke.java -- an immutable key stroke
- Copyright (C) 2002, 2004 Free Software Foundation
+ Copyright (C) 2002, 2004, 2005 Free Software Foundation
This file is part of GNU Classpath.
@@ -63,7 +63,7 @@ import java.util.StringTokenizer;
* instances of a subclass, using reflection, provided the subclass has a
* no-arg constructor (of any accessibility).
*
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Eric Blake (ebb9@email.byu.edu)
* @see #getAWTKeyStroke(char)
* @since 1.4
* @status updated to 1.4
@@ -393,15 +393,16 @@ public class AWTKeyStroke implements Serializable
* </code>
*
* @param s the string to parse
+ * @throws IllegalArgumentException if s is null or cannot be parsed
* @return the specified keystroke
- * @throws NullPointerException if s is null
- * @throws IllegalArgumentException if s cannot be parsed
*/
public static AWTKeyStroke getAWTKeyStroke(String s)
{
+ if (s == null)
+ throw new IllegalArgumentException("null argument");
StringTokenizer t = new StringTokenizer(s, " ");
if (! t.hasMoreTokens())
- throw new IllegalArgumentException();
+ throw new IllegalArgumentException("no tokens '" + s + "'");
int modifiers = 0;
boolean released = false;
String token = null;
@@ -432,7 +433,8 @@ public class AWTKeyStroke implements Serializable
KeyEvent.VK_UNDEFINED, modifiers,
false);
}
- throw new IllegalArgumentException();
+ throw new IllegalArgumentException("Invalid 'typed' argument '"
+ + s + "'");
}
else if ("pressed".equals(token))
{
@@ -453,8 +455,11 @@ public class AWTKeyStroke implements Serializable
while (t.hasMoreTokens());
// Now token contains the VK name we must parse.
Integer code = (Integer) vktable.get(token);
- if (code == null || t.hasMoreTokens())
- throw new IllegalArgumentException();
+ if (code == null)
+ throw new IllegalArgumentException("Unknown token '" + token
+ + "' in '" + s + "'");
+ if (t.hasMoreTokens())
+ throw new IllegalArgumentException("Too many tokens: " + s);
return getAWTKeyStroke(KeyEvent.CHAR_UNDEFINED, code.intValue(),
modifiers, released);
}
diff --git a/libjava/java/awt/AWTPermission.java b/libjava/java/awt/AWTPermission.java
index b5ba63d58d0..fc4ae08d55e 100644
--- a/libjava/java/awt/AWTPermission.java
+++ b/libjava/java/awt/AWTPermission.java
@@ -82,7 +82,7 @@ import java.security.BasicPermission;
* <td>malicious code could masquerade as a trusted program</td></tr>
* </table>
*
- * @author Tom Tromey <tromey@redhat.com>
+ * @author Tom Tromey (tromey@redhat.com)
* @since 1.2
* @status updated to 1.4
*/
diff --git a/libjava/java/awt/ActiveEvent.java b/libjava/java/awt/ActiveEvent.java
index d43fef16df1..5710b38c470 100644
--- a/libjava/java/awt/ActiveEvent.java
+++ b/libjava/java/awt/ActiveEvent.java
@@ -47,7 +47,7 @@ package java.awt;
* untrusted code. For example, system code should use an ActiveEvent to
* invoke user code securely.
*
- * @author Tom Tromey <tromey@cygnus.com>
+ * @author Tom Tromey (tromey@cygnus.com)
* @since 1.2
* @status updated to 1.4
*/
diff --git a/libjava/java/awt/Adjustable.java b/libjava/java/awt/Adjustable.java
index 815c77ca936..053ddd1c1e3 100644
--- a/libjava/java/awt/Adjustable.java
+++ b/libjava/java/awt/Adjustable.java
@@ -1,5 +1,5 @@
/* Adjustable.java -- Objects with a numeric adjustment scale
- Copyright (C) 1999, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -44,7 +44,7 @@ import java.awt.event.AdjustmentListener;
* This interface is for objects that take a numeric value that can be
* adjusted within a bounded range. For example, a scroll bar.
*
- * @author Aaron M. Renn <arenn@urbanophile.com>
+ * @author Aaron M. Renn (arenn@urbanophile.com)
* @since 1.0
* @status updated to 1.4
*/
diff --git a/libjava/java/awt/AlphaComposite.java b/libjava/java/awt/AlphaComposite.java
index f0795a96010..3c7744ba51e 100644
--- a/libjava/java/awt/AlphaComposite.java
+++ b/libjava/java/awt/AlphaComposite.java
@@ -1,5 +1,5 @@
/* AlphaComposite.java -- provides a context for performing alpha compositing
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -44,7 +44,7 @@ import java.util.Map;
/**
*
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Eric Blake (ebb9@email.byu.edu)
* @see Composite
* @see CompositeContext
* @since 1.3
diff --git a/libjava/java/awt/AttributeValue.java b/libjava/java/awt/AttributeValue.java
index f692c012f9f..10efab18375 100644
--- a/libjava/java/awt/AttributeValue.java
+++ b/libjava/java/awt/AttributeValue.java
@@ -1,5 +1,5 @@
/* AttributeValue.java -- parent of type-safe enums of attributes
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -44,7 +44,7 @@ package java.awt;
* <code>equals</code>, <code>toString</code>, and <code>hashCode</code>, so
* that you don't have to (although hashCode is commonly overridden).
*
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Eric Blake (ebb9@email.byu.edu)
*/
class AttributeValue
{
diff --git a/libjava/java/awt/BasicStroke.java b/libjava/java/awt/BasicStroke.java
index e302a0ebc9f..b1772548ac2 100644
--- a/libjava/java/awt/BasicStroke.java
+++ b/libjava/java/awt/BasicStroke.java
@@ -1,5 +1,5 @@
/* BasicStroke.java --
- Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -48,6 +48,7 @@ public class BasicStroke implements Stroke
public static final int JOIN_MITER = 0;
public static final int JOIN_ROUND = 1;
public static final int JOIN_BEVEL = 2;
+
public static final int CAP_BUTT = 0;
public static final int CAP_ROUND = 1;
public static final int CAP_SQUARE = 2;
@@ -208,11 +209,34 @@ public class BasicStroke implements Stroke
return phase;
}
+ /**
+ * Returns the hash code for this object. The hash is calculated by
+ * xoring the hash, cap, join, limit, dash array and phase values
+ * (converted to <code>int</code> first with
+ * <code>Float.floatToIntBits()</code> if the value is a
+ * <code>float</code>).
+ */
public int hashCode()
{
- throw new Error("not implemented");
+ int hash = Float.floatToIntBits(width);
+ hash ^= cap;
+ hash ^= join;
+ hash ^= Float.floatToIntBits(limit);
+
+ if (dash != null)
+ for (int i = 0; i < dash.length; i++)
+ hash ^= Float.floatToIntBits(dash[i]);
+
+ hash ^= Float.floatToIntBits(phase);
+
+ return hash;
}
+ /**
+ * Returns true if the given Object is an instance of BasicStroke
+ * and the width, cap, join, limit, dash array and phase are all
+ * equal.
+ */
public boolean equals(Object o)
{
if (! (o instanceof BasicStroke))
diff --git a/libjava/java/awt/BorderLayout.java b/libjava/java/awt/BorderLayout.java
index a023cbb059b..7a955d38139 100644
--- a/libjava/java/awt/BorderLayout.java
+++ b/libjava/java/awt/BorderLayout.java
@@ -1,5 +1,5 @@
/* BorderLayout.java -- A layout manager class
- Copyright (C) 1999, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -43,7 +43,7 @@ package java.awt;
* in certain sectors of the parent container.
*
* @author Aaron M. Renn (arenn@urbanophile.com)
- * @author Rolf W. Rasmussen <rolfwr@ii.uib.no>
+ * @author Rolf W. Rasmussen (rolfwr@ii.uib.no)
*/
public class BorderLayout implements LayoutManager2, java.io.Serializable
{
diff --git a/libjava/java/awt/BufferCapabilities.java b/libjava/java/awt/BufferCapabilities.java
index 871529e6e93..9f91711e18a 100644
--- a/libjava/java/awt/BufferCapabilities.java
+++ b/libjava/java/awt/BufferCapabilities.java
@@ -1,5 +1,5 @@
/* BufferCapabilities.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -41,7 +41,7 @@ package java.awt;
/**
* Needs documentation...
*
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Eric Blake (ebb9@email.byu.edu)
* @see BufferStrategy#getCapabilities()
* @see GraphicsConfiguration#getCapabilities()
* @since 1.4
diff --git a/libjava/java/awt/Button.java b/libjava/java/awt/Button.java
index 86cb37cac90..eb0fe3b7a20 100644
--- a/libjava/java/awt/Button.java
+++ b/libjava/java/awt/Button.java
@@ -1,5 +1,5 @@
/* Button.java -- AWT button widget
- Copyright (C) 1999, 2002, 2004 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -47,7 +47,6 @@ import java.util.EventListener;
import javax.accessibility.Accessible;
import javax.accessibility.AccessibleAction;
import javax.accessibility.AccessibleContext;
-import javax.accessibility.AccessibleRelation;
import javax.accessibility.AccessibleRole;
import javax.accessibility.AccessibleValue;
@@ -55,7 +54,7 @@ import javax.accessibility.AccessibleValue;
* This class provides a button widget for the AWT.
*
* @author Aaron M. Renn (arenn@urbanophile.com)
- * @author Tom Tromey <tromey@cygnus.com>
+ * @author Tom Tromey (tromey@cygnus.com)
*/
public class Button extends Component
implements java.io.Serializable, Accessible
@@ -97,7 +96,10 @@ private transient ActionListener action_listeners;
protected class AccessibleAWTButton extends AccessibleAWTComponent
implements AccessibleAction, AccessibleValue
{
- protected AccessibleAWTButton() { }
+ protected AccessibleAWTButton()
+ {
+ // Do nothing here.
+ }
/* (non-Javadoc)
* @see javax.accessibility.AccessibleAction#getAccessibleActionCount()
@@ -429,9 +431,18 @@ paramString()
+ getWidth () + "x" + getHeight () + ",label=" + getLabel ();
}
+/**
+ * Gets the AccessibleContext associated with this <code>Button</code>.
+ * The context is created, if necessary.
+ *
+ * @return the associated context
+ */
public AccessibleContext getAccessibleContext()
{
- return new AccessibleAWTButton();
+ /* Create the context if this is the first request */
+ if (accessibleContext == null)
+ accessibleContext = new AccessibleAWTButton();
+ return accessibleContext;
}
/**
diff --git a/libjava/java/awt/Canvas.java b/libjava/java/awt/Canvas.java
index d177c9b7d7a..e223d9eae77 100644
--- a/libjava/java/awt/Canvas.java
+++ b/libjava/java/awt/Canvas.java
@@ -54,8 +54,8 @@ import javax.accessibility.AccessibleRole;
* full-scale custom components.
*
* @author Original author unknown
- * @author Tom Tromey <tromey@redhat.com>
- * @author Andrew John Hughes <gnu_andrew@member.fsf.org>
+ * @author Tom Tromey (tromey@redhat.com)
+ * @author Andrew John Hughes (gnu_andrew@member.fsf.org)
* @since 1.0
*/
@@ -174,10 +174,7 @@ public class Canvas
{
/* Create the context if this is the first request */
if (accessibleContext == null)
- {
- /* Create the context */
- accessibleContext = new AccessibleAWTCanvas();
- }
+ accessibleContext = new AccessibleAWTCanvas();
return accessibleContext;
}
diff --git a/libjava/java/awt/Checkbox.java b/libjava/java/awt/Checkbox.java
index 04ace46cabe..2a8b62afd05 100644
--- a/libjava/java/awt/Checkbox.java
+++ b/libjava/java/awt/Checkbox.java
@@ -1,5 +1,5 @@
/* Checkbox.java -- An AWT checkbox widget
- Copyright (C) 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2000, 2001, 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -48,6 +48,7 @@ import javax.accessibility.AccessibleAction;
import javax.accessibility.AccessibleContext;
import javax.accessibility.AccessibleRole;
import javax.accessibility.AccessibleState;
+import javax.accessibility.AccessibleStateSet;
import javax.accessibility.AccessibleValue;
/**
@@ -55,7 +56,7 @@ import javax.accessibility.AccessibleValue;
* or more Checkboxes can be grouped by a CheckboxGroup.
*
* @author Aaron M. Renn (arenn@urbanophile.com)
- * @author Tom Tromey <tromey@redhat.com>
+ * @author Tom Tromey (tromey@redhat.com)
*/
public class Checkbox extends Component
implements ItemSelectable, Accessible, Serializable
@@ -94,13 +95,42 @@ private boolean state;
// The list of listeners for this object.
private transient ItemListener item_listeners;
-protected class AccessibleAWTCheckBox
+ /*
+ * The number used to generate the name returned by getName.
+ */
+ private static transient long next_checkbox_number;
+
+/**
+ * This class provides accessibility support for the
+ * checkbox.
+ *
+ * @author Jerry Quinn (jlquinn@optonline.net)
+ * @author Andrew John Hughes (gnu_andrew@member.fsf.org)
+ */
+protected class AccessibleAWTCheckbox
extends AccessibleAWTComponent
implements ItemListener, AccessibleAction, AccessibleValue
{
-
+ /**
+ * Serialization constant to match JDK 1.5
+ */
+ private static final long serialVersionUID = 7881579233144754107L;
+
+ /**
+ * Default constructor which simply calls the
+ * super class for generic component accessibility
+ * handling.
+ */
+ public AccessibleAWTCheckbox()
+ {
+ super();
+ }
- /* (non-Javadoc)
+ /**
+ * Captures changes to the state of the checkbox and
+ * fires appropriate accessible property change events.
+ *
+ * @param event the event fired.
* @see java.awt.event.ItemListener#itemStateChanged(java.awt.event.ItemEvent)
*/
public void itemStateChanged(ItemEvent event)
@@ -110,58 +140,121 @@ protected class AccessibleAWTCheckBox
state ? AccessibleState.CHECKED : null);
}
+ /**
+ * Returns an implementation of the <code>AccessibleAction</code>
+ * interface for this accessible object. In this case, the
+ * current instance is simply returned (with a more appropriate
+ * type), as it also implements the accessible action as well as
+ * the context.
+ *
+ * @return the accessible action associated with this context.
+ * @see javax.accessibility.AccessibleAction
+ */
public AccessibleAction getAccessibleAction()
{
return this;
}
+ /**
+ * Returns an implementation of the <code>AccessibleValue</code>
+ * interface for this accessible object. In this case, the
+ * current instance is simply returned (with a more appropriate
+ * type), as it also implements the accessible value as well as
+ * the context.
+ *
+ * @return the accessible value associated with this context.
+ * @see javax.accessibility.AccessibleValue
+ */
public AccessibleValue getAccessibleValue()
{
return this;
}
- /* (non-Javadoc)
+ /*
+ * The following methods are implemented in the JDK (up to
+ * 1.5) as stubs. We do likewise here.
+ */
+
+ /**
+ * Returns the number of actions associated with this accessible
+ * object. This default implementation returns 0.
+ *
+ * @return the number of accessible actions available.
* @see javax.accessibility.AccessibleAction#getAccessibleActionCount()
*/
public int getAccessibleActionCount()
{
- // 1.4.1 does this
+ // 1.4.1 and 1.5 do this
return 0;
}
- /* (non-Javadoc)
+ /**
+ * Returns a description of the action with the supplied id.
+ * This default implementation always returns null.
+ *
+ * @param i the id of the action whose description should be
+ * retrieved.
+ * @return a <code>String</code> describing the action.
* @see javax.accessibility.AccessibleAction#getAccessibleActionDescription(int)
*/
public String getAccessibleActionDescription(int i)
{
+ // 1.5 does this
return null;
}
- /* (non-Javadoc)
+ /**
+ * Executes the action with the specified id. This
+ * default implementation simply returns false.
+ *
+ * @param i the id of the action to perform.
+ * @return true if the action was performed.
* @see javax.accessibility.AccessibleAction#doAccessibleAction(int)
*/
public boolean doAccessibleAction(int i)
{
+ // 1.5 does this
return false;
}
- /* (non-Javadoc)
+ /**
+ * Returns the current value of this accessible object.
+ * If no value has been set, null is returned. This
+ * default implementation always returns null, regardless.
+ *
+ * @return the numeric value of this object, or null if
+ * no value has been set.
* @see javax.accessibility.AccessibleValue#getCurrentAccessibleValue()
*/
public Number getCurrentAccessibleValue()
{
+ // 1.5 does this
return null;
}
- /* (non-Javadoc)
+ /**
+ * Sets the current value of this accessible object
+ * to that supplied. In this default implementation,
+ * the value is never set and the method always returns
+ * false.
+ *
+ * @param number the new accessible value.
+ * @return true if the value was set.
* @see javax.accessibility.AccessibleValue#setCurrentAccessibleValue(java.lang.Number)
*/
public boolean setCurrentAccessibleValue(Number number)
{
+ // 1.5 does this
return false;
}
- /* (non-Javadoc)
+ /**
+ * Returns the minimum acceptable accessible value used
+ * by this object, or null if no minimum value exists.
+ * This default implementation always returns null.
+ *
+ * @return the minimum acceptable accessible value, or null
+ * if there is no minimum.
* @see javax.accessibility.AccessibleValue#getMinimumAccessibleValue()
*/
public Number getMinimumAccessibleValue()
@@ -169,7 +262,13 @@ protected class AccessibleAWTCheckBox
return null;
}
- /* (non-Javadoc)
+ /**
+ * Returns the maximum acceptable accessible value used
+ * by this object, or null if no maximum value exists.
+ * This default implementation always returns null.
+ *
+ * @return the maximum acceptable accessible value, or null
+ * if there is no maximum.
* @see javax.accessibility.AccessibleValue#getMaximumAccessibleValue()
*/
public Number getMaximumAccessibleValue()
@@ -177,11 +276,35 @@ protected class AccessibleAWTCheckBox
return null;
}
+ /**
+ * Returns the role of this accessible object.
+ *
+ * @return the instance of <code>AccessibleRole</code>,
+ * which describes this object.
+ * @see javax.accessibility.AccessibleRole
+ */
public AccessibleRole getAccessibleRole()
{
return AccessibleRole.CHECK_BOX;
}
+ /**
+ * Returns the state set of this accessible object.
+ *
+ * @return a set of <code>AccessibleState</code>s
+ * which represent the current state of the
+ * accessible object.
+ * @see javax.accessibility.AccessibleState
+ * @see javax.accessibility.AccessibleStateSet
+ */
+ public AccessibleStateSet getAccessibleStateSet()
+ {
+ AccessibleStateSet set = super.getAccessibleStateSet();
+ if (state)
+ set.add(AccessibleState.CHECKED);
+ return set;
+ }
+
}
/*************************************************************************/
@@ -490,11 +613,36 @@ paramString()
+ "," + super.paramString());
}
+/**
+ * Gets the AccessibleContext associated with this <code>Checkbox</code>.
+ * The context is created, if necessary.
+ *
+ * @return the associated context
+ */
public AccessibleContext getAccessibleContext()
{
- AccessibleAWTCheckBox ac = new AccessibleAWTCheckBox();
- addItemListener(ac);
- return ac;
+ /* Create the context if this is the first request */
+ if (accessibleContext == null)
+ {
+ AccessibleAWTCheckbox ac = new AccessibleAWTCheckbox();
+ accessibleContext = ac;
+ addItemListener(ac);
+ }
+ return accessibleContext;
}
-} // class Checkbox
+ /**
+ * Generate a unique name for this checkbox.
+ *
+ * @return A unique name for this checkbox.
+ */
+ String generateName()
+ {
+ return "checkbox" + getUniqueLong();
+ }
+
+ private static synchronized long getUniqueLong()
+ {
+ return next_checkbox_number++;
+ }
+}
diff --git a/libjava/java/awt/CheckboxGroup.java b/libjava/java/awt/CheckboxGroup.java
index 52af1903a9c..d5d22688ee3 100644
--- a/libjava/java/awt/CheckboxGroup.java
+++ b/libjava/java/awt/CheckboxGroup.java
@@ -1,5 +1,5 @@
/* CheckboxGroup.java -- A grouping class for checkboxes.
- Copyright (C) 1999, 2000, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2000, 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -43,7 +43,7 @@ package java.awt;
* one checkbox in the group can be selected at any one time.
*
* @author Aaron M. Renn (arenn@urbanophile.com)
- * @author Tom Tromey <tromey@redhat.com>
+ * @author Tom Tromey (tromey@redhat.com)
*/
public class CheckboxGroup implements java.io.Serializable
{
diff --git a/libjava/java/awt/CheckboxMenuItem.java b/libjava/java/awt/CheckboxMenuItem.java
index ab4cb60f03c..d5e4ef511fe 100644
--- a/libjava/java/awt/CheckboxMenuItem.java
+++ b/libjava/java/awt/CheckboxMenuItem.java
@@ -1,5 +1,5 @@
/* CheckboxMenuItem.java -- A menu option with a checkbox on it.
- Copyright (C) 1999, 2000, 2001, 2002, 2004 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2000, 2001, 2002, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -43,14 +43,20 @@ import java.awt.event.ItemListener;
import java.awt.peer.CheckboxMenuItemPeer;
import java.util.EventListener;
+import javax.accessibility.Accessible;
+import javax.accessibility.AccessibleAction;
+import javax.accessibility.AccessibleContext;
+import javax.accessibility.AccessibleValue;
+
/**
* This class implements a menu item that has a checkbox on it indicating
* the selected state of some option.
*
* @author Aaron M. Renn (arenn@urbanophile.com)
- * @author Tom Tromey <tromey@redhat.com>
+ * @author Tom Tromey (tromey@redhat.com)
*/
-public class CheckboxMenuItem extends MenuItem implements ItemSelectable
+public class CheckboxMenuItem extends MenuItem
+ implements ItemSelectable, Accessible
{
/*
@@ -268,6 +274,14 @@ processItemEvent(ItemEvent event)
void
dispatchEventImpl(AWTEvent e)
{
+ if (e instanceof ItemEvent)
+ {
+ synchronized (this)
+ {
+ state = (((ItemEvent) e).getStateChange() == ItemEvent.SELECTED);
+ }
+ }
+
if (e.id <= ItemEvent.ITEM_LAST
&& e.id >= ItemEvent.ITEM_FIRST
&& (item_listeners != null
@@ -315,5 +329,27 @@ paramString()
{
return (ItemListener[]) getListeners (ItemListener.class);
}
+
+
+ protected class AccessibleAWTCheckboxMenuItem extends AccessibleAWTMenuItem
+ implements AccessibleAction, AccessibleValue
+ {
+ // I think the base class provides the necessary implementation
+ }
+
+ /**
+ * Gets the AccessibleContext associated with this <code>CheckboxMenuItem</code>.
+ * The context is created, if necessary.
+ *
+ * @return the associated context
+ */
+ public AccessibleContext getAccessibleContext()
+ {
+ /* Create the context if this is the first request */
+ if (accessibleContext == null)
+ accessibleContext = new AccessibleAWTCheckboxMenuItem();
+ return accessibleContext;
+ }
+
} // class CheckboxMenuItem
diff --git a/libjava/java/awt/Choice.java b/libjava/java/awt/Choice.java
index 89e91ca78b8..c6a532a5b37 100644
--- a/libjava/java/awt/Choice.java
+++ b/libjava/java/awt/Choice.java
@@ -45,6 +45,7 @@ import java.io.Serializable;
import java.util.EventListener;
import java.util.Vector;
+import javax.accessibility.Accessible;
import javax.accessibility.AccessibleAction;
import javax.accessibility.AccessibleContext;
import javax.accessibility.AccessibleRole;
@@ -54,7 +55,8 @@ import javax.accessibility.AccessibleRole;
*
* @author Aaron M. Renn (arenn@urbanophile.com)
*/
-public class Choice extends Component implements ItemSelectable, Serializable
+public class Choice extends Component
+ implements ItemSelectable, Serializable, Accessible
{
/*
@@ -83,23 +85,65 @@ private int selectedIndex = -1;
// Listener chain
private ItemListener item_listeners;
+/**
+ * This class provides accessibility support for the
+ * combo box.
+ *
+ * @author Jerry Quinn (jlquinn@optonline.net)
+ * @author Andrew John Hughes (gnu_andrew@member.fsf.org)
+ */
protected class AccessibleAWTChoice
- extends Component.AccessibleAWTComponent
- implements AccessibleAction
+ extends AccessibleAWTComponent
+ implements AccessibleAction
{
+
+ /**
+ * Serialization constant to match JDK 1.5
+ */
+ private static final long serialVersionUID = 7175603582428509322L;
+
+ /**
+ * Default constructor which simply calls the
+ * super class for generic component accessibility
+ * handling.
+ */
+ public AccessibleAWTChoice()
+ {
+ super();
+ }
+
+ /**
+ * Returns an implementation of the <code>AccessibleAction</code>
+ * interface for this accessible object. In this case, the
+ * current instance is simply returned (with a more appropriate
+ * type), as it also implements the accessible action as well as
+ * the context.
+ *
+ * @return the accessible action associated with this context.
+ * @see javax.accessibility.AccessibleAction
+ */
public AccessibleAction getAccessibleAction()
{
return this;
}
- // FIXME: I think this is right, but should be checked by someone who
- // knows better.
+ /**
+ * Returns the role of this accessible object.
+ *
+ * @return the instance of <code>AccessibleRole</code>,
+ * which describes this object.
+ * @see javax.accessibility.AccessibleRole
+ */
public AccessibleRole getAccessibleRole()
{
- return AccessibleRole.POPUP_MENU;
+ return AccessibleRole.COMBO_BOX;
}
- /* (non-Javadoc)
+ /**
+ * Returns the number of actions associated with this accessible
+ * object. In this case, it is the number of choices available.
+ *
+ * @return the number of choices available.
* @see javax.accessibility.AccessibleAction#getAccessibleActionCount()
*/
public int getAccessibleActionCount()
@@ -107,7 +151,14 @@ private ItemListener item_listeners;
return pItems.size();
}
- /* (non-Javadoc)
+ /**
+ * Returns a description of the action with the supplied id.
+ * In this case, it is the text used in displaying the particular
+ * choice on-screen.
+ *
+ * @param i the id of the choice whose description should be
+ * retrieved.
+ * @return the <code>String</code> used to describe the choice.
* @see javax.accessibility.AccessibleAction#getAccessibleActionDescription(int)
*/
public String getAccessibleActionDescription(int i)
@@ -115,7 +166,13 @@ private ItemListener item_listeners;
return (String) pItems.get(i);
}
- /* (non-Javadoc)
+ /**
+ * Executes the action with the specified id. In this case,
+ * calling this method provides the same behaviour as would
+ * choosing a choice from the list in a visual manner.
+ *
+ * @param i the id of the choice to select.
+ * @return true if a valid choice was specified.
* @see javax.accessibility.AccessibleAction#doAccessibleAction(int)
*/
public boolean doAccessibleAction(int i)
@@ -564,8 +621,17 @@ paramString()
return (ItemListener[]) getListeners (ItemListener.class);
}
+ /**
+ * Gets the AccessibleContext associated with this <code>Choice</code>.
+ * The context is created, if necessary.
+ *
+ * @return the associated context
+ */
public AccessibleContext getAccessibleContext()
{
- return new AccessibleAWTChoice();
+ /* Create the context if this is the first request */
+ if (accessibleContext == null)
+ accessibleContext = new AccessibleAWTChoice();
+ return accessibleContext;
}
} // class Choice
diff --git a/libjava/java/awt/Color.java b/libjava/java/awt/Color.java
index c32438521be..c00aa9da038 100644
--- a/libjava/java/awt/Color.java
+++ b/libjava/java/awt/Color.java
@@ -1,5 +1,5 @@
/* Color.java -- represents a color in Java
- Copyright (C) 1999, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -53,7 +53,7 @@ import java.io.Serializable;
* <a href="http://www.w3.org/pub/WWW/Graphics/Color/sRGB.html">
* http://www.w3.org/pub/WWW/Graphics/Color/sRGB.html</a>.
*
- * @author Aaron M. Renn <arenn@urbanophile.com>
+ * @author Aaron M. Renn (arenn@urbanophile.com)
* @see ColorSpace
* @see AlphaComposite
* @since 1.0
diff --git a/libjava/java/awt/ColorPaintContext.java b/libjava/java/awt/ColorPaintContext.java
index 9fdfe61962d..3e3bac48280 100644
--- a/libjava/java/awt/ColorPaintContext.java
+++ b/libjava/java/awt/ColorPaintContext.java
@@ -1,5 +1,5 @@
/* ColorPaintContext.java -- context for painting solid colors
- Copyright (C) 2002, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -46,7 +46,7 @@ import java.awt.image.Raster;
* a raster scan with the given color. However, it is not yet completely
* implemented.
*
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Eric Blake (ebb9@email.byu.edu)
*/
class ColorPaintContext implements PaintContext
{
diff --git a/libjava/java/awt/Component.java b/libjava/java/awt/Component.java
index cb47f777acb..847a31da4b6 100644
--- a/libjava/java/awt/Component.java
+++ b/libjava/java/awt/Component.java
@@ -140,7 +140,7 @@ import javax.accessibility.AccessibleStateSet;
* present but commented out.
*
* @author original author unknown
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Eric Blake (ebb9@email.byu.edu)
* @since 1.0
* @status still missing 1.4 support
*/
@@ -1080,7 +1080,7 @@ public abstract class Component
*
* @return the locale for this component
* @throws IllegalComponentStateException if it has no locale or parent
- * @see setLocale(Locale)
+ * @see #setLocale(Locale)
* @since 1.1
*/
public Locale getLocale()
@@ -1362,7 +1362,7 @@ public abstract class Component
peer.setBounds (x, y, width, height);
// Erase old bounds and repaint new bounds for lightweights.
- if (isLightweight())
+ if (isLightweight() && isShowing ())
{
boolean shouldRepaintParent = false;
boolean shouldRepaintSelf = false;
@@ -1386,13 +1386,16 @@ public abstract class Component
repaint();
}
- if (oldx != x || oldy != y)
+ // Only post event if this component is visible and has changed size.
+ if (isShowing ()
+ && (oldx != x || oldy != y))
{
ComponentEvent ce = new ComponentEvent(this,
ComponentEvent.COMPONENT_MOVED);
getToolkit().getSystemEventQueue().postEvent(ce);
}
- if (oldwidth != width || oldheight != height)
+ if (isShowing ()
+ && (oldwidth != width || oldheight != height))
{
ComponentEvent ce = new ComponentEvent(this,
ComponentEvent.COMPONENT_RESIZED);
@@ -1955,7 +1958,7 @@ public abstract class Component
* @see Graphics#drawImage(Image, int, int, ImageObserver)
* @see Graphics#drawImage(Image, int, int, int, int, Color, ImageObserver)
* @see Graphics#drawImage(Image, int, int, int, int, ImageObserver)
- * @see ImageObserver#update(Image, int, int, int, int, int)
+ * @see ImageObserver#imageUpdate(Image, int, int, int, int, int)
*/
public boolean imageUpdate(Image img, int flags, int x, int y, int w, int h)
{
@@ -2097,7 +2100,7 @@ public abstract class Component
* @param observer the observer to notify of image loading progress
* @return the image observer flags indicating the status of the load
* @see #prepareImage(Image, int, int, ImageObserver)
- * @see #Toolkit#checkImage(Image, int, int, ImageObserver)
+ * @see Toolkit#checkImage(Image, int, int, ImageObserver)
* @throws NullPointerException if image is null
*/
public int checkImage(Image image, ImageObserver observer)
@@ -2115,7 +2118,7 @@ public abstract class Component
* @param observer the observer to notify of image loading progress
* @return the image observer flags indicating the status of the load
* @see #prepareImage(Image, int, int, ImageObserver)
- * @see #Toolkit#checkImage(Image, int, int, ImageObserver)
+ * @see Toolkit#checkImage(Image, int, int, ImageObserver)
*/
public int checkImage(Image image, int width, int height,
ImageObserver observer)
@@ -2134,7 +2137,7 @@ public abstract class Component
* @param ignoreRepaint the new setting for ignoring repaint events
* @see #getIgnoreRepaint()
* @see BufferStrategy
- * @see GraphicsDevice.setFullScreenWindow(Window)
+ * @see GraphicsDevice#setFullScreenWindow(Window)
* @since 1.4
*/
public void setIgnoreRepaint(boolean ignoreRepaint)
@@ -2250,9 +2253,9 @@ public abstract class Component
* calls {@link #postEvent}.
*
* @param e the event to deliver
- * @deprecated use {@link #dispatchEvent(AWTEvent)} instead
+ * @deprecated use {@link #dispatchEvent (AWTEvent)} instead
*/
- public void deliverEvent(Event e)
+ public void deliverEvent (Event e)
{
postEvent (e);
}
@@ -2284,7 +2287,7 @@ public abstract class Component
* @return true if the event was handled, false otherwise
* @deprecated use {@link #dispatchEvent(AWTEvent)} instead
*/
- public boolean postEvent(Event e)
+ public boolean postEvent (Event e)
{
boolean handled = handleEvent (e);
@@ -3178,8 +3181,8 @@ public abstract class Component
* AWT 1.0 event handler.
*
* This method calls one of the event-specific handler methods. For
- * example for key events, either {@link #keyDown (Event evt, int
- * key)} or {@link keyUp (Event evt, int key)} is called. A derived
+ * example for key events, either {@link #keyDown(Event,int)}
+ * or {@link #keyUp(Event,int)} is called. A derived
* component can override one of these event-specific methods if it
* only needs to handle certain event types. Otherwise it can
* override handleEvent itself and handle any event.
@@ -3188,7 +3191,7 @@ public abstract class Component
* @return true if the event was handled, false otherwise
* @deprecated use {@link #processEvent(AWTEvent)} instead
*/
- public boolean handleEvent(Event evt)
+ public boolean handleEvent (Event evt)
{
switch (evt.id)
{
@@ -3405,9 +3408,15 @@ public abstract class Component
*/
public void removeNotify()
{
- if (peer != null)
- peer.dispose();
+ // We null our peer field before disposing of it, such that if we're
+ // not the event dispatch thread and the dispatch thread is awoken by
+ // the dispose call, there will be no race checking the peer's null
+ // status.
+
+ ComponentPeer tmp = peer;
peer = null;
+ if (tmp != null)
+ tmp.dispose();
}
/**
@@ -3469,8 +3478,8 @@ public abstract class Component
* Specify whether this component can receive focus. This method also
* sets the {@link #isFocusTraversableOverridden} field to 1, which
* appears to be the undocumented way {@link
- * DefaultFocusTraversalPolicy#accept()} determines whether to respect
- * the {@link #isFocusable()} method of the component.
+ * DefaultFocusTraversalPolicy#accept(Component)} determines whether to
+ * respect the {@link #isFocusable()} method of the component.
*
* @param focusable the new focusable status
* @since 1.4
@@ -3484,10 +3493,10 @@ public abstract class Component
/**
* Sets the focus traversal keys for one of the three focus
- * traversal directions supported by Components: {@link
- * #KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS}, {@link
- * #KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS}, or {@link
- * #KeyboardFocusManager.UP_CYCLE_TRAVERSAL_KEYS}. Normally, the
+ * traversal directions supported by Components:
+ * {@link #KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS},
+ * {@link #KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS}, or
+ * {@link #KeyboardFocusManager.UP_CYCLE_TRAVERSAL_KEYS}. Normally, the
* default values should match the operating system's native
* choices. To disable a given traversal, use
* <code>Collections.EMPTY_SET</code>. The event dispatcher will
@@ -3716,7 +3725,7 @@ public abstract class Component
* receives a FOCUS_GAINED event.
*
* The behaviour of this method is platform-dependent.
- * {@link #requestFocusInWindow} should be used instead.
+ * {@link #requestFocusInWindow()} should be used instead.
*
* @see #requestFocusInWindow ()
* @see FocusEvent
@@ -3791,7 +3800,7 @@ public abstract class Component
* receives a FOCUS_GAINED event.
*
* The behaviour of this method is platform-dependent.
- * {@link #requestFocusInWindow} should be used instead.
+ * {@link #requestFocusInWindow()} should be used instead.
*
* If the return value is false, the request is guaranteed to fail.
* If the return value is true, the request will succeed unless it
@@ -3855,10 +3864,10 @@ public abstract class Component
currentFocusOwner));
}
else
- eq.postEvent (new FocusEvent(this, FocusEvent.FOCUS_GAINED, temporary));
+ eq.postEvent (new FocusEvent(this, FocusEvent.FOCUS_GAINED, temporary));
+ }
}
}
- }
else
// FIXME: need to add a focus listener to our top-level
// ancestor, so that we can post this event when it becomes
@@ -3973,10 +3982,10 @@ public abstract class Component
currentFocusOwner));
}
else
- eq.postEvent (new FocusEvent(this, FocusEvent.FOCUS_GAINED, temporary));
+ eq.postEvent (new FocusEvent(this, FocusEvent.FOCUS_GAINED, temporary));
+ }
}
}
- }
else
return false;
}
@@ -4069,8 +4078,8 @@ public abstract class Component
* However, if this is a Window, the default focus owner in the
* window in the current focus cycle is focused instead.
*
- * @see #requestFocus ()
- * @see #isFocusCycleRoot ()
+ * @see #requestFocus()
+ * @see #isFocusCycleRoot(Container)
* @since 1.4
*/
public void transferFocusUpCycle ()
@@ -4940,7 +4949,7 @@ p * <li>the set of backward traversal keys
/**
* This class provides accessibility support for subclasses of container.
*
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Eric Blake (ebb9@email.byu.edu)
* @since 1.3
* @status updated to 1.4
*/
@@ -5468,7 +5477,7 @@ p * <li>the set of backward traversal keys
/**
* Converts component changes into property changes.
*
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Eric Blake (ebb9@email.byu.edu)
* @since 1.3
* @status updated to 1.4
*/
@@ -5525,7 +5534,7 @@ p * <li>the set of backward traversal keys
/**
* Converts focus changes into property changes.
*
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Eric Blake (ebb9@email.byu.edu)
* @since 1.3
* @status updated to 1.4
*/
@@ -5565,7 +5574,7 @@ p * <li>the set of backward traversal keys
/**
* This class provides support for blitting offscreen surfaces.
*
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Eric Blake (ebb9@email.byu.edu)
* @since 1.4
* @XXX Shell class, to allow compilation. This needs documentation and
* correct implementation.
@@ -5601,7 +5610,7 @@ p * <li>the set of backward traversal keys
* This class provides support for flipping component buffers. It is only
* designed for use by Canvas and Window.
*
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Eric Blake (ebb9@email.byu.edu)
* @since 1.4
* @XXX Shell class, to allow compilation. This needs documentation and
* correct implementation.
diff --git a/libjava/java/awt/ComponentOrientation.java b/libjava/java/awt/ComponentOrientation.java
index 02cf5967ff2..8897470da48 100644
--- a/libjava/java/awt/ComponentOrientation.java
+++ b/libjava/java/awt/ComponentOrientation.java
@@ -67,7 +67,7 @@ import java.util.ResourceBundle;
* of isHorizontal() and isLeftToRight() rather than comparing objects with
* ==, especially since more constants may be added in the future.
*
- * @author Bryce McKinlay <bryce@albatross.co.nz>
+ * @author Bryce McKinlay (bryce@albatross.co.nz)
* @since 1.0
* @status updated to 1.4
*/
diff --git a/libjava/java/awt/Composite.java b/libjava/java/awt/Composite.java
index de873981652..c636921cc69 100644
--- a/libjava/java/awt/Composite.java
+++ b/libjava/java/awt/Composite.java
@@ -1,5 +1,5 @@
/* Composite.java -- graphics formed from composite layers
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -50,7 +50,7 @@ import java.awt.image.ColorModel;
* check on custom objects, <code>readDisplayPixels</code>, to prevent leaking
* restricted information graphically.
*
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Eric Blake (ebb9@email.byu.edu)
* @see AlphaComposite
* @see CompositeContext
* @see Graphics2D#setComposite(Composite)
diff --git a/libjava/java/awt/CompositeContext.java b/libjava/java/awt/CompositeContext.java
index dc3448b114b..301e7cff995 100644
--- a/libjava/java/awt/CompositeContext.java
+++ b/libjava/java/awt/CompositeContext.java
@@ -1,5 +1,5 @@
/* Composite.java -- the context for compositing graphics layers
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -45,7 +45,7 @@ import java.awt.image.WritableRaster;
* This interface provides an optimized environment for compositing graphics.
* Several such contexts may exist for a given <code>Composite</code> object.
*
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Eric Blake (ebb9@email.byu.edu)
* @see Composite
* @since 1.2
* @status updated to 1.4
diff --git a/libjava/java/awt/Container.java b/libjava/java/awt/Container.java
index 6c835d23d8e..cd7fec02ecb 100644
--- a/libjava/java/awt/Container.java
+++ b/libjava/java/awt/Container.java
@@ -1,5 +1,5 @@
/* Container.java -- parent container class in AWT
- Copyright (C) 1999, 2000, 2002, 2003, 2004 Free Software Foundation
+ Copyright (C) 1999, 2000, 2002, 2003, 2004, 2005 Free Software Foundation
This file is part of GNU Classpath.
@@ -67,7 +67,7 @@ import javax.swing.SwingUtilities;
* list or bottom of the stacking order.
*
* @author original author unknown
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Eric Blake (ebb9@email.byu.edu)
*
* @since 1.0
*
@@ -387,11 +387,14 @@ public class Container extends Component
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);
+ if (isShowing ())
+ {
+ // Post event to notify of adding the component.
+ ContainerEvent ce = new ContainerEvent(this,
+ ContainerEvent.COMPONENT_ADDED,
+ comp);
+ getToolkit().getSystemEventQueue().postEvent(ce);
+ }
}
}
@@ -419,11 +422,14 @@ public class Container extends Component
r.parent = null;
- // Post event to notify of adding the container.
- ContainerEvent ce = new ContainerEvent(this,
- ContainerEvent.COMPONENT_REMOVED,
- r);
- getToolkit().getSystemEventQueue().postEvent(ce);
+ if (isShowing ())
+ {
+ // Post event to notify of removing the component.
+ ContainerEvent ce = new ContainerEvent(this,
+ ContainerEvent.COMPONENT_REMOVED,
+ r);
+ getToolkit().getSystemEventQueue().postEvent(ce);
+ }
}
}
@@ -1046,11 +1052,14 @@ public class Container extends Component
*/
protected String paramString()
{
- String param = super.paramString();
- if (layoutMgr != null)
- param = param + ",layout=" + layoutMgr.getClass().getName();
+ if (layoutMgr == null)
+ return super.paramString();
- return param;
+ StringBuffer sb = new StringBuffer();
+ sb.append(super.paramString());
+ sb.append(",layout=");
+ sb.append(layoutMgr.getClass().getName());
+ return sb.toString();
}
/**
@@ -1677,32 +1686,48 @@ public class Container extends Component
static class GfxPaintVisitor extends GfxVisitor
{
- public void visit(Component c, Graphics gfx) { c.paint(gfx); }
public static final GfxVisitor INSTANCE = new GfxPaintVisitor();
+
+ public void visit(Component c, Graphics gfx)
+ {
+ c.paint(gfx);
+ }
}
static class GfxPrintVisitor extends GfxVisitor
{
- public void visit(Component c, Graphics gfx) { c.print(gfx); }
public static final GfxVisitor INSTANCE = new GfxPrintVisitor();
+
+ public void visit(Component c, Graphics gfx)
+ {
+ c.print(gfx);
+ }
}
static class GfxPaintAllVisitor extends GfxVisitor
{
- public void visit(Component c, Graphics gfx) { c.paintAll(gfx); }
public static final GfxVisitor INSTANCE = new GfxPaintAllVisitor();
+
+ public void visit(Component c, Graphics gfx)
+ {
+ c.paintAll(gfx);
+ }
}
static class GfxPrintAllVisitor extends GfxVisitor
{
- public void visit(Component c, Graphics gfx) { c.printAll(gfx); }
public static final GfxVisitor INSTANCE = new GfxPrintAllVisitor();
+
+ public void visit(Component c, Graphics gfx)
+ {
+ c.printAll(gfx);
+ }
}
/**
* This class provides accessibility support for subclasses of container.
*
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Eric Blake (ebb9@email.byu.edu)
*
* @since 1.3
*/
@@ -1791,7 +1816,7 @@ public class Container extends Component
* This class fires a <code>PropertyChange</code> listener, if registered,
* when children are added or removed from the enclosing accessible object.
*
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Eric Blake (ebb9@email.byu.edu)
*
* @since 1.3
*/
diff --git a/libjava/java/awt/ContainerOrderFocusTraversalPolicy.java b/libjava/java/awt/ContainerOrderFocusTraversalPolicy.java
index fa7ab4ad69a..91153e69935 100644
--- a/libjava/java/awt/ContainerOrderFocusTraversalPolicy.java
+++ b/libjava/java/awt/ContainerOrderFocusTraversalPolicy.java
@@ -1,5 +1,5 @@
/* ContainerOrderFocusTraversalPolicy.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -57,7 +57,7 @@ import java.io.Serializable;
* can override these acceptance criteria by overriding accept.
*
* @author Michael Koch
- * @author Thomas Fitzsimmons <fitzsim@redhat.com>
+ * @author Thomas Fitzsimmons (fitzsim@redhat.com)
* @since 1.4
*/
public class ContainerOrderFocusTraversalPolicy extends FocusTraversalPolicy
diff --git a/libjava/java/awt/DefaultFocusTraversalPolicy.java b/libjava/java/awt/DefaultFocusTraversalPolicy.java
index f49f386a19c..f9bd647a0fe 100644
--- a/libjava/java/awt/DefaultFocusTraversalPolicy.java
+++ b/libjava/java/awt/DefaultFocusTraversalPolicy.java
@@ -1,5 +1,5 @@
/* DefaultFocusTraversalPolicy.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -55,7 +55,7 @@ package java.awt;
* A Component's focusability is independent of the focusability of
* its peer.
*
- * @author Thomas Fitzsimmons <fitzsim@redhat.com>
+ * @author Thomas Fitzsimmons (fitzsim@redhat.com)
* @since 1.4
*/
public class DefaultFocusTraversalPolicy
diff --git a/libjava/java/awt/DefaultKeyboardFocusManager.java b/libjava/java/awt/DefaultKeyboardFocusManager.java
index 800b01d4639..9c94d8a220b 100644
--- a/libjava/java/awt/DefaultKeyboardFocusManager.java
+++ b/libjava/java/awt/DefaultKeyboardFocusManager.java
@@ -226,7 +226,7 @@ public class DefaultKeyboardFocusManager extends KeyboardFocusManager
Component focusOwner = getGlobalPermanentFocusOwner ();
if (focusOwner != null)
- processKeyEvent (focusOwner, (KeyEvent) e);
+ processKeyEvent (focusOwner, (KeyEvent) e);
if (e.isConsumed ())
return true;
diff --git a/libjava/java/awt/Dialog.java b/libjava/java/awt/Dialog.java
index 6bfb80c8563..8248df3c70d 100644
--- a/libjava/java/awt/Dialog.java
+++ b/libjava/java/awt/Dialog.java
@@ -1,5 +1,5 @@
/* Dialog.java -- An AWT dialog box
- Copyright (C) 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2000, 2001, 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -40,11 +40,16 @@ package java.awt;
import java.awt.peer.DialogPeer;
+import javax.accessibility.AccessibleContext;
+import javax.accessibility.AccessibleRole;
+import javax.accessibility.AccessibleState;
+import javax.accessibility.AccessibleStateSet;
+
/**
* A dialog box widget class.
*
- * @author Aaron M. Renn <arenn@urbanophile.com>
- * @author Tom Tromey <tromey@redhat.com>
+ * @author Aaron M. Renn (arenn@urbanophile.com)
+ * @author Tom Tromey (tromey@redhat.com)
*/
public class Dialog extends Window
{
@@ -511,5 +516,38 @@ paramString()
this.undecorated = undecorated;
}
+
+ protected class AccessibleAWTDialog extends AccessibleAWTWindow
+ {
+ public AccessibleRole getAccessibleRole()
+ {
+ return AccessibleRole.DIALOG;
+ }
+
+ public AccessibleStateSet getAccessibleState()
+ {
+ AccessibleStateSet states = super.getAccessibleStateSet();
+ if (isResizable())
+ states.add(AccessibleState.RESIZABLE);
+ if (isModal())
+ states.add(AccessibleState.MODAL);
+ return states;
+ }
+ }
+
+ /**
+ * Gets the AccessibleContext associated with this <code>Dialog</code>.
+ * The context is created, if necessary.
+ *
+ * @return the associated context
+ */
+ public AccessibleContext getAccessibleContext()
+ {
+ /* Create the context if this is the first request */
+ if (accessibleContext == null)
+ accessibleContext = new AccessibleAWTDialog();
+ return accessibleContext;
+ }
+
} // class Dialog
diff --git a/libjava/java/awt/Dimension.java b/libjava/java/awt/Dimension.java
index 282291d7ca7..270e04e70d1 100644
--- a/libjava/java/awt/Dimension.java
+++ b/libjava/java/awt/Dimension.java
@@ -53,9 +53,9 @@ import java.io.Serializable;
* manner, it is your own fault when you get invalid results. Also, this
* class is not threadsafe.
*
- * @author Per Bothner <bothner@cygnus.com>
- * @author Aaron M. Renn <arenn@urbanophile.com>
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Per Bothner (bothner@cygnus.com)
+ * @author Aaron M. Renn (arenn@urbanophile.com)
+ * @author Eric Blake (ebb9@email.byu.edu)
* @see Component
* @see LayoutManager
* @since 1.0
diff --git a/libjava/java/awt/DisplayMode.java b/libjava/java/awt/DisplayMode.java
index 533ab5ef482..a9fac604d0e 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, 2003 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2003, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -43,7 +43,7 @@ package java.awt;
* device configuration. They are device dependent, and may not always be
* available.
*
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Eric Blake (ebb9@email.byu.edu)
* @see GraphicsDevice
* @since 1.4
* @status updated to 1.4
diff --git a/libjava/java/awt/EventDispatchThread.java b/libjava/java/awt/EventDispatchThread.java
index 0803ff675c8..d55f0f5ea45 100644
--- a/libjava/java/awt/EventDispatchThread.java
+++ b/libjava/java/awt/EventDispatchThread.java
@@ -53,7 +53,6 @@ class EventDispatchThread extends Thread
setName("AWT-EventQueue-" + ++dispatchThreadNum);
this.queue = queue;
setPriority(NORM_PRIORITY + 1);
- start();
}
public void run()
@@ -63,11 +62,6 @@ class EventDispatchThread extends Thread
try
{
AWTEvent evt = queue.getNextEvent();
- if (isInterrupted ())
- {
- // We are interrupted when we should finish executing
- return;
- }
KeyboardFocusManager manager;
manager = KeyboardFocusManager.getCurrentKeyboardFocusManager ();
@@ -80,6 +74,11 @@ class EventDispatchThread extends Thread
if (!manager.dispatchEvent (evt))
queue.dispatchEvent(evt);
}
+ catch (ThreadDeath death)
+ {
+ // If someone wants to kill us, let them.
+ return;
+ }
catch (InterruptedException ie)
{
// We are interrupted when we should finish executing
diff --git a/libjava/java/awt/EventQueue.java b/libjava/java/awt/EventQueue.java
index fd1c8062d71..a2356cc6393 100644
--- a/libjava/java/awt/EventQueue.java
+++ b/libjava/java/awt/EventQueue.java
@@ -1,4 +1,5 @@
-/* Copyright (C) 1999, 2000, 2001, 2002, 2003 Free Software Foundation
+/* EventQueue.java --
+ Copyright (C) 1999, 2000, 2001, 2002, 2003, 2005 Free Software Foundation
This file is part of GNU Classpath.
@@ -37,9 +38,12 @@ exception statement from your version. */
package java.awt;
+import gnu.java.awt.ClasspathToolkit;
+
import java.awt.event.ActionEvent;
import java.awt.event.InputEvent;
import java.awt.event.InvocationEvent;
+import java.awt.event.WindowEvent;
import java.lang.reflect.InvocationTargetException;
import java.util.EmptyStackException;
@@ -71,6 +75,35 @@ public class EventQueue
private long lastWhen = System.currentTimeMillis();
private EventDispatchThread dispatchThread = new EventDispatchThread(this);
+ private boolean shutdown = false;
+
+ private long lastNativeQueueAccess = 0;
+ private long humanLatencyThreshold = 100;
+
+ synchronized void setShutdown (boolean b)
+ {
+ shutdown = b;
+ }
+
+ synchronized boolean isShutdown ()
+ {
+ if (shutdown)
+ return true;
+
+ // This is the exact self-shutdown condition specified in J2SE:
+ // http://java.sun.com/j2se/1.4.2/docs/api/java/awt/doc-files/AWTThreadIssues.html
+
+ if (peekEvent() == null
+ && ((ClasspathToolkit) Toolkit.getDefaultToolkit()).nativeQueueEmpty())
+ {
+ Frame[] frames = Frame.getFrames();
+ for (int i = 0; i < frames.length; ++i)
+ if (frames[i].isDisplayable())
+ return false;
+ return true;
+ }
+ return false;
+ }
/**
* Initializes a new instance of <code>EventQueue</code>.
@@ -93,9 +126,51 @@ public class EventQueue
{
if (next != null)
return next.getNextEvent();
+
+ ClasspathToolkit tk = ((ClasspathToolkit) Toolkit.getDefaultToolkit());
+ long curr = System.currentTimeMillis();
+
+ if (! tk.nativeQueueEmpty() &&
+ (curr - lastNativeQueueAccess > humanLatencyThreshold))
+ {
+ tk.iterateNativeQueue(this, false);
+ lastNativeQueueAccess = curr;
+ }
while (next_in == next_out)
- wait();
+ {
+ // Only the EventDispatchThread associated with the top of the stack is
+ // allowed to get events from the native source; everyone else just
+ // waits on the head of the queue.
+
+ if (isDispatchThread())
+ {
+ // We are not allowed to return null from this method, yet it
+ // is possible that we actually have run out of native events
+ // in the enclosing while() loop, and none of the native events
+ // happened to cause AWT events. We therefore ought to check
+ // the isShutdown() condition here, before risking a "native
+ // wait". If we check it before entering this function we may
+ // wait forever for events after the shutdown condition has
+ // arisen.
+
+ if (isShutdown())
+ throw new InterruptedException();
+
+ tk.iterateNativeQueue(this, true);
+ lastNativeQueueAccess = System.currentTimeMillis();
+ }
+ else
+ {
+ try
+ {
+ wait();
+ }
+ catch (InterruptedException ie)
+ {
+ }
+ }
+ }
AWTEvent res = queue[next_out];
@@ -215,6 +290,22 @@ public class EventQueue
next_out = 0;
next_in = oldQueue.length;
}
+
+ if (dispatchThread == null || !dispatchThread.isAlive())
+ {
+ dispatchThread = new EventDispatchThread(this);
+ dispatchThread.start();
+ }
+
+ // Window events might represent the closing of a window, which
+ // might cause the end of the dispatch thread's life, so we'll wake
+ // it up here to give it a chance to check for shutdown.
+
+ if (!isDispatchThread()
+ || (evt.getID() == WindowEvent.WINDOW_CLOSED)
+ || (evt.getID() == WindowEvent.WINDOW_CLOSING))
+ ((ClasspathToolkit) Toolkit.getDefaultToolkit()).wakeNativeQueue();
+
notify();
}
@@ -386,9 +477,10 @@ public class EventQueue
next_in = 0;
next_out = 0;
- // Tell our EventDispatchThread that it can end execution
- dispatchThread.interrupt ();
+ ((ClasspathToolkit) Toolkit.getDefaultToolkit()).wakeNativeQueue();
+ setShutdown(true);
dispatchThread = null;
+ this.notifyAll();
}
}
}
diff --git a/libjava/java/awt/FileDialog.java b/libjava/java/awt/FileDialog.java
index e345018550a..3e22d02e53d 100644
--- a/libjava/java/awt/FileDialog.java
+++ b/libjava/java/awt/FileDialog.java
@@ -1,5 +1,5 @@
/* FileDialog.java -- A filename selection dialog box
- Copyright (C) 1999, 2000, 2001, 2002, 2004 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2000, 2001, 2002, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -46,7 +46,7 @@ import java.io.Serializable;
* This class implements a file selection dialog box widget.
*
* @author Aaron M. Renn (arenn@urbanophile.com)
- * @author Tom Tromey <tromey@redhat.com>
+ * @author Tom Tromey (tromey@redhat.com)
*/
public class FileDialog extends Dialog implements Serializable
{
diff --git a/libjava/java/awt/Font.java b/libjava/java/awt/Font.java
index 4b2ad5a4f9f..c43297759ca 100644
--- a/libjava/java/awt/Font.java
+++ b/libjava/java/awt/Font.java
@@ -1,5 +1,5 @@
/* Font.java -- Font object
- Copyright (C) 1999, 2002, 2004 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -247,7 +247,10 @@ private static final long serialVersionUID = -4206021311591459213L;
{
tokenval = Integer.parseInt(token);
}
- catch(NumberFormatException e) { ; }
+ catch(NumberFormatException e)
+ {
+ // Ignored.
+ }
if (tokenval != 0)
size = tokenval;
diff --git a/libjava/java/awt/FontFormatException.java b/libjava/java/awt/FontFormatException.java
index 4ab53bbe834..2971e1de892 100644
--- a/libjava/java/awt/FontFormatException.java
+++ b/libjava/java/awt/FontFormatException.java
@@ -1,5 +1,5 @@
/* FontFormatException.java -- the specified font is bad
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -41,7 +41,7 @@ package java.awt;
/**
* Thrown when a specified font is bad.
*
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Eric Blake (ebb9@email.byu.edu)
* @see Font
* @since 1.3
* @status updated to 1.4
diff --git a/libjava/java/awt/Frame.java b/libjava/java/awt/Frame.java
index 80d2c99ae4d..d180984ab9d 100644
--- a/libjava/java/awt/Frame.java
+++ b/libjava/java/awt/Frame.java
@@ -1,5 +1,5 @@
/* Frame.java -- AWT toplevel window
- Copyright (C) 1999, 2000, 2002, 2004 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2000, 2002, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -39,8 +39,16 @@ exception statement from your version. */
package java.awt;
import java.awt.peer.FramePeer;
+import java.lang.ref.WeakReference;
+import java.util.ArrayList;
+import java.util.Iterator;
import java.util.Vector;
+import javax.accessibility.AccessibleContext;
+import javax.accessibility.AccessibleRole;
+import javax.accessibility.AccessibleState;
+import javax.accessibility.AccessibleStateSet;
+
/**
* This class is a top-level window with a title bar and window
* decorations.
@@ -196,7 +204,7 @@ private String title = "";
*/
private boolean undecorated = false;
-/*
+ /*
* The number used to generate the name returned by getName.
*/
private static transient long next_frame_number;
@@ -209,6 +217,7 @@ public
Frame()
{
this("");
+ noteFrame(this);
}
/**
@@ -224,6 +233,7 @@ Frame(String title)
this.title = title;
// Top-level frames are initially invisible.
visible = false;
+ noteFrame(this);
}
public
@@ -231,6 +241,7 @@ Frame(GraphicsConfiguration gc)
{
super(gc);
visible = false;
+ noteFrame(this);
}
public
@@ -239,6 +250,7 @@ Frame(String title, GraphicsConfiguration gc)
super(gc);
setTitle(title);
visible = false;
+ noteFrame(this);
}
/**
@@ -391,6 +403,17 @@ remove(MenuComponent menu)
/**
* Notifies this frame that it should create its native peer.
*/
+private static void fireDummyEvent()
+{
+ EventQueue.invokeLater(new Runnable()
+ {
+ public void run()
+ {
+ // Do nothing here.
+ }
+ });
+}
+
public void
addNotify()
{
@@ -398,6 +421,12 @@ addNotify()
menuBar.addNotify();
if (peer == null)
peer = getToolkit ().createFrame (this);
+
+ // We now know there's a Frame (us) with a live peer, so we can start the
+ // fundamental queue and dispatch thread, by inserting a dummy event.
+ if (parent != null && parent.isDisplayable())
+ fireDummyEvent();
+
super.addNotify();
}
@@ -406,15 +435,21 @@ public void removeNotify()
if (menuBar != null)
menuBar.removeNotify();
super.removeNotify();
+
+ // By now we've been disconnected from the peer, and the peer set to
+ // null. This is formally the same as saying "we just became
+ // un-displayable", so we wake up the event queue with a dummy event to
+ // see if it's time to shut down.
+ fireDummyEvent();
}
-/**
- * Returns a debugging string describing this window.
- *
- * @return A debugging string describing this window.
- */
+ /**
+ * Returns a debugging string describing this window.
+ *
+ * @return A debugging string describing this window.
+ */
protected String paramString ()
-{
+ {
String title = getTitle ();
String resizable = "";
@@ -442,15 +477,43 @@ public void removeNotify()
}
return super.paramString () + ",title=" + title + resizable + state;
+ }
+
+private static ArrayList weakFrames = new ArrayList();
+
+private static void noteFrame(Frame f)
+{
+ weakFrames.add(new WeakReference(f));
}
-public static Frame[]
-getFrames()
+public static Frame[] getFrames()
{
- //Frame[] array = new Frames[frames.size()];
- //return frames.toArray(array);
- String msg = "FIXME: can't be implemented without weak references";
- throw new UnsupportedOperationException(msg);
+ int n = 0;
+ synchronized (weakFrames)
+ {
+ Iterator i = weakFrames.iterator();
+ while (i.hasNext())
+ {
+ WeakReference wr = (WeakReference) i.next();
+ if (wr.get() != null)
+ ++n;
+ }
+ if (n == 0)
+ return new Frame[0];
+ else
+ {
+ Frame[] frames = new Frame[n];
+ n = 0;
+ i = weakFrames.iterator();
+ while (i.hasNext())
+ {
+ WeakReference wr = (WeakReference) i.next();
+ if (wr.get() != null)
+ frames[n++] = (Frame) wr.get();
+ }
+ return frames;
+ }
+ }
}
public void setState (int state)
@@ -549,4 +612,37 @@ getFrames()
{
return next_frame_number++;
}
+
+ protected class AccessibleAWTFrame extends AccessibleAWTWindow
+ {
+ public AccessibleRole getAccessibleRole()
+ {
+ return AccessibleRole.FRAME;
+ }
+
+ public AccessibleStateSet getAccessibleState()
+ {
+ AccessibleStateSet states = super.getAccessibleStateSet();
+ if (isResizable())
+ states.add(AccessibleState.RESIZABLE);
+ if ((state & ICONIFIED) != 0)
+ states.add(AccessibleState.ICONIFIED);
+ return states;
+ }
+ }
+
+ /**
+ * Gets the AccessibleContext associated with this <code>Frame</code>.
+ * The context is created, if necessary.
+ *
+ * @return the associated context
+ */
+ public AccessibleContext getAccessibleContext()
+ {
+ /* Create the context if this is the first request */
+ if (accessibleContext == null)
+ accessibleContext = new AccessibleAWTFrame();
+ return accessibleContext;
+ }
+
}
diff --git a/libjava/java/awt/Graphics.java b/libjava/java/awt/Graphics.java
index 8dc703c3274..c1dfbda2a36 100644
--- a/libjava/java/awt/Graphics.java
+++ b/libjava/java/awt/Graphics.java
@@ -1,5 +1,5 @@
/* Graphics.java -- Abstract Java drawing class
- Copyright (C) 1999, 2000, 2002, 2004 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2000, 2002, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -46,7 +46,7 @@ import java.text.AttributedCharacterIterator;
* devices such as the screen or printers.
*
* @author Aaron M. Renn (arenn@urbanophile.com)
- * @author Warren Levy <warrenl@cygnus.com>
+ * @author Warren Levy (warrenl@cygnus.com)
*/
public abstract class Graphics
{
diff --git a/libjava/java/awt/Graphics2D.java b/libjava/java/awt/Graphics2D.java
index e16c2d8fbef..c845c4c1d3b 100644
--- a/libjava/java/awt/Graphics2D.java
+++ b/libjava/java/awt/Graphics2D.java
@@ -49,7 +49,7 @@ import java.text.AttributedCharacterIterator;
import java.util.Map;
/**
- * @author Rolf W. Rasmussen <rolfwr@ii.uib.no>
+ * @author Rolf W. Rasmussen (rolfwr@ii.uib.no)
*/
public abstract class Graphics2D extends Graphics
{
diff --git a/libjava/java/awt/GraphicsConfigTemplate.java b/libjava/java/awt/GraphicsConfigTemplate.java
index 52da16799b7..76cf8b690a4 100644
--- a/libjava/java/awt/GraphicsConfigTemplate.java
+++ b/libjava/java/awt/GraphicsConfigTemplate.java
@@ -1,5 +1,5 @@
/* GraphicsConfigTemplate.java -- a template for selecting configurations
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -45,7 +45,7 @@ import java.io.Serializable;
* one based on various requirements. The resulting configuration has had
* all non-default attributes set as required to meet or exceed the request.
*
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Eric Blake (ebb9@email.byu.edu)
* @see GraphicsConfiguration
* @see GraphicsDevice
* @since 1.2
diff --git a/libjava/java/awt/GraphicsConfiguration.java b/libjava/java/awt/GraphicsConfiguration.java
index c7d0ed4ac8a..97f687e92e6 100644
--- a/libjava/java/awt/GraphicsConfiguration.java
+++ b/libjava/java/awt/GraphicsConfiguration.java
@@ -53,7 +53,7 @@ import java.awt.image.VolatileImage;
* configuration will have a non-zero relative coordinate system in such
* a case.
*
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Eric Blake (ebb9@email.byu.edu)
* @see Window
* @see Frame
* @see GraphicsEnvironment
diff --git a/libjava/java/awt/GraphicsDevice.java b/libjava/java/awt/GraphicsDevice.java
index 27d3cd67ca0..c01723356b3 100644
--- a/libjava/java/awt/GraphicsDevice.java
+++ b/libjava/java/awt/GraphicsDevice.java
@@ -1,5 +1,5 @@
/* GraphicsDevice.java -- information about a graphics device
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -44,7 +44,7 @@ package java.awt;
* each device. Also, this allows you to create virtual devices which operate
* over a multi-screen environment.
*
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Eric Blake (ebb9@email.byu.edu)
* @see GraphicsEnvironment
* @see GraphicsConfiguration
* @since 1.3
diff --git a/libjava/java/awt/GridBagLayout.java b/libjava/java/awt/GridBagLayout.java
index 85fdfb56eaa..0ee996ce715 100644
--- a/libjava/java/awt/GridBagLayout.java
+++ b/libjava/java/awt/GridBagLayout.java
@@ -1,5 +1,5 @@
/* GridBagLayout - Layout manager for components according to GridBagConstraints
- Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -44,8 +44,8 @@ import java.util.HashMap;
import java.util.Hashtable;
/**
- * @author Michael Koch <konqueror@gmx.de>
- * @author Jeroen Frijters <jeroen@frijters.net>
+ * @author Michael Koch (konqueror@gmx.de)
+ * @author Jeroen Frijters (jeroen@frijters.net)
*/
public class GridBagLayout
implements Serializable, LayoutManager2
diff --git a/libjava/java/awt/GridBagLayoutInfo.java b/libjava/java/awt/GridBagLayoutInfo.java
index 6bd7f6787a8..bb919b5570a 100644
--- a/libjava/java/awt/GridBagLayoutInfo.java
+++ b/libjava/java/awt/GridBagLayoutInfo.java
@@ -1,5 +1,5 @@
/* GridBagLayoutInfo -
- Copyright (C) 2003 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -41,7 +41,7 @@ package java.awt;
import java.io.Serializable;
/**
- * @author Michael Koch <konqueror@gmx.de>
+ * @author Michael Koch (konqueror@gmx.de)
*/
class GridBagLayoutInfo implements Serializable
{
diff --git a/libjava/java/awt/GridLayout.java b/libjava/java/awt/GridLayout.java
index a9e9eac6629..95980e6ca0b 100644
--- a/libjava/java/awt/GridLayout.java
+++ b/libjava/java/awt/GridLayout.java
@@ -52,7 +52,7 @@ import java.io.Serializable;
* horizontal and vertical gaps; these are used as spacing between
* cells.
*
- * @author Tom Tromey <tromey@redhat.com>
+ * @author Tom Tromey (tromey@redhat.com)
* @author Aaron M. Renn (arenn@urbanophile.com)
*/
public class GridLayout implements LayoutManager, Serializable
diff --git a/libjava/java/awt/HeadlessException.java b/libjava/java/awt/HeadlessException.java
index 4e7ef337f23..e88279aecea 100644
--- a/libjava/java/awt/HeadlessException.java
+++ b/libjava/java/awt/HeadlessException.java
@@ -1,5 +1,5 @@
/* HeadlessException.java -- operation not possible in headless environment
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -42,7 +42,7 @@ package java.awt;
* This exception is thrown when code dependent on a keyboard, mouse, or
* display is executed in a headless environment.
*
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Eric Blake (ebb9@email.byu.edu)
* @since 1.4
* @status updated to 1.4
*/
diff --git a/libjava/java/awt/IllegalComponentStateException.java b/libjava/java/awt/IllegalComponentStateException.java
index 413ed33a4f9..daa9d17dfde 100644
--- a/libjava/java/awt/IllegalComponentStateException.java
+++ b/libjava/java/awt/IllegalComponentStateException.java
@@ -1,5 +1,5 @@
/* IllegalComponentStateException.java -- bad component state
- Copyright (C) 1999, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -42,7 +42,7 @@ package java.awt;
* This exception is thrown when the requested operation failed because
* a component was not in the proper state.
*
- * @author Aaron M. Renn <arenn@urbanophile.com>
+ * @author Aaron M. Renn (arenn@urbanophile.com)
* @status updated to 1.4
*/
public class IllegalComponentStateException extends IllegalStateException
diff --git a/libjava/java/awt/Image.java b/libjava/java/awt/Image.java
index 37617719b01..39ab0687301 100644
--- a/libjava/java/awt/Image.java
+++ b/libjava/java/awt/Image.java
@@ -1,5 +1,5 @@
/* Image.java -- superclass for images
- Copyright (C) 1999, 2002, 2004 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -46,7 +46,7 @@ import java.awt.image.ReplicateScaleFilter;
/**
* This is the abstract superclass of all image objects in Java.
*
- * @author Aaron M. Renn <arenn@urbanophile.com>
+ * @author Aaron M. Renn (arenn@urbanophile.com)
* @since 1.0
* @status updated to 1.4
*/
diff --git a/libjava/java/awt/Insets.java b/libjava/java/awt/Insets.java
index 573005a7689..e818629a0f1 100644
--- a/libjava/java/awt/Insets.java
+++ b/libjava/java/awt/Insets.java
@@ -1,5 +1,5 @@
/* Insets.java -- information about a container border
- Copyright (C) 1999, 2000, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2000, 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -43,8 +43,8 @@ import java.io.Serializable;
/**
* This class represents the "margin" or space around a container.
*
- * @author Aaron M. Renn <arenn@urbanophile.com>
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Aaron M. Renn (arenn@urbanophile.com)
+ * @author Eric Blake (ebb9@email.byu.edu)
* @status
*/
public class Insets implements Cloneable, Serializable
diff --git a/libjava/java/awt/ItemSelectable.java b/libjava/java/awt/ItemSelectable.java
index ddf77aeb10a..74129fdda98 100644
--- a/libjava/java/awt/ItemSelectable.java
+++ b/libjava/java/awt/ItemSelectable.java
@@ -1,5 +1,5 @@
/* ItemSelectable.java -- items that can be selected
- Copyright (C) 1999, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -44,7 +44,7 @@ import java.awt.event.ItemListener;
* This interface is for objects that can have one or more items selected.
* For example, radio buttons.
*
- * @author Aaron M. Renn <arenn@urbanophile.com>
+ * @author Aaron M. Renn (arenn@urbanophile.com)
* @since 1.0
* @status updated to 1.4
*/
diff --git a/libjava/java/awt/JobAttributes.java b/libjava/java/awt/JobAttributes.java
index b64234dda5f..fc4240d316c 100644
--- a/libjava/java/awt/JobAttributes.java
+++ b/libjava/java/awt/JobAttributes.java
@@ -1,5 +1,5 @@
/* JobAttributes.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -41,7 +41,7 @@ package java.awt;
/**
* Needs documentation...
*
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Eric Blake (ebb9@email.byu.edu)
* @since 1.3
* @status updated to 1.4, lacks documentation
*/
diff --git a/libjava/java/awt/KeyEventDispatcher.java b/libjava/java/awt/KeyEventDispatcher.java
index 95aad8030d1..f9020e74bd3 100644
--- a/libjava/java/awt/KeyEventDispatcher.java
+++ b/libjava/java/awt/KeyEventDispatcher.java
@@ -1,5 +1,5 @@
/* KeyEventDispatcher.java -- dispatches key events
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -50,7 +50,7 @@ import java.awt.event.KeyEvent;
* dispatched by other dispatchers. Therefore, it is unnecessary for the user
* to register the focus manager as a dispatcher.
*
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Eric Blake (ebb9@email.byu.edu)
* @see KeyboardFocusManager#addKeyEventDispatcher(KeyEventDispatcher)
* @see KeyboardFocusManager#removeKeyEventDispatcher(KeyEventDispatcher)
* @since 1.4
diff --git a/libjava/java/awt/KeyEventPostProcessor.java b/libjava/java/awt/KeyEventPostProcessor.java
index 5069aaf510c..0bf6fe650b7 100644
--- a/libjava/java/awt/KeyEventPostProcessor.java
+++ b/libjava/java/awt/KeyEventPostProcessor.java
@@ -1,5 +1,5 @@
/* KeyEventPostProcessor.java -- performs actions after a key event dispatch
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -50,7 +50,7 @@ import java.awt.event.KeyEvent;
* post-processed elsewhere. Therefore, it is unnecessary for the user
* to register the focus manager as a dispatcher.
*
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Eric Blake (ebb9@email.byu.edu)
* @see KeyboardFocusManager#addKeyEventPostProcessor(KeyEventPostProcessor)
* @see KeyboardFocusManager#removeKeyEventPostProcessor(KeyEventPostProcessor)
* @since 1.4
diff --git a/libjava/java/awt/KeyboardFocusManager.java b/libjava/java/awt/KeyboardFocusManager.java
index 6fa56d8a88e..6ea213e3a78 100644
--- a/libjava/java/awt/KeyboardFocusManager.java
+++ b/libjava/java/awt/KeyboardFocusManager.java
@@ -109,9 +109,9 @@ import java.util.Set;
* applies recursively to any child components of such a window,
* which define no traversal keys of their own.
*
- * @author Eric Blake <ebb9@email.byu.edu>
- * @author Thomas Fitzsimmons <fitzsim@redhat.com>
- * @author Andrew John Hughes <gnu_andrew@member.fsf.org>
+ * @author Eric Blake (ebb9@email.byu.edu)
+ * @author Thomas Fitzsimmons (fitzsim@redhat.com)
+ * @author Andrew John Hughes (gnu_andrew@member.fsf.org)
* @since 1.4
*/
public abstract class KeyboardFocusManager
diff --git a/libjava/java/awt/Label.java b/libjava/java/awt/Label.java
index 189bc10a756..e1a43c8d189 100644
--- a/libjava/java/awt/Label.java
+++ b/libjava/java/awt/Label.java
@@ -1,5 +1,5 @@
/* Label.java -- Java label widget
- Copyright (C) 1999, 2000, 2002, 2004 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2000, 2002, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -49,8 +49,8 @@ import javax.accessibility.AccessibleRole;
* be edited by the user.
*
* @author Aaron M. Renn (arenn@urbanophile.com)
- * @author Tom Tromey <tromey@cygnus.com>
- * @author Andrew John Hughes <gnu_andrew@member.fsf.org>
+ * @author Tom Tromey (tromey@cygnus.com)
+ * @author Andrew John Hughes (gnu_andrew@member.fsf.org)
*/
public class Label extends Component implements Accessible
{
@@ -306,10 +306,7 @@ public AccessibleContext getAccessibleContext()
{
/* Create the context if this is the first request */
if (accessibleContext == null)
- {
- /* Create the context */
- accessibleContext = new AccessibleAWTLabel();
- }
+ accessibleContext = new AccessibleAWTLabel();
return accessibleContext;
}
diff --git a/libjava/java/awt/LayoutManager.java b/libjava/java/awt/LayoutManager.java
index 1231c3eb62f..62d5b9f6d84 100644
--- a/libjava/java/awt/LayoutManager.java
+++ b/libjava/java/awt/LayoutManager.java
@@ -1,5 +1,5 @@
/* LayoutManager.java -- lay out elements in a Container
- Copyright (C) 1999, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -41,7 +41,7 @@ package java.awt;
/**
* This interface is for laying out containers in a particular sequence.
*
- * @author Aaron M. Renn <arenn@urbanophile.com>
+ * @author Aaron M. Renn (arenn@urbanophile.com)
* @see Container
* @since 1.0
* @status updated to 1.4
diff --git a/libjava/java/awt/List.java b/libjava/java/awt/List.java
index 8fbbc07720e..e10cbaeeebf 100644
--- a/libjava/java/awt/List.java
+++ b/libjava/java/awt/List.java
@@ -47,6 +47,11 @@ import java.util.EventListener;
import java.util.Vector;
import javax.accessibility.Accessible;
+import javax.accessibility.AccessibleContext;
+import javax.accessibility.AccessibleRole;
+import javax.accessibility.AccessibleSelection;
+import javax.accessibility.AccessibleState;
+import javax.accessibility.AccessibleStateSet;
/**
* Class that implements a listbox widget
@@ -106,6 +111,7 @@ private ItemListener item_listeners;
// The list of ActionListeners for this object.
private ActionListener action_listeners;
+
/*************************************************************************/
/*
@@ -1076,4 +1082,182 @@ paramString()
{
return (ItemListener[]) getListeners (ItemListener.class);
}
+
+ // Accessibility internal class
+ protected class AccessibleAWTList extends AccessibleAWTComponent
+ implements AccessibleSelection, ItemListener, ActionListener
+ {
+ protected class AccessibleAWTListChild extends AccessibleAWTComponent
+ implements Accessible
+ {
+ private int index;
+ private List parent;
+
+ public AccessibleAWTListChild(List parent, int indexInParent)
+ {
+ this.parent = parent;
+ index = indexInParent;
+ if (parent == null)
+ index = -1;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.accessibility.Accessible#getAccessibleContext()
+ */
+ public AccessibleContext getAccessibleContext()
+ {
+ return this;
+ }
+
+ public AccessibleRole getAccessibleRole()
+ {
+ return AccessibleRole.LIST_ITEM;
+ }
+
+ public AccessibleStateSet getAccessibleStateSet()
+ {
+ AccessibleStateSet states = super.getAccessibleStateSet();
+ if (parent.isIndexSelected(index))
+ states.add(AccessibleState.SELECTED);
+ return states;
+ }
+
+ public int getAccessibleIndexInParent()
+ {
+ return index;
+ }
+
+ }
+
+ public AccessibleAWTList()
+ {
+ addItemListener(this);
+ addActionListener(this);
+ }
+
+ public AccessibleRole getAccessibleRole()
+ {
+ return AccessibleRole.LIST;
+ }
+
+ public AccessibleStateSet getAccessibleStateSet()
+ {
+ AccessibleStateSet states = super.getAccessibleStateSet();
+ states.add(AccessibleState.SELECTABLE);
+ if (isMultipleMode())
+ states.add(AccessibleState.MULTISELECTABLE);
+ return states;
+ }
+
+ public int getAccessibleChildrenCount()
+ {
+ return getItemCount();
+ }
+
+ public Accessible getAccessibleChild(int i)
+ {
+ if (i >= getItemCount())
+ return null;
+ return new AccessibleAWTListChild(List.this, i);
+ }
+
+ /* (non-Javadoc)
+ * @see javax.accessibility.AccessibleSelection#getAccessibleSelectionCount()
+ */
+ public int getAccessibleSelectionCount()
+ {
+ return getSelectedIndexes().length;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.accessibility.AccessibleSelection#getAccessibleSelection()
+ */
+ public AccessibleSelection getAccessibleSelection()
+ {
+ return this;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.accessibility.AccessibleSelection#getAccessibleSelection(int)
+ */
+ public Accessible getAccessibleSelection(int i)
+ {
+ int[] items = getSelectedIndexes();
+ if (i >= items.length)
+ return null;
+ return new AccessibleAWTListChild(List.this, items[i]);
+ }
+
+ /* (non-Javadoc)
+ * @see javax.accessibility.AccessibleSelection#isAccessibleChildSelected(int)
+ */
+ public boolean isAccessibleChildSelected(int i)
+ {
+ return isIndexSelected(i);
+ }
+
+ /* (non-Javadoc)
+ * @see javax.accessibility.AccessibleSelection#addAccessibleSelection(int)
+ */
+ public void addAccessibleSelection(int i)
+ {
+ select(i);
+ }
+
+ /* (non-Javadoc)
+ * @see javax.accessibility.AccessibleSelection#removeAccessibleSelection(int)
+ */
+ public void removeAccessibleSelection(int i)
+ {
+ deselect(i);
+ }
+
+ /* (non-Javadoc)
+ * @see javax.accessibility.AccessibleSelection#clearAccessibleSelection()
+ */
+ public void clearAccessibleSelection()
+ {
+ for (int i = 0; i < getItemCount(); i++)
+ deselect(i);
+ }
+
+ /* (non-Javadoc)
+ * @see javax.accessibility.AccessibleSelection#selectAllAccessibleSelection()
+ */
+ public void selectAllAccessibleSelection()
+ {
+ if (isMultipleMode())
+ for (int i = 0; i < getItemCount(); i++)
+ select(i);
+ }
+
+ /* (non-Javadoc)
+ * @see java.awt.event.ItemListener#itemStateChanged(java.awt.event.ItemEvent)
+ */
+ public void itemStateChanged(ItemEvent event)
+ {
+ }
+
+ /* (non-Javadoc)
+ * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
+ */
+ public void actionPerformed(ActionEvent event)
+ {
+ }
+
+ }
+
+ /**
+ * Gets the AccessibleContext associated with this <code>List</code>.
+ * The context is created, if necessary.
+ *
+ * @return the associated context
+ */
+ public AccessibleContext getAccessibleContext()
+ {
+ /* Create the context if this is the first request */
+ if (accessibleContext == null)
+ accessibleContext = new AccessibleAWTList();
+ return accessibleContext;
+ }
} // class List
diff --git a/libjava/java/awt/Menu.java b/libjava/java/awt/Menu.java
index 35798a066df..3cc9cc301ae 100644
--- a/libjava/java/awt/Menu.java
+++ b/libjava/java/awt/Menu.java
@@ -451,12 +451,18 @@ paramString()
}
}
- /* (non-Javadoc)
- * @see java.awt.MenuComponent#getAccessibleContext()
+ /**
+ * Gets the AccessibleContext associated with this <code>Menu</code>.
+ * The context is created, if necessary.
+ *
+ * @return the associated context
*/
public AccessibleContext getAccessibleContext()
{
- return new AccessibleAWTMenu();
+ /* Create the context if this is the first request */
+ if (accessibleContext == null)
+ accessibleContext = new AccessibleAWTMenu();
+ return accessibleContext;
}
} // class Menu
diff --git a/libjava/java/awt/MenuBar.java b/libjava/java/awt/MenuBar.java
index 6a97fa95685..ce5256fece7 100644
--- a/libjava/java/awt/MenuBar.java
+++ b/libjava/java/awt/MenuBar.java
@@ -1,5 +1,5 @@
/* MenuBar.java -- An AWT menu bar class
- Copyright (C) 1999, 2000, 2001, 2002, 2004 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2000, 2001, 2002, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -53,8 +53,8 @@ import javax.accessibility.AccessibleRole;
* This class implements a menu bar in the AWT system.
*
* @author Aaron M. Renn (arenn@urbanophile.com)
- * @author Tom Tromey <tromey@redhat.com>
- * @author Andrew John Hughes <gnu_andrew@member.fsf.org>
+ * @author Tom Tromey (tromey@redhat.com)
+ * @author Andrew John Hughes (gnu_andrew@member.fsf.org)
*/
public class MenuBar extends MenuComponent
implements MenuContainer, Serializable, Accessible
@@ -381,17 +381,14 @@ public AccessibleContext getAccessibleContext()
{
/* Create the context if this is the first request */
if (accessibleContext == null)
- {
- /* Create the context */
- accessibleContext = new AccessibleAWTMenuBar();
- }
+ accessibleContext = new AccessibleAWTMenuBar();
return accessibleContext;
}
/**
* This class provides accessibility support for AWT menu bars.
*
- * @author Andrew John Hughes <gnu_andrew@member.fsf.org>
+ * @author Andrew John Hughes (gnu_andrew@member.fsf.org)
*/
protected class AccessibleAWTMenuBar
extends AccessibleAWTMenuComponent
diff --git a/libjava/java/awt/MenuComponent.java b/libjava/java/awt/MenuComponent.java
index 78adfaea6e3..f5677feeb96 100644
--- a/libjava/java/awt/MenuComponent.java
+++ b/libjava/java/awt/MenuComponent.java
@@ -1,5 +1,5 @@
/* MenuComponent.java -- Superclass of all AWT menu components
- Copyright (C) 1999, 2000, 2002, 2003, 2004 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2000, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -55,7 +55,7 @@ import javax.accessibility.AccessibleStateSet;
* This is the superclass of all menu AWT widgets.
*
* @author Aaron M. Renn (arenn@urbanophile.com)
- * @author Andrew John Hughes <gnu_andrew@member.fsf.org>
+ * @author Andrew John Hughes (gnu_andrew@member.fsf.org)
*/
public abstract class MenuComponent implements Serializable
{
@@ -130,7 +130,7 @@ private static final long serialVersionUID = -4536902356223894379L;
* @see #getAccessibleContext()
* @serial the accessibility information for this component.
*/
- private AccessibleContext accessibleContext;
+ AccessibleContext accessibleContext;
/**
* Was the name of the component set? This value defaults
@@ -465,7 +465,7 @@ public AccessibleContext getAccessibleContext()
* This class provides a base for the accessibility support of menu
* components.
*
- * @author Andrew John Hughes <gnu_andrew@member.fsf.org>
+ * @author Andrew John Hughes (gnu_andrew@member.fsf.org)
*/
protected abstract class AccessibleAWTMenuComponent
extends AccessibleContext
diff --git a/libjava/java/awt/MenuContainer.java b/libjava/java/awt/MenuContainer.java
index dd8b3412e2b..08d1cb09c6f 100644
--- a/libjava/java/awt/MenuContainer.java
+++ b/libjava/java/awt/MenuContainer.java
@@ -1,5 +1,5 @@
/* MenuContainer.java -- container for menu items
- Copyright (C) 1999, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -41,7 +41,7 @@ package java.awt;
/**
* This interface is a container for menu components.
*
- * @author Aaron M. Renn <arenn@urbanophile.com>
+ * @author Aaron M. Renn (arenn@urbanophile.com)
* @since 1.0
* @status updated to 1.4
*/
diff --git a/libjava/java/awt/MenuItem.java b/libjava/java/awt/MenuItem.java
index a58774240ff..56082d36a9a 100644
--- a/libjava/java/awt/MenuItem.java
+++ b/libjava/java/awt/MenuItem.java
@@ -47,6 +47,7 @@ import java.util.EventListener;
import javax.accessibility.Accessible;
import javax.accessibility.AccessibleAction;
+import javax.accessibility.AccessibleContext;
import javax.accessibility.AccessibleRole;
import javax.accessibility.AccessibleValue;
@@ -562,7 +563,10 @@ protected void
processActionEvent(ActionEvent event)
{
if (action_listeners != null)
- action_listeners.actionPerformed(event);
+ {
+ event.setSource(this);
+ action_listeners.actionPerformed(event);
+ }
}
/*************************************************************************/
@@ -579,7 +583,18 @@ paramString()
",actionCommand=" + actionCommand + "," + super.paramString());
}
-// Accessibility API not yet implemented.
-// public AccessibleContext getAccessibleContext()
+/**
+ * Gets the AccessibleContext associated with this <code>MenuItem</code>.
+ * The context is created, if necessary.
+ *
+ * @return the associated context
+ */
+public AccessibleContext getAccessibleContext()
+{
+ /* Create the context if this is the first request */
+ if (accessibleContext == null)
+ accessibleContext = new AccessibleAWTMenuItem();
+ return accessibleContext;
+}
} // class MenuItem
diff --git a/libjava/java/awt/PageAttributes.java b/libjava/java/awt/PageAttributes.java
index 2501aa3eeaf..c94f857dc79 100644
--- a/libjava/java/awt/PageAttributes.java
+++ b/libjava/java/awt/PageAttributes.java
@@ -1,5 +1,5 @@
/* PageAttributes.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -43,7 +43,7 @@ import java.util.Locale;
/**
* Missing Documentation
*
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Eric Blake (ebb9@email.byu.edu)
* @since 1.3
* @status updated to 1.4, but missing documentation
*/
diff --git a/libjava/java/awt/Paint.java b/libjava/java/awt/Paint.java
index 94c30c0ff5d..fa136ec3fba 100644
--- a/libjava/java/awt/Paint.java
+++ b/libjava/java/awt/Paint.java
@@ -48,7 +48,7 @@ import java.awt.image.ColorModel;
* of the graphics object. Instances must be immutable, because the graphics
* object does not clone them.
*
- * @author Warren Levy <warrenl@cygnus.com>
+ * @author Warren Levy (warrenl@cygnus.com)
* @see PaintContext
* @see Color
* @see GradientPaint
diff --git a/libjava/java/awt/PaintContext.java b/libjava/java/awt/PaintContext.java
index fa26061f0ea..29003798d69 100644
--- a/libjava/java/awt/PaintContext.java
+++ b/libjava/java/awt/PaintContext.java
@@ -42,7 +42,7 @@ import java.awt.image.ColorModel;
import java.awt.image.Raster;
/**
- * @author Warren Levy <warrenl@cygnus.com>
+ * @author Warren Levy (warrenl@cygnus.com)
* @see Paint
* @since 1.1
* @status updated to 1.4
diff --git a/libjava/java/awt/Panel.java b/libjava/java/awt/Panel.java
index 1ba9fbd246e..628e53e97a1 100644
--- a/libjava/java/awt/Panel.java
+++ b/libjava/java/awt/Panel.java
@@ -1,5 +1,5 @@
/* Panel.java -- Simple container object
- Copyright (C) 1999, 2002, 2004 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -127,7 +127,7 @@ public class Panel extends Container implements Accessible
* This class provides accessibility support for Panels, and is the
* runtime type returned by {@link #getAccessibleContext()}.
*
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Eric Blake (ebb9@email.byu.edu)
* @since 1.3
*/
protected class AccessibleAWTPanel extends AccessibleAWTContainer
diff --git a/libjava/java/awt/Point.java b/libjava/java/awt/Point.java
index 3731b4134ee..48f5e33651d 100644
--- a/libjava/java/awt/Point.java
+++ b/libjava/java/awt/Point.java
@@ -50,9 +50,9 @@ import java.io.Serializable;
* manner, it is your own fault when you get invalid results. Also, this
* class is not threadsafe.
*
- * @author Per Bothner <bothner@cygnus.com>
- * @author Aaron M. Renn <arenn@urbanophile.com>
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Per Bothner (bothner@cygnus.com)
+ * @author Aaron M. Renn (arenn@urbanophile.com)
+ * @author Eric Blake (ebb9@email.byu.edu)
* @since 1.0
* @status updated to 1.4
*/
diff --git a/libjava/java/awt/Polygon.java b/libjava/java/awt/Polygon.java
index 4b89bd669f2..4b1eda85ce9 100644
--- a/libjava/java/awt/Polygon.java
+++ b/libjava/java/awt/Polygon.java
@@ -1,5 +1,5 @@
/* Polygon.java -- class representing a polygon
- Copyright (C) 1999, 2002, 2004 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -57,8 +57,8 @@ import java.io.Serializable;
* ArrayIndexOutOfBoundsException, or invalid results. Also, this class is
* not threadsafe.
*
- * @author Aaron M. Renn <arenn@urbanophile.com>
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Aaron M. Renn (arenn@urbanophile.com)
+ * @author Eric Blake (ebb9@email.byu.edu)
* @since 1.0
* @status updated to 1.4
*/
diff --git a/libjava/java/awt/PopupMenu.java b/libjava/java/awt/PopupMenu.java
index 75082029186..92840dfa075 100644
--- a/libjava/java/awt/PopupMenu.java
+++ b/libjava/java/awt/PopupMenu.java
@@ -151,9 +151,18 @@ show(Component component, int x, int y)
}
+ /**
+ * Gets the AccessibleContext associated with this <code>PopupMenu</code>.
+ * The context is created, if necessary.
+ *
+ * @return the associated context
+ */
public AccessibleContext getAccessibleContext()
{
- return new AccessibleAWTPopupMenu();
+ /* Create the context if this is the first request */
+ if (accessibleContext == null)
+ accessibleContext = new AccessibleAWTPopupMenu();
+ return accessibleContext;
}
} // class PopupMenu
diff --git a/libjava/java/awt/PrintGraphics.java b/libjava/java/awt/PrintGraphics.java
index 4a65fcec510..ae664044d9b 100644
--- a/libjava/java/awt/PrintGraphics.java
+++ b/libjava/java/awt/PrintGraphics.java
@@ -1,5 +1,5 @@
/* PrintGraphics.java -- a print graphics context
- Copyright (C) 1999, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -41,7 +41,7 @@ package java.awt;
/**
* This interface allows the originating print job to be obtained.
*
- * @author Aaron M. Renn <arenn@urbanophile.com>
+ * @author Aaron M. Renn (arenn@urbanophile.com)
* @since 1.0
* @status updated to 1.4
*/
diff --git a/libjava/java/awt/PrintJob.java b/libjava/java/awt/PrintJob.java
index 9cf95f21495..7bf4534c7fc 100644
--- a/libjava/java/awt/PrintJob.java
+++ b/libjava/java/awt/PrintJob.java
@@ -1,5 +1,5 @@
/* PrintJob.java -- A print job class
- Copyright (C) 1999, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -41,7 +41,7 @@ package java.awt;
/**
* This abstract class represents a print job.
*
- * @author Aaron M. Renn <arenn@urbanophile.com>
+ * @author Aaron M. Renn (arenn@urbanophile.com)
* @see Toolkit#getPrintJob(Frame, String, Properties)
* @since 1.0
* @status updated to 1.4
diff --git a/libjava/java/awt/Rectangle.java b/libjava/java/awt/Rectangle.java
index 66190960a12..df7cbbe6dee 100644
--- a/libjava/java/awt/Rectangle.java
+++ b/libjava/java/awt/Rectangle.java
@@ -57,9 +57,9 @@ import java.io.Serializable;
* ArrayIndexOutOfBoundsException, or invalid results. Also, this class is
* not threadsafe.
*
- * @author Warren Levy <warrenl@cygnus.com>
- * @author Aaron M. Renn <arenn@urbanophile.com>
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Warren Levy (warrenl@cygnus.com)
+ * @author Aaron M. Renn (arenn@urbanophile.com)
+ * @author Eric Blake (ebb9@email.byu.edu)
* @since 1.0
* @status updated to 1.4
*/
diff --git a/libjava/java/awt/RenderingHints.java b/libjava/java/awt/RenderingHints.java
index a1ccdff3097..86e0eb6f0ee 100644
--- a/libjava/java/awt/RenderingHints.java
+++ b/libjava/java/awt/RenderingHints.java
@@ -51,8 +51,8 @@ import java.util.Set;
* items are hints only, they may be ignored by a particular
* {@link java.awt.Graphics2D} implementation.
*
- * @author Rolf W. Rasmussen <rolfwr@ii.uib.no>
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Rolf W. Rasmussen (rolfwr@ii.uib.no)
+ * @author Eric Blake (ebb9@email.byu.edu)
*/
public class RenderingHints implements Map, Cloneable
{
diff --git a/libjava/java/awt/Robot.java b/libjava/java/awt/Robot.java
index f633fc0b354..23b6f810442 100644
--- a/libjava/java/awt/Robot.java
+++ b/libjava/java/awt/Robot.java
@@ -1,5 +1,5 @@
-/* Robot.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
+/* Robot.java -- a native input event generator
+ Copyright (C) 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,112 +38,386 @@ exception statement from your version. */
package java.awt;
+import gnu.java.awt.ClasspathToolkit;
+
+import java.lang.reflect.InvocationTargetException;
+import java.awt.event.InputEvent;
import java.awt.image.BufferedImage;
+import java.awt.peer.RobotPeer;
/**
+ * The Robot class is used to simulate user interaction with graphical
+ * programs. It can generate native windowing system input events and
+ * retrieve image data from the current screen. Robot is used to test
+ * the AWT and Swing library implementations; it can also be used to
+ * create self-running demo programs.
+ *
+ * Since Robot generates native windowing system events, rather than
+ * simply inserting {@link AWTEvents} on the AWT event queue, its use
+ * is not restricted to Java programs. It can be used to
+ * programatically drive any graphical application.
+ *
+ * This implementation requires an X server that supports the XTest
+ * extension.
+ *
+ * @author Thomas Fitzsimmons (fitzsim@redhat.com)
+ *
* @since 1.3
*/
-/** STUB CLASS ONLY */
public class Robot
{
- private GraphicsDevice screen;
private boolean waitForIdle;
private int autoDelay;
-
+ private RobotPeer peer;
+
/**
- * Creates a <code>Robot</code> object.
- *
- * @exception AWTException If GraphicsEnvironment.isHeadless() returns true.
- * @exception SecurityException If createRobot permission is not granted.
+ * Construct a Robot object that operates on the default screen.
+ *
+ * @exception AWTException if GraphicsEnvironment.isHeadless()
+ * returns true or if the X server does not support the XTest
+ * extension
+ * @exception SecurityException if createRobot permission is not
+ * granted
*/
- public Robot() throws AWTException
+ public Robot () throws AWTException
{
- throw new Error("not implemented");
+ if (GraphicsEnvironment.isHeadless ())
+ throw new AWTException ("Robot: headless graphics environment");
+
+ SecurityManager sm = System.getSecurityManager ();
+ if (sm != null)
+ sm.checkPermission (new AWTPermission ("createRobot"));
+
+ ClasspathToolkit tk = (ClasspathToolkit) Toolkit.getDefaultToolkit ();
+
+ // createRobot will throw AWTException if XTest is not supported.
+ peer = tk.createRobot (GraphicsEnvironment.getLocalGraphicsEnvironment ()
+ .getDefaultScreenDevice ());
}
/**
- * Creates a <code>Robot</code> object.
- *
- * @exception AWTException If GraphicsEnvironment.isHeadless() returns true.
- * @exception IllegalArgumentException If <code>screen</code> is not a screen
- * GraphicsDevice.
- * @exception SecurityException If createRobot permission is not granted.
+ * Construct a Robot object that operates on the specified screen.
+ *
+ * @exception AWTException if GraphicsEnvironment.isHeadless()
+ * returns true or if the X server does not support the XTest
+ * extension
+ * @exception IllegalArgumentException if screen is not a screen
+ * GraphicsDevice
+ * @exception SecurityException if createRobot permission is not
+ * granted
*/
- public Robot(GraphicsDevice screen) throws AWTException
+ public Robot (GraphicsDevice screen) throws AWTException
{
- this();
- this.screen = screen;
+ if (GraphicsEnvironment.isHeadless ())
+ throw new AWTException ("Robot: headless graphics environment");
+
+ if (screen.getType () != GraphicsDevice.TYPE_RASTER_SCREEN)
+ throw new IllegalArgumentException ("Robot: graphics"
+ + " device is not a screen");
+
+ SecurityManager sm = System.getSecurityManager ();
+ if (sm != null)
+ sm.checkPermission (new AWTPermission ("createRobot"));
+
+ ClasspathToolkit tk = (ClasspathToolkit) Toolkit.getDefaultToolkit ();
+
+ // createRobot will throw AWTException if XTest is not supported.
+ peer = tk.createRobot (screen);
}
+ /**
+ * Move the mouse pointer to absolute coordinates (x, y).
+ *
+ * @param x the destination x coordinate
+ * @param y the destination y coordinate
+ */
public void mouseMove(int x, int y)
{
+ peer.mouseMove (x, y);
+
+ if (waitForIdle)
+ waitForIdle ();
+
+ if (autoDelay > 0)
+ delay (autoDelay);
}
- public void mousePress(int buttons)
+ /**
+ * Press one or more mouse buttons.
+ *
+ * @param buttons the buttons to press; a bitmask of one or more of
+ * these {@link InputEvent} fields:
+ *
+ * <ul>
+ * <li>BUTTON1_MASK</li>
+ * <li>BUTTON2_MASK</li>
+ * <li>BUTTON3_MASK</li>
+ * </ul>
+ *
+ * @exception IllegalArgumentException if the button mask is invalid
+ */
+ public void mousePress (int buttons)
{
+ if ((buttons & InputEvent.BUTTON1_MASK) == 0
+ && (buttons & InputEvent.BUTTON2_MASK) == 0
+ && (buttons & InputEvent.BUTTON3_MASK) == 0)
+ throw new IllegalArgumentException ("Robot: mousePress:"
+ + " invalid button mask");
+
+ peer.mousePress (buttons);
+
+ if (waitForIdle)
+ waitForIdle ();
+
+ if (autoDelay > 0)
+ delay (autoDelay);
}
+ /**
+ * Release one or more mouse buttons.
+ *
+ * @param buttons the buttons to release; a bitmask of one or more
+ * of these {@link InputEvent} fields:
+ *
+ * <ul>
+ * <li>BUTTON1_MASK</li>
+ * <li>BUTTON2_MASK</li>
+ * <li>BUTTON3_MASK</li>
+ * </ul>
+ *
+ * @exception IllegalArgumentException if the button mask is invalid
+ */
public void mouseRelease(int buttons)
{
+ if ((buttons & InputEvent.BUTTON1_MASK) == 0
+ && (buttons & InputEvent.BUTTON2_MASK) == 0
+ && (buttons & InputEvent.BUTTON3_MASK) == 0)
+ throw new IllegalArgumentException ("Robot: mouseRelease:"
+ + " invalid button mask");
+
+ peer.mouseRelease (buttons);
+
+ if (waitForIdle)
+ waitForIdle ();
+
+ if (autoDelay > 0)
+ delay (autoDelay);
}
- public void mouseWheel(int wheelAmt)
+ /**
+ * Rotate the mouse scroll wheel.
+ *
+ * @param wheelAmt number of steps to rotate mouse wheel. negative
+ * to rotate wheel up (away from the user), positive to rotate wheel
+ * down (toward the user).
+ *
+ * @since 1.4
+ */
+ public void mouseWheel (int wheelAmt)
{
+ peer.mouseWheel (wheelAmt);
+
+ if (waitForIdle)
+ waitForIdle ();
+
+ if (autoDelay > 0)
+ delay (autoDelay);
}
- public void keyPress(int keycode)
+ /**
+ * Press a key.
+ *
+ * @param keycode key to press, a {@link KeyEvent} VK_ constant
+ *
+ * @exception IllegalArgumentException if keycode is not a valid key
+ */
+ public void keyPress (int keycode)
{
+ peer.keyPress (keycode);
+
+ if (waitForIdle)
+ waitForIdle ();
+
+ if (autoDelay > 0)
+ delay (autoDelay);
}
- public void keyRelease(int keycode)
+ /**
+ * Release a key.
+ *
+ * @param keycode key to release, a {@link KeyEvent} VK_ constant
+ *
+ * @exception IllegalArgumentException if keycode is not a valid key
+ */
+ public void keyRelease (int keycode)
{
+ peer.keyRelease (keycode);
+
+ if (waitForIdle)
+ waitForIdle ();
+
+ if (autoDelay > 0)
+ delay (autoDelay);
}
-
- public Color getPixelColor(int x, int y)
+
+ /**
+ * Return the color of the pixel at the given screen coordinates.
+ *
+ * @param x the x coordinate of the pixel
+ * @param y the y coordinate of the pixel
+ *
+ * @return the Color of the pixel at screen coodinates <code>(x, y)</code>
+ */
+ public Color getPixelColor (int x, int y)
{
- return null;
+ return new Color (peer.getRGBPixel (x, y));
}
- public BufferedImage createScreenCapture(Rectangle screen)
+ /**
+ * Create an image containing pixels read from the screen. The
+ * image does not include the mouse pointer.
+ *
+ * @param screenRect the rectangle of pixels to capture, in screen
+ * coordinates
+ *
+ * @return a BufferedImage containing the requested pixels
+ *
+ * @exception IllegalArgumentException if requested width and height
+ * are not both greater than zero
+ * @exception SecurityException if readDisplayPixels permission is
+ * not granted
+ */
+ public BufferedImage createScreenCapture (Rectangle screenRect)
{
- return null;
+ if (screenRect.width <= 0)
+ throw new IllegalArgumentException ("Robot: capture width is <= 0");
+
+ if (screenRect.height <= 0)
+ throw new IllegalArgumentException ("Robot: capture height is <= 0");
+
+ SecurityManager sm = System.getSecurityManager ();
+ if (sm != null)
+ sm.checkPermission (new AWTPermission ("readDisplayPixels"));
+
+ int[] pixels = peer.getRGBPixels (screenRect);
+
+ BufferedImage bufferedImage =
+ new BufferedImage (screenRect.width, screenRect.height,
+ BufferedImage.TYPE_INT_ARGB);
+
+ bufferedImage.setRGB (0, 0, screenRect.width, screenRect.height,
+ pixels, 0, screenRect.width);
+
+ return bufferedImage;
}
-
- public boolean isAutoWaitForIdle()
+
+ /**
+ * Check if this Robot automatically calls {@link waitForIdle} after
+ * generating an event.
+ *
+ * @return true if waitForIdle is automatically called
+ */
+ public boolean isAutoWaitForIdle ()
{
return waitForIdle;
}
-
- public void setAutoWaitForIdle(boolean value)
+
+ /**
+ * Set whether or not this Robot automatically calls {@link
+ * waitForIdle} after generating an event.
+ *
+ * @param isOn true if waitForIdle should be called automatically
+ */
+ public void setAutoWaitForIdle (boolean isOn)
{
- waitForIdle = value;
+ waitForIdle = isOn;
}
-
- public int getAutoDelay()
+
+ /**
+ * Retrieve the length of time this Robot sleeps after generating an
+ * event.
+ *
+ * @return the length of time in milliseconds
+ */
+ public int getAutoDelay ()
{
return autoDelay;
}
-
- public void setAutoDelay(int ms)
+
+ /**
+ * Set the length of time this Robot sleeps after generating an
+ * event.
+ *
+ * @param ms the length of time in milliseconds
+ *
+ * @exception IllegalArgumentException if ms is not between 0 and
+ * 60,000 milliseconds inclusive
+ */
+ public void setAutoDelay (int ms)
{
- if (ms < 0 || ms > 60000)
- throw new IllegalArgumentException();
-
+ if (ms <= 0 || ms >= 60000)
+ throw new IllegalArgumentException ("Robot: delay length out-of-bounds");
+
autoDelay = ms;
}
- public void delay(int ms)
+ /**
+ * Sleep for a specified length of time.
+ *
+ * @param ms the length of time in milliseconds
+ *
+ * @exception IllegalArgumentException if ms is not between 0 and
+ * 60,000 milliseconds inclusive
+ */
+ public void delay (int ms)
{
if (ms < 0 || ms > 60000)
- throw new IllegalArgumentException();
+ throw new IllegalArgumentException ("Robot: delay length out-of-bounds");
+
+ try
+ {
+ Thread.sleep (ms);
+ }
+ catch (InterruptedException e)
+ {
+ System.err.println ("Robot: delay interrupted");
+ }
}
- public void waitForIdle()
+ /**
+ * Wait until all events currently on the event queue have been
+ * dispatched.
+ */
+ public void waitForIdle ()
{
+ if (EventQueue.isDispatchThread ())
+ throw new IllegalThreadStateException ("Robot: waitForIdle called from "
+ + "the event dispatch thread");
+
+ EventQueue q = Toolkit.getDefaultToolkit ().getSystemEventQueue ();
+ try
+ {
+ q.invokeAndWait (new Runnable () { public void run () { } });
+ }
+ catch (InterruptedException e)
+ {
+ System.err.println ("Robot: waitForIdle interrupted");
+ }
+ catch (InvocationTargetException e)
+ {
+ System.err.println ("Robot: waitForIdle cannot invoke target");
+ }
}
- public String toString()
+ /**
+ * Return a string representation of this Robot.
+ *
+ * @return a string representation
+ */
+ public String toString ()
{
- return "unimplemented";
+ return getClass ().getName ()
+ + "[ autoDelay = " + autoDelay + ", autoWaitForIdle = "
+ + waitForIdle + " ]";
}
-} // class Robot
+}
diff --git a/libjava/java/awt/ScrollPane.java b/libjava/java/awt/ScrollPane.java
index abd5514d8e3..c38feb339c5 100644
--- a/libjava/java/awt/ScrollPane.java
+++ b/libjava/java/awt/ScrollPane.java
@@ -43,6 +43,8 @@ import java.awt.peer.ComponentPeer;
import java.awt.peer.ScrollPanePeer;
import javax.accessibility.Accessible;
+import javax.accessibility.AccessibleContext;
+import javax.accessibility.AccessibleRole;
/**
* This widget provides a scrollable region that allows a single
@@ -587,5 +589,27 @@ paramString()
{
wheelScrollingEnabled = enable;
}
+
+ protected class AccessibleAWTScrollPane extends AccessibleAWTContainer
+ {
+ public AccessibleRole getAccessibleRole()
+ {
+ return AccessibleRole.SCROLL_PANE;
+ }
+ }
+
+ /**
+ * Gets the AccessibleContext associated with this <code>ScrollPane</code>.
+ * The context is created, if necessary.
+ *
+ * @return the associated context
+ */
+ public AccessibleContext getAccessibleContext()
+ {
+ /* Create the context if this is the first request */
+ if (accessibleContext == null)
+ accessibleContext = new AccessibleAWTScrollPane();
+ return accessibleContext;
+ }
} // class ScrollPane
diff --git a/libjava/java/awt/Scrollbar.java b/libjava/java/awt/Scrollbar.java
index 7cc97153796..9141ea53e6d 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, 2003, 2004
+ Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005
Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -45,694 +45,603 @@ import java.awt.peer.ScrollbarPeer;
import java.util.EventListener;
import javax.accessibility.Accessible;
-
-/**
- * This class implements a scrollbar widget.
- *
- * @author Aaron M. Renn (arenn@urbanophile.com)
- * @author Tom Tromey <tromey@cygnus.com>
- */
-public class Scrollbar extends Component implements Accessible,
- Adjustable
-{
-
-// FIXME: Serialization readObject/writeObject
-
-/*
- * Static Variables
+import javax.accessibility.AccessibleContext;
+import javax.accessibility.AccessibleRole;
+import javax.accessibility.AccessibleState;
+import javax.accessibility.AccessibleStateSet;
+import javax.accessibility.AccessibleValue;
+
+/**
+ * This class implements a scrollbar widget.
+ *
+ * @author Aaron M. Renn (arenn@urbanophile.com)
+ * @author Tom Tromey (tromey@cygnus.com)
+ * @author Andrew John Hughes (gnu_andrew@member.fsf.org)
*/
+public class Scrollbar extends Component implements Accessible, Adjustable
+{
+ // FIXME: Serialization readObject/writeObject
-/**
- * Constant indicating that a scrollbar is horizontal.
- */
-public static final int HORIZONTAL = 0;
-
-/**
- * Constant indicating that a scrollbar is vertical.
- */
-public static final int VERTICAL = 1;
+ /**
+ * Constant indicating that a scrollbar is horizontal.
+ */
+ public static final int HORIZONTAL = 0;
-// Serialization Constant
-private static final long serialVersionUID = 8451667562882310543L;
+ /**
+ * Constant indicating that a scrollbar is vertical.
+ */
+ public static final int VERTICAL = 1;
-/*************************************************************************/
+ /**
+ * Serialization Constant.
+ */
+ private static final long serialVersionUID = 8451667562882310543L;
-/**
- * @serial The amount by which the value of the scrollbar is changed
- * when incrementing in line mode.
- */
-private int lineIncrement;
+ /**
+ * @serial The amount by which the value of the scrollbar is changed
+ * when incrementing in line mode.
+ */
+ private int lineIncrement;
-/**
- * @serial The amount by which the value of the scrollbar is changed
- * when incrementing in page mode.
- */
-private int pageIncrement;
+ /**
+ * @serial The amount by which the value of the scrollbar is changed
+ * when incrementing in page mode.
+ */
+ private int pageIncrement;
-/**
- * @serial The maximum value for this scrollbar
- */
-private int maximum;
+ /**
+ * @serial The maximum value for this scrollbar
+ */
+ private int maximum;
-/**
- * @serial The minimum value for this scrollbar
- */
-private int minimum;
+ /**
+ * @serial The minimum value for this scrollbar
+ */
+ private int minimum;
-/**
- * @serial The orientation of this scrollbar, which will be either
- * the <code>HORIZONTAL</code> or <code>VERTICAL</code> constant
- * from this class.
- */
-private int orientation;
+ /**
+ * @serial The orientation of this scrollbar, which will be either
+ * the <code>HORIZONTAL</code> or <code>VERTICAL</code> constant
+ * from this class.
+ */
+ private int orientation;
-/**
- * @serial The current value of this scrollbar.
- */
-private int value;
+ /**
+ * @serial The current value of this scrollbar.
+ */
+ private int value;
-/**
- * @serial The width of the scrollbar's thumb, which is relative
- * to the minimum and maximum value of the scrollbar.
- */
-private int visibleAmount;
+ /**
+ * @serial The width of the scrollbar's thumb, which is relative
+ * to the minimum and maximum value of the scrollbar.
+ */
+ private int visibleAmount;
-// List of AdjustmentListener's.
-private AdjustmentListener adjustment_listeners;
+ /**
+ * List of AdjustmentListener's.
+ */
+ private AdjustmentListener adjustment_listeners;
-private transient boolean valueIsAdjusting = false;
+ /**
+ * true if the scrollbar is adjusting, false otherwise.
+ */
+ private transient boolean valueIsAdjusting = false;
- /*
+ /**
* The number used to generate the name returned by getName.
*/
private static transient long next_scrollbar_number;
-/*************************************************************************/
-
-/*
- * Constructors
- */
-
-/**
- * Initializes a new instance of <code>Scrollbar</code> with a
- * vertical orientation and default values for all other parameters.
- *
- * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true,
- */
-public
-Scrollbar()
-{
- this(VERTICAL);
-}
-
-/*************************************************************************/
-
-/**
- * Initializes a new instance of <code>Scrollbar</code> with the
- * specified orientation and default values for all other parameters.
- * The orientation must be either the constant <code>HORIZONTAL</code> or
- * <code>VERTICAL</code> from this class. An incorrect value will throw
- * an exception.
- *
- * @param orientation The orientation of this scrollbar.
- *
- * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true,
- * @exception IllegalArgumentException If the orientation value is not valid.
- */
-public
-Scrollbar(int orientation) throws IllegalArgumentException
-{
- this(orientation, 0, 10, 0, 100);
-}
-
-/*************************************************************************/
-
-/**
- * Initializes a new instance of <code>Scrollbar</code> with the
- * specified parameters. The orientation must be either the constant
- * <code>HORIZONTAL</code> or <code>VERTICAL</code>. An incorrect value
- * will throw an exception. Inconsistent values for other parameters
- * are silently corrected to valid values.
- *
- * @param orientation The orientation of this scrollbar.
- * @param value The initial value of the scrollbar.
- * @param visibleAmount The width of the scrollbar thumb.
- * @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);
-
- this.orientation = orientation;
-
- setValues(value, visibleAmount, minimum, maximum);
-
- // Default is 1 according to online docs.
- lineIncrement = 1;
-
- // Default is 10 according to javadocs.
- pageIncrement = 10;
-}
-
-/*************************************************************************/
-
-/*
- * Instance Methods
- */
-
-/**
- * Returns the orientation constant for this object.
- *
- * @return The orientation constant for this object.
- */
-public int
-getOrientation()
-{
- return(orientation);
-}
-
-/*************************************************************************/
-
-/**
- * Sets the orientation of this scrollbar to the specified value. This
- * value must be either the constant <code>HORIZONTAL</code> or
- * <code>VERTICAL</code> from this class or an exception will be thrown.
- *
- * @param orientation The new orientation value.
- *
- * @exception IllegalArgumentException If the orientation value is not valid.
- */
-public void
-setOrientation(int orientation)
-{
- if ((orientation != HORIZONTAL) && (orientation != VERTICAL))
- throw new IllegalArgumentException("Bad orientation value: "
- + orientation);
-
- // FIXME: Communicate to peer? Or must this be called before peer creation?
- this.orientation = orientation;
-}
-
-/*************************************************************************/
-
-/**
- * Returns the current value for this scrollbar.
- *
- * @return The current value for this scrollbar.
- */
-public int
-getValue()
-{
- return(value);
-}
-
-/*************************************************************************/
-
-/**
- * Sets the current value for this scrollbar to the specified value.
- * If this is inconsistent with the minimum and maximum values for this
- * scrollbar, the value is silently adjusted.
- *
- * @param value The new value for this scrollbar.
- */
-public void
-setValue(int value)
-{
- setValues(value, visibleAmount, minimum, maximum);
-}
-
-/*************************************************************************/
-
-/**
- * Returns the maximum value for this scrollbar.
- *
- * @return The maximum value for this scrollbar.
- */
-public int
-getMaximum()
-{
- return(maximum);
-}
-
-/*************************************************************************/
-
-/**
- * Sets the maximum value for this scrollbar to the specified value.
- * If the value is less than the current minimum value, it is silent
- * set to equal the minimum value.
- *
- * @param maximum The new maximum value for this scrollbar.
- */
-public void
-setMaximum(int maximum)
-{
- setValues(value, visibleAmount, minimum, maximum);
-}
-
-/*************************************************************************/
-
-/**
- * Returns the minimum value for this scrollbar.
- *
- * @return The minimum value for this scrollbar.
- */
-public int
-getMinimum()
-{
- return(minimum);
-}
-
-/*************************************************************************/
-
-/**
- * Sets the minimum value for this scrollbar to the specified value. If
- * this is not consistent with the current value and maximum, it is
- * silently adjusted to be consistent.
- *
- * @param minimum The new minimum value for this scrollbar.
- */
-public void
-setMinimum(int minimum)
-{
- setValues(value, visibleAmount, minimum, maximum);
-}
-
-/*************************************************************************/
-
-/**
- * Returns the width of the scrollbar's thumb, in units relative to the
- * maximum and minimum value of the scrollbar.
- *
- * @return The width of the scrollbar's thumb.
- */
-public int
-getVisibleAmount()
-{
- return getVisible ();
-}
-
-/*************************************************************************/
-
-/**
- * Returns the width of the scrollbar's thumb, in units relative to the
- * maximum and minimum value of the scrollbar.
- *
- * @return The width of the scrollbar's thumb.
- *
- * @deprecated This method is deprecated in favor of
- * <code>getVisibleAmount()</code>.
- */
-public int
-getVisible()
-{
- return visibleAmount;
-}
-
-/*************************************************************************/
-
-/**
- * Sets the width of the scrollbar's thumb, in units relative to the
- * maximum and minimum value of the scrollbar.
- *
- * @param visibleAmount The new visible amount value of the scrollbar.
- */
-public void
-setVisibleAmount(int visibleAmount)
-{
- setValues(value, visibleAmount, minimum, maximum);
-}
-
-/*************************************************************************/
-
-/**
- * Sets the current value, visible amount, minimum, and maximum for this
- * scrollbar. These values are adjusted to be internally consistent
- * if necessary.
- *
- * @param value The new value for this scrollbar.
- * @param visibleAmount The new visible amount for this scrollbar.
- * @param minimum The new minimum value for this scrollbar.
- * @param maximum The new maximum value for this scrollbar.
- */
-public synchronized void
-setValues(int value, int visibleAmount, int minimum, int maximum)
-{
- if (maximum < minimum)
- maximum = minimum;
-
- if (value < minimum)
- value = minimum;
-
- if (value > maximum)
- value = maximum;
-
- if (visibleAmount > maximum - minimum)
- visibleAmount = maximum - minimum;
-
- ScrollbarPeer peer = (ScrollbarPeer) getPeer ();
- if (peer != null
- && (this.value != value || this.visibleAmount != visibleAmount
- || this.minimum != minimum || this.maximum != maximum))
- peer.setValues(value, visibleAmount, minimum, maximum);
-
- this.value = value;
- this.visibleAmount = visibleAmount;
- this.minimum = minimum;
- this.maximum = maximum;
-
- int range = maximum - minimum;
- if (lineIncrement > range)
- {
- if (range == 0)
- lineIncrement = 1;
- else
- lineIncrement = range;
-
- if (peer != null)
- peer.setLineIncrement(lineIncrement);
- }
-
- if (pageIncrement > range)
- {
- if (range == 0)
- pageIncrement = 1;
- else
- pageIncrement = range;
-
- if (peer != null)
- peer.setPageIncrement(pageIncrement);
- }
-}
-
-/*************************************************************************/
+ /**
+ * Initializes a new instance of <code>Scrollbar</code> with a
+ * vertical orientation and default values for all other parameters.
+ *
+ * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true,
+ */
+ public Scrollbar()
+ {
+ this(VERTICAL);
+ }
-/**
- * Returns the value added or subtracted when the user activates the scrollbar
- * scroll by a "unit" amount.
- *
- * @return The unit increment value.
- */
-public int
-getUnitIncrement()
-{
- return getLineIncrement ();
-}
+ /**
+ * Initializes a new instance of <code>Scrollbar</code> with the
+ * specified orientation and default values for all other parameters.
+ * The orientation must be either the constant <code>HORIZONTAL</code> or
+ * <code>VERTICAL</code> from this class. An incorrect value will throw
+ * an exception.
+ *
+ * @param orientation The orientation of this scrollbar.
+ *
+ * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true,
+ * @exception IllegalArgumentException If the orientation value is not valid.
+ */
+ public Scrollbar(int orientation) throws IllegalArgumentException
+ {
+ this(orientation, 0, 10, 0, 100);
+ }
-/*************************************************************************/
+ /**
+ * Initializes a new instance of <code>Scrollbar</code> with the
+ * specified parameters. The orientation must be either the constant
+ * <code>HORIZONTAL</code> or <code>VERTICAL</code>. An incorrect value
+ * will throw an exception. Inconsistent values for other parameters
+ * are silently corrected to valid values.
+ *
+ * @param orientation The orientation of this scrollbar.
+ * @param value The initial value of the scrollbar.
+ * @param visibleAmount The width of the scrollbar thumb.
+ * @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();
-/**
- * Returns the value added or subtracted when the user selects the scrollbar
- * scroll by a "unit" amount control.
- *
- * @return The unit increment value.
- *
- * @deprecated This method is deprecated in favor of
- * <code>getUnitIncrement()</code>.
- */
-public int
-getLineIncrement()
-{
- return lineIncrement;
-}
+ if ((orientation != HORIZONTAL) && (orientation != VERTICAL))
+ throw new IllegalArgumentException("Bad orientation value: "
+ + orientation);
-/*************************************************************************/
+ this.orientation = orientation;
-/**
- * Sets the value added or subtracted to the scrollbar value when the
- * user selects the scroll by a "unit" amount control.
- *
- * @param unitIncrement The new unit increment amount.
- */
-public synchronized void
-setUnitIncrement(int unitIncrement)
-{
- setLineIncrement (unitIncrement);
-}
+ setValues(value, visibleAmount, minimum, maximum);
-/*************************************************************************/
+ // Default is 1 according to online docs.
+ lineIncrement = 1;
-/**
- * Sets the value added or subtracted to the scrollbar value when the
- * user selects the scroll by a "unit" amount control.
- *
- * @param lineIncrement The new unit increment amount.
- *
- * @deprecated This method is deprecated in favor of
- * <code>setUnitIncrement()</code>.
- */
-public void
-setLineIncrement(int lineIncrement)
-{
- if (lineIncrement < 0)
- throw new IllegalArgumentException ("Unit increment less than zero.");
+ // Default is 10 according to javadocs.
+ pageIncrement = 10;
+ }
- int range = maximum - minimum;
- if (lineIncrement > range)
- {
- if (range == 0)
- lineIncrement = 1;
- else
- lineIncrement = range;
- }
+ /**
+ * Returns the orientation constant for this object.
+ *
+ * @return The orientation constant for this object.
+ */
+ public int getOrientation()
+ {
+ return orientation;
+ }
- if (lineIncrement == this.lineIncrement)
- return;
+ /**
+ * Sets the orientation of this scrollbar to the specified value. This
+ * value must be either the constant <code>HORIZONTAL</code> or
+ * <code>VERTICAL</code> from this class or an exception will be thrown.
+ *
+ * @param orientation The new orientation value.
+ *
+ * @exception IllegalArgumentException If the orientation value is not valid.
+ */
+ public void setOrientation(int orientation)
+ {
+ if ((orientation != HORIZONTAL) && (orientation != VERTICAL))
+ throw new IllegalArgumentException("Bad orientation value: "
+ + orientation);
- this.lineIncrement = lineIncrement;
+ // FIXME: Communicate to peer? Or must this be called before peer creation?
+ this.orientation = orientation;
+ }
- ScrollbarPeer peer = (ScrollbarPeer) getPeer ();
- if (peer != null)
- peer.setLineIncrement (this.lineIncrement);
-}
+ /**
+ * Returns the current value for this scrollbar.
+ *
+ * @return The current value for this scrollbar.
+ */
+ public int getValue()
+ {
+ return value;
+ }
-/*************************************************************************/
+ /**
+ * Sets the current value for this scrollbar to the specified value.
+ * If this is inconsistent with the minimum and maximum values for this
+ * scrollbar, the value is silently adjusted.
+ *
+ * @param value The new value for this scrollbar.
+ */
+ public void setValue(int value)
+ {
+ setValues(value, visibleAmount, minimum, maximum);
+ }
-/**
- * Returns the value added or subtracted when the user activates the scrollbar
- * scroll by a "block" amount.
- *
- * @return The block increment value.
- */
-public int
-getBlockIncrement()
-{
- return getPageIncrement ();
-}
+ /**
+ * Returns the maximum value for this scrollbar.
+ *
+ * @return The maximum value for this scrollbar.
+ */
+ public int getMaximum()
+ {
+ return maximum;
+ }
-/*************************************************************************/
+ /**
+ * Sets the maximum value for this scrollbar to the specified value.
+ * If the value is less than the current minimum value, it is silent
+ * set to equal the minimum value.
+ *
+ * @param maximum The new maximum value for this scrollbar.
+ */
+ public void setMaximum(int maximum)
+ {
+ setValues(value, visibleAmount, minimum, maximum);
+ }
-/**
- * Returns the value added or subtracted when the user selects the scrollbar
- * scroll by a "block" amount control.
- *
- * @return The block increment value.
- *
- * @deprecated This method is deprecated in favor of
- * <code>getBlockIncrement()</code>.
- */
-public int
-getPageIncrement()
-{
- return pageIncrement;
-}
+ /**
+ * Returns the minimum value for this scrollbar.
+ *
+ * @return The minimum value for this scrollbar.
+ */
+ public int getMinimum()
+ {
+ return minimum;
+ }
-/*************************************************************************/
+ /**
+ * Sets the minimum value for this scrollbar to the specified value. If
+ * this is not consistent with the current value and maximum, it is
+ * silently adjusted to be consistent.
+ *
+ * @param minimum The new minimum value for this scrollbar.
+ */
+ public void setMinimum(int minimum)
+ {
+ setValues(value, visibleAmount, minimum, maximum);
+ }
-/**
- * Sets the value added or subtracted to the scrollbar value when the
- * user selects the scroll by a "block" amount control.
- *
- * @param blockIncrement The new block increment amount.
- */
-public synchronized void
-setBlockIncrement(int blockIncrement)
-{
- setPageIncrement (blockIncrement);
-}
+ /**
+ * Returns the width of the scrollbar's thumb, in units relative to the
+ * maximum and minimum value of the scrollbar.
+ *
+ * @return The width of the scrollbar's thumb.
+ */
+ public int getVisibleAmount()
+ {
+ return getVisible();
+ }
-/*************************************************************************/
+ /**
+ * Returns the width of the scrollbar's thumb, in units relative to the
+ * maximum and minimum value of the scrollbar.
+ *
+ * @return The width of the scrollbar's thumb.
+ *
+ * @deprecated This method is deprecated in favor of
+ * <code>getVisibleAmount()</code>.
+ */
+ public int getVisible()
+ {
+ return visibleAmount;
+ }
-/**
- * Sets the value added or subtracted to the scrollbar value when the
- * user selects the scroll by a "block" amount control.
- *
- * @param pageIncrement The new block increment amount.
- *
- * @deprecated This method is deprecated in favor of
- * <code>setBlockIncrement()</code>.
- */
-public void
-setPageIncrement(int pageIncrement)
-{
- if (pageIncrement < 0)
- throw new IllegalArgumentException ("Block increment less than zero.");
+ /**
+ * Sets the width of the scrollbar's thumb, in units relative to the
+ * maximum and minimum value of the scrollbar.
+ *
+ * @param visibleAmount The new visible amount value of the scrollbar.
+ */
+ public void setVisibleAmount(int visibleAmount)
+ {
+ setValues(value, visibleAmount, minimum, maximum);
+ }
- int range = maximum - minimum;
- if (pageIncrement > range)
- {
- if (range == 0)
- pageIncrement = 1;
- else
- pageIncrement = range;
- }
+ /**
+ * Sets the current value, visible amount, minimum, and maximum for this
+ * scrollbar. These values are adjusted to be internally consistent
+ * if necessary.
+ *
+ * @param value The new value for this scrollbar.
+ * @param visibleAmount The new visible amount for this scrollbar.
+ * @param minimum The new minimum value for this scrollbar.
+ * @param maximum The new maximum value for this scrollbar.
+ */
+ public synchronized void setValues(int value, int visibleAmount,
+ int minimum, int maximum)
+ {
+ if (maximum < minimum)
+ maximum = minimum;
+
+ if (value < minimum)
+ value = minimum;
+
+ if (value > maximum)
+ value = maximum;
+
+ if (visibleAmount > maximum - minimum)
+ visibleAmount = maximum - minimum;
+
+ ScrollbarPeer peer = (ScrollbarPeer) getPeer();
+ if (peer != null
+ && (this.value != value || this.visibleAmount != visibleAmount
+ || this.minimum != minimum || this.maximum != maximum))
+ peer.setValues(value, visibleAmount, minimum, maximum);
+
+ this.value = value;
+ this.visibleAmount = visibleAmount;
+ this.minimum = minimum;
+ this.maximum = maximum;
+
+ int range = maximum - minimum;
+ if (lineIncrement > range)
+ {
+ if (range == 0)
+ lineIncrement = 1;
+ else
+ lineIncrement = range;
+
+ if (peer != null)
+ peer.setLineIncrement(lineIncrement);
+ }
+
+ if (pageIncrement > range)
+ {
+ if (range == 0)
+ pageIncrement = 1;
+ else
+ pageIncrement = range;
+
+ if (peer != null)
+ peer.setPageIncrement(pageIncrement);
+ }
+ }
- if (pageIncrement == this.pageIncrement)
- return;
+ /**
+ * Returns the value added or subtracted when the user activates the scrollbar
+ * scroll by a "unit" amount.
+ *
+ * @return The unit increment value.
+ */
+ public int getUnitIncrement()
+ {
+ return getLineIncrement();
+ }
- this.pageIncrement = pageIncrement;
+ /**
+ * Returns the value added or subtracted when the user selects the scrollbar
+ * scroll by a "unit" amount control.
+ *
+ * @return The unit increment value.
+ *
+ * @deprecated This method is deprecated in favor of
+ * <code>getUnitIncrement()</code>.
+ */
+ public int getLineIncrement()
+ {
+ return lineIncrement;
+ }
- ScrollbarPeer peer = (ScrollbarPeer) getPeer ();
- if (peer != null)
- peer.setPageIncrement (this.pageIncrement);
-}
+ /**
+ * Sets the value added or subtracted to the scrollbar value when the
+ * user selects the scroll by a "unit" amount control.
+ *
+ * @param unitIncrement The new unit increment amount.
+ */
+ public synchronized void setUnitIncrement(int unitIncrement)
+ {
+ setLineIncrement(unitIncrement);
+ }
-/*************************************************************************/
+ /**
+ * Sets the value added or subtracted to the scrollbar value when the
+ * user selects the scroll by a "unit" amount control.
+ *
+ * @param lineIncrement The new unit increment amount.
+ *
+ * @deprecated This method is deprecated in favor of
+ * <code>setUnitIncrement()</code>.
+ */
+ public void setLineIncrement(int lineIncrement)
+ {
+ if (lineIncrement < 0)
+ throw new IllegalArgumentException("Unit increment less than zero.");
+
+ int range = maximum - minimum;
+ if (lineIncrement > range)
+ {
+ if (range == 0)
+ lineIncrement = 1;
+ else
+ lineIncrement = range;
+ }
+
+ if (lineIncrement == this.lineIncrement)
+ return;
+
+ this.lineIncrement = lineIncrement;
+
+ ScrollbarPeer peer = (ScrollbarPeer) getPeer();
+ if (peer != null)
+ peer.setLineIncrement(this.lineIncrement);
+ }
-/**
- * Notifies this object to create its native peer.
- */
-public synchronized void
-addNotify()
-{
- if (peer == null)
- peer = getToolkit ().createScrollbar (this);
- super.addNotify ();
-}
+ /**
+ * Returns the value added or subtracted when the user activates the scrollbar
+ * scroll by a "block" amount.
+ *
+ * @return The block increment value.
+ */
+ public int getBlockIncrement()
+ {
+ return getPageIncrement();
+ }
-/*************************************************************************/
+ /**
+ * Returns the value added or subtracted when the user selects the scrollbar
+ * scroll by a "block" amount control.
+ *
+ * @return The block increment value.
+ *
+ * @deprecated This method is deprecated in favor of
+ * <code>getBlockIncrement()</code>.
+ */
+ public int getPageIncrement()
+ {
+ return pageIncrement;
+ }
-/**
- * Adds a new adjustment listener to the list of registered listeners
- * for this object.
- *
- * @param listener The listener to add.
- */
-public synchronized void
-addAdjustmentListener(AdjustmentListener listener)
-{
- adjustment_listeners = AWTEventMulticaster.add(adjustment_listeners, listener);
- enableEvents(AWTEvent.ADJUSTMENT_EVENT_MASK);
-}
+ /**
+ * Sets the value added or subtracted to the scrollbar value when the
+ * user selects the scroll by a "block" amount control.
+ *
+ * @param blockIncrement The new block increment amount.
+ */
+ public synchronized void setBlockIncrement(int blockIncrement)
+ {
+ setPageIncrement(blockIncrement);
+ }
-/*************************************************************************/
+ /**
+ * Sets the value added or subtracted to the scrollbar value when the
+ * user selects the scroll by a "block" amount control.
+ *
+ * @param pageIncrement The new block increment amount.
+ *
+ * @deprecated This method is deprecated in favor of
+ * <code>setBlockIncrement()</code>.
+ */
+ public void setPageIncrement(int pageIncrement)
+ {
+ if (pageIncrement < 0)
+ throw new IllegalArgumentException("Block increment less than zero.");
+
+ int range = maximum - minimum;
+ if (pageIncrement > range)
+ {
+ if (range == 0)
+ pageIncrement = 1;
+ else
+ pageIncrement = range;
+ }
+
+ if (pageIncrement == this.pageIncrement)
+ return;
+
+ this.pageIncrement = pageIncrement;
+
+ ScrollbarPeer peer = (ScrollbarPeer) getPeer();
+ if (peer != null)
+ peer.setPageIncrement(this.pageIncrement);
+ }
-/**
- * Removes the specified listener from the list of registered listeners
- * for this object.
- *
- * @param listener The listener to remove.
- */
-public synchronized void
-removeAdjustmentListener(AdjustmentListener listener)
-{
- adjustment_listeners = AWTEventMulticaster.remove(adjustment_listeners,
- listener);
-}
+ /**
+ * Notifies this object to create its native peer.
+ */
+ public synchronized void addNotify()
+ {
+ if (peer == null)
+ peer = getToolkit().createScrollbar(this);
+ super.addNotify();
+ }
-/*************************************************************************/
+ /**
+ * Adds a new adjustment listener to the list of registered listeners
+ * for this object.
+ *
+ * @param listener The listener to add.
+ */
+ public synchronized void addAdjustmentListener(AdjustmentListener listener)
+ {
+ adjustment_listeners = AWTEventMulticaster.add(adjustment_listeners,
+ listener);
+ enableEvents(AWTEvent.ADJUSTMENT_EVENT_MASK);
+ }
-/**
- * Processes events for this scrollbar. It does this by calling
- * <code>processAdjustmentEvent()</code> if the event is an instance of
- * <code>AdjustmentEvent</code>, otherwise it calls the superclass to
- * process the event.
- *
- * @param event The event to process.
- */
-protected void
-processEvent(AWTEvent event)
-{
- if (event instanceof AdjustmentEvent)
- processAdjustmentEvent((AdjustmentEvent)event);
- else
- super.processEvent(event);
-}
+ /**
+ * Removes the specified listener from the list of registered listeners
+ * for this object.
+ *
+ * @param listener The listener to remove.
+ */
+ public synchronized void removeAdjustmentListener(AdjustmentListener listener)
+ {
+ adjustment_listeners = AWTEventMulticaster.remove(adjustment_listeners,
+ listener);
+ }
-/*************************************************************************/
+ /**
+ * Processes events for this scrollbar. It does this by calling
+ * <code>processAdjustmentEvent()</code> if the event is an instance of
+ * <code>AdjustmentEvent</code>, otherwise it calls the superclass to
+ * process the event.
+ *
+ * @param event The event to process.
+ */
+ protected void processEvent(AWTEvent event)
+ {
+ if (event instanceof AdjustmentEvent)
+ processAdjustmentEvent((AdjustmentEvent) event);
+ else
+ super.processEvent(event);
+ }
-/**
- * Processes adjustment events for this object by dispatching them to
- * any registered listeners. Note that this method will only be called
- * if adjustment events are enabled. This will happen automatically if
- * any listeners are registered. Otherwise, it can be enabled by a
- * call to <code>enableEvents()</code>.
- *
- * @param event The event to process.
- */
-protected void
-processAdjustmentEvent(AdjustmentEvent event)
-{
- value = event.getValue();
- if (adjustment_listeners != null)
- adjustment_listeners.adjustmentValueChanged(event);
-}
+ /**
+ * Processes adjustment events for this object by dispatching them to
+ * any registered listeners. Note that this method will only be called
+ * if adjustment events are enabled. This will happen automatically if
+ * any listeners are registered. Otherwise, it can be enabled by a
+ * call to <code>enableEvents()</code>.
+ *
+ * @param event The event to process.
+ */
+ protected void processAdjustmentEvent(AdjustmentEvent event)
+ {
+ value = event.getValue();
+ if (adjustment_listeners != null)
+ adjustment_listeners.adjustmentValueChanged(event);
+ }
-void
-dispatchEventImpl(AWTEvent e)
-{
- if (e.id <= AdjustmentEvent.ADJUSTMENT_LAST
+ void dispatchEventImpl(AWTEvent e)
+ {
+ if (e.id <= AdjustmentEvent.ADJUSTMENT_LAST
&& e.id >= AdjustmentEvent.ADJUSTMENT_FIRST
&& (adjustment_listeners != null
|| (eventMask & AWTEvent.ADJUSTMENT_EVENT_MASK) != 0))
- processEvent(e);
- else
- super.dispatchEventImpl(e);
-}
-
-/*************************************************************************/
+ processEvent(e);
+ else
+ super.dispatchEventImpl(e);
+ }
-/**
- * Returns a debugging string for this object.
- *
- * @return A debugging string for this object.
- */
-protected String
-paramString()
-{
- return("value=" + getValue() + ",visibleAmount=" +
- getVisibleAmount() + ",minimum=" + getMinimum()
- + ",maximum=" + getMaximum()
- + ",pageIncrement=" + pageIncrement
- + ",lineIncrement=" + lineIncrement
- + ",orientation=" + (orientation == HORIZONTAL
- ? "HORIZONTAL" : "VERTICAL")
- + super.paramString());
-}
+ /**
+ * Returns a debugging string for this object.
+ *
+ * @return A debugging string for this object.
+ */
+ protected String paramString()
+ {
+ return ("value=" + getValue() + ",visibleAmount=" + getVisibleAmount()
+ + ",minimum=" + getMinimum() + ",maximum=" + getMaximum()
+ + ",pageIncrement=" + pageIncrement + ",lineIncrement="
+ + lineIncrement + ",orientation="
+ + (orientation == HORIZONTAL ? "HORIZONTAL" : "VERTICAL")
+ + super.paramString());
+ }
/**
* Returns an array of all the objects currently registered as FooListeners
- * upon this <code>Scrollbar</code>. FooListeners are registered using the
+ * upon this <code>Scrollbar</code>. FooListeners are registered using the
* addFooListener method.
*
* @exception ClassCastException If listenerType doesn't specify a class or
* interface that implements java.util.EventListener.
*/
- public EventListener[] getListeners (Class listenerType)
+ public EventListener[] getListeners(Class listenerType)
{
if (listenerType == AdjustmentListener.class)
- return AWTEventMulticaster.getListeners (adjustment_listeners,
- listenerType);
+ return AWTEventMulticaster.getListeners(adjustment_listeners,
+ listenerType);
- return super.getListeners (listenerType);
+ return super.getListeners(listenerType);
}
/**
* Returns an array of all registered adjustment listeners.
*/
- public AdjustmentListener[] getAdjustmentListeners ()
+ public AdjustmentListener[] getAdjustmentListeners()
{
- return (AdjustmentListener[]) getListeners (AdjustmentListener.class);
+ return (AdjustmentListener[]) getListeners(AdjustmentListener.class);
}
/**
@@ -740,7 +649,7 @@ paramString()
*
* @since 1.4
*/
- public boolean getValueIsAdjusting ()
+ public boolean getValueIsAdjusting()
{
return valueIsAdjusting;
}
@@ -750,7 +659,7 @@ paramString()
*
* @since 1.4
*/
- public void setValueIsAdjusting (boolean valueIsAdjusting)
+ public void setValueIsAdjusting(boolean valueIsAdjusting)
{
this.valueIsAdjusting = valueIsAdjusting;
}
@@ -760,14 +669,157 @@ paramString()
*
* @return A unique name for this scroll bar.
*/
- String generateName ()
+ String generateName()
{
- return "scrollbar" + getUniqueLong ();
+ return "scrollbar" + getUniqueLong();
}
- private static synchronized long getUniqueLong ()
+ private static synchronized long getUniqueLong()
{
return next_scrollbar_number++;
}
-} // class Scrollbar
+ /**
+ * This class provides accessibility support for the
+ * scrollbar.
+ *
+ * @author Jerry Quinn (jlquinn@optonline.net)
+ * @author Andrew John Hughes (gnu_andrew@member.fsf.org)
+ */
+ protected class AccessibleAWTScrollBar extends AccessibleAWTComponent
+ implements AccessibleValue
+ {
+ /**
+ * Serialization constant to match JDK 1.5
+ */
+ private static final long serialVersionUID = -344337268523697807L;
+
+ /**
+ * Returns the role of this accessible object.
+ *
+ * @return the instance of <code>AccessibleRole</code>,
+ * which describes this object.
+ *
+ * @see javax.accessibility.AccessibleRole
+ */
+ public AccessibleRole getAccessibleRole()
+ {
+ return AccessibleRole.SCROLL_BAR;
+ }
+
+ /**
+ * Returns the state set of this accessible object.
+ *
+ * @return a set of <code>AccessibleState</code>s which
+ * represent the current state of the accessible object.
+ *
+ * @see javax.accessibility.AccessibleState
+ * @see javax.accessibility.AccessibleStateSet
+ */
+ public AccessibleStateSet getAccessibleStateSet()
+ {
+ AccessibleStateSet states = super.getAccessibleStateSet();
+ if (getOrientation() == HORIZONTAL)
+ states.add(AccessibleState.HORIZONTAL);
+ else
+ states.add(AccessibleState.VERTICAL);
+ if (getValueIsAdjusting())
+ states.add(AccessibleState.BUSY);
+ return states;
+ }
+
+ /**
+ * Returns an implementation of the <code>AccessibleValue</code>
+ * interface for this accessible object. In this case, the
+ * current instance is simply returned (with a more appropriate
+ * type), as it also implements the accessible value as well as
+ * the context.
+ *
+ * @return the accessible value associated with this context.
+ *
+ * @see javax.accessibility.AccessibleValue
+ */
+ public AccessibleValue getAccessibleValue()
+ {
+ return this;
+ }
+
+ /**
+ * Returns the current value of this accessible object.
+ * In this case, this is the same as the value for
+ * the scrollbar, wrapped in an <code>Integer</code>
+ * object.
+ *
+ * @return the numeric value of this scrollbar.
+ *
+ * @see javax.accessibility.AccessibleValue#getCurrentAccessibleValue()
+ */
+ public Number getCurrentAccessibleValue()
+ {
+ return new Integer(getValue());
+ }
+
+ /**
+ * Sets the current value of this accessible object
+ * to that supplied. In this case, the value of the
+ * scrollbar is set, and this method always returns
+ * true.
+ *
+ * @param number the new accessible value.
+ *
+ * @return true if the value was set.
+ *
+ * @see javax.accessibility.AccessibleValue#setCurrentAccessibleValue(java.lang.Number)
+ */
+ public boolean setCurrentAccessibleValue(Number number)
+ {
+ setValue(number.intValue());
+ return true;
+ }
+
+ /**
+ * Returns the minimum acceptable accessible value used
+ * by this object. In this case, this is the same as
+ * the minimum value of the scrollbar, wrapped in an
+ * object.
+ *
+ * @return the minimum value of this scrollbar.
+ *
+ * @see javax.accessibility.AccessibleValue#getMinimumAccessibleValue()
+ */
+ public Number getMinimumAccessibleValue()
+ {
+ return new Integer(getMinimum());
+ }
+
+ /**
+ * Returns the maximum acceptable accessible value used
+ * by this object. In this case, this is the same as
+ * the maximum value of the scrollbar, wrapped in an
+ * object.
+ *
+ * @return the maximum value of this scrollbar.
+ *
+ * @see javax.accessibility.AccessibleValue#getMaximumAccessibleValue()
+ */
+ public Number getMaximumAccessibleValue()
+ {
+ return new Integer(getMaximum());
+ }
+ }
+
+ /**
+ * Gets the AccessibleContext associated with this <code>Scrollbar</code>.
+ * The context is created, if necessary.
+ *
+ * @return the associated context
+ */
+ public AccessibleContext getAccessibleContext()
+ {
+ /* Create the context if this is the first request */
+ if (accessibleContext == null)
+ accessibleContext = new AccessibleAWTScrollBar();
+
+ return accessibleContext;
+ }
+}
diff --git a/libjava/java/awt/Shape.java b/libjava/java/awt/Shape.java
index 47c97192a17..1a0852b8d12 100644
--- a/libjava/java/awt/Shape.java
+++ b/libjava/java/awt/Shape.java
@@ -1,5 +1,5 @@
/* Shape.java -- the classic Object-Oriented shape interface
- Copyright (C) 1999, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -54,7 +54,7 @@ import java.awt.geom.Rectangle2D;
* Unclosed shapes are considered as implicitly closed when performing
* <code>contains</code> or <code>intersects</code>.
*
- * @author Aaron M. Renn <arenn@urbanophile.com>
+ * @author Aaron M. Renn (arenn@urbanophile.com)
* @see PathIterator
* @see AffineTransform
* @see java.awt.geom.FlatteningPathIterator
diff --git a/libjava/java/awt/Stroke.java b/libjava/java/awt/Stroke.java
index 8b9b7fc777f..1fe1568a4fc 100644
--- a/libjava/java/awt/Stroke.java
+++ b/libjava/java/awt/Stroke.java
@@ -1,5 +1,5 @@
/* Stroke.java -- a stroked outline of a shape
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -46,7 +46,7 @@ package java.awt;
* Strokes must be immutable, because the graphics object does not clone
* them.
*
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Eric Blake (ebb9@email.byu.edu)
* @see BasicStroke
* @see Graphics2D#setStroke(Stroke)
* @since 1.1
diff --git a/libjava/java/awt/SystemColor.java b/libjava/java/awt/SystemColor.java
index 3428fba3cc5..90aa577037b 100644
--- a/libjava/java/awt/SystemColor.java
+++ b/libjava/java/awt/SystemColor.java
@@ -1,5 +1,5 @@
/* SystemColor.java -- access dynamic system color values
- Copyright (C) 1999, 2002, 2004 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -52,8 +52,8 @@ import java.io.Serializable;
* track the actual color of instances in this class. This means that equals
* may give surprising results; you are better off relying on getRGB.
*
- * @author Aaron M. Renn <arenn@urbanophile.com>
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Aaron M. Renn (arenn@urbanophile.com)
+ * @author Eric Blake (ebb9@email.byu.edu)
* @since 1.1
* @status updated to 1.4
*/
diff --git a/libjava/java/awt/TextArea.java b/libjava/java/awt/TextArea.java
index 9efc7754a20..dda45f34478 100644
--- a/libjava/java/awt/TextArea.java
+++ b/libjava/java/awt/TextArea.java
@@ -613,8 +613,17 @@ public class TextArea extends TextComponent implements java.io.Serializable
}
}
+ /**
+ * Gets the AccessibleContext associated with this <code>TextArea</code>.
+ * The context is created, if necessary.
+ *
+ * @return the associated context
+ */
public AccessibleContext getAccessibleContext()
{
- return new AccessibleAWTTextArea();
+ /* Create the context if this is the first request */
+ if (accessibleContext == null)
+ accessibleContext = new AccessibleAWTTextArea();
+ return accessibleContext;
}
}
diff --git a/libjava/java/awt/TextComponent.java b/libjava/java/awt/TextComponent.java
index 8f9f875acf3..4c384391adf 100644
--- a/libjava/java/awt/TextComponent.java
+++ b/libjava/java/awt/TextComponent.java
@@ -46,6 +46,7 @@ import java.text.BreakIterator;
import java.util.EventListener;
import javax.accessibility.Accessible;
+import javax.accessibility.AccessibleContext;
import javax.accessibility.AccessibleRole;
import javax.accessibility.AccessibleState;
import javax.accessibility.AccessibleStateSet;
@@ -690,6 +691,21 @@ paramString()
return (TextListener[]) getListeners (TextListener.class);
}
+ /**
+ * Gets the AccessibleContext associated with this <code>TextComponent</code>.
+ * The context is created, if necessary.
+ *
+ * @return the associated context
+ */
+ public AccessibleContext getAccessibleContext()
+ {
+ /* Create the context if this is the first request */
+ if (accessibleContext == null)
+ accessibleContext = new AccessibleAWTTextComponent();
+ return accessibleContext;
+ }
+
+
/*******************************/
// Provide AccessibleAWTTextComponent access to several peer functions that
// aren't publicly exposed.
diff --git a/libjava/java/awt/Toolkit.java b/libjava/java/awt/Toolkit.java
index 504572a2d5b..c7f2de95620 100644
--- a/libjava/java/awt/Toolkit.java
+++ b/libjava/java/awt/Toolkit.java
@@ -1,5 +1,5 @@
/* Toolkit.java -- AWT Toolkit superclass
- Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004
+ Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005
Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -91,7 +91,7 @@ import java.util.Properties;
* toolkit <code>gnu.java.awt.peer.gtk.GtkToolkit</code> is used. This
* toolkit creates its peers using the GTK+ toolkit.
*
- * @author Aaron M. Renn <arenn@urbanophile.com>
+ * @author Aaron M. Renn (arenn@urbanophile.com)
*/
public abstract class Toolkit
{
@@ -526,6 +526,10 @@ public abstract class Toolkit
toolkit = (Toolkit) obj;
return toolkit;
}
+ catch (ThreadDeath death)
+ {
+ throw death;
+ }
catch (Throwable t)
{
AWTError e = new AWTError("Cannot load AWT toolkit: " + toolkit_name);
diff --git a/libjava/java/awt/Transparency.java b/libjava/java/awt/Transparency.java
index fc01f583955..9636458ff2e 100644
--- a/libjava/java/awt/Transparency.java
+++ b/libjava/java/awt/Transparency.java
@@ -40,7 +40,7 @@ package java.awt;
/**
* A common transparency mode for layering graphics.
*
- * @author Warren Levy <warrenl@cygnus.com>
+ * @author Warren Levy (warrenl@cygnus.com)
* @since 1.1
* @status updated to 1.4
*/
diff --git a/libjava/java/awt/Window.java b/libjava/java/awt/Window.java
index d084bb4350b..0a39d20b1ff 100644
--- a/libjava/java/awt/Window.java
+++ b/libjava/java/awt/Window.java
@@ -56,12 +56,15 @@ import java.util.Vector;
import javax.accessibility.Accessible;
import javax.accessibility.AccessibleContext;
+import javax.accessibility.AccessibleRole;
+import javax.accessibility.AccessibleState;
+import javax.accessibility.AccessibleStateSet;
/**
* This class represents a top-level window with no decorations.
*
- * @author Aaron M. Renn <arenn@urbanophile.com>
- * @author Warren Levy <warrenl@cygnus.com>
+ * @author Aaron M. Renn (arenn@urbanophile.com)
+ * @author Warren Levy (warrenl@cygnus.com)
*/
public class Window extends Container implements Accessible
{
@@ -84,11 +87,31 @@ public class Window extends Container implements Accessible
private transient WindowFocusListener windowFocusListener;
private transient WindowStateListener windowStateListener;
private transient GraphicsConfiguration graphicsConfiguration;
- private transient AccessibleContext accessibleContext;
private transient boolean shown;
private transient Component windowFocusOwner;
+
+ /*
+ * The number used to generate the name returned by getName.
+ */
+ private static transient long next_window_number;
+
+ protected class AccessibleAWTWindow extends AccessibleAWTContainer
+ {
+ public AccessibleRole getAccessibleRole()
+ {
+ return AccessibleRole.WINDOW;
+ }
+
+ public AccessibleStateSet getAccessibleStateSet()
+ {
+ AccessibleStateSet states = super.getAccessibleStateSet();
+ if (isActive())
+ states.add(AccessibleState.ACTIVE);
+ return states;
+ }
+ }
/**
* This (package access) constructor is used by subclasses that want
@@ -200,12 +223,11 @@ public class Window extends Container implements Accessible
&& gc.getDevice().getType() != GraphicsDevice.TYPE_RASTER_SCREEN)
throw new IllegalArgumentException ("gc must be from a screen device");
- // FIXME: until we implement this, it just causes AWT to crash.
-// if (gc == null)
-// graphicsConfiguration = GraphicsEnvironment.getLocalGraphicsEnvironment()
-// .getDefaultScreenDevice()
-// .getDefaultConfiguration();
-// else
+ if (gc == null)
+ graphicsConfiguration = GraphicsEnvironment.getLocalGraphicsEnvironment()
+ .getDefaultScreenDevice()
+ .getDefaultConfiguration();
+ else
graphicsConfiguration = gc;
}
@@ -672,8 +694,34 @@ public class Window extends Container implements Accessible
}
}
}
+
+ /**
+ * Identifies if this window is active. The active window is a Frame or
+ * Dialog that has focus or owns the active window.
+ *
+ * @return true if active, else false.
+ * @since 1.4
+ */
+ public boolean isActive()
+ {
+ KeyboardFocusManager manager = KeyboardFocusManager.getCurrentKeyboardFocusManager ();
+ return manager.getActiveWindow() == this;
+ }
/**
+ * Identifies if this window is focused. A window is focused if it is the
+ * focus owner or it contains the focus owner.
+ *
+ * @return true if focused, else false.
+ * @since 1.4
+ */
+ public boolean isFocused()
+ {
+ KeyboardFocusManager manager = KeyboardFocusManager.getCurrentKeyboardFocusManager ();
+ return manager.getFocusedWindow() == this;
+ }
+
+ /**
* Returns the child window that has focus if this window is active.
* This method returns <code>null</code> if this window is not active
* or no children have focus.
@@ -731,6 +779,22 @@ public class Window extends Container implements Accessible
return super.isShowing();
}
+ public void setLocationRelativeTo (Component c)
+ {
+ if (c == null || !c.isShowing ())
+ {
+ int x = 0;
+ int y = 0;
+
+ GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment ();
+ Point center = ge.getCenterPoint ();
+ x = center.x - (width / 2);
+ y = center.y - (height / 2);
+ setLocation (x, y);
+ }
+ // FIXME: handle case where component is non-null.
+ }
+
/**
* @since 1.2
*
@@ -754,11 +818,18 @@ public class Window extends Container implements Accessible
applyResourceBundle(rb);
}
+ /**
+ * Gets the AccessibleContext associated with this <code>Window</code>.
+ * The context is created, if necessary.
+ *
+ * @return the associated context
+ */
public AccessibleContext getAccessibleContext()
{
- // FIXME
- //return null;
- throw new Error ("Not implemented");
+ /* Create the context if this is the first request */
+ if (accessibleContext == null)
+ accessibleContext = new AccessibleAWTWindow();
+ return accessibleContext;
}
/**
@@ -866,17 +937,32 @@ public class Window extends Container implements Accessible
this.y = y;
width = w;
height = h;
- if (resized)
+ if (resized && isShowing ())
{
ComponentEvent ce =
new ComponentEvent(this, ComponentEvent.COMPONENT_RESIZED);
getToolkit().getSystemEventQueue().postEvent(ce);
}
- if (moved)
+ if (moved && isShowing ())
{
ComponentEvent ce =
new ComponentEvent(this, ComponentEvent.COMPONENT_MOVED);
getToolkit().getSystemEventQueue().postEvent(ce);
}
}
+
+ /**
+ * Generate a unique name for this window.
+ *
+ * @return A unique name for this window.
+ */
+ String generateName()
+ {
+ return "win" + getUniqueLong();
+ }
+
+ private static synchronized long getUniqueLong()
+ {
+ return next_window_number++;
+ }
}
diff --git a/libjava/java/awt/color/CMMException.java b/libjava/java/awt/color/CMMException.java
index a0948ef27eb..04ef3e2c849 100644
--- a/libjava/java/awt/color/CMMException.java
+++ b/libjava/java/awt/color/CMMException.java
@@ -1,5 +1,5 @@
/* CMMException.java -- error in the native CMM
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -41,7 +41,7 @@ package java.awt.color;
/**
* Thrown when there is an error in the native CMM.
*
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Eric Blake (ebb9@email.byu.edu)
* @status updated to 1.4
*/
public class CMMException extends RuntimeException
diff --git a/libjava/java/awt/color/ColorSpace.java b/libjava/java/awt/color/ColorSpace.java
index 905bf9cd769..dd7121ec0bf 100644
--- a/libjava/java/awt/color/ColorSpace.java
+++ b/libjava/java/awt/color/ColorSpace.java
@@ -43,7 +43,7 @@ import java.io.Serializable;
/**
* NEEDS DOCUMENTATION
*
- * @author Rolf W. Rasmussen <rolfwr@ii.uib.no>
+ * @author Rolf W. Rasmussen (rolfwr@ii.uib.no)
* @since 1.2
*/
public abstract class ColorSpace implements Serializable
diff --git a/libjava/java/awt/color/ICC_ColorSpace.java b/libjava/java/awt/color/ICC_ColorSpace.java
index 5cc526adb7a..d6771cd52d2 100644
--- a/libjava/java/awt/color/ICC_ColorSpace.java
+++ b/libjava/java/awt/color/ICC_ColorSpace.java
@@ -76,7 +76,7 @@ import java.io.ObjectInputStream;
* guaranteed to have transforms from the PCS to device space.
*
* @author Sven de Marothy
- * @author Rolf W. Rasmussen <rolfwr@ii.uib.no>
+ * @author Rolf W. Rasmussen (rolfwr@ii.uib.no)
* @since 1.2
*/
public class ICC_ColorSpace extends ColorSpace
diff --git a/libjava/java/awt/color/ICC_Profile.java b/libjava/java/awt/color/ICC_Profile.java
index 79aa886ec49..791ea9f6cf1 100644
--- a/libjava/java/awt/color/ICC_Profile.java
+++ b/libjava/java/awt/color/ICC_Profile.java
@@ -79,7 +79,7 @@ import java.util.Hashtable;
* (available at www.color.org)
*
* @author Sven de Marothy
- * @author Rolf W. Rasmussen <rolfwr@ii.uib.no>
+ * @author Rolf W. Rasmussen (rolfwr@ii.uib.no)
* @since 1.2
*/
public class ICC_Profile implements Serializable
@@ -316,8 +316,6 @@ public class ICC_Profile implements Serializable
*/
protected void finalize()
{
- header = null;
- tagTable = null;
}
/**
diff --git a/libjava/java/awt/color/ProfileDataException.java b/libjava/java/awt/color/ProfileDataException.java
index 89f47a207e1..53b6d28bc3a 100644
--- a/libjava/java/awt/color/ProfileDataException.java
+++ b/libjava/java/awt/color/ProfileDataException.java
@@ -1,5 +1,5 @@
/* ProfileDataException.java -- error in processing an ICC_Profile
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -42,7 +42,7 @@ package java.awt.color;
* Thrown when there is an error accessing or processing an
* <code>ICC_Profile</code>.
*
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Eric Blake (ebb9@email.byu.edu)
* @status updated to 1.4
*/
public class ProfileDataException extends RuntimeException
diff --git a/libjava/java/awt/datatransfer/FlavorTable.java b/libjava/java/awt/datatransfer/FlavorTable.java
index 3822cdec60b..1275d924ac3 100644
--- a/libjava/java/awt/datatransfer/FlavorTable.java
+++ b/libjava/java/awt/datatransfer/FlavorTable.java
@@ -1,5 +1,5 @@
/* FlavorTable.java -- A relaxed mapping between flavors
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -45,7 +45,7 @@ import java.util.List;
* native can map to multiple flavors, and any flavor can map to multiple
* natives; although the mappings are usually symmetric.
*
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Eric Blake (ebb9@email.byu.edu)
* @since 1.4
* @status updated to 1.4
*/
diff --git a/libjava/java/awt/datatransfer/MimeTypeParseException.java b/libjava/java/awt/datatransfer/MimeTypeParseException.java
index 42aecac0528..85331c2b447 100644
--- a/libjava/java/awt/datatransfer/MimeTypeParseException.java
+++ b/libjava/java/awt/datatransfer/MimeTypeParseException.java
@@ -1,5 +1,5 @@
/* MimeTypeParseException.java -- thrown when MIME string couldn't be parsed
- Copyright (C) 2001, 2002 Free Software Foundation, Inc.
+ Copyright (C) 2001, 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -41,7 +41,7 @@ package java.awt.datatransfer;
/**
* MIME string couldn't be parsed correctly.
*
- * @author Mark Wielaard <mark@klomp.org>
+ * @author Mark Wielaard (mark@klomp.org)
* @status updated to 1.4
*/
public class MimeTypeParseException extends Exception
diff --git a/libjava/java/awt/datatransfer/Transferable.java b/libjava/java/awt/datatransfer/Transferable.java
index 2b499314306..8fa56e82d80 100644
--- a/libjava/java/awt/datatransfer/Transferable.java
+++ b/libjava/java/awt/datatransfer/Transferable.java
@@ -1,5 +1,5 @@
/* Transferable.java -- Data transfer source
- Copyright (C) 1999, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -43,7 +43,7 @@ import java.io.IOException;
/**
* This interface is implemented by classes that can transfer data.
*
- * @author Aaron M. Renn <arenn@urbanophile.com>
+ * @author Aaron M. Renn (arenn@urbanophile.com)
* @since 1.1
* @status updated to 1.4
*/
diff --git a/libjava/java/awt/datatransfer/UnsupportedFlavorException.java b/libjava/java/awt/datatransfer/UnsupportedFlavorException.java
index 620452be6f8..57ea8568ff3 100644
--- a/libjava/java/awt/datatransfer/UnsupportedFlavorException.java
+++ b/libjava/java/awt/datatransfer/UnsupportedFlavorException.java
@@ -1,5 +1,5 @@
/* UnsupportedFlavorException.java -- ata flavor is not valid
- Copyright (C) 1999, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -41,7 +41,7 @@ package java.awt.datatransfer;
/**
* The data flavor requested is not supported for the transfer data.
*
- * @author Aaron M. Renn <arenn@urbanophile.com>
+ * @author Aaron M. Renn (arenn@urbanophile.com)
* @see Transferable#getTransferData(DataFlavor)
* @status updated to 1.4
*/
diff --git a/libjava/java/awt/dnd/Autoscroll.java b/libjava/java/awt/dnd/Autoscroll.java
index ae868c077b3..054bba898f3 100644
--- a/libjava/java/awt/dnd/Autoscroll.java
+++ b/libjava/java/awt/dnd/Autoscroll.java
@@ -1,5 +1,5 @@
/* Autoscroll.java --
- Copyright (C) 2002, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -46,7 +46,7 @@ import java.awt.Point;
* subject of the operation on a region of a scrollable GUI control that
* is not currently visible to the user.
*
- * @author Michael Koch <konqueror@gmx.de>
+ * @author Michael Koch (konqueror@gmx.de)
* @since 1.2
* @status updated to 1.4
*/
diff --git a/libjava/java/awt/dnd/DnDConstants.java b/libjava/java/awt/dnd/DnDConstants.java
index 3e78121a57a..e00b0003c2e 100644
--- a/libjava/java/awt/dnd/DnDConstants.java
+++ b/libjava/java/awt/dnd/DnDConstants.java
@@ -1,5 +1,5 @@
/* DnDConstants.java -- constants for drag-and-drop operations
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -42,7 +42,7 @@ package java.awt.dnd;
* This class contains various constants used in drag-and-drop operations.
* Why it is not an interface is beyond me.
*
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Eric Blake (ebb9@email.byu.edu)
* @since 1.2
* @status updated to 1.4
*/
@@ -69,4 +69,9 @@ public final class DnDConstants
/** A synonym for {@link #ACTION_LINK}. */
public static final int ACTION_REFERENCE = ACTION_LINK;
-} // class DnDConstants
+
+ private DnDConstants()
+ {
+ // Do nothing here.
+ }
+}
diff --git a/libjava/java/awt/dnd/DragGestureListener.java b/libjava/java/awt/dnd/DragGestureListener.java
index 2673d0d5d1f..f8c7ab47466 100644
--- a/libjava/java/awt/dnd/DragGestureListener.java
+++ b/libjava/java/awt/dnd/DragGestureListener.java
@@ -1,5 +1,5 @@
/* DragGestureListener.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -44,7 +44,7 @@ import java.util.EventListener;
* This is a listener for starting a drag-and-drop gesture. Upon receiving
* notification, the implementor then starts the drag operation.
*
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Eric Blake (ebb9@email.byu.edu)
* @see DragGestureRecognizer
* @see DragGestureEvent
* @see DragSource
diff --git a/libjava/java/awt/dnd/DragSourceAdapter.java b/libjava/java/awt/dnd/DragSourceAdapter.java
index 2b2e15541fd..8d65188f846 100644
--- a/libjava/java/awt/dnd/DragSourceAdapter.java
+++ b/libjava/java/awt/dnd/DragSourceAdapter.java
@@ -1,5 +1,5 @@
/* DragSourceAdapter.java -- drag-and-drop listener adapter
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -45,7 +45,7 @@ package java.awt.dnd;
* a subset of these interfaces to extend this class and override only the
* desired methods.
*
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Eric Blake (ebb9@email.byu.edu)
* @see DragSourceEvent
* @see DragSourceListener
* @see DragSourceMotionListener
diff --git a/libjava/java/awt/dnd/DragSourceDropEvent.java b/libjava/java/awt/dnd/DragSourceDropEvent.java
index a645814f160..876b73d14dc 100644
--- a/libjava/java/awt/dnd/DragSourceDropEvent.java
+++ b/libjava/java/awt/dnd/DragSourceDropEvent.java
@@ -1,5 +1,5 @@
/* DragSourceDragEvent.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,7 +38,7 @@ exception statement from your version. */
package java.awt.dnd;
/**
- * @author Michael Koch <konqueror@gmx.de>
+ * @author Michael Koch (konqueror@gmx.de)
* @since 1.2
*
* Written using JDK 1.4.1 Online API
diff --git a/libjava/java/awt/dnd/DragSourceListener.java b/libjava/java/awt/dnd/DragSourceListener.java
index 2022a32ac76..c4a7bf2103f 100644
--- a/libjava/java/awt/dnd/DragSourceListener.java
+++ b/libjava/java/awt/dnd/DragSourceListener.java
@@ -1,5 +1,5 @@
/* DragSourceListener.java -- listen to events during the drag
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -46,7 +46,7 @@ import java.util.EventListener;
* also use a <code>DragSourceAdapter</code> to filter the events you are
* interested in.
*
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Eric Blake (ebb9@email.byu.edu)
* @since 1.2
* @status updated to 1.4
*/
diff --git a/libjava/java/awt/dnd/DragSourceMotionListener.java b/libjava/java/awt/dnd/DragSourceMotionListener.java
index 38d025c3a06..d2568454486 100644
--- a/libjava/java/awt/dnd/DragSourceMotionListener.java
+++ b/libjava/java/awt/dnd/DragSourceMotionListener.java
@@ -1,5 +1,5 @@
/* DragSourceMotionListener.java -- tracks motion in the drag source
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -45,7 +45,7 @@ import java.util.EventListener;
* event occurs. You can also use a <code>DragSourceAdapter</code> to filter
* the events you are interested in.
*
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Eric Blake (ebb9@email.byu.edu)
* @see DragSourceDragEvent
* @see DragSource
* @see DragSourceListener
diff --git a/libjava/java/awt/dnd/DropTarget.java b/libjava/java/awt/dnd/DropTarget.java
index 7379ca71c0d..2a8b79d8415 100644
--- a/libjava/java/awt/dnd/DropTarget.java
+++ b/libjava/java/awt/dnd/DropTarget.java
@@ -205,15 +205,14 @@ public class DropTarget
/**
* Adds a new <code>DropTargetListener</code>.
*
- * @exception TooManyListenersException If there is already a
- * <code>DropTargetListener</code>.
+ * @exception TooManyListenersException Sun's JDK does not, despite
+ * documentation, throw this exception here when you install an additional
+ * <code>DropTargetListener</code>. So to be compatible, we do the same
+ * thing.
*/
public void addDropTargetListener (DropTargetListener dtl)
throws TooManyListenersException
{
- if (dtl != null)
- throw new TooManyListenersException ();
-
dropTargetListener = dtl;
}
diff --git a/libjava/java/awt/dnd/DropTargetAdapter.java b/libjava/java/awt/dnd/DropTargetAdapter.java
index 4ece882121b..a9a81ac56d5 100644
--- a/libjava/java/awt/dnd/DropTargetAdapter.java
+++ b/libjava/java/awt/dnd/DropTargetAdapter.java
@@ -1,5 +1,5 @@
/* DragSourceAdapter.java -- drag-and-drop listener adapter
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -43,7 +43,7 @@ package java.awt.dnd;
* a subset of these interfaces to extend this class and override only the
* desired methods.
*
- * @author Michael Koch <konqueror@gmx.de>
+ * @author Michael Koch (konqueror@gmx.de)
* @since 1.4
* @status updated to 1.4
*/
diff --git a/libjava/java/awt/dnd/DropTargetContext.java b/libjava/java/awt/dnd/DropTargetContext.java
index d61785545c9..0b3ba75b4b6 100644
--- a/libjava/java/awt/dnd/DropTargetContext.java
+++ b/libjava/java/awt/dnd/DropTargetContext.java
@@ -47,7 +47,7 @@ import java.util.Arrays;
import java.util.List;
/**
- * @author Michael Koch <konqueror@gmx.de>
+ * @author Michael Koch (konqueror@gmx.de)
* @since 1.2
*/
public class DropTargetContext implements Serializable
diff --git a/libjava/java/awt/dnd/DropTargetListener.java b/libjava/java/awt/dnd/DropTargetListener.java
index 8025ff23920..1eda1e34822 100644
--- a/libjava/java/awt/dnd/DropTargetListener.java
+++ b/libjava/java/awt/dnd/DropTargetListener.java
@@ -1,5 +1,5 @@
/* DropTargetListener.java -- listen to events during the drop
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -41,7 +41,7 @@ package java.awt.dnd;
import java.util.EventListener;
/**
- * @author Michael Koch <konqueror@gmx.de>
+ * @author Michael Koch (konqueror@gmx.de)
* @since 1.2
* @status updated to 1.4
*/
diff --git a/libjava/java/awt/dnd/InvalidDnDOperationException.java b/libjava/java/awt/dnd/InvalidDnDOperationException.java
index 927ab140627..d02c69b80d5 100644
--- a/libjava/java/awt/dnd/InvalidDnDOperationException.java
+++ b/libjava/java/awt/dnd/InvalidDnDOperationException.java
@@ -1,5 +1,5 @@
/* InvalidDnDOperationException.java -- thrown when drag-and-drop fails
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -43,7 +43,7 @@ package java.awt.dnd;
* requested operation, usually because the underlying DnD system is in the
* wrong state.
*
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Eric Blake (ebb9@email.byu.edu)
* @since 1.2
* @status updated to 1.4
*/
diff --git a/libjava/java/awt/dnd/MouseDragGestureRecognizer.java b/libjava/java/awt/dnd/MouseDragGestureRecognizer.java
index 6b21b43c598..52e19b17476 100644
--- a/libjava/java/awt/dnd/MouseDragGestureRecognizer.java
+++ b/libjava/java/awt/dnd/MouseDragGestureRecognizer.java
@@ -1,5 +1,5 @@
/* MouseDragGestureRecognizer.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -43,7 +43,7 @@ import java.awt.event.MouseListener;
import java.awt.event.MouseMotionListener;
/**
- * @author Michael Koch <konqueror@gmx.de>
+ * @author Michael Koch (konqueror@gmx.de)
*/
public abstract class MouseDragGestureRecognizer
extends DragGestureRecognizer
diff --git a/libjava/java/awt/dnd/peer/DropTargetContextPeer.java b/libjava/java/awt/dnd/peer/DropTargetContextPeer.java
index a2e3ba2189f..6c3816f00ac 100644
--- a/libjava/java/awt/dnd/peer/DropTargetContextPeer.java
+++ b/libjava/java/awt/dnd/peer/DropTargetContextPeer.java
@@ -1,5 +1,5 @@
/* DropTargetContextPeer.java -- interface for drag-and-drop peers
- Copyright (C) 2002, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -50,7 +50,7 @@ import java.awt.dnd.InvalidDnDOperationException;
* with an associated <code>DropTarget</code> and visible geometry is first
* intersected by a logical cursor.
*
- * @author Michael Koch <konqueror@gmx.de>
+ * @author Michael Koch (konqueror@gmx.de)
*/
public interface DropTargetContextPeer
{
diff --git a/libjava/java/awt/event/AWTEventListener.java b/libjava/java/awt/event/AWTEventListener.java
index b735ce1197b..b9ce7dc6690 100644
--- a/libjava/java/awt/event/AWTEventListener.java
+++ b/libjava/java/awt/event/AWTEventListener.java
@@ -1,5 +1,5 @@
/* AWTEventListener.java -- listen for all events in the AWT system
- Copyright (C) 1999, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -46,7 +46,7 @@ import java.util.EventListener;
* system. In general, this should not be used except for classes like
* javax.accessibility or by event recorders.
*
- * @author Aaron M. Renn <arenn@urbanophile.com>
+ * @author Aaron M. Renn (arenn@urbanophile.com)
* @see AWTEvent
* @see Toolkit#addAWTEventListener(AWTEventListener, long)
* @see Toolkit#removeAWTEventListener(AWTEventListener)
diff --git a/libjava/java/awt/event/AWTEventListenerProxy.java b/libjava/java/awt/event/AWTEventListenerProxy.java
index 7572e701a65..fef8ae70c5a 100644
--- a/libjava/java/awt/event/AWTEventListenerProxy.java
+++ b/libjava/java/awt/event/AWTEventListenerProxy.java
@@ -1,5 +1,5 @@
/* AWTEventListenerProxy.java -- wrapper/filter for AWTEventListener
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -45,7 +45,7 @@ import java.util.EventListenerProxy;
* This class allows adding an AWTEventListener which only pays attention to
* a specific event mask.
*
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Eric Blake (ebb9@email.byu.edu)
* @see Toolkit
* @see EventListenerProxy
* @since 1.4
diff --git a/libjava/java/awt/event/ActionEvent.java b/libjava/java/awt/event/ActionEvent.java
index 97f98070416..2b9763ee96d 100644
--- a/libjava/java/awt/event/ActionEvent.java
+++ b/libjava/java/awt/event/ActionEvent.java
@@ -1,5 +1,5 @@
/* ActionEvent.java -- an action has been triggered
- Copyright (C) 1999, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -45,7 +45,7 @@ import java.awt.EventQueue;
* This event is generated when an action on a component (such as a
* button press) occurs.
*
- * @author Aaron M. Renn <arenn@urbanophile.com>
+ * @author Aaron M. Renn (arenn@urbanophile.com)
* @see ActionListener
* @since 1.1
* @status updated to 1.4
diff --git a/libjava/java/awt/event/AdjustmentEvent.java b/libjava/java/awt/event/AdjustmentEvent.java
index 623dab5eaed..f7c7ae48e7c 100644
--- a/libjava/java/awt/event/AdjustmentEvent.java
+++ b/libjava/java/awt/event/AdjustmentEvent.java
@@ -1,5 +1,5 @@
/* AdjustmentEvent.java -- an adjustable value was changed
- Copyright (C) 1999, 2002, 2004 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -45,7 +45,7 @@ import java.awt.Adjustable;
* This class represents an event that is generated when an adjustable
* value is changed.
*
- * @author Aaron M. Renn <arenn@urbanophile.com>
+ * @author Aaron M. Renn (arenn@urbanophile.com)
* @see Adjustable
* @see AdjustmentListener
* @since 1.1
diff --git a/libjava/java/awt/event/AdjustmentListener.java b/libjava/java/awt/event/AdjustmentListener.java
index 050528b00c9..d07663c5448 100644
--- a/libjava/java/awt/event/AdjustmentListener.java
+++ b/libjava/java/awt/event/AdjustmentListener.java
@@ -1,5 +1,5 @@
/* AdjustmentListener.java -- listen for adjustment events
- Copyright (C) 1999, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -43,7 +43,7 @@ import java.util.EventListener;
/**
* Interface for classes that listen for adjustment events.
*
- * @author Aaron M. Renn <arenn@urbanophile.com>
+ * @author Aaron M. Renn (arenn@urbanophile.com)
* @since 1.1
* @status updated to 1.4
*/
diff --git a/libjava/java/awt/event/ComponentAdapter.java b/libjava/java/awt/event/ComponentAdapter.java
index a8d6044fa2e..6ef78478405 100644
--- a/libjava/java/awt/event/ComponentAdapter.java
+++ b/libjava/java/awt/event/ComponentAdapter.java
@@ -1,5 +1,5 @@
/* ComponentAdapter.java -- convenience class for writing component listeners
- Copyright (C) 1999, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -44,7 +44,7 @@ package java.awt.event;
* implementing only a subset of the <code>ComponentListener</code>
* interface to extend this class and override only the desired methods.
*
- * @author Aaron M. Renn <arenn@urbanophile.com>
+ * @author Aaron M. Renn (arenn@urbanophile.com)
* @see ComponentEvent
* @see ComponentListener
* @since 1.1
diff --git a/libjava/java/awt/event/ComponentEvent.java b/libjava/java/awt/event/ComponentEvent.java
index 0f208151d3c..08f0df7936f 100644
--- a/libjava/java/awt/event/ComponentEvent.java
+++ b/libjava/java/awt/event/ComponentEvent.java
@@ -1,5 +1,5 @@
/* ComponentEvent.java -- notification of events for components
- Copyright (C) 1999, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -48,7 +48,7 @@ import java.awt.Component;
* is also the superclass for other events on components, but
* ComponentListeners ignore such subclasses.
*
- * @author Aaron M. Renn <arenn@urbanophile.com>
+ * @author Aaron M. Renn (arenn@urbanophile.com)
* @see ComponentAdapter
* @see ComponentListener
* @since 1.1
diff --git a/libjava/java/awt/event/ComponentListener.java b/libjava/java/awt/event/ComponentListener.java
index fbfc3335cf9..7f601740b31 100644
--- a/libjava/java/awt/event/ComponentListener.java
+++ b/libjava/java/awt/event/ComponentListener.java
@@ -1,5 +1,5 @@
/* ComponentListener.java -- receive all events for a component
- Copyright (C) 1999, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -46,7 +46,7 @@ import java.util.EventListener;
* handles them internally, taking all appropriate actions. To watch a subset
* of these events, use a ComponentAdapter.
*
- * @author Aaron M. Renn <arenn@urbanophile.com>
+ * @author Aaron M. Renn (arenn@urbanophile.com)
* @see ComponentAdapter
* @see ComponentEvent
* @since 1.1
diff --git a/libjava/java/awt/event/ContainerAdapter.java b/libjava/java/awt/event/ContainerAdapter.java
index b4c97be47b0..bad475ecf04 100644
--- a/libjava/java/awt/event/ContainerAdapter.java
+++ b/libjava/java/awt/event/ContainerAdapter.java
@@ -1,5 +1,5 @@
/* ContainerAdapter.java -- convenience class for writing container listeners
- Copyright (C) 1999, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -44,7 +44,7 @@ package java.awt.event;
* implementing only a subset of the <code>ContainerListener</code>
* interface to extend this class and override only the desired methods.
*
- * @author Aaron M. Renn <arenn@urbanophile.com>
+ * @author Aaron M. Renn (arenn@urbanophile.com)
* @see ContainerEvent
* @see ContainerListener
* @since 1.1
diff --git a/libjava/java/awt/event/ContainerEvent.java b/libjava/java/awt/event/ContainerEvent.java
index fe087d2e507..08c55faf63c 100644
--- a/libjava/java/awt/event/ContainerEvent.java
+++ b/libjava/java/awt/event/ContainerEvent.java
@@ -1,5 +1,5 @@
/* ContainerEvent.java -- components added/removed from a container
- Copyright (C) 1999, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -46,7 +46,7 @@ import java.awt.Container;
* container. Applications do not ordinarily need to handle these events
* since the AWT system handles them internally.
*
- * @author Aaron M. Renn <arenn@urbanophile.com>
+ * @author Aaron M. Renn (arenn@urbanophile.com)
* @see ContainerAdapter
* @see ContainerListener
* @since 1.1
diff --git a/libjava/java/awt/event/ContainerListener.java b/libjava/java/awt/event/ContainerListener.java
index a937e1550aa..2ad00f0b58d 100644
--- a/libjava/java/awt/event/ContainerListener.java
+++ b/libjava/java/awt/event/ContainerListener.java
@@ -1,5 +1,5 @@
/* ContainerListener.java -- listen for container events
- Copyright (C) 1999, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -46,7 +46,7 @@ import java.util.EventListener;
* listens for and processes these events. To watch a subset of these events,
* use a ContainerAdapter.
*
- * @author Aaron M. Renn <arenn@urbanophile.com>
+ * @author Aaron M. Renn (arenn@urbanophile.com)
* @see ContainerAdapter
* @see ContainerEvent
* @since 1.1
diff --git a/libjava/java/awt/event/FocusAdapter.java b/libjava/java/awt/event/FocusAdapter.java
index 721878efccb..471c7f25c0a 100644
--- a/libjava/java/awt/event/FocusAdapter.java
+++ b/libjava/java/awt/event/FocusAdapter.java
@@ -1,5 +1,5 @@
/* FocusAdapter.java -- convenience class for writing focus listeners
- Copyright (C) 1999, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -44,7 +44,7 @@ package java.awt.event;
* implementing only a subset of the <code>FocusListener</code> interface to
* extend this class and override only the desired methods.
*
- * @author Aaron M. Renn <arenn@urbanophile.com>
+ * @author Aaron M. Renn (arenn@urbanophile.com)
* @see FocusEvent
* @see FocusListener
* @since 1.1
diff --git a/libjava/java/awt/event/FocusEvent.java b/libjava/java/awt/event/FocusEvent.java
index 9f2b98f762a..3bca6a7d49e 100644
--- a/libjava/java/awt/event/FocusEvent.java
+++ b/libjava/java/awt/event/FocusEvent.java
@@ -1,5 +1,5 @@
/* FocusEvent.java -- generated for a focus change
- Copyright (C) 1999, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -46,7 +46,7 @@ import java.awt.Component;
* during a sroll then returned, and permanent changes, such as when the user
* TABs through focusable components.
*
- * @author Aaron M. Renn <arenn@urbanophile.com>
+ * @author Aaron M. Renn (arenn@urbanophile.com)
* @see FocusAdapter
* @see FocusListener
* @since 1.1
diff --git a/libjava/java/awt/event/FocusListener.java b/libjava/java/awt/event/FocusListener.java
index e372843cb2a..d8ef5a81e28 100644
--- a/libjava/java/awt/event/FocusListener.java
+++ b/libjava/java/awt/event/FocusListener.java
@@ -1,5 +1,5 @@
/* FocusListener.java -- listen for focus changes
- Copyright (C) 1999, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -45,7 +45,7 @@ import java.util.EventListener;
* keyboard focus for a component. To watch a subset of these events, use a
* FocusAdapter.
*
- * @author Aaron M. Renn <arenn@urbanophile.com>
+ * @author Aaron M. Renn (arenn@urbanophile.com)
* @see FocusAdapter
* @see FocusEvent
* @since 1.1
diff --git a/libjava/java/awt/event/InputEvent.java b/libjava/java/awt/event/InputEvent.java
index b2a1e3114ec..cd59afc299c 100644
--- a/libjava/java/awt/event/InputEvent.java
+++ b/libjava/java/awt/event/InputEvent.java
@@ -1,5 +1,5 @@
/* InputEvent.java -- common superclass of component input events
- Copyright (C) 1999, 2002, 2004 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -47,7 +47,7 @@ import java.awt.Component;
* passed to listeners before the component, so that listeners can consume
* the event before it does its default behavior.
*
- * @author Aaron M. Renn <arenn@urbanophile.com>
+ * @author Aaron M. Renn (arenn@urbanophile.com)
* @see KeyEvent
* @see KeyAdapter
* @see MouseEvent
diff --git a/libjava/java/awt/event/InputMethodEvent.java b/libjava/java/awt/event/InputMethodEvent.java
index 880025b0a9f..98dc4263341 100644
--- a/libjava/java/awt/event/InputMethodEvent.java
+++ b/libjava/java/awt/event/InputMethodEvent.java
@@ -1,5 +1,5 @@
/* InputMethodEvent.java -- events from a text input method
- Copyright (C) 1999, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -49,7 +49,7 @@ import java.text.AttributedCharacterIterator;
/**
* This class is for event generated by change in a text input method.
*
- * @author Aaron M. Renn <arenn@urbanophile.com>
+ * @author Aaron M. Renn (arenn@urbanophile.com)
* @see InputMethodListener
* @since 1.2
* @status updated to 1.4
diff --git a/libjava/java/awt/event/InputMethodListener.java b/libjava/java/awt/event/InputMethodListener.java
index bf09ed89336..08de16f7d3c 100644
--- a/libjava/java/awt/event/InputMethodListener.java
+++ b/libjava/java/awt/event/InputMethodListener.java
@@ -1,5 +1,5 @@
/* InputMethodListener.java -- listen for input method events
- Copyright (C) 1999, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -45,7 +45,7 @@ import java.util.EventListener;
* method. For a text component to use input methods, it must also install
* an InputMethodRequests handler.
*
- * @author Aaron M. Renn <arenn@urbanophile.com>
+ * @author Aaron M. Renn (arenn@urbanophile.com)
* @see InputMethodEvent
* @see InputMethodRequests
* @since 1.2
diff --git a/libjava/java/awt/event/InvocationEvent.java b/libjava/java/awt/event/InvocationEvent.java
index fb58595c793..27546c010ec 100644
--- a/libjava/java/awt/event/InvocationEvent.java
+++ b/libjava/java/awt/event/InvocationEvent.java
@@ -1,5 +1,5 @@
/* InvocationEvent.java -- call a runnable when dispatched
- Copyright (C) 1999, 2002, 2004 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -48,7 +48,7 @@ import java.awt.EventQueue;
* <code>invokeAndWait</code>, so client code can use this fact to avoid
* writing special-casing AWTEventListener objects.
*
- * @author Aaron M. Renn <arenn@urbanophile.com>
+ * @author Aaron M. Renn (arenn@urbanophile.com)
* @see ActiveEvent
* @see EventQueue#invokeLater(Runnable)
* @see EventQueue#invokeAndWait(Runnable)
diff --git a/libjava/java/awt/event/ItemEvent.java b/libjava/java/awt/event/ItemEvent.java
index 43784a86504..f9c3ee2fcf4 100644
--- a/libjava/java/awt/event/ItemEvent.java
+++ b/libjava/java/awt/event/ItemEvent.java
@@ -1,5 +1,5 @@
/* ItemEvent.java -- event for item state changes
- Copyright (C) 1999, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -46,7 +46,7 @@ import java.awt.ItemSelectable;
* abstraction that distills a large number of individual mouse or keyboard
* events into a simpler "item selected" and "item deselected" events.
*
- * @author Aaron M. Renn <arenn@urbanophile.com>
+ * @author Aaron M. Renn (arenn@urbanophile.com)
* @see ItemSelectable
* @see ItemListener
* @since 1.1
diff --git a/libjava/java/awt/event/ItemListener.java b/libjava/java/awt/event/ItemListener.java
index 5c67357851b..cc8f8c79204 100644
--- a/libjava/java/awt/event/ItemListener.java
+++ b/libjava/java/awt/event/ItemListener.java
@@ -1,5 +1,5 @@
/* ItemListener.java -- listen for item events
- Copyright (C) 1999, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -44,7 +44,7 @@ import java.util.EventListener;
* This interface is for classes that wish to receive events when an
* item's selection state changes.
*
- * @author Aaron M. Renn <arenn@urbanophile.com>
+ * @author Aaron M. Renn (arenn@urbanophile.com)
* @see ItemSelectable
* @see ItemEvent
* @since 1.1
diff --git a/libjava/java/awt/event/KeyAdapter.java b/libjava/java/awt/event/KeyAdapter.java
index c60fd52e245..d27786c4347 100644
--- a/libjava/java/awt/event/KeyAdapter.java
+++ b/libjava/java/awt/event/KeyAdapter.java
@@ -1,5 +1,5 @@
/* KeyAdapter.java -- convenience class for writing key listeners
- Copyright (C) 1999, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -44,7 +44,7 @@ package java.awt.event;
* a subset of the <code>KeyListener</code> interface to extend this class
* and override only the desired methods.
*
- * @author Aaron M. Renn <arenn@urbanophile.com>
+ * @author Aaron M. Renn (arenn@urbanophile.com)
* @see KeyEvent
* @see KeyListener
* @since 1.1
diff --git a/libjava/java/awt/event/KeyEvent.java b/libjava/java/awt/event/KeyEvent.java
index 7212c0c9791..cef05ae6241 100644
--- a/libjava/java/awt/event/KeyEvent.java
+++ b/libjava/java/awt/event/KeyEvent.java
@@ -1,5 +1,5 @@
/* KeyEvent.java -- event for key presses
- Copyright (C) 1999, 2002, 2004 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -70,8 +70,8 @@ import java.io.ObjectInputStream;
* as VK_ALL_CANDIDATES in place of ALT+VK_CONVERT. Do not rely on the value
* of the VK_* constants, except for VK_ENTER, VK_BACK_SPACE, and VK_TAB.
*
- * @author Aaron M. Renn <arenn@urbanophile.com>
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Aaron M. Renn (arenn@urbanophile.com)
+ * @author Eric Blake (ebb9@email.byu.edu)
* @see KeyAdapter
* @see KeyListener
* @since 1.1
diff --git a/libjava/java/awt/event/KeyListener.java b/libjava/java/awt/event/KeyListener.java
index 7443eedd8fb..d46edf4f48f 100644
--- a/libjava/java/awt/event/KeyListener.java
+++ b/libjava/java/awt/event/KeyListener.java
@@ -1,5 +1,5 @@
/* KeyListener.java -- listen for keyboard presses
- Copyright (C) 1999, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -44,7 +44,7 @@ import java.util.EventListener;
* This interface is for classes that wish to receive keyboard events. To
* watch a subset of these events, use a KeyAdapter.
*
- * @author Aaron M. Renn <arenn@urbanophile.com>
+ * @author Aaron M. Renn (arenn@urbanophile.com)
* @see KeyAdapter
* @see KeyEvent
* @since 1.1
diff --git a/libjava/java/awt/event/MouseAdapter.java b/libjava/java/awt/event/MouseAdapter.java
index 2518d365576..5c8cbd0d51a 100644
--- a/libjava/java/awt/event/MouseAdapter.java
+++ b/libjava/java/awt/event/MouseAdapter.java
@@ -1,5 +1,5 @@
/* MouseAdapter.java -- convenience class for writing mouse listeners
- Copyright (C) 1999, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -44,7 +44,7 @@ package java.awt.event;
* a subset of the <code>MouseListener</code> interface to extend this class
* and override only the desired methods.
*
- * @author Aaron M. Renn <arenn@urbanophile.com>
+ * @author Aaron M. Renn (arenn@urbanophile.com)
* @see MouseEvent
* @see MouseListener
* @since 1.1
diff --git a/libjava/java/awt/event/MouseEvent.java b/libjava/java/awt/event/MouseEvent.java
index 7f3e014a2ea..6e43183dd05 100644
--- a/libjava/java/awt/event/MouseEvent.java
+++ b/libjava/java/awt/event/MouseEvent.java
@@ -1,5 +1,5 @@
/* MouseEvent.java -- a mouse event
- Copyright (C) 1999, 2002, 2004 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -63,8 +63,8 @@ import java.io.ObjectInputStream;
* virtual device, some platforms may clip the path to fit in the bounds of
* the component.
*
- * @author Aaron M. Renn <arenn@urbanophile.com>
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Aaron M. Renn (arenn@urbanophile.com)
+ * @author Eric Blake (ebb9@email.byu.edu)
* @see MouseAdapter
* @see MouseListener
* @see MouseMotionAdapter
diff --git a/libjava/java/awt/event/MouseListener.java b/libjava/java/awt/event/MouseListener.java
index 6162b089769..8b60ef70447 100644
--- a/libjava/java/awt/event/MouseListener.java
+++ b/libjava/java/awt/event/MouseListener.java
@@ -1,5 +1,5 @@
/* MouseListener.java -- listen for mouse clicks and crossing component edges
- Copyright (C) 1999, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -48,7 +48,7 @@ import java.util.EventListener;
* use MouseWheelListener. To watch a subset of these events, use a
* MouseAdapter.
*
- * @author Aaron M. Renn <arenn@urbanophile.com>
+ * @author Aaron M. Renn (arenn@urbanophile.com)
* @see MouseAdapter
* @see MouseEvent
* @since 1.1
diff --git a/libjava/java/awt/event/MouseMotionAdapter.java b/libjava/java/awt/event/MouseMotionAdapter.java
index cc7498820c7..0500cc5f58a 100644
--- a/libjava/java/awt/event/MouseMotionAdapter.java
+++ b/libjava/java/awt/event/MouseMotionAdapter.java
@@ -1,5 +1,5 @@
/* MouseMotionAdapter.java -- convenience class for mouse motion listeners
- Copyright (C) 1999, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -44,7 +44,7 @@ package java.awt.event;
* implementing only a subset of the <code>MouseMotionListener</code>
* interface to extend this class and override only the desired methods.
*
- * @author Aaron M. Renn <arenn@urbanophile.com>
+ * @author Aaron M. Renn (arenn@urbanophile.com)
* @see MouseEvent
* @see MouseMotionListener
* @since 1.1
diff --git a/libjava/java/awt/event/MouseMotionListener.java b/libjava/java/awt/event/MouseMotionListener.java
index 16ced33c1f4..1a003eaca80 100644
--- a/libjava/java/awt/event/MouseMotionListener.java
+++ b/libjava/java/awt/event/MouseMotionListener.java
@@ -1,5 +1,5 @@
/* MouseMotionListener.java -- listen to mouse motion events
- Copyright (C) 1999, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -46,7 +46,7 @@ import java.util.EventListener;
* track other mouse events, use MouseListener or MouseWheelListener. To
* watch a subset of these events, use a MouseMotionAdapter.
*
- * @author Aaron M. Renn <arenn@urbanophile.com>
+ * @author Aaron M. Renn (arenn@urbanophile.com)
* @see MouseMotionAdapter
* @see MouseEvent
* @since 1.1
diff --git a/libjava/java/awt/event/MouseWheelEvent.java b/libjava/java/awt/event/MouseWheelEvent.java
index 88d31a5467a..c16705759e7 100644
--- a/libjava/java/awt/event/MouseWheelEvent.java
+++ b/libjava/java/awt/event/MouseWheelEvent.java
@@ -1,5 +1,5 @@
/* MouseWheelEvent.java -- a mouse wheel event
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -57,7 +57,7 @@ import java.awt.Component;
* "blocks" (pages at a time). The initial setting is taken from the platform,
* although the user can adjust the setting at any time.
*
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Eric Blake (ebb9@email.byu.edu)
* @see MouseWheelListener
* @see ScrollPane
* @see ScrollPane#setWheelScrollingEnabled(boolean)
diff --git a/libjava/java/awt/event/MouseWheelListener.java b/libjava/java/awt/event/MouseWheelListener.java
index 15cbd0370f1..cfb5528f4f8 100644
--- a/libjava/java/awt/event/MouseWheelListener.java
+++ b/libjava/java/awt/event/MouseWheelListener.java
@@ -1,5 +1,5 @@
/* MouseWheelListener.java -- listen for mouse wheel events
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -44,7 +44,7 @@ import java.util.EventListener;
* This interface is for classes that wish to receive mouse wheel events. For
* other events, use MouseListener or MouseMotionListener.
*
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Eric Blake (ebb9@email.byu.edu)
* @see MouseWheelEvent
* @since 1.4
* @status updated to 1.4
diff --git a/libjava/java/awt/event/PaintEvent.java b/libjava/java/awt/event/PaintEvent.java
index 107c6b390b6..c11e2b65fa4 100644
--- a/libjava/java/awt/event/PaintEvent.java
+++ b/libjava/java/awt/event/PaintEvent.java
@@ -1,5 +1,5 @@
/* PaintEvent.java -- an area of the screen needs to be repainted
- Copyright (C) 1999, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -46,7 +46,7 @@ import java.awt.Rectangle;
* This event is not meant for users, but exists to allow proper serialization
* behavior in the EventQueue with user-accessible events.
*
- * @author Aaron M. Renn <arenn@urbanophile.com>
+ * @author Aaron M. Renn (arenn@urbanophile.com)
* @since 1.1
* @status updated to 1.4
*/
diff --git a/libjava/java/awt/event/TextEvent.java b/libjava/java/awt/event/TextEvent.java
index 58d9ab6086f..7cf44b4c0d6 100644
--- a/libjava/java/awt/event/TextEvent.java
+++ b/libjava/java/awt/event/TextEvent.java
@@ -1,5 +1,5 @@
/* TextEvent.java -- event for text changes
- Copyright (C) 1999, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -45,7 +45,7 @@ import java.awt.AWTEvent;
* abstraction that distills a large number of individual mouse or keyboard
* events into a simpler "text changed" event.
*
- * @author Aaron M. Renn <arenn@urbanophile.com>
+ * @author Aaron M. Renn (arenn@urbanophile.com)
* @see TextComponent
* @see TextListener
* @since 1.1
diff --git a/libjava/java/awt/event/TextListener.java b/libjava/java/awt/event/TextListener.java
index efdd103d509..f764783510c 100644
--- a/libjava/java/awt/event/TextListener.java
+++ b/libjava/java/awt/event/TextListener.java
@@ -1,5 +1,5 @@
/* TextListener.java -- listen for text changes
- Copyright (C) 1999, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -44,7 +44,7 @@ import java.util.EventListener;
* This interface is for classes that wish to be notified when text changes
* in a component.
*
- * @author Aaron M. Renn <arenn@urbanophile.com>
+ * @author Aaron M. Renn (arenn@urbanophile.com)
* @see TextEvent
* @since 1.1
* @status updated to 1.4
diff --git a/libjava/java/awt/event/WindowAdapter.java b/libjava/java/awt/event/WindowAdapter.java
index 5dea18c3e8f..39292862d29 100644
--- a/libjava/java/awt/event/WindowAdapter.java
+++ b/libjava/java/awt/event/WindowAdapter.java
@@ -1,5 +1,5 @@
/* WindowAdapter.java -- convenience class for writing window listeners
- Copyright (C) 1999, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -45,7 +45,7 @@ package java.awt.event;
* interested in listening to only a subset of any <code>WindowEvent</code>
* actions to extend this class and override only the desired methods.
*
- * @author Aaron M. Renn <arenn@urbanophile.com>
+ * @author Aaron M. Renn (arenn@urbanophile.com)
* @see ComponentEvent
* @see ComponentListener
* @since 1.1
diff --git a/libjava/java/awt/event/WindowEvent.java b/libjava/java/awt/event/WindowEvent.java
index 6e40d5165b8..68a8c25d08b 100644
--- a/libjava/java/awt/event/WindowEvent.java
+++ b/libjava/java/awt/event/WindowEvent.java
@@ -1,5 +1,5 @@
/* WindowEvent.java -- window change event
- Copyright (C) 1999, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -48,7 +48,7 @@ import java.awt.Window;
* like maximization, and WindowFocusListeners deal with focus switching to
* or from a window.
*
- * @author Aaron M. Renn <arenn@urbanophile.com>
+ * @author Aaron M. Renn (arenn@urbanophile.com)
* @see WindowAdapter
* @see WindowListener
* @see WindowFocusListener
diff --git a/libjava/java/awt/event/WindowFocusListener.java b/libjava/java/awt/event/WindowFocusListener.java
index de684fbfce1..42034b7c7ab 100644
--- a/libjava/java/awt/event/WindowFocusListener.java
+++ b/libjava/java/awt/event/WindowFocusListener.java
@@ -1,5 +1,5 @@
/* WindowFocusListener.java -- listens for window focus events
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -44,7 +44,7 @@ import java.util.EventListener;
* This interface is for classes that wish to monitor events for window
* focus changes. To watch a subset of these events, use a WindowAdapter.
*
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Eric Blake (ebb9@email.byu.edu)
* @see WindowAdapter
* @see WindowEvent
* @since 1.4
diff --git a/libjava/java/awt/event/WindowListener.java b/libjava/java/awt/event/WindowListener.java
index ab22c8fb826..8bbcabaf64d 100644
--- a/libjava/java/awt/event/WindowListener.java
+++ b/libjava/java/awt/event/WindowListener.java
@@ -1,5 +1,5 @@
/* WindowListener.java -- listens for window events
- Copyright (C) 1999, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -44,7 +44,7 @@ import java.util.EventListener;
* This interface is for classes that wish to monitor events for window
* changes. To watch a subset of these events, use a WindowAdapter.
*
- * @author Aaron M. Renn <arenn@urbanophile.com>
+ * @author Aaron M. Renn (arenn@urbanophile.com)
* @see WindowAdapter
* @see WindowEvent
* @since 1.1
diff --git a/libjava/java/awt/event/WindowStateListener.java b/libjava/java/awt/event/WindowStateListener.java
index 2d870a8dd9f..dcf4496c796 100644
--- a/libjava/java/awt/event/WindowStateListener.java
+++ b/libjava/java/awt/event/WindowStateListener.java
@@ -1,5 +1,5 @@
/* WindowStateListener.java -- listens for window state changes
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -44,7 +44,7 @@ import java.util.EventListener;
* This interface is for classes that wish to monitor events for window
* state changes.
*
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Eric Blake (ebb9@email.byu.edu)
* @see WindowAdapter
* @see WindowEvent
* @since 1.4
diff --git a/libjava/java/awt/font/TextAttribute.java b/libjava/java/awt/font/TextAttribute.java
index 7d5444677a9..e63d2955e56 100644
--- a/libjava/java/awt/font/TextAttribute.java
+++ b/libjava/java/awt/font/TextAttribute.java
@@ -1,5 +1,5 @@
/* TextAttribute.java --
- Copyright (C) 2003, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -41,83 +41,269 @@ package java.awt.font;
import java.io.InvalidObjectException;
import java.text.AttributedCharacterIterator;
+/**
+ * Attributes (and associated values) that can be used to define an
+ * {@link java.text.AttributedString}.
+ */
public final class TextAttribute extends AttributedCharacterIterator.Attribute
{
private static final long serialVersionUID = 7744112784117861702L;
+ /** A key for the background paint attribute. */
public static final TextAttribute BACKGROUND =
- new TextAttribute ("BACKGROUND");
+ new TextAttribute("background");
+
+ /** A key for the BIDI_EMBEDDING attribute. */
public static final TextAttribute BIDI_EMBEDDING =
- new TextAttribute ("BIDI_EMBEDDING");
+ new TextAttribute("bidi_embedding");
+
+ /** A key for the CHAR_REPLACEMENT attribute. */
public static final TextAttribute CHAR_REPLACEMENT =
- new TextAttribute ("CHAR_REPLACEMENT");
- public static final TextAttribute FAMILY = new TextAttribute ("FAMILY");
- public static final TextAttribute FONT = new TextAttribute ("FONT");
- public static final TextAttribute FOREGROUND =
- new TextAttribute ("FOREGROUND");
+ new TextAttribute("char_replacement");
+
+ /** A key for the FAMILY attribute. */
+ public static final TextAttribute FAMILY = new TextAttribute("family");
+
+ /** A key for the font attribute. */
+ public static final TextAttribute FONT = new TextAttribute("font");
+
+ /** A key for the foreground paint attribute. */
+ public static final TextAttribute FOREGROUND =
+ new TextAttribute("foreground");
+
+ /** A key for the INPUT_METHOD_HIGHLIGHT attribute. */
public static final TextAttribute INPUT_METHOD_HIGHLIGHT =
- new TextAttribute ("INPUT_METHOD_HIGHLIGHT");
+ new TextAttribute("input method highlight");
+
+ /** A key for the INPUT_METHOD_UNDERLINE attribute. */
public static final TextAttribute INPUT_METHOD_UNDERLINE =
- new TextAttribute ("INPUT_METHOD_UNDERLINE");
+ new TextAttribute("input method underline");
+
+ /** A key for the text justification attribute. */
public static final TextAttribute JUSTIFICATION =
- new TextAttribute ("JUSTIFICATION");
- public static final Float JUSTIFICATION_FULL = new Float (1.0);
- public static final Float JUSTIFICATION_NONE = new Float (0.0);
+ new TextAttribute("justification");
+
+ /**
+ * A value that can be used with the {@link #JUSTIFICATION} attribute to
+ * indicate full justification of the text.
+ */
+ public static final Float JUSTIFICATION_FULL = new Float(1.0);
+
+ /**
+ * A value that can be used with the {@link #JUSTIFICATION} attribute to
+ * indicate no justification of the text.
+ */
+ public static final Float JUSTIFICATION_NONE = new Float(0.0);
+
+ /** A key for the NUMERIC_SHAPING attribute. */
public static final TextAttribute NUMERIC_SHAPING =
- new TextAttribute ("NUMERIC_SHAPING");
- public static final TextAttribute POSTURE = new TextAttribute ("POSTURE");
- public static final Float POSTURE_OBLIQUE = new Float (0.2);
- public static final Float POSTURE_REGULAR = new Float (0.0);
+ new TextAttribute("numeric_shaping");
+
+ /** A key for the POSTURE attribute. */
+ public static final TextAttribute POSTURE = new TextAttribute("posture");
+
+ /** A value that can be used with the {@link #POSTURE} attribute. */
+ public static final Float POSTURE_OBLIQUE = new Float(0.2);
+
+ /** A value that can be used with the {@link #POSTURE} attribute. */
+ public static final Float POSTURE_REGULAR = new Float(0.0);
+
+ /** A key for the RUN_DIRECTION attribute. */
public static final TextAttribute RUN_DIRECTION =
- new TextAttribute ("RUN_DIRECTION");
- public static final Boolean RUN_DIRECTION_LTR = Boolean.TRUE;
- public static final Boolean RUN_DIRECTION_RTL = Boolean.FALSE;
- public static final TextAttribute SIZE = new TextAttribute ("SIZE");
+ new TextAttribute("run_direction");
+
+ /** A value that can be used with the {@link #RUN_DIRECTION} attribute. */
+ public static final Boolean RUN_DIRECTION_LTR = Boolean.FALSE;
+
+ /** A value that can be used with the {@link #RUN_DIRECTION} attribute. */
+ public static final Boolean RUN_DIRECTION_RTL = Boolean.TRUE;
+
+ /** A key for the text size attribute. */
+ public static final TextAttribute SIZE = new TextAttribute("size");
+
+ /** A key for the STRIKETHROUGH attribute. */
public static final TextAttribute STRIKETHROUGH =
- new TextAttribute ("STRIKETHROUGH");
+ new TextAttribute("strikethrough");
+
+ /** A value that can be used with the {@link #STRIKETHROUGH} attribute. */
public static final Boolean STRIKETHROUGH_ON = Boolean.TRUE;
+
+ /** A key for the SUPERSCRIPT attribute. */
public static final TextAttribute SUPERSCRIPT =
- new TextAttribute ("SUPERSCRIPT");
- public static final Integer SUPERSCRIPT_SUB = new Integer (-1);
- public static final Integer SUPERSCRIPT_SUPER = new Integer (1);
+ new TextAttribute("superscript");
+
+ /** A value that can be used with the {@link #SUPERSCRIPT} attribute. */
+ public static final Integer SUPERSCRIPT_SUB = new Integer(-1);
+
+ /** A value that can be used with the {@link #SUPERSCRIPT} attribute. */
+ public static final Integer SUPERSCRIPT_SUPER = new Integer(1);
+
+ /** A key for the SWAP_COLORS attribute. */
public static final TextAttribute SWAP_COLORS =
- new TextAttribute ("SWAP_COLORS");
+ new TextAttribute("swap_colors");
+
+ /** A value that can be used with the {@link #SWAP_COLORS} attribute. */
public static final Boolean SWAP_COLORS_ON = Boolean.TRUE;
- public static final TextAttribute TRANSFORM = new TextAttribute ("TRANSFORM");
- public static final TextAttribute UNDERLINE = new TextAttribute ("UNDERLINE");
- public static final Integer UNDERLINE_LOW_DASHED = new Integer (0);
- public static final Integer UNDERLINE_LOW_DOTTED = new Integer (0);
- public static final Integer UNDERLINE_LOW_GRAY = new Integer (0);
- public static final Integer UNDERLINE_LOW_ONE_PIXEL = new Integer (0);
- public static final Integer UNDERLINE_LOW_TWO_PIXEL = new Integer (0);
- public static final Integer UNDERLINE_ON = new Integer (0);
- public static final TextAttribute WEIGHT = new TextAttribute ("WEIGHT");
- public static final Float WEIGHT_BOLD = new Float (2.0);
- public static final Float WEIGHT_DEMIBOLD = new Float (1.75);
- public static final Float WEIGHT_DEMILIGHT = new Float (0.875);
- public static final Float WEIGHT_EXTRA_LIGHT = new Float (0.5);
- public static final Float WEIGHT_EXTRABOLD = new Float (2.5);
- public static final Float WEIGHT_HEAVY = new Float (2.25);
- public static final Float WEIGHT_LIGHT = new Float (0.75);
- public static final Float WEIGHT_MEDIUM = new Float (1.5);
- public static final Float WEIGHT_REGULAR = new Float (1.0);
- public static final Float WEIGHT_SEMIBOLD = new Float (1.25);
- public static final Float WEIGHT_ULTRABOLD = new Float (2.75);
- public static final TextAttribute WIDTH = new TextAttribute ("");
- public static final Float WIDTH_CONDENSED = new Float (0.75);
- public static final Float WIDTH_EXTENDED = new Float (1.5);
- public static final Float WIDTH_REGULAR = new Float (1.0);
- public static final Float WIDTH_SEMI_CONDENSED = new Float (0.875);
- public static final Float WIDTH_SEMI_EXTENDED = new Float (1.25);
-
- protected TextAttribute (String name)
+
+ /** A key for the TRANFORM attribute. */
+ public static final TextAttribute TRANSFORM = new TextAttribute("transform");
+
+ /** A key for the UNDERLINE attribute. */
+ public static final TextAttribute UNDERLINE = new TextAttribute("underline");
+
+ /** A value that can be used with the {@link #UNDERLINE} attribute. */
+ public static final Integer UNDERLINE_LOW_DASHED = new Integer(5);
+
+ /** A value that can be used with the {@link #UNDERLINE} attribute. */
+ public static final Integer UNDERLINE_LOW_DOTTED = new Integer(3);
+
+ /** A value that can be used with the {@link #UNDERLINE} attribute. */
+ public static final Integer UNDERLINE_LOW_GRAY = new Integer(4);
+
+ /** A value that can be used with the {@link #UNDERLINE} attribute. */
+ public static final Integer UNDERLINE_LOW_ONE_PIXEL = new Integer(1);
+
+ /** A value that can be used with the {@link #UNDERLINE} attribute. */
+ public static final Integer UNDERLINE_LOW_TWO_PIXEL = new Integer(2);
+
+ /** A value that can be used with the {@link #UNDERLINE} attribute. */
+ public static final Integer UNDERLINE_ON = new Integer(0);
+
+ /** A key for the WEIGHT attribute. */
+ public static final TextAttribute WEIGHT = new TextAttribute("weight");
+
+ /** A value that can be used with the {@link #WEIGHT} attribute. */
+ public static final Float WEIGHT_BOLD = new Float(2.0);
+
+ /** A value that can be used with the {@link #WEIGHT} attribute. */
+ public static final Float WEIGHT_DEMIBOLD = new Float(1.75);
+
+ /** A value that can be used with the {@link #WEIGHT} attribute. */
+ public static final Float WEIGHT_DEMILIGHT = new Float(0.875);
+
+ /** A value that can be used with the {@link #WEIGHT} attribute. */
+ public static final Float WEIGHT_EXTRA_LIGHT = new Float(0.5);
+
+ /** A value that can be used with the {@link #WEIGHT} attribute. */
+ public static final Float WEIGHT_EXTRABOLD = new Float(2.5);
+
+ /** A value that can be used with the {@link #WEIGHT} attribute. */
+ public static final Float WEIGHT_HEAVY = new Float(2.25);
+
+ /** A value that can be used with the {@link #WEIGHT} attribute. */
+ public static final Float WEIGHT_LIGHT = new Float(0.75);
+
+ /** A value that can be used with the {@link #WEIGHT} attribute. */
+ public static final Float WEIGHT_MEDIUM = new Float(1.5);
+
+ /** A value that can be used with the {@link #WEIGHT} attribute. */
+ public static final Float WEIGHT_REGULAR = new Float(1.0);
+
+ /** A value that can be used with the {@link #WEIGHT} attribute. */
+ public static final Float WEIGHT_SEMIBOLD = new Float(1.25);
+
+ /** A value that can be used with the {@link #WEIGHT} attribute. */
+ public static final Float WEIGHT_ULTRABOLD = new Float(2.75);
+
+ /** A key for the WIDTH attribute. */
+ public static final TextAttribute WIDTH = new TextAttribute("width");
+
+ /** A value that can be used with the {@link #WIDTH} attribute. */
+ public static final Float WIDTH_CONDENSED = new Float(0.75);
+
+ /** A value that can be used with the {@link #WIDTH} attribute. */
+ public static final Float WIDTH_EXTENDED = new Float(1.5);
+
+ /** A value that can be used with the {@link #WIDTH} attribute. */
+ public static final Float WIDTH_REGULAR = new Float(1.0);
+
+ /** A value that can be used with the {@link #WIDTH} attribute. */
+ public static final Float WIDTH_SEMI_CONDENSED = new Float(0.875);
+
+ /** A value that can be used with the {@link #WIDTH} attribute. */
+ public static final Float WIDTH_SEMI_EXTENDED = new Float(1.25);
+
+ /**
+ * Creates a new attribute.
+ *
+ * @param name the name.
+ */
+ protected TextAttribute(String name)
{
- super (name);
+ super(name);
}
- protected Object readResolve ()
+ /**
+ * After deserialization, this method ensures that only one instance of
+ * each attribute is used.
+ *
+ * @return The (single) attribute instance.
+ *
+ * @throws InvalidObjectException if the attribute is not recognised.
+ */
+ protected Object readResolve()
throws InvalidObjectException
{
- throw new Error ("not implemented");
+ if (this.getName().equals("background"))
+ return BACKGROUND;
+
+ if (this.getName().equals("bidi_embedding"))
+ return BIDI_EMBEDDING;
+
+ if (this.getName().equals("char_replacement"))
+ return CHAR_REPLACEMENT;
+
+ if (this.getName().equals("family"))
+ return FAMILY;
+
+ if (this.getName().equals("font"))
+ return FONT;
+
+ if (this.getName().equals("foreground"))
+ return FOREGROUND;
+
+ if (this.getName().equals("input method highlight"))
+ return INPUT_METHOD_HIGHLIGHT;
+
+ if (this.getName().equals("input method underline"))
+ return INPUT_METHOD_UNDERLINE;
+
+ if (this.getName().equals("justification"))
+ return JUSTIFICATION;
+
+ if (this.getName().equals("numeric_shaping"))
+ return NUMERIC_SHAPING;
+
+ if (this.getName().equals("posture"))
+ return POSTURE;
+
+ if (this.getName().equals("run_direction"))
+ return RUN_DIRECTION;
+
+ if (this.getName().equals("size"))
+ return SIZE;
+
+ if (this.getName().equals("strikethrough"))
+ return STRIKETHROUGH;
+
+ if (this.getName().equals("superscript"))
+ return SUPERSCRIPT;
+
+ if (this.getName().equals("swap_colors"))
+ return SWAP_COLORS;
+
+ if (this.getName().equals("transform"))
+ return TRANSFORM;
+
+ if (this.getName().equals("underline"))
+ return UNDERLINE;
+
+ if (this.getName().equals("weight"))
+ return WEIGHT;
+
+ if (this.getName().equals("width"))
+ return WIDTH;
+
+ throw new InvalidObjectException("Can't resolve Attribute: " + getName());
}
}
diff --git a/libjava/java/awt/font/TextHitInfo.java b/libjava/java/awt/font/TextHitInfo.java
index daeb7c689b3..2629ad2a54d 100644
--- a/libjava/java/awt/font/TextHitInfo.java
+++ b/libjava/java/awt/font/TextHitInfo.java
@@ -1,5 +1,5 @@
/* TextHitInfo.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,7 +38,7 @@ exception statement from your version. */
package java.awt.font;
/**
- * @author John Leuner <jewel@debian.org>
+ * @author John Leuner (jewel@debian.org)
*/
public final class TextHitInfo
{
diff --git a/libjava/java/awt/font/TransformAttribute.java b/libjava/java/awt/font/TransformAttribute.java
index b2417041961..3bb3c3cf1c3 100644
--- a/libjava/java/awt/font/TransformAttribute.java
+++ b/libjava/java/awt/font/TransformAttribute.java
@@ -1,5 +1,5 @@
-/* TransformAttribute.java
- Copyright (C) 2003 Free Software Foundation, Inc.
+/* TransformAttribute.java --
+ Copyright (C) 2003, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -42,6 +42,13 @@ import java.awt.geom.AffineTransform;
import java.io.Serializable;
/**
+ * This class provides a mechanism for using an {@link AffineTransform} as
+ * an <i>immutable</i> attribute (for example, in the
+ * {@link java.text.AttributedString} class). Any transform passed to
+ * this class is copied before being stored, and any transform handed out
+ * by this class is a copy of the stored transform. In this way, it is
+ * not possible to modify the stored transform.
+ *
* @author Michael Koch
*/
public final class TransformAttribute implements Serializable
@@ -50,20 +57,40 @@ public final class TransformAttribute implements Serializable
private AffineTransform affineTransform;
+ /**
+ * Creates a new attribute that contains a copy of the given transform.
+ *
+ * @param transform the transform (<code>null</code> not permitted).
+ *
+ * @throws IllegalArgumentException if <code>transform</code> is
+ * <code>null</code>.
+ */
public TransformAttribute (AffineTransform transform)
{
- if (transform != null)
+ if (transform == null)
{
- this.affineTransform = new AffineTransform (transform);
+ throw new IllegalArgumentException("Null 'transform' not permitted.");
}
+ this.affineTransform = new AffineTransform (transform);
}
+ /**
+ * Returns a copy of the transform contained by this attribute.
+ *
+ * @return A copy of the transform.
+ */
public AffineTransform getTransform ()
{
- return affineTransform;
+ return (AffineTransform) affineTransform.clone();
}
/**
+ * Returns <code>true</code> if the transform contained by this attribute is
+ * an identity transform, and <code>false</code> otherwise.
+ *
+ * @return <code>true</code> if the transform contained by this attribute is
+ * an identity transform, and <code>false</code> otherwise.
+ *
* @since 1.4
*/
public boolean isIdentity ()
diff --git a/libjava/java/awt/geom/Area.java b/libjava/java/awt/geom/Area.java
index 9b1b9d3b109..68f905f08f4 100644
--- a/libjava/java/awt/geom/Area.java
+++ b/libjava/java/awt/geom/Area.java
@@ -2631,11 +2631,9 @@ public class Area implements Shape, Cloneable
double P = (y2 - 2 * y1 + y0);
double Q = 2 * (y1 - y0);
- double R = y0;
double A = (x2 - 2 * x1 + x0);
double B = 2 * (x1 - x0);
- double C = x0;
double area = (B * P - A * Q) / 3.0;
return (area);
@@ -2937,12 +2935,10 @@ public class Area implements Shape, Cloneable
double P = y3 - 3 * y2 + 3 * y1 - y0;
double Q = 3 * (y2 + y0 - 2 * y1);
double R = 3 * (y1 - y0);
- double S = y0;
double A = x3 - 3 * x2 + 3 * x1 - x0;
double B = 3 * (x2 + x0 - 2 * x1);
double C = 3 * (x1 - x0);
- double D = x0;
double area = (B * P - A * Q) / 5.0 + (C * P - A * R) / 2.0
+ (C * Q - B * R) / 3.0;
diff --git a/libjava/java/awt/geom/CubicCurve2D.java b/libjava/java/awt/geom/CubicCurve2D.java
index 20373061d18..1c500b00b5e 100644
--- a/libjava/java/awt/geom/CubicCurve2D.java
+++ b/libjava/java/awt/geom/CubicCurve2D.java
@@ -642,11 +642,11 @@ public abstract class CubicCurve2D implements Shape, Cloneable
* @see #solveCubic(double[], double[])
* @see QuadCurve2D#solveQuadratic(double[],double[])
*
- * @author <a href="mailto:bjg@network-theory.com">Brian Gough</a>
+ * @author Brian Gough (bjg@network-theory.com)
* (original C implementation in the <a href=
* "http://www.gnu.org/software/gsl/">GNU Scientific Library</a>)
*
- * @author <a href="mailto:brawer@dandelis.ch">Sascha Brawer</a>
+ * @author Sascha Brawer (brawer@dandelis.ch)
* (adaptation to Java)
*/
public static int solveCubic(double[] eqn)
@@ -689,11 +689,11 @@ public abstract class CubicCurve2D implements Shape, Cloneable
* result of -1 indicates that the equation is constant (i.e.,
* always or never zero).
*
- * @author <a href="mailto:bjg@network-theory.com">Brian Gough</a>
+ * @author Brain Gouph (bjg@network-theory.com)
* (original C implementation in the <a href=
* "http://www.gnu.org/software/gsl/">GNU Scientific Library</a>)
*
- * @author <a href="mailto:brawer@dandelis.ch">Sascha Brawer</a>
+ * @author Sascha Brawer (brawer@dandelis.ch)
* (adaptation to Java)
*/
public static int solveCubic(double[] eqn, double[] res)
diff --git a/libjava/java/awt/geom/Dimension2D.java b/libjava/java/awt/geom/Dimension2D.java
index dbbdf6b25b3..8654c745ec0 100644
--- a/libjava/java/awt/geom/Dimension2D.java
+++ b/libjava/java/awt/geom/Dimension2D.java
@@ -42,8 +42,8 @@ package java.awt.geom;
* This stores a dimension in 2-dimensional space - a width (along the x-axis)
* and height (along the y-axis). The storage is left to subclasses.
*
- * @author Per Bothner <bothner@cygnus.com>
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Per Bothner (bothner@cygnus.com)
+ * @author Eric Blake (ebb9@email.byu.edu)
* @since 1.2
* @status updated to 1.4
*/
diff --git a/libjava/java/awt/geom/Ellipse2D.java b/libjava/java/awt/geom/Ellipse2D.java
index bd64adf1e3a..85ba1d1e9a5 100644
--- a/libjava/java/awt/geom/Ellipse2D.java
+++ b/libjava/java/awt/geom/Ellipse2D.java
@@ -46,10 +46,10 @@ package java.awt.geom;
* The ellipse is defined by it's bounding box (shown in red),
* and is defined by the implicit curve:<BR>
* <blockquote>(<i>x</i>/<i>a</i>)<sup>2</sup> +
- * (<i>y</i>/<i>b</i>)<sup>2</sup> = 1<BR><BR>
+ * (<i>y</i>/<i>b</i>)<sup>2</sup> = 1<BR><BR></blockquote>
*
- * @author Tom Tromey <tromey@cygnus.com>
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Tom Tromey (tromey@cygnus.com)
+ * @author Eric Blake (ebb9@email.byu.edu)
*
* @since 1.2
*/
diff --git a/libjava/java/awt/geom/IllegalPathStateException.java b/libjava/java/awt/geom/IllegalPathStateException.java
index f0e388aac55..3aa432df14c 100644
--- a/libjava/java/awt/geom/IllegalPathStateException.java
+++ b/libjava/java/awt/geom/IllegalPathStateException.java
@@ -41,7 +41,7 @@ package java.awt.geom;
* Thrown when an operation on a path is in an illegal state, such as appending
* a segment to a <code>GeneralPath</code> without an initial moveto.
*
- * @author Tom Tromey <tromey@cygnus.com>
+ * @author Tom Tromey (tromey@cygnus.com)
* @see GeneralPath
* @status updated to 1.4
*/
diff --git a/libjava/java/awt/geom/Line2D.java b/libjava/java/awt/geom/Line2D.java
index 05eedcde4b2..3b64f455727 100644
--- a/libjava/java/awt/geom/Line2D.java
+++ b/libjava/java/awt/geom/Line2D.java
@@ -46,8 +46,8 @@ import java.util.NoSuchElementException;
* Remember, on-screen graphics have increasing x from left-to-right, and
* increasing y from top-to-bottom. The storage is left to subclasses.
*
- * @author Tom Tromey <tromey@cygnus.com>
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Tom Tromey (tromey@cygnus.com)
+ * @author Eric Blake (ebb9@email.byu.edu)
* @author David Gilbert
* @since 1.2
* @status updated to 1.4
@@ -867,7 +867,7 @@ public abstract class Line2D implements Shape, Cloneable
/**
* This class defines a point in <code>double</code> precision.
*
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Eric Blake (ebb9@email.byu.edu)
* @since 1.2
* @status updated to 1.4
*/
@@ -1017,7 +1017,7 @@ public abstract class Line2D implements Shape, Cloneable
/**
* This class defines a point in <code>float</code> precision.
*
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Eric Blake (ebb9@email.byu.edu)
* @since 1.2
* @status updated to 1.4
*/
diff --git a/libjava/java/awt/geom/NoninvertibleTransformException.java b/libjava/java/awt/geom/NoninvertibleTransformException.java
index 40b2c180298..0fa36674d4e 100644
--- a/libjava/java/awt/geom/NoninvertibleTransformException.java
+++ b/libjava/java/awt/geom/NoninvertibleTransformException.java
@@ -42,7 +42,7 @@ package java.awt.geom;
* <code>AffineTransform</code>, but the transform is in a non-invertible
* state.
*
- * @author Tom Tromey <tromey@cygnus.com>
+ * @author Tom Tromey (tromey@cygnus.com)
* @see AffineTransform
* @status updated to 1.4
*/
diff --git a/libjava/java/awt/geom/PathIterator.java b/libjava/java/awt/geom/PathIterator.java
index 8076b5c8353..6d38911b732 100644
--- a/libjava/java/awt/geom/PathIterator.java
+++ b/libjava/java/awt/geom/PathIterator.java
@@ -44,8 +44,8 @@ package java.awt.geom;
* MOVETO directive, and can close a circular path back to the previos
* MOVETO via the CLOSE directive.
*
- * @author Tom Tromey <tromey@cygnus.com>
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Tom Tromey (tromey@cygnus.com)
+ * @author Eric Blake (ebb9@email.byu.edu)
* @see java.awt.Shape
* @see java.awt.Stroke
* @see FlatteningPathIterator
diff --git a/libjava/java/awt/geom/Point2D.java b/libjava/java/awt/geom/Point2D.java
index d27505fa41d..e334ac7806b 100644
--- a/libjava/java/awt/geom/Point2D.java
+++ b/libjava/java/awt/geom/Point2D.java
@@ -229,7 +229,7 @@ public abstract class Point2D implements Cloneable
/**
* This class defines a point in <code>double</code> precision.
*
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Eric Blake (ebb9@email.byu.edu)
* @since 1.2
* @status updated to 1.4
*/
@@ -307,7 +307,7 @@ public abstract class Point2D implements Cloneable
/**
* This class defines a point in <code>float</code> precision.
*
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Eric Blake (ebb9@email.byu.edu)
* @since 1.2
* @status updated to 1.4
*/
diff --git a/libjava/java/awt/geom/QuadCurve2D.java b/libjava/java/awt/geom/QuadCurve2D.java
index 0376d5a01af..db7c2abf2ec 100644
--- a/libjava/java/awt/geom/QuadCurve2D.java
+++ b/libjava/java/awt/geom/QuadCurve2D.java
@@ -41,7 +41,6 @@ import java.awt.Rectangle;
import java.awt.Shape;
import java.util.NoSuchElementException;
-
/**
* A two-dimensional curve that is parameterized with a quadratic
* function.
@@ -563,11 +562,11 @@ public abstract class QuadCurve2D implements Shape, Cloneable
* result of -1 indicates that the equation is constant (i.e.,
* always or never zero).
*
- * @author <a href="mailto:bjg@network-theory.com">Brian Gough</a>
+ * @author Brain Gouph (bjg@network-theory.com)
* (original C implementation in the <a href=
* "http://www.gnu.org/software/gsl/">GNU Scientific Library</a>)
*
- * @author <a href="mailto:brawer@dandelis.ch">Sascha Brawer</a>
+ * @author Sascha Brawer (brawer@dandelis.ch)
* (adaptation to Java)
*/
public static int solveQuadratic(double[] eqn)
@@ -608,11 +607,11 @@ public abstract class QuadCurve2D implements Shape, Cloneable
* result of -1 indicates that the equation is constant (i.e.,
* always or never zero).
*
- * @author <a href="mailto:bjg@network-theory.com">Brian Gough</a>
+ * @author Brian Gouph (bjg@network-theory.com)
* (original C implementation in the <a href=
* "http://www.gnu.org/software/gsl/">GNU Scientific Library</a>)
*
- * @author <a href="mailto:brawer@dandelis.ch">Sascha Brawer</a>
+ * @author Sascha Brawer (brawer@dandelis.ch)
* (adaptation to Java)
*/
public static int solveQuadratic(double[] eqn, double[] res)
diff --git a/libjava/java/awt/geom/Rectangle2D.java b/libjava/java/awt/geom/Rectangle2D.java
index bd1a37c6e09..d8217fecdb5 100644
--- a/libjava/java/awt/geom/Rectangle2D.java
+++ b/libjava/java/awt/geom/Rectangle2D.java
@@ -1,5 +1,5 @@
/* Rectangle2D.java -- generic rectangles in 2-D space
- Copyright (C) 2000, 2001, 2002 Free Software Foundation
+ Copyright (C) 2000, 2001, 2002, 2004 Free Software Foundation
This file is part of GNU Classpath.
@@ -57,30 +57,30 @@ import java.util.NoSuchElementException;
public abstract class Rectangle2D extends RectangularShape
{
/**
- * The point lies left of the rectangle (p.x < r.x).
+ * The point lies left of the rectangle (p.x &lt; r.x).
*
- * @see #outcode()
+ * @see #outcode(double, double)
*/
public static final int OUT_LEFT = 1;
/**
- * The point lies above the rectangle (p.y < r.y).
+ * The point lies above the rectangle (p.y &lt; r.y).
*
- * @see #outcode()
+ * @see #outcode(double, double)
*/
public static final int OUT_TOP = 2;
/**
* The point lies right of the rectangle (p.x &gt; r.maxX).
*
- * @see #outcode()
+ * @see #outcode(double, double)
*/
public static final int OUT_RIGHT = 4;
/**
* The point lies below of the rectangle (p.y &gt; r.maxY).
*
- * @see #outcode()
+ * @see #outcode(double, double)
*/
public static final int OUT_BOTTOM = 8;
diff --git a/libjava/java/awt/geom/RectangularShape.java b/libjava/java/awt/geom/RectangularShape.java
index 78e393eafcb..8679d2e32d5 100644
--- a/libjava/java/awt/geom/RectangularShape.java
+++ b/libjava/java/awt/geom/RectangularShape.java
@@ -46,8 +46,8 @@ import java.awt.Shape;
* subclasses which represent geometric objects inside a rectangular frame.
* This does not specify any geometry except for the bounding box.
*
- * @author Tom Tromey <tromey@cygnus.com>
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Tom Tromey (tromey@cygnus.com)
+ * @author Eric Blake (ebb9@email.byu.edu)
* @since 1.2
* @see Arc2D
* @see Ellipse2D
diff --git a/libjava/java/awt/geom/RoundRectangle2D.java b/libjava/java/awt/geom/RoundRectangle2D.java
index 3f004ed6bbc..b9af7efc7ee 100644
--- a/libjava/java/awt/geom/RoundRectangle2D.java
+++ b/libjava/java/awt/geom/RoundRectangle2D.java
@@ -41,7 +41,7 @@ import java.util.NoSuchElementException;
/** This class implements a rectangle with rounded corners.
- * @author Tom Tromey <tromey@cygnus.com>
+ * @author Tom Tromey (tromey@cygnus.com)
* @date December 3, 2000
*/
public abstract class RoundRectangle2D extends RectangularShape
diff --git a/libjava/java/awt/im/InputContext.java b/libjava/java/awt/im/InputContext.java
index 04e70e313f5..03fbd361026 100644
--- a/libjava/java/awt/im/InputContext.java
+++ b/libjava/java/awt/im/InputContext.java
@@ -1,5 +1,5 @@
/* InputContext.java -- provides the context for text input
- Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -74,7 +74,7 @@ import java.util.Locale;
* one entry per line in UTF-8 encoding, each class in the jar that implements
* java.awt.im.spi.InputMethodDescriptor.
*
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Eric Blake (ebb9@email.byu.edu)
* @see Component#getInputContext()
* @see Component#enableInputMethods(boolean)
* @since 1.2
@@ -102,8 +102,8 @@ public class InputContext
while (e.hasMoreElements())
{
URL url = (URL) e.nextElement();
- BufferedReader in = null;
- String line = null;
+ BufferedReader in;
+ String line;
try
{
in = new BufferedReader
diff --git a/libjava/java/awt/im/InputMethodHighlight.java b/libjava/java/awt/im/InputMethodHighlight.java
index 2946d259b91..92867624aaf 100644
--- a/libjava/java/awt/im/InputMethodHighlight.java
+++ b/libjava/java/awt/im/InputMethodHighlight.java
@@ -1,5 +1,5 @@
/* InputMethodHighlight.java -- highlights the current text selection
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -52,7 +52,7 @@ import java.util.Map;
* AttributedCharacterIterators, and may be wrapped in Annotations to separate
* text segments.
*
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Eric Blake (ebb9@email.byu.edu)
* @see AttributedCharacterIterators
* @see Annotation
* @since 1.2
diff --git a/libjava/java/awt/im/InputMethodRequests.java b/libjava/java/awt/im/InputMethodRequests.java
index 88253ed6237..d39efcb9400 100644
--- a/libjava/java/awt/im/InputMethodRequests.java
+++ b/libjava/java/awt/im/InputMethodRequests.java
@@ -1,5 +1,5 @@
/* InputMethodRequests.java -- handles text insertion via input methods
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -51,7 +51,7 @@ import java.text.AttributedCharacterIterator.Attribute;
* usually below the main text window, until it is committed into place at
* the insertion point, overwriting any selected text</li></ul>
*
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Eric Blake (ebb9@email.byu.edu)
* @see Component#getInputMethodRequests()
* @see InputMethodListener
* @since 1.2
diff --git a/libjava/java/awt/im/InputSubset.java b/libjava/java/awt/im/InputSubset.java
index fd03269a891..78c2164ffab 100644
--- a/libjava/java/awt/im/InputSubset.java
+++ b/libjava/java/awt/im/InputSubset.java
@@ -1,5 +1,5 @@
/* InputSubset.java -- subsets of Unicode important in text input
- Copyright (C) 2002, 2003 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2003, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -42,7 +42,7 @@ package java.awt.im;
* These constants encompass several Unicode blocks, or portions thereof, for
* simplification over {@link Character.UnicodeBlock}.
*
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Eric Blake (ebb9@email.byu.edu)
* @since 1.2
* @status updated to 1.4
*/
diff --git a/libjava/java/awt/im/spi/InputMethod.java b/libjava/java/awt/im/spi/InputMethod.java
index 0e981efb87f..18f7a7b17a3 100644
--- a/libjava/java/awt/im/spi/InputMethod.java
+++ b/libjava/java/awt/im/spi/InputMethod.java
@@ -1,5 +1,5 @@
/* InputMethod.java -- defines an interface for complex text input
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -51,7 +51,7 @@ import java.util.Locale;
* <p>These contexts can be loaded by the input method framework, using
* {@link InputContext#selectInputMethod(Locale)}.
*
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Eric Blake (ebb9@email.byu.edu)
* @since 1.3
* @status updated to 1.4
*/
diff --git a/libjava/java/awt/im/spi/InputMethodDescriptor.java b/libjava/java/awt/im/spi/InputMethodDescriptor.java
index 9ba97744aef..57a1fda48ba 100644
--- a/libjava/java/awt/im/spi/InputMethodDescriptor.java
+++ b/libjava/java/awt/im/spi/InputMethodDescriptor.java
@@ -1,5 +1,5 @@
/* InputMethodDescriptor.java -- enables loading and use of an input method
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -45,7 +45,7 @@ import java.util.Locale;
* This interface provides information about an InputMethod before it is
* loaded.
*
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Eric Blake (ebb9@email.byu.edu)
* @since 1.3
* @status updated to 1.4
*/
diff --git a/libjava/java/awt/image/BandCombineOp.java b/libjava/java/awt/image/BandCombineOp.java
index 48c61c57026..4c921ede9ae 100644
--- a/libjava/java/awt/image/BandCombineOp.java
+++ b/libjava/java/awt/image/BandCombineOp.java
@@ -53,7 +53,7 @@ import java.awt.geom.Rectangle2D;
* for the destination. Therefore the destination Raster must contain the
* same number of bands as the number of rows in the filter matrix.
*
- * @author Jerry Quinn <jlquinn@optonline.net>
+ * @author Jerry Quinn (jlquinn@optonline.net)
*/
public class BandCombineOp implements RasterOp
{
diff --git a/libjava/java/awt/image/BandedSampleModel.java b/libjava/java/awt/image/BandedSampleModel.java
index 93252d9cce6..68a4466eea2 100644
--- a/libjava/java/awt/image/BandedSampleModel.java
+++ b/libjava/java/awt/image/BandedSampleModel.java
@@ -41,7 +41,7 @@ package java.awt.image;
* multiple pixels in a single unit. Pixels have 2^n bits and 2^k pixels fit
* per data element.
*
- * @author Jerry Quinn <jlquinn@optonline.net>
+ * @author Jerry Quinn (jlquinn@optonline.net)
*/
public final class BandedSampleModel extends ComponentSampleModel
{
diff --git a/libjava/java/awt/image/ByteLookupTable.java b/libjava/java/awt/image/ByteLookupTable.java
index f0221915a71..8bea284e9d3 100644
--- a/libjava/java/awt/image/ByteLookupTable.java
+++ b/libjava/java/awt/image/ByteLookupTable.java
@@ -1,5 +1,5 @@
/* ByteLookupTable.java -- Java class for a pixel translation table.
- Copyright (C) 2004 Free Software Foundation, Inc.
+ Copyright (C) 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -44,7 +44,7 @@ package java.awt.image;
* Alpha, R, G, and B. When doing translation, the offset is subtracted from
* the pixel values to allow a subset of an array to be used.
*
- * @author <a href="mailto:jlquinn@optonline.net">Jerry Quinn</a>
+ * @author Jerry Quinn (jlquinn@optonline.net)
* @version 1.0
*/
public class ByteLookupTable extends LookupTable
diff --git a/libjava/java/awt/image/ComponentSampleModel.java b/libjava/java/awt/image/ComponentSampleModel.java
index 0665f406793..86161e0ae39 100644
--- a/libjava/java/awt/image/ComponentSampleModel.java
+++ b/libjava/java/awt/image/ComponentSampleModel.java
@@ -56,7 +56,7 @@ import gnu.java.awt.Buffers;
* is controlled by bandOffset, pixelStride, and scanlineStride, which means
* that any combination of interleavings is supported.
*
- * @author Rolf W. Rasmussen <rolfwr@ii.uib.no>
+ * @author Rolf W. Rasmussen (rolfwr@ii.uib.no)
*/
public class ComponentSampleModel extends SampleModel
{
diff --git a/libjava/java/awt/image/DataBuffer.java b/libjava/java/awt/image/DataBuffer.java
index b921953ec28..6f0215b10e1 100644
--- a/libjava/java/awt/image/DataBuffer.java
+++ b/libjava/java/awt/image/DataBuffer.java
@@ -41,7 +41,7 @@ package java.awt.image;
* of one or more banks. A bank is a continuous region of data
* elements.
*
- * @author Rolf W. Rasmussen <rolfwr@ii.uib.no>
+ * @author Rolf W. Rasmussen (rolfwr@ii.uib.no)
*/
public abstract class DataBuffer
{
diff --git a/libjava/java/awt/image/DataBufferByte.java b/libjava/java/awt/image/DataBufferByte.java
index c56be6b31dd..a306ede6fd6 100644
--- a/libjava/java/awt/image/DataBufferByte.java
+++ b/libjava/java/awt/image/DataBufferByte.java
@@ -47,7 +47,7 @@ package java.awt.image;
code is a maintenance nightmare. */
/**
- * @author Rolf W. Rasmussen <rolfwr@ii.uib.no>
+ * @author Rolf W. Rasmussen (rolfwr@ii.uib.no)
*/
public final class DataBufferByte extends DataBuffer
{
diff --git a/libjava/java/awt/image/DataBufferDouble.java b/libjava/java/awt/image/DataBufferDouble.java
index 305cb00b2ff..c6d1e100d35 100644
--- a/libjava/java/awt/image/DataBufferDouble.java
+++ b/libjava/java/awt/image/DataBufferDouble.java
@@ -49,8 +49,8 @@ package java.awt.image;
/**
* @since 1.4
*
- * @author <a href="mailto:rolfwr@ii.uib.no">Rolf W. Rasmussen</a>
- * @author <a href="mailto:brawer@dandelis.ch">Sascha Brawer</a>
+ * @author Rolf W. Rasmussen (rolfwr@ii.uib.no)
+ * @author Sascha Brawer (brawer@dandelis.ch)
*/
public final class DataBufferDouble
extends DataBuffer
diff --git a/libjava/java/awt/image/DataBufferFloat.java b/libjava/java/awt/image/DataBufferFloat.java
index 9673eddb458..6b47e2be005 100644
--- a/libjava/java/awt/image/DataBufferFloat.java
+++ b/libjava/java/awt/image/DataBufferFloat.java
@@ -47,8 +47,8 @@ package java.awt.image;
code is a maintenance nightmare. */
/**
- * @author <a href="mailto:rolfwr@ii.uib.no">Rolf W. Rasmussen</a>
- * @author <a href="mailto:brawer@dandelis.ch">Sascha Brawer</a>
+ * @author Rolf W. Rasmussen (rolfwr@ii.uib.no)
+ * @author Sascha Brawer (brawer@dandelis.ch)
*/
public final class DataBufferFloat
extends DataBuffer
diff --git a/libjava/java/awt/image/DataBufferInt.java b/libjava/java/awt/image/DataBufferInt.java
index c5f08530d2b..c90f9558811 100644
--- a/libjava/java/awt/image/DataBufferInt.java
+++ b/libjava/java/awt/image/DataBufferInt.java
@@ -47,7 +47,7 @@ package java.awt.image;
code is a maintenance nightmare. */
/**
- * @author Rolf W. Rasmussen <rolfwr@ii.uib.no>
+ * @author Rolf W. Rasmussen (rolfwr@ii.uib.no)
*/
public final class DataBufferInt extends DataBuffer
{
diff --git a/libjava/java/awt/image/DataBufferShort.java b/libjava/java/awt/image/DataBufferShort.java
index 7a095c4e38e..a8d8cb5ef64 100644
--- a/libjava/java/awt/image/DataBufferShort.java
+++ b/libjava/java/awt/image/DataBufferShort.java
@@ -48,7 +48,7 @@ package java.awt.image;
code is a maintenance nightmare. */
/**
- * @author Rolf W. Rasmussen <rolfwr@ii.uib.no>
+ * @author Rolf W. Rasmussen (rolfwr@ii.uib.no)
*/
public final class DataBufferShort extends DataBuffer
{
diff --git a/libjava/java/awt/image/DataBufferUShort.java b/libjava/java/awt/image/DataBufferUShort.java
index 6efe73d83ab..7466d857956 100644
--- a/libjava/java/awt/image/DataBufferUShort.java
+++ b/libjava/java/awt/image/DataBufferUShort.java
@@ -48,7 +48,7 @@ package java.awt.image;
code is a maintenance nightmare. */
/**
- * @author Rolf W. Rasmussen <rolfwr@ii.uib.no>
+ * @author Rolf W. Rasmussen (rolfwr@ii.uib.no)
*/
public final class DataBufferUShort extends DataBuffer
{
diff --git a/libjava/java/awt/image/ImagingOpException.java b/libjava/java/awt/image/ImagingOpException.java
index 51bf02b281c..0018dc47cc3 100644
--- a/libjava/java/awt/image/ImagingOpException.java
+++ b/libjava/java/awt/image/ImagingOpException.java
@@ -1,5 +1,5 @@
/* ImagingOpException.java -- indicates an imaging filter failure
- Copyright (C) 2002, 2003 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2003, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -42,7 +42,7 @@ package java.awt.image;
* This exception is thrown when <code>BufferedImageOp</code> or
* <code>RasterOp</code> filters cannot process an image.
*
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Eric Blake (ebb9@email.byu.edu)
* @see BufferedImageOp
* @see RasterOp
* @status updated to 1.4
diff --git a/libjava/java/awt/image/IndexColorModel.java b/libjava/java/awt/image/IndexColorModel.java
index 6791589032e..e4ccc542903 100644
--- a/libjava/java/awt/image/IndexColorModel.java
+++ b/libjava/java/awt/image/IndexColorModel.java
@@ -125,7 +125,9 @@ public class IndexColorModel extends ColorModel
public IndexColorModel(int bits, int size, byte[] reds, byte[] greens,
byte[] blues, byte[] alphas)
{
- super (bits);
+ // FIXME: This super() constructor should not be used since it can give
+ // the wrong value for hasAlpha() which is final and cannot be overloaded
+ super(bits);
map_size = size;
opaque = (alphas == null);
@@ -416,10 +418,10 @@ public class IndexColorModel extends ColorModel
*/
public final int getAlpha (int pixel)
{
- if (pixel < map_size)
- return (int) ((generateMask (3) & rgb[pixel]) >> (3 * pixel_bits));
-
- return 0;
+ if (opaque || pixel >= map_size)
+ return 255;
+
+ return (int) ((generateMask (3) & rgb[pixel]) >> (3 * pixel_bits));
}
/**
diff --git a/libjava/java/awt/image/Kernel.java b/libjava/java/awt/image/Kernel.java
index 4898f9ed82b..2bc82ee74c6 100644
--- a/libjava/java/awt/image/Kernel.java
+++ b/libjava/java/awt/image/Kernel.java
@@ -1,5 +1,5 @@
/* Kernel.java -- Java class for an image processing kernel
- Copyright (C) 2004 Free Software Foundation, Inc.
+ Copyright (C) 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -43,7 +43,7 @@ package java.awt.image;
* convolution filters among other purposes. It stores an array of float
* values representing a 2-dimensional array in row-major order.
*
- * @author <a href="mailto:jlquinn@optonline.net">Jerry Quinn</a>
+ * @author Jerry Quinn (jlquinn@optonline.net)
* @version 1.0
*/
public class Kernel implements Cloneable
diff --git a/libjava/java/awt/image/LookupTable.java b/libjava/java/awt/image/LookupTable.java
index eb89795c2c8..497cdb6e089 100644
--- a/libjava/java/awt/image/LookupTable.java
+++ b/libjava/java/awt/image/LookupTable.java
@@ -1,5 +1,5 @@
/* LookupTable.java -- Java class for a pixel translation table.
- Copyright (C) 2004 Free Software Foundation, Inc.
+ Copyright (C) 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -47,7 +47,7 @@ package java.awt.image;
* @see ByteLookupTable
* @see ShortLookupTable
*
- * @author <a href="mailto:jlquinn@optonline.net">Jerry Quinn</a>
+ * @author Jerry Quinn (jlquinn@optonline.net)
* @version 1.0
*/
public abstract class LookupTable
diff --git a/libjava/java/awt/image/MemoryImageSource.java b/libjava/java/awt/image/MemoryImageSource.java
index 07e42cf077d..6b43d00c37b 100644
--- a/libjava/java/awt/image/MemoryImageSource.java
+++ b/libjava/java/awt/image/MemoryImageSource.java
@@ -1,4 +1,4 @@
-/* MemoryImageSource.java -- Java class for providing image data
+/* MemoryImageSource.java -- Java class for providing image data
Copyright (C) 1999, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -41,335 +41,333 @@ package java.awt.image;
import java.util.Hashtable;
import java.util.Vector;
-public class MemoryImageSource implements ImageProducer
+public class MemoryImageSource implements ImageProducer
{
- private boolean animated = false;
- private boolean fullbuffers = false;
- private int pixeli[], width, height, offset, scansize;
- private byte pixelb[];
- private ColorModel cm;
- private Hashtable props = new Hashtable();
- private Vector consumers = new Vector();
-
- /**
- * Construct an image producer that reads image data from a byte
- * array.
- *
- * @param w width of image
- * @param h height of image
- * @param cm the color model used to represent pixel values
- * @param pix a byte array of pixel values
- * @param off the offset into the array at which the first pixel is stored
- * @param scan the number of array elements that represents a single pixel row
- */
- public MemoryImageSource(int w, int h, ColorModel cm,
- byte pix[], int off, int scan)
- {
- this ( w, h, cm, pix, off, scan, null );
- }
- /**
- Constructs an ImageProducer from memory
- */
- public MemoryImageSource( int w, int h, ColorModel cm,
- byte pix[], int off, int scan,
- Hashtable props)
- {
- width = w;
- height = h;
- this.cm = cm;
- offset = off;
- scansize = scan;
- this.props = props;
- int max = (( scansize > width ) ? scansize : width );
- pixelb = pix;
- }
- /**
- * Construct an image producer that reads image data from an
- * integer array.
- *
- * @param w width of image
- * @param h height of image
- * @param cm the color model used to represent pixel values
- * @param pix an integer array of pixel values
- * @param off the offset into the array at which the first pixel is stored
- * @param scan the number of array elements that represents a single pixel row
- */
- public MemoryImageSource(int w, int h, ColorModel cm,
- int pix[], int off, int scan)
- {
- this ( w, h, cm, pix, off, scan, null );
- }
-
- /**
- Constructs an ImageProducer from memory
- */
- public MemoryImageSource(int w, int h, ColorModel cm,
- int pix[], int off, int scan,
- Hashtable props)
- {
- width = w;
- height = h;
- this.cm = cm;
- offset = off;
- scansize = scan;
- this.props = props;
- int max = (( scansize > width ) ? scansize : width );
- pixeli = pix;
- }
- /**
- Constructs an ImageProducer from memory using the default RGB ColorModel
- */
- public MemoryImageSource(int w, int h,
- int pix[], int off, int scan,
- Hashtable props)
- {
- this ( w, h, ColorModel.getRGBdefault(), pix, off, scan, props);
- }
-
- /**
- Constructs an ImageProducer from memory using the default RGB ColorModel
- */
- public MemoryImageSource(int w, int h,
- int pix[], int off, int scan)
- {
- this ( w, h, ColorModel.getRGBdefault(), pix, off, scan, null);
- }
-
- /**
- * Used to register an <code>ImageConsumer</code> with this
- * <code>ImageProducer</code>.
- */
- public synchronized void addConsumer(ImageConsumer ic) {
- if (consumers.contains(ic))
- return;
-
- consumers.addElement(ic);
- }
-
- /**
- * Used to determine if the given <code>ImageConsumer</code> is
- * already registered with this <code>ImageProducer</code>.
- */
- public synchronized boolean isConsumer(ImageConsumer ic) {
- if (consumers.contains(ic))
- return true;
- return false;
- }
-
- /**
- * Used to remove an <code>ImageConsumer</code> from the list of
- * registered consumers for this <code>ImageProducer</code>.
- */
- public synchronized void removeConsumer(ImageConsumer ic) {
- consumers.removeElement(ic);
- }
-
- /**
- * Used to register an <code>ImageConsumer</code> with this
- * <code>ImageProducer</code> and then immediately start
- * reconstruction of the image data to be delivered to all
- * registered consumers.
- */
- public void startProduction(ImageConsumer ic) {
- if (!(consumers.contains(ic))) {
- consumers.addElement(ic);
- }
-
+ private boolean animated = false;
+ private boolean fullbuffers = false;
+ private int[] pixeli;
+ private int width;
+ private int height;
+ private int offset;
+ private int scansize;
+ private byte[] pixelb;
+ private ColorModel cm;
+ private Hashtable props = new Hashtable();
+ private Vector consumers = new Vector();
+
+ /**
+ * Construct an image producer that reads image data from a byte
+ * array.
+ *
+ * @param w width of image
+ * @param h height of image
+ * @param cm the color model used to represent pixel values
+ * @param pix a byte array of pixel values
+ * @param off the offset into the array at which the first pixel is stored
+ * @param scan the number of array elements that represents a single pixel row
+ */
+ public MemoryImageSource(int w, int h, ColorModel cm, byte[] pix, int off,
+ int scan)
+ {
+ this(w, h, cm, pix, off, scan, null);
+ }
+
+ /**
+ * Constructs an ImageProducer from memory
+ */
+ public MemoryImageSource(int w, int h, ColorModel cm, byte[] pix, int off,
+ int scan, Hashtable props)
+ {
+ width = w;
+ height = h;
+ this.cm = cm;
+ offset = off;
+ scansize = scan;
+ this.props = props;
+ int max = ((scansize > width) ? scansize : width);
+ pixelb = pix;
+ }
+
+ /**
+ * Construct an image producer that reads image data from an
+ * integer array.
+ *
+ * @param w width of image
+ * @param h height of image
+ * @param cm the color model used to represent pixel values
+ * @param pix an integer array of pixel values
+ * @param off the offset into the array at which the first pixel is stored
+ * @param scan the number of array elements that represents a single pixel row
+ */
+ public MemoryImageSource(int w, int h, ColorModel cm, int[] pix, int off,
+ int scan)
+ {
+ this(w, h, cm, pix, off, scan, null);
+ }
+
+ /**
+ Constructs an ImageProducer from memory
+ */
+ public MemoryImageSource(int w, int h, ColorModel cm, int[] pix, int off,
+ int scan, Hashtable props)
+ {
+ width = w;
+ height = h;
+ this.cm = cm;
+ offset = off;
+ scansize = scan;
+ this.props = props;
+ int max = ((scansize > width) ? scansize : width);
+ pixeli = pix;
+ }
+
+ /**
+ * Constructs an ImageProducer from memory using the default RGB ColorModel
+ */
+ public MemoryImageSource(int w, int h, int[] pix, int off, int scan,
+ Hashtable props)
+ {
+ this(w, h, ColorModel.getRGBdefault(), pix, off, scan, props);
+ }
+
+ /**
+ * Constructs an ImageProducer from memory using the default RGB ColorModel
+ */
+ public MemoryImageSource(int w, int h, int[] pix, int off, int scan)
+ {
+ this(w, h, ColorModel.getRGBdefault(), pix, off, scan, null);
+ }
+
+ /**
+ * Used to register an <code>ImageConsumer</code> with this
+ * <code>ImageProducer</code>.
+ */
+ public synchronized void addConsumer(ImageConsumer ic)
+ {
+ if (consumers.contains(ic))
+ return;
+
+ consumers.addElement(ic);
+ }
+
+ /**
+ * Used to determine if the given <code>ImageConsumer</code> is
+ * already registered with this <code>ImageProducer</code>.
+ */
+ public synchronized boolean isConsumer(ImageConsumer ic)
+ {
+ if (consumers.contains(ic))
+ return true;
+ return false;
+ }
+
+ /**
+ * Used to remove an <code>ImageConsumer</code> from the list of
+ * registered consumers for this <code>ImageProducer</code>.
+ */
+ public synchronized void removeConsumer(ImageConsumer ic)
+ {
+ consumers.removeElement(ic);
+ }
+
+ /**
+ * Used to register an <code>ImageConsumer</code> with this
+ * <code>ImageProducer</code> and then immediately start
+ * reconstruction of the image data to be delivered to all
+ * registered consumers.
+ */
+ public void startProduction(ImageConsumer ic)
+ {
+ if (! (consumers.contains(ic)))
+ consumers.addElement(ic);
+
+ Vector list = (Vector) consumers.clone();
+ for (int i = 0; i < list.size(); i++)
+ {
+ ic = (ImageConsumer) list.elementAt(i);
+ sendPicture(ic);
+ if (animated)
+ ic.imageComplete(ImageConsumer.SINGLEFRAME);
+ else
+ ic.imageComplete(ImageConsumer.STATICIMAGEDONE);
+ }
+ }
+
+ /**
+ * Used to register an <code>ImageConsumer</code> with this
+ * <code>ImageProducer</code> and then request that this producer
+ * resend the image data in the order top-down, left-right.
+ */
+ public void requestTopDownLeftRightResend(ImageConsumer ic)
+ {
+ startProduction(ic);
+ }
+
+ /**
+ * Changes a flag to indicate whether this MemoryImageSource supports
+ * animations.
+ *
+ * @param animated A flag indicating whether this class supports animations
+ */
+ public synchronized void setAnimated(boolean animated)
+ {
+ this.animated = animated;
+ }
+
+ /**
+ * A flag to indicate whether or not to send full buffer updates when
+ * sending animation. If this flag is set then full buffers are sent
+ * in the newPixels methods instead of just regions.
+ *
+ * @param fullbuffers - a flag indicating whether to send the full buffers
+ */
+ public synchronized void setFullBufferUpdates(boolean fullbuffers)
+ {
+ this.fullbuffers = fullbuffers;
+ }
+
+ /**
+ * Send an animation frame to the image consumers.
+ */
+ public void newPixels()
+ {
+ if (animated == true)
+ {
+ ImageConsumer ic;
Vector list = (Vector) consumers.clone();
- for(int i = 0; i < list.size(); i++) {
+ for (int i = 0; i < list.size(); i++)
+ {
ic = (ImageConsumer) list.elementAt(i);
- sendPicture( ic );
- if (animated)
- ic.imageComplete( ImageConsumer.SINGLEFRAME );
- else
- ic.imageComplete( ImageConsumer.STATICIMAGEDONE );
- }
- }
-
- /**
- * Used to register an <code>ImageConsumer</code> with this
- * <code>ImageProducer</code> and then request that this producer
- * resend the image data in the order top-down, left-right.
- */
- public void requestTopDownLeftRightResend(ImageConsumer ic) {
- startProduction ( ic );
- }
-
-
- /**
- Changes a flag to indicate whether this MemoryImageSource supports
- animations.
-
- @param animated A flag indicating whether this class supports animations
- */
- public synchronized void setAnimated(boolean animated)
- {
- this.animated = animated;
- }
-
-
- /**
- A flag to indicate whether or not to send full buffer updates when
- sending animation. If this flag is set then full buffers are sent
- in the newPixels methods instead of just regions.
-
- @param fullbuffers - a flag indicating whether to send the full buffers
- */
- public synchronized void setFullBufferUpdates(boolean fullbuffers)
- {
- this.fullbuffers = fullbuffers;
- }
-
- /**
- Send an animation frame to the image consumers.
- */
- public void newPixels()
- {
- if( animated == true ) {
- ImageConsumer ic;
- Vector list = (Vector) consumers.clone();
- for(int i = 0; i < list.size(); i++) {
- ic = (ImageConsumer) list.elementAt(i);
- sendPicture( ic );
- ic.imageComplete( ImageConsumer.SINGLEFRAME );
- }
- }
- }
-
-
- private void sendPicture ( ImageConsumer ic )
- {
- ic.setHints( ImageConsumer.TOPDOWNLEFTRIGHT );
- if( props != null ) {
- ic.setProperties( props );
- }
- ic.setDimensions(width, height);
- ic.setColorModel(cm);
- if( pixeli != null ) {
- ic.setPixels( 0, 0, width, height, cm, pixeli, offset, scansize );
- } else {
- ic.setPixels( 0, 0, width, height, cm, pixelb, offset, scansize );
- }
- }
-
- /**
- Send an animation frame to the image consumers containing the specified
- pixels unless setFullBufferUpdates is set.
- */
- public synchronized void newPixels(int x,
- int y,
- int w,
- int h)
- {
- if( animated == true )
- {
- if( fullbuffers ) {
- newPixels();
- } else {
- ImageConsumer ic;
- Vector list = (Vector) consumers.clone();
- for(int i = 0; i < list.size(); i++) {
- ic = (ImageConsumer) list.elementAt(i);
- ic.setHints( ImageConsumer.TOPDOWNLEFTRIGHT );
- if( props != null ) {
- ic.setProperties( props );
- }
- if( pixeli != null ) {
- int[] pixelbuf = new int[w * h];
- for (int row = y; row < y + h; row++)
- System.arraycopy(pixeli, row * scansize + x + offset, pixelbuf, 0, w * h);
- ic.setPixels( x, y, w, h, cm, pixelbuf, 0, w );
- } else {
- byte[] pixelbuf = new byte[w * h];
- for (int row = y; row < y + h; row++)
- System.arraycopy(pixelb, row * scansize + x + offset, pixelbuf, 0, w * h);
-
- ic.setPixels( x, y, w, h, cm, pixelbuf, 0, w );
- }
- ic.imageComplete( ImageConsumer.SINGLEFRAME );
- }
- }
- }
- }
-
-
-
- /**
- Send an animation frame to the image consumers containing the specified
- pixels unless setFullBufferUpdates is set.
-
- If framenotify is set then a notification is sent when the frame
- is sent otherwise no status is sent.
- */
- public synchronized void newPixels(int x,
- int y,
- int w,
- int h,
- boolean framenotify)
- {
- if( animated == true )
- {
- if( fullbuffers ) {
- newPixels();
- } else {
- ImageConsumer ic;
- Vector list = (Vector) consumers.clone();
- for(int i = 0; i < list.size(); i++) {
- ic = (ImageConsumer) list.elementAt(i);
- ic.setHints( ImageConsumer.TOPDOWNLEFTRIGHT );
- if( props != null ) {
- ic.setProperties( props );
- }
- if( pixeli != null ) {
- int[] pixelbuf = new int[w * h];
- for (int row = y; row < y + h; row++)
- System.arraycopy(pixeli, row * scansize + x + offset, pixelbuf, 0, w * h);
- ic.setPixels( x, y, w, h, cm, pixelbuf, 0, w );
- } else {
- byte[] pixelbuf = new byte[w * h];
- for (int row = y; row < y + h; row++)
- System.arraycopy(pixelb, row * scansize + x + offset, pixelbuf, 0, w * h);
- ic.setPixels( x, y, w, h, cm, pixelbuf, 0, w );
- }
- if( framenotify == true )
- ic.imageComplete( ImageConsumer.SINGLEFRAME );
- }
- }
- }
- }
-
- public synchronized void newPixels(byte newpix[],
- ColorModel newmodel,
- int offset,
- int scansize)
-
- {
- pixeli = null;
- pixelb = newpix;
- cm = newmodel;
- this.offset = offset;
- this.scansize = scansize;
- if( animated == true )
- {
- newPixels();
- }
- }
-
- public synchronized void newPixels(int newpix[],
- ColorModel newmodel,
- int offset,
- int scansize)
-
- {
- pixelb = null;
- pixeli = newpix;
- cm = newmodel;
- this.offset = offset;
- this.scansize = scansize;
- if( animated == true )
- {
- newPixels();
- }
- }
-
+ sendPicture(ic);
+ ic.imageComplete(ImageConsumer.SINGLEFRAME);
+ }
+ }
+ }
+
+ private void sendPicture(ImageConsumer ic)
+ {
+ ic.setHints(ImageConsumer.TOPDOWNLEFTRIGHT);
+ if (props != null)
+ ic.setProperties(props);
+ ic.setDimensions(width, height);
+ ic.setColorModel(cm);
+ if (pixeli != null)
+ ic.setPixels(0, 0, width, height, cm, pixeli, offset, scansize);
+ else
+ ic.setPixels(0, 0, width, height, cm, pixelb, offset, scansize);
+ }
+
+ /**
+ * Send an animation frame to the image consumers containing the specified
+ * pixels unless setFullBufferUpdates is set.
+ */
+ public synchronized void newPixels(int x, int y, int w, int h)
+ {
+ if (animated == true)
+ {
+ if (fullbuffers)
+ newPixels();
+ else
+ {
+ ImageConsumer ic;
+ Vector list = (Vector) consumers.clone();
+ for (int i = 0; i < list.size(); i++)
+ {
+ ic = (ImageConsumer) list.elementAt(i);
+ ic.setHints(ImageConsumer.TOPDOWNLEFTRIGHT);
+ if (props != null)
+ ic.setProperties(props);
+ if (pixeli != null)
+ {
+ int[] pixelbuf = new int[w * h];
+ for (int row = y; row < y + h; row++)
+ System.arraycopy(pixeli, row * scansize + x + offset,
+ pixelbuf, 0, w * h);
+ ic.setPixels(x, y, w, h, cm, pixelbuf, 0, w);
+ }
+ else
+ {
+ byte[] pixelbuf = new byte[w * h];
+ for (int row = y; row < y + h; row++)
+ System.arraycopy(pixelb, row * scansize + x + offset,
+ pixelbuf, 0, w * h);
+
+ ic.setPixels(x, y, w, h, cm, pixelbuf, 0, w);
+ }
+ ic.imageComplete(ImageConsumer.SINGLEFRAME);
+ }
+ }
+ }
+ }
+
+ /**
+ * Send an animation frame to the image consumers containing the specified
+ * pixels unless setFullBufferUpdates is set.
+ *
+ * If framenotify is set then a notification is sent when the frame
+ * is sent otherwise no status is sent.
+ */
+ public synchronized void newPixels(int x, int y, int w, int h,
+ boolean framenotify)
+ {
+ if (animated == true)
+ {
+ if (fullbuffers)
+ newPixels();
+ else
+ {
+ ImageConsumer ic;
+ Vector list = (Vector) consumers.clone();
+ for (int i = 0; i < list.size(); i++)
+ {
+ ic = (ImageConsumer) list.elementAt(i);
+ ic.setHints(ImageConsumer.TOPDOWNLEFTRIGHT);
+ if (props != null)
+ ic.setProperties(props);
+ if (pixeli != null)
+ {
+ int[] pixelbuf = new int[w * h];
+ for (int row = y; row < y + h; row++)
+ System.arraycopy(pixeli, row * scansize + x + offset,
+ pixelbuf, 0, w * h);
+ ic.setPixels(x, y, w, h, cm, pixelbuf, 0, w);
+ }
+ else
+ {
+ byte[] pixelbuf = new byte[w * h];
+ for (int row = y; row < y + h; row++)
+ System.arraycopy(pixelb, row * scansize + x + offset,
+ pixelbuf, 0, w * h);
+ ic.setPixels(x, y, w, h, cm, pixelbuf, 0, w);
+ }
+ if (framenotify == true)
+ ic.imageComplete(ImageConsumer.SINGLEFRAME);
+ }
+ }
+ }
+ }
+
+ public synchronized void newPixels(byte[] newpix, ColorModel newmodel,
+ int offset, int scansize)
+ {
+ pixeli = null;
+ pixelb = newpix;
+ cm = newmodel;
+ this.offset = offset;
+ this.scansize = scansize;
+ if (animated == true)
+ newPixels();
+ }
+
+ public synchronized void newPixels(int[] newpix, ColorModel newmodel,
+ int offset, int scansize)
+ {
+ pixelb = null;
+ pixeli = newpix;
+ cm = newmodel;
+ this.offset = offset;
+ this.scansize = scansize;
+ if (animated == true)
+ newPixels();
+ }
}
diff --git a/libjava/java/awt/image/MultiPixelPackedSampleModel.java b/libjava/java/awt/image/MultiPixelPackedSampleModel.java
index 0525d37bd42..ab971c0e675 100644
--- a/libjava/java/awt/image/MultiPixelPackedSampleModel.java
+++ b/libjava/java/awt/image/MultiPixelPackedSampleModel.java
@@ -43,7 +43,7 @@ import gnu.java.awt.Buffers;
* multiple pixels in a single unit. Pixels have 2^n bits and 2^k pixels fit
* per data element.
*
- * @author Jerry Quinn <jlquinn@optonline.net>
+ * @author Jerry Quinn (jlquinn@optonline.net)
*/
public class MultiPixelPackedSampleModel extends SampleModel
{
@@ -59,7 +59,7 @@ public class MultiPixelPackedSampleModel extends SampleModel
public MultiPixelPackedSampleModel(int dataType, int w, int h,
int numberOfBits)
{
- this(dataType, w, h, 0, numberOfBits, 0);
+ this(dataType, w, h, numberOfBits, 0, 0);
}
public MultiPixelPackedSampleModel(int dataType, int w, int h,
@@ -101,7 +101,7 @@ public class MultiPixelPackedSampleModel extends SampleModel
// Compute scan line large enough for w pixels.
if (scanlineStride == 0)
- scanlineStride = ((dataBitOffset + w * numberOfBits) / elemBits) + 1;
+ scanlineStride = ((dataBitOffset + w * numberOfBits) / elemBits);
this.scanlineStride = scanlineStride;
@@ -112,8 +112,9 @@ public class MultiPixelPackedSampleModel extends SampleModel
bitOffsets = new int[numElems];
for (int i=0; i < numElems; i++)
{
- bitOffsets[i] = numberOfBits * i;
- bitMasks[i] = ((1 << numberOfBits) - 1) << bitOffsets[i];
+ bitOffsets[numElems - i- 1] = numberOfBits * i;
+ bitMasks[numElems - i - 1] = ((1 << numberOfBits) - 1) <<
+ bitOffsets[numElems - i - 1];
}
}
diff --git a/libjava/java/awt/image/PackedColorModel.java b/libjava/java/awt/image/PackedColorModel.java
index 1f18cf68eb1..457dded93db 100644
--- a/libjava/java/awt/image/PackedColorModel.java
+++ b/libjava/java/awt/image/PackedColorModel.java
@@ -43,7 +43,7 @@ import java.awt.Point;
import java.awt.color.ColorSpace;
/**
- * @author Rolf W. Rasmussen <rolfwr@ii.uib.no>
+ * @author Rolf W. Rasmussen (rolfwr@ii.uib.no)
*/
public abstract class PackedColorModel extends ColorModel
{
diff --git a/libjava/java/awt/image/PixelInterleavedSampleModel.java b/libjava/java/awt/image/PixelInterleavedSampleModel.java
index d17a68d9ae3..1c0408cd15b 100644
--- a/libjava/java/awt/image/PixelInterleavedSampleModel.java
+++ b/libjava/java/awt/image/PixelInterleavedSampleModel.java
@@ -1,5 +1,5 @@
/* PixelInterleavedSampleModel.java
- Copyright (C) 2004 Free Software Foundation, Inc.
+ Copyright (C) 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -45,7 +45,7 @@ package java.awt.image;
*
* @since 1.2
*
- * @author <a href="mailto:brawer@dandelis.ch">Sascha Brawer</a>
+ * @author Sascha Brawer (brawer@dandelis.ch)
*/
public class PixelInterleavedSampleModel
extends ComponentSampleModel
diff --git a/libjava/java/awt/image/RGBImageFilter.java b/libjava/java/awt/image/RGBImageFilter.java
index 0fd977eab67..ca88d70e360 100644
--- a/libjava/java/awt/image/RGBImageFilter.java
+++ b/libjava/java/awt/image/RGBImageFilter.java
@@ -1,5 +1,5 @@
/* RGBImageFilter.java -- Java class for filtering Pixels by RGB values
- Copyright (C) 1999 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -42,7 +42,7 @@ package java.awt.image;
* A filter designed to filter images in the default RGBColorModel regardless of
* the ImageProducer's ColorModel.
*
- * @author Mark Benvenuto <mcb54@columbia.edu>
+ * @author Mark Benvenuto (mcb54@columbia.edu)
*/
public abstract class RGBImageFilter extends ImageFilter
{
@@ -83,7 +83,7 @@ public abstract class RGBImageFilter extends ImageFilter
}
else {
consumer.setColorModel(ColorModel.getRGBdefault());
- }
+ }
}
/**
diff --git a/libjava/java/awt/image/Raster.java b/libjava/java/awt/image/Raster.java
index 0fad4ba0acb..c3cb07fb219 100644
--- a/libjava/java/awt/image/Raster.java
+++ b/libjava/java/awt/image/Raster.java
@@ -41,7 +41,7 @@ import java.awt.Point;
import java.awt.Rectangle;
/**
- * @author Rolf W. Rasmussen <rolfwr@ii.uib.no>
+ * @author Rolf W. Rasmussen (rolfwr@ii.uib.no)
*/
public class Raster
{
diff --git a/libjava/java/awt/image/RasterFormatException.java b/libjava/java/awt/image/RasterFormatException.java
index 3a29877476b..4cfc5b5dc88 100644
--- a/libjava/java/awt/image/RasterFormatException.java
+++ b/libjava/java/awt/image/RasterFormatException.java
@@ -1,5 +1,5 @@
/* RasterFormatException.java -- indicates invalid layout in Raster
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -42,7 +42,7 @@ package java.awt.image;
* This exception is thrown when there is invalid layout information in
* <code>Raster</code>
*
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Eric Blake (ebb9@email.byu.edu)
* @see Raster
* @status updated to 1.4
*/
diff --git a/libjava/java/awt/image/ReplicateScaleFilter.java b/libjava/java/awt/image/ReplicateScaleFilter.java
index a572da7c3bd..091909d5bea 100644
--- a/libjava/java/awt/image/ReplicateScaleFilter.java
+++ b/libjava/java/awt/image/ReplicateScaleFilter.java
@@ -201,10 +201,10 @@ public class ReplicateScaleFilter extends ImageFilter
model, destPixels, 0, destScansize);
}
- protected byte[] replicatePixels(int srcx, int srcy, int srcw, int srch,
- ColorModel model, byte[] srcPixels,
- int srcOffset, int srcScansize,
- double rx, double ry, int destScansize)
+ private byte[] replicatePixels(int srcx, int srcy, int srcw, int srch,
+ ColorModel model, byte[] srcPixels,
+ int srcOffset, int srcScansize,
+ double rx, double ry, int destScansize)
{
byte[] destPixels =
new byte[(int) Math.ceil(srcw/rx) * (int) Math.ceil(srch/ry)];
@@ -221,10 +221,10 @@ public class ReplicateScaleFilter extends ImageFilter
return destPixels;
}
- protected int[] replicatePixels(int srcx, int srcy, int srcw, int srch,
- ColorModel model, int[] srcPixels,
- int srcOffset, int srcScansize,
- double rx, double ry, int destScansize)
+ private int[] replicatePixels(int srcx, int srcy, int srcw, int srch,
+ ColorModel model, int[] srcPixels,
+ int srcOffset, int srcScansize,
+ double rx, double ry, int destScansize)
{
int[] destPixels =
new int[(int) Math.ceil(srcw/rx) * (int) Math.ceil(srch/ry)];
diff --git a/libjava/java/awt/image/SampleModel.java b/libjava/java/awt/image/SampleModel.java
index 4e3b38b9922..b0d12c0ead0 100644
--- a/libjava/java/awt/image/SampleModel.java
+++ b/libjava/java/awt/image/SampleModel.java
@@ -37,7 +37,7 @@ exception statement from your version. */
package java.awt.image;
/**
- * @author Rolf W. Rasmussen <rolfwr@ii.uib.no>
+ * @author Rolf W. Rasmussen (rolfwr@ii.uib.no)
*/
public abstract class SampleModel
{
diff --git a/libjava/java/awt/image/ShortLookupTable.java b/libjava/java/awt/image/ShortLookupTable.java
index 36beb1df540..c57abeba795 100644
--- a/libjava/java/awt/image/ShortLookupTable.java
+++ b/libjava/java/awt/image/ShortLookupTable.java
@@ -1,5 +1,5 @@
/* ShortLookupTable.java -- Java class for a pixel translation table.
- Copyright (C) 2004 Free Software Foundation, Inc.
+ Copyright (C) 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -44,7 +44,7 @@ package java.awt.image;
* Alpha, R, G, and B. When doing translation, the offset is subtracted from
* the pixel values to allow a subset of an array to be used.
*
- * @author <a href="mailto:jlquinn@optonline.net">Jerry Quinn</a>
+ * @author Jerry Quinn (jlquinn@optonline.net)
* @version 1.0
*/
public class ShortLookupTable extends LookupTable
diff --git a/libjava/java/awt/image/SinglePixelPackedSampleModel.java b/libjava/java/awt/image/SinglePixelPackedSampleModel.java
index 94a9537318e..32789fc6350 100644
--- a/libjava/java/awt/image/SinglePixelPackedSampleModel.java
+++ b/libjava/java/awt/image/SinglePixelPackedSampleModel.java
@@ -40,7 +40,7 @@ import gnu.java.awt.BitMaskExtent;
import gnu.java.awt.Buffers;
/**
- * @author Rolf W. Rasmussen <rolfwr@ii.uib.no>
+ * @author Rolf W. Rasmussen (rolfwr@ii.uib.no)
*/
public class SinglePixelPackedSampleModel extends SampleModel
{
diff --git a/libjava/java/awt/image/WritableRaster.java b/libjava/java/awt/image/WritableRaster.java
index f735001e915..de3648af5f3 100644
--- a/libjava/java/awt/image/WritableRaster.java
+++ b/libjava/java/awt/image/WritableRaster.java
@@ -41,7 +41,7 @@ import java.awt.Point;
import java.awt.Rectangle;
/**
- * @author Rolf W. Rasmussen <rolfwr@ii.uib.no>
+ * @author Rolf W. Rasmussen (rolfwr@ii.uib.no)
*/
public class WritableRaster extends Raster
{
diff --git a/libjava/java/awt/peer/RobotPeer.java b/libjava/java/awt/peer/RobotPeer.java
index 2daa14d5e11..a187fc0217d 100644
--- a/libjava/java/awt/peer/RobotPeer.java
+++ b/libjava/java/awt/peer/RobotPeer.java
@@ -43,12 +43,12 @@ import java.awt.Rectangle;
public interface RobotPeer
{
void mouseMove (int x, int y);
- void mousePress (int x);
- void mouseRelease (int x);
- void mouseWheel (int x);
- void keyPress (int x);
- void keyRelease (int x);
+ void mousePress (int buttons);
+ void mouseRelease (int buttons);
+ void mouseWheel (int wheelAmt);
+ void keyPress (int keycode);
+ void keyRelease (int keycode);
int getRGBPixel (int x, int y);
- int[] getRGBPixels (Rectangle r);
+ int[] getRGBPixels (Rectangle screen);
} // interface RobotPeer
diff --git a/libjava/java/awt/print/Book.java b/libjava/java/awt/print/Book.java
index 9bdd7d6fd34..41f360beca0 100644
--- a/libjava/java/awt/print/Book.java
+++ b/libjava/java/awt/print/Book.java
@@ -1,5 +1,5 @@
/* Book.java -- A mixed group of pages to print.
- Copyright (C) 1999 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -41,146 +41,119 @@ package java.awt.print;
import java.util.Vector;
/**
- * This class allows documents to be created with different paper types,
- * page formatters, and painters.
- *
- * @author Aaron M. Renn (arenn@urbanophile.com)
- */
-public class Book implements Pageable
-{
-
-/*
- * Instance Variables
- */
-
-// Painter objects for the book
-Vector printables = new Vector();
-
-// Page formats for the book
-Vector page_formats = new Vector();
-
-/*************************************************************************/
-
-/*
- * Constructors
+ * This class allows documents to be created with different paper types,
+ * page formatters, and painters.
+ *
+ * @author Aaron M. Renn (arenn@urbanophile.com)
*/
-
-/**
- * Initializes a new instance of <code>Book</code> that is empty.
- */
-public
-Book()
-{
- ;
-}
-
-/*************************************************************************/
-
-/**
- * Returns the number of pages in this book.
- *
- * @return The number of pages in this book.
- */
-public int
-getNumberOfPages()
-{
- return(printables.size());
-}
-
-/*************************************************************************/
-
-/**
- * This method returns the <code>PageFormat</code> object for the
- * specified page.
- *
- * @param page_number The number of the page to get information for, where
- * page numbers start at 0.
- *
- * @return The <code>PageFormat</code> object for the specified page.
- *
- * @exception IndexOutOfBoundsException If the page number is not valid.
- */
-public PageFormat
-getPageFormat(int page_number)
-{
- return((PageFormat)page_formats.elementAt(page_number));
-}
-
-/*************************************************************************/
-
-/**
- * This method returns the <code>Printable</code> object for the
- * specified page.
- *
- * @param page_number The number of the page to get information for, where
- * page numbers start at 0.
- *
- * @return The <code>Printable</code> object for the specified page.
- *
- * @exception IndexOutOfBoundsException If the page number is not valid.
- */
-public Printable
-getPrintable(int page_number)
-{
- return((Printable)printables.elementAt(page_number));
-}
-
-/*************************************************************************/
-
-/**
- * This method appends a page to the end of the book.
- *
- * @param printable The <code>Printable</code> for this page.
- * @param page_format The <code>PageFormat</code> for this page.
- *
- * @exception NullPointerException If either argument is <code>null</code>.
- */
-public void
-append(Printable printable, PageFormat page_format)
-{
- append(printable, page_format, 1);
-}
-
-/*************************************************************************/
-
-/**
- * This method appends the specified number of pages to the end of the book.
- * Each one will be associated with the specified <code>Printable</code>
- * and <code>PageFormat</code>.
- *
- * @param printable The <code>Printable</code> for this page.
- * @param page_format The <code>PageFormat</code> for this page.
- * @param num_pages The number of pages to append.
- *
- * @exception NullPointerException If any argument is <code>null</code>.
- */
-public void
-append(Printable printable, PageFormat page_format, int num_pages)
-{
- for (int i = 0; i < num_pages; i++)
- {
- printables.addElement(printable);
- page_formats.addElement(page_format);
- }
-}
-
-/*************************************************************************/
-
-/**
- * This method changes the <code>Printable</code> and <code>PageFormat</code>
- * for the specified page. The page must already exist or an exception
- * will be thrown.
- *
- * @param page_num The page number to alter.
- * @param printable The new <code>Printable</code> for the page.
- * @param page_format The new <code>PageFormat</code> for the page.
- *
- * @throws IndexOutOfBoundsException If the specified page does not exist.
- */
-public void
-setPage(int page_num, Printable printable, PageFormat page_format)
+public class Book implements Pageable
{
- printables.setElementAt(printable, page_num);
- page_formats.setElementAt(page_format, page_num);
-}
+ /**
+ * Painter objects for the book.
+ */
+ Vector printables = new Vector();
+
+ /**
+ * Page formats for the book.
+ */
+ Vector page_formats = new Vector();
+
+ /**
+ * Initializes a new instance of <code>Book</code> that is empty.
+ */
+ public Book()
+ {
+ }
+
+ /**
+ * Returns the number of pages in this book.
+ *
+ * @return The number of pages in this book.
+ */
+ public int getNumberOfPages()
+ {
+ return printables.size();
+ }
+
+ /**
+ * This method returns the <code>PageFormat</code> object for the
+ * specified page.
+ *
+ * @param page_number The number of the page to get information for, where
+ * page numbers start at 0.
+ *
+ * @return The <code>PageFormat</code> object for the specified page.
+ *
+ * @exception IndexOutOfBoundsException If the page number is not valid.
+ */
+ public PageFormat getPageFormat(int page_number)
+ {
+ return (PageFormat) page_formats.elementAt(page_number);
+ }
+
+ /**
+ * This method returns the <code>Printable</code> object for the
+ * specified page.
+ *
+ * @param page_number The number of the page to get information for, where
+ * page numbers start at 0.
+ *
+ * @return The <code>Printable</code> object for the specified page.
+ *
+ * @exception IndexOutOfBoundsException If the page number is not valid.
+ */
+ public Printable getPrintable(int page_number)
+ {
+ return (Printable) printables.elementAt(page_number);
+ }
+
+ /**
+ * This method appends a page to the end of the book.
+ *
+ * @param printable The <code>Printable</code> for this page.
+ * @param page_format The <code>PageFormat</code> for this page.
+ *
+ * @exception NullPointerException If either argument is <code>null</code>.
+ */
+ public void append(Printable printable, PageFormat page_format)
+ {
+ append(printable, page_format, 1);
+ }
+
+ /**
+ * This method appends the specified number of pages to the end of the book.
+ * Each one will be associated with the specified <code>Printable</code>
+ * and <code>PageFormat</code>.
+ *
+ * @param printable The <code>Printable</code> for this page.
+ * @param page_format The <code>PageFormat</code> for this page.
+ * @param num_pages The number of pages to append.
+ *
+ * @exception NullPointerException If any argument is <code>null</code>.
+ */
+ public void append(Printable printable, PageFormat page_format, int num_pages)
+ {
+ for (int i = 0; i < num_pages; i++)
+ {
+ printables.addElement(printable);
+ page_formats.addElement(page_format);
+ }
+ }
+
+ /**
+ * This method changes the <code>Printable</code> and <code>PageFormat</code>
+ * for the specified page. The page must already exist or an exception
+ * will be thrown.
+ *
+ * @param page_num The page number to alter.
+ * @param printable The new <code>Printable</code> for the page.
+ * @param page_format The new <code>PageFormat</code> for the page.
+ *
+ * @throws IndexOutOfBoundsException If the specified page does not exist.
+ */
+ public void setPage(int page_num, Printable printable, PageFormat page_format)
+ {
+ printables.setElementAt(printable, page_num);
+ page_formats.setElementAt(page_format, page_num);
+ }
}
diff --git a/libjava/java/awt/print/PrinterAbortException.java b/libjava/java/awt/print/PrinterAbortException.java
index 133fdfe116d..5507a4f6ef8 100644
--- a/libjava/java/awt/print/PrinterAbortException.java
+++ b/libjava/java/awt/print/PrinterAbortException.java
@@ -1,5 +1,5 @@
/* PrinterAbortException.java -- Indicates the print job was aborted
- Copyright (C) 1999, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -42,7 +42,7 @@ package java.awt.print;
* This exception is thrown when the print job is aborted, either by the
* user or by the application.
*
- * @author Aaron M. Renn <arenn@urbanophile.com>
+ * @author Aaron M. Renn (arenn@urbanophile.com)
* @status updated to 1.4
*/
public class PrinterAbortException extends PrinterException
diff --git a/libjava/java/awt/print/PrinterException.java b/libjava/java/awt/print/PrinterException.java
index 9476d935674..e27fdbff4ab 100644
--- a/libjava/java/awt/print/PrinterException.java
+++ b/libjava/java/awt/print/PrinterException.java
@@ -1,5 +1,5 @@
/* PrinterException.java -- generic problem in the printing subsystem
- Copyright (C) 1999, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -42,7 +42,7 @@ package java.awt.print;
* This is the generic toplevel exception for printing errors. Subclasses
* provide more detailed descriptions of the problem.
*
- * @author Aaron M. Renn <arenn@urbanophile.com>
+ * @author Aaron M. Renn (arenn@urbanophile.com)
* @status updated to 1.4
*/
public class PrinterException extends Exception
diff --git a/libjava/java/awt/print/PrinterIOException.java b/libjava/java/awt/print/PrinterIOException.java
index 31f6381dc0d..e64ff4e6f7b 100644
--- a/libjava/java/awt/print/PrinterIOException.java
+++ b/libjava/java/awt/print/PrinterIOException.java
@@ -1,5 +1,5 @@
/* PrinterIOException.java -- The print job encountered an I/O error
- Copyright (C) 1999, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -44,8 +44,8 @@ import java.io.IOException;
* This exception is thrown when the print job encounters an I/O problem
* of some kind.
*
- * @author Aaron M. Renn <arenn@urbanophile.com>
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Aaron M. Renn (arenn@urbanophile.com)
+ * @author Eric Blake (ebb9@email.byu.edu)
* @status updated to 1.4
*/
public class PrinterIOException extends PrinterException
diff --git a/libjava/java/awt/print/PrinterJob.java b/libjava/java/awt/print/PrinterJob.java
index 8998aa0ff89..bc5cfcd5a1b 100644
--- a/libjava/java/awt/print/PrinterJob.java
+++ b/libjava/java/awt/print/PrinterJob.java
@@ -1,5 +1,5 @@
/* PrinterJob.java -- This job is the printer control class
- Copyright (C) 1999, 2004 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,10 +38,9 @@ exception statement from your version. */
package java.awt.print;
-import javax.print.DocFlavor;
+import java.awt.HeadlessException;
+
import javax.print.PrintService;
-import javax.print.PrintServiceLookup;
-//import javax.print.StreamPrintServiceFactory;
import javax.print.attribute.PrintRequestAttributeSet;
/**
@@ -61,7 +60,7 @@ public abstract class PrinterJob
*/
public static PrinterJob getPrinterJob()
{
- // FIXME: Need to fix this to load a default implementation instance.
+ // FIXME: Need to fix this to load a default implementation instance.
return null;
}
@@ -149,7 +148,8 @@ public abstract class PrinterJob
*
* @return The modified <code>PageFormat</code>.
*/
- public abstract PageFormat pageDialog(PageFormat page_format);
+ public abstract PageFormat pageDialog(PageFormat page_format)
+ throws HeadlessException;
/**
* Prints the pages.
@@ -169,7 +169,8 @@ public abstract class PrinterJob
* @return <code>false</code> if the user cancels the dialog box,
* <code>true</code> otherwise.
*/
- public abstract boolean printDialog();
+ public abstract boolean printDialog()
+ throws HeadlessException;
/**
* Displays a dialog box to the user which allows the print job
@@ -178,7 +179,8 @@ public abstract class PrinterJob
* @return <code>false</code> if the user cancels the dialog box,
* <code>true</code> otherwise.
*/
- public abstract boolean printDialog(PrintRequestAttributeSet attributes);
+ public abstract boolean printDialog(PrintRequestAttributeSet attributes)
+ throws HeadlessException;
/**
* This sets the pages that are to be printed.
diff --git a/libjava/java/beans/AppletInitializer.java b/libjava/java/beans/AppletInitializer.java
index 48c37b38061..0b20c86fefd 100644
--- a/libjava/java/beans/AppletInitializer.java
+++ b/libjava/java/beans/AppletInitializer.java
@@ -1,5 +1,5 @@
/* java.beans.AppletInitializer
- Copyright (C) 2001 Free Software Foundation, Inc.
+ Copyright (C) 2001, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -45,7 +45,7 @@ import java.beans.beancontext.BeanContext;
* Bean that is also an Applet. It is used by
* <code>Beans.instantiate()</code>.
*
- * @author Tom Tromey <tromey@redhat.com>
+ * @author Tom Tromey (tromey@redhat.com)
* @since 1.2
*/
public interface AppletInitializer
diff --git a/libjava/java/beans/Beans.java b/libjava/java/beans/Beans.java
index 762e4d597ca..30f6642bbc3 100644
--- a/libjava/java/beans/Beans.java
+++ b/libjava/java/beans/Beans.java
@@ -1,5 +1,5 @@
/* java.beans.Beans
- Copyright (C) 1998, 1999 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -35,23 +35,26 @@ 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.beans;
+import gnu.java.beans.DummyAppletStub;
import gnu.java.io.ClassLoaderObjectInputStream;
import java.applet.Applet;
+import java.beans.beancontext.BeanContext;
import java.io.IOException;
-import java.io.InputStream;
import java.io.ObjectInputStream;
+import java.net.URL;
/**
* <code>Beans</code> provides some helper methods that allow the basic
* operations of Bean-ness.
*
* @author John Keiser
+ * @author Robert Schuster
+ *
* @since 1.1
- * @version 1.1.0, 29 Jul 1998
+ * @status updated to 1.4
*
*/
public class Beans
@@ -66,196 +69,300 @@ public class Beans
*/
public Beans()
{
- // Do nothing here.
+ // Does intentionally nothing here.
}
- /**
- * Allows you to instantiate a Bean. This method takes
- * a ClassLoader from which to read the Bean and the
- * name of the Bean.<P>
- *
- * The Bean name should be a dotted name, like a class.
- * It can represent several things. Beans will search
- * for the Bean using the name like this:<P>
- * <OL>
- * <LI>Searches for a serialized instance of the Bean
- * using getResource(), mangling the Bean name by
- * replacing the dots with slashes and appending .ser
- * (for example, gnu.beans.BlahDeBlah would cause
- * Beans to search for gnu/beans/BlahDeBlah.ser using
- * getResource()).</LI>
- * <LI>Searches for the Bean class using the beanName,
- * and then instantiates it with the no-arg constructor.
- * At that point, if it is an Applet, it provides it
- * with AppletContext and AppletStub, and then calls
- * init().</LI>
- * </OL>
- *
- * @param cl the ClassLoader to use, or <CODE>null</CODE>
- * to use the default ClassLoader.
- * @param beanName the name of the Bean.
- *
- * @return the Bean.
- *
- * @XXX
- */
- public static Object instantiate (ClassLoader cl, String beanName)
- throws IOException, ClassNotFoundException
- {
- Object bean;
- InputStream serStream;
-
- if (cl == null)
- {
- serStream = ClassLoader.getSystemResourceAsStream
- (beanName.replace ('.','/')+".ser");
- }
- else
- {
- serStream = cl.getResourceAsStream (beanName.replace ('.', '/')
- + ".ser");
- }
-
- if (serStream != null)
- {
- if(cl == null)
- {
- ObjectInputStream ois = new ObjectInputStream(serStream);
- bean = ois.readObject();
- }
- else
- {
- ClassLoaderObjectInputStream ois =
- new ClassLoaderObjectInputStream (serStream, cl);
+ /** Creates a bean.
+ * <p>This is a convenience method that calls <code>instantiate(cl, beanName, null, null)</code>.</p>
+ *
+ * @see instantiate(ClassLoader, String, BeanContext, AppletInitializer)
+ * @param cl ClassLoader to be used or <code>null</code> for the system classloader.
+ * @param beanName Name of a serialized bean or class name.
+ * @return A newly created bean.
+ * @throws IOException If access of an IO resource failed.
+ * @throws ClassNotFoundException If the class name is not known or does not lead to a proper bean class.
+ */
+ public static Object instantiate(ClassLoader cl, String beanName)
+ throws IOException, ClassNotFoundException
+ {
+ return instantiate(cl, beanName, null, null);
+ }
+
+ /** Creates a bean.
+ *
+ * <p>This is a convenience method that calls <code>instantiate(cl, beanName, beanContext, null)</code>.</p>
+ *
+ * @see instantiate(ClassLoader, String, BeanContext, AppletInitializer)
+ * @param cl ClassLoader to be used or <code>null</code> for the system classloader.
+ * @param beanName Name of a serialized bean or class name.
+ * @param beanContext Context to which the newly created Bean should be added.
+ * @return A newly created bean.
+ * @throws IOException If access of an IO resource failed.
+ * @throws ClassNotFoundException If the class name is not known or does not lead to a proper bean class.
+ */
+ public static Object instantiate(
+ ClassLoader cl,
+ String beanName,
+ BeanContext beanContext)
+ throws IOException, ClassNotFoundException
+ {
+ return instantiate(cl, beanName, beanContext, null);
+ }
+
+ /** Instantiates a bean according to Beans 1.0.
+ *
+ * <p>In Beans 1.0 the instantiation scheme is as follows:</p>
+ * <p>The name should be dot-separated (e.g "place.for.beans.myBean") and indicate either a
+ * serialized object or a class name. In the first case all dots in the name are replaced with
+ * slashes ('/') and ".ser" is appended ("place.for.beans.myBean" becomes "place/for/beans/myBean.ser").
+ * The bean is then loaded as an application or system resource depending on whether a
+ * <code>ClassLoader</code> was provided.</p>
+ *
+ * <p>If no such resource exists or if it contains no bean the name is interpreted as a class name of
+ * which an instance is then created.</p>
+ *
+ * <p>If a <code>BeanContext</code> instance is available the created bean is added to it.</p>
+ *
+ * <p>If the created Bean is an <code>Applet</code> or subclass and an <code>AppletInitializer</code>
+ * instance is available the applet is initialized and afterwards activated using the initializer. Additionally
+ * every instantiated <code>Applet</code> bean is initialized using the {@link Applet.init} method.
+ * Furthermore every applet gets a default <code>AppletStub</code>. The <code>Applet</code>'s
+ * document base is the location of the ".ser" file if it was deserialized or the location of its class
+ * file if it was instantiated.</p>
+ *
+ * <p>A <code>ClassNotFoundException</code> is not only thrown when a class name was unknown
+ * but even when the class has public no-argument constructor
+ * (<code>IllegalAccessException</code> is wrapped) or an exception is thrown while
+ * invoking such a constructor (causing exception is wrapped).</p>
+ *
+ * @param cl ClassLoader to be used or <code>null</code> for the system classloader.
+ * @param beanName Name of a serialized bean or class name.
+ * @param beanContext Context to which the newly created Bean should be added.
+ * @param initializer The AppletInitializer which is used for initializing <code>Applet</code> beans.
+ * @return A newly created bean.
+ * @throws IOException If access of an IO resource failed.
+ * @throws ClassNotFoundException If the class name is not known or does not lead to a proper bean class.
+ */
+ public static Object instantiate(
+ ClassLoader cl,
+ String beanName,
+ BeanContext beanContext,
+ AppletInitializer initializer)
+ throws IOException, ClassNotFoundException
+ {
+ Object bean = null;
+ URL beanLocation = null;
+ URL classLocation = null;
+
+ // Converts bean name into a resource name (eg. "a.b.c" -> "a/b/c").
+ String resourceName = beanName.replace('.', '/');
+
+ /* Tries to get an input stream of the Bean, reading it as a system resource
+ * if no ClassLoader is present or as an application resource if a classloader
+ * is given.
+ */
+ beanLocation =
+ (cl == null)
+ ? ClassLoader.getSystemResource(resourceName + ".ser")
+ : cl.getResource(resourceName + ".ser");
+
+ // Reads the serialized Bean from the returned URL.
+ if (beanLocation != null)
+ {
+ // Deserializes the bean instance.
+ ObjectInputStream ois =
+ (cl == null)
+ ? new ObjectInputStream(beanLocation.openStream())
+ : new ClassLoaderObjectInputStream(
+ beanLocation.openStream(),
+ cl);
+
bean = ois.readObject();
- }
- }
- else if(cl == null)
- {
- Class beanClass = Class.forName(beanName);
- try
- {
- bean = beanClass.newInstance();
- }
- catch(IllegalAccessException E)
- {
- bean = null;
- }
- catch(InstantiationException E)
- {
- bean = null;
- }
- }
- else
- {
- Class beanClass = cl.loadClass(beanName);
- try
- {
- bean = beanClass.newInstance();
- }
- catch(IllegalAccessException E)
- {
- bean = null;
- }
- catch(InstantiationException E)
- {
- bean = null;
- }
- }
-
- if(bean instanceof Applet)
- {
- Applet a = (Applet)bean;
- //a.setAppletContext(???);
- //a.setStub(???);
- if(serStream == null)
- {
- a.init();
- }
- }
-
- return bean;
- }
- /**
- * Get the Bean as a different class type.
- * This should be used instead of casting to get a new
- * type view of a Bean, because in the future there may
- * be new types of Bean, even Beans spanning multiple
- * Objects.
- *
- * @param bean the Bean to cast.
- * @param newClass the Class to cast it to.
- *
- * @return the Bean as a new view, or if the operation
- * could not be performed, the Bean itself.
- */
- public static Object getInstanceOf(Object bean, Class newClass)
- {
- return bean;
- }
+ /* Implementation note: The result of ObjectInputStream.readObject()
+ * may have been null at this point (its a valid value to deserialize)
+ * and we explicitly want to try instantiation in such a case
+ * (this is important for compatibility).
+ */
+ }
- /**
- * Determine whether the Bean can be cast to a different
- * class type.
- * This should be used instead of instanceof to determine
- * a Bean's castability, because in the future there may
- * be new types of Bean, even Beans spanning multiple
- * Objects.
- *
- * @param bean the Bean to cast.
- * @param newBeanClass the Class to cast it to.
- *
- * @return whether the Bean can be cast to the class type
- * in question.
- */
- public static boolean isInstanceOf(Object bean, Class newBeanClass)
- {
- return newBeanClass.isInstance(bean);
- }
+ // Instantiates the Bean using reflective instantiation if it has not been created yet.
+ if (bean == null)
+ {
+ // Makes sure that the deserialization was NOT done.
+ beanLocation = null;
- /**
- * Find out whether the GUI is available to use.
- * Defaults to true.
- *
- * @return whether the GUI is available to use.
- */
- public static boolean isGuiAvailable()
- {
- return guiAvailable;
- }
+ Class beanClass;
+ if (cl == null)
+ {
+ beanClass = Class.forName(beanName);
+ classLocation =
+ ClassLoader.getSystemResource(resourceName + ".class");
+ }
+ else
+ {
+ beanClass = cl.loadClass(beanName);
+ classLocation = cl.getResource(resourceName + ".class");
+ }
- /**
- * Find out whether it is design time. Design time means
- * we are in a RAD tool.
- * Defaults to false.
- *
- * @return whether it is design time.
- */
- public static boolean isDesignTime()
- {
- return designTime;
- }
+ // Instantiates and optionally registers the new bean.
+ try
+ {
+ bean = beanClass.newInstance();
+ }
+ catch(Exception e) {
+ /* Wraps all kinds of Exceptions in a ClassNotFoundException (this behavior
+ * matches with official >= 1.5, this was different for <=1.4)
+ */
+ throw new ClassNotFoundException(null, e);
+ }
+ }
- /**
- * Set whether the GUI is available to use.
- * @param guiAvailable whether the GUI is available to use.
- */
- public static void setGuiAvailable(boolean guiAvailable)
- throws SecurityException
- {
- Beans.guiAvailable = guiAvailable;
- }
+ /* Applet beans are treated in the following way:
+ * - all AppletS get a default AppletStub
+ * - all AppletS are initialized using the AppletInitializer instance (if it is available)
+ * - as every other Bean Applets are added to a BeanContext if one is available
+ * - each instantiated Applet is initialized using Applet.init() (this is not done for deserialized ones)
+ * - finally AppletS get activated using the AppletInitializerS activate-Method
+ *
+ * The order of operations is important for compatibility.
+ */
+ Applet applet = null;
+ if (bean instanceof Applet)
+ {
+ // Makes a second instanceof call unneccessary (instanceof is expensive).
+ applet = (Applet) bean;
+
+ /* The AppletStub's code and document base is set as follows:
+ * The code base is always the URL from where the class data originated
+ * (without the package name).
+ * If the Applet was deserialized the document base is the location of
+ * the serialized instance (usually the ".ser" file) otherwise its the URL
+ * from where the class data originated (usually the absolute directory
+ * location of the ".class" file).
+ */
+ applet.setStub(
+ new DummyAppletStub(
+ applet
+ .getClass()
+ .getProtectionDomain()
+ .getCodeSource()
+ .getLocation(),
+ (beanLocation == null) ? classLocation : beanLocation));
+
+ // Runs the Applet's initialization using an AppletInitializer.
+ if (initializer != null)
+ {
+ initializer.initialize(applet, beanContext);
+ }
+ }
+
+ // Adds the new bean to its BeanContext.
+ if (beanContext != null)
+ {
+ beanContext.add(bean);
+ }
+
+ if (applet != null)
+ {
+
+ // Initializes an instantiated (not deserialized) Applet using its own method.
+ if (beanLocation == null)
+ {
+ applet.init();
+ }
+
+ // Runs the Applet's activation using an AppletInitializer.
+ if (initializer != null)
+ {
+ initializer.activate(applet);
+ }
+ }
+
+ return bean;
+ }
+
+ /**
+ * Returns the Bean as a different class type.
+ * This should be used instead of casting to get a new
+ * type view of a Bean, because in the future there may
+ * be new types of Bean, even Beans spanning multiple
+ * Objects.
+ *
+ * @param bean the Bean to cast.
+ * @param newClass the Class to cast it to.
+ *
+ * @return the Bean as a new view, or if the operation
+ * could not be performed, the Bean itself.
+ */
+ public static Object getInstanceOf(Object bean, Class newClass)
+ {
+ return bean;
+ }
+
+ /**
+ * Determines whether the Bean can be cast to a different
+ * class type.
+ * This should be used instead of instanceof to determine
+ * a Bean's castability, because in the future there may
+ * be new types of Bean, even Beans spanning multiple
+ * Objects.
+ *
+ * @param bean the Bean to cast.
+ * @param newClass the Class to cast it to.
+ *
+ * @return whether the Bean can be cast to the class type
+ * in question.
+ */
+ public static boolean isInstanceOf(Object bean, Class newBeanClass)
+ {
+ return newBeanClass.isInstance(bean);
+ }
+
+ /**
+ * Returns whether the GUI is available to use.
+ * <p>Defaults to true.</p>
+ *
+ * @return whether the GUI is available to use.
+ */
+ public static boolean isGuiAvailable()
+ {
+ return guiAvailable;
+ }
+
+ /**
+ * Returns whether it is design time. Design time means
+ * we are in a RAD tool.
+ * <p>Defaults to false.</p>
+ *
+ * @return whether it is design time.
+ */
+ public static boolean isDesignTime()
+ {
+ return designTime;
+ }
+
+ /**
+ * Sets whether the GUI is available to use.
+ *
+ * @param guiAvailable whether the GUI is available to use.
+ */
+ public static void setGuiAvailable(boolean guiAvailable)
+ throws SecurityException
+ {
+ Beans.guiAvailable = guiAvailable;
+ }
+
+ /**
+ * Sets whether it is design time. Design time means we
+ * are in a RAD tool.
+ *
+ * @param designTime whether it is design time.
+ */
+ public static void setDesignTime(boolean designTime)
+ throws SecurityException
+ {
+ Beans.designTime = designTime;
+ }
- /**
- * Set whether it is design time. Design time means we
- * are in a RAD tool.
- *
- * @param designTime whether it is design time.
- */
- public static void setDesignTime(boolean designTime)
- throws SecurityException
- {
- Beans.designTime = designTime;
- }
}
diff --git a/libjava/java/beans/ExceptionListener.java b/libjava/java/beans/ExceptionListener.java
index 09f7d1a8a2e..01f952f8597 100644
--- a/libjava/java/beans/ExceptionListener.java
+++ b/libjava/java/beans/ExceptionListener.java
@@ -1,5 +1,5 @@
/* ExceptionListener.java -- listen for recoverable internal exceptions
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -42,7 +42,7 @@ package java.beans;
* This interface allows a class to monitor internal exceptions, to try to
* recover from them.
*
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Eric Blake (ebb9@email.byu.edu)
* @since 1.4
* @status updated to 1.4
*/
diff --git a/libjava/java/beans/PropertyChangeEvent.java b/libjava/java/beans/PropertyChangeEvent.java
index 418f92f8bb8..75e17b18be1 100644
--- a/libjava/java/beans/PropertyChangeEvent.java
+++ b/libjava/java/beans/PropertyChangeEvent.java
@@ -1,5 +1,5 @@
/* PropertyChangeEvent.java -- describes a change in a property
- Copyright (C) 1998, 2000, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1998, 2000, 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -55,7 +55,7 @@ import java.util.EventObject;
* information.
*
* @author John Keiser
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Eric Blake (ebb9@email.byu.edu)
* @since 1.1
* @status udpated to 1.4
*/
diff --git a/libjava/java/beans/PropertyChangeListenerProxy.java b/libjava/java/beans/PropertyChangeListenerProxy.java
index 6e707038d06..3a04de2db5a 100644
--- a/libjava/java/beans/PropertyChangeListenerProxy.java
+++ b/libjava/java/beans/PropertyChangeListenerProxy.java
@@ -1,5 +1,5 @@
/* PropertyChangeListenerProxy.java -- adds a name to a property listener
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -45,7 +45,7 @@ import java.util.EventListenerProxy;
* associating a name with the listener. This can be used to filter the
* changes that one is interested in.
*
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Eric Blake (ebb9@email.byu.edu)
* @since 1.4
* @status udpated to 1.4
*/
diff --git a/libjava/java/beans/PropertyChangeSupport.java b/libjava/java/beans/PropertyChangeSupport.java
index 4796a17f13e..76932bccda3 100644
--- a/libjava/java/beans/PropertyChangeSupport.java
+++ b/libjava/java/beans/PropertyChangeSupport.java
@@ -1,5 +1,5 @@
/* PropertyChangeSupport.java -- support to manage property change listeners
- Copyright (C) 1998, 1999, 2000, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2000, 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -57,7 +57,7 @@ import java.util.Vector;
* is thread-safe.
*
* @author John Keiser
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Eric Blake (ebb9@email.byu.edu)
* @since 1.1
* @status updated to 1.4
*/
diff --git a/libjava/java/beans/PropertyDescriptor.java b/libjava/java/beans/PropertyDescriptor.java
index b62440a2e47..57ed4f8cadf 100644
--- a/libjava/java/beans/PropertyDescriptor.java
+++ b/libjava/java/beans/PropertyDescriptor.java
@@ -1,5 +1,5 @@
/* java.beans.PropertyDescriptor
- Copyright (C) 1998, 2001, 2004 Free Software Foundation, Inc.
+ Copyright (C) 1998, 2001, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -57,7 +57,7 @@ import java.lang.reflect.Method;
** </OL>
**
** @author John Keiser
- ** @author Robert Schuster <thebohemian@gmx.net>
+ ** @author Robert Schuster (thebohemian@gmx.net)
** @since 1.1
** @status updated to 1.4
**/
@@ -126,7 +126,7 @@ public class PropertyDescriptor extends FeatureDescriptor
}
// finally check the methods compatibility
- checkMethods(getMethod, setMethod);
+ propertyType = checkMethods(getMethod, setMethod);
}
/** Create a new PropertyDescriptor by introspection.
@@ -178,7 +178,7 @@ public class PropertyDescriptor extends FeatureDescriptor
"Cannot find a setter method called " + setMethodName);
}
- checkMethods(getMethod, setMethod);
+ propertyType = checkMethods(getMethod, setMethod);
}
/** Create a new PropertyDescriptor using explicit Methods.
@@ -205,17 +205,7 @@ public class PropertyDescriptor extends FeatureDescriptor
setName(name);
getMethod = readMethod;
setMethod = writeMethod;
-
- if (getMethod != null)
- {
- this.propertyType = getMethod.getReturnType();
- }
- else if (setMethod != null)
- {
- this.propertyType = setMethod.getParameterTypes()[0];
- }
-
- checkMethods(getMethod, setMethod);
+ propertyType = checkMethods(getMethod, setMethod);
}
/** Get the property type.
@@ -250,7 +240,7 @@ public class PropertyDescriptor extends FeatureDescriptor
*/
public void setReadMethod(Method readMethod) throws IntrospectionException
{
- checkMethods(readMethod, setMethod);
+ propertyType = checkMethods(readMethod, setMethod);
getMethod = readMethod;
}
@@ -448,7 +438,7 @@ public class PropertyDescriptor extends FeatureDescriptor
* <li>the property type and the read method's return type must be assignable from the
* write method's argument type</li>
* <li>the write method may not exist</li>
- * <ul>
+ * </ul>
* While checking the methods a common new property type is calculated. If the method
* succeeds this property type is returned.<br/>
* <br/>
diff --git a/libjava/java/beans/VetoableChangeListenerProxy.java b/libjava/java/beans/VetoableChangeListenerProxy.java
index f9d79958705..d5007317bd5 100644
--- a/libjava/java/beans/VetoableChangeListenerProxy.java
+++ b/libjava/java/beans/VetoableChangeListenerProxy.java
@@ -1,5 +1,5 @@
/* VetoableChangeListenerProxy.java -- adds a name to a vetoable listener
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -45,7 +45,7 @@ import java.util.EventListenerProxy;
* associating a name with the listener. This can be used to filter the
* changes that one is interested in.
*
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Eric Blake (ebb9@email.byu.edu)
* @since 1.4
* @status udpated to 1.4
*/
diff --git a/libjava/java/beans/VetoableChangeSupport.java b/libjava/java/beans/VetoableChangeSupport.java
index bbac648dbd2..f1dbc50a778 100644
--- a/libjava/java/beans/VetoableChangeSupport.java
+++ b/libjava/java/beans/VetoableChangeSupport.java
@@ -1,5 +1,5 @@
/* VetoableChangeSupport.java -- support to manage vetoable change listeners
- Copyright (C) 1998, 1999, 2000, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2000, 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -57,7 +57,7 @@ import java.util.Vector;
* is thread-safe.
*
* @author John Keiser
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Eric Blake (ebb9@email.byu.edu)
* @since 1.1
* @status updated to 1.4
*/
diff --git a/libjava/java/beans/XMLDecoder.java b/libjava/java/beans/XMLDecoder.java
new file mode 100644
index 00000000000..87703352248
--- /dev/null
+++ b/libjava/java/beans/XMLDecoder.java
@@ -0,0 +1,307 @@
+/* java.beans.XMLDecoder --
+ Copyright (C) 2004, 2005 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.beans;
+
+import gnu.java.beans.decoder.DefaultExceptionListener;
+import gnu.java.beans.decoder.PersistenceParser;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Iterator;
+import java.util.NoSuchElementException;
+
+/**
+ * The XMLDecoder reads XML data that is structured according to
+ * <a href="http://java.sun.com/products/jfc/tsc/articles/persistence3/javabeans.dtd">this</a> DTD
+ * and creates objects according to the content. Usually such data is generated using the
+ * {@link XMLEncoder} class.
+ * <p>
+ * An example XML document might look like this:
+ * <code>
+ * &lt;java&gt;
+ * &lt;string&gt;Hello World&lt;/string&gt;
+ * &lt;int&gt;200&lt;/int&gt;
+ * &lt;/java&gt;
+ * </code>
+ * <p>To read the <code>String</code> and the <code>Integer</code> instance the following can be used (assume
+ * the XML data can be obtained from the InputStream):</p>
+ * <code>
+ * XMLDecoder decoder = new XMLDecoder(inputStreamContainingXMLData);
+ * String message = (String) decoder.readObject();
+ * Integer number = (Integer) decoder.readObject();
+ * </code>
+ * <p>Besides this basic functionality the <code>XMLDecoder</code> has some more features that might come
+ * handy in certain situations:</p>
+ * <p>An owner object can be set using the <code>setOwner</code> method which can then be accessed when
+ * decoding. This feature is only useful if the XML data is aware of the owner object. Such data may
+ * look like this (assume that the owner object is a JFrame instance):</p>
+ * <code>
+ * &lt;java&gt;
+ * &lt;void method="getOwner"&gt;
+ * &lt;void method="setVisible"&gt;
+ * &lt;boolean&gt;true&lt;boolean&gt;
+ * &lt;/void&gt;
+ * &lt;/void&gt;
+ * &lt;/java&gt;
+ * </code>
+ * This accesses the <code>JFrame</code> and makes it visible using the <code>setVisible</code> method.
+ * <p>Please note that changing the owner <b>after</b> the having read the first object has no effect,
+ * because all object have been decoded then.</p>
+ * <p>If the <code>XMLDecoder</code> is created with no {@link ExceptionListener} instance a default one
+ * is used that prints an error message to <code>System.err</code> whenever a recoverable exception
+ * is thrown. Recovarable exceptions occur when the XML data cannot be interpreted correctly (e.g
+ * unknown classes or methods, invocation on null, ...). In general be very careful when the
+ * <code>XMLDecoder</code> provoked such exceptions because the resulting object(s) may be in an
+ * undesirable state.</p>
+ * <p>Note that changing the ExceptionListener instance after <code>readObject</code> has been called
+ * once has no effect because the decoding is completed then.</p>
+ * <p>At last one can provide a specific <code>ClassLoader</code> which is then used when <code>Class</code>
+ * objects are accessed. See {@link java.lang.Class#forName(String, boolean, ClassLoader)} for details
+ * on this.</p>
+ * <p>Note: If the <code>InputStream</code> instance given to any of the constructors is <code>null</code>
+ * the resulting <code>XMLDecoder</code> will be silently (without any exception) useless. Each call
+ * to <code>readObject</code> will return <code>null</code> and never throws an
+ * <code>ArrayIndexOutOfBoundsException</code>.</p>
+ *
+ * @author Robert Schuster
+ * @since 1.4
+ * @status updated to 1.5
+ */
+public class XMLDecoder
+{
+ private Object owner;
+
+ private ExceptionListener exceptionListener;
+
+ private InputStream inputStream;
+
+ private boolean isStreamClosed;
+
+ private ClassLoader classLoader;
+
+ private Iterator iterator;
+
+ /** Creates a XMLDecoder instance that parses the XML data of the given input stream.
+ * Using this constructor no special ClassLoader, a default ExceptionListener
+ * and no owner object is used.
+ *
+ * @param in InputStream to read XML data from.
+ */
+ public XMLDecoder(InputStream in)
+ {
+ this(in, null);
+ }
+
+ /** Creates a XMLDecoder instance that parses the XML data of the given input stream.
+ * Using this constructor no special ClassLoader and a default ExceptionListener
+ * is used.
+ *
+ * @param in InputStream to read XML data from.
+ * @param owner Owner object which can be accessed and modified while parsing.
+ */
+ public XMLDecoder(InputStream in, Object owner)
+ {
+ this(in, owner, null);
+ }
+
+ /** Creates a XMLDecoder instance that parses the XML data of the given input stream.
+ * If the ExceptionListener argument is null a default implementation is used.
+ *
+ * @param in InputStream to read XML data from.
+ * @param owner Owner object which can be accessed and modified while parsing.
+ * @param exceptionListener ExceptionListener instance to which exception notifications are send.
+ */
+ public XMLDecoder(
+ InputStream in,
+ Object owner,
+ ExceptionListener exceptionListener)
+ {
+ this(
+ in,
+ owner,
+ exceptionListener,
+ Thread.currentThread().getContextClassLoader());
+ }
+
+ /** Creates a XMLDecoder instance that parses the XML data of the given input stream.
+ * If the ExceptionListener argument is null a default implementation is used.
+ *
+ * @param in InputStream to read XML data from.
+ * @param owner Owner object which can be accessed and modified while parsing.
+ * @param exceptionListener ExceptionListener instance to which exception notifications are send.
+ * @param cl ClassLoader instance that is used for calls to <code>Class.forName(String, boolean, ClassLoader)</code>
+ * @since 1.5
+ */
+ public XMLDecoder(
+ InputStream in,
+ Object owner,
+ ExceptionListener listener,
+ ClassLoader cl)
+ {
+ // initially here was a check for the validity of the InputStream argument but some
+ // great engineers decided that this API should silently discard this and behave rather
+ // odd: readObject will always return null ...
+ inputStream = in;
+
+ setExceptionListener(listener);
+
+ // validity of this object is checked in Class.forName() and therefore may be null
+ classLoader = cl;
+
+ this.owner = owner;
+ }
+
+ /** Closes the stream associated with this decoder. This should be done after having read all
+ * decoded objects.
+ * <p>See the description of the {@link #readObject()} for the effect caused by <code>close</code>.</p>
+ */
+ public void close()
+ {
+ if (isStreamClosed)
+ {
+ return;
+ }
+
+ try
+ {
+ inputStream.close();
+ isStreamClosed = true;
+ }
+ catch (IOException e)
+ {
+ // bad style forced by original API design ...
+ }
+ }
+
+ /** Returns the ExceptionListener instance associated with this decoder.
+ * <p>See the description of {@link XMLDecoder} class for more information on the ExceptionListener.</p>
+ *
+ * @return Current ExceptionListener of the decoder.
+ */
+ public ExceptionListener getExceptionListener()
+ {
+ return exceptionListener;
+ }
+
+ /** Returns the owner object of the decoder. This method is usually called
+ * from within the parsed XML data.
+ * <p>See the description of {@link XMLDecoder} class for more information on the owner object.</p>
+ *
+ * @return The owner object of this decoder.
+ */
+ public Object getOwner()
+ {
+ return owner;
+ }
+
+ /** Returns the next available decoded object.
+ * <p>Note that the actual decoding takes place when the method is called for the first time.</p>
+ * <p>If the <code>close</code> method was already called a <code>NoSuchElementException</code>
+ * is thrown.</p>
+ * <p>If the InputStream instance used in the constructors was <code>null</code> this method
+ * will always return <code>null</code> itself.</p>
+ *
+ * @return The next object in a sequence decoded from XML data.
+ * @throws ArrayIndexOutOfBoundsException When no more objects are available.
+ */
+ public Object readObject() throws ArrayIndexOutOfBoundsException
+ {
+ // note: the RI does it this way ...
+ if(inputStream == null) {
+ return null;
+ }
+
+ // note: the original API documentation says nothing on what to do
+ // when the stream was closed before readObject is called but it actually
+ // throws a NoSuchElementException - this behaviour is imitated here
+ if (isStreamClosed)
+ {
+ throw new NoSuchElementException("Cannot read any objects - XMLDecoder was already closed.");
+ }
+
+ // creates the PersistenceParser (doing the parsing and decoding) and returns its
+ // Iterator on first invocation
+ if (iterator == null)
+ {
+ iterator =
+ new PersistenceParser(
+ inputStream,
+ exceptionListener,
+ classLoader,
+ this)
+ .iterator();
+ }
+
+ // note: done according to the official documentation
+ if (!iterator.hasNext())
+ {
+ throw new ArrayIndexOutOfBoundsException("No more objects available from this XMLDecoder.");
+ }
+
+ // returns just the next object if there was no problem
+ return iterator.next();
+ }
+
+ /** Sets the ExceptionListener instance to which notifications of exceptions are send
+ * while parsing the XML data.
+ * <p>See the description of {@link XMLDecoder} class for more information on the ExceptionListener.</p>
+ *
+ * @param listener
+ */
+ public void setExceptionListener(ExceptionListener listener)
+ {
+ // uses a default implementation when null
+ if (listener == null)
+ {
+ listener = new DefaultExceptionListener();
+ }
+ exceptionListener = listener;
+ }
+
+ /** Sets the owner object which can be accessed from the parsed XML data.
+ * <p>See the description of {@link XMLDecoder} class for more information on the owner object.</p>
+ *
+ * @param newOwner
+ */
+ public void setOwner(Object newOwner)
+ {
+ owner = newOwner;
+ }
+
+}
diff --git a/libjava/java/io/BufferedInputStream.java b/libjava/java/io/BufferedInputStream.java
index 5343f0762b6..ce166b337f4 100644
--- a/libjava/java/io/BufferedInputStream.java
+++ b/libjava/java/io/BufferedInputStream.java
@@ -65,6 +65,7 @@ package java.io;
*/
public class BufferedInputStream extends FilterInputStream
{
+
/**
* This is the default buffer size
*/
@@ -103,17 +104,11 @@ public class BufferedInputStream extends FilterInputStream
protected int marklimit;
/**
- * This is the maximum size we have to allocate for the mark buffer.
- * This number may be huge (Integer.MAX_VALUE). The class will continue
- * to allocate new chunks (specified by <code>CHUNKSIZE</code>) until the
- * the size specified by this field is achieved.
- */
- private int marktarget = 0;
-
- /**
- * This is the number of bytes to allocate to reach marktarget.
+ * This is the initial buffer size. When the buffer is grown because
+ * of marking requirements, it will be grown by bufferSize increments.
+ * The underlying stream will be read in chunks of bufferSize.
*/
- static final private int CHUNKSIZE = 1024;
+ private final int bufferSize;
/**
* This method initializes a new <code>BufferedInputStream</code> that will
@@ -143,6 +138,9 @@ public class BufferedInputStream extends FilterInputStream
if (size <= 0)
throw new IllegalArgumentException();
buf = new byte[size];
+ // initialize pos & count to bufferSize, to prevent refill from
+ // allocating a new buffer (if the caller starts out by calling mark()).
+ pos = count = bufferSize = size;
}
/**
@@ -160,7 +158,7 @@ public class BufferedInputStream extends FilterInputStream
*/
public synchronized int available() throws IOException
{
- return count - pos + super.available();
+ return count - pos + in.available();
}
/**
@@ -173,7 +171,9 @@ public class BufferedInputStream extends FilterInputStream
{
// Free up the array memory.
buf = null;
- super.close();
+ pos = count = 0;
+ markpos = -1;
+ in.close();
}
/**
@@ -196,9 +196,7 @@ public class BufferedInputStream extends FilterInputStream
*/
public synchronized void mark(int readlimit)
{
- marktarget = marklimit = readlimit;
- if (marklimit > CHUNKSIZE)
- marklimit = CHUNKSIZE;
+ marklimit = readlimit;
markpos = pos;
}
@@ -231,9 +229,6 @@ public class BufferedInputStream extends FilterInputStream
if (pos >= count && !refill())
return -1; // EOF
- if (markpos >= 0 && pos - markpos > marktarget)
- markpos = -1;
-
return buf[pos++] & 0xFF;
}
@@ -278,10 +273,7 @@ public class BufferedInputStream extends FilterInputStream
off += totalBytesRead;
len -= totalBytesRead;
- if (markpos >= 0 && pos - markpos > marktarget)
- markpos = -1;
-
- while (len > 0 && super.available() > 0 && refill())
+ while (len > 0 && in.available() > 0 && refill())
{
int remain = Math.min(count - pos, len);
System.arraycopy(buf, pos, b, off, remain);
@@ -289,9 +281,6 @@ public class BufferedInputStream extends FilterInputStream
off += remain;
len -= remain;
totalBytesRead += remain;
-
- if (markpos >= 0 && pos - markpos > marktarget)
- markpos = -1;
}
return totalBytesRead;
@@ -338,23 +327,28 @@ public class BufferedInputStream extends FilterInputStream
while (n > 0L)
{
- if (pos >= count && !refill())
- if (n < origN)
- break;
- else
- return 0; // No bytes were read before EOF.
+ if (pos >= count)
+ {
+ if (markpos == -1)
+ {
+ // Buffer is empty and no mark is set, skip on the
+ // underlying stream.
+ n -= in.skip(n);
+ break;
+ }
+ else if (!refill())
+ break;
+ }
int numread = (int) Math.min((long) (count - pos), n);
pos += numread;
n -= numread;
-
- if (markpos >= 0 && pos - markpos > marktarget)
- markpos = -1;
}
return origN - n;
}
+ // GCJ LOCAL: package-private for use by InputStreamReader
/**
* Called to refill the buffer (when count is equal to pos).
*
@@ -366,39 +360,31 @@ public class BufferedInputStream extends FilterInputStream
if (buf == null)
throw new IOException("Stream closed.");
- if (markpos < 0)
- count = pos = 0;
- else if (markpos > 0)
+ if (markpos == -1 || count - markpos >= marklimit)
{
- // Shift the marked bytes (if any) to the beginning of the array
- // but don't grow it. This saves space in case a reset is done
- // before we reach the max capacity of this array.
- System.arraycopy(buf, markpos, buf, 0, count - markpos);
- count -= markpos;
- pos -= markpos;
- markpos = 0;
+ markpos = -1;
+ pos = count = 0;
}
- else if (count >= buf.length && count < marktarget) // BTW, markpos == 0
+ else
{
- // Need to grow the buffer now to have room for marklimit bytes.
- // Note that the new buffer is one greater than marklimit.
- // This is so that there will be one byte past marklimit to be read
- // before having to call refill again, thus allowing marklimit to be
- // invalidated. That way refill doesn't have to check marklimit.
- marklimit += CHUNKSIZE;
- if (marklimit >= marktarget)
- marklimit = marktarget;
- byte[] newbuf = new byte[marklimit + 1];
- System.arraycopy(buf, 0, newbuf, 0, count);
+ byte[] newbuf = buf;
+ if (markpos < bufferSize)
+ {
+ newbuf = new byte[count - markpos + bufferSize];
+ }
+ System.arraycopy(buf, markpos, newbuf, 0, count - markpos);
buf = newbuf;
+ count -= markpos;
+ pos -= markpos;
+ markpos = 0;
}
- int numread = super.read(buf, count, buf.length - count);
+ int numread = in.read(buf, count, bufferSize);
- if (numread < 0) // EOF
+ if (numread <= 0) // EOF
return false;
count += numread;
- return numread > 0;
+ return true;
}
}
diff --git a/libjava/java/io/BufferedReader.java b/libjava/java/io/BufferedReader.java
index 19074703938..ab597884828 100644
--- a/libjava/java/io/BufferedReader.java
+++ b/libjava/java/io/BufferedReader.java
@@ -1,5 +1,5 @@
/* BufferedReader.java
- Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004
+ Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -55,8 +55,8 @@ package java.io;
* of remembering any number of input chars, to the limits of
* system memory or the size of <code>Integer.MAX_VALUE</code>
*
- * @author Per Bothner <bothner@cygnus.com>
- * @author Aaron M. Renn <arenn@urbanophile.com>
+ * @author Per Bothner (bothner@cygnus.com)
+ * @author Aaron M. Renn (arenn@urbanophile.com)
*/
public class BufferedReader extends Reader
{
diff --git a/libjava/java/io/ByteArrayInputStream.java b/libjava/java/io/ByteArrayInputStream.java
index 45a09a77b5d..906e71a0d94 100644
--- a/libjava/java/io/ByteArrayInputStream.java
+++ b/libjava/java/io/ByteArrayInputStream.java
@@ -1,5 +1,5 @@
/* ByteArrayInputStream.java -- Read an array as a stream
- Copyright (C) 1998, 1999, 2001 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2001, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -41,7 +41,7 @@ package java.io;
/**
* This class permits an array of bytes to be read as an input stream.
*
- * @author Warren Levy <warrenl@cygnus.com>
+ * @author Warren Levy (warrenl@cygnus.com)
* @author Aaron M. Renn (arenn@urbanophile.com)
*/
public class ByteArrayInputStream extends InputStream
diff --git a/libjava/java/io/ByteArrayOutputStream.java b/libjava/java/io/ByteArrayOutputStream.java
index 2e89cf5ee0a..095debefa7b 100644
--- a/libjava/java/io/ByteArrayOutputStream.java
+++ b/libjava/java/io/ByteArrayOutputStream.java
@@ -1,5 +1,5 @@
/* BufferedReader.java
- Copyright (C) 1998, 1999, 2000, 2001, 2003 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2000, 2001, 2003, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -66,7 +66,7 @@ package java.io;
* multibyte character encodings.
*
* @author Aaron M. Renn (arenn@urbanophile.com)
- * @author Tom Tromey <tromey@cygnus.com>
+ * @author Tom Tromey (tromey@cygnus.com)
* @date September 24, 1998
*/
public class ByteArrayOutputStream extends OutputStream
diff --git a/libjava/java/io/CharArrayReader.java b/libjava/java/io/CharArrayReader.java
index 9d5382bef1e..d0d5a28399c 100644
--- a/libjava/java/io/CharArrayReader.java
+++ b/libjava/java/io/CharArrayReader.java
@@ -1,5 +1,5 @@
/* CharArrayReader.java -- Read an array of characters as a stream
- Copyright (C) 1998, 2001 Free Software Foundation, Inc.
+ Copyright (C) 1998, 2001, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -42,7 +42,7 @@ package java.io;
* This class permits an array of chars to be read as an input stream.
*
* @author Aaron M. Renn (arenn@urbanophile.com)
- * @author Warren Levy <warrenl@cygnus.com>
+ * @author Warren Levy (warrenl@cygnus.com)
*/
public class CharArrayReader extends Reader
{
diff --git a/libjava/java/io/CharArrayWriter.java b/libjava/java/io/CharArrayWriter.java
index 7453996c346..4593f15c784 100644
--- a/libjava/java/io/CharArrayWriter.java
+++ b/libjava/java/io/CharArrayWriter.java
@@ -1,5 +1,5 @@
/* CharArrayWriter.java -- Write chars to a buffer
- Copyright (C) 1998, 1999, 2001, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2001, 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -60,7 +60,7 @@ package java.io;
* <p>
*
* @author Aaron M. Renn (arenn@urbanophile.com)
- * @author Tom Tromey <tromey@cygnus.com>
+ * @author Tom Tromey (tromey@cygnus.com)
*/
public class CharArrayWriter extends Writer
{
diff --git a/libjava/java/io/CharConversionException.java b/libjava/java/io/CharConversionException.java
index 0cb83d2d020..6f2afb53f7b 100644
--- a/libjava/java/io/CharConversionException.java
+++ b/libjava/java/io/CharConversionException.java
@@ -1,5 +1,5 @@
/* CharConversionException.java -- Character conversion exceptions
- Copyright (C) 1998, 1999, 2001, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2001, 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -43,7 +43,7 @@ package java.io;
* an attempted character conversion.
*
* @author Aaron M. Renn (arenn@urbanophile.com)
- * @author Tom Tromey <tromey@cygnus.com>
+ * @author Tom Tromey (tromey@cygnus.com)
* @since 1.1
* @status updated to 1.4
*/
diff --git a/libjava/java/io/DataInput.java b/libjava/java/io/DataInput.java
index 52cd246110d..0aa172b17a0 100644
--- a/libjava/java/io/DataInput.java
+++ b/libjava/java/io/DataInput.java
@@ -1,5 +1,5 @@
/* DataInput.java -- Interface for reading data from a stream
- Copyright (C) 1998, 1999, 2001, 2003 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2001, 2003, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -48,7 +48,7 @@ package java.io;
* into Java primitive types.
*
* @author Aaron M. Renn (arenn@urbanophile.com)
- * @author Warren Levy <warrenl@cygnus.com>
+ * @author Warren Levy (warrenl@cygnus.com)
*/
public interface DataInput
{
diff --git a/libjava/java/io/DataInputStream.java b/libjava/java/io/DataInputStream.java
index d6068828c89..9cdbc695506 100644
--- a/libjava/java/io/DataInputStream.java
+++ b/libjava/java/io/DataInputStream.java
@@ -50,8 +50,8 @@ package java.io;
*
* @see DataInput
*
- * @author Warren Levy <warrenl@cygnus.com>
- * @author Aaron M. Renn <arenn@urbanophile.com>
+ * @author Warren Levy (warrenl@cygnus.com)
+ * @author Aaron M. Renn (arenn@urbanophile.com)
* @date October 20, 1998.
*/
public class DataInputStream extends FilterInputStream implements DataInput
diff --git a/libjava/java/io/DataOutput.java b/libjava/java/io/DataOutput.java
index e07eb628969..70fb7d48c69 100644
--- a/libjava/java/io/DataOutput.java
+++ b/libjava/java/io/DataOutput.java
@@ -1,5 +1,5 @@
/* DataOutput.java -- Interface for writing data from a stream
- Copyright (C) 1998, 1999, 2001, 2003 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2001, 2003, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -49,7 +49,7 @@ package java.io;
* by classes implementing the <code>DataInput</code> interface.
*
* @author Aaron M. Renn (arenn@urbanophile.com)
- * @author Tom Tromey <tromey@cygnus.com>
+ * @author Tom Tromey (tromey@cygnus.com)
*
* @see DataInput
*/
diff --git a/libjava/java/io/DataOutputStream.java b/libjava/java/io/DataOutputStream.java
index ab2db95df99..9a2d172ac46 100644
--- a/libjava/java/io/DataOutputStream.java
+++ b/libjava/java/io/DataOutputStream.java
@@ -1,5 +1,5 @@
/* DataOutputStream.java -- Writes primitive Java datatypes to streams
- Copyright (C) 1998, 2001, 2003 Free Software Foundation, Inc.
+ Copyright (C) 1998, 2001, 2003, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -51,8 +51,8 @@ package java.io;
*
* @see DataInputStream
*
- * @author Aaron M. Renn <arenn@urbanophile.com>
- * @author Tom Tromey <tromey@cygnus.com>
+ * @author Aaron M. Renn (arenn@urbanophile.com)
+ * @author Tom Tromey (tromey@cygnus.com)
*/
public class DataOutputStream extends FilterOutputStream implements DataOutput
{
diff --git a/libjava/java/io/EOFException.java b/libjava/java/io/EOFException.java
index d129cd69249..2ec28c6c8ee 100644
--- a/libjava/java/io/EOFException.java
+++ b/libjava/java/io/EOFException.java
@@ -1,5 +1,5 @@
/* EOFException.java -- unexpected end of file exception
- Copyright (C) 1998, 1999, 2001, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2001, 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -47,7 +47,7 @@ package java.io;
* thus throw this exception.
*
* @author Aaron M. Renn (arenn@urbanophile.com)
- * @author Tom Tromey <tromey@cygnus.com>
+ * @author Tom Tromey (tromey@cygnus.com)
* @status updated to 1.4
*/
public class EOFException extends IOException
diff --git a/libjava/java/io/Externalizable.java b/libjava/java/io/Externalizable.java
index 09080a05831..71304e24abf 100644
--- a/libjava/java/io/Externalizable.java
+++ b/libjava/java/io/Externalizable.java
@@ -60,8 +60,6 @@ package java.io;
*/
public interface Externalizable extends Serializable
{
- long serialVersionUID = -282491828744381764L;
-
/**
* This method restores an object's state by reading in the instance data
* for the object from the passed in stream. Note that this stream is not
diff --git a/libjava/java/io/FileDescriptor.java b/libjava/java/io/FileDescriptor.java
index e3c1a18bd9f..1e44a60bb99 100644
--- a/libjava/java/io/FileDescriptor.java
+++ b/libjava/java/io/FileDescriptor.java
@@ -120,7 +120,7 @@ public final class FileDescriptor
if (ex instanceof SyncFailedException)
throw (SyncFailedException) ex;
else
- throw new SyncFailedException(ex.getMessage());
+ throw new SyncFailedException(ex.toString());
}
}
}
diff --git a/libjava/java/io/FileInputStream.java b/libjava/java/io/FileInputStream.java
index 908c00a19b9..17aaf799be0 100644
--- a/libjava/java/io/FileInputStream.java
+++ b/libjava/java/io/FileInputStream.java
@@ -1,5 +1,5 @@
/* FileInputStream.java -- An input stream that reads from disk files.
- Copyright (C) 1998, 2002, 2003, 2004 Free Software Foundation, Inc.
+ Copyright (C) 1998, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -51,8 +51,8 @@ import java.nio.channels.FileChannel;
/**
* This class is a stream that reads its bytes from a file.
*
- * @author Aaron M. Renn <arenn@urbanophile.com>
- * @author Warren Levy <warrenl@cygnus.com>
+ * @author Aaron M. Renn (arenn@urbanophile.com)
+ * @author Warren Levy (warrenl@cygnus.com)
*/
public class FileInputStream extends InputStream
{
diff --git a/libjava/java/io/FileNotFoundException.java b/libjava/java/io/FileNotFoundException.java
index 7877aba150d..66809f5e7bb 100644
--- a/libjava/java/io/FileNotFoundException.java
+++ b/libjava/java/io/FileNotFoundException.java
@@ -1,5 +1,5 @@
/* FileNotFoundException.java -- the requested file could not be found
- Copyright (C) 1998, 1999, 2001, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2001, 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -43,8 +43,8 @@ package java.io;
* does not exist, or is inaccessible for some other reason (such as writing
* a read-only file).
*
- * @author Aaron M. Renn <arenn@urbanophile.com>
- * @author Tom Tromey <tromey@cygnus.com>
+ * @author Aaron M. Renn (arenn@urbanophile.com)
+ * @author Tom Tromey (tromey@cygnus.com)
* @status updated to 1.4
*/
public class FileNotFoundException extends IOException
diff --git a/libjava/java/io/FileOutputStream.java b/libjava/java/io/FileOutputStream.java
index 1702ffe8f54..34b06cbf151 100644
--- a/libjava/java/io/FileOutputStream.java
+++ b/libjava/java/io/FileOutputStream.java
@@ -1,5 +1,5 @@
/* FileOutputStream.java -- Writes to a file on disk.
- Copyright (C) 1998, 2001, 2003, 2004 Free Software Foundation, Inc.
+ Copyright (C) 1998, 2001, 2003, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -51,8 +51,8 @@ import java.nio.channels.FileChannel;
* This classes allows a stream of data to be written to a disk file or
* any open <code>FileDescriptor</code>.
*
- * @author Aaron M. Renn <arenn@urbanophile.com>
- * @author Tom Tromey <tromey@cygnus.com>
+ * @author Aaron M. Renn (arenn@urbanophile.com)
+ * @author Tom Tromey (tromey@cygnus.com)
*/
public class FileOutputStream extends OutputStream
{
diff --git a/libjava/java/io/FilenameFilter.java b/libjava/java/io/FilenameFilter.java
index e3b004d5499..dad3ccf28af 100644
--- a/libjava/java/io/FilenameFilter.java
+++ b/libjava/java/io/FilenameFilter.java
@@ -1,5 +1,5 @@
/* FilenameFilter.java -- Filter a list of filenames
- Copyright (C) 1998, 1999, 2001, 2003 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2001, 2003, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -53,7 +53,7 @@ package java.io;
* or should not be included in the file listing.
*
* @author Aaron M. Renn (arenn@urbanophile.com)
- * @author Tom Tromey <tromey@cygnus.com>
+ * @author Tom Tromey (tromey@cygnus.com)
*
* @see File#listFiles(java.io.FilenameFilter)
* @see java.awt.FileDialog#setFilenameFilter(java.io.FilenameFilter)
diff --git a/libjava/java/io/FilterInputStream.java b/libjava/java/io/FilterInputStream.java
index c81259bd25b..477521aa816 100644
--- a/libjava/java/io/FilterInputStream.java
+++ b/libjava/java/io/FilterInputStream.java
@@ -1,5 +1,5 @@
/* FilterInputStream.java -- Base class for classes that filter input
- Copyright (C) 1998, 1999, 2001 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2001, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -65,7 +65,7 @@ package java.io;
* <code>InputStream read(byte[])</code> method.
*
* @author Aaron M. Renn (arenn@urbanophile.com)
- * @author Warren Levy <warrenl@cygnus.com>
+ * @author Warren Levy (warrenl@cygnus.com)
*/
public class FilterInputStream extends InputStream
{
diff --git a/libjava/java/io/FilterOutputStream.java b/libjava/java/io/FilterOutputStream.java
index 2144213f0e1..98db4ac12c9 100644
--- a/libjava/java/io/FilterOutputStream.java
+++ b/libjava/java/io/FilterOutputStream.java
@@ -1,5 +1,5 @@
/* FilterOutputStream.java -- Parent class for output streams that filter
- Copyright (C) 1998, 1999, 2001, 2003 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2001, 2003, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -52,7 +52,7 @@ package java.io;
* underlying stream. Subclasses provide actual filtering.
*
* @author Aaron M. Renn (arenn@urbanophile.com)
- * @author Tom Tromey <tromey@cygnus.com>
+ * @author Tom Tromey (tromey@cygnus.com)
*/
public class FilterOutputStream extends OutputStream
{
diff --git a/libjava/java/io/FilterReader.java b/libjava/java/io/FilterReader.java
index caf102b082a..4cc6940c518 100644
--- a/libjava/java/io/FilterReader.java
+++ b/libjava/java/io/FilterReader.java
@@ -1,5 +1,5 @@
/* FilterReader.java -- Base class for char stream classes that filter input
- Copyright (C) 1998, 1999, 2001, 2003 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2001, 2003, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -59,7 +59,7 @@ package java.io;
* <code>Reader} read(yte[])</code> method.
*
* @author Aaron M. Renn (arenn@urbanophile.com)
- * @author Warren Levy <warrenl@cygnus.com>
+ * @author Warren Levy (warrenl@cygnus.com)
*/
public abstract class FilterReader extends Reader
{
diff --git a/libjava/java/io/FilterWriter.java b/libjava/java/io/FilterWriter.java
index a717092d859..5a8ede572db 100644
--- a/libjava/java/io/FilterWriter.java
+++ b/libjava/java/io/FilterWriter.java
@@ -1,5 +1,5 @@
/* FilterWriter.java -- Parent class for output streams that filter
- Copyright (C) 1998, 1999, 2001, 2003 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2001, 2003, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -52,7 +52,7 @@ package java.io;
* underlying stream. Subclasses provide actual filtering.
*
* @author Aaron M. Renn (arenn@urbanophile.com)
- * @author Tom Tromey <tromey@cygnus.com>
+ * @author Tom Tromey (tromey@cygnus.com)
*/
public abstract class FilterWriter extends Writer
{
diff --git a/libjava/java/io/IOException.java b/libjava/java/io/IOException.java
index 8baf593c9c2..f1e3848da4a 100644
--- a/libjava/java/io/IOException.java
+++ b/libjava/java/io/IOException.java
@@ -1,5 +1,5 @@
/* IOException.java -- Generic input/output exception
- Copyright (C) 1998, 1999, 2001, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2001, 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -45,7 +45,7 @@ package java.io;
* detailed indication of what happened.
*
* @author Aaron M. Renn (arenn@urbanophile.com)
- * @author Tom Tromey <tromey@cygnus.com>
+ * @author Tom Tromey (tromey@cygnus.com)
* @status updated to 1.4
*/
public class IOException extends Exception
diff --git a/libjava/java/io/InputStream.java b/libjava/java/io/InputStream.java
index 610ccf1f177..1d942446711 100644
--- a/libjava/java/io/InputStream.java
+++ b/libjava/java/io/InputStream.java
@@ -1,5 +1,5 @@
/* InputStream.java -- Base class for input
- Copyright (C) 1998, 1999, 2001 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2001, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -46,7 +46,7 @@ package java.io;
* or network connection.
*
* @author Aaron M. Renn (arenn@urbanophile.com)
- * @author Warren Levy <warrenl@cygnus.com>
+ * @author Warren Levy (warrenl@cygnus.com)
*/
public abstract class InputStream
{
diff --git a/libjava/java/io/InputStreamReader.java b/libjava/java/io/InputStreamReader.java
index 3ebbb4ec9e4..b3f65368ce3 100644
--- a/libjava/java/io/InputStreamReader.java
+++ b/libjava/java/io/InputStreamReader.java
@@ -1,5 +1,5 @@
/* InputStreamReader.java -- Reader than transforms bytes to chars
- Copyright (C) 1998, 1999, 2001, 2003, 2004 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2001, 2003, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -82,7 +82,7 @@ import gnu.gcj.convert.*;
* @see InputStream
*
* @author Aaron M. Renn (arenn@urbanophile.com)
- * @author Per Bothner <bothner@cygnus.com>
+ * @author Per Bothner (bothner@cygnus.com)
* @date April 22, 1998.
*/
public class InputStreamReader extends Reader
@@ -282,11 +282,9 @@ public class InputStreamReader extends Reader
{
// We have knowledge of the internals of BufferedInputStream
// here. Eww.
- in.mark (0);
// BufferedInputStream.refill() can only be called when
// `pos>=count'.
boolean r = in.pos < in.count || in.refill ();
- in.reset ();
if (! r)
return -1;
converter.setInput(in.buf, in.pos, in.count);
diff --git a/libjava/java/io/InterruptedIOException.java b/libjava/java/io/InterruptedIOException.java
index 321c2697b43..614fb3b8947 100644
--- a/libjava/java/io/InterruptedIOException.java
+++ b/libjava/java/io/InterruptedIOException.java
@@ -1,5 +1,5 @@
/* InterruptedIOException.java -- an I/O operation was interrupted
- Copyright (C) 1998, 1999, 2001, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2001, 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -43,8 +43,8 @@ package java.io;
* for some reason. The field bytesTransferred will contain the number of
* bytes that were read/written prior to the interruption.
*
- * @author Aaron M. Renn <arenn@urbanophile.com>
- * @author Tom Tromey <tromey@cygnus.com>
+ * @author Aaron M. Renn (arenn@urbanophile.com)
+ * @author Tom Tromey (tromey@cygnus.com)
* @see Thread#interrupt()
* @status updated to 1.4
*/
diff --git a/libjava/java/io/LineNumberInputStream.java b/libjava/java/io/LineNumberInputStream.java
index ee0ce2c799e..ae6292e9284 100644
--- a/libjava/java/io/LineNumberInputStream.java
+++ b/libjava/java/io/LineNumberInputStream.java
@@ -1,5 +1,5 @@
/* LineNumberInputStream.java -- An input stream which counts line numbers
- Copyright (C) 1998, 1999, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -67,7 +67,7 @@ package java.io;
* compatibility only and should not be used in new applications.
*
* @author Aaron M. Renn (arenn@urbanophile.com)
- * @author Warren Levy <warrenl@cygnus.com>
+ * @author Warren Levy (warrenl@cygnus.com)
*/
public class LineNumberInputStream extends FilterInputStream
{
diff --git a/libjava/java/io/LineNumberReader.java b/libjava/java/io/LineNumberReader.java
index b3cb5826930..0a4797bd6c1 100644
--- a/libjava/java/io/LineNumberReader.java
+++ b/libjava/java/io/LineNumberReader.java
@@ -1,5 +1,5 @@
/* LineNumberReader.java -- A character input stream which counts line numbers
- Copyright (C) 1998, 1999, 2001, 2003 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2001, 2003, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -52,9 +52,9 @@ package java.io;
* read from the stream does not end in a line termination sequence, it
* will not be counted as a line.
*
- * @author Per Bothner <bothner@cygnus.com>
+ * @author Per Bothner (bothner@cygnus.com)
* @author Aaron M. Renn (arenn@urbanophile.com)
- * @author Guilhem Lavaux <guilhem@kaffe.org>
+ * @author Guilhem Lavaux (guilhem@kaffe.org)
* @date December 28, 2003.
*/
/* Written using "Java Class Libraries", 2nd edition, plus online
diff --git a/libjava/java/io/ObjectInputStream.java b/libjava/java/io/ObjectInputStream.java
index 0c79d332700..2cfe4c99419 100644
--- a/libjava/java/io/ObjectInputStream.java
+++ b/libjava/java/io/ObjectInputStream.java
@@ -1,5 +1,6 @@
/* ObjectInputStream.java -- Class used to read serialized objects
- Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2005
+ Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -42,13 +43,14 @@ import gnu.classpath.Configuration;
import gnu.java.io.ObjectIdentityWrapper;
import java.lang.reflect.Array;
+import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.lang.reflect.Proxy;
-import java.security.PrivilegedAction;
import java.security.AccessController;
+import java.security.PrivilegedAction;
import java.util.Arrays;
import java.util.Hashtable;
import java.util.Vector;
@@ -121,15 +123,6 @@ public class ObjectInputStream extends InputStream
*/
public final Object readObject() throws ClassNotFoundException, IOException
{
- if (callersClassLoader == null)
- {
- callersClassLoader = getCallersClassLoader ();
- if (Configuration.DEBUG && dump)
- {
- dumpElementln ("CallersClassLoader = " + callersClassLoader);
- }
- }
-
if (this.useSubclassMethod)
return readObjectOverride();
@@ -271,7 +264,7 @@ public class ObjectInputStream extends InputStream
readArrayElements(array, componentType);
if(dump)
for (int i = 0, len = Array.getLength(array); i < len; i++)
- dumpElementln(" ELEMENT[" + i + "]=" + Array.get(array, i));
+ dumpElementln(" ELEMENT[" + i + "]=" + Array.get(array, i));
ret_val = processResolution(null, array, handle);
break;
}
@@ -301,13 +294,18 @@ public class ObjectInputStream extends InputStream
obj.readExternal(this);
if (read_from_blocks)
- setBlockDataMode(oldmode);
+ {
+ setBlockDataMode(oldmode);
+ if (!oldmode)
+ if (this.realInputStream.readByte() != TC_ENDBLOCKDATA)
+ throw new IOException("No end of block data seen for class with readExternal (ObjectInputStream) method.");
+ }
ret_val = processResolution(osc, obj, handle);
break;
} // end if (osc.realClassIsExternalizable)
- Object obj = newObject(clazz, osc.firstNonSerializableParent);
+ Object obj = newObject(clazz, osc.firstNonSerializableParentConstructor);
int handle = assignNewHandle(obj);
Object prevObject = this.currentObject;
@@ -398,8 +396,6 @@ public class ObjectInputStream extends InputStream
setBlockDataMode(old_mode);
this.isDeserializing = was_deserializing;
-
- depth -= 2;
depth -= 2;
@@ -505,7 +501,8 @@ public class ObjectInputStream extends InputStream
flags, fields);
assignNewHandle(osc);
- ClassLoader currentLoader = currentLoader();
+ if (callersClassLoader == null)
+ callersClassLoader = currentLoader();
for (int i = 0; i < field_count; i++)
{
@@ -526,12 +523,40 @@ public class ObjectInputStream extends InputStream
class_name = String.valueOf(type_code);
fields[i] =
- new ObjectStreamField(field_name, class_name, currentLoader);
+ new ObjectStreamField(field_name, class_name, callersClassLoader);
}
/* Now that fields have been read we may resolve the class
* (and read annotation if needed). */
- Class clazz = resolveClass(osc);
+ Class clazz;
+ try
+ {
+ clazz = resolveClass(osc);
+ }
+ catch (ClassNotFoundException cnfe)
+ {
+ // Maybe it was an primitive class?
+ if (name.equals("void"))
+ clazz = Void.TYPE;
+ else if (name.equals("boolean"))
+ clazz = Boolean.TYPE;
+ else if (name.equals("byte"))
+ clazz = Byte.TYPE;
+ else if (name.equals("short"))
+ clazz = Short.TYPE;
+ else if (name.equals("char"))
+ clazz = Character.TYPE;
+ else if (name.equals("int"))
+ clazz = Integer.TYPE;
+ else if (name.equals("long"))
+ clazz = Long.TYPE;
+ else if (name.equals("float"))
+ clazz = Float.TYPE;
+ else if (name.equals("double"))
+ clazz = Double.TYPE;
+ else
+ throw cnfe;
+ }
boolean oldmode = setBlockDataMode(true);
osc.setClass(clazz, lookupClass(clazz.getSuperclass()));
@@ -541,16 +566,45 @@ public class ObjectInputStream extends InputStream
// find the first non-serializable, non-abstract
// class in clazz's inheritance hierarchy
Class first_nonserial = clazz.getSuperclass();
- while (Serializable.class.isAssignableFrom(first_nonserial)
- || Modifier.isAbstract(first_nonserial.getModifiers()))
+ // Maybe it is a primitive class, those don't have a super class,
+ // or Object itself. Otherwise we can keep getting the superclass
+ // till we hit the Object class, or some other non-serializable class.
+
+ if (first_nonserial == null)
+ first_nonserial = clazz;
+ else
+ while (Serializable.class.isAssignableFrom(first_nonserial)
+ || Modifier.isAbstract(first_nonserial.getModifiers()))
first_nonserial = first_nonserial.getSuperclass();
- osc.firstNonSerializableParent = first_nonserial;
+ final Class local_constructor_class = first_nonserial;
+
+ osc.firstNonSerializableParentConstructor =
+ (Constructor)AccessController.doPrivileged(new PrivilegedAction()
+ {
+ public Object run()
+ {
+ try
+ {
+ Constructor c = local_constructor_class.
+ getDeclaredConstructor(new Class[0]);
+ if (Modifier.isPrivate(c.getModifiers()))
+ return null;
+ return c;
+ }
+ catch (NoSuchMethodException e)
+ {
+ // error will be reported later, in newObject()
+ return null;
+ }
+ }
+ });
+
osc.realClassIsSerializable = Serializable.class.isAssignableFrom(clazz);
osc.realClassIsExternalizable = Externalizable.class.isAssignableFrom(clazz);
ObjectStreamField[] stream_fields = osc.fields;
- ObjectStreamField[] real_fields = ObjectStreamClass.lookup(clazz).fields;
+ ObjectStreamField[] real_fields = ObjectStreamClass.lookupForClassObject(clazz).fields;
ObjectStreamField[] fieldmapping = new ObjectStreamField[2 * Math.max(stream_fields.length, real_fields.length)];
int stream_idx = 0;
@@ -716,6 +770,15 @@ public class ObjectInputStream extends InputStream
protected Class resolveClass(ObjectStreamClass osc)
throws ClassNotFoundException, IOException
{
+ if (callersClassLoader == null)
+ {
+ callersClassLoader = currentLoader ();
+ if (Configuration.DEBUG && dump)
+ {
+ dumpElementln ("CallersClassLoader = " + callersClassLoader);
+ }
+ }
+
return Class.forName(osc.getName(), true, callersClassLoader);
}
@@ -749,8 +812,10 @@ public class ObjectInputStream extends InputStream
*/
private ObjectStreamClass lookupClass(Class clazz)
{
- ObjectStreamClass oclazz;
+ if (clazz == null)
+ return null;
+ ObjectStreamClass oclazz;
oclazz = (ObjectStreamClass)classLookupTable.get(clazz);
if (oclazz == null)
return ObjectStreamClass.lookup(clazz);
@@ -1766,14 +1831,14 @@ public class ObjectInputStream extends InputStream
// returns a new instance of REAL_CLASS that has been constructed
// only to the level of CONSTRUCTOR_CLASS (a super class of REAL_CLASS)
- private Object newObject (Class real_class, Class constructor_class)
- throws ClassNotFoundException
+ private Object newObject (Class real_class, Constructor constructor)
+ throws ClassNotFoundException, IOException
{
+ if (constructor == null)
+ throw new InvalidClassException("Missing accessible no-arg base class constructor for " + real_class.getName());
try
{
- Object obj = allocateObject (real_class);
- callConstructor (constructor_class, obj);
- return obj;
+ return allocateObject(real_class, constructor.getDeclaringClass(), constructor);
}
catch (InstantiationException e)
{
@@ -1808,10 +1873,7 @@ public class ObjectInputStream extends InputStream
* @param sm SecurityManager instance which should be called.
* @return The current class loader in the calling stack.
*/
-
private static native ClassLoader currentClassLoader (SecurityManager sm);
-
- private native ClassLoader getCallersClassLoader();
private void callReadMethod (Method readObject, Class klass, Object obj)
throws ClassNotFoundException, IOException
@@ -1844,11 +1906,9 @@ public class ObjectInputStream extends InputStream
prereadFields = null;
}
- private native Object allocateObject (Class clazz)
+ private native Object allocateObject(Class clazz, Class constr_clazz, Constructor constructor)
throws InstantiationException;
- private native void callConstructor (Class clazz, Object obj);
-
private static final int BUFFER_SIZE = 1024;
private DataInputStream realInputStream;
@@ -1870,15 +1930,14 @@ public class ObjectInputStream extends InputStream
private Hashtable classLookupTable;
private GetField prereadFields;
- private static boolean dump = false && Configuration.DEBUG;
-
private ClassLoader callersClassLoader;
+ private static boolean dump;
// The nesting depth for debugging output
private int depth = 0;
private void dumpElement (String msg)
- {
+ {
System.out.print(msg);
}
@@ -1897,24 +1956,24 @@ public class ObjectInputStream extends InputStream
System.loadLibrary ("javaio");
}
}
-}
-
-
-// used to keep a prioritized list of object validators
-class ValidatorAndPriority implements Comparable
-{
- int priority;
- ObjectInputValidation validator;
-
- ValidatorAndPriority (ObjectInputValidation validator, int priority)
- {
- this.priority = priority;
- this.validator = validator;
- }
- public int compareTo (Object o)
+ // used to keep a prioritized list of object validators
+ private static final class ValidatorAndPriority implements Comparable
{
- ValidatorAndPriority vap = (ValidatorAndPriority)o;
- return this.priority - vap.priority;
+ int priority;
+ ObjectInputValidation validator;
+
+ ValidatorAndPriority (ObjectInputValidation validator, int priority)
+ {
+ this.priority = priority;
+ this.validator = validator;
+ }
+
+ public int compareTo (Object o)
+ {
+ ValidatorAndPriority vap = (ValidatorAndPriority)o;
+ return this.priority - vap.priority;
+ }
}
}
+
diff --git a/libjava/java/io/ObjectOutputStream.java b/libjava/java/io/ObjectOutputStream.java
index 3482225232a..55763eeddfe 100644
--- a/libjava/java/io/ObjectOutputStream.java
+++ b/libjava/java/io/ObjectOutputStream.java
@@ -250,6 +250,11 @@ public class ObjectOutputStream extends OutputStream
break;
}
+ Class clazz = obj.getClass();
+ ObjectStreamClass osc = ObjectStreamClass.lookupForClassObject(clazz);
+ if (osc == null)
+ throw new NotSerializableException(clazz.getName());
+
if ((replacementEnabled || obj instanceof Serializable)
&& ! replaceDone)
{
@@ -257,19 +262,11 @@ public class ObjectOutputStream extends OutputStream
if (obj instanceof Serializable)
{
- Method m = null;
try
{
- Class classArgs[] = {};
- m = getMethod(obj.getClass(), "writeReplace",
- classArgs);
- // m can't be null by definition since an
- // exception would have been thrown so a check
- // for null is not needed.
- obj = m.invoke(obj, new Object[] {});
- }
- catch (NoSuchMethodException ignore)
- {
+ Method m = osc.writeReplaceMethod;
+ if (m != null)
+ obj = m.invoke(obj, new Object[0]);
}
catch (IllegalAccessException ignore)
{
@@ -294,11 +291,6 @@ public class ObjectOutputStream extends OutputStream
break;
}
- Class clazz = obj.getClass();
- ObjectStreamClass osc = ObjectStreamClass.lookupForClassObject(clazz);
- if (osc == null)
- throw new NotSerializableException(clazz.getName());
-
if (clazz.isArray ())
{
realOutput.writeByte(TC_ARRAY);
@@ -347,8 +339,8 @@ public class ObjectOutputStream extends OutputStream
fieldsAlreadyWritten = false;
if (currentObjectStreamClass.hasWriteMethod())
{
- if (dump)
- dumpElementln ("WRITE METHOD CALLED FOR: " + obj);
+ if (dump)
+ dumpElementln ("WRITE METHOD CALLED FOR: " + obj);
setBlockDataMode(true);
callWriteMethod(obj, currentObjectStreamClass);
setBlockDataMode(false);
@@ -358,10 +350,10 @@ public class ObjectOutputStream extends OutputStream
}
else
{
- if (dump)
- dumpElementln ("WRITE FIELDS CALLED FOR: " + obj);
- writeFields(obj, currentObjectStreamClass);
- }
+ if (dump)
+ dumpElementln ("WRITE FIELDS CALLED FOR: " + obj);
+ writeFields(obj, currentObjectStreamClass);
+ }
}
this.currentObject = prevObject;
@@ -1261,18 +1253,11 @@ public class ObjectOutputStream extends OutputStream
private void callWriteMethod(Object obj, ObjectStreamClass osc)
throws IOException
{
- Class klass = osc.forClass();
currentPutField = null;
try
{
- Class classArgs[] = {ObjectOutputStream.class};
- Method m = getMethod(klass, "writeObject", classArgs);
- Object args[] = {this};
- m.invoke(obj, args);
- }
- catch (NoSuchMethodException nsme)
- {
- // Nothing.
+ Object args[] = {this};
+ osc.writeObjectMethod.invoke(obj, args);
}
catch (InvocationTargetException x)
{
@@ -1285,7 +1270,8 @@ public class ObjectOutputStream extends OutputStream
IOException ioe
= new IOException("Exception thrown from writeObject() on " +
- klass + ": " + exception.getClass().getName());
+ osc.forClass().getName() + ": " +
+ exception.getClass().getName());
ioe.initCause(exception);
throw ioe;
}
@@ -1293,7 +1279,8 @@ public class ObjectOutputStream extends OutputStream
{
IOException ioe
= new IOException("Failure invoking writeObject() on " +
- klass + ": " + x.getClass().getName());
+ osc.forClass().getName() + ": " +
+ x.getClass().getName());
ioe.initCause(x);
throw ioe;
}
@@ -1535,15 +1522,6 @@ public class ObjectOutputStream extends OutputStream
}
}
- private Method getMethod (Class klass, String name, Class[] args)
- throws java.lang.NoSuchMethodException
- {
- final Method m = klass.getDeclaredMethod(name, args);
- setAccessible.setMember(m);
- AccessController.doPrivileged(setAccessible);
- return m;
- }
-
private void dumpElementln (String msg)
{
for (int i = 0; i < depth; i++)
diff --git a/libjava/java/io/ObjectStreamClass.java b/libjava/java/io/ObjectStreamClass.java
index d133afc08f9..a5f6ea0be5e 100644
--- a/libjava/java/io/ObjectStreamClass.java
+++ b/libjava/java/io/ObjectStreamClass.java
@@ -452,27 +452,33 @@ public class ObjectStreamClass implements Serializable
}
private Method findMethod(Method[] methods, String name, Class[] params,
- Class returnType)
+ Class returnType, boolean mustBePrivate)
{
outer:
- for(int i = 0; i < methods.length; i++)
+ for (int i = 0; i < methods.length; i++)
{
- if(methods[i].getName().equals(name) &&
- methods[i].getReturnType() == returnType)
+ final Method m = methods[i];
+ int mods = m.getModifiers();
+ if (Modifier.isStatic(mods)
+ || (mustBePrivate && !Modifier.isPrivate(mods)))
+ {
+ continue;
+ }
+
+ if (m.getName().equals(name)
+ && m.getReturnType() == returnType)
{
- Class[] mp = methods[i].getParameterTypes();
- if(mp.length == params.length)
+ Class[] mp = m.getParameterTypes();
+ if (mp.length == params.length)
{
- for(int j = 0; j < mp.length; j++)
+ for (int j = 0; j < mp.length; j++)
{
- if(mp[j] != params[j])
+ if (mp[j] != params[j])
{
continue outer;
}
}
- final Method m = methods[i];
- SetAccessibleAction setAccessible = new SetAccessibleAction(m);
- AccessController.doPrivileged(setAccessible);
+ AccessController.doPrivileged(new SetAccessibleAction(m));
return m;
}
}
@@ -485,9 +491,14 @@ outer:
Method[] methods = forClass().getDeclaredMethods();
readObjectMethod = findMethod(methods, "readObject",
new Class[] { ObjectInputStream.class },
- Void.TYPE);
+ Void.TYPE, true);
+ writeObjectMethod = findMethod(methods, "writeObject",
+ new Class[] { ObjectOutputStream.class },
+ Void.TYPE, true);
readResolveMethod = findMethod(methods, "readResolve",
- new Class[0], Object.class);
+ new Class[0], Object.class, false);
+ writeReplaceMethod = findMethod(methods, "writeReplace",
+ new Class[0], Object.class, false);
}
private ObjectStreamClass(Class cl)
@@ -517,20 +528,8 @@ outer:
// only set this bit if CL is NOT Externalizable
flags |= ObjectStreamConstants.SC_SERIALIZABLE;
- try
- {
- Method writeMethod = cl.getDeclaredMethod("writeObject",
- writeMethodArgTypes);
- int modifiers = writeMethod.getModifiers();
-
- if (writeMethod.getReturnType() == Void.TYPE
- && Modifier.isPrivate(modifiers)
- && !Modifier.isStatic(modifiers))
- flags |= ObjectStreamConstants.SC_WRITE_METHOD;
- }
- catch(NoSuchMethodException oh_well)
- {
- }
+ if (writeObjectMethod != null)
+ flags |= ObjectStreamConstants.SC_WRITE_METHOD;
}
@@ -851,11 +850,11 @@ outer:
{
return (Externalizable)constructor.newInstance(null);
}
- catch(Throwable t)
+ catch(Exception x)
{
throw (InvalidClassException)
new InvalidClassException(clazz.getName(),
- "Unable to instantiate").initCause(t);
+ "Unable to instantiate").initCause(x);
}
}
@@ -884,10 +883,12 @@ outer:
Method readObjectMethod;
Method readResolveMethod;
+ Method writeReplaceMethod;
+ Method writeObjectMethod;
boolean realClassIsSerializable;
boolean realClassIsExternalizable;
ObjectStreamField[] fieldMapping;
- Class firstNonSerializableParent;
+ Constructor firstNonSerializableParentConstructor;
private Constructor constructor; // default constructor for Externalizable
boolean isProxyClass = false;
@@ -896,34 +897,33 @@ outer:
// but it will avoid showing up as a discrepancy when comparing SUIDs.
private static final long serialVersionUID = -6120832682080437368L;
-}
-
-// interfaces are compared only by name
-class InterfaceComparator implements Comparator
-{
- public int compare(Object o1, Object o2)
+ // interfaces are compared only by name
+ private static final class InterfaceComparator implements Comparator
{
- return ((Class) o1).getName().compareTo(((Class) o2).getName());
+ public int compare(Object o1, Object o2)
+ {
+ return ((Class) o1).getName().compareTo(((Class) o2).getName());
+ }
}
-}
-// Members (Methods and Constructors) are compared first by name,
-// conflicts are resolved by comparing type signatures
-class MemberComparator implements Comparator
-{
- public int compare(Object o1, Object o2)
+ // Members (Methods and Constructors) are compared first by name,
+ // conflicts are resolved by comparing type signatures
+ private static final class MemberComparator implements Comparator
{
- Member m1 = (Member) o1;
- Member m2 = (Member) o2;
+ public int compare(Object o1, Object o2)
+ {
+ Member m1 = (Member) o1;
+ Member m2 = (Member) o2;
- int comp = m1.getName().compareTo(m2.getName());
+ int comp = m1.getName().compareTo(m2.getName());
- if (comp == 0)
- return TypeSignature.getEncodingOfMember(m1).
- compareTo(TypeSignature.getEncodingOfMember(m2));
- else
- return comp;
+ if (comp == 0)
+ return TypeSignature.getEncodingOfMember(m1).
+ compareTo(TypeSignature.getEncodingOfMember(m2));
+ else
+ return comp;
+ }
}
}
diff --git a/libjava/java/io/ObjectStreamException.java b/libjava/java/io/ObjectStreamException.java
index da1ca46e662..fa2c78021c2 100644
--- a/libjava/java/io/ObjectStreamException.java
+++ b/libjava/java/io/ObjectStreamException.java
@@ -1,5 +1,5 @@
/* ObjectStreamException.java -- Superclass of all serialization exceptions
- Copyright (C) 1998, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
+ Copyright (C) 1998, 2000, 2001, 2002, 2003, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -44,7 +44,7 @@ package java.io;
* indications of the precise failure.
*
* @author Aaron M. Renn (arenn@urbanophile.com)
- * @author Warren Levy <warrenl@cygnus.com>
+ * @author Warren Levy (warrenl@cygnus.com)
* @since 1.1
* @status updated to 1.4
*/
diff --git a/libjava/java/io/ObjectStreamField.java b/libjava/java/io/ObjectStreamField.java
index 93a121cd762..8c1a5db7b59 100644
--- a/libjava/java/io/ObjectStreamField.java
+++ b/libjava/java/io/ObjectStreamField.java
@@ -367,109 +367,46 @@ public class ObjectStreamField implements Comparable
final void setBooleanField(Object obj, boolean val)
{
- try
- {
- field.setBoolean(obj, val);
- }
- catch(IllegalAccessException x)
- {
- throw new InternalError(x.getMessage());
- }
+ VMObjectStreamClass.setBooleanNative(field, obj, val);
}
final void setByteField(Object obj, byte val)
{
- try
- {
- field.setByte(obj, val);
- }
- catch(IllegalAccessException x)
- {
- throw new InternalError(x.getMessage());
- }
+ VMObjectStreamClass.setByteNative(field, obj, val);
}
final void setCharField(Object obj, char val)
{
- try
- {
- field.setChar(obj, val);
- }
- catch(IllegalAccessException x)
- {
- throw new InternalError(x.getMessage());
- }
+ VMObjectStreamClass.setCharNative(field, obj, val);
}
final void setShortField(Object obj, short val)
{
- try
- {
- field.setShort(obj, val);
- }
- catch(IllegalAccessException x)
- {
- throw new InternalError(x.getMessage());
- }
+ VMObjectStreamClass.setShortNative(field, obj, val);
}
final void setIntField(Object obj, int val)
{
- try
- {
- field.setInt(obj, val);
- }
- catch(IllegalAccessException x)
- {
- throw new InternalError(x.getMessage());
- }
+ VMObjectStreamClass.setIntNative(field, obj, val);
}
final void setLongField(Object obj, long val)
{
- try
- {
- field.setLong(obj, val);
- }
- catch(IllegalAccessException x)
- {
- throw new InternalError(x.getMessage());
- }
+ VMObjectStreamClass.setLongNative(field, obj, val);
}
final void setFloatField(Object obj, float val)
{
- try
- {
- field.setFloat(obj, val);
- }
- catch(IllegalAccessException x)
- {
- throw new InternalError(x.getMessage());
- }
+ VMObjectStreamClass.setFloatNative(field, obj, val);
}
final void setDoubleField(Object obj, double val)
{
- try
- {
- field.setDouble(obj, val);
- }
- catch(IllegalAccessException x)
- {
- throw new InternalError(x.getMessage());
- }
+ VMObjectStreamClass.setDoubleNative(field, obj, val);
}
final void setObjectField(Object obj, Object val)
{
- try
- {
- field.set(obj, val);
- }
- catch(IllegalAccessException x)
- {
- throw new InternalError(x.getMessage());
- }
+ VMObjectStreamClass.setObjectNative(field, obj, val);
}
}
diff --git a/libjava/java/io/OptionalDataException.java b/libjava/java/io/OptionalDataException.java
index 919c2bf0f4d..858302c0486 100644
--- a/libjava/java/io/OptionalDataException.java
+++ b/libjava/java/io/OptionalDataException.java
@@ -1,5 +1,5 @@
/* OptionalDataException.java -- indicates unexpected data in serialized stream
- Copyright (C) 1998, 2000, 2001, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1998, 2000, 2001, 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -50,7 +50,7 @@ package java.io;
* </ul>
*
* @author Aaron M. Renn (arenn@urbanophile.com)
- * @author Warren Levy <warrenl@cygnus.com>
+ * @author Warren Levy (warrenl@cygnus.com)
* @since 1.1
* @status updated to 1.4
*/
diff --git a/libjava/java/io/OutputStream.java b/libjava/java/io/OutputStream.java
index cee98644b0f..2b1a90a7508 100644
--- a/libjava/java/io/OutputStream.java
+++ b/libjava/java/io/OutputStream.java
@@ -1,5 +1,5 @@
/* OutputStream.java -- Base class for byte output streams
- Copyright (C) 1998, 1999, 2001 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2001, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -46,7 +46,7 @@ package java.io;
* destination such as a file on disk or network connection.
*
* @author Aaron M. Renn (arenn@urbanophile.com)
- * @author Tom Tromey <tromey@cygnus.com>
+ * @author Tom Tromey (tromey@cygnus.com)
*/
public abstract class OutputStream
{
diff --git a/libjava/java/io/OutputStreamWriter.java b/libjava/java/io/OutputStreamWriter.java
index a07470a7291..07050415aba 100644
--- a/libjava/java/io/OutputStreamWriter.java
+++ b/libjava/java/io/OutputStreamWriter.java
@@ -1,5 +1,5 @@
/* OutputStreamWriter.java -- Writer that converts chars to bytes
- Copyright (C) 1998, 1999, 2000, 2001, 2003 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2000, 2001, 2003, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -70,7 +70,7 @@ import gnu.gcj.convert.UnicodeToBytes;
* </ul>
*
* @author Aaron M. Renn (arenn@urbanophile.com)
- * @author Per Bothner <bothner@cygnus.com>
+ * @author Per Bothner (bothner@cygnus.com)
* @date April 17, 1998.
*/
public class OutputStreamWriter extends Writer
diff --git a/libjava/java/io/PipedInputStream.java b/libjava/java/io/PipedInputStream.java
index 906ef10fa9f..d424587889a 100644
--- a/libjava/java/io/PipedInputStream.java
+++ b/libjava/java/io/PipedInputStream.java
@@ -1,5 +1,5 @@
/* PipedInputStream.java -- Read portion of piped streams.
- Copyright (C) 1998, 1999, 2000, 2001, 2003 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2000, 2001, 2003, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -226,18 +226,17 @@ public class PipedInputStream extends InputStream
}
/**
- * This method reads bytes from the stream into a caller supplied buffer.
- * It starts storing bytes at position <code>offset</code> into the
- * buffer and
- * reads a maximum of <code>len</code> bytes. Note that this method
- * can actually
- * read fewer than <code>len</code> bytes. The actual number of bytes
- * read is
- * returned. A -1 is returned to indicated that no bytes can be read
+ * This method reads one byte from the stream.
+ * -1 is returned to indicated that no bytes can be read
* because the end of the stream was reached. If the stream is already
* closed, a -1 will again be returned to indicate the end of the stream.
- * <p>
- * This method will block if no byte is available to be read.
+ *
+ * <p>This method will block if no byte is available to be read.</p>
+ *
+ * @return the value of the read byte value, or -1 of the end of the stream
+ * was reached
+ *
+ * @throws IOException if an error occured
*/
public int read() throws IOException
{
@@ -248,7 +247,7 @@ public class PipedInputStream extends InputStream
// if this method is never called.
int r = read(read_buf, 0, 1);
- return r != -1 ? read_buf[0] : -1;
+ return r != -1 ? (read_buf[0] & 0xff) : -1;
}
/**
diff --git a/libjava/java/io/PrintStream.java b/libjava/java/io/PrintStream.java
index 3526473a4fd..02a126b000f 100644
--- a/libjava/java/io/PrintStream.java
+++ b/libjava/java/io/PrintStream.java
@@ -1,5 +1,5 @@
/* PrintStream.java -- OutputStream for printing output
- Copyright (C) 1998, 1999, 2001, 2003 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2001, 2003, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -55,8 +55,8 @@ import gnu.gcj.convert.UnicodeToBytes;
* <p>
* This class converts char's into byte's using the system default encoding.
*
- * @author Aaron M. Renn <arenn@urbanophile.com>
- * @author Tom Tromey <tromey@cygnus.com>
+ * @author Aaron M. Renn (arenn@urbanophile.com)
+ * @author Tom Tromey (tromey@cygnus.com)
*/
public class PrintStream extends FilterOutputStream
{
diff --git a/libjava/java/io/PrintWriter.java b/libjava/java/io/PrintWriter.java
index 376b3c44e7b..e03f2f85a87 100644
--- a/libjava/java/io/PrintWriter.java
+++ b/libjava/java/io/PrintWriter.java
@@ -54,8 +54,8 @@ package java.io;
* class which also auto-flushes when it encounters a newline character
* in the chars written).
*
- * @author Per Bothner <bothner@cygnus.com>
- * @author Aaron M. Renn <arenn@urbanophile.com>
+ * @author Per Bothner (bothner@cygnus.com)
+ * @author Aaron M. Renn (arenn@urbanophile.com)
* @date April 17, 1998.
*/
public class PrintWriter extends Writer
diff --git a/libjava/java/io/PushbackInputStream.java b/libjava/java/io/PushbackInputStream.java
index c07714ec61c..aedd7eb65ee 100644
--- a/libjava/java/io/PushbackInputStream.java
+++ b/libjava/java/io/PushbackInputStream.java
@@ -1,5 +1,5 @@
/* PushbackInputStream.java -- An input stream that can unread bytes
- Copyright (C) 1998, 1999, 2001, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2001, 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -49,7 +49,7 @@ package java.io;
* <p>
*
* @author Aaron M. Renn (arenn@urbanophile.com)
- * @author Warren Levy <warrenl@cygnus.com>
+ * @author Warren Levy (warrenl@cygnus.com)
*/
public class PushbackInputStream extends FilterInputStream
{
diff --git a/libjava/java/io/PushbackReader.java b/libjava/java/io/PushbackReader.java
index cc2473a6c34..05f343ed9aa 100644
--- a/libjava/java/io/PushbackReader.java
+++ b/libjava/java/io/PushbackReader.java
@@ -1,5 +1,5 @@
/* PushbackReader.java -- An character stream that can unread chars
- Copyright (C) 1998, 2000, 2001, 2003 Free Software Foundation, Inc.
+ Copyright (C) 1998, 2000, 2001, 2003, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -49,7 +49,7 @@ package java.io;
* by the creator of the stream.
*
* @author Aaron M. Renn (arenn@urbanophile.com)
- * @author Warren Levy <warrenl@cygnus.com>
+ * @author Warren Levy (warrenl@cygnus.com)
*/
public class PushbackReader extends FilterReader
{
diff --git a/libjava/java/io/RandomAccessFile.java b/libjava/java/io/RandomAccessFile.java
index 2b1e08599e8..c23ca3adf2e 100644
--- a/libjava/java/io/RandomAccessFile.java
+++ b/libjava/java/io/RandomAccessFile.java
@@ -1,5 +1,5 @@
/* RandomAccessFile.java -- Class supporting random file I/O
- Copyright (C) 1998, 1999, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -55,8 +55,8 @@ import java.nio.channels.FileChannel;
* <code>DataInput</code> and <code>DataOutput</code> interfaces to allow
* the reading and writing of Java primitives.
*
- * @author Aaron M. Renn <arenn@urbanophile.com>
- * @author Tom Tromey <tromey@cygnus.com>
+ * @author Aaron M. Renn (arenn@urbanophile.com)
+ * @author Tom Tromey (tromey@cygnus.com)
*/
public class RandomAccessFile implements DataOutput, DataInput
{
diff --git a/libjava/java/io/Reader.java b/libjava/java/io/Reader.java
index 18481ac697b..bb4494b431a 100644
--- a/libjava/java/io/Reader.java
+++ b/libjava/java/io/Reader.java
@@ -49,7 +49,7 @@ package java.io;
* methods to read characters from a particular input source such as a file
* or network connection.
*
- * @author Per Bothner <bothner@cygnus.com>
+ * @author Per Bothner (bothner@cygnus.com)
* @date April 21, 1998.
* @author Aaron M. Renn (arenn@urbanophile.com)
*/
diff --git a/libjava/java/io/SequenceInputStream.java b/libjava/java/io/SequenceInputStream.java
index e7b2f494c2a..a46b11d56aa 100644
--- a/libjava/java/io/SequenceInputStream.java
+++ b/libjava/java/io/SequenceInputStream.java
@@ -1,5 +1,5 @@
/* SequenceInputStream.java -- Reads multiple input streams in sequence
- Copyright (C) 1998, 1999, 2001 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2001, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -61,7 +61,7 @@ import java.util.Enumeration;
* to completion, all subordinate streams are closed.
*
* @author Aaron M. Renn (arenn@urbanophile.com)
- * @author Warren Levy <warrenl@cygnus.com>
+ * @author Warren Levy (warrenl@cygnus.com)
*/
public class SequenceInputStream extends InputStream
{
diff --git a/libjava/java/io/Serializable.java b/libjava/java/io/Serializable.java
index b6c47c4ccbd..1ca6638c874 100644
--- a/libjava/java/io/Serializable.java
+++ b/libjava/java/io/Serializable.java
@@ -1,5 +1,5 @@
/* Serializable.java -- Interface to indicate a class may be serialized
- Copyright (C) 1998, 1999, 2001 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2001, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -47,9 +47,8 @@ package java.io;
* the implementing class may be serialized.
*
* @author Aaron M. Renn (arenn@urbanophile.com)
- * @author Warren Levy <warrenl@cygnus.com>
+ * @author Warren Levy (warrenl@cygnus.com)
*/
public interface Serializable
{
- long serialVersionUID = 1196656838076753133L;
} // interface Serializable
diff --git a/libjava/java/io/StreamCorruptedException.java b/libjava/java/io/StreamCorruptedException.java
index 004047fb654..86002cbe8a6 100644
--- a/libjava/java/io/StreamCorruptedException.java
+++ b/libjava/java/io/StreamCorruptedException.java
@@ -1,5 +1,5 @@
/* StreamCorruptedException.java -- Error in stream during serialization
- Copyright (C) 1998, 2000, 2001, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1998, 2000, 2001, 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -43,7 +43,7 @@ package java.io;
* read from a stream during de-serialization.
*
* @author Aaron M. Renn (arenn@urbanophile.com)
- * @author Warren Levy <warrenl@cygnus.com>
+ * @author Warren Levy (warrenl@cygnus.com)
* @since 1.1
* @status updated to 1.4
*/
diff --git a/libjava/java/io/StreamTokenizer.java b/libjava/java/io/StreamTokenizer.java
index dd6acb3fd36..b5bd38f2d78 100644
--- a/libjava/java/io/StreamTokenizer.java
+++ b/libjava/java/io/StreamTokenizer.java
@@ -42,7 +42,7 @@ package java.io;
* million-zillion flags that can be set to control the parsing, as
* described under the various method headings.
*
- * @author Warren Levy <warrenl@cygnus.com>
+ * @author Warren Levy (warrenl@cygnus.com)
* @date October 25, 1998.
*/
/* Written using "Java Class Libraries", 2nd edition, ISBN 0-201-31002-3
diff --git a/libjava/java/io/StringBufferInputStream.java b/libjava/java/io/StringBufferInputStream.java
index 96dc4a382f3..4ed9a9f7190 100644
--- a/libjava/java/io/StringBufferInputStream.java
+++ b/libjava/java/io/StringBufferInputStream.java
@@ -1,5 +1,5 @@
/* StringBufferInputStream.java -- Read an String as a stream
- Copyright (C) 1998, 1999, 2001 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2001, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -65,7 +65,7 @@ package java.io;
* @deprecated
*
* @author Aaron M. Renn (arenn@urbanophile.com)
- * @author Warren Levy <warrenl@cygnus.com>
+ * @author Warren Levy (warrenl@cygnus.com)
*/
public class StringBufferInputStream extends InputStream
{
diff --git a/libjava/java/io/StringWriter.java b/libjava/java/io/StringWriter.java
index c5aab8d157c..7b6e14193cd 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, 2003 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2000, 2001, 2003, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -47,7 +47,7 @@ package java.io;
* can then be used to retrieve a <code>String</code>.
*
* @author Aaron M. Renn (arenn@urbanophile.com)
- * @author Tom Tromey <tromey@cygnus.com>
+ * @author Tom Tromey (tromey@cygnus.com)
*/
public class StringWriter extends Writer
{
diff --git a/libjava/java/io/SyncFailedException.java b/libjava/java/io/SyncFailedException.java
index a896ffb5e43..5563268ffd5 100644
--- a/libjava/java/io/SyncFailedException.java
+++ b/libjava/java/io/SyncFailedException.java
@@ -1,5 +1,5 @@
/* SyncFailedException.java -- a file sync failed
- Copyright (C) 1998, 1999, 2001, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2001, 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -42,7 +42,7 @@ package java.io;
* Thrown when a file synchronization fails.
*
* @author Aaron M. Renn (arenn@urbanophile.com)
- * @author Tom Tromey <tromey@cygnus.com>
+ * @author Tom Tromey (tromey@cygnus.com)
* @see FileDescriptor#sync()
* @since 1.1
* @status updated to 1.4
diff --git a/libjava/java/io/UTFDataFormatException.java b/libjava/java/io/UTFDataFormatException.java
index a38e25179f5..d4f2df253e4 100644
--- a/libjava/java/io/UTFDataFormatException.java
+++ b/libjava/java/io/UTFDataFormatException.java
@@ -1,5 +1,5 @@
/* UTFDataFormatException.java -- thrown on bad format in UTF data
- Copyright (C) 1998, 1999, 2001, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2001, 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -43,7 +43,7 @@ package java.io;
* to indicate that the data read is invalid.
*
* @author Aaron M. Renn (arenn@urbanophile.com)
- * @author Tom Tromey <tromey@cygnus.com>
+ * @author Tom Tromey (tromey@cygnus.com)
* @see DataInput
* @see DataInputStream#readUTF(DataInput)
* @status updated to 1.4
diff --git a/libjava/java/io/UnsupportedEncodingException.java b/libjava/java/io/UnsupportedEncodingException.java
index 8ee686bde03..5159fb2b246 100644
--- a/libjava/java/io/UnsupportedEncodingException.java
+++ b/libjava/java/io/UnsupportedEncodingException.java
@@ -1,5 +1,5 @@
/* UnsupportedEncodingException.java -- the requested encoding isn't supported
- Copyright (C) 1998, 1999, 2001, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2001, 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -43,7 +43,7 @@ package java.io;
* not supported.
*
* @author Aaron M. Renn (arenn@urbanophile.com)
- * @author Per Bothner <bothner@cygnus.com>
+ * @author Per Bothner (bothner@cygnus.com)
* @since 1.1
* @status updated to 1.4
*/
diff --git a/libjava/java/io/VMObjectStreamClass.java b/libjava/java/io/VMObjectStreamClass.java
index fd4023e402b..d21de72a130 100644
--- a/libjava/java/io/VMObjectStreamClass.java
+++ b/libjava/java/io/VMObjectStreamClass.java
@@ -38,7 +38,7 @@ exception statement from your version. */
package java.io;
-import java.lang.reflect.Method;
+import java.lang.reflect.Field;
final class VMObjectStreamClass
{
@@ -47,4 +47,94 @@ final class VMObjectStreamClass
* (a.k.a. <clinit>).
*/
static native boolean hasClassInitializer (Class clazz);
+
+ /**
+ * Sets the value of the specified "double" field, allowing final values
+ * to be assigned.
+ *
+ * @param field Field to set the value.
+ * @param obj Instance which will have its field set.
+ * @param val Value to put in the field.
+ */
+ static native void setDoubleNative(Field field, Object obj, double val);
+
+ /**
+ * Sets the value of the specified "float" field, allowing final values
+ * to be assigned.
+ *
+ * @param field Field to set the value.
+ * @param obj Instance which will have its field set.
+ * @param val Value to put in the field.
+ */
+ static native void setFloatNative(Field field, Object obj, float val);
+
+ /**
+ * Sets the value of the specified "long" field, allowing final values
+ * to be assigned.
+ *
+ * @param field Field to set the value.
+ * @param obj Instance which will have its field set.
+ * @param val Value to put in the field.
+ */
+ static native void setLongNative(Field field, Object obj, long val);
+
+ /**
+ * Sets the value of the specified "int" field, allowing final values
+ * to be assigned.
+ *
+ * @param field Field to set the value.
+ * @param obj Instance which will have its field set.
+ * @param val Value to put in the field.
+ */
+ static native void setIntNative(Field field, Object obj, int val);
+
+ /**
+ * Sets the value of the specified "short" field, allowing final values
+ * to be assigned.
+ *
+ * @param field Field to set the value.
+ * @param obj Instance which will have its field set.
+ * @param val Value to put in the field.
+ */
+ static native void setShortNative(Field field, Object obj, short val);
+
+ /**
+ * Sets the value of the specified "char" field, allowing final values
+ * to be assigned.
+ *
+ * @param field Field to set the value.
+ * @param obj Instance which will have its field set.
+ * @param val Value to put in the field.
+ */
+ static native void setCharNative(Field field, Object obj, char val);
+
+ /**
+ * Sets the value of the specified "byte" field, allowing final values
+ * to be assigned.
+ *
+ * @param field Field to set the value.
+ * @param obj Instance which will have its field set.
+ * @param val Value to put in the field.
+ */
+ static native void setByteNative(Field field, Object obj, byte val);
+
+ /**
+ * Sets the value of the specified "boolean" field, allowing final values
+ * to be assigned.
+ *
+ * @param field Field to set the value.
+ * @param obj Instance which will have its field set.
+ * @param val Value to put in the field.
+ */
+ static native void setBooleanNative(Field field, Object obj, boolean val);
+
+ /**
+ * Sets the value of the specified object field, allowing final values
+ * to be assigned.
+ *
+ * @param field Field to set the value.
+ * @param obj Instance which will have its field set.
+ * @param val Value to put in the field.
+ */
+ static native void setObjectNative(Field field, Object obj, Object val);
}
diff --git a/libjava/java/io/WriteAbortedException.java b/libjava/java/io/WriteAbortedException.java
index 7b683854d3d..a7787805f30 100644
--- a/libjava/java/io/WriteAbortedException.java
+++ b/libjava/java/io/WriteAbortedException.java
@@ -1,5 +1,5 @@
/* WriteAbortedException.java -- wraps an exception thrown while writing
- Copyright (C) 1998, 2000, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1998, 2000, 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -44,7 +44,7 @@ package java.io;
* objects are discarded.
*
* @author Aaron M. Renn (arenn@urbanophile.com)
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Eric Blake (ebb9@email.byu.edu)
* @since 1.1
* @status updated to 1.4
*/
diff --git a/libjava/java/io/Writer.java b/libjava/java/io/Writer.java
index 49b6315231e..4a69030a5e2 100644
--- a/libjava/java/io/Writer.java
+++ b/libjava/java/io/Writer.java
@@ -1,5 +1,5 @@
/* Writer.java -- Base class for character output streams
- Copyright (C) 1998, 1999, 2001, 2003, 2004 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2001, 2003, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -51,7 +51,7 @@ package java.io;
* destination such as a file on disk or network connection.
*
* @author Aaron M. Renn (arenn@urbanophile.com)
- * @author Per Bothner <bothner@cygnus.com>
+ * @author Per Bothner (bothner@cygnus.com)
*/
public abstract class Writer
{
diff --git a/libjava/java/io/natObjectInputStream.cc b/libjava/java/io/natObjectInputStream.cc
index 9da4910aa06..0e0d5a719cc 100644
--- a/libjava/java/io/natObjectInputStream.cc
+++ b/libjava/java/io/natObjectInputStream.cc
@@ -12,6 +12,7 @@ details. */
#include <gcj/cni.h>
#include <jvm.h>
+#include <gcj/method.h>
#include <java/io/ObjectInputStream$GetField.h>
#include <java/io/ObjectInputStream.h>
@@ -21,6 +22,8 @@ details. */
#include <java/lang/reflect/Method.h>
#include <java/lang/ArrayIndexOutOfBoundsException.h>
#include <java/lang/SecurityManager.h>
+#include <java/lang/reflect/Constructor.h>
+#include <java/lang/reflect/Method.h>
#ifdef DEBUG
#include <java/lang/System.h>
@@ -28,7 +31,8 @@ details. */
#endif
jobject
-java::io::ObjectInputStream::allocateObject (jclass klass)
+java::io::ObjectInputStream::allocateObject (jclass klass, jclass,
+ ::java::lang::reflect::Constructor *ctr)
{
jobject obj = NULL;
using namespace java::lang::reflect;
@@ -41,21 +45,15 @@ java::io::ObjectInputStream::allocateObject (jclass klass)
else
{
obj = _Jv_AllocObject (klass);
- }
+ }
}
catch (jthrowable t)
{
return NULL;
}
- return obj;
-}
-
+ jmethodID meth = _Jv_FromReflectedConstructor (ctr);
-void
-java::io::ObjectInputStream::callConstructor (jclass klass, jobject obj)
-{
- jstring init_name = JvNewStringLatin1 ("<init>");
// This is a bit inefficient, and a bit of a hack, since we don't
// actually use the Method and since what is returned isn't
// technically a Method. We can't use Method.invoke as it looks up
@@ -63,36 +61,12 @@ java::io::ObjectInputStream::callConstructor (jclass klass, jobject obj)
JArray<jclass> *arg_types
= (JArray<jclass> *) JvNewObjectArray (0, &java::lang::Class::class$,
NULL);
- java::lang::reflect::Method *m = klass->getPrivateMethod (init_name,
- arg_types);
+
// We lie about this being a constructor. If we put `true' here
// then _Jv_CallAnyMethodA would try to allocate the object for us.
- jmethodID meth = (jmethodID) ((char *) (klass->methods)
- + m->offset);
_Jv_CallAnyMethodA (obj, JvPrimClass (void), meth, false, arg_types, NULL);
-}
-java::lang::ClassLoader*
-java::io::ObjectInputStream::getCallersClassLoader ()
-{
- java::lang::ClassLoader *loader = NULL;
- gnu::gcj::runtime::StackTrace *t
- = new gnu::gcj::runtime::StackTrace(4);
- java::lang::Class *klass = NULL;
- try
- {
- for (int i = 2; !klass; i++)
- {
- klass = t->classAt (i);
- }
- loader = klass->getClassLoaderInternal();
- }
- catch (::java::lang::ArrayIndexOutOfBoundsException *e)
- {
- // FIXME: RuntimeError
- }
-
- return loader;
+ return obj;
}
java::lang::ClassLoader*
diff --git a/libjava/java/io/natVMObjectStreamClass.cc b/libjava/java/io/natVMObjectStreamClass.cc
index b7a056c457f..847b540f0be 100644
--- a/libjava/java/io/natVMObjectStreamClass.cc
+++ b/libjava/java/io/natVMObjectStreamClass.cc
@@ -13,11 +13,75 @@ details. */
#include <java/io/VMObjectStreamClass.h>
#include <java/lang/Class.h>
+#include <java/lang/reflect/Field.h>
+
+using namespace java::lang::reflect;
jboolean
java::io::VMObjectStreamClass::hasClassInitializer (jclass klass)
{
+ if (klass->isPrimitive())
+ return false;
_Jv_Method *meth = _Jv_GetMethodLocal(klass, gcj::clinit_name,
gcj::void_signature);
return (meth != NULL);
}
+
+void
+java::io::VMObjectStreamClass::setDoubleNative (Field *f, jobject obj,
+ jdouble val)
+{
+ f->setDouble (NULL, obj, val, false);
+}
+
+void
+java::io::VMObjectStreamClass::setFloatNative (Field *f, jobject obj,
+ jfloat val)
+{
+ f->setFloat (NULL, obj, val, false);
+}
+
+void
+java::io::VMObjectStreamClass::setLongNative (Field *f, jobject obj, jlong val)
+{
+ f->setLong (NULL, obj, val, false);
+}
+
+void
+java::io::VMObjectStreamClass::setIntNative (Field *f, jobject obj, jint val)
+{
+ f->setInt (NULL, obj, val, false);
+}
+
+void
+java::io::VMObjectStreamClass::setShortNative (Field *f, jobject obj,
+ jshort val)
+{
+ f->setShort (NULL, obj, val, false);
+}
+
+void
+java::io::VMObjectStreamClass::setCharNative (Field *f, jobject obj, jchar val)
+{
+ f->setChar (NULL, obj, val, false);
+}
+
+void
+java::io::VMObjectStreamClass::setByteNative (Field *f, jobject obj, jbyte val)
+{
+ f->setByte (NULL, obj, val, false);
+}
+
+void
+java::io::VMObjectStreamClass::setBooleanNative (Field *f, jobject obj,
+ jboolean val)
+{
+ f->setBoolean (NULL, obj, val, false);
+}
+
+void
+java::io::VMObjectStreamClass::setObjectNative (Field *f, jobject obj,
+ jobject val)
+{
+ f->set (NULL, obj, val, f->getType(), false);
+}
diff --git a/libjava/java/lang/AbstractMethodError.java b/libjava/java/lang/AbstractMethodError.java
index df961864a67..8fd20d3c0cf 100644
--- a/libjava/java/lang/AbstractMethodError.java
+++ b/libjava/java/lang/AbstractMethodError.java
@@ -1,5 +1,5 @@
/* AbstractMethodError.java -- thrown if an abstract method is invoked
- Copyright (C) 1998, 1999, 2001, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2001, 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -46,7 +46,7 @@ package java.lang;
* reflecting on methods.
*
* @author Brian Jones
- * @author Tom Tromey <tromey@cygnus.com>
+ * @author Tom Tromey (tromey@cygnus.com)
* @status updated to 1.4
*/
public class AbstractMethodError extends IncompatibleClassChangeError
diff --git a/libjava/java/lang/ArithmeticException.java b/libjava/java/lang/ArithmeticException.java
index de79b096ab3..7fb9c1cc4d6 100644
--- a/libjava/java/lang/ArithmeticException.java
+++ b/libjava/java/lang/ArithmeticException.java
@@ -1,6 +1,6 @@
/* ArithmeticException.java -- exception thrown to indicate conditions
like divide by zero.
- Copyright (C) 1998, 1999, 2001, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2001, 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -48,7 +48,7 @@ package java.lang;
* </pre>
*
* @author Brian Jones
- * @author Warren Levy <warrenl@cygnus.com>
+ * @author Warren Levy (warrenl@cygnus.com)
* @status updated to 1.4
*/
public class ArithmeticException extends RuntimeException
diff --git a/libjava/java/lang/ArrayIndexOutOfBoundsException.java b/libjava/java/lang/ArrayIndexOutOfBoundsException.java
index 1a6db8daf04..abc6d1d607f 100644
--- a/libjava/java/lang/ArrayIndexOutOfBoundsException.java
+++ b/libjava/java/lang/ArrayIndexOutOfBoundsException.java
@@ -1,6 +1,6 @@
/* ArrayIndexOutOfBoundsException.java -- exception thrown when accessing
an illegal index.
- Copyright (C) 1998, 1999, 2001, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2001, 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -48,7 +48,7 @@ package java.lang;
* </pre>
*
* @author Brian Jones
- * @author Warren Levy <warrenl@cygnus.com>
+ * @author Warren Levy (warrenl@cygnus.com)
* @status updated to 1.4
*/
public class ArrayIndexOutOfBoundsException extends IndexOutOfBoundsException
diff --git a/libjava/java/lang/ArrayStoreException.java b/libjava/java/lang/ArrayStoreException.java
index 3fa714d2ef4..00a084ec115 100644
--- a/libjava/java/lang/ArrayStoreException.java
+++ b/libjava/java/lang/ArrayStoreException.java
@@ -1,6 +1,6 @@
/* ArrayStoreException.java -- exception thrown to when trying to store an
object into an array of a different type.
- Copyright (C) 1998, 1999, 2001, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2001, 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -48,7 +48,7 @@ package java.lang;
* </pre>
*
* @author Brian Jones
- * @author Warren Levy <warrenl@cygnus.com>
+ * @author Warren Levy (warrenl@cygnus.com)
* @status updated to 1.4
*/
public class ArrayStoreException extends RuntimeException
diff --git a/libjava/java/lang/AssertionError.java b/libjava/java/lang/AssertionError.java
index 2bbf81cac97..8851be1d30f 100644
--- a/libjava/java/lang/AssertionError.java
+++ b/libjava/java/lang/AssertionError.java
@@ -1,5 +1,5 @@
/* AssertionError.java -- indication of a failed assertion
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -47,7 +47,7 @@ package java.lang;
* the string <code>"" + <em>expression</em></code>. This extends Error,
* because you usually do not want to inadvertently trap an assertion failure.
*
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Eric Blake (ebb9@email.byu.edu)
* @since 1.4
* @status updated to 1.4
*/
diff --git a/libjava/java/lang/Boolean.java b/libjava/java/lang/Boolean.java
index 3c09a1505c1..a30b669df1a 100644
--- a/libjava/java/lang/Boolean.java
+++ b/libjava/java/lang/Boolean.java
@@ -1,5 +1,5 @@
/* Boolean.java -- object wrapper for boolean
- Copyright (C) 1998, 2001, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1998, 2001, 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -45,7 +45,7 @@ import java.io.Serializable;
* <code>boolean</code> values.
*
* @author Paul Fisher
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Eric Blake (ebb9@email.byu.edu)
* @since 1.0
* @status updated to 1.4
*/
diff --git a/libjava/java/lang/Byte.java b/libjava/java/lang/Byte.java
index 641c5cc8ee1..e59ac598aed 100644
--- a/libjava/java/lang/Byte.java
+++ b/libjava/java/lang/Byte.java
@@ -1,5 +1,5 @@
/* Byte.java -- object wrapper for byte
- Copyright (C) 1998, 2001, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1998, 2001, 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -48,7 +48,7 @@ package java.lang;
* @author Paul Fisher
* @author John Keiser
* @author Per Bothner
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Eric Blake (ebb9@email.byu.edu)
* @since 1.1
* @status updated to 1.4
*/
diff --git a/libjava/java/lang/Class.h b/libjava/java/lang/Class.h
index 34ff5df634d..98ebcc13d38 100644
--- a/libjava/java/lang/Class.h
+++ b/libjava/java/lang/Class.h
@@ -228,14 +228,15 @@ void _Jv_InitNewClassFields (jclass klass);
// Friend functions and classes in prims.cc
void _Jv_InitPrimClass (jclass, char *, char, int);
-jstring _Jv_GetMethodString (jclass, _Jv_Utf8Const *);
+jstring _Jv_GetMethodString (jclass, _Jv_Method *, jclass = NULL);
jboolean _Jv_CheckAccess (jclass self_klass, jclass other_klass,
jint flags);
jclass _Jv_GetArrayClass (jclass klass, java::lang::ClassLoader *loader);
-#ifdef INTERPRETER
jboolean _Jv_IsInterpretedClass (jclass);
+
+#ifdef INTERPRETER
void _Jv_InitField (jobject, jclass, int);
class _Jv_ClassReader;
@@ -454,7 +455,7 @@ private:
// in prims.cc
friend void ::_Jv_InitPrimClass (jclass, char *, char, int);
- friend jstring (::_Jv_GetMethodString) (jclass, _Jv_Utf8Const *);
+ friend jstring (::_Jv_GetMethodString) (jclass, _Jv_Method *, jclass);
friend jboolean (::_Jv_CheckAccess) (jclass self_klass, jclass other_klass,
jint flags);
@@ -466,8 +467,9 @@ private:
friend jclass (::_Jv_GetArrayClass) (jclass klass,
java::lang::ClassLoader *loader);
-#ifdef INTERPRETER
friend jboolean (::_Jv_IsInterpretedClass) (jclass);
+
+#ifdef INTERPRETER
friend void ::_Jv_InitField (jobject, jclass, int);
friend class ::_Jv_ClassReader;
diff --git a/libjava/java/lang/Class.java b/libjava/java/lang/Class.java
index 6a65482f637..bf11861985d 100644
--- a/libjava/java/lang/Class.java
+++ b/libjava/java/lang/Class.java
@@ -71,8 +71,8 @@ import java.util.HashSet;
* see {@link ObjectStreamClass}.
*
* @author John Keiser
- * @author Eric Blake <ebb9@email.byu.edu>
- * @author Tom Tromey <tromey@cygnus.com>
+ * @author Eric Blake (ebb9@email.byu.edu)
+ * @author Tom Tromey (tromey@cygnus.com)
* @since 1.0
* @see ClassLoader
*/
diff --git a/libjava/java/lang/ClassCastException.java b/libjava/java/lang/ClassCastException.java
index b552b23fbdb..49c5262222d 100644
--- a/libjava/java/lang/ClassCastException.java
+++ b/libjava/java/lang/ClassCastException.java
@@ -1,5 +1,5 @@
/* ClassCastException.java -- exception thrown on bad cast
- Copyright (C) 1998, 1999, 2001, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2001, 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -47,7 +47,7 @@ package java.lang;
* </pre>
*
* @author Brian Jones
- * @author Warren Levy <warrenl@cygnus.com>
+ * @author Warren Levy (warrenl@cygnus.com)
* @status updated to 1.4
*/
public class ClassCastException extends RuntimeException
diff --git a/libjava/java/lang/ClassCircularityError.java b/libjava/java/lang/ClassCircularityError.java
index 8016eadb868..fb93327eb1d 100644
--- a/libjava/java/lang/ClassCircularityError.java
+++ b/libjava/java/lang/ClassCircularityError.java
@@ -1,5 +1,5 @@
/* ClassCircularityError.java -- thrown when linking circular classes
- Copyright (C) 1998, 1999, 2001, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2001, 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -44,7 +44,7 @@ package java.lang;
* incompatible versions of class files, as the compiler normally catches this.
*
* @author Brian Jones
- * @author Tom Tromey <tromey@cygnus.com>
+ * @author Tom Tromey (tromey@cygnus.com)
* @status updated to 1.4
*/
public class ClassCircularityError extends LinkageError
diff --git a/libjava/java/lang/ClassLoader.java b/libjava/java/lang/ClassLoader.java
index 46e523c6834..a4ac1e1b301 100644
--- a/libjava/java/lang/ClassLoader.java
+++ b/libjava/java/lang/ClassLoader.java
@@ -109,7 +109,7 @@ import java.util.Map;
*
* @author John Keiser
* @author Mark Wielaard
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Eric Blake (ebb9@email.byu.edu)
* @see Class
* @since 1.0
* @status still missing 1.4 functionality
@@ -260,6 +260,9 @@ public abstract class ClassLoader
return loadClass(name, false);
}
+ private native Class loadClassFromSig(String name)
+ throws ClassNotFoundException;
+
/**
* Load a class using this ClassLoader or its parent, possibly resolving
* it as well using <code>resolveClass()</code>. It first tries to find
@@ -283,30 +286,37 @@ public abstract class ClassLoader
protected synchronized Class loadClass(String name, boolean resolve)
throws ClassNotFoundException
{
- // Have we already loaded this class?
- Class c = findLoadedClass(name);
- if (c != null)
- return c;
-
- // Can the class be loaded by a parent?
- try
+ // Arrays are handled specially.
+ Class c;
+ if (name.charAt(0) == '[')
+ c = loadClassFromSig(name);
+ else
{
- if (parent == null)
+ // Have we already loaded this class?
+ c = findLoadedClass(name);
+ if (c == null)
{
- c = VMClassLoader.loadClass(name, resolve);
- if (c != null)
- return c;
+ // Can the class be loaded by a parent?
+ try
+ {
+ if (parent == null)
+ {
+ c = VMClassLoader.loadClass(name, resolve);
+ if (c != null)
+ return c;
+ }
+ else
+ {
+ return parent.loadClass(name, resolve);
+ }
+ }
+ catch (ClassNotFoundException e)
+ {
+ }
+ // Still not found, we have to do it ourself.
+ c = findClass(name);
}
- else
- {
- return parent.loadClass(name, resolve);
- }
- }
- catch (ClassNotFoundException e)
- {
}
- // Still not found, we have to do it ourself.
- c = findClass(name);
if (resolve)
resolveClass(c);
return c;
diff --git a/libjava/java/lang/ClassNotFoundException.java b/libjava/java/lang/ClassNotFoundException.java
index cb546602e56..cfa03f59647 100644
--- a/libjava/java/lang/ClassNotFoundException.java
+++ b/libjava/java/lang/ClassNotFoundException.java
@@ -1,5 +1,5 @@
/* ClassNotFoundException.java -- thrown when class definition cannot be found
- Copyright (C) 1998, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1998, 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -43,7 +43,7 @@ package java.lang;
* cannot be found. This exception is often chained from another Throwable.
*
* @author Brian Jones
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Eric Blake (ebb9@email.byu.edu)
* @see Class#forName(String)
* @see ClassLoader#findSystemClass(String)
* @see ClassLoader#loadClass(String, boolean)
diff --git a/libjava/java/lang/CloneNotSupportedException.java b/libjava/java/lang/CloneNotSupportedException.java
index e13112ac350..488e9154c3a 100644
--- a/libjava/java/lang/CloneNotSupportedException.java
+++ b/libjava/java/lang/CloneNotSupportedException.java
@@ -1,5 +1,5 @@
/* CloneNotSupportedException.java -- thrown when an object cannot be cloned
- Copyright (C) 1998, 1999, 2001, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2001, 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -60,8 +60,8 @@ package java.lang;
* </pre>
*
* @author Brian Jones
- * @author Warren Levy <warrenl@cygnus.com>
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Warren Levy (warrenl@cygnus.com)
+ * @author Eric Blake (ebb9@email.byu.edu)
* @see Cloneable
* @see Object#clone()
* @status updated to 1.4
diff --git a/libjava/java/lang/Cloneable.java b/libjava/java/lang/Cloneable.java
index 64c7faf4863..0a8243ea21f 100644
--- a/libjava/java/lang/Cloneable.java
+++ b/libjava/java/lang/Cloneable.java
@@ -1,5 +1,5 @@
/* Cloneable.java -- Interface for marking objects cloneable by Object.clone()
- Copyright (C) 1998, 1999, 2001, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2001, 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -65,8 +65,8 @@ package java.lang;
* <code>CloneNotSupportedException</code>.
*
* @author Paul Fisher
- * @author Eric Blake <ebb9@email.byu.edu>
- * @author Warren Levy <warrenl@cygnus.com>
+ * @author Eric Blake (ebb9@email.byu.edu)
+ * @author Warren Levy (warrenl@cygnus.com)
* @see Object#clone()
* @see CloneNotSupportedException
* @since 1.0
diff --git a/libjava/java/lang/Comparable.java b/libjava/java/lang/Comparable.java
index bfe72dbcb11..4ffec6056ca 100644
--- a/libjava/java/lang/Comparable.java
+++ b/libjava/java/lang/Comparable.java
@@ -1,5 +1,5 @@
/* Comparable.java -- Interface for comparaing objects to obtain an ordering
- Copyright (C) 1998, 1999, 2001, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2001, 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -57,7 +57,7 @@ package java.lang;
* classes.
*
* @author Geoff Berry
- * @author Warren Levy <warrenl@cygnus.com>
+ * @author Warren Levy (warrenl@cygnus.com)
* @see java.util.Comparator
* @see java.util.Collections#sort(java.util.List)
* @see java.util.Arrays#sort(Object[])
diff --git a/libjava/java/lang/Compiler.java b/libjava/java/lang/Compiler.java
index 858f63ee993..1179f79faff 100644
--- a/libjava/java/lang/Compiler.java
+++ b/libjava/java/lang/Compiler.java
@@ -1,5 +1,5 @@
/* Compiler.java -- placeholder for Java-to-native runtime compilers
- Copyright (C) 1998, 1999, 2001, 2002, 2004 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2001, 2002, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -50,7 +50,7 @@ package java.lang;
*
* <p>Note that a VM might not have implemented any of this.
*
- * @author Tom Tromey <tromey@cygnus.com>
+ * @author Tom Tromey (tromey@cygnus.com)
* @see System#getProperty(String)
* @see System#getProperty(String, String)
* @see System#loadLibrary(String)
diff --git a/libjava/java/lang/Double.java b/libjava/java/lang/Double.java
index be393b6b4b9..81985f04e05 100644
--- a/libjava/java/lang/Double.java
+++ b/libjava/java/lang/Double.java
@@ -1,5 +1,5 @@
/* Double.java -- object wrapper for double
- Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003
+ Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2005
Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -48,8 +48,8 @@ import gnu.classpath.Configuration;
* related to doubles.
*
* @author Paul Fisher
- * @author Andrew Haley <aph@cygnus.com>
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Andrew Haley (aph@cygnus.com)
+ * @author Eric Blake (ebb9@email.byu.edu)
* @since 1.0
* @status updated to 1.4
*/
diff --git a/libjava/java/lang/Error.java b/libjava/java/lang/Error.java
index 8bb42dc887c..fc1d6227861 100644
--- a/libjava/java/lang/Error.java
+++ b/libjava/java/lang/Error.java
@@ -1,5 +1,5 @@
/* Error.java -- Indication of fatal abnormal conditions
- Copyright (C) 1998, 1999, 2001, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2001, 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -49,8 +49,8 @@ package java.lang;
* executing the method.
*
* @author Brian Jones
- * @author Tom Tromey <tromey@cygnus.com>
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Tom Tromey (tromey@cygnus.com)
+ * @author Eric Blake (ebb9@email.byu.edu)
* @since 1.0
* @status updated to 1.4
*/
diff --git a/libjava/java/lang/Exception.java b/libjava/java/lang/Exception.java
index edf5de228c8..68a7dcb2d2b 100644
--- a/libjava/java/lang/Exception.java
+++ b/libjava/java/lang/Exception.java
@@ -1,6 +1,6 @@
/* Exception.java -- generic exception thrown to indicate an exceptional
condition has occurred.
- Copyright (C) 1998, 1999, 2001, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2001, 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -47,8 +47,8 @@ package java.lang;
* mouse movements, keyboard clicking, etc.
*
* @author Brian Jones
- * @author Warren Levy <warrenl@cygnus.com>
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Warren Levy (warrenl@cygnus.com)
+ * @author Eric Blake (ebb9@email.byu.edu)
* @status updated to 1.4
*/
public class Exception extends Throwable
diff --git a/libjava/java/lang/ExceptionInInitializerError.java b/libjava/java/lang/ExceptionInInitializerError.java
index d04bdc010d7..966a9f3acee 100644
--- a/libjava/java/lang/ExceptionInInitializerError.java
+++ b/libjava/java/lang/ExceptionInInitializerError.java
@@ -1,6 +1,6 @@
/* ExceptionInInitializerError.java -- thrown when class initialization fails
with an uncaught exception
- Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2000, 2001, 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -48,8 +48,8 @@ package java.lang;
* is initialized as part of another action.
*
* @author Brian Jones
- * @author Tom Tromey <tromey@cygnus.com>
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Tom Tromey (tromey@cygnus.com)
+ * @author Eric Blake (ebb9@email.byu.edu)
* @since 1.1
* @status updated to 1.4
*/
diff --git a/libjava/java/lang/Float.java b/libjava/java/lang/Float.java
index d59912168da..0fa3547a77b 100644
--- a/libjava/java/lang/Float.java
+++ b/libjava/java/lang/Float.java
@@ -1,5 +1,5 @@
/* Float.java -- object wrapper for float
- Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003
+ Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2005
Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -47,8 +47,8 @@ package java.lang;
* related to floats.
*
* @author Paul Fisher
- * @author Andrew Haley <aph@cygnus.com>
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Andrew Haley (aph@cygnus.com)
+ * @author Eric Blake (ebb9@email.byu.edu)
* @since 1.0
* @status updated to 1.4
*/
diff --git a/libjava/java/lang/IllegalAccessError.java b/libjava/java/lang/IllegalAccessError.java
index a5c384e77fe..a45efd1633b 100644
--- a/libjava/java/lang/IllegalAccessError.java
+++ b/libjava/java/lang/IllegalAccessError.java
@@ -1,5 +1,5 @@
/* IllegalAccessError.java -- thrown when linking to an inaccessible member
- Copyright (C) 1998, 1999, 2001, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2001, 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -47,7 +47,7 @@ package java.lang;
* application.
*
* @author Brian Jones
- * @author Tom Tromey <tromey@cygnus.com>
+ * @author Tom Tromey (tromey@cygnus.com)
* @status updated to 1.4
*/
public class IllegalAccessError extends IncompatibleClassChangeError
diff --git a/libjava/java/lang/IllegalAccessException.java b/libjava/java/lang/IllegalAccessException.java
index f6fc8f67e91..f1ac3b0a32e 100644
--- a/libjava/java/lang/IllegalAccessException.java
+++ b/libjava/java/lang/IllegalAccessException.java
@@ -1,6 +1,6 @@
/* IllegalAccessException.java -- thrown on attempt to reflect on
inaccessible data
- Copyright (C) 1998, 1999, 2001, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2001, 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -45,7 +45,7 @@ package java.lang;
* variable that belongs to a class in another package is bad.
*
* @author Brian Jones
- * @author Warren Levy <warrenl@cygnus.com>
+ * @author Warren Levy (warrenl@cygnus.com)
* @see Class#newInstance()
* @see Field#set(Object, Object)
* @see Field#setBoolean(Object, boolean)
diff --git a/libjava/java/lang/IllegalArgumentException.java b/libjava/java/lang/IllegalArgumentException.java
index deb6735c899..d0120135ca1 100644
--- a/libjava/java/lang/IllegalArgumentException.java
+++ b/libjava/java/lang/IllegalArgumentException.java
@@ -1,6 +1,6 @@
/* IllegalArgumentException.java -- thrown when a method is passed an
illegal or inappropriate argument
- Copyright (C) 1998, 1999, 2001, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2001, 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -46,7 +46,7 @@ package java.lang;
* </pre>
*
* @author Brian Jones
- * @author Warren Levy <warrenl@cygnus.com>
+ * @author Warren Levy (warrenl@cygnus.com)
* @status updated to 1.4
*/
public class IllegalArgumentException extends RuntimeException
diff --git a/libjava/java/lang/IllegalMonitorStateException.java b/libjava/java/lang/IllegalMonitorStateException.java
index 08e1ba7a1ea..7461942ccd7 100644
--- a/libjava/java/lang/IllegalMonitorStateException.java
+++ b/libjava/java/lang/IllegalMonitorStateException.java
@@ -1,6 +1,6 @@
/* IllegalMonitorStateException.java -- thrown when trying to wait or
notify a monitor that is not owned
- Copyright (C) 1998, 1999, 2001, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2001, 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -49,7 +49,7 @@ package java.lang;
* </pre>
*
* @author Brian Jones
- * @author Warren Levy <warrenl@cygnus.com>
+ * @author Warren Levy (warrenl@cygnus.com)
* @status updated to 1.4
*/
public class IllegalMonitorStateException extends RuntimeException
diff --git a/libjava/java/lang/IllegalStateException.java b/libjava/java/lang/IllegalStateException.java
index 16dcf1a80c8..f39ea539cc1 100644
--- a/libjava/java/lang/IllegalStateException.java
+++ b/libjava/java/lang/IllegalStateException.java
@@ -1,6 +1,6 @@
/* IllegalStateException.java -- thrown when invoking a method at
an illegal or inappropriate time
- Copyright (C) 1998, 1999, 2001, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2001, 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -50,7 +50,7 @@ package java.lang;
* </pre>
*
* @author Brian Jones
- * @author Warren Levy <warrenl@cygnus.com>
+ * @author Warren Levy (warrenl@cygnus.com)
* @since 1.1
* @status updated to 1.4
*/
diff --git a/libjava/java/lang/IllegalThreadStateException.java b/libjava/java/lang/IllegalThreadStateException.java
index bcc188e1a66..d7e0a2ba49b 100644
--- a/libjava/java/lang/IllegalThreadStateException.java
+++ b/libjava/java/lang/IllegalThreadStateException.java
@@ -1,6 +1,6 @@
/* IllegalThreadStateException.java -- thrown when trying to manipulate a
Thread when it is not in an appropriate state
- Copyright (C) 1998, 1999, 2001, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2001, 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -46,7 +46,7 @@ package java.lang;
* two methods are deprecated, this exception is likely very rare.
*
* @author Brian Jones
- * @author Warren Levy <warrenl@cygnus.com>
+ * @author Warren Levy (warrenl@cygnus.com)
* @status updated to 1.4
*/
public class IllegalThreadStateException extends IllegalArgumentException
diff --git a/libjava/java/lang/IncompatibleClassChangeError.java b/libjava/java/lang/IncompatibleClassChangeError.java
index 7f569fdc36d..7885a2542e6 100644
--- a/libjava/java/lang/IncompatibleClassChangeError.java
+++ b/libjava/java/lang/IncompatibleClassChangeError.java
@@ -1,5 +1,5 @@
/* IncompatibleClassChangeError.java -- thrown for binary incompatible classes
- Copyright (C) 1998, 1999, 2001, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2001, 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -44,7 +44,7 @@ package java.lang;
* incompatible way.
*
* @author Brian Jones
- * @author Tom Tromey <tromey@cygnus.com>
+ * @author Tom Tromey (tromey@cygnus.com)
* @status updated to 1.4
*/
public class IncompatibleClassChangeError extends LinkageError
diff --git a/libjava/java/lang/IndexOutOfBoundsException.java b/libjava/java/lang/IndexOutOfBoundsException.java
index 336f87219a3..4886f01da9d 100644
--- a/libjava/java/lang/IndexOutOfBoundsException.java
+++ b/libjava/java/lang/IndexOutOfBoundsException.java
@@ -1,5 +1,5 @@
/* IndexOutOfBoundsException.java -- thrown for an invalid index
- Copyright (C) 1998, 1999, 2001, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2001, 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -46,7 +46,7 @@ package java.lang;
* which would be out of bounds.
*
* @author Brian Jones
- * @author Warren Levy <warrenl@cygnus.com>
+ * @author Warren Levy (warrenl@cygnus.com)
* @status updated to 1.4
*/
public class IndexOutOfBoundsException extends RuntimeException
diff --git a/libjava/java/lang/InheritableThreadLocal.java b/libjava/java/lang/InheritableThreadLocal.java
index 5dfbe9a6230..43810f80e87 100644
--- a/libjava/java/lang/InheritableThreadLocal.java
+++ b/libjava/java/lang/InheritableThreadLocal.java
@@ -1,5 +1,5 @@
/* InheritableThreadLocal -- a ThreadLocal which inherits values across threads
- Copyright (C) 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
+ Copyright (C) 2000, 2001, 2002, 2003, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -55,8 +55,8 @@ import java.util.WeakHashMap;
* is in transferring items like User ID or Transaction ID across threads
* automatically.
*
- * @author Mark Wielaard <mark@klomp.org>
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Mark Wielaard (mark@klomp.org)
+ * @author Eric Blake (ebb9@email.byu.edu)
* @see ThreadLocal
* @since 1.2
* @status updated to 1.4
diff --git a/libjava/java/lang/InstantiationError.java b/libjava/java/lang/InstantiationError.java
index 54aa7b36609..3d2750ce8a3 100644
--- a/libjava/java/lang/InstantiationError.java
+++ b/libjava/java/lang/InstantiationError.java
@@ -1,5 +1,5 @@
/* InstantiationError.java -- thrown when the linker cannot create an instance
- Copyright (C) 1998, 1999, 2001, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2001, 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -46,7 +46,7 @@ package java.lang;
* with the previously compiled application.
*
* @author Brian Jones
- * @author Tom Tromey <tromey@cygnus.com>
+ * @author Tom Tromey (tromey@cygnus.com)
* @status updated to 1.4
*/
public class InstantiationError extends IncompatibleClassChangeError
diff --git a/libjava/java/lang/InstantiationException.java b/libjava/java/lang/InstantiationException.java
index 511481418c4..4aa4bd077ca 100644
--- a/libjava/java/lang/InstantiationException.java
+++ b/libjava/java/lang/InstantiationException.java
@@ -1,6 +1,6 @@
/* InstantiationException.java -- thrown when reflection cannot create an
instance
- Copyright (C) 1998, 1999, 2001, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2001, 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -44,7 +44,7 @@ package java.lang;
* non-instantiable class (an interface or abstract class).
*
* @author Brian Jones
- * @author Warren Levy <warrenl@cygnus.com>
+ * @author Warren Levy (warrenl@cygnus.com)
* @see Class#newInstance()
* @status updated to 1.4
*/
diff --git a/libjava/java/lang/Integer.java b/libjava/java/lang/Integer.java
index 9c8329dbd83..eddaea2292a 100644
--- a/libjava/java/lang/Integer.java
+++ b/libjava/java/lang/Integer.java
@@ -1,5 +1,5 @@
/* Integer.java -- object wrapper for int
- Copyright (C) 1998, 1999, 2001, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2001, 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -48,7 +48,7 @@ package java.lang;
* @author Paul Fisher
* @author John Keiser
* @author Warren Levy
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Eric Blake (ebb9@email.byu.edu)
* @since 1.0
* @status updated to 1.4
*/
diff --git a/libjava/java/lang/InternalError.java b/libjava/java/lang/InternalError.java
index d85aed11817..d612d092fa2 100644
--- a/libjava/java/lang/InternalError.java
+++ b/libjava/java/lang/InternalError.java
@@ -1,5 +1,5 @@
/* InternalError.java -- thrown when the VM encounters an internal error
- Copyright (C) 1998, 1999, 2001, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2001, 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -43,7 +43,7 @@ package java.lang;
* occurred in the Java Virtual Machine.
*
* @author Brian Jones
- * @author Tom Tromey <tromey@cygnus.com>
+ * @author Tom Tromey (tromey@cygnus.com)
* @status updated to 1.4
*/
public class InternalError extends VirtualMachineError
diff --git a/libjava/java/lang/InterruptedException.java b/libjava/java/lang/InterruptedException.java
index 2ee7867f610..58951abc46d 100644
--- a/libjava/java/lang/InterruptedException.java
+++ b/libjava/java/lang/InterruptedException.java
@@ -1,5 +1,5 @@
/* InterruptedException.java -- thrown when a thread is interrupted
- Copyright (C) 1998, 1999, 2001, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2001, 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -44,7 +44,7 @@ package java.lang;
* <code>interrupt</code> method of class <code>Thread</code>.
*
* @author Brian Jones
- * @author Warren Levy <warrenl@cygnus.com>
+ * @author Warren Levy (warrenl@cygnus.com)
* @see Object#wait()
* @see Object#wait(long)
* @see Object#wait(long, int)
diff --git a/libjava/java/lang/LinkageError.java b/libjava/java/lang/LinkageError.java
index 020fe0a9a7c..ead768f3756 100644
--- a/libjava/java/lang/LinkageError.java
+++ b/libjava/java/lang/LinkageError.java
@@ -1,6 +1,6 @@
/* LinkageError.java -- thrown when classes valid at separate compile times
cannot be linked to each other
- Copyright (C) 1998, 1999, 2001, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2001, 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -45,7 +45,7 @@ package java.lang;
* linked to one another.
*
* @author Brian Jones
- * @author Tom Tromey <tromey@cygnus.com>
+ * @author Tom Tromey (tromey@cygnus.com)
* @status updated to 1.4
*/
public class LinkageError extends Error
diff --git a/libjava/java/lang/Long.java b/libjava/java/lang/Long.java
index 012cc9c93e7..e93786d2571 100644
--- a/libjava/java/lang/Long.java
+++ b/libjava/java/lang/Long.java
@@ -1,5 +1,5 @@
/* Long.java -- object wrapper for long
- Copyright (C) 1998, 1999, 2001, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2001, 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -48,7 +48,7 @@ package java.lang;
* @author Paul Fisher
* @author John Keiser
* @author Warren Levy
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Eric Blake (ebb9@email.byu.edu)
* @since 1.0
* @status updated to 1.4
*/
diff --git a/libjava/java/lang/NegativeArraySizeException.java b/libjava/java/lang/NegativeArraySizeException.java
index ee73a97d5aa..695ee0e6e4a 100644
--- a/libjava/java/lang/NegativeArraySizeException.java
+++ b/libjava/java/lang/NegativeArraySizeException.java
@@ -1,6 +1,6 @@
/* NegativeArraySizeException.java -- thrown on attempt to create array
with a negative size
- Copyright (C) 1998, 1999, 2001, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2001, 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -48,7 +48,7 @@ package java.lang;
* </pre>
*
* @author Brian Jones
- * @author Warren Levy <warrenl@cygnus.com>
+ * @author Warren Levy (warrenl@cygnus.com)
* @status updated to 1.4
*/
public class NegativeArraySizeException extends RuntimeException
diff --git a/libjava/java/lang/NoClassDefFoundError.java b/libjava/java/lang/NoClassDefFoundError.java
index 5ca69bcaaa2..8fbdb29909c 100644
--- a/libjava/java/lang/NoClassDefFoundError.java
+++ b/libjava/java/lang/NoClassDefFoundError.java
@@ -1,5 +1,5 @@
/* NoClassDefFoundError.java -- thrown when a ClassLoader cannot find a class
- Copyright (C) 1998, 1999, 2001, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2001, 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -47,7 +47,7 @@ package java.lang;
* class was compiled, but now that definition cannot be found.
*
* @author Brian Jones
- * @author Tom Tromey <tromey@cygnus.com>
+ * @author Tom Tromey (tromey@cygnus.com)
* @status updated to 1.4
*/
public class NoClassDefFoundError extends LinkageError
diff --git a/libjava/java/lang/NoSuchFieldError.java b/libjava/java/lang/NoSuchFieldError.java
index 0a197b0c4bd..965dfd6603d 100644
--- a/libjava/java/lang/NoSuchFieldError.java
+++ b/libjava/java/lang/NoSuchFieldError.java
@@ -1,5 +1,5 @@
/* NoSuchFieldError.java -- thrown when the linker does not find a field
- Copyright (C) 1998, 1999, 2001, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2001, 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -45,7 +45,7 @@ package java.lang;
* using binary incompatible class versions.
*
* @author Brian Jones
- * @author Tom Tromey <tromey@cygnus.com>
+ * @author Tom Tromey (tromey@cygnus.com)
* @status updated to 1.4
*/
public class NoSuchFieldError extends IncompatibleClassChangeError
diff --git a/libjava/java/lang/NoSuchFieldException.java b/libjava/java/lang/NoSuchFieldException.java
index ee721ebef21..30beeefcd25 100644
--- a/libjava/java/lang/NoSuchFieldException.java
+++ b/libjava/java/lang/NoSuchFieldException.java
@@ -1,5 +1,5 @@
/* NoSuchFieldException.java -- thrown when reflecting a non-existant field
- Copyright (C) 1998, 1999, 2001, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2001, 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -43,7 +43,7 @@ package java.lang;
* caused by a variety of reflection methods, when looking up a field by name.
*
* @author Brian Jones
- * @author Warren Levy <warrenl@cygnus.com>
+ * @author Warren Levy (warrenl@cygnus.com)
* @since 1.1
* @status updated to 1.4
*/
diff --git a/libjava/java/lang/NoSuchMethodError.java b/libjava/java/lang/NoSuchMethodError.java
index dced018cfe3..494f7a2713e 100644
--- a/libjava/java/lang/NoSuchMethodError.java
+++ b/libjava/java/lang/NoSuchMethodError.java
@@ -1,5 +1,5 @@
/* NoSuchMethodError.java -- thrown when the linker does not find a method
- Copyright (C) 1998, 1999, 2001, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2001, 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -45,7 +45,7 @@ package java.lang;
* using binary incompatible class versions.
*
* @author Brian Jones
- * @author Tom Tromey <tromey@cygnus.com>
+ * @author Tom Tromey (tromey@cygnus.com)
* @status updated to 1.4
*/
public class NoSuchMethodError extends IncompatibleClassChangeError
diff --git a/libjava/java/lang/NoSuchMethodException.java b/libjava/java/lang/NoSuchMethodException.java
index cba69203f7b..fa3e06e4f73 100644
--- a/libjava/java/lang/NoSuchMethodException.java
+++ b/libjava/java/lang/NoSuchMethodException.java
@@ -1,5 +1,5 @@
/* NoSuchMethodException.java -- thrown when reflecting a non-existant method
- Copyright (C) 1998, 1999, 2001, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2001, 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -43,7 +43,7 @@ package java.lang;
* caused by a variety of reflection methods, when looking up a method by name.
*
* @author Brian Jones
- * @author Warren Levy <warrenl@cygnus.com>
+ * @author Warren Levy (warrenl@cygnus.com)
* @status updated to 1.4
*/
public class NoSuchMethodException extends Exception
diff --git a/libjava/java/lang/NullPointerException.java b/libjava/java/lang/NullPointerException.java
index bab20719373..c55341cfd3c 100644
--- a/libjava/java/lang/NullPointerException.java
+++ b/libjava/java/lang/NullPointerException.java
@@ -1,5 +1,5 @@
/* NullPointerException.java -- thrown when using null instead of an object
- Copyright (C) 1998, 1999, 2001, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2001, 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -53,7 +53,7 @@ package java.lang;
* <code>null</code> is an inappropriate parameter to a method.
*
* @author Brian Jones
- * @author Warren Levy <warrenl@cygnus.com>
+ * @author Warren Levy (warrenl@cygnus.com)
* @status updated to 1.4
*/
public class NullPointerException extends RuntimeException
diff --git a/libjava/java/lang/Number.java b/libjava/java/lang/Number.java
index 54bb1f763e5..70d0fe8543c 100644
--- a/libjava/java/lang/Number.java
+++ b/libjava/java/lang/Number.java
@@ -1,5 +1,5 @@
/* Number.java =- abstract superclass of numeric objects
- Copyright (C) 1998, 2001, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1998, 2001, 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -51,7 +51,7 @@ import java.io.Serializable;
* @author Paul Fisher
* @author John Keiser
* @author Warren Levy
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Eric Blake (ebb9@email.byu.edu)
* @since 1.0
* @status updated to 1.4
*/
diff --git a/libjava/java/lang/NumberFormatException.java b/libjava/java/lang/NumberFormatException.java
index d076cc83da9..478036ffc6c 100644
--- a/libjava/java/lang/NumberFormatException.java
+++ b/libjava/java/lang/NumberFormatException.java
@@ -1,5 +1,5 @@
/* NumberFormatException.java -- thrown when parsing a bad string as a number
- Copyright (C) 1998, 1999, 2001, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2001, 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -44,7 +44,7 @@ package java.lang;
* has the wrong format.
*
* @author Brian Jones
- * @author Warren Levy <warrenl@cygnus.com>
+ * @author Warren Levy (warrenl@cygnus.com)
* @status updated to 1.4
*/
public class NumberFormatException extends IllegalArgumentException
diff --git a/libjava/java/lang/Object.h b/libjava/java/lang/Object.h
index 0842e0b291c..bf68a72399b 100644
--- a/libjava/java/lang/Object.h
+++ b/libjava/java/lang/Object.h
@@ -1,6 +1,6 @@
// Object.h - Header file for java.lang.Object. -*- c++ -*-
-/* Copyright (C) 1998, 1999, 2000, 2001, 2004 Free Software Foundation
+/* Copyright (C) 1998, 1999, 2000, 2001, 2004, 2005 Free Software Foundation
This file is part of libgcj.
@@ -15,6 +15,8 @@ details. */
#include <gcj/javaprims.h>
+extern "Java"
+{
// This class is mainly here as a kludge to get G++ to allocate two
// extra entries in each vtable.
struct _JvObjectPrefix
@@ -27,6 +29,7 @@ protected:
virtual void nacd_2 (void) {}; // Actually the GC bitmap marking descriptor.
# endif
};
+}
// Forward declarations for friends of java::lang::Object
void _Jv_MonitorEnter (jobject obj);
diff --git a/libjava/java/lang/OutOfMemoryError.java b/libjava/java/lang/OutOfMemoryError.java
index b56b8f4242e..105aae5c2e9 100644
--- a/libjava/java/lang/OutOfMemoryError.java
+++ b/libjava/java/lang/OutOfMemoryError.java
@@ -1,5 +1,5 @@
/* OutOfMemoryError.java -- thrown when a memory allocation fails
- Copyright (C) 1998, 1999, 2001, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2001, 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -44,7 +44,7 @@ package java.lang;
* by the garbage collector.
*
* @author Brian Jones
- * @author Tom Tromey <tromey@cygnus.com>
+ * @author Tom Tromey (tromey@cygnus.com)
* @status updated to 1.4
*/
public class OutOfMemoryError extends VirtualMachineError
diff --git a/libjava/java/lang/Process.java b/libjava/java/lang/Process.java
index b87bd8068b5..e8c52760dfe 100644
--- a/libjava/java/lang/Process.java
+++ b/libjava/java/lang/Process.java
@@ -1,5 +1,5 @@
/* Process.java - Represent spawned system process
- Copyright (C) 1998, 1999, 2001, 2002, 2003, 2004
+ Copyright (C) 1998, 1999, 2001, 2002, 2003, 2004, 2005
Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -61,7 +61,7 @@ import java.io.OutputStream;
* owns this object.
*
* @author Brian Jones
- * @author Tom Tromey <tromey@cygnus.com>
+ * @author Tom Tromey (tromey@cygnus.com)
* @see Runtime#exec(String[], String[], File)
* @since 1.0
* @status updated to 1.4
diff --git a/libjava/java/lang/Runnable.java b/libjava/java/lang/Runnable.java
index fd817b0e4a1..ee8d6842cef 100644
--- a/libjava/java/lang/Runnable.java
+++ b/libjava/java/lang/Runnable.java
@@ -1,5 +1,5 @@
/* Runnable -- interface for a method tied to an Object; often for Threads
- Copyright (C) 1998, 1999, 2001, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2001, 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -45,7 +45,7 @@ package java.lang;
* override run.
*
* @author Paul Fisher
- * @author Tom Tromey <tromey@cygnus.com>
+ * @author Tom Tromey (tromey@cygnus.com)
* @see Thread
* @since 1.0
* @status updated to 1.4
diff --git a/libjava/java/lang/Runtime.java b/libjava/java/lang/Runtime.java
index aaeb93eda2d..1094720404d 100644
--- a/libjava/java/lang/Runtime.java
+++ b/libjava/java/lang/Runtime.java
@@ -52,8 +52,8 @@ import java.util.StringTokenizer;
* Runtime represents the Virtual Machine.
*
* @author John Keiser
- * @author Eric Blake <ebb9@email.byu.edu>
- * @status still missing 1.4 functionality
+ * @author Eric Blake (ebb9@email.byu.edu)
+ * @author Jeroen Frijters
*/
// No idea why this class isn't final, since you can't build a subclass!
public class Runtime
diff --git a/libjava/java/lang/RuntimeException.java b/libjava/java/lang/RuntimeException.java
index 8fc9fb10aab..6e63ed3fd13 100644
--- a/libjava/java/lang/RuntimeException.java
+++ b/libjava/java/lang/RuntimeException.java
@@ -1,5 +1,5 @@
/* RuntimeException.java -- root of all unchecked exceptions
- Copyright (C) 1998, 1999, 2001, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2001, 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -45,8 +45,8 @@ package java.lang;
* in their throws clause.
*
* @author Brian Jones
- * @author Warren Levy <warrenl@cygnus.com>
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Warren Levy (warrenl@cygnus.com)
+ * @author Eric Blake (ebb9@email.byu.edu)
* @status updated to 1.4
*/
public class RuntimeException extends Exception
diff --git a/libjava/java/lang/RuntimePermission.java b/libjava/java/lang/RuntimePermission.java
index b6adf383804..f4b46f68fb4 100644
--- a/libjava/java/lang/RuntimePermission.java
+++ b/libjava/java/lang/RuntimePermission.java
@@ -1,5 +1,5 @@
/* RuntimePermission.java -- permission for a secure runtime action
- Copyright (C) 1998, 2000, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1998, 2000, 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -166,7 +166,7 @@ import java.security.BasicPermission;
* </table>
*
* @author Brian Jones
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Eric Blake (ebb9@email.byu.edu)
* @see BasicPermission
* @see Permission
* @see SecurityManager
diff --git a/libjava/java/lang/SecurityException.java b/libjava/java/lang/SecurityException.java
index 5fbdb4ae222..91b015a895e 100644
--- a/libjava/java/lang/SecurityException.java
+++ b/libjava/java/lang/SecurityException.java
@@ -1,5 +1,5 @@
/* SecurityException.java -- thrown to indicate a security violation
- Copyright (C) 1998, 1999, 2001, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2001, 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -44,7 +44,7 @@ package java.lang;
* deemed unsafe by the current security policies.
*
* @author Brian Jones
- * @author Warren Levy <warrenl@cygnus.com>
+ * @author Warren Levy (warrenl@cygnus.com)
* @see SecurityManager
* @status updated to 1.4
*/
diff --git a/libjava/java/lang/SecurityManager.java b/libjava/java/lang/SecurityManager.java
index 972b312d943..c9ed4be0b3f 100644
--- a/libjava/java/lang/SecurityManager.java
+++ b/libjava/java/lang/SecurityManager.java
@@ -1,5 +1,5 @@
/* SecurityManager.java -- security checks for privileged actions
- Copyright (C) 1998, 1999, 2001, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2001, 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -101,7 +101,7 @@ import java.util.PropertyPermission;
* subclassing this class.
*
* @author John Keiser
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Eric Blake (ebb9@email.byu.edu)
* @see ClassLoader
* @see SecurityException
* @see #checkTopLevelWindow(Object)
diff --git a/libjava/java/lang/Short.java b/libjava/java/lang/Short.java
index 1a82e3edf36..1220f608acd 100644
--- a/libjava/java/lang/Short.java
+++ b/libjava/java/lang/Short.java
@@ -1,5 +1,5 @@
/* Short.java -- object wrapper for short
- Copyright (C) 1998, 2001, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1998, 2001, 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -47,7 +47,7 @@ package java.lang;
*
* @author Paul Fisher
* @author John Keiser
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Eric Blake (ebb9@email.byu.edu)
* @since 1.1
* @status updated to 1.4
*/
diff --git a/libjava/java/lang/StackOverflowError.java b/libjava/java/lang/StackOverflowError.java
index 8e8ed8d92b0..dc4c8ccf446 100644
--- a/libjava/java/lang/StackOverflowError.java
+++ b/libjava/java/lang/StackOverflowError.java
@@ -1,5 +1,5 @@
/* StackOverflowError.java -- thrown when the stack depth is exceeded
- Copyright (C) 1998, 1999, 2001, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2001, 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -43,7 +43,7 @@ package java.lang;
* overflow occurs. This often occurs when a method enters infinit recursion.
*
* @author Brian Jones
- * @author Tom Tromey <tromey@cygnus.com>
+ * @author Tom Tromey (tromey@cygnus.com)
* @status updated to 1.4
*/
public class StackOverflowError extends VirtualMachineError
diff --git a/libjava/java/lang/StackTraceElement.java b/libjava/java/lang/StackTraceElement.java
index 4495186e175..262d58228ee 100644
--- a/libjava/java/lang/StackTraceElement.java
+++ b/libjava/java/lang/StackTraceElement.java
@@ -1,5 +1,5 @@
/* StackTraceElement.java -- One function call or call stack element
- Copyright (C) 2001, 2002, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2001, 2002, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -46,8 +46,8 @@ import java.io.Serializable;
* the fully qualified class name, the method name and whether this method
* is native, if this information is known.
*
- * @author Mark Wielaard <mark@klomp.org>
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Mark Wielaard (mark@klomp.org)
+ * @author Eric Blake (ebb9@email.byu.edu)
* @since 1.4
* @status updated to 1.4
*/
diff --git a/libjava/java/lang/StringBuffer.java b/libjava/java/lang/StringBuffer.java
index 4f04de265ca..eac1d5ae3ed 100644
--- a/libjava/java/lang/StringBuffer.java
+++ b/libjava/java/lang/StringBuffer.java
@@ -1,5 +1,5 @@
/* StringBuffer.java -- Growable strings
- Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004
+ Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -67,7 +67,7 @@ import java.io.Serializable;
* @author Paul Fisher
* @author John Keiser
* @author Tom Tromey
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Eric Blake (ebb9@email.byu.edu)
* @see String
* @since 1.0
* @status updated to 1.4
diff --git a/libjava/java/lang/StringIndexOutOfBoundsException.java b/libjava/java/lang/StringIndexOutOfBoundsException.java
index 9a935ee8c44..ea0df6890e9 100644
--- a/libjava/java/lang/StringIndexOutOfBoundsException.java
+++ b/libjava/java/lang/StringIndexOutOfBoundsException.java
@@ -1,6 +1,6 @@
/* StringIndexOutOfBoundsException.java -- thrown to indicate attempt to
exceed string bounds
- Copyright (C) 1998, 1999, 2001, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2001, 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -46,7 +46,7 @@ package java.lang;
* which would be out of bounds.
*
* @author Brian Jones
- * @author Warren Levy <warrenl@cygnus.com>
+ * @author Warren Levy (warrenl@cygnus.com)
* @status updated to 1.4
*/
public class StringIndexOutOfBoundsException extends IndexOutOfBoundsException
diff --git a/libjava/java/lang/ThreadDeath.java b/libjava/java/lang/ThreadDeath.java
index 3ba4cf899ec..29c452e30b8 100644
--- a/libjava/java/lang/ThreadDeath.java
+++ b/libjava/java/lang/ThreadDeath.java
@@ -1,5 +1,5 @@
/* ThreadDeath.java - special exception registering Thread death
- Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2000, 2001, 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -48,7 +48,7 @@ package java.lang;
* deprecated Thread.stop() method.
*
* @author John Keiser
- * @author Tom Tromey <tromey@cygnus.com>
+ * @author Tom Tromey (tromey@cygnus.com)
* @see Thread#stop()
* @status updated to 1.4
*/
diff --git a/libjava/java/lang/ThreadGroup.java b/libjava/java/lang/ThreadGroup.java
index 89aff3f0249..0464767bf17 100644
--- a/libjava/java/lang/ThreadGroup.java
+++ b/libjava/java/lang/ThreadGroup.java
@@ -1,5 +1,5 @@
/* ThreadGroup -- a group of Threads
- Copyright (C) 1998, 2000, 2001, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1998, 2000, 2001, 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -48,7 +48,7 @@ import java.util.Vector;
* @author John Keiser
* @author Tom Tromey
* @author Bryce McKinlay
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Eric Blake (ebb9@email.byu.edu)
* @see Thread
* @since 1.0
* @status updated to 1.4
diff --git a/libjava/java/lang/Throwable.java b/libjava/java/lang/Throwable.java
index e082548300b..ad5157823f5 100644
--- a/libjava/java/lang/Throwable.java
+++ b/libjava/java/lang/Throwable.java
@@ -1,5 +1,5 @@
/* java.lang.Throwable -- Root class for all Exceptions and Errors
- Copyright (C) 1998, 1999, 2002, 2004 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2002, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -98,7 +98,7 @@ import java.io.Serializable;
* @author John Keiser
* @author Mark Wielaard
* @author Tom Tromey
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Eric Blake (ebb9@email.byu.edu)
* @since 1.0
* @status updated to 1.4
*/
diff --git a/libjava/java/lang/UnsatisfiedLinkError.java b/libjava/java/lang/UnsatisfiedLinkError.java
index 95c0b5333a4..ab4095644a7 100644
--- a/libjava/java/lang/UnsatisfiedLinkError.java
+++ b/libjava/java/lang/UnsatisfiedLinkError.java
@@ -1,5 +1,5 @@
/* UnsatisfiedLinkError.java -- thrown when a native method cannot be loaded
- Copyright (C) 1998, 1999, 2001, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2001, 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -44,7 +44,7 @@ package java.lang;
* cannot be found by the Java Virtual Machine.
*
* @author Brian Jones
- * @author Tom Tromey <tromey@cygnus.com>
+ * @author Tom Tromey (tromey@cygnus.com)
* @see Runtime
* @status updated to 1.4
*/
diff --git a/libjava/java/lang/UnsupportedOperationException.java b/libjava/java/lang/UnsupportedOperationException.java
index 6c00bef4342..efbb844b337 100644
--- a/libjava/java/lang/UnsupportedOperationException.java
+++ b/libjava/java/lang/UnsupportedOperationException.java
@@ -1,6 +1,6 @@
/* UnsupportedOperationException.java -- thrown when an operation is not
supported
- Copyright (C) 1998, 1999, 2001, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2001, 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -43,7 +43,7 @@ package java.lang;
* This exception is thrown by an object when an operation is
* requested of it that it does not support.
*
- * @author Warren Levy <warrenl@cygnus.com>
+ * @author Warren Levy (warrenl@cygnus.com)
* @since 1.2
* @status updated to 1.4
*/
diff --git a/libjava/java/lang/VMClassLoader.java b/libjava/java/lang/VMClassLoader.java
index e21bb649542..c48fc709991 100644
--- a/libjava/java/lang/VMClassLoader.java
+++ b/libjava/java/lang/VMClassLoader.java
@@ -51,8 +51,10 @@ import java.security.ProtectionDomain;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.HashMap;
+import java.util.HashSet;
import java.util.Map;
import java.util.StringTokenizer;
+import gnu.gcj.runtime.BootClassLoader;
/**
* java.lang.VMClassLoader is a package-private helper for VMs to implement
@@ -82,6 +84,21 @@ final class VMClassLoader
static final HashMap definedPackages = new HashMap();
+ // This is a helper for handling java.endorsed.dirs. It is null
+ // until we've initialized the system, at which point it is created.
+ static BootClassLoader bootLoader;
+
+ // This keeps track of shared libraries we've already tried to load.
+ private static HashSet tried_libraries;
+
+ // Holds one of the LIB_* constants; used to determine how shared
+ // library loads are done.
+ private static int lib_control;
+
+ private static final int LIB_FULL = 0;
+ private static final int LIB_CACHE = 1;
+ private static final int LIB_NEVER = 2;
+
/**
* Helper to define a class using a string of bytes. This assumes that
* the security checks have already been performed, if necessary.
@@ -153,6 +170,8 @@ final class VMClassLoader
*/
static URL getResource(String name)
{
+ if (bootLoader != null)
+ return bootLoader.bootGetResource(name);
return null;
}
@@ -168,6 +187,8 @@ final class VMClassLoader
*/
static Enumeration getResources(String name) throws IOException
{
+ if (bootLoader != null)
+ return bootLoader.bootGetResources(name);
return EmptyEnumeration.getInstance();
}
@@ -287,6 +308,32 @@ final class VMClassLoader
static native ClassLoader getSystemClassLoaderInternal();
+ static native void initBootLoader(String libdir);
+
+ static void initialize(String libdir)
+ {
+ initBootLoader(libdir);
+
+ String p
+ = System.getProperty ("gnu.gcj.runtime.VMClassLoader.library_control",
+ "");
+ if ("never".equals(p))
+ lib_control = LIB_NEVER;
+ else if ("cache".equals(p))
+ lib_control = LIB_CACHE;
+ else if ("full".equals(p))
+ lib_control = LIB_FULL;
+ else
+ lib_control = LIB_CACHE;
+
+ tried_libraries = new HashSet();
+ }
+
+ /**
+ * Possibly load a .so and search it for classes.
+ */
+ static native Class nativeFindClass(String name);
+
static ClassLoader getSystemClassLoader()
{
// This method is called as the initialization of systemClassLoader,
@@ -304,14 +351,13 @@ final class VMClassLoader
default_sys
= (ClassLoader) c.newInstance(new Object[] { default_sys });
}
- catch (Exception e)
+ catch (Exception ex)
{
- System.err.println("Requested system classloader "
- + loader + " failed, using "
- + "gnu.gcj.runtime.VMClassLoader");
- e.printStackTrace();
+ throw new Error("Failed to load requested system classloader "
+ + loader, ex);
}
}
+
return default_sys;
}
}
diff --git a/libjava/java/lang/VMCompiler.java b/libjava/java/lang/VMCompiler.java
index 3eb4491ecec..6961a31d905 100644
--- a/libjava/java/lang/VMCompiler.java
+++ b/libjava/java/lang/VMCompiler.java
@@ -79,6 +79,24 @@ final class VMCompiler
private static Vector precompiledMapFiles;
+ // We create a single MD5 engine and then clone it whenever we want
+ // a new one. This is simpler than trying to find a new one each
+ // time, and it avoids potential deadlocks due to class loader
+ // oddities.
+ private static final MessageDigest md5Digest;
+
+ static
+ {
+ try
+ {
+ md5Digest = MessageDigest.getInstance("MD5");
+ }
+ catch (NoSuchAlgorithmException _)
+ {
+ md5Digest = null;
+ }
+ }
+
static
{
gcjJitCompiler = System.getProperty("gnu.gcj.jit.compiler");
@@ -123,6 +141,10 @@ final class VMCompiler
catch (java.io.IOException _)
{
}
+ catch (java.nio.BufferUnderflowException _)
+ {
+ // Invalid map file.
+ }
}
}
}
@@ -142,7 +164,8 @@ final class VMCompiler
{
Class c = null;
SharedLibHelper helper
- = SharedLibHelper.findHelper (loader, fileName, domain.getCodeSource());
+ = SharedLibHelper.findHelper (loader, fileName, domain.getCodeSource(),
+ domain, false);
c = helper.findClass (className);
if (c != null)
{
@@ -174,11 +197,18 @@ final class VMCompiler
try
{
- MessageDigest md = MessageDigest.getInstance("MD5");
+ MessageDigest md = (MessageDigest) md5Digest.clone();
digest = md.digest(data);
}
- catch (NoSuchAlgorithmException _)
+ catch (CloneNotSupportedException _)
+ {
+ // Can't happen.
+ return null;
+ }
+ catch (NullPointerException _)
{
+ // If md5Digest==null -- but really this should never happen
+ // either, since the MD5 digest is in libgcj.
return null;
}
diff --git a/libjava/java/lang/VerifyError.java b/libjava/java/lang/VerifyError.java
index 3926530f9f3..c5ae8dd83ea 100644
--- a/libjava/java/lang/VerifyError.java
+++ b/libjava/java/lang/VerifyError.java
@@ -1,5 +1,5 @@
/* VerifyError.java -- thrown when a class fails verification
- Copyright (C) 1998, 1999, 2001, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2001, 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -43,7 +43,7 @@ package java.lang;
* internal inconsistency in a class file as detected by the "verifier."
*
* @author Brian Jones
- * @author Tom Tromey <tromey@cygnus.com>
+ * @author Tom Tromey (tromey@cygnus.com)
* @status updated to 1.4
*/
public class VerifyError extends LinkageError
diff --git a/libjava/java/lang/VirtualMachineError.java b/libjava/java/lang/VirtualMachineError.java
index b6f0758e862..161e4e647b3 100644
--- a/libjava/java/lang/VirtualMachineError.java
+++ b/libjava/java/lang/VirtualMachineError.java
@@ -1,5 +1,5 @@
/* VirtualMachineError.java -- thrown when the Virtual Machine has a problem
- Copyright (C) 1998, 1999, 2001, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2001, 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -44,7 +44,7 @@ package java.lang;
* it does not have the resources needed for it to continue execution.
*
* @author Brian Jones
- * @author Tom Tromey <tromey@cygnus.com>
+ * @author Tom Tromey (tromey@cygnus.com)
* @status updated to 1.4
*/
public abstract class VirtualMachineError extends Error
diff --git a/libjava/java/lang/natClass.cc b/libjava/java/lang/natClass.cc
index 0e9c26c7b4f..f29f6674764 100644
--- a/libjava/java/lang/natClass.cc
+++ b/libjava/java/lang/natClass.cc
@@ -1,6 +1,6 @@
// natClass.cc - Implementation of java.lang.Class native methods.
-/* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004
+/* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
Free Software Foundation
This file is part of libgcj.
@@ -973,13 +973,13 @@ _Jv_LookupInterfaceMethod (jclass klass, _Jv_Utf8Const *name,
if (Modifier::isStatic(meth->accflags))
throw new java::lang::IncompatibleClassChangeError
- (_Jv_GetMethodString (klass, meth->name));
+ (_Jv_GetMethodString (klass, meth));
if (Modifier::isAbstract(meth->accflags))
throw new java::lang::AbstractMethodError
- (_Jv_GetMethodString (klass, meth->name));
+ (_Jv_GetMethodString (klass, meth));
if (! Modifier::isPublic(meth->accflags))
throw new java::lang::IllegalAccessError
- (_Jv_GetMethodString (klass, meth->name));
+ (_Jv_GetMethodString (klass, meth));
_Jv_AddMethodToCache (klass, meth);
diff --git a/libjava/java/lang/natClassLoader.cc b/libjava/java/lang/natClassLoader.cc
index 17b2a883386..ed43b7aeb8b 100644
--- a/libjava/java/lang/natClassLoader.cc
+++ b/libjava/java/lang/natClassLoader.cc
@@ -26,7 +26,6 @@ details. */
#include <java/lang/Character.h>
#include <java/lang/Thread.h>
#include <java/lang/ClassLoader.h>
-#include <gnu/gcj/runtime/VMClassLoader.h>
#include <java/lang/InternalError.h>
#include <java/lang/IllegalAccessError.h>
#include <java/lang/LinkageError.h>
@@ -43,6 +42,7 @@ details. */
#include <java/io/Serializable.h>
#include <java/lang/Cloneable.h>
#include <java/util/HashMap.h>
+#include <gnu/gcj/runtime/BootClassLoader.h>
// Size of local hash table.
#define HASH_LEN 1013
@@ -65,6 +65,17 @@ static int bootstrap_index;
+jclass
+java::lang::ClassLoader::loadClassFromSig(jstring name)
+{
+ int len = _Jv_GetStringUTFLength (name);
+ char sig[len + 1];
+ _Jv_GetStringUTFRegion (name, 0, name->length(), sig);
+ return _Jv_FindClassFromSignature(sig, this);
+}
+
+
+
// This tries to find a class in our built-in cache. This cache is
// used only for classes which are linked in to the executable or
// loaded via dlopen().
@@ -106,7 +117,7 @@ void
_Jv_RegisterInitiatingLoader (jclass klass, java::lang::ClassLoader *loader)
{
if (! loader)
- loader = java::lang::ClassLoader::getSystemClassLoader();
+ loader = java::lang::VMClassLoader::bootLoader;
loader->loadedClasses->put(klass->name->toString(), klass);
}
@@ -116,7 +127,7 @@ void
_Jv_UnregisterInitiatingLoader (jclass klass, java::lang::ClassLoader *loader)
{
if (! loader)
- loader = java::lang::ClassLoader::getSystemClassLoader();
+ loader = java::lang::VMClassLoader::bootLoader;
loader->loadedClasses->remove(klass->name->toString());
}
@@ -211,36 +222,37 @@ _Jv_FindClass (_Jv_Utf8Const *name, java::lang::ClassLoader *loader)
// See if the class was already loaded by this loader. This handles
// initiating loader checks, as we register classes with their
// initiating loaders.
- java::lang::ClassLoader *sys
- = java::lang::ClassLoader::getSystemClassLoader ();
+
+ java::lang::ClassLoader *boot = java::lang::VMClassLoader::bootLoader;
java::lang::ClassLoader *real = loader;
if (! real)
- real = sys;
+ real = boot;
jstring sname = name->toString();
// We might still be bootstrapping the VM, in which case there
- // won't be a system class loader yet.
+ // won't be a bootstrap class loader yet.
jclass klass = real ? real->findLoadedClass (sname) : NULL;
if (! klass)
{
if (loader)
{
- // Load using a user-defined loader, jvmspec 5.3.2
- klass = loader->loadClass(sname, false);
+ // Load using a user-defined loader, jvmspec 5.3.2.
+ // Note that we explicitly must call the single-argument form.
+ klass = loader->loadClass(sname);
// If "loader" delegated the loadClass operation to another
// loader, explicitly register that it is also an initiating
// loader of the given class.
- java::lang::ClassLoader *delegate = (loader == sys
+ java::lang::ClassLoader *delegate = (loader == boot
? NULL
: loader);
if (klass && klass->getClassLoaderInternal () != delegate)
_Jv_RegisterInitiatingLoader (klass, loader);
}
- else if (sys)
+ else if (boot)
{
// Load using the bootstrap loader jvmspec 5.3.1.
- klass = sys->loadClass (sname, false);
+ klass = java::lang::VMClassLoader::loadClass (sname, false);
// Register that we're an initiating loader.
if (klass)
@@ -251,15 +263,30 @@ _Jv_FindClass (_Jv_Utf8Const *name, java::lang::ClassLoader *loader)
// Not even a bootstrap loader, try the built-in cache.
klass = _Jv_FindClassInCache (name);
- if (bootstrap_index == BOOTSTRAP_CLASS_LIST_SIZE)
- abort ();
- bootstrap_class_list[bootstrap_index++] = klass;
+ if (klass)
+ {
+ bool found = false;
+ for (int i = 0; i < bootstrap_index; ++i)
+ {
+ if (bootstrap_class_list[i] == klass)
+ {
+ found = true;
+ break;
+ }
+ }
+ if (! found)
+ {
+ if (bootstrap_index == BOOTSTRAP_CLASS_LIST_SIZE)
+ abort ();
+ bootstrap_class_list[bootstrap_index++] = klass;
+ }
+ }
}
}
else
{
- // we need classes to be in the hash while
- // we're loading, so that they can refer to themselves.
+ // We need classes to be in the hash while we're loading, so
+ // that they can refer to themselves.
_Jv_Linker::wait_for_state (klass, JV_STATE_LOADED);
}
diff --git a/libjava/java/lang/natDouble.cc b/libjava/java/lang/natDouble.cc
index dfec5967a9b..72fe5fbe1c6 100644
--- a/libjava/java/lang/natDouble.cc
+++ b/libjava/java/lang/natDouble.cc
@@ -1,6 +1,6 @@
// natDouble.cc - Implementation of java.lang.Double native methods.
-/* Copyright (C) 1998, 1999, 2000, 2001, 2003 Free Software Foundation
+/* Copyright (C) 1998, 1999, 2000, 2001, 2003, 2005 Free Software Foundation
This file is part of libgcj.
@@ -167,11 +167,15 @@ java::lang::Double::parseDouble(jstring str)
length--;
// The String could end with a f/F/d/D which is valid but we don't need.
+ bool saw_trailer = false;
if (length > 0)
{
jchar last = str->charAt(length-1);
if (last == 'f' || last == 'F' || last == 'd' || last == 'D')
- length--;
+ {
+ length--;
+ saw_trailer = true;
+ }
}
jsize start = 0;
@@ -186,6 +190,17 @@ java::lang::Double::parseDouble(jstring str)
jsize blength = _Jv_GetStringUTFRegion (str, start, length, data);
data[blength] = 0;
+ if (! saw_trailer)
+ {
+ if (! strcmp (data, "NaN") || ! strcmp (data, "+NaN")
+ || ! strcmp (data, "-NaN"))
+ return NaN;
+ else if (! strcmp (data, "Infinity") || ! strcmp (data, "+Infinity"))
+ return POSITIVE_INFINITY;
+ else if (! strcmp (data, "-Infinity"))
+ return NEGATIVE_INFINITY;
+ }
+
struct _Jv_reent reent;
memset (&reent, 0, sizeof reent);
diff --git a/libjava/java/lang/natRuntime.cc b/libjava/java/lang/natRuntime.cc
index 0f3b7987af4..00293a1d5ce 100644
--- a/libjava/java/lang/natRuntime.cc
+++ b/libjava/java/lang/natRuntime.cc
@@ -163,7 +163,7 @@ java::lang::Runtime::_load (jstring path, jboolean do_search)
if (do_search)
{
- ClassLoader *sys = ClassLoader::getSystemClassLoader();
+ ClassLoader *sys = ClassLoader::systemClassLoader;
ClassLoader *look = NULL;
gnu::gcj::runtime::StackTrace *t = new gnu::gcj::runtime::StackTrace(10);
try
@@ -391,8 +391,8 @@ java::lang::Runtime::insertSystemProperties (java::util::Properties *newprops)
// (introduced in 1.2), and earlier versioning properties. Some
// programs rely on seeing values that they expect, so we claim to
// be a 1.4-ish VM for their sake.
- SET ("java.version", "1.4.2");
- SET ("java.runtime.version", "1.4.2");
+ SET ("java.version", JV_VERSION);
+ SET ("java.runtime.version", JV_VERSION);
SET ("java.vendor", "Free Software Foundation, Inc.");
SET ("java.vendor.url", "http://gcc.gnu.org/java/");
SET ("java.class.version", "46.0");
@@ -402,7 +402,7 @@ java::lang::Runtime::insertSystemProperties (java::util::Properties *newprops)
SET ("java.vm.version", __VERSION__);
SET ("java.vm.vendor", "Free Software Foundation, Inc.");
SET ("java.vm.name", "GNU libgcj");
- SET ("java.specification.version", "1.4");
+ SET ("java.specification.version", JV_API_VERSION);
SET ("java.specification.name", "Java(tm) Platform API Specification");
SET ("java.specification.vendor", "Sun Microsystems Inc.");
@@ -420,7 +420,7 @@ java::lang::Runtime::insertSystemProperties (java::util::Properties *newprops)
// part we do this because most people specify only --prefix and
// nothing else when installing gcj. Plus, people are free to
// redefine `java.home' with `-D' if necessary.
- SET ("java.home", PREFIX);
+ SET ("java.home", JAVA_HOME);
SET ("gnu.classpath.home", PREFIX);
// This is set to $(libdir) because we use this to find .security
// files at runtime.
@@ -436,8 +436,18 @@ java::lang::Runtime::insertSystemProperties (java::util::Properties *newprops)
if (! uname (&u))
{
SET ("os.name", u.sysname);
- SET ("os.arch", u.machine);
SET ("os.version", u.release);
+
+ // Normalize x86 architecture names to "i386" (except on Windows, which
+ // is handled in win32.cc).
+ if (u.machine[0] == 'i'
+ && u.machine[1] != 0
+ && u.machine[2] == '8'
+ && u.machine[3] == '6'
+ && u.machine[4] == 0)
+ SET ("os.arch", "i386");
+ else
+ SET ("os.arch", u.machine);
}
else
{
@@ -540,14 +550,22 @@ java::lang::Runtime::insertSystemProperties (java::util::Properties *newprops)
// The java extensions directory.
SET ("java.ext.dirs", JAVA_EXT_DIRS);
+ // The endorsed directories that libgcj knows about by default.
+ // This is a way to get other jars into the boot class loader
+ // without overriding java.endorsed.dirs.
+ SET ("gnu.gcj.runtime.endorsed.dirs", GCJ_ENDORSED_DIRS);
+
// The path to libgcj's boot classes
SET ("sun.boot.class.path", BOOT_CLASS_PATH);
+ // If there is a default system database, set it.
+ SET ("gnu.gcj.precompiled.db.path", LIBGCJ_DEFAULT_DATABASE);
+
// Set some properties according to whatever was compiled in with
// `-D'. Important: after this point, the only properties that
// should be set are those which either the user cannot meaningfully
// override, or which augment whatever value the user has provided.
- for (int i = 0; _Jv_Compiler_Properties[i]; ++i)
+ for (int i = 0; i < _Jv_Properties_Count; ++i)
{
const char *s, *p;
// Find the `='.
@@ -573,30 +591,6 @@ java::lang::Runtime::insertSystemProperties (java::util::Properties *newprops)
}
#endif
- if (_Jv_Jar_Class_Path)
- newprops->put(JvNewStringLatin1 ("java.class.path"),
- JvNewStringLatin1 (_Jv_Jar_Class_Path));
- else
- {
- // FIXME: find libgcj.zip and append its path?
- char *classpath = ::getenv("CLASSPATH");
- jstring cp = newprops->getProperty (JvNewStringLatin1("java.class.path"));
- java::lang::StringBuffer *sb = new java::lang::StringBuffer ();
-
- if (classpath)
- {
- sb->append (JvNewStringLatin1 (classpath));
- sb->append (_Jv_platform_path_separator);
- }
- if (cp != NULL)
- sb->append (cp);
- else
- sb->append ((jchar) '.');
-
- newprops->put(JvNewStringLatin1 ("java.class.path"),
- sb->toString ());
- }
-
// The name used to invoke this process (argv[0] in C).
SET ("gnu.gcj.progname", _Jv_GetSafeArg (0));
diff --git a/libjava/java/lang/natVMClassLoader.cc b/libjava/java/lang/natVMClassLoader.cc
index 1da79497154..182b8d72743 100644
--- a/libjava/java/lang/natVMClassLoader.cc
+++ b/libjava/java/lang/natVMClassLoader.cc
@@ -23,13 +23,17 @@ details. */
#include <java/lang/VMClassLoader.h>
#include <java/lang/VMCompiler.h>
-#include <gnu/gcj/runtime/VMClassLoader.h>
+#include <gnu/gcj/runtime/ExtensionClassLoader.h>
#include <gnu/gcj/runtime/SystemClassLoader.h>
+#include <gnu/gcj/runtime/BootClassLoader.h>
#include <java/lang/ClassLoader.h>
#include <java/lang/Class.h>
#include <java/lang/Throwable.h>
#include <java/security/ProtectionDomain.h>
#include <java/lang/ClassFormatError.h>
+#include <java/lang/StringBuffer.h>
+#include <java/lang/Runtime.h>
+#include <java/util/HashSet.h>
void
java::lang::VMClassLoader::resolveClass (jclass klass)
@@ -66,9 +70,9 @@ java::lang::VMClassLoader::defineClass (java::lang::ClassLoader *loader,
// until we're done loading.
JvSynchronize sync (klass);
- // Record the defining loader. For the system class loader, we
- // record NULL.
- if (loader != java::lang::ClassLoader::getSystemClassLoader())
+ // Record the defining loader. For the bootstrap class loader,
+ // we record NULL.
+ if (loader != bootLoader)
klass->loader = loader;
if (name != 0)
@@ -109,8 +113,8 @@ java::lang::VMClassLoader::defineClass (java::lang::ClassLoader *loader,
java::lang::ClassLoader *
java::lang::VMClassLoader::getSystemClassLoaderInternal()
{
- _Jv_InitClass (&gnu::gcj::runtime::VMClassLoader::class$);
- return gnu::gcj::runtime::VMClassLoader::system_instance;
+ _Jv_InitClass (&gnu::gcj::runtime::ExtensionClassLoader::class$);
+ return gnu::gcj::runtime::ExtensionClassLoader::system_instance;
}
jclass
@@ -119,14 +123,93 @@ java::lang::VMClassLoader::getPrimitiveClass (jchar type)
char sig[2];
sig[0] = (char) type;
sig[1] = '\0';
+ // Note: this cannot return NULL, since the input is always correct.
return _Jv_FindClassFromSignature (sig, NULL);
}
+void
+java::lang::VMClassLoader::initBootLoader(jstring libdir)
+{
+ bootLoader = new gnu::gcj::runtime::BootClassLoader(libdir);
+}
+
+jclass
+java::lang::VMClassLoader::nativeFindClass (jstring name)
+{
+ jclass klass = NULL;
+
+ if (lib_control != LIB_NEVER)
+ {
+ // Turn `gnu.pkg.quux' into `lib-gnu-pkg-quux'. Then search for
+ // a module named (eg, on Linux) `lib-gnu-pkg-quux.so', followed
+ // by `lib-gnu-pkg.so' and `lib-gnu.so'. If loading one of
+ // these causes the class to appear in the cache, then use it.
+ java::lang::StringBuffer *sb
+ = new java::lang::StringBuffer (JvNewStringLatin1("lib-"));
+ // Skip inner classes
+ jstring cn;
+ jint ci = name->indexOf('$');
+ if (ci == -1)
+ cn = name;
+ else
+ cn = name->substring (0, ci);
+ jstring so_base_name
+ = (sb->append (cn)->toString ())->replace ('.', '-');
+
+ using namespace ::java::lang;
+ Runtime *rt = Runtime::getRuntime();
+
+ _Jv_Utf8Const *name_u = NULL;
+
+ // Compare against `3' because that is the length of "lib".
+ while (! klass && so_base_name && so_base_name->length() > 3)
+ {
+ if (lib_control == LIB_CACHE)
+ {
+ // If we've already tried this name, we're done.
+ if (tried_libraries->contains(so_base_name))
+ break;
+ tried_libraries->add(so_base_name);
+ }
+
+ jboolean loaded = rt->loadLibraryInternal (so_base_name);
+
+ jint nd = so_base_name->lastIndexOf ('-');
+ if (nd == -1)
+ so_base_name = NULL;
+ else
+ so_base_name = so_base_name->substring (0, nd);
+
+ if (loaded)
+ {
+ if (name_u == NULL)
+ name_u = _Jv_makeUtf8Const (name);
+ klass = _Jv_FindClassInCache (name_u);
+ }
+ }
+ }
+
+ if (klass)
+ definePackageForNative(name);
+
+ return klass;
+}
+
jclass
java::lang::VMClassLoader::loadClass(jstring name, jboolean resolve)
{
- _Jv_Utf8Const *utf = _Jv_makeUtf8Const (name);
- jclass klass = _Jv_FindClassInCache (utf);
+ // We try the boot loader first, so that the endorsed directory
+ // overrides compiled-in classes.
+ jclass klass = NULL;
+ if (bootLoader)
+ klass = bootLoader->bootLoadClass(name);
+ if (! klass)
+ {
+ _Jv_Utf8Const *utf = _Jv_makeUtf8Const (name);
+ klass = _Jv_FindClassInCache (utf);
+ }
+ if (! klass)
+ klass = nativeFindClass(name);
if (klass)
{
// We never want to return a class without its supers linked.
diff --git a/libjava/java/lang/reflect/AccessibleObject.java b/libjava/java/lang/reflect/AccessibleObject.java
index 5b5b5f6ff52..d50f3de9dec 100644
--- a/libjava/java/lang/reflect/AccessibleObject.java
+++ b/libjava/java/lang/reflect/AccessibleObject.java
@@ -1,5 +1,5 @@
/* java.lang.reflect.AccessibleObject
- Copyright (C) 2001 Free Software Foundation, Inc.
+ Copyright (C) 2001, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -46,8 +46,8 @@ package java.lang.reflect;
* to mess with this, don't try. Fortunately, there are adequate
* security checks before you can set a reflection object as accessible.
*
- * @author Tom Tromey <tromey@cygnus.com>
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Tom Tromey (tromey@cygnus.com)
+ * @author Eric Blake (ebb9@email.byu.edu)
* @see Field
* @see Constructor
* @see Method
diff --git a/libjava/java/lang/reflect/Array.java b/libjava/java/lang/reflect/Array.java
index 11b0d97e9da..5df6dbd0e8d 100644
--- a/libjava/java/lang/reflect/Array.java
+++ b/libjava/java/lang/reflect/Array.java
@@ -1,5 +1,5 @@
/* java.lang.reflect.Array - manipulate arrays by reflection
- Copyright (C) 1998, 1999, 2001, 2003 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2001, 2003, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -63,8 +63,8 @@ import gnu.classpath.Configuration;
* worse if you do this and use the generic set() function.
*
* @author John Keiser
- * @author Eric Blake <ebb9@email.byu.edu>
- * @author Per Bothner <bothner@cygnus.com>
+ * @author Eric Blake (ebb9@email.byu.edu)
+ * @author Per Bothner (bothner@cygnus.com)
* @see java.lang.Boolean#TYPE
* @see java.lang.Byte#TYPE
* @see java.lang.Short#TYPE
diff --git a/libjava/java/lang/reflect/Field.java b/libjava/java/lang/reflect/Field.java
index b54a103d9bc..cb852cf2fb2 100644
--- a/libjava/java/lang/reflect/Field.java
+++ b/libjava/java/lang/reflect/Field.java
@@ -23,6 +23,9 @@ public final class Field extends AccessibleObject implements Member
// Offset in bytes from the start of declaringClass's fields array.
private int offset;
+ // The Class (or primitive TYPE) of this field.
+ private Class type;
+
// This is instantiated by Class sometimes, but it uses C++ and
// avoids the Java protection check.
Field ()
@@ -136,76 +139,79 @@ public final class Field extends AccessibleObject implements Member
public void setByte (Object obj, byte b)
throws IllegalArgumentException, IllegalAccessException
{
- setByte(null, obj, b);
+ setByte(null, obj, b, true);
}
public void setShort (Object obj, short s)
throws IllegalArgumentException, IllegalAccessException
{
- setShort(null, obj, s);
+ setShort(null, obj, s, true);
}
public void setInt (Object obj, int i)
throws IllegalArgumentException, IllegalAccessException
{
- setInt(null, obj, i);
+ setInt(null, obj, i, true);
}
public void setLong (Object obj, long l)
throws IllegalArgumentException, IllegalAccessException
{
- setLong(null, obj, l);
+ setLong(null, obj, l, true);
}
public void setFloat (Object obj, float f)
throws IllegalArgumentException, IllegalAccessException
{
- setFloat(null, obj, f);
+ setFloat(null, obj, f, true);
}
public void setDouble (Object obj, double d)
throws IllegalArgumentException, IllegalAccessException
{
- setDouble(null, obj, d);
+ setDouble(null, obj, d, true);
}
public void setChar (Object obj, char c)
throws IllegalArgumentException, IllegalAccessException
{
- setChar(null, obj, c);
+ setChar(null, obj, c, true);
}
public void setBoolean (Object obj, boolean b)
throws IllegalArgumentException, IllegalAccessException
{
- setBoolean(null, obj, b);
+ setBoolean(null, obj, b, true);
}
- private native void setByte (Class caller, Object obj, byte b)
+ native void setByte (Class caller, Object obj, byte b, boolean checkFinal)
throws IllegalArgumentException, IllegalAccessException;
- private native void setShort (Class caller, Object obj, short s)
+ native void setShort (Class caller, Object obj, short s, boolean checkFinal)
throws IllegalArgumentException, IllegalAccessException;
- private native void setInt (Class caller, Object obj, int i)
+ native void setInt (Class caller, Object obj, int i, boolean checkFinal)
throws IllegalArgumentException, IllegalAccessException;
- private native void setLong (Class caller, Object obj, long l)
+ native void setLong (Class caller, Object obj, long l, boolean checkFinal)
throws IllegalArgumentException, IllegalAccessException;
- private native void setFloat (Class caller, Object obj, float f)
+ native void setFloat (Class caller, Object obj, float f, boolean checkFinal)
throws IllegalArgumentException, IllegalAccessException;
- private native void setDouble (Class caller, Object obj, double d)
+ native void setDouble (Class caller, Object obj, double d,
+ boolean checkFinal)
throws IllegalArgumentException, IllegalAccessException;
- private native void setChar (Class caller, Object obj, char c)
+ native void setChar (Class caller, Object obj, char c, boolean checkFinal)
throws IllegalArgumentException, IllegalAccessException;
- private native void setBoolean (Class caller, Object obj, boolean b)
+ native void setBoolean (Class caller, Object obj, boolean b,
+ boolean checkFinal)
throws IllegalArgumentException, IllegalAccessException;
- private native void set (Class caller, Object obj, Object val, Class type)
+ native void set (Class caller, Object obj, Object val, Class type,
+ boolean checkFinal)
throws IllegalArgumentException, IllegalAccessException;
public void set (Object object, Object value)
@@ -219,23 +225,23 @@ public final class Field extends AccessibleObject implements Member
{
Class type = getType();
if (! type.isPrimitive())
- set(caller, object, value, type);
+ set(caller, object, value, type, true);
else if (value instanceof Byte)
- setByte(caller, object, ((Byte) value).byteValue());
+ setByte(caller, object, ((Byte) value).byteValue(), true);
else if (value instanceof Short)
- setShort (caller, object, ((Short) value).shortValue());
+ setShort (caller, object, ((Short) value).shortValue(), true);
else if (value instanceof Integer)
- setInt(caller, object, ((Integer) value).intValue());
+ setInt(caller, object, ((Integer) value).intValue(), true);
else if (value instanceof Long)
- setLong(caller, object, ((Long) value).longValue());
+ setLong(caller, object, ((Long) value).longValue(), true);
else if (value instanceof Float)
- setFloat(caller, object, ((Float) value).floatValue());
+ setFloat(caller, object, ((Float) value).floatValue(), true);
else if (value instanceof Double)
- setDouble(caller, object, ((Double) value).doubleValue());
+ setDouble(caller, object, ((Double) value).doubleValue(), true);
else if (value instanceof Character)
- setChar(caller, object, ((Character) value).charValue());
+ setChar(caller, object, ((Character) value).charValue(), true);
else if (value instanceof Boolean)
- setBoolean(caller, object, ((Boolean) value).booleanValue());
+ setBoolean(caller, object, ((Boolean) value).booleanValue(), true);
else
throw new IllegalArgumentException();
}
diff --git a/libjava/java/lang/reflect/InvocationTargetException.java b/libjava/java/lang/reflect/InvocationTargetException.java
index 904cc631324..2593921a3e6 100644
--- a/libjava/java/lang/reflect/InvocationTargetException.java
+++ b/libjava/java/lang/reflect/InvocationTargetException.java
@@ -1,5 +1,5 @@
/* InvocationTargetException.java -- Wrapper exception for reflection
- Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2000, 2001, 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -45,8 +45,8 @@ package java.lang.reflect;
* exceptions, but <code>getTargetException()</code> still works.
*
* @author John Keiser
- * @author Tom Tromey <tromey@cygnus.com>
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Tom Tromey (tromey@cygnus.com)
+ * @author Eric Blake (ebb9@email.byu.edu)
* @see Method#invoke(Object,Object[])
* @see Constructor#newInstance(Object[])
* @since 1.1
diff --git a/libjava/java/lang/reflect/Member.java b/libjava/java/lang/reflect/Member.java
index 983d45230ec..ef980d8726d 100644
--- a/libjava/java/lang/reflect/Member.java
+++ b/libjava/java/lang/reflect/Member.java
@@ -1,5 +1,5 @@
/* java.lang.reflect.Member - common query methods in reflection
- Copyright (C) 1998, 1999, 2001 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2001, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -44,8 +44,8 @@ package java.lang.reflect;
* class, name or modifiers of the member with this interface.
*
* @author John Keiser
- * @author Per Bothner <bothner@cygnus.com>
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Per Bothner (bothner@cygnus.com)
+ * @author Eric Blake (ebb9@email.byu.edu)
* @see Class
* @see Field
* @see Method
diff --git a/libjava/java/lang/reflect/Modifier.java b/libjava/java/lang/reflect/Modifier.java
index 8171a88feb5..3b3baa6722e 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, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2001, 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -50,8 +50,8 @@ package java.lang.reflect;
* Sun does it, but I'm willing to bet money that it is.
*
* @author John Keiser
- * @author Tom Tromey <tromey@cygnus.com>
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Tom Tromey (tromey@cygnus.com)
+ * @author Eric Blake (ebb9@email.byu.edu)
* @see Member#getModifiers()
* @see Method#getModifiers()
* @see Field#getModifiers()
diff --git a/libjava/java/lang/reflect/Proxy.java b/libjava/java/lang/reflect/Proxy.java
index 8aee02fb47f..3f13254fdc3 100644
--- a/libjava/java/lang/reflect/Proxy.java
+++ b/libjava/java/lang/reflect/Proxy.java
@@ -1,5 +1,5 @@
/* Proxy.java -- build a proxy class that implements reflected interfaces
- Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -459,7 +459,7 @@ public class Proxy implements Serializable
* Helper class for mapping unique ClassLoader and interface combinations
* to proxy classes.
*
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Eric Blake (ebb9@email.byu.edu)
*/
private static final class ProxyType
{
@@ -565,7 +565,7 @@ public class Proxy implements Serializable
* without worrying about return type, declaring class, or throws clause,
* and which reduces the maximally common throws clause between two methods
*
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Eric Blake (ebb9@email.byu.edu)
*/
private static final class ProxySignature
{
@@ -718,7 +718,7 @@ public class Proxy implements Serializable
* A flat representation of all data needed to generate bytecode/instantiate
* a proxy class. This is basically a struct.
*
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Eric Blake (ebb9@email.byu.edu)
*/
private static final class ProxyData
{
@@ -871,7 +871,7 @@ public class Proxy implements Serializable
* this code is not loaded in memory if the VM has a native
* implementation instead.
*
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Eric Blake (ebb9@email.byu.edu)
*/
private static final class ClassFactory
{
@@ -1347,7 +1347,7 @@ public class Proxy implements Serializable
return clazz;
}
- catch (Throwable e)
+ catch (Exception e)
{
// assert false;
throw (Error) new InternalError("Unexpected: " + e).initCause(e);
diff --git a/libjava/java/lang/reflect/ReflectPermission.java b/libjava/java/lang/reflect/ReflectPermission.java
index 400ca25afcc..26fd0fc4a7c 100644
--- a/libjava/java/lang/reflect/ReflectPermission.java
+++ b/libjava/java/lang/reflect/ReflectPermission.java
@@ -1,5 +1,5 @@
/* ReflectPermission.java - named permission for reflaction
- Copyright (C) 2000, 2001 Free Software Foundation, Inc.
+ Copyright (C) 2000, 2001, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -66,8 +66,8 @@ import java.security.BasicPermission;
* </tr>
* </table>
*
- * @author Tom Tromey <tromey@redhat.com>
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Tom Tromey (tromey@redhat.com)
+ * @author Eric Blake (ebb9@email.byu.edu)
* @since 1.2
* @status updated to 1.4
*/
diff --git a/libjava/java/lang/reflect/UndeclaredThrowableException.java b/libjava/java/lang/reflect/UndeclaredThrowableException.java
index d9596922beb..2e26e598859 100644
--- a/libjava/java/lang/reflect/UndeclaredThrowableException.java
+++ b/libjava/java/lang/reflect/UndeclaredThrowableException.java
@@ -1,6 +1,6 @@
/* UndeclaredThrowableException.java -- wraps an undeclared checked exception
thrown by a Proxy invocation handler
- Copyright (C) 2001, 2002 Free Software Foundation, Inc.
+ Copyright (C) 2001, 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -50,7 +50,7 @@ package java.lang.reflect;
* exception, never {@link Error} or {@link RuntimeException},
* which are unchecked.
*
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Eric Blake (ebb9@email.byu.edu)
* @see Proxy
* @see InvocationHandler
* @since 1.3
diff --git a/libjava/java/lang/reflect/natField.cc b/libjava/java/lang/reflect/natField.cc
index 7eb032227ab..9a8107b795d 100644
--- a/libjava/java/lang/reflect/natField.cc
+++ b/libjava/java/lang/reflect/natField.cc
@@ -45,14 +45,19 @@ java::lang::reflect::Field::getName ()
jclass
java::lang::reflect::Field::getType ()
{
- jfieldID fld = _Jv_FromReflectedField (this);
- JvSynchronize sync (declaringClass);
- _Jv_Linker::resolve_field (fld, declaringClass->getClassLoaderInternal ());
- return fld->type;
+ if (type == NULL)
+ {
+ jfieldID fld = _Jv_FromReflectedField (this);
+ JvSynchronize sync (declaringClass);
+ _Jv_Linker::resolve_field (fld, declaringClass->getClassLoaderInternal ());
+ type = fld->type;
+ }
+ return type;
}
static void*
-getAddr (java::lang::reflect::Field* field, jclass caller, jobject obj)
+getAddr (java::lang::reflect::Field* field, jclass caller, jobject obj,
+ jboolean checkFinal)
{
// FIXME: we know CALLER is NULL here. At one point we planned to
// have the compiler insert the caller as a hidden argument in some
@@ -63,6 +68,12 @@ getAddr (java::lang::reflect::Field* field, jclass caller, jobject obj)
jfieldID fld = _Jv_FromReflectedField (field);
_Jv_ushort flags = fld->getModifiers();
+
+ // Setting a final field is usually not allowed.
+ if (checkFinal
+ && field->getModifiers() & java::lang::reflect::Modifier::FINAL)
+ throw new java::lang::IllegalAccessException(JvNewStringUTF
+ ("Field is final"));
// Check accessibility, if required.
if (! (Modifier::isPublic (flags) || field->isAccessible()))
@@ -180,56 +191,56 @@ getDouble (jclass cls, void* addr)
jboolean
java::lang::reflect::Field::getBoolean (jclass caller, jobject obj)
{
- return ::getBoolean (this->getType(), getAddr (this, caller, obj));
+ return ::getBoolean (this->getType(), getAddr (this, caller, obj, false));
}
jchar
java::lang::reflect::Field::getChar (jclass caller, jobject obj)
{
- return ::getChar (this->getType(), getAddr (this, caller, obj));
+ return ::getChar (this->getType(), getAddr (this, caller, obj, false));
}
jbyte
java::lang::reflect::Field::getByte (jclass caller, jobject obj)
{
- return ::getByte (this->getType(), getAddr (this, caller, obj));
+ return ::getByte (this->getType(), getAddr (this, caller, obj, false));
}
jshort
java::lang::reflect::Field::getShort (jclass caller, jobject obj)
{
- return ::getShort (this->getType(), getAddr (this, caller, obj));
+ return ::getShort (this->getType(), getAddr (this, caller, obj, false));
}
jint
java::lang::reflect::Field::getInt (jclass caller, jobject obj)
{
- return ::getInt (this->getType(), getAddr (this, caller, obj));
+ return ::getInt (this->getType(), getAddr (this, caller, obj, false));
}
jlong
java::lang::reflect::Field::getLong (jclass caller, jobject obj)
{
- return ::getLong (this->getType(), getAddr (this, caller, obj));
+ return ::getLong (this->getType(), getAddr (this, caller, obj, false));
}
jfloat
java::lang::reflect::Field::getFloat (jclass caller, jobject obj)
{
- return ::getFloat (this->getType(), getAddr (this, caller, obj));
+ return ::getFloat (this->getType(), getAddr (this, caller, obj, false));
}
jdouble
java::lang::reflect::Field::getDouble (jclass caller, jobject obj)
{
- return ::getDouble (this->getType(), getAddr (this, caller, obj));
+ return ::getDouble (this->getType(), getAddr (this, caller, obj, false));
}
jobject
java::lang::reflect::Field::get (jclass caller, jobject obj)
{
jclass type = this->getType();
- void* addr = getAddr (this, caller, obj);
+ void* addr = getAddr (this, caller, obj, false);
if (! type->isPrimitive ())
return * (jobject*) addr;
if (type == JvPrimClass (double))
@@ -257,16 +268,6 @@ java::lang::reflect::Field::get (jclass caller, jobject obj)
throw new java::lang::IllegalArgumentException;
}
-static void*
-setAddr (java::lang::reflect::Field* field, jclass caller, jobject obj)
-{
- void *addr = getAddr(field, caller, obj);
- if (!field->isAccessible()
- && field->getModifiers() & java::lang::reflect::Modifier::FINAL)
- throw new java::lang::IllegalAccessException();
- return addr;
-}
-
static void
setBoolean (jclass type, void *addr, jboolean value)
{
@@ -378,57 +379,66 @@ setDouble (jclass type, void *addr, jdouble value)
}
void
-java::lang::reflect::Field::setBoolean (jclass caller, jobject obj, jboolean b)
+java::lang::reflect::Field::setBoolean (jclass caller, jobject obj, jboolean b,
+ jboolean checkFinal)
{
- ::setBoolean (this->getType(), setAddr (this, caller, obj), b);
+ ::setBoolean (this->getType(), getAddr (this, caller, obj, checkFinal), b);
}
void
-java::lang::reflect::Field::setChar (jclass caller, jobject obj, jchar c)
+java::lang::reflect::Field::setChar (jclass caller, jobject obj, jchar c,
+ jboolean checkFinal)
{
- ::setChar (this->getType(), setAddr (this, caller, obj), c);
+ ::setChar (this->getType(), getAddr (this, caller, obj, checkFinal), c);
}
void
-java::lang::reflect::Field::setByte (jclass caller, jobject obj, jbyte b)
+java::lang::reflect::Field::setByte (jclass caller, jobject obj, jbyte b,
+ jboolean checkFinal)
{
- ::setByte (this->getType(), setAddr (this, caller, obj), b);
+ ::setByte (this->getType(), getAddr (this, caller, obj, checkFinal), b);
}
void
-java::lang::reflect::Field::setShort (jclass caller, jobject obj, jshort s)
+java::lang::reflect::Field::setShort (jclass caller, jobject obj, jshort s,
+ jboolean checkFinal)
{
- ::setShort (this->getType(), setAddr (this, caller, obj), s);
+ ::setShort (this->getType(), getAddr (this, caller, obj, checkFinal), s);
}
void
-java::lang::reflect::Field::setInt (jclass caller, jobject obj, jint i)
+java::lang::reflect::Field::setInt (jclass caller, jobject obj, jint i,
+ jboolean checkFinal)
{
- ::setInt (this->getType(), setAddr (this, caller, obj), i);
+ ::setInt (this->getType(), getAddr (this, caller, obj, checkFinal), i);
}
void
-java::lang::reflect::Field::setLong (jclass caller, jobject obj, jlong l)
+java::lang::reflect::Field::setLong (jclass caller, jobject obj, jlong l,
+ jboolean checkFinal)
{
- ::setLong (this->getType(), setAddr (this, caller, obj), l);
+ ::setLong (this->getType(), getAddr (this, caller, obj, checkFinal), l);
}
+
void
-java::lang::reflect::Field::setFloat (jclass caller, jobject obj, jfloat f)
+java::lang::reflect::Field::setFloat (jclass caller, jobject obj, jfloat f,
+ jboolean checkFinal)
{
- ::setFloat (this->getType(), setAddr (this, caller, obj), f);
+ ::setFloat (this->getType(), getAddr (this, caller, obj, checkFinal), f);
}
void
-java::lang::reflect::Field::setDouble (jclass caller, jobject obj, jdouble d)
+java::lang::reflect::Field::setDouble (jclass caller, jobject obj, jdouble d,
+ jboolean checkFinal)
{
- ::setDouble (this->getType(), setAddr (this, caller, obj), d);
+ ::setDouble (this->getType(), getAddr (this, caller, obj, checkFinal), d);
}
void
java::lang::reflect::Field::set (jclass caller, jobject object, jobject value,
- jclass type)
+ jclass type, jboolean checkFinal)
{
- void* addr = setAddr (this, caller, object);
+ void* addr = getAddr (this, caller, object, checkFinal);
if (value != NULL && ! _Jv_IsInstanceOf (value, type))
throw new java::lang::IllegalArgumentException;
* (jobject*) addr = value;
diff --git a/libjava/java/lang/reflect/natMethod.cc b/libjava/java/lang/reflect/natMethod.cc
index b4b3a7a9b06..27c26e19ac7 100644
--- a/libjava/java/lang/reflect/natMethod.cc
+++ b/libjava/java/lang/reflect/natMethod.cc
@@ -1,6 +1,6 @@
// natMethod.cc - Native code for Method class.
-/* Copyright (C) 1998, 1999, 2000, 2001 , 2002, 2003, 2004 Free Software Foundation
+/* Copyright (C) 1998, 1999, 2000, 2001 , 2002, 2003, 2004, 2005 Free Software Foundation
This file is part of libgcj.
@@ -496,7 +496,7 @@ _Jv_CallAnyMethodA (jobject obj,
|| concrete_meth->ncode == NULL
|| Modifier::isAbstract(concrete_meth->accflags))
throw new java::lang::IncompatibleClassChangeError
- (_Jv_GetMethodString (vtable->clas, meth->name));
+ (_Jv_GetMethodString (vtable->clas, meth));
ncode = concrete_meth->ncode;
}
else
diff --git a/libjava/java/math/BigInteger.java b/libjava/java/math/BigInteger.java
index 3a822aa81c6..df948a3ecce 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, 2002, 2003 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -50,10 +50,10 @@ import java.util.Random;
* as "The Java Class Libraries", 2nd edition (Addison-Wesley, 1998) and
* "Applied Cryptography, Second Edition" by Bruce Schneier (Wiley, 1996).
*
- * Based primarily on IntNum.java BitOps.java by Per Bothner <per@bothner.com>
+ * Based primarily on IntNum.java BitOps.java by Per Bothner (per@bothner.com)
* (found in Kawa 1.6.62).
*
- * @author Warren Levy <warrenl@cygnus.com>
+ * @author Warren Levy (warrenl@cygnus.com)
* @date December 20, 1999.
* @status believed complete and correct.
*/
diff --git a/libjava/java/net/NetworkInterface.java b/libjava/java/net/NetworkInterface.java
index dea4e3b444b..2b4da7392e6 100644
--- a/libjava/java/net/NetworkInterface.java
+++ b/libjava/java/net/NetworkInterface.java
@@ -1,5 +1,5 @@
/* NetworkInterface.java --
- Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -212,7 +212,7 @@ public final class NetworkInterface
*
* @param obj The object to compare with
*
- * @return <code>true</code> if equal, <code>false<code> otherwise
+ * @return <code>true</code> if equal, <code>false</code> otherwise
*/
public boolean equals(Object obj)
{
diff --git a/libjava/java/net/URL.java b/libjava/java/net/URL.java
index 96f97991280..576e2d3e55f 100644
--- a/libjava/java/net/URL.java
+++ b/libjava/java/net/URL.java
@@ -1,5 +1,5 @@
/* URL.java -- Uniform Resource Locator Class
- Copyright (C) 1998, 1999, 2000, 2002, 2003, 2004
+ Copyright (C) 1998, 1999, 2000, 2002, 2003, 2004, 2005
Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -125,7 +125,7 @@ import java.util.StringTokenizer;
public final class URL implements Serializable
{
private static final String DEFAULT_SEARCH_PATH =
- "gnu.java.net.protocol|gnu.inet";
+ "org.metastatic.jessie|gnu.java.net.protocol|gnu.inet";
// Cached System ClassLoader
private static ClassLoader systemClassLoader;
@@ -918,6 +918,10 @@ public final class URL implements Serializable
Class c = Class.forName(clsName, true, systemClassLoader);
ph = (URLStreamHandler) c.newInstance();
}
+ catch (ThreadDeath death)
+ {
+ throw death;
+ }
catch (Throwable t) { /* ignored */ }
}
while (ph == null && pkgPrefix.hasMoreTokens());
diff --git a/libjava/java/net/URLClassLoader.java b/libjava/java/net/URLClassLoader.java
index 0ee2e748a3d..9593e7d0fb0 100644
--- a/libjava/java/net/URLClassLoader.java
+++ b/libjava/java/net/URLClassLoader.java
@@ -332,7 +332,7 @@ public class URLClassLoader extends SecureClassLoader
Manifest manifest;
Attributes attributes;
String classPathString;
-
+
if ((manifest = jarfile.getManifest()) != null
&& (attributes = manifest.getMainAttributes()) != null
&& ((classPathString
@@ -422,7 +422,11 @@ public class URLClassLoader extends SecureClassLoader
Certificate[] getCertificates()
{
- return entry.getCertificates();
+ // We have to get the entry from the jar file again, because the
+ // certificates will not be available until the entire entry has
+ // been read.
+ return ((JarEntry) ((JarURLLoader) loader).jarfile.getEntry(name))
+ .getCertificates();
}
URL getURL()
@@ -543,7 +547,7 @@ public class URLClassLoader extends SecureClassLoader
{
super(classloader, url, overrideURL);
helper = SharedLibHelper.findHelper(classloader, url.getFile(),
- noCertCodeSource);
+ noCertCodeSource, true);
}
Class getClass(String className)
@@ -795,6 +799,9 @@ public class URLClassLoader extends SecureClassLoader
if (newUrl == null)
return; // Silently ignore...
+ // Reset the toString() value.
+ thisString = null;
+
// Check global cache to see if there're already url loader
// for this url.
URLLoader loader = (URLLoader) urlloaders.get(newUrl);
@@ -977,9 +984,10 @@ public class URLClassLoader extends SecureClassLoader
// And finally construct the class!
SecurityManager sm = System.getSecurityManager();
+ Class result = null;
if (sm != null && securityContext != null)
{
- return (Class)AccessController.doPrivileged
+ result = (Class)AccessController.doPrivileged
(new PrivilegedAction()
{
public Object run()
@@ -991,7 +999,10 @@ public class URLClassLoader extends SecureClassLoader
}, securityContext);
}
else
- return defineClass(className, classData, 0, classData.length, source);
+ result = defineClass(className, classData, 0, classData.length, source);
+
+ super.setSigners(result, resource.getCertificates());
+ return result;
}
catch (IOException ioe)
{
@@ -1012,25 +1023,28 @@ public class URLClassLoader extends SecureClassLoader
*/
public String toString()
{
- if (thisString == null)
+ synchronized (urlloaders)
{
- StringBuffer sb = new StringBuffer();
- sb.append(this.getClass().getName());
- sb.append("{urls=[" );
- URL[] thisURLs = getURLs();
- for (int i = 0; i < thisURLs.length; i++)
+ if (thisString == null)
{
- sb.append(thisURLs[i]);
- if (i < thisURLs.length - 1)
- sb.append(',');
+ StringBuffer sb = new StringBuffer();
+ sb.append(this.getClass().getName());
+ sb.append("{urls=[" );
+ URL[] thisURLs = getURLs();
+ for (int i = 0; i < thisURLs.length; i++)
+ {
+ sb.append(thisURLs[i]);
+ if (i < thisURLs.length - 1)
+ sb.append(',');
+ }
+ sb.append(']');
+ sb.append(", parent=");
+ sb.append(getParent());
+ sb.append('}');
+ thisString = sb.toString();
}
- sb.append(']');
- sb.append(", parent=");
- sb.append(getParent());
- sb.append('}');
- thisString = sb.toString();
+ return thisString;
}
- return thisString;
}
/**
diff --git a/libjava/java/nio/ByteBufferHelper.java b/libjava/java/nio/ByteBufferHelper.java
index cbc1f110a6f..799d41c2a04 100644
--- a/libjava/java/nio/ByteBufferHelper.java
+++ b/libjava/java/nio/ByteBufferHelper.java
@@ -1,5 +1,5 @@
/* ByteBufferImpl.java --
- Copyright (C) 2003, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,7 +38,7 @@ exception statement from your version. */
package java.nio;
/**
- * @author Michael Koch <konqueror@gmx.de>
+ * @author Michael Koch (konqueror@gmx.de)
*/
final class ByteBufferHelper
{
diff --git a/libjava/java/nio/ByteBufferImpl.java b/libjava/java/nio/ByteBufferImpl.java
index 7734dbf12cd..d9f24627de0 100644
--- a/libjava/java/nio/ByteBufferImpl.java
+++ b/libjava/java/nio/ByteBufferImpl.java
@@ -1,5 +1,5 @@
/* ByteBufferImpl.java --
- Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -112,6 +112,8 @@ final class ByteBufferImpl extends ByteBuffer
public ByteBuffer compact ()
{
+ checkIfReadOnly();
+ mark = -1;
int pos = position();
if (pos > 0)
{
@@ -120,6 +122,11 @@ final class ByteBufferImpl extends ByteBuffer
position(count);
limit(capacity());
}
+ else
+ {
+ position(limit());
+ limit(capacity());
+ }
return this;
}
@@ -178,7 +185,7 @@ final class ByteBufferImpl extends ByteBuffer
}
/**
- * Absolute put method. Writes <code>value</value> to position
+ * Absolute put method. Writes <code>value</code> to position
* <code>index</code> in the buffer.
*
* @exception IndexOutOfBoundsException If index is negative or not smaller
diff --git a/libjava/java/nio/CharBufferImpl.java b/libjava/java/nio/CharBufferImpl.java
index 2ca44d94459..f9babe8287b 100644
--- a/libjava/java/nio/CharBufferImpl.java
+++ b/libjava/java/nio/CharBufferImpl.java
@@ -87,6 +87,8 @@ final class CharBufferImpl extends CharBuffer
public CharBuffer compact ()
{
+ checkIfReadOnly();
+ mark = -1;
int copied = 0;
while (remaining () > 0)
@@ -96,6 +98,7 @@ final class CharBufferImpl extends CharBuffer
}
position (copied);
+ limit(capacity());
return this;
}
diff --git a/libjava/java/nio/CharViewBufferImpl.java b/libjava/java/nio/CharViewBufferImpl.java
index 2701983ead5..25a2cf7972a 100644
--- a/libjava/java/nio/CharViewBufferImpl.java
+++ b/libjava/java/nio/CharViewBufferImpl.java
@@ -122,6 +122,11 @@ class CharViewBufferImpl extends CharBuffer
position (count);
limit (capacity ());
}
+ else
+ {
+ position(limit());
+ limit(capacity());
+ }
return this;
}
diff --git a/libjava/java/nio/DirectByteBufferImpl.java b/libjava/java/nio/DirectByteBufferImpl.java
index c272bacbf72..a0599c722a9 100644
--- a/libjava/java/nio/DirectByteBufferImpl.java
+++ b/libjava/java/nio/DirectByteBufferImpl.java
@@ -42,21 +42,22 @@ import gnu.gcj.RawData;
abstract class DirectByteBufferImpl extends ByteBuffer
{
- /** The owner is used to keep alive the object that actually owns the
- * memory. There are three possibilities:
- * 1) owner == this: We allocated the memory and we should free it,
- * but *only* in finalize (if we've been sliced
- * other objects will also have access to the
- * memory).
- * 2) owner == null: The byte buffer was created thru
- * JNI.NewDirectByteBuffer. The JNI code is
- * responsible for freeing the memory.
- * 3) owner == some other object: The other object allocated the
- * memory and should free it.
- */
+ /**
+ * The owner is used to keep alive the object that actually owns the
+ * memory. There are three possibilities:
+ * 1) owner == this: We allocated the memory and we should free it,
+ * but *only* in finalize (if we've been sliced
+ * other objects will also have access to the
+ * memory).
+ * 2) owner == null: The byte buffer was created thru
+ * JNI.NewDirectByteBuffer. The JNI code is
+ * responsible for freeing the memory.
+ * 3) owner == some other object: The other object allocated the
+ * memory and should free it.
+ */
private final Object owner;
- final static class ReadOnly extends DirectByteBufferImpl
+ static final class ReadOnly extends DirectByteBufferImpl
{
ReadOnly(Object owner, RawData address,
int capacity, int limit,
@@ -81,7 +82,7 @@ abstract class DirectByteBufferImpl extends ByteBuffer
}
}
- final static class ReadWrite extends DirectByteBufferImpl
+ static final class ReadWrite extends DirectByteBufferImpl
{
ReadWrite(int capacity)
{
@@ -116,7 +117,7 @@ abstract class DirectByteBufferImpl extends ByteBuffer
DirectByteBufferImpl(RawData address, int capacity)
{
super(capacity, capacity, 0, -1);
- this.owner = this;
+ this.owner = null;
this.address = address;
}
@@ -197,6 +198,8 @@ abstract class DirectByteBufferImpl extends ByteBuffer
public ByteBuffer compact()
{
+ checkIfReadOnly();
+ mark = -1;
int pos = position();
if (pos > 0)
{
@@ -205,6 +208,11 @@ abstract class DirectByteBufferImpl extends ByteBuffer
position(count);
limit(capacity());
}
+ else
+ {
+ position(limit());
+ limit(capacity());
+ }
return this;
}
diff --git a/libjava/java/nio/DoubleBufferImpl.java b/libjava/java/nio/DoubleBufferImpl.java
index 504ee8d61b0..bad883c7d6c 100644
--- a/libjava/java/nio/DoubleBufferImpl.java
+++ b/libjava/java/nio/DoubleBufferImpl.java
@@ -1,5 +1,5 @@
/* DoubleBufferImpl.java --
- Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -80,6 +80,8 @@ final class DoubleBufferImpl extends DoubleBuffer
public DoubleBuffer compact ()
{
+ checkIfReadOnly();
+ mark = -1;
int copied = 0;
while (remaining () > 0)
@@ -89,6 +91,7 @@ final class DoubleBufferImpl extends DoubleBuffer
}
position (copied);
+ limit(capacity());
return this;
}
@@ -146,7 +149,7 @@ final class DoubleBufferImpl extends DoubleBuffer
}
/**
- * Absolute put method. Writes <code>value</value> to position
+ * Absolute put method. Writes <code>value</code> to position
* <code>index</code> in the buffer.
*
* @exception IndexOutOfBoundsException If index is negative or not smaller
diff --git a/libjava/java/nio/DoubleViewBufferImpl.java b/libjava/java/nio/DoubleViewBufferImpl.java
index 276e2757045..d47c96463f4 100644
--- a/libjava/java/nio/DoubleViewBufferImpl.java
+++ b/libjava/java/nio/DoubleViewBufferImpl.java
@@ -120,6 +120,11 @@ final class DoubleViewBufferImpl extends DoubleBuffer
position (count);
limit (capacity ());
}
+ else
+ {
+ position(limit());
+ limit(capacity());
+ }
return this;
}
diff --git a/libjava/java/nio/FloatBufferImpl.java b/libjava/java/nio/FloatBufferImpl.java
index a9eb7c1de8a..6f552cfabe3 100644
--- a/libjava/java/nio/FloatBufferImpl.java
+++ b/libjava/java/nio/FloatBufferImpl.java
@@ -1,5 +1,5 @@
/* FloatBufferImpl.java --
- Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -80,6 +80,8 @@ final class FloatBufferImpl extends FloatBuffer
public FloatBuffer compact ()
{
+ checkIfReadOnly();
+ mark = -1;
int copied = 0;
while (remaining () > 0)
@@ -89,6 +91,7 @@ final class FloatBufferImpl extends FloatBuffer
}
position (copied);
+ limit(capacity());
return this;
}
@@ -146,7 +149,7 @@ final class FloatBufferImpl extends FloatBuffer
}
/**
- * Absolute put method. Writes <code>value</value> to position
+ * Absolute put method. Writes <code>value</code> to position
* <code>index</code> in the buffer.
*
* @exception IndexOutOfBoundsException If index is negative or not smaller
diff --git a/libjava/java/nio/FloatViewBufferImpl.java b/libjava/java/nio/FloatViewBufferImpl.java
index 3dd0736fb49..5d074b5bed3 100644
--- a/libjava/java/nio/FloatViewBufferImpl.java
+++ b/libjava/java/nio/FloatViewBufferImpl.java
@@ -120,6 +120,11 @@ final class FloatViewBufferImpl extends FloatBuffer
position (count);
limit (capacity ());
}
+ else
+ {
+ position(limit());
+ limit(capacity());
+ }
return this;
}
diff --git a/libjava/java/nio/IntBufferImpl.java b/libjava/java/nio/IntBufferImpl.java
index f68dd92fa04..6b22d40fb21 100644
--- a/libjava/java/nio/IntBufferImpl.java
+++ b/libjava/java/nio/IntBufferImpl.java
@@ -1,5 +1,5 @@
/* IntBufferImpl.java --
- Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -80,6 +80,8 @@ final class IntBufferImpl extends IntBuffer
public IntBuffer compact ()
{
+ checkIfReadOnly();
+ mark = -1;
int copied = 0;
while (remaining () > 0)
@@ -89,6 +91,7 @@ final class IntBufferImpl extends IntBuffer
}
position (copied);
+ limit(capacity());
return this;
}
@@ -146,7 +149,7 @@ final class IntBufferImpl extends IntBuffer
}
/**
- * Absolute put method. Writes <code>value</value> to position
+ * Absolute put method. Writes <code>value</code> to position
* <code>index</code> in the buffer.
*
* @exception IndexOutOfBoundsException If index is negative or not smaller
diff --git a/libjava/java/nio/IntViewBufferImpl.java b/libjava/java/nio/IntViewBufferImpl.java
index ff8b27be1a4..77b04a8c3c0 100644
--- a/libjava/java/nio/IntViewBufferImpl.java
+++ b/libjava/java/nio/IntViewBufferImpl.java
@@ -120,6 +120,11 @@ final class IntViewBufferImpl extends IntBuffer
position (count);
limit (capacity ());
}
+ else
+ {
+ position(limit());
+ limit(capacity());
+ }
return this;
}
diff --git a/libjava/java/nio/LongBufferImpl.java b/libjava/java/nio/LongBufferImpl.java
index df720eec62c..e82f7749cd5 100644
--- a/libjava/java/nio/LongBufferImpl.java
+++ b/libjava/java/nio/LongBufferImpl.java
@@ -1,5 +1,5 @@
/* LongBufferImpl.java --
- Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -80,6 +80,8 @@ final class LongBufferImpl extends LongBuffer
public LongBuffer compact ()
{
+ checkIfReadOnly();
+ mark = -1;
int copied = 0;
while (remaining () > 0)
@@ -89,6 +91,7 @@ final class LongBufferImpl extends LongBuffer
}
position (copied);
+ limit(capacity());
return this;
}
@@ -146,7 +149,7 @@ final class LongBufferImpl extends LongBuffer
}
/**
- * Absolute put method. Writes <code>value</value> to position
+ * Absolute put method. Writes <code>value</code> to position
* <code>index</code> in the buffer.
*
* @exception IndexOutOfBoundsException If index is negative or not smaller
diff --git a/libjava/java/nio/LongViewBufferImpl.java b/libjava/java/nio/LongViewBufferImpl.java
index bfa64d0ad9a..e2054757871 100644
--- a/libjava/java/nio/LongViewBufferImpl.java
+++ b/libjava/java/nio/LongViewBufferImpl.java
@@ -120,6 +120,11 @@ final class LongViewBufferImpl extends LongBuffer
position (count);
limit (capacity ());
}
+ else
+ {
+ position(limit());
+ limit(capacity());
+ }
return this;
}
diff --git a/libjava/java/nio/MappedByteBufferImpl.java b/libjava/java/nio/MappedByteBufferImpl.java
index 63e0225bc51..fdb64c5bb0f 100644
--- a/libjava/java/nio/MappedByteBufferImpl.java
+++ b/libjava/java/nio/MappedByteBufferImpl.java
@@ -117,6 +117,8 @@ final class MappedByteBufferImpl extends MappedByteBuffer
public ByteBuffer compact()
{
+ checkIfReadOnly();
+ mark = -1;
int pos = position();
if (pos > 0)
{
@@ -126,6 +128,11 @@ final class MappedByteBufferImpl extends MappedByteBuffer
position(count);
limit(capacity());
}
+ else
+ {
+ position(limit());
+ limit(capacity());
+ }
return this;
}
diff --git a/libjava/java/nio/ShortBufferImpl.java b/libjava/java/nio/ShortBufferImpl.java
index 28f6efbd804..05424322b27 100644
--- a/libjava/java/nio/ShortBufferImpl.java
+++ b/libjava/java/nio/ShortBufferImpl.java
@@ -1,5 +1,5 @@
/* ShortBufferImpl.java --
- Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -80,6 +80,8 @@ final class ShortBufferImpl extends ShortBuffer
public ShortBuffer compact ()
{
+ checkIfReadOnly();
+ mark = -1;
int copied = 0;
while (remaining () > 0)
@@ -89,6 +91,7 @@ final class ShortBufferImpl extends ShortBuffer
}
position (copied);
+ limit(capacity());
return this;
}
@@ -146,7 +149,7 @@ final class ShortBufferImpl extends ShortBuffer
}
/**
- * Absolute put method. Writes <code>value</value> to position
+ * Absolute put method. Writes <code>value</code> to position
* <code>index</code> in the buffer.
*
* @exception IndexOutOfBoundsException If index is negative or not smaller
diff --git a/libjava/java/nio/ShortViewBufferImpl.java b/libjava/java/nio/ShortViewBufferImpl.java
index acd6c233d07..f884ed54244 100644
--- a/libjava/java/nio/ShortViewBufferImpl.java
+++ b/libjava/java/nio/ShortViewBufferImpl.java
@@ -120,6 +120,11 @@ final class ShortViewBufferImpl extends ShortBuffer
position (count);
limit (capacity ());
}
+ else
+ {
+ position(limit());
+ limit(capacity());
+ }
return this;
}
diff --git a/libjava/java/nio/channels/Channel.java b/libjava/java/nio/channels/Channel.java
index 8e73f87f88f..5912695d053 100644
--- a/libjava/java/nio/channels/Channel.java
+++ b/libjava/java/nio/channels/Channel.java
@@ -1,5 +1,5 @@
/* Channel.java --
- Copyright (C) 2002, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -46,7 +46,7 @@ public interface Channel
* Tells whether this channel is open or not
*
* @return <code>true</code>if channel is open,
- * </code>false</code> otherwise
+ * <code>false</code> otherwise
*/
boolean isOpen();
diff --git a/libjava/java/nio/channels/Channels.java b/libjava/java/nio/channels/Channels.java
index 3e5316efbe8..1da5d13193e 100644
--- a/libjava/java/nio/channels/Channels.java
+++ b/libjava/java/nio/channels/Channels.java
@@ -1,5 +1,5 @@
/* Channels.java --
- Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -35,10 +35,12 @@ 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 gnu.java.nio.ChannelInputStream;
import gnu.java.nio.ChannelOutputStream;
+import gnu.java.nio.ChannelReader;
import gnu.java.nio.InputStreamChannel;
import gnu.java.nio.OutputStreamChannel;
import gnu.java.nio.channels.FileChannelImpl;
@@ -62,7 +64,10 @@ public final class Channels
/**
* This class isn't intended to be instantiated.
*/
- private Channels() {}
+ private Channels()
+ {
+ // Do nothing here.
+ }
/**
* Constructs a stream that reads bytes from the given channel.
@@ -111,7 +116,7 @@ public final class Channels
public static Reader newReader(ReadableByteChannel ch, CharsetDecoder dec,
int minBufferCap)
{
- throw new Error("not implemented");
+ return new ChannelReader(ch, dec, minBufferCap);
}
/**
@@ -133,6 +138,7 @@ public final class Channels
public static Writer newWriter(WritableByteChannel ch, CharsetEncoder enc,
int minBufferCap)
{
+ // FIXME: implement java.nio.channels.Channel.newWriter(WritableByteChannel, CharsetEncoder, int)
throw new Error("not implemented");
}
diff --git a/libjava/java/nio/channels/IllegalBlockingModeException.java b/libjava/java/nio/channels/IllegalBlockingModeException.java
index 5b70c1f5814..e6a3a2c29df 100644
--- a/libjava/java/nio/channels/IllegalBlockingModeException.java
+++ b/libjava/java/nio/channels/IllegalBlockingModeException.java
@@ -1,5 +1,5 @@
/* IllegalBlockingModeException.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -39,7 +39,7 @@ package java.nio.channels;
/**
- * @author Michael Koch <konqueror@gmx.de>
+ * @author Michael Koch (konqueror@gmx.de)
* @since 1.4
*
* Written using JDK 1.4.1 Online API from Sun
diff --git a/libjava/java/nio/charset/Charset.java b/libjava/java/nio/charset/Charset.java
index 5bb78f63ca9..c7672c1c3df 100644
--- a/libjava/java/nio/charset/Charset.java
+++ b/libjava/java/nio/charset/Charset.java
@@ -117,9 +117,24 @@ public abstract class Charset implements Comparable
{
return charsetForName (charsetName) != null;
}
-
+
+ /**
+ * Returns the Charset instance for the charset of the given name.
+ *
+ * @param charsetName
+ * @return
+ * @throws UnsupportedCharsetException if this VM does not support
+ * the charset of the given name.
+ * @throws IllegalCharsetNameException if the given charset name is
+ * legal.
+ * @throws IllegalArgumentException if <code>charsetName</code> is null.
+ */
public static Charset forName (String charsetName)
{
+ // Throws IllegalArgumentException as the JDK does.
+ if(charsetName == null)
+ throw new IllegalArgumentException("Charset name must not be null.");
+
Charset cs = charsetForName (charsetName);
if (cs == null)
throw new UnsupportedCharsetException (charsetName);
@@ -132,19 +147,19 @@ public abstract class Charset implements Comparable
* Retrieves a charset for the given charset name.
*
* @return A charset object for the charset with the specified name, or
- * <code>null</code> if no such charset exists.
+ * <code>null</code> if no such charset exists.
*
* @throws IllegalCharsetNameException if the name is illegal
*/
- private static Charset charsetForName (String charsetName)
+ private static Charset charsetForName(String charsetName)
{
checkName (charsetName);
return provider ().charsetForName (charsetName);
}
- public static SortedMap availableCharsets ()
+ public static SortedMap availableCharsets()
{
- TreeMap charsets = new TreeMap (String.CASE_INSENSITIVE_ORDER);
+ TreeMap charsets = new TreeMap(String.CASE_INSENSITIVE_ORDER);
for (Iterator i = provider ().charsets (); i.hasNext (); )
{
@@ -152,15 +167,15 @@ public abstract class Charset implements Comparable
charsets.put (cs.name (), cs);
}
- return Collections.unmodifiableSortedMap (charsets);
+ return Collections.unmodifiableSortedMap(charsets);
}
// XXX: we need to support multiple providers, reading them from
// java.nio.charset.spi.CharsetProvider in the resource directory
// META-INF/services
- private static CharsetProvider provider ()
+ private static CharsetProvider provider()
{
- return Provider.provider ();
+ return Provider.provider();
}
public final String name ()
diff --git a/libjava/java/nio/charset/spi/CharsetProvider.java b/libjava/java/nio/charset/spi/CharsetProvider.java
index 1af7a8ef314..3cbc14b991c 100644
--- a/libjava/java/nio/charset/spi/CharsetProvider.java
+++ b/libjava/java/nio/charset/spi/CharsetProvider.java
@@ -52,7 +52,7 @@ import java.util.Iterator;
* ignored, and '#' starts comments. Duplicates are ignored. The
* implementations must be accessible to the classloader that requests them.
*
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Eric Blake (ebb9@email.byu.edu)
* @see Charset
* @since 1.4
* @status updated to 1.4
diff --git a/libjava/java/rmi/server/RemoteObject.java b/libjava/java/rmi/server/RemoteObject.java
index 1bc7648c8fc..6dca07f8e1a 100644
--- a/libjava/java/rmi/server/RemoteObject.java
+++ b/libjava/java/rmi/server/RemoteObject.java
@@ -45,14 +45,17 @@ import java.lang.reflect.Constructor;
import java.rmi.NoSuchObjectException;
import java.rmi.Remote;
import java.rmi.UnmarshalException;
+import java.util.WeakHashMap;
public abstract class RemoteObject
implements Remote, Serializable {
-public static final long serialVersionUID = -3215090123894869218l;
+private static final long serialVersionUID = -3215090123894869218l;
protected transient RemoteRef ref;
+private static final WeakHashMap stubs = new WeakHashMap();
+
protected RemoteObject() {
this(null);
}
@@ -65,21 +68,24 @@ public RemoteRef getRef() {
return (ref);
}
+synchronized static void addStub(Remote obj, Remote stub)
+{
+ stubs.put(obj, stub);
+}
+
+synchronized static void deleteStub(Remote obj)
+{
+ stubs.remove(obj);
+}
+
public static Remote toStub(Remote obj) throws NoSuchObjectException
{
- Class cls = obj.getClass();
- String classname = cls.getName();
- ClassLoader cl = cls.getClassLoader();
- try
- {
- Class scls = cl.loadClass(classname + "_Stub");
- // JDK 1.2 stubs
- Class[] stubprototype = new Class[] { RemoteRef.class };
- Constructor con = scls.getConstructor(stubprototype);
- return (Remote)(con.newInstance(new Object[]{obj}));
- }
- catch (Exception e) {}
- throw new NoSuchObjectException(obj.getClass().getName());
+ Remote stub = (Remote)stubs.get(obj);
+
+ if (stub == null)
+ throw new NoSuchObjectException(obj.getClass().getName());
+
+ return stub;
}
public int hashCode() {
diff --git a/libjava/java/rmi/server/RemoteRef.java b/libjava/java/rmi/server/RemoteRef.java
index a3f22c27a66..89cee1256b2 100644
--- a/libjava/java/rmi/server/RemoteRef.java
+++ b/libjava/java/rmi/server/RemoteRef.java
@@ -46,7 +46,7 @@ import java.rmi.RemoteException;
public interface RemoteRef extends Externalizable
{
- long serialVersionUID = 0;
+ long serialVersionUID = 3632638527362204081L;
String packagePrefix = "gnu.java.rmi.server";
diff --git a/libjava/java/rmi/server/ServerRef.java b/libjava/java/rmi/server/ServerRef.java
index a6e986750ba..906b1269889 100644
--- a/libjava/java/rmi/server/ServerRef.java
+++ b/libjava/java/rmi/server/ServerRef.java
@@ -43,7 +43,7 @@ import java.rmi.RemoteException;
public interface ServerRef extends RemoteRef
{
- long serialVersionUID = 0;
+ long serialVersionUID = -4557750989390278438L;
RemoteStub exportObject(Remote obj, Object data) throws RemoteException;
diff --git a/libjava/java/rmi/server/UID.java b/libjava/java/rmi/server/UID.java
index c6fd30e463a..d472e69c995 100644
--- a/libjava/java/rmi/server/UID.java
+++ b/libjava/java/rmi/server/UID.java
@@ -45,7 +45,7 @@ import java.io.Serializable;
public final class UID implements Serializable
{
-public static final long serialVersionUID = 1086053664494604050L;
+private static final long serialVersionUID = 1086053664494604050L;
private static final Object lock = UID.class;
private static long baseTime = System.currentTimeMillis();
diff --git a/libjava/java/rmi/server/UnicastRemoteObject.java b/libjava/java/rmi/server/UnicastRemoteObject.java
index 6e8fb253820..ed296f03341 100644
--- a/libjava/java/rmi/server/UnicastRemoteObject.java
+++ b/libjava/java/rmi/server/UnicastRemoteObject.java
@@ -98,7 +98,9 @@ public static RemoteStub exportObject(Remote obj) throws RemoteException {
{
sref = new UnicastServerRef(new ObjID (), port, ssf);
}
- return (sref.exportObject (obj));
+ Remote stub = sref.exportObject (obj);
+ addStub(obj, stub);
+ return stub;
}
/**
@@ -116,12 +118,15 @@ public static RemoteStub exportObject(Remote obj) throws RemoteException {
{
if (obj instanceof RemoteObject)
{
+ deleteStub(obj);
UnicastServerRef sref = (UnicastServerRef)((RemoteObject)obj).getRef();
return sref.unexportObject(obj, force);
}
else
- //FIX ME
- ;
+ {
+ //FIX ME
+ ;
+ }
return true;
}
diff --git a/libjava/java/security/AccessControlException.java b/libjava/java/security/AccessControlException.java
index ff8b5a93fb3..d7b1f2926a4 100644
--- a/libjava/java/security/AccessControlException.java
+++ b/libjava/java/security/AccessControlException.java
@@ -1,5 +1,5 @@
/* AccessControlException.java -- Permission is denied
- Copyright (C) 1998, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1998, 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -42,7 +42,7 @@ package java.security;
* an attempt to perform an operation. This often keeps track of the
* permission that was not granted.
*
- * @author Aaron M. Renn <arenn@urbanophile.com>
+ * @author Aaron M. Renn (arenn@urbanophile.com)
* @see AccessController
* @status updated to 1.4
*/
diff --git a/libjava/java/security/AlgorithmParameterGenerator.java b/libjava/java/security/AlgorithmParameterGenerator.java
index cf245da5a62..ed2f344010b 100644
--- a/libjava/java/security/AlgorithmParameterGenerator.java
+++ b/libjava/java/security/AlgorithmParameterGenerator.java
@@ -174,7 +174,7 @@ public class AlgorithmParameterGenerator
Provider p = Security.getProvider(provider);
if (p == null)
- throw new NoSuchProviderException();
+ throw new NoSuchProviderException(provider);
return getInstance(algorithm, p);
}
diff --git a/libjava/java/security/AlgorithmParameters.java b/libjava/java/security/AlgorithmParameters.java
index afeb843a97e..8ccd40a317c 100644
--- a/libjava/java/security/AlgorithmParameters.java
+++ b/libjava/java/security/AlgorithmParameters.java
@@ -178,7 +178,7 @@ public class AlgorithmParameters
Provider p = Security.getProvider(provider);
if (p == null)
- throw new NoSuchProviderException();
+ throw new NoSuchProviderException(provider);
return getInstance(algorithm, p);
}
diff --git a/libjava/java/security/AllPermission.java b/libjava/java/security/AllPermission.java
index 32d0b45f57c..e7f316917c2 100644
--- a/libjava/java/security/AllPermission.java
+++ b/libjava/java/security/AllPermission.java
@@ -1,5 +1,5 @@
/* AllPermission.java -- Permission to do anything
- Copyright (C) 1998, 2001, 2002, 2004 Free Software Foundation, Inc.
+ Copyright (C) 1998, 2001, 2002, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -135,64 +135,64 @@ public final class AllPermission extends Permission
{
return new AllPermissionCollection();
}
-} // class AllPermission
-
-/**
- * Implements AllPermission.newPermissionCollection, and obeys serialization
- * of JDK.
- *
- * @author Eric Blake <ebb9@email.byu.edu>
- */
-final class AllPermissionCollection extends PermissionCollection
-{
- /**
- * Compatible with JDK 1.1+.
- */
- private static final long serialVersionUID = -4023755556366636806L;
-
- /**
- * Whether an AllPermission has been added to the collection.
- *
- * @serial if all permission is in the collection yet
- */
- private boolean all_allowed;
-
- /**
- * Add an AllPermission.
- *
- * @param perm the permission to add
- * @throws IllegalArgumentException if perm is not an AllPermission
- * @throws SecurityException if the collection is read-only
- */
- public void add(Permission perm)
- {
- if (isReadOnly())
- throw new SecurityException();
- if (! (perm instanceof AllPermission))
- throw new IllegalArgumentException();
- all_allowed = true;
- }
-
- /**
- * Returns true if this collection implies a permission.
- *
- * @param perm the permission to check
- * @return true if this collection contains an AllPermission
- */
- public boolean implies(Permission perm)
- {
- return all_allowed;
- }
/**
- * Returns an enumeration of the elements in the collection.
+ * Implements AllPermission.newPermissionCollection, and obeys serialization
+ * of JDK.
*
- * @return the elements in the collection
+ * @author Eric Blake (ebb9@email.byu.edu)
*/
- public Enumeration elements()
+ private static final class AllPermissionCollection extends PermissionCollection
{
- return all_allowed
- ? Collections.enumeration(Collections.singleton(new AllPermission()))
- : EmptyEnumeration.getInstance();
- }
-} // class AllPermissionCollection
+ /**
+ * Compatible with JDK 1.1+.
+ */
+ private static final long serialVersionUID = -4023755556366636806L;
+
+ /**
+ * Whether an AllPermission has been added to the collection.
+ *
+ * @serial if all permission is in the collection yet
+ */
+ private boolean all_allowed;
+
+ /**
+ * Add an AllPermission.
+ *
+ * @param perm the permission to add
+ * @throws IllegalArgumentException if perm is not an AllPermission
+ * @throws SecurityException if the collection is read-only
+ */
+ public void add(Permission perm)
+ {
+ if (isReadOnly())
+ throw new SecurityException();
+ if (! (perm instanceof AllPermission))
+ throw new IllegalArgumentException();
+ all_allowed = true;
+ }
+
+ /**
+ * Returns true if this collection implies a permission.
+ *
+ * @param perm the permission to check
+ * @return true if this collection contains an AllPermission
+ */
+ public boolean implies(Permission perm)
+ {
+ return all_allowed;
+ }
+
+ /**
+ * Returns an enumeration of the elements in the collection.
+ *
+ * @return the elements in the collection
+ */
+ public Enumeration elements()
+ {
+ return all_allowed
+ ? Collections.enumeration(Collections.singleton(new AllPermission()))
+ : EmptyEnumeration.getInstance();
+ }
+ } // class AllPermissionCollection
+} // class AllPermission
diff --git a/libjava/java/security/BasicPermission.java b/libjava/java/security/BasicPermission.java
index fef0b87a8ad..741f2b02464 100644
--- a/libjava/java/security/BasicPermission.java
+++ b/libjava/java/security/BasicPermission.java
@@ -1,5 +1,5 @@
/* BasicPermission.java -- implements a simple named permission
- Copyright (C) 1998, 1999, 2002, 2003, 2004 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -58,8 +58,8 @@ import java.util.Hashtable;
* <p>This class ignores the action list. Subclasses can choose to implement
* actions on top of this class if desired.
*
- * @author Aaron M. Renn <arenn@urbanophile.com>
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Aaron M. Renn (arenn@urbanophile.com)
+ * @author Eric Blake (ebb9@email.byu.edu)
* @see Permission
* @see Permissions
* @see PermissionCollection
@@ -72,8 +72,9 @@ import java.util.Hashtable;
* @since 1.1
* @status updated to 1.4
*/
-public abstract class BasicPermission extends Permission
+public abstract class BasicPermission extends java.security.Permission
implements Serializable
+ // FIXME extends with fully qualified classname as workaround for gcj 3.3.
{
/**
* Compatible with JDK 1.1+.
@@ -197,111 +198,111 @@ public abstract class BasicPermission extends Permission
{
return new BasicPermissionCollection(getClass());
}
-} // class BasicPermission
-/**
- * Implements AllPermission.newPermissionCollection, and obeys serialization
- * of JDK.
- *
- * @author Eric Blake <ebb9@email.byu.edu>
- */
-final class BasicPermissionCollection extends PermissionCollection
-{
/**
- * Compatible with JDK 1.1+.
- */
- private static final long serialVersionUID = 739301742472979399L;
-
- /**
- * The permissions in the collection.
+ * Implements AllPermission.newPermissionCollection, and obeys serialization
+ * of JDK.
*
- * @serial a hash mapping name to permissions, all of type permClass
+ * @author Eric Blake (ebb9@email.byu.edu)
*/
- private final Hashtable permissions = new Hashtable();
+ private static final class BasicPermissionCollection extends PermissionCollection
+ {
+ /**
+ * Compatible with JDK 1.1+.
+ */
+ private static final long serialVersionUID = 739301742472979399L;
- /**
- * If "*" is in the collection.
- *
- * @serial true if a permission named "*" is in the collection
- */
- private boolean all_allowed;
+ /**
+ * The permissions in the collection.
+ *
+ * @serial a hash mapping name to permissions, all of type permClass
+ */
+ private final Hashtable permissions = new Hashtable();
- /**
- * The runtime class which all entries in the table must belong to.
- *
- * @serial the limiting subclass of this collection
- */
- private final Class permClass;
+ /**
+ * If "*" is in the collection.
+ *
+ * @serial true if a permission named "*" is in the collection
+ */
+ private boolean all_allowed;
- /**
- * Construct a collection over the given runtime class.
- *
- * @param c the class
- */
- BasicPermissionCollection(Class c)
- {
- permClass = c;
- }
+ /**
+ * The runtime class which all entries in the table must belong to.
+ *
+ * @serial the limiting subclass of this collection
+ */
+ private final Class permClass;
- /**
- * Add a Permission. It must be of the same type as the permission which
- * created this collection.
- *
- * @param perm the permission to add
- * @throws IllegalArgumentException if perm is not the correct type
- * @throws SecurityException if the collection is read-only
- */
- public void add(Permission perm)
- {
- if (isReadOnly())
- throw new SecurityException("readonly");
- if (! permClass.isInstance(perm))
- throw new IllegalArgumentException("Expecting instance of " + permClass);
- BasicPermission bp = (BasicPermission) perm;
- String name = bp.getName();
- if (name.equals("*"))
- all_allowed = true;
- permissions.put(name, bp);
- }
+ /**
+ * Construct a collection over the given runtime class.
+ *
+ * @param c the class
+ */
+ BasicPermissionCollection(Class c)
+ {
+ permClass = c;
+ }
- /**
- * Returns true if this collection implies the given permission.
- *
- * @param permission the permission to check
- * @return true if it is implied by this
- */
- public boolean implies(Permission permission)
- {
- if (! permClass.isInstance(permission))
- return false;
- if (all_allowed)
- return true;
- BasicPermission toImply = (BasicPermission) permission;
- String name = toImply.getName();
- if (name.equals("*"))
- return false;
- int prefixLength = name.length();
- if (name.endsWith("*"))
- prefixLength -= 2;
+ /**
+ * Add a Permission. It must be of the same type as the permission which
+ * created this collection.
+ *
+ * @param perm the permission to add
+ * @throws IllegalArgumentException if perm is not the correct type
+ * @throws SecurityException if the collection is read-only
+ */
+ public void add(Permission perm)
+ {
+ if (isReadOnly())
+ throw new SecurityException("readonly");
+ if (! permClass.isInstance(perm))
+ throw new IllegalArgumentException("Expecting instance of " + permClass);
+ BasicPermission bp = (BasicPermission) perm;
+ String name = bp.getName();
+ if (name.equals("*"))
+ all_allowed = true;
+ permissions.put(name, bp);
+ }
- while (true)
- {
- if (permissions.get(name) != null)
- return true;
- prefixLength = name.lastIndexOf('.', prefixLength);
- if (prefixLength < 0)
- return false;
- name = name.substring(0, prefixLength + 1) + '*';
- }
- }
+ /**
+ * Returns true if this collection implies the given permission.
+ *
+ * @param permission the permission to check
+ * @return true if it is implied by this
+ */
+ public boolean implies(Permission permission)
+ {
+ if (! permClass.isInstance(permission))
+ return false;
+ if (all_allowed)
+ return true;
+ BasicPermission toImply = (BasicPermission) permission;
+ String name = toImply.getName();
+ if (name.equals("*"))
+ return false;
+ int prefixLength = name.length();
+ if (name.endsWith("*"))
+ prefixLength -= 2;
- /**
- * Enumerate over the collection.
- *
- * @return an enumeration of the collection contents
- */
- public Enumeration elements()
- {
- return permissions.elements();
- }
-} // class BasicPermissionCollection
+ while (true)
+ {
+ if (permissions.get(name) != null)
+ return true;
+ prefixLength = name.lastIndexOf('.', prefixLength);
+ if (prefixLength < 0)
+ return false;
+ name = name.substring(0, prefixLength + 1) + '*';
+ }
+ }
+
+ /**
+ * Enumerate over the collection.
+ *
+ * @return an enumeration of the collection contents
+ */
+ public Enumeration elements()
+ {
+ return permissions.elements();
+ }
+ } // class BasicPermissionCollection
+} // class BasicPermission
diff --git a/libjava/java/security/DigestException.java b/libjava/java/security/DigestException.java
index f5c8d627de6..bc672420207 100644
--- a/libjava/java/security/DigestException.java
+++ b/libjava/java/security/DigestException.java
@@ -1,5 +1,5 @@
/* DigestException.java -- A generic message digest exception
- Copyright (C) 1998, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1998, 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -41,7 +41,7 @@ package java.security;
* This exception indicates that a generic message digest exception has
* occurred.
*
- * @author Aaron M. Renn <arenn@urbanophile.com>
+ * @author Aaron M. Renn (arenn@urbanophile.com)
* @status updated to 1.4
*/
public class DigestException extends GeneralSecurityException
diff --git a/libjava/java/security/DigestInputStream.java b/libjava/java/security/DigestInputStream.java
index 2ca9d1b3956..e8d2b63fdfc 100644
--- a/libjava/java/security/DigestInputStream.java
+++ b/libjava/java/security/DigestInputStream.java
@@ -1,5 +1,5 @@
/* DigestInputStream.java --- An Input stream tied to a message digest
- Copyright (C) 1999, 2003, 2004 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2003, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -52,7 +52,7 @@ import java.io.InputStream;
* in the message digest.
*
* @version 0.0
- * @author Mark Benvenuto <ivymccough@worldnet.att.net>
+ * @author Mark Benvenuto (ivymccough@worldnet.att.net)
*/
public class DigestInputStream extends FilterInputStream
{
diff --git a/libjava/java/security/DigestOutputStream.java b/libjava/java/security/DigestOutputStream.java
index caf059bf40e..d95533c97cc 100644
--- a/libjava/java/security/DigestOutputStream.java
+++ b/libjava/java/security/DigestOutputStream.java
@@ -1,5 +1,5 @@
/* DigestOutputStream.java --- An output stream tied to a message digest
- Copyright (C) 1999, 2004 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -52,7 +52,7 @@ import java.io.OutputStream;
* message digest.
*
* @version 0.0
- * @author Mark Benvenuto <ivymccough@worldnet.att.net>
+ * @author Mark Benvenuto (ivymccough@worldnet.att.net)
*/
public class DigestOutputStream extends FilterOutputStream
{
diff --git a/libjava/java/security/GeneralSecurityException.java b/libjava/java/security/GeneralSecurityException.java
index d1db3c5d6fb..8a26e85cd50 100644
--- a/libjava/java/security/GeneralSecurityException.java
+++ b/libjava/java/security/GeneralSecurityException.java
@@ -1,5 +1,5 @@
/* GeneralSecurityException.java -- Common superclass of security exceptions
- Copyright (C) 1998, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1998, 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -46,7 +46,7 @@ package java.security;
* (<code>RuntimeException</code>), and <code>InvalidParamterException</code>
* (<code>IllegalArgumentException</code>).
*
- * @author Aaron M. Renn <arenn@urbanophile.com>
+ * @author Aaron M. Renn (arenn@urbanophile.com)
* @status updated to 1.4
*/
public class GeneralSecurityException extends Exception
diff --git a/libjava/java/security/Guard.java b/libjava/java/security/Guard.java
index 2654ba70c04..8a2ab0f0f5f 100644
--- a/libjava/java/security/Guard.java
+++ b/libjava/java/security/Guard.java
@@ -1,5 +1,5 @@
/* Guard.java -- Check access to a guarded object
- Copyright (C) 1998, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1998, 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -41,7 +41,7 @@ package java.security;
* This interface specifies a mechanism for querying whether or not
* access is allowed to a guarded object.
*
- * @author Aaron M. Renn <arenn@urbanophile.com>
+ * @author Aaron M. Renn (arenn@urbanophile.com)
* @see GuardedObject
* @since 1.1
* @status updated to 1.4
diff --git a/libjava/java/security/GuardedObject.java b/libjava/java/security/GuardedObject.java
index a4cdf74bd3e..5aeaf91e385 100644
--- a/libjava/java/security/GuardedObject.java
+++ b/libjava/java/security/GuardedObject.java
@@ -1,5 +1,5 @@
/* GuardedObject.java -- An object protected by a Guard
- Copyright (C) 1998, 2002, 2004 Free Software Foundation, Inc.
+ Copyright (C) 1998, 2002, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -50,7 +50,7 @@ import java.io.Serializable;
* <code>Guard</code>. If the <code>Guard</code> disallows access, an
* exception will be thrown.
*
- * @author Aaron M. Renn <arenn@urbanophile.com>
+ * @author Aaron M. Renn (arenn@urbanophile.com)
* @since 1.1
* @status updated to 1.4
*/
diff --git a/libjava/java/security/InvalidAlgorithmParameterException.java b/libjava/java/security/InvalidAlgorithmParameterException.java
index 40f953079be..5b2ada1bfb9 100644
--- a/libjava/java/security/InvalidAlgorithmParameterException.java
+++ b/libjava/java/security/InvalidAlgorithmParameterException.java
@@ -1,6 +1,6 @@
/* InvalidAlgorithmParameterException.java -- an invalid parameter to a
security algorithm
- Copyright (C) 2000, 2002 Free Software Foundation, Inc.
+ Copyright (C) 2000, 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -41,7 +41,7 @@ package java.security;
/**
* Thrown for an invalid security algorithm parameter.
*
- * @author Warren Levy <warrenl@cygnus.com>
+ * @author Warren Levy (warrenl@cygnus.com)
* @since 1.2
* @status updated to 1.4
*/
diff --git a/libjava/java/security/InvalidKeyException.java b/libjava/java/security/InvalidKeyException.java
index 373e8625a68..ce6b8e5cd54 100644
--- a/libjava/java/security/InvalidKeyException.java
+++ b/libjava/java/security/InvalidKeyException.java
@@ -40,7 +40,7 @@ package java.security;
/**
* Thrown for an invalid key.
*
- * @author Warren Levy <warrenl@cygnus.com>
+ * @author Warren Levy (warrenl@cygnus.com)
* @status updated to 1.4
*/
public class InvalidKeyException extends KeyException
diff --git a/libjava/java/security/InvalidParameterException.java b/libjava/java/security/InvalidParameterException.java
index 220899197fa..f54d819de81 100644
--- a/libjava/java/security/InvalidParameterException.java
+++ b/libjava/java/security/InvalidParameterException.java
@@ -41,7 +41,7 @@ package java.security;
* Thrown when an invalid parameter is passed to a method of the JCA/JCE
* engine classes.
*
- * @author Warren Levy <warrenl@cygnus.com>
+ * @author Warren Levy (warrenl@cygnus.com)
* @status updated to 1.4
*/
public class InvalidParameterException extends IllegalArgumentException
diff --git a/libjava/java/security/Key.java b/libjava/java/security/Key.java
index 195e50bb527..5e74be9da9a 100644
--- a/libjava/java/security/Key.java
+++ b/libjava/java/security/Key.java
@@ -1,5 +1,5 @@
/* Key.java -- A abstract representation of a digital key
- Copyright (C) 1998, 2000, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1998, 2000, 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -47,7 +47,7 @@ import java.io.Serializable;
* keys may be serialized. Keys are generally obtained through key generators,
* including {@link KeyFactory}.
*
- * @author Aaron M. Renn <arenn@urbanophile.com>
+ * @author Aaron M. Renn (arenn@urbanophile.com)
* @see PublicKey
* @see PrivateKey
* @see KeyPair
diff --git a/libjava/java/security/KeyException.java b/libjava/java/security/KeyException.java
index 3b7d3886e15..8d69a569318 100644
--- a/libjava/java/security/KeyException.java
+++ b/libjava/java/security/KeyException.java
@@ -1,5 +1,5 @@
/* KeyException.java -- Thrown when there is a problem with a key
- Copyright (C) 1998, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1998, 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -40,7 +40,7 @@ package java.security;
/**
* This exception is thrown when there is a problem with a key.
*
- * @author Aaron M. Renn <arenn@urbanophile.com>
+ * @author Aaron M. Renn (arenn@urbanophile.com)
* @see Key
* @status updated to 1.4
*/
diff --git a/libjava/java/security/KeyFactory.java b/libjava/java/security/KeyFactory.java
index 27171f50966..02709f4c8f3 100644
--- a/libjava/java/security/KeyFactory.java
+++ b/libjava/java/security/KeyFactory.java
@@ -163,7 +163,7 @@ public class KeyFactory
Provider p = Security.getProvider(provider);
if (p == null)
- throw new NoSuchProviderException();
+ throw new NoSuchProviderException(provider);
return getInstance(algorithm, p);
}
diff --git a/libjava/java/security/KeyManagementException.java b/libjava/java/security/KeyManagementException.java
index 52c2786294f..ca642ba3422 100644
--- a/libjava/java/security/KeyManagementException.java
+++ b/libjava/java/security/KeyManagementException.java
@@ -1,5 +1,5 @@
/* KeyManagementException.java -- an exception in key management
- Copyright (C) 1998, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1998, 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -41,7 +41,7 @@ package java.security;
* This exception is thrown whenever a problem related to the management of
* security keys is encountered.
*
- * @author Aaron M. Renn <arenn@urbanophile.com>
+ * @author Aaron M. Renn (arenn@urbanophile.com)
* @see Key
* @status updated to 1.4
*/
diff --git a/libjava/java/security/KeyStore.java b/libjava/java/security/KeyStore.java
index 99aaed3f123..f1e874786f5 100644
--- a/libjava/java/security/KeyStore.java
+++ b/libjava/java/security/KeyStore.java
@@ -164,7 +164,7 @@ public class KeyStore
Provider p = Security.getProvider(provider);
if (p == null)
- throw new NoSuchProviderException();
+ throw new NoSuchProviderException(provider);
return getInstance(type, p);
}
diff --git a/libjava/java/security/KeyStoreException.java b/libjava/java/security/KeyStoreException.java
index 369587a5984..8f45a555c52 100644
--- a/libjava/java/security/KeyStoreException.java
+++ b/libjava/java/security/KeyStoreException.java
@@ -1,5 +1,5 @@
/* KeyStoreException.java -- Indicates a problem with the key store
- Copyright (C) 1998, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1998, 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -40,7 +40,7 @@ package java.security;
/**
* Indicates a problem with the key store.
*
- * @author Aaron M. Renn <arenn@urbanophile.com>
+ * @author Aaron M. Renn (arenn@urbanophile.com)
* @since 1.2
* @status updated to 1.4
*/
diff --git a/libjava/java/security/MessageDigestSpi.java b/libjava/java/security/MessageDigestSpi.java
index f2447f17d86..036392ea928 100644
--- a/libjava/java/security/MessageDigestSpi.java
+++ b/libjava/java/security/MessageDigestSpi.java
@@ -1,5 +1,5 @@
/* MessageDigestSpi.java --- The message digest service provider interface.
- Copyright (C) 1999 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -53,7 +53,7 @@ package java.security;
@version 0.0
- @author Mark Benvenuto <ivymccough@worldnet.att.net>
+ @author Mark Benvenuto (ivymccough@worldnet.att.net)
*/
public abstract class MessageDigestSpi
{
diff --git a/libjava/java/security/NoSuchAlgorithmException.java b/libjava/java/security/NoSuchAlgorithmException.java
index 31e00537a50..7d167dd0e8f 100644
--- a/libjava/java/security/NoSuchAlgorithmException.java
+++ b/libjava/java/security/NoSuchAlgorithmException.java
@@ -1,5 +1,5 @@
/* NoSuchAlgorithmException.java -- an algorithm was not available
- Copyright (C) 1998, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1998, 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -41,7 +41,7 @@ package java.security;
* This exception is thrown when the requested security algorithm is
* not available
*
- * @author Aaron M. Renn <arenn@urbanophile.com>
+ * @author Aaron M. Renn (arenn@urbanophile.com)
* @status updated to 1.4
*/
public class NoSuchAlgorithmException extends GeneralSecurityException
diff --git a/libjava/java/security/NoSuchProviderException.java b/libjava/java/security/NoSuchProviderException.java
index 546b2dc6190..e676046aefd 100644
--- a/libjava/java/security/NoSuchProviderException.java
+++ b/libjava/java/security/NoSuchProviderException.java
@@ -1,5 +1,5 @@
/* NoSuchProviderException.java -- thrown when a provider is not found
- Copyright (C) 1998, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1998, 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -41,7 +41,7 @@ package java.security;
* This exception is thrown when the requested security provider is
* not available.
*
- * @author Aaron M. Renn <arenn@urbanophile.com>
+ * @author Aaron M. Renn (arenn@urbanophile.com)
* @status updated to 1.4
*/
public class NoSuchProviderException extends GeneralSecurityException
diff --git a/libjava/java/security/Permission.java b/libjava/java/security/Permission.java
index 58702da2c0c..4310500ca45 100644
--- a/libjava/java/security/Permission.java
+++ b/libjava/java/security/Permission.java
@@ -1,5 +1,5 @@
/* Permission.java -- The superclass for all permission objects
- Copyright (C) 1998, 2001, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1998, 2001, 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -61,7 +61,7 @@ import java.io.Serializable;
* <p><code>Permission</code>'s must be immutable - do not change their
* state after creation.
*
- * @author Aaron M. Renn <arenn@urbanophile.com>
+ * @author Aaron M. Renn (arenn@urbanophile.com)
* @see Permissions
* @see PermissionCollection
* @since 1.1
diff --git a/libjava/java/security/PermissionCollection.java b/libjava/java/security/PermissionCollection.java
index 703767ed9a9..337a8fca937 100644
--- a/libjava/java/security/PermissionCollection.java
+++ b/libjava/java/security/PermissionCollection.java
@@ -1,5 +1,5 @@
/* PermissionCollection.java -- A collection of permission objects
- Copyright (C) 1998, 2001, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1998, 2001, 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -67,8 +67,8 @@ import java.util.Enumeration;
* in any type of collection unless it overrides that method to create its
* own collection type.
*
- * @author Aaron M. Renn <arenn@urbanophile.com>
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Aaron M. Renn (arenn@urbanophile.com)
+ * @author Eric Blake (ebb9@email.byu.edu)
* @see Permission
* @see Permissions
* @since 1.1
diff --git a/libjava/java/security/Permissions.java b/libjava/java/security/Permissions.java
index d44341c947a..b603dedcf86 100644
--- a/libjava/java/security/Permissions.java
+++ b/libjava/java/security/Permissions.java
@@ -1,5 +1,5 @@
/* Permissions.java -- a collection of permission collections
- Copyright (C) 1998, 2001, 2002, 2004 Free Software Foundation, Inc.
+ Copyright (C) 1998, 2001, 2002, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -53,8 +53,8 @@ import java.util.NoSuchElementException;
* collection type which stores its permissions in a hash table will be
* used.
*
- * @author Aaron M. Renn <arenn@urbanophile.com>
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Aaron M. Renn (arenn@urbanophile.com)
+ * @author Eric Blake (ebb9@email.byu.edu)
* @since 1.1
*/
public final class Permissions extends PermissionCollection
@@ -188,58 +188,67 @@ public final class Permissions extends PermissionCollection
}
};
}
-} // class Permissions
-
-/**
- * Implements the permission collection for all permissions without one of
- * their own, and obeys serialization of JDK.
- *
- * @author Eric Blake <ebb9@email.byu.edu>
- */
-class PermissionsHash extends PermissionCollection
-{
- /**
- * Compatible with JDK 1.1+.
- */
- private static final long serialVersionUID = -8491988220802933440L;
-
- /**
- * Hashtable where we store permissions.
- *
- * @serial the stored permissions, both as key and value
- */
- private final Hashtable perms = new Hashtable();
-
- /**
- * Add a permission. We don't need to check for read-only, as this
- * collection is never exposed outside of Permissions, which has already
- * done that check.
- *
- * @param perm the permission to add
- */
- public void add(Permission perm)
- {
- perms.put(perm, perm);
- }
-
- /**
- * Returns true if perm is in the collection.
- *
- * @param perm the permission to check
- * @return true if it is implied
- */
- public boolean implies(Permission perm)
- {
- return perms.get(perm) != null;
- }
/**
- * Return the elements.
+ * Implements the permission collection for all permissions without one of
+ * their own, and obeys serialization of JDK.
*
- * @return the elements
+ * @author Eric Blake (ebb9@email.byu.edu)
*/
- public Enumeration elements()
+ private static final class PermissionsHash extends PermissionCollection
{
- return perms.elements();
- }
+ /**
+ * Compatible with JDK 1.1+.
+ */
+ private static final long serialVersionUID = -8491988220802933440L;
+
+ /**
+ * Hashtable where we store permissions.
+ *
+ * @serial the stored permissions, both as key and value
+ */
+ private final Hashtable perms = new Hashtable();
+
+ /**
+ * Add a permission. We don't need to check for read-only, as this
+ * collection is never exposed outside of Permissions, which has already
+ * done that check.
+ *
+ * @param perm the permission to add
+ */
+ public void add(Permission perm)
+ {
+ perms.put(perm, perm);
+ }
+
+ /**
+ * Returns true if perm is in the collection.
+ *
+ * @param perm the permission to check
+ * @return true if it is implied
+ */
+ // FIXME: Should this method be synchronized?
+ public boolean implies(Permission perm)
+ {
+ Enumeration elements = elements();
+
+ while (elements.hasMoreElements())
+ {
+ Permission p = (Permission)elements.nextElement();
+ if (p.implies(perm))
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Return the elements.
+ *
+ * @return the elements
+ */
+ public Enumeration elements()
+ {
+ return perms.elements();
+ }
+ } // class PermissionsHash
} // class Permissions
diff --git a/libjava/java/security/Principal.java b/libjava/java/security/Principal.java
index 2ac69b2c563..69990b8f8a7 100644
--- a/libjava/java/security/Principal.java
+++ b/libjava/java/security/Principal.java
@@ -1,5 +1,5 @@
/* Principal.java -- A security entity
- Copyright (C) 1998, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1998, 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -42,7 +42,7 @@ package java.security;
* This interface models an entity (such as a user or a certificate authority)
* for the purposes of applying the Java security model.
*
- * @author Aaron M. Renn <arenn@urbanophile.com>
+ * @author Aaron M. Renn (arenn@urbanophile.com)
* @see X509Certificate
* @since 1.1
* @status updated to 1.4
diff --git a/libjava/java/security/PrivateKey.java b/libjava/java/security/PrivateKey.java
index 40b97f58b9a..c4a628c4279 100644
--- a/libjava/java/security/PrivateKey.java
+++ b/libjava/java/security/PrivateKey.java
@@ -1,5 +1,5 @@
/* PrivateKey.java -- tagging interface for all private keys
- Copyright (C) 1998, 2001, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1998, 2001, 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -42,7 +42,7 @@ package java.security;
* This interface specified no methods. In simply provides a common
* super-interface for all algorithm specific private key values.
*
- * @author Aaron M. Renn <arenn@urbanophile.com>
+ * @author Aaron M. Renn (arenn@urbanophile.com)
* @see Key
* @see PublicKey
* @see Certificate
diff --git a/libjava/java/security/PrivilegedActionException.java b/libjava/java/security/PrivilegedActionException.java
index 633a872cfe5..d699abd8766 100644
--- a/libjava/java/security/PrivilegedActionException.java
+++ b/libjava/java/security/PrivilegedActionException.java
@@ -1,5 +1,5 @@
/* PrivilegedActionException.java -- wrap an exception in a privileged action
- Copyright (C) 1998, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1998, 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -43,8 +43,8 @@ package java.security;
* <code>AccessController.doPrivileged()</code> method. It wraps the
* actual exception thrown in the privileged code.
*
- * @author Aaron M. Renn <arenn@urbanophile.com>
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Aaron M. Renn (arenn@urbanophile.com)
+ * @author Eric Blake (ebb9@email.byu.edu)
* @see PrivilegedExceptionAction
* @see AccessController#doPrivileged(PrivilegedExceptionAction)
* @see AccessController#doPrivileged(PrivilegedExceptionAction, AccessControlContext)
diff --git a/libjava/java/security/ProviderException.java b/libjava/java/security/ProviderException.java
index eac3eb064c8..5b0e86e9b8e 100644
--- a/libjava/java/security/ProviderException.java
+++ b/libjava/java/security/ProviderException.java
@@ -1,5 +1,5 @@
/* ProviderException.java -- Generic security provider runtime exception
- Copyright (C) 1998, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1998, 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -41,7 +41,7 @@ package java.security;
* This exception indicates that a runtime problem was encounterd with
* a security provider.
*
- * @author Aaron M. Renn <arenn@urbanophile.com>
+ * @author Aaron M. Renn (arenn@urbanophile.com)
* @status updated to 1.4
*/
public class ProviderException extends RuntimeException
diff --git a/libjava/java/security/PublicKey.java b/libjava/java/security/PublicKey.java
index 81ab764615f..f2a331e6862 100644
--- a/libjava/java/security/PublicKey.java
+++ b/libjava/java/security/PublicKey.java
@@ -1,5 +1,5 @@
/* PublicKey.java -- tagging interface for all public keys
- Copyright (C) 1998, 2001, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1998, 2001, 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -41,7 +41,7 @@ package java.security;
* This interface specified no methods. In simply provides a common
* super-interface for all algorithm specific public key values.
*
- * @author Aaron M. Renn <arenn@urbanophile.com>
+ * @author Aaron M. Renn (arenn@urbanophile.com)
* @see Key
* @see PrivateKey
* @see Certificate
diff --git a/libjava/java/security/SecureClassLoader.java b/libjava/java/security/SecureClassLoader.java
index 7546edc85e5..89b5e4effce 100644
--- a/libjava/java/security/SecureClassLoader.java
+++ b/libjava/java/security/SecureClassLoader.java
@@ -48,6 +48,8 @@ package java.security;
*/
public class SecureClassLoader extends ClassLoader
{
+ java.util.WeakHashMap protectionDomainCache = new java.util.WeakHashMap();
+
protected SecureClassLoader(ClassLoader parent)
{
super(parent);
@@ -80,11 +82,29 @@ public class SecureClassLoader extends ClassLoader
protected final Class defineClass(String name, byte[] b, int off, int len,
CodeSource cs)
{
- // FIXME: Need to cache ProtectionDomains according to 1.3 docs.
if (cs != null)
{
- ProtectionDomain protectionDomain
- = new ProtectionDomain(cs, getPermissions(cs), this, null);
+ ProtectionDomain protectionDomain;
+
+ synchronized (protectionDomainCache)
+ {
+ protectionDomain = (ProtectionDomain)protectionDomainCache.get(cs);
+ }
+
+ if (protectionDomain == null)
+ {
+ protectionDomain
+ = new ProtectionDomain(cs, getPermissions(cs), this, null);
+ synchronized (protectionDomainCache)
+ {
+ ProtectionDomain domain
+ = (ProtectionDomain)protectionDomainCache.get(cs);
+ if (domain == null)
+ protectionDomainCache.put(cs, protectionDomain);
+ else
+ protectionDomain = domain;
+ }
+ }
return super.defineClass(name, b, off, len, protectionDomain);
}
else
diff --git a/libjava/java/security/SecureRandom.java b/libjava/java/security/SecureRandom.java
index 5e410c0405c..5d200383843 100644
--- a/libjava/java/security/SecureRandom.java
+++ b/libjava/java/security/SecureRandom.java
@@ -1,5 +1,5 @@
/* SecureRandom.java --- Secure Random class implementation
- Copyright (C) 1999, 2001, 2002, 2003 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2001, 2002, 2003, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -49,7 +49,7 @@ import java.util.Random;
* keys and initialization vectors to the generation of random padding
* bytes.
*
- * @author Mark Benvenuto <ivymccough@worldnet.att.net>
+ * @author Mark Benvenuto (ivymccough@worldnet.att.net)
* @author Casey Marshall
*/
public class SecureRandom extends Random
@@ -112,6 +112,10 @@ public class SecureRandom extends Random
provider = p[i];
return;
}
+ catch (ThreadDeath death)
+ {
+ throw death;
+ }
catch (Throwable t)
{
// Ignore.
@@ -214,7 +218,7 @@ public class SecureRandom extends Random
Provider p = Security.getProvider(provider);
if (p == null)
- throw new NoSuchProviderException();
+ throw new NoSuchProviderException(provider);
return getInstance(algorithm, p);
}
diff --git a/libjava/java/security/SecureRandomSpi.java b/libjava/java/security/SecureRandomSpi.java
index 6831173688f..5218a985899 100644
--- a/libjava/java/security/SecureRandomSpi.java
+++ b/libjava/java/security/SecureRandomSpi.java
@@ -1,5 +1,5 @@
/* SecureRandomSpi.java --- Secure Random Service Provider Interface
- Copyright (C) 1999 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -46,7 +46,7 @@ import java.io.Serializable;
@since JDK 1.2
- @author Mark Benvenuto <ivymccough@worldnet.att.net>
+ @author Mark Benvenuto (ivymccough@worldnet.att.net)
*/
public abstract class SecureRandomSpi implements Serializable
{
diff --git a/libjava/java/security/SignatureException.java b/libjava/java/security/SignatureException.java
index 8762b0683cc..daccdf09cf7 100644
--- a/libjava/java/security/SignatureException.java
+++ b/libjava/java/security/SignatureException.java
@@ -1,5 +1,5 @@
/* SignatureException.java -- Generic error in signature
- Copyright (C) 1998, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1998, 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -41,7 +41,7 @@ package java.security;
* This exception is thrown when a problem is encountered with a
* digital signature.
*
- * @author Aaron M. Renn <arenn@urbanophile.com>
+ * @author Aaron M. Renn (arenn@urbanophile.com)
* @status updated to 1.4
*/
public class SignatureException extends GeneralSecurityException
diff --git a/libjava/java/security/SignatureSpi.java b/libjava/java/security/SignatureSpi.java
index 3b6bdbc99ab..3dd3e4f4952 100644
--- a/libjava/java/security/SignatureSpi.java
+++ b/libjava/java/security/SignatureSpi.java
@@ -49,7 +49,7 @@ import java.security.spec.AlgorithmParameterSpec;
* cryptographic service provider who wishes to supply the implementation of a
* particular signature algorithm.
*
- * @author Mark Benvenuto <ivymccough@worldnet.att.net>
+ * @author Mark Benvenuto (ivymccough@worldnet.att.net)
* @since 1.2
* @see Signature
*/
diff --git a/libjava/java/security/SignedObject.java b/libjava/java/security/SignedObject.java
index 0d9f733e70d..f7ef0d5cb44 100644
--- a/libjava/java/security/SignedObject.java
+++ b/libjava/java/security/SignedObject.java
@@ -123,7 +123,7 @@ import java.io.Serializable;
* of signatures, resembling a chain of authorization and delegation.</li>
* </ul>
*
- * @author Mark Benvenuto <ivymccough@worldnet.att.net>
+ * @author Mark Benvenuto (ivymccough@worldnet.att.net)
* @since 1.2
* @see Signature
*/
diff --git a/libjava/java/security/Signer.java b/libjava/java/security/Signer.java
index 425933a8cea..a9e20d42cab 100644
--- a/libjava/java/security/Signer.java
+++ b/libjava/java/security/Signer.java
@@ -45,7 +45,7 @@ package java.security;
* issue that should be handled by subclasses as appropriate to their intended
* use.</p>
*
- * @author Mark Benvenuto <ivymccough@worldnet.att.net>
+ * @author Mark Benvenuto (ivymccough@worldnet.att.net)
* @deprecated This class is no longer used. Its functionality has been replaced
* by <code>java.security.KeyStore</code>, the <code>java.security.cert</code>
* package, and <code>java.security.Principal</code>.
diff --git a/libjava/java/security/UnrecoverableKeyException.java b/libjava/java/security/UnrecoverableKeyException.java
index 3e93153ad7d..9708625a636 100644
--- a/libjava/java/security/UnrecoverableKeyException.java
+++ b/libjava/java/security/UnrecoverableKeyException.java
@@ -1,5 +1,5 @@
/* UnrecoverableKeyException.java -- Cannot recover a key from the key store
- Copyright (C) 1998, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1998, 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -41,7 +41,7 @@ package java.security;
* This exception is thrown when a key cannot be recovered from the key
* store.
*
- * @author Aaron M. Renn <arenn@urbanophile.com>
+ * @author Aaron M. Renn (arenn@urbanophile.com)
* @since 1.2
* @status updated to 1.4
*/
diff --git a/libjava/java/security/UnresolvedPermission.java b/libjava/java/security/UnresolvedPermission.java
index c96bce0cc14..c1f6f049360 100644
--- a/libjava/java/security/UnresolvedPermission.java
+++ b/libjava/java/security/UnresolvedPermission.java
@@ -1,5 +1,5 @@
/* UnresolvedPermission.java -- Placeholder for unresolved permissions
- Copyright (C) 1998, 2001, 2002, 2004 Free Software Foundation, Inc.
+ Copyright (C) 1998, 2001, 2002, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -207,7 +207,7 @@ public final class UnresolvedPermission extends Permission
* Implements the permission collection for unresolved permissions, and
* obeys serialization of JDK.
*
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Eric Blake (ebb9@email.byu.edu)
*/
class UnresolvedPermissionCollection extends PermissionCollection
{
diff --git a/libjava/java/security/acl/AclNotFoundException.java b/libjava/java/security/acl/AclNotFoundException.java
index a843fac1761..4462ffc3493 100644
--- a/libjava/java/security/acl/AclNotFoundException.java
+++ b/libjava/java/security/acl/AclNotFoundException.java
@@ -1,5 +1,5 @@
/* AclNotFoundException.java -- thrown when an ACL is not found
- Copyright (C) 1998, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1998, 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -41,7 +41,7 @@ package java.security.acl;
* This exception is thrown when a requested access control list (ACL) is
* not found.
*
- * @author Aaron M. Renn <arenn@urbanophile.com>
+ * @author Aaron M. Renn (arenn@urbanophile.com)
* @status updated to 1.4
*/
public class AclNotFoundException extends Exception
diff --git a/libjava/java/security/acl/LastOwnerException.java b/libjava/java/security/acl/LastOwnerException.java
index be2815192fb..13e13907988 100644
--- a/libjava/java/security/acl/LastOwnerException.java
+++ b/libjava/java/security/acl/LastOwnerException.java
@@ -1,5 +1,5 @@
/* LastOwnerException.java -- User attempted to delete last ACL owner
- Copyright (C) 1998, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1998, 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -41,7 +41,7 @@ package java.security.acl;
* This exception is thrown when an attempt is made to delete the last owner
* of an access control list (ACL)
*
- * @author Aaron M. Renn <arenn@urbanophile.com>
+ * @author Aaron M. Renn (arenn@urbanophile.com)
* @see Owner#deleteOwner(java.security.Principal, java.security.Principal)
* @status updated to 1.4
*/
diff --git a/libjava/java/security/acl/NotOwnerException.java b/libjava/java/security/acl/NotOwnerException.java
index 8b2739d9cc4..7c3a6c431a7 100644
--- a/libjava/java/security/acl/NotOwnerException.java
+++ b/libjava/java/security/acl/NotOwnerException.java
@@ -1,5 +1,5 @@
/* NotOwnerException.java -- Attempt to modify an unowned ACL
- Copyright (C) 1998, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1998, 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -42,7 +42,7 @@ package java.security.acl;
* the caller to be the owner of the access control list (ACL) when the caller
* is in fact not the owner of the ACL.
*
- * @author Aaron M. Renn <arenn@urbanophile.com>
+ * @author Aaron M. Renn (arenn@urbanophile.com)
* @status updated to 1.4
*/
public class NotOwnerException extends Exception
diff --git a/libjava/java/security/cert/CertPath.java b/libjava/java/security/cert/CertPath.java
index 53f42e752de..c57bd313bc1 100644
--- a/libjava/java/security/cert/CertPath.java
+++ b/libjava/java/security/cert/CertPath.java
@@ -1,5 +1,5 @@
/* CertPath.java -- a sequence of certificates
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -54,7 +54,7 @@ import java.util.List;
* the path is consolidated into a {@link CertPathRep}, which preserves the
* data regardless of the underlying implementation of the path.
*
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Eric Blake (ebb9@email.byu.edu)
* @since 1.4
* @status updated to 1.4
*/
@@ -63,7 +63,7 @@ public abstract class CertPath implements Serializable
/**
* The serialized representation of a path.
*
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Eric Blake (ebb9@email.byu.edu)
*/
protected static class CertPathRep implements Serializable
{
diff --git a/libjava/java/security/cert/CertPathBuilderException.java b/libjava/java/security/cert/CertPathBuilderException.java
index 7cfdb79e536..2db7d337c98 100644
--- a/libjava/java/security/cert/CertPathBuilderException.java
+++ b/libjava/java/security/cert/CertPathBuilderException.java
@@ -1,6 +1,6 @@
/* CertPathBuilderException.java -- wraps an exception during certificate
path building
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -47,7 +47,7 @@ import java.security.GeneralSecurityException;
* Indicates a problem while using a <code>CertPathBuilder</code>, wrapping
* the lower exception. This class is not thread-safe.
*
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Eric Blake (ebb9@email.byu.edu)
* @see CertPathBuilder
* @since 1.4
* @status updated to 1.4
diff --git a/libjava/java/security/cert/CertPathValidatorException.java b/libjava/java/security/cert/CertPathValidatorException.java
index e7b40b8d3d6..9c7ad03c925 100644
--- a/libjava/java/security/cert/CertPathValidatorException.java
+++ b/libjava/java/security/cert/CertPathValidatorException.java
@@ -1,6 +1,6 @@
/* CertPathValidatorException.java -- wraps an exception during validation
of a CertPath
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -48,7 +48,7 @@ import java.security.GeneralSecurityException;
* it can store the path an index in that path that caused the problem. This
* class is not thread-safe.
*
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Eric Blake (ebb9@email.byu.edu)
* @see CertPathValidator
* @since 1.4
* @status updated to 1.4
diff --git a/libjava/java/security/cert/CertStoreException.java b/libjava/java/security/cert/CertStoreException.java
index 7d7bd148e9a..d157b1dc950 100644
--- a/libjava/java/security/cert/CertStoreException.java
+++ b/libjava/java/security/cert/CertStoreException.java
@@ -1,5 +1,5 @@
/* CertStoreException.java -- wraps an exception during certificate storage
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -47,7 +47,7 @@ import java.security.GeneralSecurityException;
* <code>CertStore</code>, wrapping the lower exception. This class is not
* thread-safe.
*
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Eric Blake (ebb9@email.byu.edu)
* @see CertStore
* @since 1.4
* @status updated to 1.4
diff --git a/libjava/java/security/cert/CertificateFactory.java b/libjava/java/security/cert/CertificateFactory.java
index 31664401aea..6a9231703e4 100644
--- a/libjava/java/security/cert/CertificateFactory.java
+++ b/libjava/java/security/cert/CertificateFactory.java
@@ -138,7 +138,7 @@ public class CertificateFactory
{
Provider p = Security.getProvider(provider);
if( p == null)
- throw new NoSuchProviderException();
+ throw new NoSuchProviderException(provider);
return getInstance(type, p);
}
diff --git a/libjava/java/security/interfaces/DSAPrivateKey.java b/libjava/java/security/interfaces/DSAPrivateKey.java
index 4e6f13ddbe5..223db91e806 100644
--- a/libjava/java/security/interfaces/DSAPrivateKey.java
+++ b/libjava/java/security/interfaces/DSAPrivateKey.java
@@ -50,6 +50,11 @@ import java.security.PrivateKey;
public interface DSAPrivateKey extends DSAKey, PrivateKey
{
/**
+ * The version identifier used for serialization.
+ */
+ long serialVersionUID = 7776497482533790279L;
+
+ /**
* This method returns the value of the DSA private key
*/
BigInteger getX();
diff --git a/libjava/java/security/interfaces/DSAPublicKey.java b/libjava/java/security/interfaces/DSAPublicKey.java
index aec1c606dcd..3f8d211d295 100644
--- a/libjava/java/security/interfaces/DSAPublicKey.java
+++ b/libjava/java/security/interfaces/DSAPublicKey.java
@@ -50,6 +50,11 @@ import java.security.PublicKey;
public interface DSAPublicKey extends DSAKey, PublicKey
{
/**
+ * The version identifier used for serialization.
+ */
+ long serialVersionUID = 1234526332779022332L;
+
+ /**
* This method returns the value of the DSA public key
*/
BigInteger getY();
diff --git a/libjava/java/security/interfaces/RSAMultiPrimePrivateCrtKey.java b/libjava/java/security/interfaces/RSAMultiPrimePrivateCrtKey.java
index 7e115fabcd1..68a5e448877 100644
--- a/libjava/java/security/interfaces/RSAMultiPrimePrivateCrtKey.java
+++ b/libjava/java/security/interfaces/RSAMultiPrimePrivateCrtKey.java
@@ -54,6 +54,7 @@ public interface RSAMultiPrimePrivateCrtKey extends RSAPrivateKey
{
// Constants
// --------------------------------------------------------------------------
+ long serialVersionUID = 618058533534628008L;
// Methods
// --------------------------------------------------------------------------
diff --git a/libjava/java/security/interfaces/RSAPrivateCrtKey.java b/libjava/java/security/interfaces/RSAPrivateCrtKey.java
index 8af1bb9168e..1fb2881ed50 100644
--- a/libjava/java/security/interfaces/RSAPrivateCrtKey.java
+++ b/libjava/java/security/interfaces/RSAPrivateCrtKey.java
@@ -49,6 +49,8 @@ import java.math.BigInteger;
*/
public interface RSAPrivateCrtKey extends RSAPrivateKey
{
+ long serialVersionUID = -5682214253527700368L;
+
/**
* Returns the public exponent for this key
*
diff --git a/libjava/java/security/interfaces/RSAPrivateKey.java b/libjava/java/security/interfaces/RSAPrivateKey.java
index d287d67327a..b4e34292340 100644
--- a/libjava/java/security/interfaces/RSAPrivateKey.java
+++ b/libjava/java/security/interfaces/RSAPrivateKey.java
@@ -49,6 +49,8 @@ import java.security.PrivateKey;
*/
public interface RSAPrivateKey extends PrivateKey, RSAKey
{
+ long serialVersionUID = 5187144804936595022L;
+
/**
* Returns the private exponent value for this key
*
diff --git a/libjava/java/security/interfaces/RSAPublicKey.java b/libjava/java/security/interfaces/RSAPublicKey.java
index 22d64b1bb7a..9847ae9d257 100644
--- a/libjava/java/security/interfaces/RSAPublicKey.java
+++ b/libjava/java/security/interfaces/RSAPublicKey.java
@@ -49,6 +49,8 @@ import java.security.PublicKey;
*/
public interface RSAPublicKey extends PublicKey, RSAKey
{
+ long serialVersionUID = -8727434096241101194L;
+
/**
* Returns the public exponent value for this key
*
diff --git a/libjava/java/text/BreakIterator.java b/libjava/java/text/BreakIterator.java
index a79db8c5f23..7fbc16b5849 100644
--- a/libjava/java/text/BreakIterator.java
+++ b/libjava/java/text/BreakIterator.java
@@ -1,5 +1,5 @@
/* BreakIterator.java -- Breaks text into elements
- Copyright (C) 1998, 1999, 2001, 2004 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2001, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -53,7 +53,7 @@ import java.util.ResourceBundle;
* class will be valid upon creation. That is, their methods will
* not cause exceptions if called before you call setText().
*
- * @author Tom Tromey <tromey@cygnus.com>
+ * @author Tom Tromey (tromey@cygnus.com)
* @author Aaron M. Renn (arenn@urbanophile.com)
* @date March 19, 1999
*/
diff --git a/libjava/java/text/ChoiceFormat.java b/libjava/java/text/ChoiceFormat.java
index ff3c9f667d9..3c390278b88 100644
--- a/libjava/java/text/ChoiceFormat.java
+++ b/libjava/java/text/ChoiceFormat.java
@@ -1,5 +1,5 @@
/* ChoiceFormat.java -- Format over a range of numbers
- Copyright (C) 1998, 1999, 2000, 2001, 2002, 2004
+ Copyright (C) 1998, 1999, 2000, 2001, 2002, 2004, 2005
Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -71,7 +71,7 @@ formats = { "file", "files" }</pre>
* array must be sorted in ascending order and the format string array
* must be the same length as the terminator array.
*
- * @author Tom Tromey <tromey@cygnus.com>
+ * @author Tom Tromey (tromey@cygnus.com)
* @author Aaron M. Renn (arenn@urbanophile.com)
* @date March 9, 1999
*/
diff --git a/libjava/java/text/CollationElementIterator.java b/libjava/java/text/CollationElementIterator.java
index 91f341f55b2..481b286c479 100644
--- a/libjava/java/text/CollationElementIterator.java
+++ b/libjava/java/text/CollationElementIterator.java
@@ -53,9 +53,9 @@ import java.util.ArrayList;
* <code>getCollationElementIterator</code> method on
* <code>RuleBasedCollator</code>.
*
- * @author Aaron M. Renn <arenn@urbanophile.com>
- * @author Tom Tromey <tromey@cygnus.com>
- * @author Guilhem Lavaux <guilhem.lavaux@free.fr>
+ * @author Aaron M. Renn (arenn@urbanophile.com)
+ * @author Tom Tromey (tromey@cygnus.com)
+ * @author Guilhem Lavaux (guilhem.lavaux@free.fr)
*/
public final class CollationElementIterator
{
@@ -369,8 +369,9 @@ public final class CollationElementIterator
idx_idx += idxToMove;
idxToMove = 0;
}
- } else
- idx_idx += prefix.key.length();
+ }
+ else
+ idx_idx += prefix.key.length();
}
}
diff --git a/libjava/java/text/CollationKey.java b/libjava/java/text/CollationKey.java
index 4e6aca2635d..1fa380f3595 100644
--- a/libjava/java/text/CollationKey.java
+++ b/libjava/java/text/CollationKey.java
@@ -1,5 +1,5 @@
/* CollationKey.java -- Precomputed collation value
- Copyright (C) 1998, 1999, 2000, 2003 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2000, 2003, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -59,8 +59,8 @@ package java.text;
* <code>CollationKey</code> is created by calling the
* <code>getCollationKey</code> method on an instance of <code>Collator</code>.
*
- * @author Aaron M. Renn <arenn@urbanophile.com>
- * @author Tom Tromey <tromey@cygnus.com>
+ * @author Aaron M. Renn (arenn@urbanophile.com)
+ * @author Tom Tromey (tromey@cygnus.com)
* @date March 25, 1999
*/
public final class CollationKey implements Comparable
diff --git a/libjava/java/text/Collator.java b/libjava/java/text/Collator.java
index 6464d137041..4e634e1c137 100644
--- a/libjava/java/text/Collator.java
+++ b/libjava/java/text/Collator.java
@@ -1,5 +1,5 @@
/* Collator.java -- Perform locale dependent String comparisons.
- Copyright (C) 1998, 1999, 2000, 2001, 2004 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2000, 2001, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -64,7 +64,7 @@ import java.util.ResourceBundle;
* are described in detail in the documentation for the methods and values
* that are related to them.
*
- * @author Tom Tromey <tromey@cygnus.com>
+ * @author Tom Tromey (tromey@cygnus.com)
* @author Aaron M. Renn (arenn@urbanophile.com)
* @date March 18, 1999
*/
diff --git a/libjava/java/text/DateFormat.java b/libjava/java/text/DateFormat.java
index 6fe4461b030..1571672dc43 100644
--- a/libjava/java/text/DateFormat.java
+++ b/libjava/java/text/DateFormat.java
@@ -1,5 +1,5 @@
/* DateFormat.java -- Class for formatting/parsing date/times
- Copyright (C) 1998, 1999, 2000, 2001, 2003, 2004
+ Copyright (C) 1998, 1999, 2000, 2001, 2003, 2004, 2005
Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -48,7 +48,7 @@ import java.util.ResourceBundle;
import java.util.TimeZone;
/**
- * @author Per Bothner <bothner@cygnus.com>
+ * @author Per Bothner (bothner@cygnus.com)
* @date October 25, 1998.
*/
/* Written using "Java Class Libraries", 2nd edition, plus online
@@ -70,29 +70,221 @@ public abstract class DateFormat extends Format implements Cloneable
/* These constants need to have these exact values. They
* correspond to index positions within the localPatternChars
- * string for a given locale. For example, the US locale uses
- * the string "GyMdkHmsSEDFwWahKz", where 'G' is the character
- * for era, 'y' for year, and so on down to 'z' for time zone.
+ * string for a given locale. Each locale may specify its
+ * own character for a particular field, but the position
+ * of these characters must correspond to an appropriate field
+ * number (as listed below), in order for their meaning to
+ * be determined. For example, the US locale uses
+ * the string "GyMdkHmsSEDFwWahKzYeugAZ", where 'G' is the character
+ * for era, 'y' for year, and so on down to 'Z' for time zone.
*/
+ /**
+ * Represents the position of the era
+ * pattern character in the array of
+ * localized pattern characters.
+ * For example, 'AD' is an era used
+ * in the Gregorian calendar system.
+ * In the U.S. locale, this is 'G'.
+ */
public static final int ERA_FIELD = 0;
+ /**
+ * Represents the position of the year
+ * pattern character in the array of
+ * localized pattern characters.
+ * In the U.S. locale, this is 'y'.
+ */
public static final int YEAR_FIELD = 1;
+ /**
+ * Represents the position of the month
+ * pattern character in the array of
+ * localized pattern characters.
+ * In the U.S. locale, this is 'M'.
+ */
public static final int MONTH_FIELD = 2;
+ /**
+ * Represents the position of the date
+ * or day of the month pattern character
+ * in the array of localized pattern
+ * characters. In the U.S. locale,
+ * this is 'd'.
+ */
public static final int DATE_FIELD = 3;
+ /**
+ * Represents the position of the 24
+ * hour pattern character in the array of
+ * localized pattern characters.
+ * In the U.S. locale, this is 'k'.
+ * This field numbers hours from 1 to 24.
+ */
public static final int HOUR_OF_DAY1_FIELD = 4;
+ /**
+ * Represents the position of the 24
+ * hour pattern character in the array of
+ * localized pattern characters.
+ * In the U.S. locale, this is 'H'.
+ * This field numbers hours from 0 to 23.
+ */
public static final int HOUR_OF_DAY0_FIELD = 5;
+ /**
+ * Represents the position of the minute
+ * pattern character in the array of
+ * localized pattern characters.
+ * In the U.S. locale, this is 'm'.
+ */
public static final int MINUTE_FIELD = 6;
+ /**
+ * Represents the position of the second
+ * pattern character in the array of
+ * localized pattern characters.
+ * In the U.S. locale, this is 's'.
+ */
public static final int SECOND_FIELD = 7;
+ /**
+ * Represents the position of the millisecond
+ * pattern character in the array of
+ * localized pattern characters.
+ * In the U.S. locale, this is 'S'.
+ */
public static final int MILLISECOND_FIELD = 8;
+ /**
+ * Represents the position of the day of the
+ * week pattern character in the array of
+ * localized pattern characters.
+ * In the U.S. locale, this is 'E'.
+ */
public static final int DAY_OF_WEEK_FIELD = 9;
+ /**
+ * Represents the position of the day of the
+ * year pattern character in the array of
+ * localized pattern characters.
+ * In the U.S. locale, this is 'D'.
+ */
public static final int DAY_OF_YEAR_FIELD = 10;
+ /**
+ * Represents the position of the day of the
+ * week in the month pattern character in the
+ * array of localized pattern characters.
+ * In the U.S. locale, this is 'F'.
+ */
public static final int DAY_OF_WEEK_IN_MONTH_FIELD = 11;
+ /**
+ * Represents the position of the week of the
+ * year pattern character in the array of
+ * localized pattern characters.
+ * In the U.S. locale, this is 'w'.
+ */
public static final int WEEK_OF_YEAR_FIELD = 12;
+ /**
+ * Represents the position of the week of the
+ * month pattern character in the array of
+ * localized pattern characters.
+ * In the U.S. locale, this is 'W'.
+ */
public static final int WEEK_OF_MONTH_FIELD = 13;
+ /**
+ * Represents the position of the am/pm
+ * pattern character in the array of
+ * localized pattern characters.
+ * In the U.S. locale, this is 'a'.
+ */
public static final int AM_PM_FIELD = 14;
+ /**
+ * Represents the position of the 12
+ * hour pattern character in the array of
+ * localized pattern characters.
+ * In the U.S. locale, this is 'h'.
+ * This field numbers hours from 1 to 12.
+ */
public static final int HOUR1_FIELD = 15;
+ /**
+ * Represents the position of the 12
+ * hour pattern character in the array of
+ * localized pattern characters.
+ * In the U.S. locale, this is 'K'.
+ * This field numbers hours from 0 to 11.
+ */
public static final int HOUR0_FIELD = 16;
+ /**
+ * Represents the position of the generic
+ * timezone pattern character in the array of
+ * localized pattern characters.
+ * In the U.S. locale, this is 'z'.
+ */
public static final int TIMEZONE_FIELD = 17;
-
+ /**
+ * Represents the position of the ISO year
+ * pattern character in the array of
+ * localized pattern characters.
+ * In the U.S. locale, this is 'Y'.
+ * This is a GNU extension in accordance with
+ * the CLDR data used. This value may
+ * differ from the normal year value.
+ */
+ public static final int ISO_YEAR_FIELD = 18;
+ /**
+ * Represents the position of the localized
+ * day of the week pattern character in the
+ * array of localized pattern characters.
+ * In the U.S. locale, this is 'e'.
+ * This is a GNU extension in accordance with
+ * the CLDR data used. This value only
+ * differs from the day of the week with
+ * numeric formatting, in which case the
+ * locale's first day of the week is used.
+ */
+ public static final int LOCALIZED_DAY_OF_WEEK_FIELD = 19;
+ /**
+ * Represents the position of the extended year
+ * pattern character in the array of
+ * localized pattern characters.
+ * In the U.S. locale, this is 'u'.
+ * This is a GNU extension in accordance with
+ * the CLDR data used. This value modifies
+ * the year value, so as to incorporate the era.
+ * For example, in the Gregorian calendar system,
+ * the extended year is negative instead of being
+ * marked as BC.
+ */
+ public static final int EXTENDED_YEAR_FIELD = 20;
+ /**
+ * Represents the position of the modified Julian
+ * day pattern character in the array of
+ * localized pattern characters.
+ * In the U.S. locale, this is 'g'.
+ * This is a GNU extension in accordance with
+ * the CLDR data used. This value differs
+ * from the standard Julian day in that days
+ * are marked from midnight onwards rather than
+ * noon, and the local time zone affects the value.
+ * In simple terms, it can be thought of as all
+ * the date fields represented as a single number.
+ */
+ public static final int MODIFIED_JULIAN_DAY_FIELD = 21;
+ /**
+ * Represents the position of the millisecond
+ * in the day pattern character in the array of
+ * localized pattern characters.
+ * In the U.S. locale, this is 'A'.
+ * This is a GNU extension in accordance with
+ * the CLDR data used. This value represents
+ * all the time fields (excluding the time zone)
+ * numerically, giving the number of milliseconds
+ * into the day (e.g. 10 in the morning would
+ * be 10 * 60 * 60 * 1000). Any daylight savings
+ * offset also affects this value.
+ */
+ public static final int MILLISECOND_IN_DAY_FIELD = 22;
+ /**
+ * Represents the position of the RFC822
+ * timezone pattern character in the array of
+ * localized pattern characters.
+ * In the U.S. locale, this is 'Z'.
+ * This is a GNU extension in accordance with
+ * the CLDR data used. The value is the offset
+ * of the current time from GMT e.g. -0500 would
+ * be five hours prior to GMT.
+ */
+ public static final int RFC822_TIMEZONE_FIELD = 23;
public static class Field extends Format.Field
{
@@ -136,14 +328,28 @@ public abstract class DateFormat extends Format implements Cloneable
= new Field("hour0", Calendar.HOUR);
public static final DateFormat.Field TIME_ZONE
= new Field("timezone", Calendar.ZONE_OFFSET);
-
+ public static final DateFormat.Field ISO_YEAR
+ = new Field("iso year", Calendar.YEAR);
+ public static final DateFormat.Field LOCALIZED_DAY_OF_WEEK
+ = new Field("localized day of week", Calendar.DAY_OF_WEEK);
+ public static final DateFormat.Field EXTENDED_YEAR
+ = new Field("extended year", Calendar.YEAR);
+ public static final DateFormat.Field MODIFIED_JULIAN_DAY
+ = new Field("julian day", -1);
+ public static final DateFormat.Field MILLISECOND_IN_DAY
+ = new Field("millisecond in day", -1);
+ public static final DateFormat.Field RFC822_TIME_ZONE
+ = new Field("rfc822 timezone", Calendar.ZONE_OFFSET);
+
static final DateFormat.Field[] allFields =
{
ERA, YEAR, MONTH, DAY_OF_MONTH, HOUR_OF_DAY1,
HOUR_OF_DAY0, MINUTE, SECOND, MILLISECOND,
DAY_OF_WEEK, DAY_OF_YEAR, DAY_OF_WEEK_IN_MONTH,
WEEK_OF_YEAR, WEEK_OF_MONTH, AM_PM, HOUR1, HOUR0,
- TIME_ZONE
+ TIME_ZONE, ISO_YEAR, LOCALIZED_DAY_OF_WEEK,
+ EXTENDED_YEAR, MODIFIED_JULIAN_DAY, MILLISECOND_IN_DAY,
+ RFC822_TIME_ZONE
};
// For deserialization
@@ -288,7 +494,7 @@ public abstract class DateFormat extends Format implements Cloneable
* This method returns a list of available locales supported by this
* class.
*/
- public static Locale[] getAvailableLocales ()
+ public static Locale[] getAvailableLocales()
{
// FIXME
Locale[] l = new Locale[1];
diff --git a/libjava/java/text/DateFormatSymbols.java b/libjava/java/text/DateFormatSymbols.java
index b9b71ba36a7..9555cfb67bc 100644
--- a/libjava/java/text/DateFormatSymbols.java
+++ b/libjava/java/text/DateFormatSymbols.java
@@ -1,5 +1,5 @@
/* DateFormatSymbols.java -- Format over a range of numbers
- Copyright (C) 1998, 1999, 2000, 2001, 2003 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2000, 2001, 2003, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -45,7 +45,7 @@ import java.util.ResourceBundle;
/**
* This class acts as container for locale specific date/time formatting
* information such as the days of the week and the months of the year.
- * @author Per Bothner <bothner@cygnus.com>
+ * @author Per Bothner (bothner@cygnus.com)
* @date October 24, 1998.
*/
/* Written using "Java Class Libraries", 2nd edition, ISBN 0-201-31002-3.
diff --git a/libjava/java/text/DecimalFormat.java b/libjava/java/text/DecimalFormat.java
index 8b2c25cd3c3..a085875a1ae 100644
--- a/libjava/java/text/DecimalFormat.java
+++ b/libjava/java/text/DecimalFormat.java
@@ -49,7 +49,8 @@ import java.util.HashMap;
import java.util.Locale;
/**
- * @author Tom Tromey <tromey@cygnus.com>
+ * @author Tom Tromey (tromey@cygnus.com)
+ * @author Andrew John Hughes (gnu_andrew@member.fsf.org)
* @date March 4, 1999
*/
/* Written using "Java Class Libraries", 2nd edition, plus online
diff --git a/libjava/java/text/DecimalFormatSymbols.java b/libjava/java/text/DecimalFormatSymbols.java
index 7a4e56e9a42..72a132e002a 100644
--- a/libjava/java/text/DecimalFormatSymbols.java
+++ b/libjava/java/text/DecimalFormatSymbols.java
@@ -52,7 +52,7 @@ import java.util.ResourceBundle;
* normally handled automatically, but an application can override
* values as desired using this class.
*
- * @author Tom Tromey <tromey@cygnus.com>
+ * @author Tom Tromey (tromey@cygnus.com)
* @author Aaron M. Renn (arenn@urbanophile.com)
* @date February 24, 1999
*/
diff --git a/libjava/java/text/FieldPosition.java b/libjava/java/text/FieldPosition.java
index 47cf7a146f4..6dd3a626705 100644
--- a/libjava/java/text/FieldPosition.java
+++ b/libjava/java/text/FieldPosition.java
@@ -1,5 +1,5 @@
/* FieldPosition.java -- Keeps track of field positions while formatting
- Copyright (C) 1998, 1999, 2001 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2001, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -45,7 +45,7 @@ package java.text;
* typically define constant values for the field identifiers.
*
* @author Aaron M. Renn (arenn@urbanophile.com)
- * @author Per Bothner <bothner@cygnus.com>
+ * @author Per Bothner (bothner@cygnus.com)
*/
public class FieldPosition
{
diff --git a/libjava/java/text/Format.java b/libjava/java/text/Format.java
index 2c75578243c..970c7ce631f 100644
--- a/libjava/java/text/Format.java
+++ b/libjava/java/text/Format.java
@@ -1,5 +1,5 @@
/* Format.java -- Abstract superclass for formatting/parsing strings.
- Copyright (C) 1998, 1999, 2000, 2001, 2003 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2000, 2001, 2003, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -57,7 +57,7 @@ import java.io.Serializable;
* available locales in the current runtime environment.
*
* @author Aaron M. Renn (arenn@urbanophile.com)
- * @author Per Bothner <bothner@cygnus.com>
+ * @author Per Bothner (bothner@cygnus.com)
*/
public abstract class Format implements Serializable, Cloneable
{
diff --git a/libjava/java/text/MessageFormat.java b/libjava/java/text/MessageFormat.java
index 6a031bc7254..6c1b0508bda 100644
--- a/libjava/java/text/MessageFormat.java
+++ b/libjava/java/text/MessageFormat.java
@@ -46,107 +46,107 @@ import java.util.HashMap;
import java.util.Locale;
import java.util.Vector;
-/**
- * @author Tom Tromey <tromey@cygnus.com>
- * @author Jorge Aliss <jaliss@hotmail.com>
- * @date March 3, 1999
- */
-/* Written using "Java Class Libraries", 2nd edition, plus online
- * API docs for JDK 1.2 from http://www.javasoft.com.
- * Status: Believed complete and correct to 1.2, except serialization.
- * and parsing.
- */
-final class MessageFormatElement
+public class MessageFormat extends Format
{
- // Argument number.
- int argNumber;
- // Formatter to be used. This is the format set by setFormat.
- Format setFormat;
- // Formatter to be used based on the type.
- Format format;
-
- // Argument will be checked to make sure it is an instance of this
- // class.
- Class formatClass;
-
- // Formatter type.
- String type;
- // Formatter style.
- String style;
-
- // Text to follow this element.
- String trailer;
-
- // Recompute the locale-based formatter.
- void setLocale (Locale loc)
+ /**
+ * @author Tom Tromey (tromey@cygnus.com)
+ * @author Jorge Aliss (jaliss@hotmail.com)
+ * @date March 3, 1999
+ */
+ /* Written using "Java Class Libraries", 2nd edition, plus online
+ * API docs for JDK 1.2 from http://www.javasoft.com.
+ * Status: Believed complete and correct to 1.2, except serialization.
+ * and parsing.
+ */
+ private static final class MessageFormatElement
{
- if (type == null)
- ;
- else if (type.equals("number"))
- {
- formatClass = java.lang.Number.class;
-
- if (style == null)
- format = NumberFormat.getInstance(loc);
- else if (style.equals("currency"))
- format = NumberFormat.getCurrencyInstance(loc);
- else if (style.equals("percent"))
- format = NumberFormat.getPercentInstance(loc);
- else if (style.equals("integer"))
- {
- NumberFormat nf = NumberFormat.getNumberInstance(loc);
- nf.setMaximumFractionDigits(0);
- nf.setGroupingUsed(false);
- format = nf;
- }
- else
- {
- format = NumberFormat.getNumberInstance(loc);
- DecimalFormat df = (DecimalFormat) format;
- df.applyPattern(style);
- }
- }
- else if (type.equals("time") || type.equals("date"))
- {
- formatClass = java.util.Date.class;
-
- int val = DateFormat.DEFAULT;
- if (style == null)
- ;
- else if (style.equals("short"))
- val = DateFormat.SHORT;
- else if (style.equals("medium"))
- val = DateFormat.MEDIUM;
- else if (style.equals("long"))
- val = DateFormat.LONG;
- else if (style.equals("full"))
- val = DateFormat.FULL;
-
- if (type.equals("time"))
- format = DateFormat.getTimeInstance(val, loc);
- else
- format = DateFormat.getDateInstance(val, loc);
-
- if (style != null && val == DateFormat.DEFAULT)
- {
- SimpleDateFormat sdf = (SimpleDateFormat) format;
- sdf.applyPattern(style);
- }
- }
- else if (type.equals("choice"))
- {
- formatClass = java.lang.Number.class;
-
- if (style == null)
- throw new
- IllegalArgumentException ("style required for choice format");
- format = new ChoiceFormat (style);
- }
+ // Argument number.
+ int argNumber;
+ // Formatter to be used. This is the format set by setFormat.
+ Format setFormat;
+ // Formatter to be used based on the type.
+ Format format;
+
+ // Argument will be checked to make sure it is an instance of this
+ // class.
+ Class formatClass;
+
+ // Formatter type.
+ String type;
+ // Formatter style.
+ String style;
+
+ // Text to follow this element.
+ String trailer;
+
+ // Recompute the locale-based formatter.
+ void setLocale (Locale loc)
+ {
+ if (type == null)
+ ;
+ else if (type.equals("number"))
+ {
+ formatClass = java.lang.Number.class;
+
+ if (style == null)
+ format = NumberFormat.getInstance(loc);
+ else if (style.equals("currency"))
+ format = NumberFormat.getCurrencyInstance(loc);
+ else if (style.equals("percent"))
+ format = NumberFormat.getPercentInstance(loc);
+ else if (style.equals("integer"))
+ {
+ NumberFormat nf = NumberFormat.getNumberInstance(loc);
+ nf.setMaximumFractionDigits(0);
+ nf.setGroupingUsed(false);
+ format = nf;
+ }
+ else
+ {
+ format = NumberFormat.getNumberInstance(loc);
+ DecimalFormat df = (DecimalFormat) format;
+ df.applyPattern(style);
+ }
+ }
+ else if (type.equals("time") || type.equals("date"))
+ {
+ formatClass = java.util.Date.class;
+
+ int val = DateFormat.DEFAULT;
+ if (style == null)
+ ;
+ else if (style.equals("short"))
+ val = DateFormat.SHORT;
+ else if (style.equals("medium"))
+ val = DateFormat.MEDIUM;
+ else if (style.equals("long"))
+ val = DateFormat.LONG;
+ else if (style.equals("full"))
+ val = DateFormat.FULL;
+
+ if (type.equals("time"))
+ format = DateFormat.getTimeInstance(val, loc);
+ else
+ format = DateFormat.getDateInstance(val, loc);
+
+ if (style != null && val == DateFormat.DEFAULT)
+ {
+ SimpleDateFormat sdf = (SimpleDateFormat) format;
+ sdf.applyPattern(style);
+ }
+ }
+ else if (type.equals("choice"))
+ {
+ formatClass = java.lang.Number.class;
+
+ if (style == null)
+ throw new
+ IllegalArgumentException ("style required for choice format");
+ format = new ChoiceFormat (style);
+ }
+ }
}
-}
-public class MessageFormat extends Format
-{
private static final long serialVersionUID = 6479157306784022952L;
public static class Field extends Format.Field
diff --git a/libjava/java/text/NumberFormat.java b/libjava/java/text/NumberFormat.java
index 368292686bc..4fc98b15c54 100644
--- a/libjava/java/text/NumberFormat.java
+++ b/libjava/java/text/NumberFormat.java
@@ -59,7 +59,7 @@ import java.util.ResourceBundle;
* static factory methods in this class such as
* <code>getCurrencyInstance</code>.
*
- * @author Tom Tromey <tromey@cygnus.com>
+ * @author Tom Tromey (tromey@cygnus.com)
* @author Aaron M. Renn (arenn@urbanophile.com)
* @date March 4, 1999
*/
diff --git a/libjava/java/text/ParseException.java b/libjava/java/text/ParseException.java
index 20e828e18a7..13229c8c89a 100644
--- a/libjava/java/text/ParseException.java
+++ b/libjava/java/text/ParseException.java
@@ -1,5 +1,5 @@
/* ParseException.java -- an error occurred while parsing
- Copyright (C) 1998, 1999, 2001, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2001, 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -42,7 +42,7 @@ package java.text;
* This exception is thrown when an unexpected error occurs during parsing.
*
* @author Aaron M. Renn (arenn@urbanophile.com)
- * @author Per Bothner <bothner@cygnus.com>
+ * @author Per Bothner (bothner@cygnus.com)
* @see Format
* @see FieldPosition
* @status updated to 1.4
diff --git a/libjava/java/text/ParsePosition.java b/libjava/java/text/ParsePosition.java
index c6dffed8f59..91fa44fccf4 100644
--- a/libjava/java/text/ParsePosition.java
+++ b/libjava/java/text/ParsePosition.java
@@ -1,5 +1,5 @@
/* ParsePosition.java -- Keep track of position while parsing.
- Copyright (C) 1998, 1999, 2001 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2001, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -43,7 +43,7 @@ package java.text;
* operations.
*
* @author Aaron M. Renn (arenn@urbanophile.com)
- * @author Per Bothner <bothner@cygnus.com>
+ * @author Per Bothner (bothner@cygnus.com)
*/
public class ParsePosition
{
diff --git a/libjava/java/text/RuleBasedCollator.java b/libjava/java/text/RuleBasedCollator.java
index c2cff5a0c8c..afb766ff8ae 100644
--- a/libjava/java/text/RuleBasedCollator.java
+++ b/libjava/java/text/RuleBasedCollator.java
@@ -1,5 +1,5 @@
/* RuleBasedCollator.java -- Concrete Collator Class
- Copyright (C) 1998, 1999, 2000, 2001, 2003, 2004 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2000, 2001, 2003, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -435,56 +435,57 @@ main_parse_loop:
continue;
}
- switch (c) {
- case '!':
- throw new ParseException
- ("Modifier '!' is not yet supported by Classpath", i+base_offset);
- case '<':
- type = CollationSorter.GREATERP;
- break;
- case ';':
- type = CollationSorter.GREATERS;
- break;
- case ',':
- type = CollationSorter.GREATERT;
- break;
- case '=':
- type = CollationSorter.EQUAL;
- break;
- case '\'':
- eatingChars = !eatingChars;
- doubleQuote = true;
- break;
- case '@':
- if (ignoreChars)
- throw new ParseException
- ("comparison list has not yet been started. You may only use"
- + "(<,;=&)", i+base_offset);
- // Inverse the order of secondaries from now on.
- nextIsModifier = true;
- type = CollationSorter.INVERSE_SECONDARY;
- break;
- case '&':
- type = CollationSorter.RESET;
- if (stop_on_reset)
- break main_parse_loop;
- break;
- default:
- if (operator < 0)
- throw new ParseException
- ("operator missing at " + (i+base_offset), i+base_offset);
- if (!eatingChars &&
- ((c >= 0x21 && c <= 0x2F)
- || (c >= 0x3A && c <= 0x40)
- || (c >= 0x5B && c <= 0x60)
- || (c >= 0x7B && c <= 0x7E)))
+ switch (c)
+ {
+ case '!':
throw new ParseException
- ("unquoted punctuation character '"+c+"'", i+base_offset);
-
- //type = ignoreChars ? CollationSorter.IGNORE : -1;
- sb.append(c);
- break;
- }
+ ("Modifier '!' is not yet supported by Classpath", i + base_offset);
+ case '<':
+ type = CollationSorter.GREATERP;
+ break;
+ case ';':
+ type = CollationSorter.GREATERS;
+ break;
+ case ',':
+ type = CollationSorter.GREATERT;
+ break;
+ case '=':
+ type = CollationSorter.EQUAL;
+ break;
+ case '\'':
+ eatingChars = !eatingChars;
+ doubleQuote = true;
+ break;
+ case '@':
+ if (ignoreChars)
+ throw new ParseException
+ ("comparison list has not yet been started. You may only use"
+ + "(<,;=&)", i + base_offset);
+ // Inverse the order of secondaries from now on.
+ nextIsModifier = true;
+ type = CollationSorter.INVERSE_SECONDARY;
+ break;
+ case '&':
+ type = CollationSorter.RESET;
+ if (stop_on_reset)
+ break main_parse_loop;
+ break;
+ default:
+ if (operator < 0)
+ throw new ParseException
+ ("operator missing at " + (i + base_offset), i + base_offset);
+ if (! eatingChars
+ && ((c >= 0x21 && c <= 0x2F)
+ || (c >= 0x3A && c <= 0x40)
+ || (c >= 0x5B && c <= 0x60)
+ || (c >= 0x7B && c <= 0x7E)))
+ throw new ParseException
+ ("unquoted punctuation character '" + c + "'", i + base_offset);
+
+ //type = ignoreChars ? CollationSorter.IGNORE : -1;
+ sb.append(c);
+ break;
+ }
if (type < 0)
continue;
diff --git a/libjava/java/text/SimpleDateFormat.java b/libjava/java/text/SimpleDateFormat.java
index 35083eb887e..190b4d624f4 100644
--- a/libjava/java/text/SimpleDateFormat.java
+++ b/libjava/java/text/SimpleDateFormat.java
@@ -1,6 +1,6 @@
/* SimpleDateFormat.java -- A class for parsing/formating simple
date constructs
- Copyright (C) 1998, 1999, 2000, 2001, 2003, 2004
+ Copyright (C) 1998, 1999, 2000, 2001, 2003, 2004, 2005
Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -46,6 +46,7 @@ import gnu.java.text.FormatCharacterIterator;
import gnu.java.text.StringFormatBuffer;
import java.io.IOException;
+import java.io.InvalidObjectException;
import java.io.ObjectInputStream;
import java.util.ArrayList;
import java.util.Calendar;
@@ -53,8 +54,9 @@ import java.util.Date;
import java.util.GregorianCalendar;
import java.util.Iterator;
import java.util.Locale;
-import java.util.SimpleTimeZone;
import java.util.TimeZone;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
/**
* SimpleDateFormat provides convenient methods for parsing and formatting
@@ -62,34 +64,190 @@ import java.util.TimeZone;
*/
public class SimpleDateFormat extends DateFormat
{
- /** A pair class used by SimpleDateFormat as a compiled representation
- * of a format string.
+ /**
+ * This class is used by <code>SimpleDateFormat</code> as a
+ * compiled representation of a format string. The field
+ * ID, size, and character used are stored for each sequence
+ * of pattern characters.
*/
- private class FieldSizePair
+ private class CompiledField
{
- public int field;
- public int size;
+ /**
+ * The ID of the field within the local pattern characters,
+ */
+ private int field;
+
+ /**
+ * The size of the character sequence.
+ */
+ private int size;
+
+ /**
+ * The character used.
+ */
+ private char character;
- /** Constructs a pair with the given field and size values */
- public FieldSizePair(int f, int s) {
+ /**
+ * Constructs a compiled field using the
+ * the given field ID, size and character
+ * values.
+ *
+ * @param f the field ID.
+ * @param s the size of the field.
+ * @param c the character used.
+ */
+ public CompiledField(int f, int s, char c)
+ {
field = f;
size = s;
+ character = c;
+ }
+
+ /**
+ * Retrieves the ID of the field relative to
+ * the local pattern characters.
+ */
+ public int getField()
+ {
+ return field;
+ }
+
+ /**
+ * Retrieves the size of the character sequence.
+ */
+ public int getSize()
+ {
+ return size;
+ }
+
+ /**
+ * Retrieves the character used in the sequence.
+ */
+ public char getCharacter()
+ {
+ return character;
+ }
+
+ /**
+ * Returns a <code>String</code> representation
+ * of the compiled field, primarily for debugging
+ * purposes.
+ *
+ * @return a <code>String</code> representation.
+ */
+ public String toString()
+ {
+ StringBuffer builder;
+
+ builder = new StringBuffer(getClass().getName());
+ builder.append("[field=");
+ builder.append(field);
+ builder.append(", size=");
+ builder.append(size);
+ builder.append(", character=");
+ builder.append(character);
+ builder.append("]");
+
+ return builder.toString();
}
}
+ /**
+ * A list of <code>CompiledField</code>s,
+ * representing the compiled version of the pattern.
+ *
+ * @see CompiledField
+ * @serial Ignored.
+ */
private transient ArrayList tokens;
- private DateFormatSymbols formatData; // formatData
+
+ /**
+ * The localised data used in formatting,
+ * such as the day and month names in the local
+ * language, and the localized pattern characters.
+ *
+ * @see DateFormatSymbols
+ * @serial The localisation data. May not be null.
+ */
+ private DateFormatSymbols formatData;
+
+ /**
+ * The date representing the start of the century
+ * used for interpreting two digit years. For
+ * example, 24/10/2004 would cause two digit
+ * years to be interpreted as representing
+ * the years between 2004 and 2104.
+ *
+ * @see get2DigitYearStart()
+ * @see set2DigitYearStart(java.util.Date)
+ * @see Date
+ * @serial The start date of the century for parsing two digit years.
+ * May not be null.
+ */
private Date defaultCenturyStart;
+
+ /**
+ * The year at which interpretation of two
+ * digit years starts.
+ *
+ * @see get2DigitYearStart()
+ * @see set2DigitYearStart(java.util.Date)
+ * @serial Ignored.
+ */
private transient int defaultCentury;
+
+ /**
+ * The non-localized pattern string. This
+ * only ever contains the pattern characters
+ * stored in standardChars. Localized patterns
+ * are translated to this form.
+ *
+ * @see applyPattern(String)
+ * @see applyLocalizedPattern(String)
+ * @see toPattern()
+ * @see toLocalizedPattern()
+ * @serial The non-localized pattern string. May not be null.
+ */
private String pattern;
+
+ /**
+ * The version of serialized data used by this class.
+ * Version 0 only includes the pattern and formatting
+ * data. Version 1 adds the start date for interpreting
+ * two digit years.
+ *
+ * @serial This specifies the version of the data being serialized.
+ * Version 0 (or no version) specifies just <code>pattern</code>
+ * and <code>formatData</code>. Version 1 adds
+ * the <code>defaultCenturyStart</code>. This implementation
+ * always writes out version 1 data.
+ */
private int serialVersionOnStream = 1; // 0 indicates JDK1.1.3 or earlier
+
+ /**
+ * For compatability.
+ */
private static final long serialVersionUID = 4774881970558875024L;
- // This string is specified in the JCL. We set it here rather than
- // do a DateFormatSymbols(Locale.US).getLocalPatternChars() since
- // someone could theoretically change those values (though unlikely).
- private static final String standardChars = "GyMdkHmsSEDFwWahKzZ";
+ // This string is specified in the root of the CLDR. We set it here
+ // rather than doing a DateFormatSymbols(Locale.US).getLocalPatternChars()
+ // since someone could theoretically change those values (though unlikely).
+ private static final String standardChars = "GyMdkHmsSEDFwWahKzYeugAZ";
+ /**
+ * Reads the serialized version of this object.
+ * If the serialized data is only version 0,
+ * then the date for the start of the century
+ * for interpreting two digit years is computed.
+ * The pattern is parsed and compiled following the process
+ * of reading in the serialized data.
+ *
+ * @param stream the object stream to read the data from.
+ * @throws IOException if an I/O error occurs.
+ * @throws ClassNotFoundException if the class of the serialized data
+ * could not be found.
+ * @throws InvalidObjectException if the pattern is invalid.
+ */
private void readObject(ObjectInputStream stream)
throws IOException, ClassNotFoundException
{
@@ -105,9 +263,25 @@ public class SimpleDateFormat extends DateFormat
// Set up items normally taken care of by the constructor.
tokens = new ArrayList();
- compileFormat(pattern);
+ try
+ {
+ compileFormat(pattern);
+ }
+ catch (IllegalArgumentException e)
+ {
+ throw new InvalidObjectException("The stream pattern was invalid.");
+ }
}
+ /**
+ * Compiles the supplied non-localized pattern into a form
+ * from which formatting and parsing can be performed.
+ * This also detects errors in the pattern, which will
+ * be raised on later use of the compiled data.
+ *
+ * @param pattern the non-localized pattern to compile.
+ * @throws IllegalArgumentException if the pattern is invalid.
+ */
private void compileFormat(String pattern)
{
// Any alphabetical characters are treated as pattern characters
@@ -116,24 +290,25 @@ public class SimpleDateFormat extends DateFormat
char thisChar;
int pos;
int field;
- FieldSizePair current = null;
+ CompiledField current = null;
for (int i=0; i<pattern.length(); i++) {
thisChar = pattern.charAt(i);
- field = formatData.getLocalPatternChars().indexOf(thisChar);
+ field = standardChars.indexOf(thisChar);
if (field == -1) {
current = null;
if ((thisChar >= 'A' && thisChar <= 'Z')
|| (thisChar >= 'a' && thisChar <= 'z')) {
- // Not a valid letter
- tokens.add(new FieldSizePair(-1,0));
+ // Not a valid letter
+ throw new IllegalArgumentException("Invalid letter " + thisChar +
+ "encountered at character " + i
+ + ".");
} else if (thisChar == '\'') {
// Quoted text section; skip to next single quote
pos = pattern.indexOf('\'',i+1);
if (pos == -1) {
- // This ought to be an exception, but spec does not
- // let us throw one.
- tokens.add(new FieldSizePair(-1,0));
+ throw new IllegalArgumentException("Quotes starting at character "
+ + i + " not closed.");
}
if ((pos+1 < pattern.length()) && (pattern.charAt(pos+1) == '\'')) {
tokens.add(pattern.substring(i+1,pos+1));
@@ -150,20 +325,38 @@ public class SimpleDateFormat extends DateFormat
if ((current != null) && (field == current.field)) {
current.size++;
} else {
- current = new FieldSizePair(field,1);
+ current = new CompiledField(field,1,thisChar);
tokens.add(current);
}
}
}
}
+ /**
+ * Returns a string representation of this
+ * class.
+ *
+ * @return a string representation of the <code>SimpleDateFormat</code>
+ * instance.
+ */
public String toString()
{
- StringBuffer output = new StringBuffer();
- Iterator i = tokens.iterator();
- while (i.hasNext()) {
- output.append(i.next().toString());
- }
+ StringBuffer output = new StringBuffer(getClass().getName());
+ output.append("[tokens=");
+ output.append(tokens);
+ output.append(", formatData=");
+ output.append(formatData);
+ output.append(", defaultCenturyStart=");
+ output.append(defaultCenturyStart);
+ output.append(", defaultCentury=");
+ output.append(defaultCentury);
+ output.append(", pattern=");
+ output.append(pattern);
+ output.append(", serialVersionOnStream=");
+ output.append(serialVersionOnStream);
+ output.append(", standardChars=");
+ output.append(standardChars);
+ output.append("]");
return output.toString();
}
@@ -194,8 +387,12 @@ public class SimpleDateFormat extends DateFormat
}
/**
- * Creates a date formatter using the specified pattern, with the default
- * DateFormatSymbols for the default locale.
+ * Creates a date formatter using the specified non-localized pattern,
+ * with the default DateFormatSymbols for the default locale.
+ *
+ * @param pattern the pattern to use.
+ * @throws NullPointerException if the pattern is null.
+ * @throws IllegalArgumentException if the pattern is invalid.
*/
public SimpleDateFormat(String pattern)
{
@@ -203,8 +400,13 @@ public class SimpleDateFormat extends DateFormat
}
/**
- * Creates a date formatter using the specified pattern, with the default
- * DateFormatSymbols for the given locale.
+ * Creates a date formatter using the specified non-localized pattern,
+ * with the default DateFormatSymbols for the given locale.
+ *
+ * @param pattern the non-localized pattern to use.
+ * @param locale the locale to use for the formatting symbols.
+ * @throws NullPointerException if the pattern is null.
+ * @throws IllegalArgumentException if the pattern is invalid.
*/
public SimpleDateFormat(String pattern, Locale locale)
{
@@ -222,8 +424,14 @@ public class SimpleDateFormat extends DateFormat
}
/**
- * Creates a date formatter using the specified pattern. The
- * specified DateFormatSymbols will be used when formatting.
+ * Creates a date formatter using the specified non-localized
+ * pattern. The specified DateFormatSymbols will be used when
+ * formatting.
+ *
+ * @param pattern the non-localized pattern to use.
+ * @param formatData the formatting symbols to use.
+ * @throws NullPointerException if the pattern or formatData is null.
+ * @throws IllegalArgumentException if the pattern is invalid.
*/
public SimpleDateFormat(String pattern, DateFormatSymbols formatData)
{
@@ -231,6 +439,8 @@ public class SimpleDateFormat extends DateFormat
calendar = new GregorianCalendar();
computeCenturyStart ();
tokens = new ArrayList();
+ if (formatData == null)
+ throw new NullPointerException("formatData");
this.formatData = formatData;
compileFormat(pattern);
this.pattern = pattern;
@@ -240,9 +450,6 @@ public class SimpleDateFormat extends DateFormat
numberFormat.setMaximumFractionDigits (0);
}
- // What is the difference between localized and unlocalized? The
- // docs don't say.
-
/**
* This method returns a string with the formatting pattern being used
* by this object. This string is unlocalized.
@@ -263,7 +470,7 @@ public class SimpleDateFormat extends DateFormat
public String toLocalizedPattern()
{
String localChars = formatData.getLocalPatternChars();
- return applyLocalizedPattern (pattern, standardChars, localChars);
+ return translateLocalizedPattern(pattern, standardChars, localChars);
}
/**
@@ -271,6 +478,8 @@ public class SimpleDateFormat extends DateFormat
* object. This string is not localized.
*
* @param pattern The new format pattern.
+ * @throws NullPointerException if the pattern is null.
+ * @throws IllegalArgumentException if the pattern is invalid.
*/
public void applyPattern(String pattern)
{
@@ -284,16 +493,34 @@ public class SimpleDateFormat extends DateFormat
* object. This string is localized.
*
* @param pattern The new format pattern.
+ * @throws NullPointerException if the pattern is null.
+ * @throws IllegalArgumentException if the pattern is invalid.
*/
public void applyLocalizedPattern(String pattern)
{
String localChars = formatData.getLocalPatternChars();
- pattern = applyLocalizedPattern (pattern, localChars, standardChars);
+ pattern = translateLocalizedPattern(pattern, localChars, standardChars);
applyPattern(pattern);
}
- private String applyLocalizedPattern(String pattern,
- String oldChars, String newChars)
+ /**
+ * Translates either from or to a localized variant of the pattern
+ * string. For example, in the German locale, 't' (for 'tag') is
+ * used instead of 'd' (for 'date'). This method translates
+ * a localized pattern (such as 'ttt') to a non-localized pattern
+ * (such as 'ddd'), or vice versa. Non-localized patterns use
+ * a standard set of characters, which match those of the U.S. English
+ * locale.
+ *
+ * @param pattern the pattern to translate.
+ * @param oldChars the old set of characters (used in the pattern).
+ * @param newChars the new set of characters (which will be used in the
+ * pattern).
+ * @return a version of the pattern using the characters in
+ * <code>newChars</code>.
+ */
+ private String translateLocalizedPattern(String pattern,
+ String oldChars, String newChars)
{
int len = pattern.length();
StringBuffer buf = new StringBuffer(len);
@@ -341,14 +568,14 @@ public class SimpleDateFormat extends DateFormat
}
/**
- * This method returns the format symbol information used for parsing
- * and formatting dates.
+ * This method returns a copy of the format symbol information used
+ * for parsing and formatting dates.
*
- * @return The date format symbols.
+ * @return a copy of the date format symbols.
*/
public DateFormatSymbols getDateFormatSymbols()
{
- return formatData;
+ return (DateFormatSymbols) formatData.clone();
}
/**
@@ -356,9 +583,15 @@ public class SimpleDateFormat extends DateFormat
* and formatting dates.
*
* @param formatData The date format symbols.
+ * @throws NullPointerException if <code>formatData</code> is null.
*/
public void setDateFormatSymbols(DateFormatSymbols formatData)
{
+ if (formatData == null)
+ {
+ throw new
+ NullPointerException("The supplied format data was null.");
+ }
this.formatData = formatData;
}
@@ -431,12 +664,12 @@ public class SimpleDateFormat extends DateFormat
while (iter.hasNext())
{
Object o = iter.next();
- if (o instanceof FieldSizePair)
+ if (o instanceof CompiledField)
{
- FieldSizePair p = (FieldSizePair) o;
+ CompiledField cf = (CompiledField) o;
int beginIndex = buffer.length();
- switch (p.field)
+ switch (cf.getField())
{
case ERA_FIELD:
buffer.append (formatData.eras[calendar.get (Calendar.ERA)], DateFormat.Field.ERA);
@@ -445,75 +678,75 @@ public class SimpleDateFormat extends DateFormat
// If we have two digits, then we truncate. Otherwise, we
// use the size of the pattern, and zero pad.
buffer.setDefaultAttribute (DateFormat.Field.YEAR);
- if (p.size == 2)
+ if (cf.getSize() == 2)
{
temp = String.valueOf (calendar.get (Calendar.YEAR));
buffer.append (temp.substring (temp.length() - 2));
}
else
- withLeadingZeros (calendar.get (Calendar.YEAR), p.size, buffer);
+ withLeadingZeros (calendar.get (Calendar.YEAR), cf.getSize(), buffer);
break;
case MONTH_FIELD:
buffer.setDefaultAttribute (DateFormat.Field.MONTH);
- if (p.size < 3)
- withLeadingZeros (calendar.get (Calendar.MONTH) + 1, p.size, buffer);
- else if (p.size < 4)
+ if (cf.getSize() < 3)
+ withLeadingZeros (calendar.get (Calendar.MONTH) + 1, cf.getSize(), buffer);
+ else if (cf.getSize() < 4)
buffer.append (formatData.shortMonths[calendar.get (Calendar.MONTH)]);
else
buffer.append (formatData.months[calendar.get (Calendar.MONTH)]);
break;
case DATE_FIELD:
buffer.setDefaultAttribute (DateFormat.Field.DAY_OF_MONTH);
- withLeadingZeros (calendar.get (Calendar.DATE), p.size, buffer);
+ withLeadingZeros (calendar.get (Calendar.DATE), cf.getSize(), buffer);
break;
case HOUR_OF_DAY1_FIELD: // 1-24
buffer.setDefaultAttribute(DateFormat.Field.HOUR_OF_DAY1);
withLeadingZeros ( ((calendar.get (Calendar.HOUR_OF_DAY) + 23) % 24) + 1,
- p.size, buffer);
+ cf.getSize(), buffer);
break;
case HOUR_OF_DAY0_FIELD: // 0-23
buffer.setDefaultAttribute (DateFormat.Field.HOUR_OF_DAY0);
- withLeadingZeros (calendar.get (Calendar.HOUR_OF_DAY), p.size, buffer);
+ withLeadingZeros (calendar.get (Calendar.HOUR_OF_DAY), cf.getSize(), buffer);
break;
case MINUTE_FIELD:
buffer.setDefaultAttribute (DateFormat.Field.MINUTE);
withLeadingZeros (calendar.get (Calendar.MINUTE),
- p.size, buffer);
+ cf.getSize(), buffer);
break;
case SECOND_FIELD:
buffer.setDefaultAttribute (DateFormat.Field.SECOND);
withLeadingZeros(calendar.get (Calendar.SECOND),
- p.size, buffer);
+ cf.getSize(), buffer);
break;
case MILLISECOND_FIELD:
buffer.setDefaultAttribute (DateFormat.Field.MILLISECOND);
- withLeadingZeros (calendar.get (Calendar.MILLISECOND), p.size, buffer);
+ withLeadingZeros (calendar.get (Calendar.MILLISECOND), cf.getSize(), buffer);
break;
case DAY_OF_WEEK_FIELD:
buffer.setDefaultAttribute (DateFormat.Field.DAY_OF_WEEK);
- if (p.size < 4)
+ if (cf.getSize() < 4)
buffer.append (formatData.shortWeekdays[calendar.get (Calendar.DAY_OF_WEEK)]);
else
buffer.append (formatData.weekdays[calendar.get (Calendar.DAY_OF_WEEK)]);
break;
case DAY_OF_YEAR_FIELD:
buffer.setDefaultAttribute (DateFormat.Field.DAY_OF_YEAR);
- withLeadingZeros (calendar.get (Calendar.DAY_OF_YEAR), p.size, buffer);
+ withLeadingZeros (calendar.get (Calendar.DAY_OF_YEAR), cf.getSize(), buffer);
break;
case DAY_OF_WEEK_IN_MONTH_FIELD:
buffer.setDefaultAttribute (DateFormat.Field.DAY_OF_WEEK_IN_MONTH);
withLeadingZeros (calendar.get (Calendar.DAY_OF_WEEK_IN_MONTH),
- p.size, buffer);
+ cf.getSize(), buffer);
break;
case WEEK_OF_YEAR_FIELD:
buffer.setDefaultAttribute (DateFormat.Field.WEEK_OF_YEAR);
withLeadingZeros (calendar.get (Calendar.WEEK_OF_YEAR),
- p.size, buffer);
+ cf.getSize(), buffer);
break;
case WEEK_OF_MONTH_FIELD:
buffer.setDefaultAttribute (DateFormat.Field.WEEK_OF_MONTH);
withLeadingZeros (calendar.get (Calendar.WEEK_OF_MONTH),
- p.size, buffer);
+ cf.getSize(), buffer);
break;
case AM_PM_FIELD:
buffer.setDefaultAttribute (DateFormat.Field.AM_PM);
@@ -521,25 +754,39 @@ public class SimpleDateFormat extends DateFormat
break;
case HOUR1_FIELD: // 1-12
buffer.setDefaultAttribute (DateFormat.Field.HOUR1);
- withLeadingZeros (((calendar.get (Calendar.HOUR) + 11) % 12) + 1, p.size, buffer);
+ withLeadingZeros (((calendar.get (Calendar.HOUR) + 11) % 12) + 1,
+ cf.getSize(), buffer);
break;
case HOUR0_FIELD: // 0-11
buffer.setDefaultAttribute (DateFormat.Field.HOUR0);
- withLeadingZeros (calendar.get (Calendar.HOUR), p.size, buffer);
+ withLeadingZeros (calendar.get (Calendar.HOUR), cf.getSize(), buffer);
break;
case TIMEZONE_FIELD:
buffer.setDefaultAttribute (DateFormat.Field.TIME_ZONE);
TimeZone zone = calendar.getTimeZone();
boolean isDST = calendar.get (Calendar.DST_OFFSET) != 0;
// FIXME: XXX: This should be a localized time zone.
- String zoneID = zone.getDisplayName (isDST, p.size > 3 ? TimeZone.LONG : TimeZone.SHORT);
+ String zoneID = zone.getDisplayName
+ (isDST, cf.getSize() > 3 ? TimeZone.LONG : TimeZone.SHORT);
buffer.append (zoneID);
break;
+ case RFC822_TIMEZONE_FIELD:
+ buffer.setDefaultAttribute(DateFormat.Field.RFC822_TIME_ZONE);
+ int pureMinutes = (calendar.get(Calendar.ZONE_OFFSET) +
+ calendar.get(Calendar.DST_OFFSET)) / (1000 * 60);
+ String sign = (pureMinutes < 0) ? "-" : "+";
+ int hours = pureMinutes / 60;
+ int minutes = pureMinutes % 60;
+ buffer.append(sign);
+ withLeadingZeros(hours, 2, buffer);
+ withLeadingZeros(minutes, 2, buffer);
+ break;
default:
- throw new IllegalArgumentException ("Illegal pattern character " + p.field);
+ throw new IllegalArgumentException ("Illegal pattern character " +
+ cf.getCharacter());
}
if (pos != null && (buffer.getDefaultAttribute() == pos.getFieldAttribute()
- || p.field == pos.getField()))
+ || cf.getField() == pos.getField()))
{
pos.setBeginIndex(beginIndex);
pos.setEndIndex(buffer.length());
@@ -614,232 +861,277 @@ public class SimpleDateFormat extends DateFormat
boolean saw_timezone = false;
int quote_start = -1;
boolean is2DigitYear = false;
- for (; fmt_index < fmt_max; ++fmt_index)
+ try
{
- char ch = pattern.charAt(fmt_index);
- if (ch == '\'')
+ for (; fmt_index < fmt_max; ++fmt_index)
{
- int index = pos.getIndex();
- if (fmt_index < fmt_max - 1
- && pattern.charAt(fmt_index + 1) == '\'')
+ char ch = pattern.charAt(fmt_index);
+ if (ch == '\'')
+ {
+ int index = pos.getIndex();
+ if (fmt_index < fmt_max - 1
+ && pattern.charAt(fmt_index + 1) == '\'')
+ {
+ if (! expect (dateStr, pos, ch))
+ return null;
+ ++fmt_index;
+ }
+ else
+ quote_start = quote_start < 0 ? fmt_index : -1;
+ continue;
+ }
+
+ if (quote_start != -1
+ || ((ch < 'a' || ch > 'z')
+ && (ch < 'A' || ch > 'Z')))
{
if (! expect (dateStr, pos, ch))
return null;
- ++fmt_index;
+ continue;
}
- else
- quote_start = quote_start < 0 ? fmt_index : -1;
- continue;
- }
-
- if (quote_start != -1
- || ((ch < 'a' || ch > 'z')
- && (ch < 'A' || ch > 'Z')))
- {
- if (! expect (dateStr, pos, ch))
- return null;
- continue;
- }
-
- // We've arrived at a potential pattern character in the
- // pattern.
- int first = fmt_index;
- while (++fmt_index < fmt_max && pattern.charAt(fmt_index) == ch)
- ;
- int fmt_count = fmt_index - first;
-
- // We might need to limit the number of digits to parse in
- // some cases. We look to the next pattern character to
- // decide.
- boolean limit_digits = false;
- if (fmt_index < fmt_max
- && standardChars.indexOf(pattern.charAt(fmt_index)) >= 0)
- limit_digits = true;
- --fmt_index;
-
- // We can handle most fields automatically: most either are
- // numeric or are looked up in a string vector. In some cases
- // we need an offset. When numeric, `offset' is added to the
- // resulting value. When doing a string lookup, offset is the
- // initial index into the string array.
- int calendar_field;
- boolean is_numeric = true;
- String[] match = null;
- int offset = 0;
- boolean maybe2DigitYear = false;
- switch (ch)
- {
- case 'd':
- calendar_field = Calendar.DATE;
- break;
- case 'D':
- calendar_field = Calendar.DAY_OF_YEAR;
- break;
- case 'F':
- calendar_field = Calendar.DAY_OF_WEEK_IN_MONTH;
- break;
- case 'E':
- is_numeric = false;
- offset = 1;
- calendar_field = Calendar.DAY_OF_WEEK;
- match = (fmt_count <= 3
- ? formatData.getShortWeekdays()
- : formatData.getWeekdays());
- break;
- case 'w':
- calendar_field = Calendar.WEEK_OF_YEAR;
- break;
- case 'W':
- calendar_field = Calendar.WEEK_OF_MONTH;
- break;
- case 'M':
- calendar_field = Calendar.MONTH;
- if (fmt_count <= 2)
- offset = -1;
- else
+
+ // We've arrived at a potential pattern character in the
+ // pattern.
+ int fmt_count = 1;
+ while (++fmt_index < fmt_max && pattern.charAt(fmt_index) == ch)
{
- is_numeric = false;
- match = (fmt_count <= 3
- ? formatData.getShortMonths()
- : formatData.getMonths());
+ ++fmt_count;
}
- break;
- case 'y':
- calendar_field = Calendar.YEAR;
- if (fmt_count <= 2)
- maybe2DigitYear = true;
- break;
- case 'K':
- calendar_field = Calendar.HOUR;
- break;
- case 'h':
- calendar_field = Calendar.HOUR;
- break;
- case 'H':
- calendar_field = Calendar.HOUR_OF_DAY;
- break;
- case 'k':
- calendar_field = Calendar.HOUR_OF_DAY;
- break;
- case 'm':
- calendar_field = Calendar.MINUTE;
- break;
- case 's':
- calendar_field = Calendar.SECOND;
- break;
- case 'S':
- calendar_field = Calendar.MILLISECOND;
- break;
- case 'a':
- is_numeric = false;
- calendar_field = Calendar.AM_PM;
- match = formatData.getAmPmStrings();
- break;
- case 'z':
- // We need a special case for the timezone, because it
- // uses a different data structure than the other cases.
- is_numeric = false;
- calendar_field = Calendar.DST_OFFSET;
- String[][] zoneStrings = formatData.getZoneStrings();
- int zoneCount = zoneStrings.length;
- int index = pos.getIndex();
- boolean found_zone = false;
- for (int j = 0; j < zoneCount; j++)
+
+ // We might need to limit the number of digits to parse in
+ // some cases. We look to the next pattern character to
+ // decide.
+ boolean limit_digits = false;
+ if (fmt_index < fmt_max
+ && standardChars.indexOf(pattern.charAt(fmt_index)) >= 0)
+ limit_digits = true;
+ --fmt_index;
+
+ // We can handle most fields automatically: most either are
+ // numeric or are looked up in a string vector. In some cases
+ // we need an offset. When numeric, `offset' is added to the
+ // resulting value. When doing a string lookup, offset is the
+ // initial index into the string array.
+ int calendar_field;
+ boolean is_numeric = true;
+ int offset = 0;
+ boolean maybe2DigitYear = false;
+ boolean oneBasedHour = false;
+ boolean oneBasedHourOfDay = false;
+ Integer simpleOffset;
+ String[] set1 = null;
+ String[] set2 = null;
+ switch (ch)
{
- String[] strings = zoneStrings[j];
- int k;
- for (k = 1; k < strings.length; ++k)
+ case 'd':
+ calendar_field = Calendar.DATE;
+ break;
+ case 'D':
+ calendar_field = Calendar.DAY_OF_YEAR;
+ break;
+ case 'F':
+ calendar_field = Calendar.DAY_OF_WEEK_IN_MONTH;
+ break;
+ case 'E':
+ is_numeric = false;
+ offset = 1;
+ calendar_field = Calendar.DAY_OF_WEEK;
+ set1 = formatData.getWeekdays();
+ set2 = formatData.getShortWeekdays();
+ break;
+ case 'w':
+ calendar_field = Calendar.WEEK_OF_YEAR;
+ break;
+ case 'W':
+ calendar_field = Calendar.WEEK_OF_MONTH;
+ break;
+ case 'M':
+ calendar_field = Calendar.MONTH;
+ if (fmt_count <= 2)
+ offset = -1;
+ else
{
- if (dateStr.startsWith(strings[k], index))
- break;
+ is_numeric = false;
+ set1 = formatData.getMonths();
+ set2 = formatData.getShortMonths();
}
- if (k != strings.length)
+ break;
+ case 'y':
+ calendar_field = Calendar.YEAR;
+ if (fmt_count <= 2)
+ maybe2DigitYear = true;
+ break;
+ case 'K':
+ calendar_field = Calendar.HOUR;
+ break;
+ case 'h':
+ calendar_field = Calendar.HOUR;
+ oneBasedHour = true;
+ break;
+ case 'H':
+ calendar_field = Calendar.HOUR_OF_DAY;
+ break;
+ case 'k':
+ calendar_field = Calendar.HOUR_OF_DAY;
+ oneBasedHourOfDay = true;
+ break;
+ case 'm':
+ calendar_field = Calendar.MINUTE;
+ break;
+ case 's':
+ calendar_field = Calendar.SECOND;
+ break;
+ case 'S':
+ calendar_field = Calendar.MILLISECOND;
+ break;
+ case 'a':
+ is_numeric = false;
+ calendar_field = Calendar.AM_PM;
+ set1 = formatData.getAmPmStrings();
+ break;
+ case 'z':
+ case 'Z':
+ // We need a special case for the timezone, because it
+ // uses a different data structure than the other cases.
+ is_numeric = false;
+ calendar_field = Calendar.ZONE_OFFSET;
+ String[][] zoneStrings = formatData.getZoneStrings();
+ int zoneCount = zoneStrings.length;
+ int index = pos.getIndex();
+ boolean found_zone = false;
+ simpleOffset = computeOffset(dateStr.substring(index));
+ if (simpleOffset != null)
{
found_zone = true;
saw_timezone = true;
- TimeZone tz = TimeZone.getTimeZone (strings[0]);
- calendar.set (Calendar.ZONE_OFFSET, tz.getRawOffset ());
- offset = 0;
- if (k > 2 && tz instanceof SimpleTimeZone)
+ calendar.set(Calendar.DST_OFFSET, 0);
+ offset = simpleOffset.intValue();
+ }
+ else
+ {
+ for (int j = 0; j < zoneCount; j++)
{
- SimpleTimeZone stz = (SimpleTimeZone) tz;
- offset = stz.getDSTSavings ();
+ String[] strings = zoneStrings[j];
+ int k;
+ for (k = 0; k < strings.length; ++k)
+ {
+ if (dateStr.startsWith(strings[k], index))
+ break;
+ }
+ if (k != strings.length)
+ {
+ found_zone = true;
+ saw_timezone = true;
+ TimeZone tz = TimeZone.getTimeZone (strings[0]);
+ // Check if it's a DST zone or ordinary
+ if(k == 3 || k == 4)
+ calendar.set (Calendar.DST_OFFSET, tz.getDSTSavings());
+ else
+ calendar.set (Calendar.DST_OFFSET, 0);
+ offset = tz.getRawOffset ();
+ pos.setIndex(index + strings[k].length());
+ break;
+ }
}
- pos.setIndex(index + strings[k].length());
- break;
}
- }
- if (! found_zone)
- {
+ if (! found_zone)
+ {
+ pos.setErrorIndex(pos.getIndex());
+ return null;
+ }
+ break;
+ default:
pos.setErrorIndex(pos.getIndex());
return null;
}
- break;
- default:
- pos.setErrorIndex(pos.getIndex());
- return null;
- }
-
- // Compute the value we should assign to the field.
- int value;
- int index = -1;
- if (is_numeric)
- {
- numberFormat.setMinimumIntegerDigits(fmt_count);
- if (limit_digits)
- numberFormat.setMaximumIntegerDigits(fmt_count);
- if (maybe2DigitYear)
- index = pos.getIndex();
- Number n = numberFormat.parse(dateStr, pos);
- if (pos == null || ! (n instanceof Long))
- return null;
- value = n.intValue() + offset;
- }
- else if (match != null)
- {
- index = pos.getIndex();
- int i;
- for (i = offset; i < match.length; ++i)
+
+ // Compute the value we should assign to the field.
+ int value;
+ int index = -1;
+ if (is_numeric)
{
- if (dateStr.startsWith(match[i], index))
- break;
+ numberFormat.setMinimumIntegerDigits(fmt_count);
+ if (limit_digits)
+ numberFormat.setMaximumIntegerDigits(fmt_count);
+ if (maybe2DigitYear)
+ index = pos.getIndex();
+ Number n = numberFormat.parse(dateStr, pos);
+ if (pos == null || ! (n instanceof Long))
+ return null;
+ value = n.intValue() + offset;
}
- if (i == match.length)
+ else if (set1 != null)
{
- pos.setErrorIndex(index);
- return null;
+ index = pos.getIndex();
+ int i;
+ boolean found = false;
+ for (i = offset; i < set1.length; ++i)
+ {
+ if (set1[i] != null)
+ if (dateStr.toUpperCase().startsWith(set1[i].toUpperCase(),
+ index))
+ {
+ found = true;
+ pos.setIndex(index + set1[i].length());
+ break;
+ }
+ }
+ if (!found && set2 != null)
+ {
+ for (i = offset; i < set2.length; ++i)
+ {
+ if (set2[i] != null)
+ if (dateStr.toUpperCase().startsWith(set2[i].toUpperCase(),
+ index))
+ {
+ found = true;
+ pos.setIndex(index + set2[i].length());
+ break;
+ }
+ }
+ }
+ if (!found)
+ {
+ pos.setErrorIndex(index);
+ return null;
+ }
+ value = i;
}
- pos.setIndex(index + match[i].length());
- value = i;
- }
- else
- value = offset;
+ else
+ value = offset;
- if (maybe2DigitYear)
- {
- // Parse into default century if the numeric year string has
- // exactly 2 digits.
- int digit_count = pos.getIndex() - index;
- if (digit_count == 2)
- is2DigitYear = true;
- }
+ if (maybe2DigitYear)
+ {
+ // Parse into default century if the numeric year string has
+ // exactly 2 digits.
+ int digit_count = pos.getIndex() - index;
+ if (digit_count == 2)
+ {
+ is2DigitYear = true;
+ value += defaultCentury;
+ }
+ }
+
+ // Calendar uses 0-based hours.
+ // I.e. 00:00 AM is midnight, not 12 AM or 24:00
+ if (oneBasedHour && value == 12)
+ value = 0;
- // Assign the value and move on.
- calendar.set(calendar_field, value);
- }
+ if (oneBasedHourOfDay && value == 24)
+ value = 0;
+
+ // Assign the value and move on.
+ calendar.set(calendar_field, value);
+ }
- if (is2DigitYear)
- {
- // Apply the 80-20 heuristic to dermine the full year based on
- // defaultCenturyStart.
- int year = defaultCentury + calendar.get(Calendar.YEAR);
- calendar.set(Calendar.YEAR, year);
- if (calendar.getTime().compareTo(defaultCenturyStart) < 0)
- calendar.set(Calendar.YEAR, year + 100);
- }
-
- try
- {
+ if (is2DigitYear)
+ {
+ // Apply the 80-20 heuristic to dermine the full year based on
+ // defaultCenturyStart.
+ int year = calendar.get(Calendar.YEAR);
+ if (calendar.getTime().compareTo(defaultCenturyStart) < 0)
+ calendar.set(Calendar.YEAR, year + 100);
+ }
if (! saw_timezone)
{
// Use the real rules to determine whether or not this
@@ -854,6 +1146,69 @@ public class SimpleDateFormat extends DateFormat
pos.setErrorIndex(pos.getIndex());
return null;
}
+ }
+
+ /**
+ * <p>
+ * Computes the time zone offset in milliseconds
+ * relative to GMT, based on the supplied
+ * <code>String</code> representation.
+ * </p>
+ * <p>
+ * The supplied <code>String</code> must be a three
+ * or four digit signed number, with an optional 'GMT'
+ * prefix. The first one or two digits represents the hours,
+ * while the last two represent the minutes. The
+ * two sets of digits can optionally be separated by
+ * ':'. The mandatory sign prefix (either '+' or '-')
+ * indicates the direction of the offset from GMT.
+ * </p>
+ * <p>
+ * For example, 'GMT+0200' specifies 2 hours after
+ * GMT, while '-05:00' specifies 5 hours prior to
+ * GMT. The special case of 'GMT' alone can be used
+ * to represent the offset, 0.
+ * </p>
+ * <p>
+ * If the <code>String</code> can not be parsed,
+ * the result will be null. The resulting offset
+ * is wrapped in an <code>Integer</code> object, in
+ * order to allow such failure to be represented.
+ * </p>
+ *
+ * @param zoneString a string in the form
+ * (GMT)? sign hours : minutes
+ * where sign = '+' or '-', hours
+ * is a one or two digits representing
+ * a number between 0 and 23, and
+ * minutes is two digits representing
+ * a number between 0 and 59.
+ * @return the parsed offset, or null if parsing
+ * failed.
+ */
+ private Integer computeOffset(String zoneString)
+ {
+ Pattern pattern =
+ Pattern.compile("(GMT)?([+-])([012])?([0-9]):?([0-9]{2})");
+ Matcher matcher = pattern.matcher(zoneString);
+ if (matcher.matches())
+ {
+ int sign = matcher.group(2).equals("+") ? 1 : -1;
+ int hour = (Integer.parseInt(matcher.group(3)) * 10)
+ + Integer.parseInt(matcher.group(4));
+ int minutes = Integer.parseInt(matcher.group(5));
+
+ if (hour > 23)
+ return null;
+
+ int offset = sign * ((hour * 60) + minutes) * 60000;
+ return new Integer(offset);
+ }
+ else if (zoneString.startsWith("GMT"))
+ {
+ return new Integer(0);
+ }
+ return null;
}
// Compute the start of the current century as defined by
@@ -864,4 +1219,19 @@ public class SimpleDateFormat extends DateFormat
calendar.set(Calendar.YEAR, year - 80);
set2DigitYearStart(calendar.getTime());
}
+
+ /**
+ * Returns a copy of this instance of
+ * <code>SimpleDateFormat</code>. The copy contains
+ * clones of the formatting symbols and the 2-digit
+ * year century start date.
+ */
+ public Object clone()
+ {
+ SimpleDateFormat clone = (SimpleDateFormat) super.clone();
+ clone.setDateFormatSymbols((DateFormatSymbols) formatData.clone());
+ clone.set2DigitYearStart((Date) defaultCenturyStart.clone());
+ return clone;
+ }
+
}
diff --git a/libjava/java/text/StringCharacterIterator.java b/libjava/java/text/StringCharacterIterator.java
index 44bac6b74a3..82df7c44992 100644
--- a/libjava/java/text/StringCharacterIterator.java
+++ b/libjava/java/text/StringCharacterIterator.java
@@ -1,5 +1,5 @@
/* StringCharacterIterator.java -- Iterate over a character range in a string
- Copyright (C) 1998, 1999, 2001 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2001, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -46,7 +46,7 @@ package java.text;
* the index to be set.
*
* @author Aaron M. Renn (arenn@urbanophile.com)
- * @author Tom Tromey <tromey@cygnus.com>
+ * @author Tom Tromey (tromey@cygnus.com)
*/
public final class StringCharacterIterator implements CharacterIterator
{
diff --git a/libjava/java/util/AbstractCollection.java b/libjava/java/util/AbstractCollection.java
index a98f41efbea..567380c1a9d 100644
--- a/libjava/java/util/AbstractCollection.java
+++ b/libjava/java/util/AbstractCollection.java
@@ -1,5 +1,5 @@
/* AbstractCollection.java -- Abstract implementation of most of Collection
- Copyright (C) 1998, 2000, 2001 Free Software Foundation, Inc.
+ Copyright (C) 1998, 2000, 2001, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -61,7 +61,7 @@ import java.lang.reflect.Array;
*
* @author Original author unknown
* @author Bryce McKinlay
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Eric Blake (ebb9@email.byu.edu)
* @see Collection
* @see AbstractSet
* @see AbstractList
diff --git a/libjava/java/util/AbstractList.java b/libjava/java/util/AbstractList.java
index 15cb5814ab8..37288a7bb9e 100644
--- a/libjava/java/util/AbstractList.java
+++ b/libjava/java/util/AbstractList.java
@@ -1,5 +1,5 @@
/* AbstractList.java -- Abstract implementation of most of List
- Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2000, 2001, 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -59,7 +59,7 @@ package java.util;
*
* @author Original author unknown
* @author Bryce McKinlay
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Eric Blake (ebb9@email.byu.edu)
* @see Collection
* @see List
* @see AbstractSequentialList
@@ -751,476 +751,475 @@ while (i.hasNext())
return new SubList(this, fromIndex, toIndex);
}
-} // class AbstractList
-
-
-/**
- * This class follows the implementation requirements set forth in
- * {@link AbstractList#subList(int, int)}. It matches Sun's implementation
- * by using a non-public top-level class in the same package.
- *
- * @author Original author unknown
- * @author Eric Blake <ebb9@email.byu.edu>
- */
-class SubList extends AbstractList
-{
- // Package visible, for use by iterator.
- /** The original list. */
- final AbstractList backingList;
- /** The index of the first element of the sublist. */
- final int offset;
- /** The size of the sublist. */
- int size;
-
- /**
- * Construct the sublist.
- *
- * @param backing the list this comes from
- * @param fromIndex the lower bound, inclusive
- * @param toIndex the upper bound, exclusive
- */
- SubList(AbstractList backing, int fromIndex, int toIndex)
- {
- backingList = backing;
- modCount = backing.modCount;
- offset = fromIndex;
- size = toIndex - fromIndex;
- }
-
- /**
- * This method checks the two modCount fields to ensure that there has
- * not been a concurrent modification, returning if all is okay.
- *
- * @throws ConcurrentModificationException if the backing list has been
- * modified externally to this sublist
- */
- // This can be inlined. Package visible, for use by iterator.
- void checkMod()
- {
- if (modCount != backingList.modCount)
- throw new ConcurrentModificationException();
- }
-
- /**
- * This method checks that a value is between 0 and size (inclusive). If
- * it is not, an exception is thrown.
- *
- * @param index the value to check
- * @throws IndexOutOfBoundsException if index &lt; 0 || index &gt; size()
- */
- // This will get inlined, since it is private.
- private void checkBoundsInclusive(int index)
- {
- if (index < 0 || index > size)
- throw new IndexOutOfBoundsException("Index: " + index + ", Size:"
- + size);
- }
-
- /**
- * This method checks that a value is between 0 (inclusive) and size
- * (exclusive). If it is not, an exception is thrown.
- *
- * @param index the value to check
- * @throws IndexOutOfBoundsException if index &lt; 0 || index &gt;= size()
- */
- // This will get inlined, since it is private.
- private void checkBoundsExclusive(int index)
- {
- if (index < 0 || index >= size)
- throw new IndexOutOfBoundsException("Index: " + index + ", Size:"
- + size);
- }
-
- /**
- * Specified by AbstractList.subList to return the private field size.
- *
- * @return the sublist size
- * @throws ConcurrentModificationException if the backing list has been
- * modified externally to this sublist
- */
- public int size()
- {
- checkMod();
- return size;
- }
-
- /**
- * Specified by AbstractList.subList to delegate to the backing list.
- *
- * @param index the location to modify
- * @param o the new value
- * @return the old value
- * @throws ConcurrentModificationException if the backing list has been
- * modified externally to this sublist
- * @throws UnsupportedOperationException if the backing list does not
- * support the set operation
- * @throws IndexOutOfBoundsException if index &lt; 0 || index &gt;= size()
- * @throws ClassCastException if o cannot be added to the backing list due
- * to its type
- * @throws IllegalArgumentException if o cannot be added to the backing list
- * for some other reason
- */
- public Object set(int index, Object o)
- {
- checkMod();
- checkBoundsExclusive(index);
- return backingList.set(index + offset, o);
- }
-
- /**
- * Specified by AbstractList.subList to delegate to the backing list.
- *
- * @param index the location to get from
- * @return the object at that location
- * @throws ConcurrentModificationException if the backing list has been
- * modified externally to this sublist
- * @throws IndexOutOfBoundsException if index &lt; 0 || index &gt;= size()
- */
- public Object get(int index)
- {
- checkMod();
- checkBoundsExclusive(index);
- return backingList.get(index + offset);
- }
-
- /**
- * Specified by AbstractList.subList to delegate to the backing list.
- *
- * @param index the index to insert at
- * @param o the object to add
- * @throws ConcurrentModificationException if the backing list has been
- * modified externally to this sublist
- * @throws IndexOutOfBoundsException if index &lt; 0 || index &gt; size()
- * @throws UnsupportedOperationException if the backing list does not
- * support the add operation.
- * @throws ClassCastException if o cannot be added to the backing list due
- * to its type.
- * @throws IllegalArgumentException if o cannot be added to the backing
- * list for some other reason.
- */
- public void add(int index, Object o)
- {
- checkMod();
- checkBoundsInclusive(index);
- backingList.add(index + offset, o);
- size++;
- modCount = backingList.modCount;
- }
-
- /**
- * Specified by AbstractList.subList to delegate to the backing list.
- *
- * @param index the index to remove
- * @return the removed object
- * @throws ConcurrentModificationException if the backing list has been
- * modified externally to this sublist
- * @throws IndexOutOfBoundsException if index &lt; 0 || index &gt;= size()
- * @throws UnsupportedOperationException if the backing list does not
- * support the remove operation
- */
- public Object remove(int index)
- {
- checkMod();
- checkBoundsExclusive(index);
- Object o = backingList.remove(index + offset);
- size--;
- modCount = backingList.modCount;
- return o;
- }
-
- /**
- * Specified by AbstractList.subList to delegate to the backing list.
- * This does no bounds checking, as it assumes it will only be called
- * by trusted code like clear() which has already checked the bounds.
- *
- * @param fromIndex the lower bound, inclusive
- * @param toIndex the upper bound, exclusive
- * @throws ConcurrentModificationException if the backing list has been
- * modified externally to this sublist
- * @throws UnsupportedOperationException if the backing list does
- * not support removing elements.
- */
- protected void removeRange(int fromIndex, int toIndex)
- {
- checkMod();
-
- backingList.removeRange(offset + fromIndex, offset + toIndex);
- size -= toIndex - fromIndex;
- modCount = backingList.modCount;
- }
-
- /**
- * Specified by AbstractList.subList to delegate to the backing list.
- *
- * @param index the location to insert at
- * @param c the collection to insert
- * @return true if this list was modified, in other words, c is non-empty
- * @throws ConcurrentModificationException if the backing list has been
- * modified externally to this sublist
- * @throws IndexOutOfBoundsException if index &lt; 0 || index &gt; size()
- * @throws UnsupportedOperationException if this list does not support the
- * addAll operation
- * @throws ClassCastException if some element of c cannot be added to this
- * list due to its type
- * @throws IllegalArgumentException if some element of c cannot be added
- * to this list for some other reason
- * @throws NullPointerException if the specified collection is null
- */
- public boolean addAll(int index, Collection c)
- {
- checkMod();
- checkBoundsInclusive(index);
- int csize = c.size();
- boolean result = backingList.addAll(offset + index, c);
- size += csize;
- modCount = backingList.modCount;
- return result;
- }
-
- /**
- * Specified by AbstractList.subList to return addAll(size, c).
- *
- * @param c the collection to insert
- * @return true if this list was modified, in other words, c is non-empty
- * @throws ConcurrentModificationException if the backing list has been
- * modified externally to this sublist
- * @throws UnsupportedOperationException if this list does not support the
- * addAll operation
- * @throws ClassCastException if some element of c cannot be added to this
- * list due to its type
- * @throws IllegalArgumentException if some element of c cannot be added
- * to this list for some other reason
- * @throws NullPointerException if the specified collection is null
- */
- public boolean addAll(Collection c)
- {
- return addAll(size, c);
- }
-
- /**
- * Specified by AbstractList.subList to return listIterator().
- *
- * @return an iterator over the sublist
- */
- public Iterator iterator()
- {
- return listIterator();
- }
-
/**
- * Specified by AbstractList.subList to return a wrapper around the
- * backing list's iterator.
+ * This class follows the implementation requirements set forth in
+ * {@link AbstractList#subList(int, int)}. It matches Sun's implementation
+ * by using a non-public top-level class in the same package.
*
- * @param index the start location of the iterator
- * @return a list iterator over the sublist
- * @throws ConcurrentModificationException if the backing list has been
- * modified externally to this sublist
- * @throws IndexOutOfBoundsException if the value is out of range
+ * @author Original author unknown
+ * @author Eric Blake (ebb9@email.byu.edu)
*/
- public ListIterator listIterator(final int index)
+ private static class SubList extends AbstractList
{
- checkMod();
- checkBoundsInclusive(index);
-
- return new ListIterator()
+ // Package visible, for use by iterator.
+ /** The original list. */
+ final AbstractList backingList;
+ /** The index of the first element of the sublist. */
+ final int offset;
+ /** The size of the sublist. */
+ int size;
+
+ /**
+ * Construct the sublist.
+ *
+ * @param backing the list this comes from
+ * @param fromIndex the lower bound, inclusive
+ * @param toIndex the upper bound, exclusive
+ */
+ SubList(AbstractList backing, int fromIndex, int toIndex)
{
- private final ListIterator i = backingList.listIterator(index + offset);
- private int position = index;
-
- /**
- * Tests to see if there are any more objects to
- * return.
- *
- * @return True if the end of the list has not yet been
- * reached.
- * @throws ConcurrentModificationException if the
- * list has been modified elsewhere.
- */
- public boolean hasNext()
- {
- checkMod();
- return position < size;
- }
-
- /**
- * Tests to see if there are objects prior to the
- * current position in the list.
- *
- * @return True if objects exist prior to the current
- * position of the iterator.
- * @throws ConcurrentModificationException if the
- * list has been modified elsewhere.
- */
- public boolean hasPrevious()
- {
- checkMod();
- return position > 0;
- }
-
- /**
- * Retrieves the next object from the list.
- *
- * @return The next object.
- * @throws NoSuchElementException if there are no
- * more objects to retrieve.
- * @throws ConcurrentModificationException if the
- * list has been modified elsewhere.
- */
- public Object next()
- {
- if (position == size)
- throw new NoSuchElementException();
- position++;
- return i.next();
- }
-
- /**
- * Retrieves the previous object from the list.
- *
- * @return The next object.
- * @throws NoSuchElementException if there are no
- * previous objects to retrieve.
- * @throws ConcurrentModificationException if the
- * list has been modified elsewhere.
- */
- public Object previous()
- {
- if (position == 0)
- throw new NoSuchElementException();
- position--;
- return i.previous();
- }
-
- /**
- * Returns the index of the next element in the
- * list, which will be retrieved by <code>next()</code>
- *
- * @return The index of the next element.
- * @throws ConcurrentModificationException if the
- * list has been modified elsewhere.
- */
- public int nextIndex()
- {
- return i.nextIndex() - offset;
- }
-
- /**
- * Returns the index of the previous element in the
- * list, which will be retrieved by <code>previous()</code>
- *
- * @return The index of the previous element.
- * @throws ConcurrentModificationException if the
- * list has been modified elsewhere.
- */
- public int previousIndex()
- {
- return i.previousIndex() - offset;
- }
-
- /**
- * Removes the last object retrieved by <code>next()</code>
- * from the list, if the list supports object removal.
- *
- * @throws IllegalStateException if the iterator is positioned
- * before the start of the list or the last object has already
- * been removed.
- * @throws UnsupportedOperationException if the list does
- * not support removing elements.
- */
- public void remove()
- {
- i.remove();
- size--;
- position = nextIndex();
- modCount = backingList.modCount;
- }
-
-
- /**
- * Replaces the last object retrieved by <code>next()</code>
- * or <code>previous</code> with o, if the list supports object
- * replacement and an add or remove operation has not already
- * been performed.
- *
- * @throws IllegalStateException if the iterator is positioned
- * before the start of the list or the last object has already
- * been removed.
- * @throws UnsupportedOperationException if the list doesn't support
- * the addition or removal of elements.
- * @throws ClassCastException if the type of o is not a valid type
- * for this list.
- * @throws IllegalArgumentException if something else related to o
- * prevents its addition.
- * @throws ConcurrentModificationException if the list
- * has been modified elsewhere.
- */
- public void set(Object o)
- {
- i.set(o);
- }
+ backingList = backing;
+ modCount = backing.modCount;
+ offset = fromIndex;
+ size = toIndex - fromIndex;
+ }
+
+ /**
+ * This method checks the two modCount fields to ensure that there has
+ * not been a concurrent modification, returning if all is okay.
+ *
+ * @throws ConcurrentModificationException if the backing list has been
+ * modified externally to this sublist
+ */
+ // This can be inlined. Package visible, for use by iterator.
+ void checkMod()
+ {
+ if (modCount != backingList.modCount)
+ throw new ConcurrentModificationException();
+ }
+
+ /**
+ * This method checks that a value is between 0 and size (inclusive). If
+ * it is not, an exception is thrown.
+ *
+ * @param index the value to check
+ * @throws IndexOutOfBoundsException if index &lt; 0 || index &gt; size()
+ */
+ // This will get inlined, since it is private.
+ private void checkBoundsInclusive(int index)
+ {
+ if (index < 0 || index > size)
+ throw new IndexOutOfBoundsException("Index: " + index + ", Size:"
+ + size);
+ }
+
+ /**
+ * This method checks that a value is between 0 (inclusive) and size
+ * (exclusive). If it is not, an exception is thrown.
+ *
+ * @param index the value to check
+ * @throws IndexOutOfBoundsException if index &lt; 0 || index &gt;= size()
+ */
+ // This will get inlined, since it is private.
+ private void checkBoundsExclusive(int index)
+ {
+ if (index < 0 || index >= size)
+ throw new IndexOutOfBoundsException("Index: " + index + ", Size:"
+ + size);
+ }
+
+ /**
+ * Specified by AbstractList.subList to return the private field size.
+ *
+ * @return the sublist size
+ * @throws ConcurrentModificationException if the backing list has been
+ * modified externally to this sublist
+ */
+ public int size()
+ {
+ checkMod();
+ return size;
+ }
+
+ /**
+ * Specified by AbstractList.subList to delegate to the backing list.
+ *
+ * @param index the location to modify
+ * @param o the new value
+ * @return the old value
+ * @throws ConcurrentModificationException if the backing list has been
+ * modified externally to this sublist
+ * @throws UnsupportedOperationException if the backing list does not
+ * support the set operation
+ * @throws IndexOutOfBoundsException if index &lt; 0 || index &gt;= size()
+ * @throws ClassCastException if o cannot be added to the backing list due
+ * to its type
+ * @throws IllegalArgumentException if o cannot be added to the backing list
+ * for some other reason
+ */
+ public Object set(int index, Object o)
+ {
+ checkMod();
+ checkBoundsExclusive(index);
+ return backingList.set(index + offset, o);
+ }
+
+ /**
+ * Specified by AbstractList.subList to delegate to the backing list.
+ *
+ * @param index the location to get from
+ * @return the object at that location
+ * @throws ConcurrentModificationException if the backing list has been
+ * modified externally to this sublist
+ * @throws IndexOutOfBoundsException if index &lt; 0 || index &gt;= size()
+ */
+ public Object get(int index)
+ {
+ checkMod();
+ checkBoundsExclusive(index);
+ return backingList.get(index + offset);
+ }
+
+ /**
+ * Specified by AbstractList.subList to delegate to the backing list.
+ *
+ * @param index the index to insert at
+ * @param o the object to add
+ * @throws ConcurrentModificationException if the backing list has been
+ * modified externally to this sublist
+ * @throws IndexOutOfBoundsException if index &lt; 0 || index &gt; size()
+ * @throws UnsupportedOperationException if the backing list does not
+ * support the add operation.
+ * @throws ClassCastException if o cannot be added to the backing list due
+ * to its type.
+ * @throws IllegalArgumentException if o cannot be added to the backing
+ * list for some other reason.
+ */
+ public void add(int index, Object o)
+ {
+ checkMod();
+ checkBoundsInclusive(index);
+ backingList.add(index + offset, o);
+ size++;
+ modCount = backingList.modCount;
+ }
+
+ /**
+ * Specified by AbstractList.subList to delegate to the backing list.
+ *
+ * @param index the index to remove
+ * @return the removed object
+ * @throws ConcurrentModificationException if the backing list has been
+ * modified externally to this sublist
+ * @throws IndexOutOfBoundsException if index &lt; 0 || index &gt;= size()
+ * @throws UnsupportedOperationException if the backing list does not
+ * support the remove operation
+ */
+ public Object remove(int index)
+ {
+ checkMod();
+ checkBoundsExclusive(index);
+ Object o = backingList.remove(index + offset);
+ size--;
+ modCount = backingList.modCount;
+ return o;
+ }
+
+ /**
+ * Specified by AbstractList.subList to delegate to the backing list.
+ * This does no bounds checking, as it assumes it will only be called
+ * by trusted code like clear() which has already checked the bounds.
+ *
+ * @param fromIndex the lower bound, inclusive
+ * @param toIndex the upper bound, exclusive
+ * @throws ConcurrentModificationException if the backing list has been
+ * modified externally to this sublist
+ * @throws UnsupportedOperationException if the backing list does
+ * not support removing elements.
+ */
+ protected void removeRange(int fromIndex, int toIndex)
+ {
+ checkMod();
+
+ backingList.removeRange(offset + fromIndex, offset + toIndex);
+ size -= toIndex - fromIndex;
+ modCount = backingList.modCount;
+ }
+
+ /**
+ * Specified by AbstractList.subList to delegate to the backing list.
+ *
+ * @param index the location to insert at
+ * @param c the collection to insert
+ * @return true if this list was modified, in other words, c is non-empty
+ * @throws ConcurrentModificationException if the backing list has been
+ * modified externally to this sublist
+ * @throws IndexOutOfBoundsException if index &lt; 0 || index &gt; size()
+ * @throws UnsupportedOperationException if this list does not support the
+ * addAll operation
+ * @throws ClassCastException if some element of c cannot be added to this
+ * list due to its type
+ * @throws IllegalArgumentException if some element of c cannot be added
+ * to this list for some other reason
+ * @throws NullPointerException if the specified collection is null
+ */
+ public boolean addAll(int index, Collection c)
+ {
+ checkMod();
+ checkBoundsInclusive(index);
+ int csize = c.size();
+ boolean result = backingList.addAll(offset + index, c);
+ size += csize;
+ modCount = backingList.modCount;
+ return result;
+ }
+
+ /**
+ * Specified by AbstractList.subList to return addAll(size, c).
+ *
+ * @param c the collection to insert
+ * @return true if this list was modified, in other words, c is non-empty
+ * @throws ConcurrentModificationException if the backing list has been
+ * modified externally to this sublist
+ * @throws UnsupportedOperationException if this list does not support the
+ * addAll operation
+ * @throws ClassCastException if some element of c cannot be added to this
+ * list due to its type
+ * @throws IllegalArgumentException if some element of c cannot be added
+ * to this list for some other reason
+ * @throws NullPointerException if the specified collection is null
+ */
+ public boolean addAll(Collection c)
+ {
+ return addAll(size, c);
+ }
+
+ /**
+ * Specified by AbstractList.subList to return listIterator().
+ *
+ * @return an iterator over the sublist
+ */
+ public Iterator iterator()
+ {
+ return listIterator();
+ }
+
+ /**
+ * Specified by AbstractList.subList to return a wrapper around the
+ * backing list's iterator.
+ *
+ * @param index the start location of the iterator
+ * @return a list iterator over the sublist
+ * @throws ConcurrentModificationException if the backing list has been
+ * modified externally to this sublist
+ * @throws IndexOutOfBoundsException if the value is out of range
+ */
+ public ListIterator listIterator(final int index)
+ {
+ checkMod();
+ checkBoundsInclusive(index);
- /**
- * Adds the supplied object before the element that would be returned
- * by a call to <code>next()</code>, if the list supports addition.
- *
- * @param o The object to add to the list.
- * @throws UnsupportedOperationException if the list doesn't support
- * the addition of new elements.
- * @throws ClassCastException if the type of o is not a valid type
- * for this list.
- * @throws IllegalArgumentException if something else related to o
- * prevents its addition.
- * @throws ConcurrentModificationException if the list
- * has been modified elsewhere.
- */
- public void add(Object o)
+ return new ListIterator()
{
- i.add(o);
- size++;
- position++;
- modCount = backingList.modCount;
- }
-
- // Here is the reason why the various modCount fields are mostly
- // ignored in this wrapper listIterator.
- // If the backing listIterator is failfast, then the following holds:
- // Using any other method on this list will call a corresponding
- // method on the backing list *after* the backing listIterator
- // is created, which will in turn cause a ConcurrentModException
- // when this listIterator comes to use the backing one. So it is
- // implicitly failfast.
- // If the backing listIterator is NOT failfast, then the whole of
- // this list isn't failfast, because the modCount field of the
- // backing list is not valid. It would still be *possible* to
- // make the iterator failfast wrt modifications of the sublist
- // only, but somewhat pointless when the list can be changed under
- // us.
- // Either way, no explicit handling of modCount is needed.
- // However modCount = backingList.modCount must be executed in add
- // and remove, and size must also be updated in these two methods,
- // since they do not go through the corresponding methods of the subList.
- };
- }
-} // class SubList
+ private final ListIterator i = backingList.listIterator(index + offset);
+ private int position = index;
+
+ /**
+ * Tests to see if there are any more objects to
+ * return.
+ *
+ * @return True if the end of the list has not yet been
+ * reached.
+ * @throws ConcurrentModificationException if the
+ * list has been modified elsewhere.
+ */
+ public boolean hasNext()
+ {
+ checkMod();
+ return position < size;
+ }
+
+ /**
+ * Tests to see if there are objects prior to the
+ * current position in the list.
+ *
+ * @return True if objects exist prior to the current
+ * position of the iterator.
+ * @throws ConcurrentModificationException if the
+ * list has been modified elsewhere.
+ */
+ public boolean hasPrevious()
+ {
+ checkMod();
+ return position > 0;
+ }
+
+ /**
+ * Retrieves the next object from the list.
+ *
+ * @return The next object.
+ * @throws NoSuchElementException if there are no
+ * more objects to retrieve.
+ * @throws ConcurrentModificationException if the
+ * list has been modified elsewhere.
+ */
+ public Object next()
+ {
+ if (position == size)
+ throw new NoSuchElementException();
+ position++;
+ return i.next();
+ }
+
+ /**
+ * Retrieves the previous object from the list.
+ *
+ * @return The next object.
+ * @throws NoSuchElementException if there are no
+ * previous objects to retrieve.
+ * @throws ConcurrentModificationException if the
+ * list has been modified elsewhere.
+ */
+ public Object previous()
+ {
+ if (position == 0)
+ throw new NoSuchElementException();
+ position--;
+ return i.previous();
+ }
+
+ /**
+ * Returns the index of the next element in the
+ * list, which will be retrieved by <code>next()</code>
+ *
+ * @return The index of the next element.
+ * @throws ConcurrentModificationException if the
+ * list has been modified elsewhere.
+ */
+ public int nextIndex()
+ {
+ return i.nextIndex() - offset;
+ }
+
+ /**
+ * Returns the index of the previous element in the
+ * list, which will be retrieved by <code>previous()</code>
+ *
+ * @return The index of the previous element.
+ * @throws ConcurrentModificationException if the
+ * list has been modified elsewhere.
+ */
+ public int previousIndex()
+ {
+ return i.previousIndex() - offset;
+ }
+
+ /**
+ * Removes the last object retrieved by <code>next()</code>
+ * from the list, if the list supports object removal.
+ *
+ * @throws IllegalStateException if the iterator is positioned
+ * before the start of the list or the last object has already
+ * been removed.
+ * @throws UnsupportedOperationException if the list does
+ * not support removing elements.
+ */
+ public void remove()
+ {
+ i.remove();
+ size--;
+ position = nextIndex();
+ modCount = backingList.modCount;
+ }
+
+
+ /**
+ * Replaces the last object retrieved by <code>next()</code>
+ * or <code>previous</code> with o, if the list supports object
+ * replacement and an add or remove operation has not already
+ * been performed.
+ *
+ * @throws IllegalStateException if the iterator is positioned
+ * before the start of the list or the last object has already
+ * been removed.
+ * @throws UnsupportedOperationException if the list doesn't support
+ * the addition or removal of elements.
+ * @throws ClassCastException if the type of o is not a valid type
+ * for this list.
+ * @throws IllegalArgumentException if something else related to o
+ * prevents its addition.
+ * @throws ConcurrentModificationException if the list
+ * has been modified elsewhere.
+ */
+ public void set(Object o)
+ {
+ i.set(o);
+ }
+
+ /**
+ * Adds the supplied object before the element that would be returned
+ * by a call to <code>next()</code>, if the list supports addition.
+ *
+ * @param o The object to add to the list.
+ * @throws UnsupportedOperationException if the list doesn't support
+ * the addition of new elements.
+ * @throws ClassCastException if the type of o is not a valid type
+ * for this list.
+ * @throws IllegalArgumentException if something else related to o
+ * prevents its addition.
+ * @throws ConcurrentModificationException if the list
+ * has been modified elsewhere.
+ */
+ public void add(Object o)
+ {
+ i.add(o);
+ size++;
+ position++;
+ modCount = backingList.modCount;
+ }
+
+ // Here is the reason why the various modCount fields are mostly
+ // ignored in this wrapper listIterator.
+ // If the backing listIterator is failfast, then the following holds:
+ // Using any other method on this list will call a corresponding
+ // method on the backing list *after* the backing listIterator
+ // is created, which will in turn cause a ConcurrentModException
+ // when this listIterator comes to use the backing one. So it is
+ // implicitly failfast.
+ // If the backing listIterator is NOT failfast, then the whole of
+ // this list isn't failfast, because the modCount field of the
+ // backing list is not valid. It would still be *possible* to
+ // make the iterator failfast wrt modifications of the sublist
+ // only, but somewhat pointless when the list can be changed under
+ // us.
+ // Either way, no explicit handling of modCount is needed.
+ // However modCount = backingList.modCount must be executed in add
+ // and remove, and size must also be updated in these two methods,
+ // since they do not go through the corresponding methods of the subList.
+ };
+ }
+ } // class SubList
-/**
- * This class is a RandomAccess version of SubList, as required by
- * {@link AbstractList#subList(int, int)}.
- *
- * @author Eric Blake <ebb9@email.byu.edu>
- */
-final class RandomAccessSubList extends SubList
- implements RandomAccess
-{
/**
- * Construct the sublist.
+ * This class is a RandomAccess version of SubList, as required by
+ * {@link AbstractList#subList(int, int)}.
*
- * @param backing the list this comes from
- * @param fromIndex the lower bound, inclusive
- * @param toIndex the upper bound, exclusive
+ * @author Eric Blake (ebb9@email.byu.edu)
*/
- RandomAccessSubList(AbstractList backing, int fromIndex, int toIndex)
+ private static final class RandomAccessSubList extends SubList
+ implements RandomAccess
{
- super(backing, fromIndex, toIndex);
- }
-} // class RandomAccessSubList
+ /**
+ * Construct the sublist.
+ *
+ * @param backing the list this comes from
+ * @param fromIndex the lower bound, inclusive
+ * @param toIndex the upper bound, exclusive
+ */
+ RandomAccessSubList(AbstractList backing, int fromIndex, int toIndex)
+ {
+ super(backing, fromIndex, toIndex);
+ }
+ } // class RandomAccessSubList
+
+} // class AbstractList
diff --git a/libjava/java/util/AbstractMap.java b/libjava/java/util/AbstractMap.java
index d27e93b65d1..81093f8e374 100644
--- a/libjava/java/util/AbstractMap.java
+++ b/libjava/java/util/AbstractMap.java
@@ -1,5 +1,5 @@
/* AbstractMap.java -- Abstract implementation of most of Map
- Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2000, 2001, 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -53,7 +53,7 @@ package java.util;
*
* @author Original author unknown
* @author Bryce McKinlay
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Eric Blake (ebb9@email.byu.edu)
* @see Map
* @see Collection
* @see HashMap
@@ -622,7 +622,7 @@ public abstract class AbstractMap implements Map
* life much easier.
*
* @author Jon Zeppieri
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Eric Blake (ebb9@email.byu.edu)
*/
// XXX - FIXME Use fully qualified implements as gcj 3.1 workaround.
// Bug still exists in 3.4.1
diff --git a/libjava/java/util/AbstractSequentialList.java b/libjava/java/util/AbstractSequentialList.java
index 0e5d59fceec..f942e578ba1 100644
--- a/libjava/java/util/AbstractSequentialList.java
+++ b/libjava/java/util/AbstractSequentialList.java
@@ -1,5 +1,5 @@
/* AbstractSequentialList.java -- List implementation for sequential access
- Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2000, 2001, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -61,7 +61,7 @@ package java.util;
*
* @author Original author unknown
* @author Bryce McKinlay
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Eric Blake (ebb9@email.byu.edu)
* @see Collection
* @see List
* @see AbstractList
diff --git a/libjava/java/util/AbstractSet.java b/libjava/java/util/AbstractSet.java
index ce266283ebe..dcab1c9d3ea 100644
--- a/libjava/java/util/AbstractSet.java
+++ b/libjava/java/util/AbstractSet.java
@@ -1,5 +1,5 @@
/* AbstractSet.java -- Abstract implementation of most of Set
- Copyright (C) 1998, 2000, 2001 Free Software Foundation, Inc.
+ Copyright (C) 1998, 2000, 2001, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -48,7 +48,7 @@ package java.util;
* the requirements placed on them by the Set interface.
*
* @author Original author unknown
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Eric Blake (ebb9@email.byu.edu)
* @see Collection
* @see AbstractCollection
* @see Set
diff --git a/libjava/java/util/ArrayList.java b/libjava/java/util/ArrayList.java
index e39e4e0171b..2479efdf8b9 100644
--- a/libjava/java/util/ArrayList.java
+++ b/libjava/java/util/ArrayList.java
@@ -1,6 +1,6 @@
/* ArrayList.java -- JDK1.2's answer to Vector; this is an array-backed
implementation of the List interface
- Copyright (C) 1998, 1999, 2000, 2001, 2004 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2000, 2001, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -72,7 +72,7 @@ import java.lang.reflect.Array;
*
* @author Jon A. Zeppieri
* @author Bryce McKinlay
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Eric Blake (ebb9@email.byu.edu)
* @see Collection
* @see List
* @see LinkedList
diff --git a/libjava/java/util/Arrays.java b/libjava/java/util/Arrays.java
index f2337aee6dc..f3f15e6ec2b 100644
--- a/libjava/java/util/Arrays.java
+++ b/libjava/java/util/Arrays.java
@@ -1,5 +1,5 @@
/* Arrays.java -- Utility class with methods to operate on arrays
- Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004
+ Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -59,7 +59,7 @@ import java.lang.reflect.Array;
*
* @author Original author unknown
* @author Bryce McKinlay
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Eric Blake (ebb9@email.byu.edu)
* @see Comparable
* @see Comparator
* @since 1.2
@@ -935,7 +935,7 @@ public class Arrays
// sort
- // Thanks to Paul Fisher <rao@gnu.org> for finding this quicksort algorithm
+ // Thanks to Paul Fisher (rao@gnu.org) for finding this quicksort algorithm
// as specified by Sun and porting it to Java. The algorithm is an optimised
// quicksort, as described in Jon L. Bentley and M. Douglas McIlroy's
// "Engineering a Sort Function", Software-Practice and Experience, Vol.
@@ -2358,7 +2358,7 @@ public class Arrays
* Sun's choice for Serialization purposes. Element addition and removal
* is prohibited, but values can be modified.
*
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Eric Blake (ebb9@email.byu.edu)
* @status updated to 1.4
*/
private static final class ArrayList extends AbstractList
diff --git a/libjava/java/util/BitSet.java b/libjava/java/util/BitSet.java
index d152ba1d96b..cf7a83ed083 100644
--- a/libjava/java/util/BitSet.java
+++ b/libjava/java/util/BitSet.java
@@ -1,5 +1,5 @@
/* BitSet.java -- A vector of bits.
- Copyright (C) 1998, 1999, 2000, 2001, 2004 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2000, 2001, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -61,8 +61,8 @@ import java.io.Serializable;
* undefined.
*
* @author Jochen Hoenicke
- * @author Tom Tromey <tromey@cygnus.com>
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Tom Tromey (tromey@cygnus.com)
+ * @author Eric Blake (ebb9@email.byu.edu)
* @status updated to 1.4
*/
public class BitSet implements Cloneable, Serializable
diff --git a/libjava/java/util/Calendar.java b/libjava/java/util/Calendar.java
index 1f0b27a56e8..7faaeee43bc 100644
--- a/libjava/java/util/Calendar.java
+++ b/libjava/java/util/Calendar.java
@@ -1,5 +1,5 @@
/* Calendar.java --
- Copyright (C) 1998, 1999, 2000, 2001, 2002, 2004 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2000, 2001, 2002, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -51,7 +51,7 @@ import java.lang.reflect.InvocationTargetException;
* integer fields which represent <code>YEAR</code>,
* <code>MONTH</code>, <code>DAY</code>, etc. The <code>Date</code>
* object represents a time in milliseconds since the Epoch. <br>
- *
+ *
* This class is locale sensitive. To get the Object matching the
* current locale you can use <code>getInstance</code>. You can even provide
* a locale or a timezone. <code>getInstance</code> returns currently
@@ -78,13 +78,13 @@ import java.lang.reflect.InvocationTargetException;
* and for the first line all fields are set, that line is used to
* compute the day. <br>
*
- *
+ *
<pre>month + day_of_month
month + week_of_month + day_of_week
month + day_of_week_of_month + day_of_week
day_of_year
day_of_week + week_of_year</pre>
- *
+ *
* The hour_of_day-field takes precedence over the ampm and
* hour_of_ampm fields. <br>
*
@@ -92,7 +92,7 @@ day_of_week + week_of_year</pre>
*
* To convert a calendar to a human readable form and vice versa, use
* the <code>java.text.DateFormat</code> class. <br>
- *
+ *
* Other useful things you can do with an calendar, is
* <code>roll</code>ing fields (that means increase/decrease a
* specific field by one, propagating overflows), or
@@ -101,7 +101,7 @@ day_of_week + week_of_year</pre>
* @see Date
* @see GregorianCalendar
* @see TimeZone
- * @see java.text.DateFormat
+ * @see java.text.DateFormat
*/
public abstract class Calendar implements Serializable, Cloneable
{
@@ -109,43 +109,52 @@ public abstract class Calendar implements Serializable, Cloneable
* Constant representing the era time field.
*/
public static final int ERA = 0;
+
/**
* Constant representing the year time field.
*/
public static final int YEAR = 1;
+
/**
* Constant representing the month time field. This field
* should contain one of the JANUARY,...,DECEMBER constants below.
*/
public static final int MONTH = 2;
+
/**
* Constant representing the week of the year field.
* @see #setFirstDayOfWeek(int)
*/
public static final int WEEK_OF_YEAR = 3;
+
/**
* Constant representing the week of the month time field.
* @see #setFirstDayOfWeek(int)
*/
public static final int WEEK_OF_MONTH = 4;
+
/**
* Constant representing the day time field, synonym for DAY_OF_MONTH.
*/
public static final int DATE = 5;
+
/**
* Constant representing the day time field.
*/
public static final int DAY_OF_MONTH = 5;
+
/**
* Constant representing the day of year time field. This is
* 1 for the first day in month.
*/
public static final int DAY_OF_YEAR = 6;
+
/**
* Constant representing the day of week time field. This field
* should contain one of the SUNDAY,...,SATURDAY constants below.
*/
public static final int DAY_OF_WEEK = 7;
+
/**
* Constant representing the day-of-week-in-month field. For
* instance this field contains 2 for the second thursday in a
@@ -153,42 +162,51 @@ public abstract class Calendar implements Serializable, Cloneable
* from the end of the month.
*/
public static final int DAY_OF_WEEK_IN_MONTH = 8;
+
/**
* Constant representing the part of the day for 12-hour clock. This
* should be one of AM or PM.
*/
public static final int AM_PM = 9;
+
/**
* Constant representing the hour time field for 12-hour clock.
*/
public static final int HOUR = 10;
+
/**
* Constant representing the hour of day time field for 24-hour clock.
*/
public static final int HOUR_OF_DAY = 11;
+
/**
* Constant representing the minute of hour time field.
*/
public static final int MINUTE = 12;
+
/**
* Constant representing the second time field.
*/
public static final int SECOND = 13;
+
/**
* Constant representing the millisecond time field.
*/
public static final int MILLISECOND = 14;
+
/**
* Constant representing the time zone offset time field for the
* time given in the other fields. It is measured in
- * milliseconds. The default is the offset of the time zone.
+ * milliseconds. The default is the offset of the time zone.
*/
public static final int ZONE_OFFSET = 15;
+
/**
* Constant representing the daylight saving time offset in
- * milliseconds. The default is the value given by the time zone.
+ * milliseconds. The default is the value given by the time zone.
*/
public static final int DST_OFFSET = 16;
+
/**
* Number of time fields.
*/
@@ -198,26 +216,32 @@ public abstract class Calendar implements Serializable, Cloneable
* Constant representing Sunday.
*/
public static final int SUNDAY = 1;
+
/**
* Constant representing Monday.
*/
public static final int MONDAY = 2;
+
/**
* Constant representing Tuesday.
*/
public static final int TUESDAY = 3;
+
/**
* Constant representing Wednesday.
*/
public static final int WEDNESDAY = 4;
+
/**
* Constant representing Thursday.
*/
public static final int THURSDAY = 5;
+
/**
* Constant representing Friday.
*/
public static final int FRIDAY = 6;
+
/**
* Constant representing Saturday.
*/
@@ -227,50 +251,62 @@ public abstract class Calendar implements Serializable, Cloneable
* Constant representing January.
*/
public static final int JANUARY = 0;
+
/**
* Constant representing February.
*/
public static final int FEBRUARY = 1;
+
/**
* Constant representing March.
*/
public static final int MARCH = 2;
+
/**
* Constant representing April.
*/
public static final int APRIL = 3;
+
/**
* Constant representing May.
*/
public static final int MAY = 4;
+
/**
* Constant representing June.
*/
public static final int JUNE = 5;
+
/**
* Constant representing July.
*/
public static final int JULY = 6;
+
/**
* Constant representing August.
*/
public static final int AUGUST = 7;
+
/**
* Constant representing September.
*/
public static final int SEPTEMBER = 8;
+
/**
* Constant representing October.
*/
public static final int OCTOBER = 9;
+
/**
* Constant representing November.
*/
public static final int NOVEMBER = 10;
+
/**
* Constant representing December.
*/
public static final int DECEMBER = 11;
+
/**
* Constant representing Undecimber. This is an artificial name useful
* for lunar calendars.
@@ -281,6 +317,7 @@ public abstract class Calendar implements Serializable, Cloneable
* Useful constant for 12-hour clock.
*/
public static final int AM = 0;
+
/**
* Useful constant for 12-hour clock.
*/
@@ -292,21 +329,25 @@ public abstract class Calendar implements Serializable, Cloneable
* @serial
*/
protected int[] fields = new int[FIELD_COUNT];
+
/**
* The flags which tell if the fields above have a value.
* @serial
*/
protected boolean[] isSet = new boolean[FIELD_COUNT];
+
/**
* The time in milliseconds since the epoch.
* @serial
*/
protected long time;
+
/**
* Tells if the above field has a valid value.
* @serial
*/
protected boolean isTimeSet;
+
/**
* Tells if the fields have a valid value. This superseeds the isSet
* array.
@@ -332,7 +373,7 @@ public abstract class Calendar implements Serializable, Cloneable
/**
* Sets what the first day of week is. This is used for
- * WEEK_OF_MONTH and WEEK_OF_YEAR fields.
+ * WEEK_OF_MONTH and WEEK_OF_YEAR fields.
* @serial
*/
private int firstDayOfWeek;
@@ -347,13 +388,20 @@ public abstract class Calendar implements Serializable, Cloneable
private int minimalDaysInFirstWeek;
/**
- * The version of the serialized data on the stream.
+ * Is set to true if DST_OFFSET is explicitly set. In that case
+ * it's value overrides the value computed from the current
+ * time and the timezone.
+ */
+ private boolean explicitDSTOffset = false;
+
+ /**
+ * The version of the serialized data on the stream.
* <dl><dt>0 or not present</dt>
* <dd> JDK 1.1.5 or later.</dd>
- * <dl><dt>1</dt>
+ * <dt>1</dt>
* <dd>JDK 1.1.6 or later. This always writes a correct `time' value
* on the stream, as well as the other fields, to be compatible with
- * earlier versions</dd>
+ * earlier versions</dd></dl>
* @since JDK1.1.6
* @serial
*/
@@ -371,14 +419,14 @@ public abstract class Calendar implements Serializable, Cloneable
private static final String bundleName = "gnu.java.locale.Calendar";
/**
- * get resource bundle:
+ * get resource bundle:
* The resources should be loaded via this method only. Iff an application
- * uses this method, the resourcebundle is required.
+ * uses this method, the resourcebundle is required.
*/
- private static ResourceBundle getBundle(Locale locale)
+ private static ResourceBundle getBundle(Locale locale)
{
return ResourceBundle.getBundle(bundleName, locale,
- ClassLoader.getSystemClassLoader());
+ ClassLoader.getSystemClassLoader());
}
/**
@@ -404,8 +452,9 @@ public abstract class Calendar implements Serializable, Cloneable
ResourceBundle rb = getBundle(locale);
firstDayOfWeek = ((Integer) rb.getObject("firstDayOfWeek")).intValue();
- minimalDaysInFirstWeek =
- ((Integer) rb.getObject("minimalDaysInFirstWeek")).intValue();
+ minimalDaysInFirstWeek = ((Integer) rb.getObject("minimalDaysInFirstWeek"))
+ .intValue();
+ clear();
}
/**
@@ -437,15 +486,17 @@ public abstract class Calendar implements Serializable, Cloneable
return getInstance(TimeZone.getDefault(), locale);
}
- /**
+ /**
* Cache of locale->calendar-class mappings. This avoids having to do a ResourceBundle
- * lookup for every getInstance call.
+ * lookup for every getInstance call.
*/
private static HashMap cache = new HashMap();
/** Preset argument types for calendar-class constructor lookup. */
- private static Class[] ctorArgTypes
- = new Class[] {TimeZone.class, Locale.class};
+ private static Class[] ctorArgTypes = new Class[]
+ {
+ TimeZone.class, Locale.class
+ };
/**
* Creates a calendar representing the actual time, using the given
@@ -473,7 +524,7 @@ public abstract class Calendar implements Serializable, Cloneable
}
}
- // GregorianCalendar is by far the most common case. Optimize by
+ // GregorianCalendar is by far the most common case. Optimize by
// avoiding reflection.
if (calendarClass == GregorianCalendar.class)
return new GregorianCalendar(zone, locale);
@@ -481,7 +532,7 @@ public abstract class Calendar implements Serializable, Cloneable
if (Calendar.class.isAssignableFrom(calendarClass))
{
Constructor ctor = calendarClass.getConstructor(ctorArgTypes);
- return (Calendar) ctor.newInstance(new Object[] {zone, locale});
+ return (Calendar) ctor.newInstance(new Object[] { zone, locale });
}
}
catch (ClassNotFoundException ex)
@@ -504,9 +555,9 @@ public abstract class Calendar implements Serializable, Cloneable
{
exception = ex;
}
-
- throw new RuntimeException("Error instantiating calendar for locale " +
- locale, exception);
+
+ throw new RuntimeException("Error instantiating calendar for locale "
+ + locale, exception);
}
/**
@@ -530,7 +581,7 @@ public abstract class Calendar implements Serializable, Cloneable
* Converts the milliseconds since the epoch UTC
* (<code>time</code>) to time fields
* (<code>fields</code>). Override this method if you write your
- * own Calendar.
+ * own Calendar.
*/
protected abstract void computeFields();
@@ -541,7 +592,7 @@ public abstract class Calendar implements Serializable, Cloneable
*/
public final Date getTime()
{
- if (!isTimeSet)
+ if (! isTimeSet)
computeTime();
return new Date(time);
}
@@ -562,7 +613,7 @@ public abstract class Calendar implements Serializable, Cloneable
*/
public long getTimeInMillis()
{
- if (!isTimeSet)
+ if (! isTimeSet)
computeTime();
return time;
}
@@ -575,9 +626,9 @@ public abstract class Calendar implements Serializable, Cloneable
*/
public void setTimeInMillis(long time)
{
+ clear();
this.time = time;
isTimeSet = true;
- computeFields();
}
/**
@@ -593,14 +644,14 @@ public abstract class Calendar implements Serializable, Cloneable
public int get(int field)
{
// If the requested field is invalid, force all fields to be recomputed.
- if (!isSet[field])
+ if (! isSet[field])
areFieldsSet = false;
complete();
return fields[field];
}
/**
- * Gets the value of the specified field. This method doesn't
+ * Gets the value of the specified field. This method doesn't
* recompute the fields, if they are invalid.
* @param field the time field. One of the time field constants.
* @return the value of the specified field, undefined if
@@ -626,21 +677,78 @@ public abstract class Calendar implements Serializable, Cloneable
*/
public void set(int field, int value)
{
+ if (isTimeSet)
+ for (int i = 0; i < FIELD_COUNT; i++)
+ isSet[i] = false;
isTimeSet = false;
fields[field] = value;
isSet[field] = true;
+
+ // The five valid date patterns, in order of priority
+ // 1 YEAR + MONTH + DAY_OF_MONTH
+ // 2 YEAR + MONTH + WEEK_OF_MONTH + DAY_OF_WEEK
+ // 3 YEAR + MONTH + DAY_OF_WEEK_IN_MONTH + DAY_OF_WEEK
+ // 4 YEAR + DAY_OF_YEAR
+ // 5 YEAR + DAY_OF_WEEK + WEEK_OF_YEAR
switch (field)
{
- case YEAR:
- case MONTH:
- case DATE:
+ case MONTH: // pattern 1,2 or 3
+ isSet[DAY_OF_YEAR] = false;
+ isSet[WEEK_OF_YEAR] = false;
+ break;
+ case DAY_OF_MONTH: // pattern 1
+ isSet[YEAR] = true;
+ isSet[MONTH] = true;
+ isSet[WEEK_OF_MONTH] = true;
+ isSet[DAY_OF_WEEK] = false;
+ isSet[DAY_OF_WEEK_IN_MONTH] = false;
+ isSet[DAY_OF_YEAR] = false;
+ isSet[WEEK_OF_YEAR] = false;
+ break;
+ case WEEK_OF_MONTH: // pattern 2
+ if (! isSet[DAY_OF_WEEK])
+ fields[DAY_OF_WEEK] = getFirstDayOfWeek();
+ isSet[YEAR] = true;
+ isSet[MONTH] = true;
+ isSet[DAY_OF_WEEK] = true;
+ isSet[DAY_OF_MONTH] = false;
+ isSet[DAY_OF_WEEK_IN_MONTH] = false;
+ isSet[DAY_OF_YEAR] = false;
isSet[WEEK_OF_YEAR] = false;
+ break;
+ case DAY_OF_WEEK_IN_MONTH: // pattern 3
+ if (! isSet[DAY_OF_WEEK])
+ fields[DAY_OF_WEEK] = getFirstDayOfWeek();
+ isSet[YEAR] = true;
+ isSet[MONTH] = true;
+ isSet[DAY_OF_WEEK] = true;
isSet[DAY_OF_YEAR] = false;
+ isSet[DAY_OF_MONTH] = false;
+ isSet[WEEK_OF_MONTH] = false;
+ isSet[WEEK_OF_YEAR] = false;
+ break;
+ case DAY_OF_YEAR: // pattern 4
+ isSet[YEAR] = true;
+ isSet[MONTH] = false;
isSet[WEEK_OF_MONTH] = false;
+ isSet[DAY_OF_MONTH] = false;
isSet[DAY_OF_WEEK] = false;
+ isSet[WEEK_OF_YEAR] = false;
+ isSet[DAY_OF_WEEK_IN_MONTH] = false;
+ break;
+ case WEEK_OF_YEAR: // pattern 5
+ if (! isSet[DAY_OF_WEEK])
+ fields[DAY_OF_WEEK] = getFirstDayOfWeek();
+ isSet[YEAR] = true;
+ isSet[DAY_OF_WEEK] = true;
+ isSet[MONTH] = false;
+ isSet[DAY_OF_MONTH] = false;
+ isSet[WEEK_OF_MONTH] = false;
+ isSet[DAY_OF_YEAR] = false;
isSet[DAY_OF_WEEK_IN_MONTH] = false;
break;
case AM_PM:
+ isSet[HOUR] = true;
isSet[HOUR_OF_DAY] = false;
break;
case HOUR_OF_DAY:
@@ -648,12 +756,15 @@ public abstract class Calendar implements Serializable, Cloneable
isSet[HOUR] = false;
break;
case HOUR:
+ isSet[AM_PM] = true;
isSet[HOUR_OF_DAY] = false;
break;
+ case DST_OFFSET:
+ explicitDSTOffset = true;
}
// May have crossed over a DST boundary.
- if (field != DST_OFFSET && field != ZONE_OFFSET)
+ if (! explicitDSTOffset && (field != DST_OFFSET && field != ZONE_OFFSET))
isSet[DST_OFFSET] = false;
}
@@ -675,8 +786,10 @@ public abstract class Calendar implements Serializable, Cloneable
isSet[WEEK_OF_MONTH] = false;
isSet[DAY_OF_WEEK] = false;
isSet[DAY_OF_WEEK_IN_MONTH] = false;
+ isSet[ERA] = false;
- isSet[DST_OFFSET] = false; // May have crossed a DST boundary.
+ if (! explicitDSTOffset)
+ isSet[DST_OFFSET] = false; // May have crossed a DST boundary.
}
/**
@@ -706,8 +819,8 @@ public abstract class Calendar implements Serializable, Cloneable
* @param minute the minute.
* @param second the second.
*/
- public final void set(int year, int month, int date,
- int hour, int minute, int second)
+ public final void set(int year, int month, int date, int hour, int minute,
+ int second)
{
set(year, month, date, hour, minute);
fields[SECOND] = second;
@@ -721,11 +834,15 @@ public abstract class Calendar implements Serializable, Cloneable
{
isTimeSet = false;
areFieldsSet = false;
+ int zoneOffs = zone.getRawOffset();
+ int[] tempFields =
+ {
+ 1, 1970, JANUARY, 1, 1, 1, 1, THURSDAY, 1, AM, 0, 0, 0,
+ 0, 0, zoneOffs, 0
+ };
+ fields = tempFields;
for (int i = 0; i < FIELD_COUNT; i++)
- {
- isSet[i] = false;
- fields[i] = 0;
- }
+ isSet[i] = false;
}
/**
@@ -737,10 +854,15 @@ public abstract class Calendar implements Serializable, Cloneable
*/
public final void clear(int field)
{
+ int[] tempFields =
+ {
+ 1, 1970, JANUARY, 1, 1, 1, 1, THURSDAY, 1, AM, 0, 0, 0,
+ 0, 0, zone.getRawOffset(), 0
+ };
isTimeSet = false;
areFieldsSet = false;
isSet[field] = false;
- fields[field] = 0;
+ fields[field] = tempFields[field];
}
/**
@@ -757,18 +879,18 @@ public abstract class Calendar implements Serializable, Cloneable
/**
* Fills any unset fields in the time field list
- * @return true if the specified field has a value.
+ * @return true if the specified field has a value.
*/
protected void complete()
{
- if (!isTimeSet)
+ if (! isTimeSet)
computeTime();
- if (!areFieldsSet)
+ if (! areFieldsSet)
computeFields();
}
/**
- * Compares the given calendar with this.
+ * Compares the given calendar with this.
* @param o the object to that we should compare.
* @return true, if the given object is a calendar, that represents
* the same time (but doesn't necessary have the same fields).
@@ -776,12 +898,12 @@ public abstract class Calendar implements Serializable, Cloneable
public boolean equals(Object o)
{
return (o instanceof Calendar)
- && getTimeInMillis() == ((Calendar) o).getTimeInMillis();
+ && getTimeInMillis() == ((Calendar) o).getTimeInMillis();
}
/**
* Returns a hash code for this calendar.
- * @return a hash code, which fullfits the general contract of
+ * @return a hash code, which fullfits the general contract of
* <code>hashCode()</code>
*/
public int hashCode()
@@ -791,7 +913,7 @@ public abstract class Calendar implements Serializable, Cloneable
}
/**
- * Compares the given calendar with this.
+ * Compares the given calendar with this.
* @param o the object to that we should compare.
* @return true, if the given object is a calendar, and this calendar
* represents a smaller time than the calendar o.
@@ -804,7 +926,7 @@ public abstract class Calendar implements Serializable, Cloneable
}
/**
- * Compares the given calendar with this.
+ * Compares the given calendar with this.
* @param o the object to that we should compare.
* @return true, if the given object is a calendar, and this calendar
* represents a bigger time than the calendar o.
@@ -831,11 +953,11 @@ public abstract class Calendar implements Serializable, Cloneable
/**
* Rolls the specified time field up or down. This means add one
* to the specified field, but don't change the other fields. If
- * the maximum for this field is reached, start over with the
+ * the maximum for this field is reached, start over with the
* minimum value. <br>
*
* <strong>Note:</strong> There may be situation, where the other
- * fields must be changed, e.g rolling the month on May, 31.
+ * fields must be changed, e.g rolling the month on May, 31.
* The date June, 31 is automatically converted to July, 1.
* @param field the time field. One of the time field constants.
* @param up the direction, true for up, false for down.
@@ -854,7 +976,7 @@ public abstract class Calendar implements Serializable, Cloneable
*
* @param field the time field. One of the time field constants.
* @param amount the amount to roll by, positive for rolling up,
- * negative for rolling down.
+ * negative for rolling down.
* @throws ArrayIndexOutOfBoundsException if the field is outside
* the valid range. The value of field must be >= 0 and
* <= <code>FIELD_COUNT</code>.
@@ -874,7 +996,6 @@ public abstract class Calendar implements Serializable, Cloneable
}
}
-
/**
* Sets the time zone to the specified value.
* @param zone the new time zone
@@ -918,7 +1039,7 @@ public abstract class Calendar implements Serializable, Cloneable
/**
* Sets what the first day of week is. This is used for
- * WEEK_OF_MONTH and WEEK_OF_YEAR fields.
+ * WEEK_OF_MONTH and WEEK_OF_YEAR fields.
* @param value the first day of week. One of SUNDAY to SATURDAY.
*/
public void setFirstDayOfWeek(int value)
@@ -928,7 +1049,7 @@ public abstract class Calendar implements Serializable, Cloneable
/**
* Gets what the first day of week is. This is used for
- * WEEK_OF_MONTH and WEEK_OF_YEAR fields.
+ * WEEK_OF_MONTH and WEEK_OF_YEAR fields.
* @return the first day of week. One of SUNDAY to SATURDAY.
*/
public int getFirstDayOfWeek()
@@ -972,7 +1093,6 @@ public abstract class Calendar implements Serializable, Cloneable
*/
public abstract int getMaximum(int field);
-
/**
* Gets the greatest minimum value that is allowed for the specified field.
* @param field the time field. One of the time field constants.
@@ -984,7 +1104,7 @@ public abstract class Calendar implements Serializable, Cloneable
* Gets the smallest maximum value that is allowed for the
* specified field. For example this is 28 for DAY_OF_MONTH.
* @param field the time field. One of the time field constants.
- * @return the least maximum value.
+ * @return the least maximum value.
*/
public abstract int getLeastMaximum(int field);
@@ -1000,16 +1120,15 @@ public abstract class Calendar implements Serializable, Cloneable
*/
public int getActualMinimum(int field)
{
- Calendar tmp = (Calendar)clone(); // To avoid restoring state
+ Calendar tmp = (Calendar) clone(); // To avoid restoring state
int min = tmp.getGreatestMinimum(field);
int end = tmp.getMinimum(field);
tmp.set(field, min);
for (; min > end; min--)
{
- tmp.add(field, -1); // Try to get smaller
+ tmp.add(field, -1); // Try to get smaller
if (tmp.get(field) != min - 1)
- break; // Done if not successful
-
+ break; // Done if not successful
}
return min;
}
@@ -1018,7 +1137,7 @@ public abstract class Calendar implements Serializable, Cloneable
* Gets the actual maximum value that is allowed for the specified field.
* This value is dependent on the values of the other fields.
* @param field the time field. One of the time field constants.
- * @return the actual maximum value.
+ * @return the actual maximum value.
* @throws ArrayIndexOutOfBoundsException if the field is outside
* the valid range. The value of field must be >= 0 and
* <= <code>FIELD_COUNT</code>.
@@ -1026,7 +1145,7 @@ public abstract class Calendar implements Serializable, Cloneable
*/
public int getActualMaximum(int field)
{
- Calendar tmp = (Calendar)clone(); // To avoid restoring state
+ Calendar tmp = (Calendar) clone(); // To avoid restoring state
int max = tmp.getLeastMaximum(field);
int end = tmp.getMaximum(field);
tmp.set(field, max);
@@ -1048,7 +1167,7 @@ public abstract class Calendar implements Serializable, Cloneable
{
Calendar cal = (Calendar) super.clone();
cal.fields = (int[]) fields.clone();
- cal.isSet = (boolean[])isSet.clone();
+ cal.isSet = (boolean[]) isSet.clone();
return cal;
}
catch (CloneNotSupportedException ex)
@@ -1057,16 +1176,19 @@ public abstract class Calendar implements Serializable, Cloneable
}
}
- private static final String[] fieldNames = {
- ",ERA=", ",YEAR=", ",MONTH=",
- ",WEEK_OF_YEAR=", ",WEEK_OF_MONTH=",
- ",DAY_OF_MONTH=", ",DAY_OF_YEAR=", ",DAY_OF_WEEK=",
- ",DAY_OF_WEEK_IN_MONTH=",
- ",AM_PM=", ",HOUR=", ",HOUR_OF_DAY=",
- ",MINUTE=", ",SECOND=", ",MILLISECOND=",
- ",ZONE_OFFSET=", ",DST_OFFSET="
- };
-
+ private static final String[] fieldNames =
+ {
+ ",ERA=", ",YEAR=", ",MONTH=",
+ ",WEEK_OF_YEAR=",
+ ",WEEK_OF_MONTH=",
+ ",DAY_OF_MONTH=",
+ ",DAY_OF_YEAR=", ",DAY_OF_WEEK=",
+ ",DAY_OF_WEEK_IN_MONTH=",
+ ",AM_PM=", ",HOUR=",
+ ",HOUR_OF_DAY=", ",MINUTE=",
+ ",SECOND=", ",MILLISECOND=",
+ ",ZONE_OFFSET=", ",DST_OFFSET="
+ };
/**
* Returns a string representation of this object. It is mainly
@@ -1109,7 +1231,7 @@ public abstract class Calendar implements Serializable, Cloneable
* says, that it could be omitted. */
private void writeObject(ObjectOutputStream stream) throws IOException
{
- if (!isTimeSet)
+ if (! isTimeSet)
computeTime();
stream.defaultWriteObject();
}
@@ -1121,7 +1243,7 @@ public abstract class Calendar implements Serializable, Cloneable
throws IOException, ClassNotFoundException
{
stream.defaultReadObject();
- if (!isTimeSet)
+ if (! isTimeSet)
computeTime();
if (serialVersionOnStream > 1)
@@ -1130,7 +1252,6 @@ public abstract class Calendar implements Serializable, Cloneable
// Sun wants to remove all fields from the stream someday
// and will then increase the serialVersion number again.
// We prepare to be compatible.
-
fields = new int[FIELD_COUNT];
isSet = new boolean[FIELD_COUNT];
areFieldsSet = false;
diff --git a/libjava/java/util/Collection.java b/libjava/java/util/Collection.java
index be500b20086..910a893c35a 100644
--- a/libjava/java/util/Collection.java
+++ b/libjava/java/util/Collection.java
@@ -1,5 +1,5 @@
/* Collection.java -- Interface that represents a collection of objects
- Copyright (C) 1998, 2001 Free Software Foundation, Inc.
+ Copyright (C) 1998, 2001, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -66,7 +66,7 @@ package java.util;
* copy of the argument using its own implementation).
*
* @author Original author unknown
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Eric Blake (ebb9@email.byu.edu)
* @see List
* @see Set
* @see Map
diff --git a/libjava/java/util/Collections.java b/libjava/java/util/Collections.java
index 6da84296e7e..e25fbc36493 100644
--- a/libjava/java/util/Collections.java
+++ b/libjava/java/util/Collections.java
@@ -1,5 +1,5 @@
/* Collections.java -- Utility class with methods to operate on collections
- Copyright (C) 1998, 1999, 2000, 2001, 2002, 2004
+ Copyright (C) 1998, 1999, 2000, 2001, 2002, 2004, 2005
Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -61,7 +61,7 @@ import java.io.Serializable;
* modify the set.
*
* @author Original author unknown
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Eric Blake (ebb9@email.byu.edu)
* @see Collection
* @see Set
* @see List
@@ -112,7 +112,7 @@ public class Collections
* The implementation of {@link #EMPTY_SET}. This class name is required
* for compatibility with Sun's JDK serializability.
*
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Eric Blake (ebb9@email.byu.edu)
*/
private static final class EmptySet extends AbstractSet
implements Serializable
@@ -266,7 +266,7 @@ public class Collections
* The implementation of {@link #EMPTY_LIST}. This class name is required
* for compatibility with Sun's JDK serializability.
*
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Eric Blake (ebb9@email.byu.edu)
*/
private static final class EmptyList extends AbstractList
implements Serializable, RandomAccess
@@ -444,7 +444,7 @@ public class Collections
* The implementation of {@link #EMPTY_MAP}. This class name is required
* for compatibility with Sun's JDK serializability.
*
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Eric Blake (ebb9@email.byu.edu)
*/
private static final class EmptyMap extends AbstractMap
implements Serializable
@@ -958,7 +958,7 @@ public class Collections
* The implementation of {@link #nCopies(int, Object)}. This class name
* is required for compatibility with Sun's JDK serializability.
*
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Eric Blake (ebb9@email.byu.edu)
*/
private static final class CopiesList extends AbstractList
implements Serializable, RandomAccess
@@ -1169,7 +1169,7 @@ public class Collections
* The implementation of {@link #reverseOrder()}. This class name
* is required for compatibility with Sun's JDK serializability.
*
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Eric Blake (ebb9@email.byu.edu)
*/
private static final class ReverseComparator
implements Comparator, Serializable
@@ -1384,7 +1384,7 @@ public class Collections
* The implementation of {@link #singleton(Object)}. This class name
* is required for compatibility with Sun's JDK serializability.
*
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Eric Blake (ebb9@email.byu.edu)
*/
private static final class SingletonSet extends AbstractSet
implements Serializable
@@ -1558,7 +1558,7 @@ public class Collections
* The implementation of {@link #singletonList(Object)}. This class name
* is required for compatibility with Sun's JDK serializability.
*
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Eric Blake (ebb9@email.byu.edu)
*/
private static final class SingletonList extends AbstractList
implements Serializable, RandomAccess
@@ -1734,7 +1734,7 @@ public class Collections
* The implementation of {@link #singletonMap(Object)}. This class name
* is required for compatibility with Sun's JDK serializability.
*
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Eric Blake (ebb9@email.byu.edu)
*/
private static final class SingletonMap extends AbstractMap
implements Serializable
@@ -1999,7 +1999,7 @@ public class Collections
* Package visible, so that collections such as the one for
* Hashtable.values() can specify which object to synchronize on.
*
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Eric Blake (ebb9@email.byu.edu)
*/
static class SynchronizedCollection
implements Collection, Serializable
@@ -2332,7 +2332,7 @@ public class Collections
* synchronized classes. These iterators must "sync" on the same object
* as the collection they iterate over.
*
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Eric Blake (ebb9@email.byu.edu)
*/
private static class SynchronizedIterator implements Iterator
{
@@ -2451,7 +2451,7 @@ public class Collections
* serializability. Package visible, so that lists such as Vector.subList()
* can specify which object to synchronize on.
*
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Eric Blake (ebb9@email.byu.edu)
*/
static class SynchronizedList extends SynchronizedCollection
implements List
@@ -2757,7 +2757,7 @@ public class Collections
* lists. This class name is required for compatibility with Sun's JDK
* serializability.
*
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Eric Blake (ebb9@email.byu.edu)
*/
private static final class SynchronizedRandomAccessList
extends SynchronizedList implements RandomAccess
@@ -2822,7 +2822,7 @@ public class Collections
* The implementation of {@link SynchronizedList#listIterator()}. This
* iterator must "sync" on the same object as the list it iterates over.
*
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Eric Blake (ebb9@email.byu.edu)
*/
private static final class SynchronizedListIterator
extends SynchronizedIterator implements ListIterator
@@ -2997,7 +2997,7 @@ public class Collections
* The implementation of {@link #synchronizedMap(Map)}. This
* class name is required for compatibility with Sun's JDK serializability.
*
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Eric Blake (ebb9@email.byu.edu)
*/
private static class SynchronizedMap implements Map, Serializable
{
@@ -3527,7 +3527,7 @@ public class Collections
* Package visible, so that sets such as Hashtable.keySet()
* can specify which object to synchronize on.
*
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Eric Blake (ebb9@email.byu.edu)
*/
static class SynchronizedSet extends SynchronizedCollection
implements Set
@@ -3631,7 +3631,7 @@ public class Collections
* The implementation of {@link #synchronizedSortedMap(SortedMap)}. This
* class name is required for compatibility with Sun's JDK serializability.
*
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Eric Blake (ebb9@email.byu.edu)
*/
private static final class SynchronizedSortedMap extends SynchronizedMap
implements SortedMap
@@ -3827,7 +3827,7 @@ public class Collections
* The implementation of {@link #synchronizedSortedSet(SortedSet)}. This
* class name is required for compatibility with Sun's JDK serializability.
*
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Eric Blake (ebb9@email.byu.edu)
*/
private static final class SynchronizedSortedSet extends SynchronizedSet
implements SortedSet
@@ -4019,7 +4019,7 @@ public class Collections
* The implementation of {@link #unmodifiableCollection(Collection)}. This
* class name is required for compatibility with Sun's JDK serializability.
*
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Eric Blake (ebb9@email.byu.edu)
*/
private static class UnmodifiableCollection
implements Collection, Serializable
@@ -4250,7 +4250,7 @@ public class Collections
* The implementation of the various iterator methods in the
* unmodifiable classes.
*
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Eric Blake (ebb9@email.byu.edu)
*/
private static class UnmodifiableIterator implements Iterator
{
@@ -4336,7 +4336,7 @@ public class Collections
* lists. This class name is required for compatibility with Sun's JDK
* serializability.
*
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Eric Blake (ebb9@email.byu.edu)
*/
private static class UnmodifiableList extends UnmodifiableCollection
implements List
@@ -4554,7 +4554,7 @@ public class Collections
* lists. This class name is required for compatibility with Sun's JDK
* serializability.
*
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Eric Blake (ebb9@email.byu.edu)
*/
private static final class UnmodifiableRandomAccessList
extends UnmodifiableList implements RandomAccess
@@ -4578,7 +4578,7 @@ public class Collections
/**
* The implementation of {@link UnmodifiableList#listIterator()}.
*
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Eric Blake (ebb9@email.byu.edu)
*/
private static final class UnmodifiableListIterator
extends UnmodifiableIterator implements ListIterator
@@ -4702,7 +4702,7 @@ public class Collections
* The implementation of {@link #unmodifiableMap(Map)}. This
* class name is required for compatibility with Sun's JDK serializability.
*
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Eric Blake (ebb9@email.byu.edu)
*/
private static class UnmodifiableMap implements Map, Serializable
{
@@ -4811,7 +4811,7 @@ public class Collections
* The implementation of {@link UnmodifiableMap#entrySet()}. This class
* name is required for compatibility with Sun's JDK serializability.
*
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Eric Blake (ebb9@email.byu.edu)
*/
private static final class UnmodifiableEntrySet extends UnmodifiableSet
implements Serializable
@@ -5100,7 +5100,7 @@ public class Collections
* The implementation of {@link #unmodifiableSet(Set)}. This class
* name is required for compatibility with Sun's JDK serializability.
*
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Eric Blake (ebb9@email.byu.edu)
*/
private static class UnmodifiableSet extends UnmodifiableCollection
implements Set
@@ -5169,7 +5169,7 @@ public class Collections
* The implementation of {@link #unmodifiableSortedMap(SortedMap)}. This
* class name is required for compatibility with Sun's JDK serializability.
*
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Eric Blake (ebb9@email.byu.edu)
*/
private static class UnmodifiableSortedMap extends UnmodifiableMap
implements SortedMap
@@ -5342,7 +5342,7 @@ public class Collections
* The implementation of {@link #synchronizedSortedMap(SortedMap)}. This
* class name is required for compatibility with Sun's JDK serializability.
*
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Eric Blake (ebb9@email.byu.edu)
*/
private static class UnmodifiableSortedSet extends UnmodifiableSet
implements SortedSet
diff --git a/libjava/java/util/Comparator.java b/libjava/java/util/Comparator.java
index adf6fd01d74..d536520cb47 100644
--- a/libjava/java/util/Comparator.java
+++ b/libjava/java/util/Comparator.java
@@ -1,5 +1,5 @@
/* Comparator.java -- Interface for objects that specify an ordering
- Copyright (C) 1998, 2001 Free Software Foundation, Inc.
+ Copyright (C) 1998, 2001, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -60,7 +60,7 @@ package java.util;
* Serializable.
*
* @author Original author unknown
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Eric Blake (ebb9@email.byu.edu)
* @see Comparable
* @see TreeMap
* @see TreeSet
@@ -84,7 +84,7 @@ public interface Comparator
* <li>if compare(a, b) &lt; 0 and compare(b, c) &lt; 0 then compare(a, c)
* &lt; 0</li>
* <li>if compare(a, b) == 0 then compare(a, c) and compare(b, c) must
- * have the same sign</li
+ * have the same sign</li>
* </ul>
* To be consistent with equals, the following additional constraint is
* in place:
diff --git a/libjava/java/util/ConcurrentModificationException.java b/libjava/java/util/ConcurrentModificationException.java
index 9e22267d36b..9492eb97628 100644
--- a/libjava/java/util/ConcurrentModificationException.java
+++ b/libjava/java/util/ConcurrentModificationException.java
@@ -1,5 +1,5 @@
/* ConcurrentModificationException.java -- Data structure concurrently modified
- Copyright (C) 1998, 1999, 2001 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2001, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -52,8 +52,8 @@ package java.util;
* this condition is referred to as fail-fast. Notice that this can occur
* even in single-threaded designs, if you call methods out of order.
*
- * @author Warren Levy <warrenl@cygnus.com>
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Warren Levy (warrenl@cygnus.com)
+ * @author Eric Blake (ebb9@email.byu.edu)
* @see Collection
* @see Iterator
* @see ListIterator
diff --git a/libjava/java/util/Currency.java b/libjava/java/util/Currency.java
index 98a599e65cf..ffe593dfcc4 100644
--- a/libjava/java/util/Currency.java
+++ b/libjava/java/util/Currency.java
@@ -1,5 +1,5 @@
/* Currency.java -- Representation of a currency
- Copyright (C) 2003, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -49,10 +49,10 @@ import java.text.NumberFormat;
* a constructor.
*
* @see java.util.Locale
- * @author Guilhem Lavaux <guilhem.lavaux@free.fr>
- * @author Dalibor Topic <robilad@kaffe.org>
- * @author Bryce McKinlay <mckinlay@redhat.com>
- * @author Andrew John Hughes <gnu_andrew@member.fsf.org>
+ * @author Guilhem Lavaux (guilhem.lavaux@free.fr)
+ * @author Dalibor Topic (robilad@kaffe.org)
+ * @author Bryce McKinlay (mckinlay@redhat.com)
+ * @author Andrew John Hughes (gnu_andrew@member.fsf.org)
* @since 1.4
*/
public final class Currency
diff --git a/libjava/java/util/Date.java b/libjava/java/util/Date.java
index 4a96ff03d5a..3d8f2a69d9d 100644
--- a/libjava/java/util/Date.java
+++ b/libjava/java/util/Date.java
@@ -1,5 +1,5 @@
/* java.util.Date
- Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2000, 2001, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -685,6 +685,7 @@ public class Date
* <p>
* A sequence of consecutive alphabetic characters is recognised as a word,
* and interpreted as follows, in a case-insentive fashion:
+ * <ul>
* <li>
* The characters 'AM' or 'PM' restrict the hour value to a value between 0
* and 12. In the latter case, 12 is added to the hour value before storage.
diff --git a/libjava/java/util/EmptyStackException.java b/libjava/java/util/EmptyStackException.java
index 3236fbf6788..90109513e93 100644
--- a/libjava/java/util/EmptyStackException.java
+++ b/libjava/java/util/EmptyStackException.java
@@ -1,5 +1,5 @@
/* EmptyStackException.java -- Attempt to pop from an empty stack
- Copyright (C) 1998, 1999, 2001 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2001, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -47,8 +47,8 @@ package java.util;
* This exception is thrown by the Stack class when an attempt is made to pop
* or otherwise access elements from an empty stack.
*
- * @author Warren Levy <warrenl@cygnus.com>
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Warren Levy (warrenl@cygnus.com)
+ * @author Eric Blake (ebb9@email.byu.edu)
* @see Stack
* @since 1.0
* @status updated to 1.4
diff --git a/libjava/java/util/Enumeration.java b/libjava/java/util/Enumeration.java
index 1b23cfc5c8d..ebd75427ddf 100644
--- a/libjava/java/util/Enumeration.java
+++ b/libjava/java/util/Enumeration.java
@@ -1,5 +1,5 @@
/* Enumeration.java -- Interface for enumerating lists of objects
- Copyright (C) 1998, 1999, 2001 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2001, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -52,8 +52,8 @@ package java.util;
* the new collections classes, for use with legacy APIs that require them, can
* be obtained by the enumeration method in class Collections.
*
- * @author Warren Levy <warrenl@cygnus.com>
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Warren Levy (warrenl@cygnus.com)
+ * @author Eric Blake (ebb9@email.byu.edu)
* @see Iterator
* @see Hashtable
* @see Vector
diff --git a/libjava/java/util/EventListener.java b/libjava/java/util/EventListener.java
index f8443314bde..32dc563af2a 100644
--- a/libjava/java/util/EventListener.java
+++ b/libjava/java/util/EventListener.java
@@ -1,5 +1,5 @@
/* EventListener.java -- tagging interface for all event listeners
- Copyright (C) 1998, 1999, 2001, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2001, 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -45,7 +45,7 @@ package java.util;
* <code>Listener</code> and all method described by the subinterface
* take as argument an subclass of <code>EventObject</code>.
*
- * @author Tom Tromey <tromey@cygnus.com>
+ * @author Tom Tromey (tromey@cygnus.com)
* @see EventObject
* @status updated to 1.4
*/
diff --git a/libjava/java/util/EventListenerProxy.java b/libjava/java/util/EventListenerProxy.java
index 2955f455f73..484e1f2b449 100644
--- a/libjava/java/util/EventListenerProxy.java
+++ b/libjava/java/util/EventListenerProxy.java
@@ -1,5 +1,5 @@
/* EventListenerProxy.java -- abstract wrapper for event listeners
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -44,7 +44,7 @@ package java.util;
* a new one. Subclasses are expected to add methods to set and retrieve
* any attached properties.
*
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Eric Blake (ebb9@email.byu.edu)
* @since 1.4
* @status updated to 1.4
*/
diff --git a/libjava/java/util/EventObject.java b/libjava/java/util/EventObject.java
index 3ccb6ecd29a..f6fbd8a47b2 100644
--- a/libjava/java/util/EventObject.java
+++ b/libjava/java/util/EventObject.java
@@ -1,5 +1,5 @@
/* EventObject.java -- represents an event on an object
- Copyright (C) 1999, 2000, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2000, 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -43,7 +43,7 @@ import java.io.Serializable;
/**
* Represents Events fired by Objects.
*
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Eric Blake (ebb9@email.byu.edu)
* @see EventListener
* @since 1.1
* @status updated to 1.4
diff --git a/libjava/java/util/GregorianCalendar.java b/libjava/java/util/GregorianCalendar.java
index d99a9f2c612..d036cd620e8 100644
--- a/libjava/java/util/GregorianCalendar.java
+++ b/libjava/java/util/GregorianCalendar.java
@@ -39,6 +39,7 @@ exception statement from your version. */
package java.util;
+
/**
* <p>
* This class represents the Gregorian calendar, that is used in most
@@ -46,7 +47,7 @@ package java.util;
* for dates smaller than the date of the change to the Gregorian calendar.
* The Gregorian calendar differs from the Julian calendar by a different
* leap year rule (no leap year every 100 years, except if year is divisible
- * by 400).
+ * by 400).
* </p>
* <p>
* This change date is different from country to country, and can be changed with
@@ -136,7 +137,7 @@ public class GregorianCalendar extends Calendar
* Constant representing the era BC (Before Christ).
*/
public static final int BC = 0;
-
+
/**
* Constant representing the era AD (Anno Domini).
*/
@@ -164,43 +165,46 @@ public class GregorianCalendar extends Calendar
private static final String bundleName = "gnu.java.locale.Calendar";
/**
- * Retrieves the resource bundle. The resources should be loaded
- * via this method only. Iff an application uses this method, the
- * resourcebundle is required.
+ * Days in the epoch. Relative Jan 1, year '0' which is not a leap year.
+ * (although there is no year zero, this does not matter.)
+ * This is consistent with the formula:
+ * = (year-1)*365L + ((year-1) >> 2)
+ *
+ * Plus the gregorian correction:
+ * Math.floor((year-1) / 400.) - Math.floor((year-1) / 100.);
+ * For a correct julian date, the correction is -2 instead.
*
- * @param locale the locale in use for this calendar.
- * @return A resource bundle for the calendar for the specified locale.
+ * The gregorian cutover in 1582 was 10 days, so by calculating the
+ * correction from year zero, we have 15 non-leap days (even centuries)
+ * minus 3 leap days (year 400,800,1200) = 12. Subtracting two corrects
+ * this to the correct number 10.
*/
- private static ResourceBundle getBundle(Locale locale)
- {
- return ResourceBundle.getBundle(bundleName, locale,
- ClassLoader.getSystemClassLoader());
- }
+ private static final int EPOCH_DAYS = 719162;
/**
* Constructs a new GregorianCalender representing the current
- * time, using the default time zone and the default locale.
+ * time, using the default time zone and the default locale.
*/
public GregorianCalendar()
{
this(TimeZone.getDefault(), Locale.getDefault());
}
-
+
/**
* Constructs a new GregorianCalender representing the current
- * time, using the specified time zone and the default locale.
- *
+ * time, using the specified time zone and the default locale.
+ *
* @param zone a time zone.
*/
public GregorianCalendar(TimeZone zone)
{
this(zone, Locale.getDefault());
}
-
+
/**
* Constructs a new GregorianCalender representing the current
* time, using the default time zone and the specified locale.
- *
+ *
* @param locale a locale.
*/
public GregorianCalendar(Locale locale)
@@ -212,15 +216,30 @@ public class GregorianCalendar extends Calendar
* Constructs a new GregorianCalender representing the current
* time with the given time zone and the given locale.
*
- * @param zone a time zone.
- * @param locale a locale.
+ * @param zone a time zone.
+ * @param locale a locale.
*/
public GregorianCalendar(TimeZone zone, Locale locale)
{
+ this(zone, locale, false);
+ setTimeInMillis(System.currentTimeMillis());
+ complete();
+ }
+
+ /**
+ * Common constructor that all constructors should call.
+ * @param zone a time zone.
+ * @param locale a locale.
+ * @param unused unused parameter to make the signature differ from
+ * the public constructor (TimeZone, Locale).
+ */
+ private GregorianCalendar(TimeZone zone, Locale locale, boolean unused)
+ {
super(zone, locale);
- ResourceBundle rb = getBundle(locale);
+ ResourceBundle rb = ResourceBundle.getBundle(bundleName, locale,
+ ClassLoader
+ .getSystemClassLoader());
gregorianCutover = ((Date) rb.getObject("gregorianCutOver")).getTime();
- setTimeInMillis(System.currentTimeMillis());
}
/**
@@ -232,7 +251,7 @@ public class GregorianCalendar extends Calendar
*/
public GregorianCalendar(int year, int month, int day)
{
- super();
+ this(TimeZone.getDefault(), Locale.getDefault(), false);
set(year, month, day);
}
@@ -248,7 +267,7 @@ public class GregorianCalendar extends Calendar
*/
public GregorianCalendar(int year, int month, int day, int hour, int minute)
{
- super();
+ this(TimeZone.getDefault(), Locale.getDefault(), false);
set(year, month, day, hour, minute);
}
@@ -256,7 +275,6 @@ public class GregorianCalendar extends Calendar
* Constructs a new GregorianCalendar representing midnight on the
* given date with the default time zone and locale.
*
- *
* @param year corresponds to the YEAR time field.
* @param month corresponds to the MONTH time field.
* @param day corresponds to the DAY time field.
@@ -264,10 +282,10 @@ public class GregorianCalendar extends Calendar
* @param minute corresponds to the MINUTE time field.
* @param second corresponds to the SECOND time field.
*/
- public GregorianCalendar(int year, int month, int day,
- int hour, int minute, int second)
+ public GregorianCalendar(int year, int month, int day, int hour, int minute,
+ int second)
{
- super();
+ this(TimeZone.getDefault(), Locale.getDefault(), false);
set(year, month, day, hour, minute, second);
}
@@ -308,71 +326,23 @@ public class GregorianCalendar extends Calendar
* </p>
*
* @param year a year (use a negative value for BC).
- * @return true, if the given year is a leap year, false otherwise.
+ * @return true, if the given year is a leap year, false otherwise.
*/
public boolean isLeapYear(int year)
{
+ // Only years divisible by 4 can be leap years
if ((year & 3) != 0)
- // Only years divisible by 4 can be leap years
return false;
- // compute the linear day of the 29. February of that year.
- // The 13 is the number of days, that were omitted in the Gregorian
- // Calender until the epoch.
- int julianDay = (((year-1) * (365*4+1)) >> 2) + (31+29 -
- (((1970-1) * (365*4+1)) / 4 + 1 - 13));
-
- // If that day is smaller than the gregorianChange the julian
- // rule applies: This is a leap year since it is divisible by 4.
- if (julianDay * (24 * 60 * 60 * 1000L) < gregorianCutover)
+ // Is the leap-day a Julian date? Then it's a leap year
+ if (! isGregorian(year, 31 + 29 - 1))
return true;
+ // Apply gregorian rules otherwise
return ((year % 100) != 0 || (year % 400) == 0);
}
/**
- * Get the linear time in milliseconds since the epoch. If you
- * specify a nonpositive year it is interpreted as BC as
- * following: 0 is 1 BC, -1 is 2 BC and so on. The date is
- * interpreted as gregorian if the change occurred before that date.
- *
- * @param year the year of the date.
- * @param dayOfYear the day of year of the date; 1 based.
- * @param millis the millisecond in that day.
- * @return the days since the epoch, may be negative.
- */
- private long getLinearTime(int year, int dayOfYear, int millis)
- {
- // The 13 is the number of days, that were omitted in the Gregorian
- // Calendar until the epoch.
- // We shift right by 2 instead of dividing by 4, to get correct
- // results for negative years (and this is even more efficient).
- int julianDay = ((year * (365 * 4 + 1)) >> 2) + dayOfYear -
- ((1970 * (365 * 4 + 1)) / 4 + 1 - 13);
- long time = julianDay * (24 * 60 * 60 * 1000L) + millis;
-
- if (time >= gregorianCutover)
- {
- // subtract the days that are missing in gregorian calendar
- // with respect to julian calendar.
- //
- // Okay, here we rely on the fact that the gregorian
- // calendar was introduced in the AD era. This doesn't work
- // with negative years.
- //
- // The additional leap year factor accounts for the fact that
- // a leap day is not seen on Jan 1 of the leap year.
- // And on and after the leap day, the leap day has already been
- // included in dayOfYear.
- int gregOffset = (year / 400) - (year / 100) + 2;
- if (isLeapYear (year, true))
- --gregOffset;
- time += gregOffset * (24 * 60 * 60 * 1000L);
- }
- return time;
- }
-
- /**
* Retrieves the day of the week corresponding to the specified
* day of the specified year.
*
@@ -382,8 +352,8 @@ public class GregorianCalendar extends Calendar
*/
private int getWeekDay(int year, int dayOfYear)
{
- int day =
- (int) (getLinearTime(year, dayOfYear, 0) / (24 * 60 * 60 * 1000L));
+ boolean greg = isGregorian(year, dayOfYear);
+ int day = (int) getLinearDay(year, dayOfYear, greg);
// The epoch was a thursday.
int weekday = (day + THURSDAY) % 7;
@@ -393,234 +363,363 @@ public class GregorianCalendar extends Calendar
}
/**
- * <p>
- * Calculate the dayOfYear from the fields array.
- * The relativeDays is used, to account for weeks that begin before
- * the Gregorian change and end after it.
- * </p>
- * <p>
- * We return two values. The first is used to determine, if we
- * should use the Gregorian calendar or the Julian calendar, in order
- * to handle the change year. The second is a relative day after the given
- * day. This is necessary for week calculation in the year in
- * which the Gregorian change occurs.
- * </p>
- *
- * @param year the year, negative for BC.
- * @return an array of two integer values, the first containing a reference
- * day in the current year, the second a relative count since this reference
- * day.
+ * Returns the day of the week for the first day of a given month (0..11)
*/
- private int[] getDayOfYear(int year)
+ private int getFirstDayOfMonth(int year, int month)
{
- if (isSet[MONTH])
- {
- int dayOfYear;
- if (fields[MONTH] > FEBRUARY)
- {
+ int[] dayCount = { 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334 };
- // The months after February are regular:
- // 9 is an offset found by try and error.
- dayOfYear = (fields[MONTH] * (31 + 30 + 31 + 30 + 31) - 9) / 5;
- if (isLeapYear(year))
- dayOfYear++;
- }
- else
- dayOfYear = 31 * fields[MONTH];
+ if (month > 11)
+ {
+ year += (month / 12);
+ month = month % 12;
+ }
- if (isSet[DAY_OF_MONTH])
+ if (month < 0)
+ {
+ year += (int) month / 12;
+ month = month % 12;
+ if (month < 0)
{
- return new int[]
- {
- dayOfYear + fields[DAY_OF_MONTH], 0};
+ month += 12;
+ year--;
}
- if (isSet[WEEK_OF_MONTH] && isSet[DAY_OF_WEEK])
- {
- // the weekday of the first day in that month is:
- int weekday = getWeekDay(year, ++dayOfYear);
+ }
- return new int[]
- {
- dayOfYear,
- // the day of week in the first week
- // (weeks starting on sunday) is:
- fields[DAY_OF_WEEK] - weekday +
- // Now jump to the right week and correct the possible
- // error made by assuming sunday is the first week day.
- 7 * (fields[WEEK_OF_MONTH]
- + (fields[DAY_OF_WEEK] < getFirstDayOfWeek()? 0 : -1)
- + (weekday < getFirstDayOfWeek()? -1 : 0))};
- }
- if (isSet[DAY_OF_WEEK] && isSet[DAY_OF_WEEK_IN_MONTH])
- {
- // the weekday of the first day in that month is:
- int weekday = getWeekDay(year, ++dayOfYear);
- return new int[] {
- dayOfYear,
- fields[DAY_OF_WEEK] - weekday +
- 7 * (fields[DAY_OF_WEEK_IN_MONTH]
- + (fields[DAY_OF_WEEK] < weekday ? 0 : -1))};
- }
+ int dayOfYear = dayCount[month] + 1;
+ if (month > 1)
+ if (isLeapYear(year))
+ dayOfYear++;
+
+ boolean greg = isGregorian(year, dayOfYear);
+ int day = (int) getLinearDay(year, dayOfYear, greg);
+
+ // The epoch was a thursday.
+ int weekday = (day + THURSDAY) % 7;
+ if (weekday <= 0)
+ weekday += 7;
+ return weekday;
+ }
+
+ /**
+ * Takes a year, and a (zero based) day of year and determines
+ * if it is gregorian or not.
+ */
+ private boolean isGregorian(int year, int dayOfYear)
+ {
+ int relativeDay = (year - 1) * 365 + ((year - 1) >> 2) + dayOfYear
+ - EPOCH_DAYS; // gregorian days from 1 to epoch.
+ int gregFactor = (int) Math.floor((double) (year - 1) / 400.)
+ - (int) Math.floor((double) (year - 1) / 100.);
+
+ return ((relativeDay + gregFactor) * 60L * 60L * 24L * 1000L >= gregorianCutover);
+ }
+
+ /**
+ * Check set fields for validity, without leniency.
+ *
+ * @throws IllegalArgumentException if a field is invalid
+ */
+ private void nonLeniencyCheck() throws IllegalArgumentException
+ {
+ int[] month_days = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
+ int year = fields[YEAR];
+ int month = fields[MONTH];
+ int leap = isLeapYear(year) ? 1 : 0;
+
+ if (isSet[ERA] && fields[ERA] != AD && fields[ERA] != BC)
+ throw new IllegalArgumentException("Illegal ERA.");
+ if (isSet[YEAR] && fields[YEAR] < 1)
+ throw new IllegalArgumentException("Illegal YEAR.");
+ if (isSet[MONTH] && (month < 0 || month > 11))
+ throw new IllegalArgumentException("Illegal MONTH.");
+ if (isSet[WEEK_OF_YEAR])
+ {
+ int daysInYear = 365 + leap;
+ daysInYear += (getFirstDayOfMonth(year, 0) - 1); // pad first week
+ int last = getFirstDayOfMonth(year, 11) + 4;
+ if (last > 7)
+ last -= 7;
+ daysInYear += 7 - last;
+ int weeks = daysInYear / 7;
+ if (fields[WEEK_OF_YEAR] < 1 || fields[WEEK_OF_YEAR] > weeks)
+ throw new IllegalArgumentException("Illegal WEEK_OF_YEAR.");
}
- // MONTH + something did not succeed.
- if (isSet[DAY_OF_YEAR])
+ if (isSet[WEEK_OF_MONTH])
{
- return new int[] {0, fields[DAY_OF_YEAR]};
+ int weeks = (month == 1 && leap == 0) ? 4 : 5;
+ if (fields[WEEK_OF_MONTH] < 1 || fields[WEEK_OF_MONTH] > weeks)
+ throw new IllegalArgumentException("Illegal WEEK_OF_MONTH.");
}
-
- if (isSet[DAY_OF_WEEK] && isSet[WEEK_OF_YEAR])
+
+ if (isSet[DAY_OF_MONTH])
+ if (fields[DAY_OF_MONTH] < 1
+ || fields[DAY_OF_MONTH] > month_days[month]
+ + ((month == 1) ? leap : 0))
+ throw new IllegalArgumentException("Illegal DAY_OF_MONTH.");
+
+ if (isSet[DAY_OF_YEAR]
+ && (fields[DAY_OF_YEAR] < 1 || fields[DAY_OF_YEAR] > 365 + leap))
+ throw new IllegalArgumentException("Illegal DAY_OF_YEAR.");
+
+ if (isSet[DAY_OF_WEEK]
+ && (fields[DAY_OF_WEEK] < 1 || fields[DAY_OF_WEEK] > 7))
+ throw new IllegalArgumentException("Illegal DAY_OF_WEEK.");
+
+ if (isSet[DAY_OF_WEEK_IN_MONTH])
{
- int dayOfYear = getMinimalDaysInFirstWeek();
- // the weekday of the day, that begins the first week
- // in that year is:
- int weekday = getWeekDay(year, dayOfYear);
-
- return new int[] {
- dayOfYear,
- // the day of week in the first week
- // (weeks starting on sunday) is:
- fields[DAY_OF_WEEK] - weekday
- // Now jump to the right week and correct the possible
- // error made by assuming sunday is the first week day.
- + 7 * (fields[WEEK_OF_YEAR]
- + (fields[DAY_OF_WEEK] < getFirstDayOfWeek()? 0 : -1)
- + (weekday < getFirstDayOfWeek()? -1 : 0))};
+ int weeks = (month == 1 && leap == 0) ? 4 : 5;
+ if (fields[DAY_OF_WEEK_IN_MONTH] < -weeks
+ || fields[DAY_OF_WEEK_IN_MONTH] > weeks)
+ throw new IllegalArgumentException("Illegal DAY_OF_WEEK_IN_MONTH.");
}
- // As last resort return Jan, 1st.
- return new int[] {1, 0};
+ if (isSet[AM_PM] && fields[AM_PM] != AM && fields[AM_PM] != PM)
+ throw new IllegalArgumentException("Illegal AM_PM.");
+ if (isSet[HOUR] && (fields[HOUR] < 0 || fields[HOUR] > 11))
+ throw new IllegalArgumentException("Illegal HOUR.");
+ if (isSet[HOUR_OF_DAY]
+ && (fields[HOUR_OF_DAY] < 0 || fields[HOUR_OF_DAY] > 23))
+ throw new IllegalArgumentException("Illegal HOUR_OF_DAY.");
+ if (isSet[MINUTE] && (fields[MINUTE] < 0 || fields[MINUTE] > 59))
+ throw new IllegalArgumentException("Illegal MINUTE.");
+ if (isSet[SECOND] && (fields[SECOND] < 0 || fields[SECOND] > 59))
+ throw new IllegalArgumentException("Illegal SECOND.");
+ if (isSet[MILLISECOND]
+ && (fields[MILLISECOND] < 0 || fields[MILLISECOND] > 999))
+ throw new IllegalArgumentException("Illegal MILLISECOND.");
+ if (isSet[ZONE_OFFSET]
+ && (fields[ZONE_OFFSET] < -12 * 60 * 60 * 1000L
+ || fields[ZONE_OFFSET] > 12 * 60 * 60 * 1000L))
+ throw new IllegalArgumentException("Illegal ZONE_OFFSET.");
+ if (isSet[DST_OFFSET]
+ && (fields[DST_OFFSET] < -12 * 60 * 60 * 1000L
+ || fields[DST_OFFSET] > 12 * 60 * 60 * 1000L))
+ throw new IllegalArgumentException("Illegal DST_OFFSET.");
}
/**
* Converts the time field values (<code>fields</code>) to
- * milliseconds since the epoch UTC (<code>time</code>).
+ * milliseconds since the epoch UTC (<code>time</code>).
*
* @throws IllegalArgumentException if any calendar fields
* are invalid.
*/
protected synchronized void computeTime()
{
- int era = isSet[ERA] ? fields[ERA] : AD;
- int year = isSet[YEAR] ? fields[YEAR] : 1970;
- if (era == BC)
- year = 1 - year;
+ int millisInDay = 0;
+ int era = fields[ERA];
+ int year = fields[YEAR];
+ int month = fields[MONTH];
+ int day = fields[DAY_OF_MONTH];
+
+ int minute = fields[MINUTE];
+ int second = fields[SECOND];
+ int millis = fields[MILLISECOND];
+ int[] month_days = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
+ int[] dayCount = { 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334 };
+ int hour = 0;
- int[] daysOfYear = getDayOfYear(year);
+ if (! isLenient())
+ nonLeniencyCheck();
- int hour = 0;
- if (isSet[HOUR_OF_DAY])
- hour = fields[HOUR_OF_DAY];
- else if (isSet[HOUR])
+ if (! isSet[MONTH] && (! isSet[DAY_OF_WEEK] || isSet[WEEK_OF_YEAR]))
{
- hour = fields[HOUR];
- if (isSet[AM_PM] && fields[AM_PM] == PM)
- if (hour != 12) /* not Noon */
- hour += 12;
- /* Fix the problem of the status of 12:00 AM (midnight). */
- if (isSet[AM_PM] && fields[AM_PM] == AM && hour == 12)
- hour = 0;
+ // 5: YEAR + DAY_OF_WEEK + WEEK_OF_YEAR
+ if (isSet[WEEK_OF_YEAR])
+ {
+ int first = getFirstDayOfMonth(year, 0);
+ int offs = 1;
+ int daysInFirstWeek = getFirstDayOfWeek() - first;
+ if (daysInFirstWeek <= 0)
+ daysInFirstWeek += 7;
+
+ if (daysInFirstWeek < getMinimalDaysInFirstWeek())
+ offs += daysInFirstWeek;
+ else
+ offs -= 7 - daysInFirstWeek;
+ month = 0;
+ day = offs + 7 * (fields[WEEK_OF_YEAR] - 1);
+ offs = fields[DAY_OF_WEEK] - getFirstDayOfWeek();
+
+ if (offs < 0)
+ offs += 7;
+ day += offs;
+ }
+ else
+ {
+ // 4: YEAR + DAY_OF_YEAR
+ month = 0;
+ day = fields[DAY_OF_YEAR];
+ }
}
+ else
+ {
+ if (isSet[DAY_OF_WEEK])
+ {
+ int first = getFirstDayOfMonth(year, month);
+
+ // 3: YEAR + MONTH + DAY_OF_WEEK_IN_MONTH + DAY_OF_WEEK
+ if (isSet[DAY_OF_WEEK_IN_MONTH])
+ {
+ if (fields[DAY_OF_WEEK_IN_MONTH] < 0)
+ {
+ month++;
+ first = getFirstDayOfMonth(year, month);
+ day = 1 + 7 * (fields[DAY_OF_WEEK_IN_MONTH]);
+ }
+ else
+ day = 1 + 7 * (fields[DAY_OF_WEEK_IN_MONTH] - 1);
+
+ int offs = fields[DAY_OF_WEEK] - first;
+ if (offs < 0)
+ offs += 7;
+ day += offs;
+ }
+ else
+ { // 2: YEAR + MONTH + WEEK_OF_MONTH + DAY_OF_WEEK
+ int offs = 1;
+ int daysInFirstWeek = getFirstDayOfWeek() - first;
+ if (daysInFirstWeek <= 0)
+ daysInFirstWeek += 7;
+
+ if (daysInFirstWeek < getMinimalDaysInFirstWeek())
+ offs += daysInFirstWeek;
+ else
+ offs -= 7 - daysInFirstWeek;
+
+ day = offs + 7 * (fields[WEEK_OF_MONTH] - 1);
+ offs = fields[DAY_OF_WEEK] - getFirstDayOfWeek();
+ if (offs <= 0)
+ offs += 7;
+ day += offs;
+ }
+ }
- int minute = isSet[MINUTE] ? fields[MINUTE] : 0;
- int second = isSet[SECOND] ? fields[SECOND] : 0;
- int millis = isSet[MILLISECOND] ? fields[MILLISECOND] : 0;
- int millisInDay;
+ // 1: YEAR + MONTH + DAY_OF_MONTH
+ }
+ if (era == BC && year > 0)
+ year = 1 - year;
- if (isLenient())
+ // rest of code assumes day/month/year set
+ // should negative BC years be AD?
+ // get the hour (but no check for validity)
+ if (isSet[HOUR])
{
- // prevent overflow
- long allMillis = (((hour * 60L) + minute) * 60L + second) * 1000L
- + millis;
- daysOfYear[1] += allMillis / (24 * 60 * 60 * 1000L);
- millisInDay = (int) (allMillis % (24 * 60 * 60 * 1000L));
+ hour = fields[HOUR];
+ if (fields[AM_PM] == PM)
+ hour += 12;
}
else
+ hour = fields[HOUR_OF_DAY];
+
+ // Read the era,year,month,day fields and convert as appropriate.
+ // Calculate number of milliseconds into the day
+ // This takes care of both h, m, s, ms over/underflows.
+ long allMillis = (((hour * 60L) + minute) * 60L + second) * 1000L + millis;
+ day += allMillis / (24 * 60 * 60 * 1000L);
+ millisInDay = (int) (allMillis % (24 * 60 * 60 * 1000L));
+
+ if (month < 0)
+ {
+ year += (int) month / 12;
+ month = month % 12;
+ if (month < 0)
+ {
+ month += 12;
+ year--;
+ }
+ }
+ if (month > 11)
{
- if (hour < 0 || hour >= 24 || minute < 0 || minute > 59
- || second < 0 || second > 59 || millis < 0 || millis >= 1000)
- throw new IllegalArgumentException();
- millisInDay = (((hour * 60) + minute) * 60 + second) * 1000 + millis;
+ year += (month / 12);
+ month = month % 12;
}
- time = getLinearTime(year, daysOfYear[0], millisInDay);
- // Add the relative days after calculating the linear time, to
- // get right behaviour when jumping over the gregorianCutover.
- time += daysOfYear[1] * (24 * 60 * 60 * 1000L);
+ month_days[1] = isLeapYear(year) ? 29 : 28;
+ while (day <= 0)
+ {
+ if (month == 0)
+ {
+ year--;
+ month_days[1] = isLeapYear(year) ? 29 : 28;
+ }
+ month = (month + 11) % 12;
+ day += month_days[month];
+ }
+ while (day > month_days[month])
+ {
+ day -= (month_days[month]);
+ month = (month + 1) % 12;
+ if (month == 0)
+ {
+ year++;
+ month_days[1] = isLeapYear(year) ? 29 : 28;
+ }
+ }
- TimeZone zone = getTimeZone();
- int rawOffset = isSet[ZONE_OFFSET]
- ? fields[ZONE_OFFSET] : zone.getRawOffset();
-
- int dayOfYear = daysOfYear[0] + daysOfYear[1];
- // This formula isn't right, so check for month as a quick fix.
- // It doesn't compensate for leap years and puts day 30 in month 1
- // instead of month 0.
- int month = isSet[MONTH]
- ? fields[MONTH] : (dayOfYear * 5 + 3) / (31 + 30 + 31 + 30 + 31);
- // This formula isn't right, so check for day as a quick fix. It
- // doesn't compensate for leap years, either.
- int day = isSet[DAY_OF_MONTH] ? fields[DAY_OF_MONTH]
- : (6 + (dayOfYear * 5 + 3) % (31 + 30 + 31 + 30 + 31)) / 5;
- int weekday = ((int) (time / (24 * 60 * 60 * 1000L)) + THURSDAY) % 7;
+ // ok, by here we have valid day,month,year,era and millisinday
+ int dayOfYear = dayCount[month] + day - 1; // (day starts on 1)
+ if (isLeapYear(year) && month > 1)
+ dayOfYear++;
+
+ int relativeDay = (year - 1) * 365 + ((year - 1) >> 2) + dayOfYear
+ - EPOCH_DAYS; // gregorian days from 1 to epoch.
+ int gregFactor = (int) Math.floor((double) (year - 1) / 400.)
+ - (int) Math.floor((double) (year - 1) / 100.);
+
+ if ((relativeDay + gregFactor) * 60L * 60L * 24L * 1000L >= gregorianCutover)
+ relativeDay += gregFactor;
+ else
+ relativeDay -= 2;
+
+ time = relativeDay * (24 * 60 * 60 * 1000L) + millisInDay;
+
+ // the epoch was a Thursday.
+ int weekday = (int) (relativeDay + THURSDAY) % 7;
if (weekday <= 0)
weekday += 7;
- int dstOffset = isSet[DST_OFFSET]
- ? fields[DST_OFFSET] : (zone.getOffset((year < 0) ? BC : AD,
- (year < 0) ? 1 - year : year,
- month, day, weekday, millisInDay)
- - zone.getRawOffset());
- time -= rawOffset + dstOffset;
- isTimeSet = true;
- }
+ fields[DAY_OF_WEEK] = weekday;
- /**
- * <p>
- * Determines if the given year is a leap year.
- * </p>
- * <p>
- * To specify a year in the BC era, use a negative value calculated
- * as 1 - y, where y is the required year in BC. So, 1 BC is 0,
- * 2 BC is -1, 3 BC is -2, etc.
- * </p>
- *
- * @param year a year (use a negative value for BC).
- * @param gregorian if true, use the gregorian leap year rule.
- * @return true, if the given year is a leap year, false otherwise.
- */
- private boolean isLeapYear(int year, boolean gregorian)
- {
- if ((year & 3) != 0)
- // Only years divisible by 4 can be leap years
- return false;
+ // Time zone corrections.
+ TimeZone zone = getTimeZone();
+ int rawOffset = isSet[ZONE_OFFSET] ? fields[ZONE_OFFSET]
+ : zone.getRawOffset();
- if (!gregorian)
- return true;
+ int dstOffset = isSet[DST_OFFSET] ? fields[DST_OFFSET]
+ : (zone.getOffset((year < 0) ? BC : AD,
+ (year < 0) ? 1 - year
+ : year,
+ month, day, weekday,
+ millisInDay)
+ - zone.getRawOffset());
- // We rely on AD area here.
- return ((year % 100) != 0 || (year % 400) == 0);
+ time -= rawOffset + dstOffset;
+
+ isTimeSet = true;
}
/**
* Get the linear day in days since the epoch, using the
* Julian or Gregorian calendar as specified. If you specify a
* nonpositive year it is interpreted as BC as following: 0 is 1
- * BC, -1 is 2 BC and so on.
+ * BC, -1 is 2 BC and so on.
*
* @param year the year of the date.
* @param dayOfYear the day of year of the date; 1 based.
* @param gregorian <code>true</code>, if we should use the Gregorian rules.
* @return the days since the epoch, may be negative.
*/
- private int getLinearDay(int year, int dayOfYear, boolean gregorian)
+ private long getLinearDay(int year, int dayOfYear, boolean gregorian)
{
// The 13 is the number of days, that were omitted in the Gregorian
// Calender until the epoch.
// We shift right by 2 instead of dividing by 4, to get correct
// results for negative years (and this is even more efficient).
- int julianDay = ((year * (365 * 4 + 1)) >> 2) + dayOfYear -
- ((1970 * (365 * 4 + 1)) / 4 + 1 - 13);
+ long julianDay = (year - 1) * 365L + ((year - 1) >> 2) + (dayOfYear - 1)
+ - EPOCH_DAYS; // gregorian days from 1 to epoch.
if (gregorian)
{
@@ -633,11 +732,13 @@ public class GregorianCalendar extends Calendar
//
// The additional leap year factor accounts for the fact that
// a leap day is not seen on Jan 1 of the leap year.
- int gregOffset = (year / 400) - (year / 100) + 2;
- if (isLeapYear (year, true) && dayOfYear < 31 + 29)
- --gregOffset;
- julianDay += gregOffset;
+ int gregOffset = (int) Math.floor((double) (year - 1) / 400.)
+ - (int) Math.floor((double) (year - 1) / 100.);
+
+ return julianDay + gregOffset;
}
+ else
+ julianDay -= 2;
return julianDay;
}
@@ -646,26 +747,27 @@ public class GregorianCalendar extends Calendar
* day_of_year, day_of_month, day_of_week, and writes the result
* into the fields array.
*
- * @param day the linear day.
+ * @param day the linear day.
* @param gregorian true, if we should use Gregorian rules.
*/
- private void calculateDay(int day, boolean gregorian)
+ private void calculateDay(int[] fields, long day, boolean gregorian)
{
- // the epoch is a Thursday.
- int weekday = (day + THURSDAY) % 7;
+ // the epoch was a Thursday.
+ int weekday = (int) (day + THURSDAY) % 7;
if (weekday <= 0)
weekday += 7;
fields[DAY_OF_WEEK] = weekday;
// get a first approximation of the year. This may be one
// year too big.
- int year = 1970 + (gregorian
- ? ((day - 100) * 400) / (365 * 400 + 100 - 4 + 1)
- : ((day - 100) * 4) / (365 * 4 + 1));
+ int year = 1970
+ + (int) (gregorian
+ ? ((day - 100L) * 400L) / (365L * 400L + 100L - 4L
+ + 1L) : ((day - 100L) * 4L) / (365L * 4L + 1L));
if (day >= 0)
year++;
- int firstDayOfYear = getLinearDay(year, 1, gregorian);
+ long firstDayOfYear = getLinearDay(year, 1, gregorian);
// Now look in which year day really lies.
if (day < firstDayOfYear)
@@ -674,9 +776,9 @@ public class GregorianCalendar extends Calendar
firstDayOfYear = getLinearDay(year, 1, gregorian);
}
- day -= firstDayOfYear - 1; // day of year, one based.
+ day -= firstDayOfYear - 1; // day of year, one based.
- fields[DAY_OF_YEAR] = day;
+ fields[DAY_OF_YEAR] = (int) day;
if (year <= 0)
{
fields[ERA] = BC;
@@ -688,16 +790,16 @@ public class GregorianCalendar extends Calendar
fields[YEAR] = year;
}
- int leapday = isLeapYear(year, gregorian) ? 1 : 0;
+ int leapday = isLeapYear(year) ? 1 : 0;
if (day <= 31 + 28 + leapday)
{
- fields[MONTH] = day / 32; // 31->JANUARY, 32->FEBRUARY
- fields[DAY_OF_MONTH] = day - 31 * fields[MONTH];
+ fields[MONTH] = (int) day / 32; // 31->JANUARY, 32->FEBRUARY
+ fields[DAY_OF_MONTH] = (int) day - 31 * fields[MONTH];
}
else
{
// A few more magic formulas
- int scaledDay = (day - leapday) * 5 + 8;
+ int scaledDay = ((int) day - leapday) * 5 + 8;
fields[MONTH] = scaledDay / (31 + 30 + 31 + 30 + 31);
fields[DAY_OF_MONTH] = (scaledDay % (31 + 30 + 31 + 30 + 31)) / 5 + 1;
}
@@ -716,25 +818,26 @@ public class GregorianCalendar extends Calendar
fields[ZONE_OFFSET] = zone.getRawOffset();
long localTime = time + fields[ZONE_OFFSET];
- int day = (int) (localTime / (24 * 60 * 60 * 1000L));
+ long day = localTime / (24 * 60 * 60 * 1000L);
int millisInDay = (int) (localTime % (24 * 60 * 60 * 1000L));
+
if (millisInDay < 0)
{
millisInDay += (24 * 60 * 60 * 1000);
day--;
}
- calculateDay(day, gregorian);
- fields[DST_OFFSET] =
- zone.getOffset(fields[ERA], fields[YEAR], fields[MONTH],
- fields[DAY_OF_MONTH], fields[DAY_OF_WEEK],
- millisInDay) - fields[ZONE_OFFSET];
+ calculateDay(fields, day, gregorian);
+ fields[DST_OFFSET] = zone.getOffset(fields[ERA], fields[YEAR],
+ fields[MONTH], fields[DAY_OF_MONTH],
+ fields[DAY_OF_WEEK], millisInDay)
+ - fields[ZONE_OFFSET];
millisInDay += fields[DST_OFFSET];
if (millisInDay >= 24 * 60 * 60 * 1000)
{
millisInDay -= 24 * 60 * 60 * 1000;
- calculateDay(++day, gregorian);
+ calculateDay(fields, ++day, gregorian);
}
fields[DAY_OF_WEEK_IN_MONTH] = (fields[DAY_OF_MONTH] + 6) / 7;
@@ -749,17 +852,16 @@ public class GregorianCalendar extends Calendar
// Do the Correction: getMinimalDaysInFirstWeek() is always in the
// first week.
int minDays = getMinimalDaysInFirstWeek();
- int firstWeekday =
- (7 + getWeekDay(fields[YEAR], minDays) - getFirstDayOfWeek()) % 7;
+ int firstWeekday = (7 + getWeekDay(fields[YEAR], minDays)
+ - getFirstDayOfWeek()) % 7;
if (minDays - firstWeekday < 1)
weekOfYear++;
fields[WEEK_OF_YEAR] = weekOfYear;
-
int hourOfDay = millisInDay / (60 * 60 * 1000);
fields[AM_PM] = (hourOfDay < 12) ? AM : PM;
int hour = hourOfDay % 12;
- fields[HOUR] = (hour == 0) ? 12 : hour;
+ fields[HOUR] = hour;
fields[HOUR_OF_DAY] = hourOfDay;
millisInDay %= (60 * 60 * 1000);
fields[MINUTE] = millisInDay / (60 * 1000);
@@ -767,14 +869,7 @@ public class GregorianCalendar extends Calendar
fields[SECOND] = millisInDay / (1000);
fields[MILLISECOND] = millisInDay % 1000;
-
- areFieldsSet = isSet[ERA] = isSet[YEAR] = isSet[MONTH] =
- isSet[WEEK_OF_YEAR] = isSet[WEEK_OF_MONTH] =
- isSet[DAY_OF_MONTH] = isSet[DAY_OF_YEAR] = isSet[DAY_OF_WEEK] =
- isSet[DAY_OF_WEEK_IN_MONTH] = isSet[AM_PM] = isSet[HOUR] =
- isSet[HOUR_OF_DAY] = isSet[MINUTE] = isSet[SECOND] =
- isSet[MILLISECOND] = isSet[ZONE_OFFSET] = isSet[DST_OFFSET] = true;
-
+ areFieldsSet = isSet[ERA] = isSet[YEAR] = isSet[MONTH] = isSet[WEEK_OF_YEAR] = isSet[WEEK_OF_MONTH] = isSet[DAY_OF_MONTH] = isSet[DAY_OF_YEAR] = isSet[DAY_OF_WEEK] = isSet[DAY_OF_WEEK_IN_MONTH] = isSet[AM_PM] = isSet[HOUR] = isSet[HOUR_OF_DAY] = isSet[MINUTE] = isSet[SECOND] = isSet[MILLISECOND] = isSet[ZONE_OFFSET] = isSet[DST_OFFSET] = true;
}
/**
@@ -782,7 +877,7 @@ public class GregorianCalendar extends Calendar
* equivalent to this if it is also a <code>GregorianCalendar</code>
* with the same time since the epoch under the same conditions
* (same change date and same time zone).
- *
+ *
* @param o the object to that we should compare.
* @return true, if the given object is a calendar, that represents
* the same time (but doesn't necessarily have the same fields).
@@ -794,48 +889,20 @@ public class GregorianCalendar extends Calendar
*/
public boolean equals(Object o)
{
- if (!(o instanceof GregorianCalendar))
+ if (! (o instanceof GregorianCalendar))
return false;
GregorianCalendar cal = (GregorianCalendar) o;
return (cal.getTimeInMillis() == getTimeInMillis());
}
-// /**
-// * Compares the given calender with this.
-// * @param o the object to that we should compare.
-// * @return true, if the given object is a calendar, and this calendar
-// * represents a smaller time than the calender o.
-// */
-// public boolean before(Object o) {
-// if (!(o instanceof GregorianCalendar))
-// return false;
-
-// GregorianCalendar cal = (GregorianCalendar) o;
-// return (cal.getTimeInMillis() < getTimeInMillis());
-// }
-
-// /**
-// * Compares the given calender with this.
-// * @param o the object to that we should compare.
-// * @return true, if the given object is a calendar, and this calendar
-// * represents a bigger time than the calender o.
-// */
-// public boolean after(Object o) {
-// if (!(o instanceof GregorianCalendar))
-// return false;
-
-// GregorianCalendar cal = (GregorianCalendar) o;
-// return (cal.getTimeInMillis() > getTimeInMillis());
-// }
-
/**
* Adds the specified amount of time to the given time field. The
* amount may be negative to subtract the time. If the field overflows
* it does what you expect: Jan, 25 + 10 Days is Feb, 4.
* @param field one of the time field constants.
* @param amount the amount of time to add.
- * @exception IllegalArgumentException if <code>field</code> is
+ * @exception IllegalArgumentException if <code>field</code> is
* <code>ZONE_OFFSET</code>, <code>DST_OFFSET</code>, or invalid; or
* if <code>amount</code> contains an out-of-range value and the calendar
* is not in lenient mode.
@@ -859,18 +926,16 @@ public class GregorianCalendar extends Calendar
fields[MONTH] += 12;
fields[YEAR]--;
}
- isTimeSet = false;
int maxDay = getActualMaximum(DAY_OF_MONTH);
if (fields[DAY_OF_MONTH] > maxDay)
- {
- fields[DAY_OF_MONTH] = maxDay;
- isTimeSet = false;
- }
+ fields[DAY_OF_MONTH] = maxDay;
+ set(YEAR, fields[YEAR]);
+ set(MONTH, fields[MONTH]);
break;
case DAY_OF_MONTH:
case DAY_OF_YEAR:
case DAY_OF_WEEK:
- if (!isTimeSet)
+ if (! isTimeSet)
computeTime();
time += amount * (24 * 60 * 60 * 1000L);
areFieldsSet = false;
@@ -878,59 +943,57 @@ public class GregorianCalendar extends Calendar
case WEEK_OF_YEAR:
case WEEK_OF_MONTH:
case DAY_OF_WEEK_IN_MONTH:
- if (!isTimeSet)
+ if (! isTimeSet)
computeTime();
time += amount * (7 * 24 * 60 * 60 * 1000L);
areFieldsSet = false;
break;
case AM_PM:
- if (!isTimeSet)
+ if (! isTimeSet)
computeTime();
time += amount * (12 * 60 * 60 * 1000L);
areFieldsSet = false;
break;
case HOUR:
case HOUR_OF_DAY:
- if (!isTimeSet)
+ if (! isTimeSet)
computeTime();
time += amount * (60 * 60 * 1000L);
areFieldsSet = false;
break;
case MINUTE:
- if (!isTimeSet)
+ if (! isTimeSet)
computeTime();
time += amount * (60 * 1000L);
areFieldsSet = false;
break;
case SECOND:
- if (!isTimeSet)
+ if (! isTimeSet)
computeTime();
time += amount * (1000L);
areFieldsSet = false;
break;
case MILLISECOND:
- if (!isTimeSet)
+ if (! isTimeSet)
computeTime();
time += amount;
areFieldsSet = false;
break;
case ZONE_OFFSET:
- case DST_OFFSET:
- default:
+ case DST_OFFSET:default:
throw new IllegalArgumentException("Invalid or unknown field");
}
}
-
/**
* Rolls the specified time field up or down. This means add one
* to the specified field, but don't change the other fields. If
- * the maximum for this field is reached, start over with the
- * minimum value.
+ * the maximum for this field is reached, start over with the
+ * minimum value.
*
* <strong>Note:</strong> There may be situation, where the other
- * fields must be changed, e.g rolling the month on May, 31.
- * The date June, 31 is automatically converted to July, 1.
+ * fields must be changed, e.g rolling the month on May, 31.
+ * The date June, 31 is automatically converted to July, 1.
* This requires lenient settings.
*
* @param field the time field. One of the time field constants.
@@ -972,7 +1035,6 @@ public class GregorianCalendar extends Calendar
isSet[DAY_OF_YEAR] = false;
isSet[WEEK_OF_YEAR] = false;
break;
-
case DAY_OF_MONTH:
isSet[WEEK_OF_MONTH] = false;
isSet[DAY_OF_WEEK] = false;
@@ -981,7 +1043,6 @@ public class GregorianCalendar extends Calendar
isSet[WEEK_OF_YEAR] = false;
time += delta * (24 * 60 * 60 * 1000L);
break;
-
case WEEK_OF_MONTH:
isSet[DAY_OF_MONTH] = false;
isSet[DAY_OF_WEEK_IN_MONTH] = false;
@@ -1013,7 +1074,6 @@ public class GregorianCalendar extends Calendar
isSet[DAY_OF_YEAR] = false;
time += delta * (7 * 24 * 60 * 60 * 1000L);
break;
-
case AM_PM:
isSet[HOUR_OF_DAY] = false;
time += delta * (12 * 60 * 60 * 1000L);
@@ -1027,7 +1087,6 @@ public class GregorianCalendar extends Calendar
isSet[AM_PM] = false;
time += delta * (60 * 60 * 1000L);
break;
-
case MINUTE:
time += delta * (60 * 1000L);
break;
@@ -1047,7 +1106,7 @@ public class GregorianCalendar extends Calendar
* with the minimum value and vice versa for negative amounts.
*
* <strong>Note:</strong> There may be situation, where the other
- * fields must be changed, e.g rolling the month on May, 31.
+ * fields must be changed, e.g rolling the month on May, 31.
* The date June, 31 is automatically corrected to June, 30.
*
* @param field the time field. One of the time field constants.
@@ -1084,16 +1143,23 @@ public class GregorianCalendar extends Calendar
/**
* The minimum values for the calendar fields.
*/
- private static final int[] minimums =
- { BC, 1, 0, 0, 1, 1, 1, SUNDAY, 1,
- AM, 1, 0, 1, 1, 1, -(12*60*60*1000), 0 };
+ private static final int[] minimums =
+ {
+ BC, 1, 0, 0, 1, 1, 1, SUNDAY, 1, AM,
+ 1, 0, 0, 0, 0, -(12 * 60 * 60 * 1000),
+ 0
+ };
/**
* The maximum values for the calendar fields.
*/
- private static final int[] maximums =
- { AD, 5000000, 11, 53, 5, 31, 366, SATURDAY, 5,
- PM, 12, 23, 59, 59, 999, +(12*60*60*1000), (12*60*60*1000) };
+ private static final int[] maximums =
+ {
+ AD, 5000000, 11, 53, 5, 31, 366,
+ SATURDAY, 5, PM, 12, 23, 59, 59, 999,
+ +(12 * 60 * 60 * 1000),
+ (12 * 60 * 60 * 1000)
+ };
/**
* Gets the smallest value that is allowed for the specified field.
@@ -1117,7 +1183,6 @@ public class GregorianCalendar extends Calendar
return maximums[field];
}
-
/**
* Gets the greatest minimum value that is allowed for the specified field.
* This is the largest value returned by the <code>getActualMinimum(int)</code>
@@ -1142,7 +1207,7 @@ public class GregorianCalendar extends Calendar
* 28 days).
*
* @param field the time field. One of the time field constants.
- * @return the least maximum value.
+ * @return the least maximum value.
* @see #getActualMaximum(int)
* @since 1.2
*/
@@ -1182,7 +1247,7 @@ public class GregorianCalendar extends Calendar
int min = getMinimalDaysInFirstWeek();
if (min == 0)
return 1;
- if (!areFieldsSet || !isSet[ERA] || !isSet[YEAR])
+ if (! areFieldsSet || ! isSet[ERA] || ! isSet[YEAR])
complete();
int year = fields[ERA] == AD ? fields[YEAR] : 1 - fields[YEAR];
@@ -1203,45 +1268,46 @@ public class GregorianCalendar extends Calendar
* 29, rather than 28.
*
* @param field the time field. One of the time field constants.
- * @return the actual maximum value.
+ * @return the actual maximum value.
*/
public int getActualMaximum(int field)
{
switch (field)
{
case WEEK_OF_YEAR:
- {
- if (!areFieldsSet || !isSet[ERA] || !isSet[YEAR])
+ {
+ if (! areFieldsSet || ! isSet[ERA] || ! isSet[YEAR])
complete();
+
// This is wrong for the year that contains the gregorian change.
// I.e it gives the weeks in the julian year or in the gregorian
// year in that case.
int year = fields[ERA] == AD ? fields[YEAR] : 1 - fields[YEAR];
int lastDay = isLeapYear(year) ? 366 : 365;
int weekday = getWeekDay(year, lastDay);
- int week = (lastDay + 6
- - (7 + weekday - getFirstDayOfWeek()) % 7) / 7;
+ int week = (lastDay + 6 - (7 + weekday - getFirstDayOfWeek()) % 7) / 7;
int minimalDays = getMinimalDaysInFirstWeek();
int firstWeekday = getWeekDay(year, minimalDays);
- /*
+ /*
* Is there a set of days at the beginning of the year, before the
* first day of the week, equal to or greater than the minimum number
* of days required in the first week?
*/
if (minimalDays - (7 + firstWeekday - getFirstDayOfWeek()) % 7 < 1)
return week + 1; /* Add week 1: firstWeekday through to firstDayOfWeek */
- }
- case DAY_OF_MONTH:
- {
- if (!areFieldsSet || !isSet[MONTH])
+ }
+ case DAY_OF_MONTH:
+ {
+ if (! areFieldsSet || ! isSet[MONTH])
complete();
int month = fields[MONTH];
+
// If you change this, you should also change
// SimpleTimeZone.getDaysInMonth();
if (month == FEBRUARY)
{
- if (!isSet[YEAR] || !isSet[ERA])
+ if (! isSet[YEAR] || ! isSet[ERA])
complete();
int year = fields[ERA] == AD ? fields[YEAR] : 1 - fields[YEAR];
return isLeapYear(year) ? 29 : 28;
@@ -1250,33 +1316,31 @@ public class GregorianCalendar extends Calendar
return 31 - (month & 1);
else
return 30 + (month & 1);
- }
+ }
case DAY_OF_YEAR:
- {
- if (!areFieldsSet || !isSet[ERA] || !isSet[YEAR])
+ {
+ if (! areFieldsSet || ! isSet[ERA] || ! isSet[YEAR])
complete();
int year = fields[ERA] == AD ? fields[YEAR] : 1 - fields[YEAR];
return isLeapYear(year) ? 366 : 365;
- }
+ }
case DAY_OF_WEEK_IN_MONTH:
- {
+ {
// This is wrong for the month that contains the gregorian change.
int daysInMonth = getActualMaximum(DAY_OF_MONTH);
+
// That's black magic, I know
return (daysInMonth - (fields[DAY_OF_MONTH] - 1) % 7 + 6) / 7;
- }
+ }
case WEEK_OF_MONTH:
- {
+ {
int daysInMonth = getActualMaximum(DAY_OF_MONTH);
int weekday = (daysInMonth - fields[DAY_OF_MONTH]
- + fields[DAY_OF_WEEK] - SUNDAY) % 7 + SUNDAY;
- return (daysInMonth + 6
- - (7 + weekday - getFirstDayOfWeek()) % 7) / 7;
- }
+ + fields[DAY_OF_WEEK] - SUNDAY) % 7 + SUNDAY;
+ return (daysInMonth + 6 - (7 + weekday - getFirstDayOfWeek()) % 7) / 7;
+ }
default:
return maximums[field];
}
}
-
-
}
diff --git a/libjava/java/util/HashMap.java b/libjava/java/util/HashMap.java
index fe4c8b06022..5265daf7a85 100644
--- a/libjava/java/util/HashMap.java
+++ b/libjava/java/util/HashMap.java
@@ -1,6 +1,6 @@
/* HashMap.java -- a class providing a basic hashtable data structure,
mapping Object --> Object
- Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -85,7 +85,7 @@ import java.io.Serializable;
* @author Jon Zeppieri
* @author Jochen Hoenicke
* @author Bryce McKinlay
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Eric Blake (ebb9@email.byu.edu)
* @see Object#hashCode()
* @see Collection
* @see Map
@@ -160,7 +160,7 @@ public class HashMap extends AbstractMap
* Class to represent an entry in the hash table. Holds a single key-value
* pair. Package visible for use by subclass.
*
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Eric Blake (ebb9@email.byu.edu)
*/
static class HashEntry extends AbstractMap.BasicMapEntry
{
diff --git a/libjava/java/util/HashSet.java b/libjava/java/util/HashSet.java
index caad3ad16e7..4b6d1270406 100644
--- a/libjava/java/util/HashSet.java
+++ b/libjava/java/util/HashSet.java
@@ -1,5 +1,5 @@
/* HashSet.java -- a class providing a HashMap-backed Set
- Copyright (C) 1998, 1999, 2001, 2004 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2001, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -66,7 +66,7 @@ import java.io.Serializable;
* non-deterministic behavior.
*
* @author Jon Zeppieri
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Eric Blake (ebb9@email.byu.edu)
* @see Collection
* @see Set
* @see TreeSet
diff --git a/libjava/java/util/Hashtable.java b/libjava/java/util/Hashtable.java
index 3f5ae4c18c7..8d6e81fc7ef 100644
--- a/libjava/java/util/Hashtable.java
+++ b/libjava/java/util/Hashtable.java
@@ -1,6 +1,6 @@
/* Hashtable.java -- a class providing a basic hashtable data structure,
mapping Object --> Object
- Copyright (C) 1998, 1999, 2000, 2001, 2002, 2004 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2000, 2001, 2002, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -91,7 +91,7 @@ import java.io.Serializable;
* @author Jon Zeppieri
* @author Warren Levy
* @author Bryce McKinlay
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Eric Blake (ebb9@email.byu.edu)
* @see HashMap
* @see TreeMap
* @see IdentityHashMap
diff --git a/libjava/java/util/IdentityHashMap.java b/libjava/java/util/IdentityHashMap.java
index 5b2e9967c70..54f4aca81e2 100644
--- a/libjava/java/util/IdentityHashMap.java
+++ b/libjava/java/util/IdentityHashMap.java
@@ -1,6 +1,6 @@
/* IdentityHashMap.java -- a class providing a hashtable data structure,
mapping Object --> Object, which uses object identity for hashing.
- Copyright (C) 2001, 2002, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2001, 2002, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -78,8 +78,8 @@ import java.io.Serializable;
* iterator, and in the case of the entrySet, the Map.Entry, to
* fail with a {@link ConcurrentModificationException}.
*
- * @author Tom Tromey <tromey@redhat.com>
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Tom Tromey (tromey@redhat.com)
+ * @author Eric Blake (ebb9@email.byu.edu)
* @see System#identityHashCode(Object)
* @see Collection
* @see Map
@@ -676,8 +676,8 @@ public class IdentityHashMap extends AbstractMap
* creates the appropriate Map.Entry object with the correct fail-fast
* semantics and identity comparisons.
*
- * @author Tom Tromey <tromey@redhat.com>
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Tom Tromey (tromey@redhat.com)
+ * @author Eric Blake (ebb9@email.byu.edu)
*/
private class IdentityIterator implements Iterator
{
@@ -769,7 +769,7 @@ public class IdentityHashMap extends AbstractMap
* the general contract of Map.Entry, and is probably unsuitable for
* comparison to normal maps; but it works among other IdentityHashMaps.
*
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Eric Blake (ebb9@email.byu.edu)
*/
private final class IdentityEntry implements Map.Entry
{
diff --git a/libjava/java/util/Iterator.java b/libjava/java/util/Iterator.java
index 1c55a35e582..0d8441a172c 100644
--- a/libjava/java/util/Iterator.java
+++ b/libjava/java/util/Iterator.java
@@ -1,5 +1,5 @@
/* Iterator.java -- Interface for iterating over collections
- Copyright (C) 1998, 2001 Free Software Foundation, Inc.
+ Copyright (C) 1998, 2001, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -47,7 +47,7 @@ package java.util;
* have the remove method and had less conveniently named methods.
*
* @author Original author unknown
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Eric Blake (ebb9@email.byu.edu)
* @see Collection
* @see ListIterator
* @see Enumeration
diff --git a/libjava/java/util/LinkedHashMap.java b/libjava/java/util/LinkedHashMap.java
index 0a8484bae88..f58cf3fe70e 100644
--- a/libjava/java/util/LinkedHashMap.java
+++ b/libjava/java/util/LinkedHashMap.java
@@ -412,7 +412,7 @@ public class LinkedHashMap extends HashMap
e.next = buckets[idx];
buckets[idx] = e;
if (callRemove && removeEldestEntry(root))
- remove(root);
+ remove(root.key);
}
/**
diff --git a/libjava/java/util/LinkedHashSet.java b/libjava/java/util/LinkedHashSet.java
index 4641e52b64a..567602818d3 100644
--- a/libjava/java/util/LinkedHashSet.java
+++ b/libjava/java/util/LinkedHashSet.java
@@ -1,6 +1,6 @@
/* LinkedHashSet.java -- a set backed by a LinkedHashMap, for linked
list traversal.
- Copyright (C) 2001 Free Software Foundation, Inc.
+ Copyright (C) 2001, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -78,7 +78,7 @@ import java.io.Serializable;
* {@link ConcurrentModificationException} rather than exhibit
* non-deterministic behavior.
*
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Eric Blake (ebb9@email.byu.edu)
* @see Object#hashCode()
* @see Collection
* @see Set
diff --git a/libjava/java/util/LinkedList.java b/libjava/java/util/LinkedList.java
index 4789a387ad5..b2bfda42e2a 100644
--- a/libjava/java/util/LinkedList.java
+++ b/libjava/java/util/LinkedList.java
@@ -1,5 +1,5 @@
/* LinkedList.java -- Linked list implementation of the List interface
- Copyright (C) 1998, 1999, 2000, 2001, 2002, 2004 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2000, 2001, 2002, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -63,7 +63,7 @@ import java.lang.reflect.Array;
*
* @author Original author unknown
* @author Bryce McKinlay
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Eric Blake (ebb9@email.byu.edu)
* @see List
* @see ArrayList
* @see Vector
@@ -750,7 +750,7 @@ public class LinkedList extends AbstractSequentialList
* position in the list and the two list entries it is between.
*
* @author Original author unknown
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Eric Blake (ebb9@email.byu.edu)
*/
private final class LinkedListItr implements ListIterator
{
diff --git a/libjava/java/util/List.java b/libjava/java/util/List.java
index 0f7f409dae6..6d3df8593be 100644
--- a/libjava/java/util/List.java
+++ b/libjava/java/util/List.java
@@ -1,5 +1,5 @@
/* List.java -- An ordered collection which allows indexed access
- Copyright (C) 1998, 2001 Free Software Foundation, Inc.
+ Copyright (C) 1998, 2001, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -66,7 +66,7 @@ package java.util;
* hashCode or equals.
*
* @author Original author unknown
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Eric Blake (ebb9@email.byu.edu)
* @see Collection
* @see Set
* @see ArrayList
diff --git a/libjava/java/util/ListIterator.java b/libjava/java/util/ListIterator.java
index 6d53469ec99..c957e3f217a 100644
--- a/libjava/java/util/ListIterator.java
+++ b/libjava/java/util/ListIterator.java
@@ -1,5 +1,5 @@
/* ListIterator.java -- Extended Iterator for iterating over ordered lists
- Copyright (C) 1998, 1999, 2001 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2001, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -51,7 +51,7 @@ package java.util;
* or <code>previous</code>.
*
* @author Original author unknown
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Eric Blake (ebb9@email.byu.edu)
* @see Collection
* @see List
* @see Iterator
diff --git a/libjava/java/util/ListResourceBundle.java b/libjava/java/util/ListResourceBundle.java
index b7b32c212f9..3c7336eaffd 100644
--- a/libjava/java/util/ListResourceBundle.java
+++ b/libjava/java/util/ListResourceBundle.java
@@ -1,5 +1,5 @@
/* ListResourceBundle -- a resource bundle build around a list
- Copyright (C) 1998, 1999, 2001, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2001, 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -72,7 +72,7 @@ package java.util;
}</pre>
*
* @author Jochen Hoenicke
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Eric Blake (ebb9@email.byu.edu)
* @see Locale
* @see PropertyResourceBundle
* @since 1.1
diff --git a/libjava/java/util/Map.java b/libjava/java/util/Map.java
index 093e13d215d..3298d8ea28c 100644
--- a/libjava/java/util/Map.java
+++ b/libjava/java/util/Map.java
@@ -1,6 +1,6 @@
/* Map.java: interface Map -- An object that maps keys to values
interface Map.Entry -- an Entry in a Map
- Copyright (C) 1998, 2001, 2004 Free Software Foundation, Inc.
+ Copyright (C) 1998, 2001, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -68,7 +68,7 @@ package java.util;
* normally fail with a non-empty argument.
*
* @author Original author unknown
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Eric Blake (ebb9@email.byu.edu)
* @see HashMap
* @see TreeMap
* @see Hashtable
@@ -267,7 +267,7 @@ public interface Map
* for undefined behavior.
*
* @author Original author unknown
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Eric Blake (ebb9@email.byu.edu)
* @see Map
* @see Map#entrySet()
* @since 1.2
diff --git a/libjava/java/util/MissingResourceException.java b/libjava/java/util/MissingResourceException.java
index 47525e55bfa..1bfed625247 100644
--- a/libjava/java/util/MissingResourceException.java
+++ b/libjava/java/util/MissingResourceException.java
@@ -1,5 +1,5 @@
/* MissingResourceException.java -- thrown for a missing resource
- Copyright (C) 1998, 1999, 2001, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2001, 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -42,7 +42,7 @@ package java.util;
* This exception is thrown when a resource is missing.
*
* @author Jochen Hoenicke
- * @author Warren Levy <warrenl@cygnus.com>
+ * @author Warren Levy (warrenl@cygnus.com)
* @see ResourceBundle
* @since 1.1
* @status updated to 1.4
diff --git a/libjava/java/util/NoSuchElementException.java b/libjava/java/util/NoSuchElementException.java
index a040e901be7..d0c53a0a808 100644
--- a/libjava/java/util/NoSuchElementException.java
+++ b/libjava/java/util/NoSuchElementException.java
@@ -1,5 +1,5 @@
/* NoSuchElementException.java -- Attempt to access element that does not exist
- Copyright (C) 1998, 1999, 2001 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2001, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -51,8 +51,8 @@ package java.util;
* thrown by Vector and Stack when attempting to access the first or last
* element of an empty collection.
*
- * @author Warren Levy <warrenl@cygnus.com>
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Warren Levy (warrenl@cygnus.com)
+ * @author Eric Blake (ebb9@email.byu.edu)
* @see Enumeration
* @see Iterator
* @see ListIterator
diff --git a/libjava/java/util/Observable.java b/libjava/java/util/Observable.java
index 7616f5160f8..4fd9919e4c0 100644
--- a/libjava/java/util/Observable.java
+++ b/libjava/java/util/Observable.java
@@ -1,5 +1,5 @@
/* Observable.java -- an object to be observed
- Copyright (C) 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2000, 2001, 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -47,8 +47,8 @@ package java.util;
* Note that the <code>notifyObservers()</code> method of this class is
* unrelated to the <code>notify()</code> of Object.
*
- * @author Warren Levy <warrenl@cygnus.com>
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Warren Levy (warrenl@cygnus.com)
+ * @author Eric Blake (ebb9@email.byu.edu)
* @see Observer
* @status updated to 1.4
*/
diff --git a/libjava/java/util/Observer.java b/libjava/java/util/Observer.java
index 884a263888f..88d1e4d80d4 100644
--- a/libjava/java/util/Observer.java
+++ b/libjava/java/util/Observer.java
@@ -1,5 +1,5 @@
/* Observer.java -- an object that will be informed of changes in an Observable
- Copyright (C) 1998, 1999, 2001, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2001, 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -42,7 +42,7 @@ package java.util;
* Interface that is implemented when a class wants to be informed of changes
* in Observable objects.
*
- * @author Warren Levy <warrenl@cygnus.com>
+ * @author Warren Levy (warrenl@cygnus.com)
* @see Observable
* @status updated to 1.4
*/
diff --git a/libjava/java/util/Properties.java b/libjava/java/util/Properties.java
index eac90e490fb..5e351056c70 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, 2003, 2004 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -86,7 +86,7 @@ s16=1,3</pre>
* a single <code>u</code> for any character which cannot be represented.
*
* @author Jochen Hoenicke
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Eric Blake (ebb9@email.byu.edu)
* @see PropertyResourceBundle
* @status updated to 1.4
*/
diff --git a/libjava/java/util/PropertyPermission.java b/libjava/java/util/PropertyPermission.java
index ec2ca7abab6..7b2667a39dd 100644
--- a/libjava/java/util/PropertyPermission.java
+++ b/libjava/java/util/PropertyPermission.java
@@ -1,5 +1,5 @@
/* PropertyPermission.java -- permission to get and set System properties
- Copyright (C) 1999, 2000, 2002, 2004 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2000, 2002, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -154,17 +154,18 @@ public final class PropertyPermission extends BasicPermission
actions = WRITE;
else if ("read,write".equals(str) || "write,read".equals(str))
actions = READ | WRITE;
- else {
- String lstr = str.toLowerCase();
- if ("read".equals(lstr))
- actions = READ;
- else if ("write".equals(lstr))
- actions = WRITE;
- else if ("read,write".equals(lstr) || "write,read".equals(lstr))
- actions = READ | WRITE;
- else
- throw new IllegalArgumentException("illegal action " + str);
- }
+ else
+ {
+ String lstr = str.toLowerCase();
+ if ("read".equals(lstr))
+ actions = READ;
+ else if ("write".equals(lstr))
+ actions = WRITE;
+ else if ("read,write".equals(lstr) || "write,read".equals(lstr))
+ actions = READ | WRITE;
+ else
+ throw new IllegalArgumentException("illegal action " + str);
+ }
}
/**
diff --git a/libjava/java/util/PropertyPermissionCollection.java b/libjava/java/util/PropertyPermissionCollection.java
index 5c799238f3f..6a14c9bd740 100644
--- a/libjava/java/util/PropertyPermissionCollection.java
+++ b/libjava/java/util/PropertyPermissionCollection.java
@@ -1,5 +1,5 @@
/* PropertyPermissionCollection.java -- a collection of PropertyPermissions
- Copyright (C) 2002, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -47,7 +47,7 @@ import java.security.PermissionCollection;
* PropertyPermissions, and correctly implements <code>implies</code>. It
* is synchronized, as specified in the superclass.
*
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Eric Blake (ebb9@email.byu.edu)
* @status an undocumented class, but this matches Sun's serialization
*/
class PropertyPermissionCollection extends PermissionCollection
diff --git a/libjava/java/util/RandomAccess.java b/libjava/java/util/RandomAccess.java
index 151ceac08aa..a38b6a5f48c 100644
--- a/libjava/java/util/RandomAccess.java
+++ b/libjava/java/util/RandomAccess.java
@@ -1,6 +1,6 @@
/* RandomAccess.java -- A tagging interface that lists can use to tailor
operations to the correct algorithm
- Copyright (C) 2001 Free Software Foundation, Inc.
+ Copyright (C) 2001, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -53,7 +53,7 @@ package java.util;
* <br>runs faster than this loop:<br>
* <code>for (Iterator i = list.iterator(); i.hasNext(); ) i.next();</code>
*
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Eric Blake (ebb9@email.byu.edu)
* @see List
* @since 1.4
* @status updated to 1.4
diff --git a/libjava/java/util/Set.java b/libjava/java/util/Set.java
index eb4df3ef299..58736d81544 100644
--- a/libjava/java/util/Set.java
+++ b/libjava/java/util/Set.java
@@ -1,5 +1,5 @@
/* Set.java -- A collection that prohibits duplicates
- Copyright (C) 1998, 2001 Free Software Foundation, Inc.
+ Copyright (C) 1998, 2001, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -53,7 +53,7 @@ package java.util;
* allowed to be an element of itself, without risking undefined behavior.
*
* @author Original author unknown
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Eric Blake (ebb9@email.byu.edu)
* @see Collection
* @see List
* @see SortedSet
diff --git a/libjava/java/util/SimpleTimeZone.java b/libjava/java/util/SimpleTimeZone.java
index 7d0e2019861..4da1847a29c 100644
--- a/libjava/java/util/SimpleTimeZone.java
+++ b/libjava/java/util/SimpleTimeZone.java
@@ -1,5 +1,5 @@
/* java.util.SimpleTimeZone
- Copyright (C) 1998, 1999, 2000, 2003, 2004 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2000, 2003, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,6 +38,7 @@ exception statement from your version. */
package java.util;
+
/**
* This class represents a simple time zone offset and handles
* daylight savings. It can only handle one daylight savings rule, so
@@ -49,14 +50,14 @@ package java.util;
* lying in the AD era.
*
* @see Calendar
- * @see GregorianCalender
+ * @see GregorianCalender
* @author Jochen Hoenicke
*/
public class SimpleTimeZone extends TimeZone
{
/**
* The raw time zone offset in milliseconds to GMT, ignoring
- * daylight savings.
+ * daylight savings.
* @serial
*/
private int rawOffset;
@@ -77,16 +78,15 @@ public class SimpleTimeZone extends TimeZone
private int dstSavings = 60 * 60 * 1000;
/**
- * The first year, in which daylight savings rules applies.
+ * The first year, in which daylight savings rules applies.
* @serial
*/
private int startYear;
-
private static final int DOM_MODE = 1;
private static final int DOW_IN_MONTH_MODE = 2;
private static final int DOW_GE_DOM_MODE = 3;
private static final int DOW_LE_DOM_MODE = 4;
-
+
/**
* The mode of the start rule. This takes one of the following values:
* <dl>
@@ -119,7 +119,7 @@ public class SimpleTimeZone extends TimeZone
/**
* The month in which daylight savings start. This is one of the
- * constants Calendar.JANUARY, ..., Calendar.DECEMBER.
+ * constants Calendar.JANUARY, ..., Calendar.DECEMBER.
* @serial
*/
private int startMonth;
@@ -128,21 +128,21 @@ public class SimpleTimeZone extends TimeZone
* This variable can have different meanings. See startMode for details
* @see #startMode;
* @serial
- */
+ */
private int startDay;
-
+
/**
- * This variable specifies the day of week the change takes place. If
+ * This variable specifies the day of week the change takes place. If
* startMode == DOM_MODE, this is undefined.
* @serial
* @see #startMode;
- */
+ */
private int startDayOfWeek;
-
+
/**
* This variable specifies the time of change to daylight savings.
* This time is given in milliseconds after midnight local
- * standard time.
+ * standard time.
* @serial
*/
private int startTime;
@@ -157,9 +157,9 @@ public class SimpleTimeZone extends TimeZone
/**
* The month in which daylight savings ends. This is one of the
- * constants Calendar.JANUARY, ..., Calendar.DECEMBER.
+ * constants Calendar.JANUARY, ..., Calendar.DECEMBER.
* @serial
- */
+ */
private int endMonth;
/**
@@ -167,7 +167,7 @@ public class SimpleTimeZone extends TimeZone
* It can take the same values as startMode.
* @serial
* @see #startMode
- */
+ */
private int endMode;
/**
@@ -176,19 +176,19 @@ public class SimpleTimeZone extends TimeZone
* @see #startMode;
*/
private int endDay;
-
+
/**
- * This variable specifies the day of week the change takes place. If
+ * This variable specifies the day of week the change takes place. If
* endMode == DOM_MODE, this is undefined.
* @serial
* @see #startMode;
*/
private int endDayOfWeek;
-
+
/**
* This variable specifies the time of change back to standard time.
* This time is given in milliseconds after midnight local
- * standard time.
+ * standard time.
* @serial
*/
private int endTime;
@@ -210,8 +210,11 @@ public class SimpleTimeZone extends TimeZone
* @serial
*/
private byte[] monthLength = monthArr;
- private static final byte[] monthArr =
- {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
+ private static final byte[] monthArr =
+ {
+ 31, 28, 31, 30, 31, 30, 31, 31, 30,
+ 31, 30, 31
+ };
/**
* The version of the serialized data on the stream.
@@ -225,6 +228,7 @@ public class SimpleTimeZone extends TimeZone
* startMode, endMode and dstSavings. And there is a optional section
* as described in writeObject.
* </dd>
+ * </dl>
*
* XXX - JDK 1.2 Beta 4 docu states 1.1.4, but my 1.1.5 has the old
* version.
@@ -232,10 +236,9 @@ public class SimpleTimeZone extends TimeZone
* When streaming out this class it is always written in the latest
* version.
* @serial
- * @since JDK1.1.4
+ * @since JDK1.1.4
*/
private int serialVersionOnStream = 2;
-
private static final long serialVersionUID = -403250971215465050L;
/**
@@ -257,9 +260,9 @@ public class SimpleTimeZone extends TimeZone
/**
* Create a <code>SimpleTimeZone</code> with the given time offset
- * from GMT and without daylight savings.
+ * from GMT and without daylight savings.
* @param rawOffset the time offset from GMT in milliseconds.
- * @param id The identifier of this time zone.
+ * @param id The identifier of this time zone.
*/
public SimpleTimeZone(int rawOffset, String id)
{
@@ -273,7 +276,7 @@ public class SimpleTimeZone extends TimeZone
* Create a <code>SimpleTimeZone</code> with the given time offset
* from GMT and with daylight savings. The start/end parameters
* can have different meaning (replace WEEKDAY with a real day of
- * week). Only the first two meanings were supported by earlier
+ * week). Only the first two meanings were supported by earlier
* versions of jdk.
*
* <dl>
@@ -296,12 +299,12 @@ public class SimpleTimeZone extends TimeZone
* must make sure that this day lies in the same month. </dd>
* </dl>
*
- * If you give a non existing month, a day that is zero, or too big,
+ * If you give a non existing month, a day that is zero, or too big,
* or a dayOfWeek that is too big, the result is undefined.
*
* The start rule must have a different month than the end rule.
* This restriction shouldn't hurt for all possible time zones.
- *
+ *
* @param rawOffset The time offset from GMT in milliseconds.
* @param id The identifier of this time zone.
* @param startMonth The start month of daylight savings; use the
@@ -312,29 +315,26 @@ public class SimpleTimeZone extends TimeZone
* @param startTime A time in millis in standard time.
* @param endMonth The end month of daylight savings; use the
* constants in Calendar.
- * @param endday A day in month or a day of week number, as
+ * @param endday A day in month or a day of week number, as
* described above.
* @param endDayOfWeek The end rule day of week; see above.
* @param endTime A time in millis in standard time.
* @throws IllegalArgumentException if parameters are invalid or out of
* range.
*/
- public SimpleTimeZone(int rawOffset, String id,
- int startMonth, int startDayOfWeekInMonth,
- int startDayOfWeek, int startTime,
- int endMonth, int endDayOfWeekInMonth,
- int endDayOfWeek, int endTime)
+ public SimpleTimeZone(int rawOffset, String id, int startMonth,
+ int startDayOfWeekInMonth, int startDayOfWeek,
+ int startTime, int endMonth, int endDayOfWeekInMonth,
+ int endDayOfWeek, int endTime)
{
this.rawOffset = rawOffset;
setID(id);
useDaylight = true;
- setStartRule(startMonth, startDayOfWeekInMonth,
- startDayOfWeek, startTime);
+ setStartRule(startMonth, startDayOfWeekInMonth, startDayOfWeek, startTime);
setEndRule(endMonth, endDayOfWeekInMonth, endDayOfWeek, endTime);
if (startMonth == endMonth)
- throw new IllegalArgumentException
- ("startMonth and endMonth must be different");
+ throw new IllegalArgumentException("startMonth and endMonth must be different");
this.startYear = 0;
}
@@ -347,15 +347,13 @@ public class SimpleTimeZone extends TimeZone
* time in milliseconds. This must be positive.
* @since 1.2
*/
- public SimpleTimeZone(int rawOffset, String id,
- int startMonth, int startDayOfWeekInMonth,
- int startDayOfWeek, int startTime,
- int endMonth, int endDayOfWeekInMonth,
- int endDayOfWeek, int endTime, int dstSavings)
+ public SimpleTimeZone(int rawOffset, String id, int startMonth,
+ int startDayOfWeekInMonth, int startDayOfWeek,
+ int startTime, int endMonth, int endDayOfWeekInMonth,
+ int endDayOfWeek, int endTime, int dstSavings)
{
- this(rawOffset, id,
- startMonth, startDayOfWeekInMonth, startDayOfWeek, startTime,
- endMonth, endDayOfWeekInMonth, endDayOfWeek, endTime);
+ this(rawOffset, id, startMonth, startDayOfWeekInMonth, startDayOfWeek,
+ startTime, endMonth, endDayOfWeekInMonth, endDayOfWeek, endTime);
this.dstSavings = dstSavings;
}
@@ -376,12 +374,11 @@ public class SimpleTimeZone extends TimeZone
* range.
* @since 1.4
*/
- public SimpleTimeZone(int rawOffset, String id,
- int startMonth, int startDayOfWeekInMonth,
- int startDayOfWeek, int startTime, int startTimeMode,
- int endMonth, int endDayOfWeekInMonth,
- int endDayOfWeek, int endTime, int endTimeMode,
- int dstSavings)
+ public SimpleTimeZone(int rawOffset, String id, int startMonth,
+ int startDayOfWeekInMonth, int startDayOfWeek,
+ int startTime, int startTimeMode, int endMonth,
+ int endDayOfWeekInMonth, int endDayOfWeek,
+ int endTime, int endTimeMode, int dstSavings)
{
this.rawOffset = rawOffset;
setID(id);
@@ -394,12 +391,10 @@ public class SimpleTimeZone extends TimeZone
this.startTimeMode = startTimeMode;
this.endTimeMode = endTimeMode;
- setStartRule(startMonth, startDayOfWeekInMonth,
- startDayOfWeek, startTime);
+ setStartRule(startMonth, startDayOfWeekInMonth, startDayOfWeek, startTime);
setEndRule(endMonth, endDayOfWeekInMonth, endDayOfWeek, endTime);
if (startMonth == endMonth)
- throw new IllegalArgumentException
- ("startMonth and endMonth must be different");
+ throw new IllegalArgumentException("startMonth and endMonth must be different");
this.startYear = 0;
this.dstSavings = dstSavings;
@@ -432,6 +427,7 @@ public class SimpleTimeZone extends TimeZone
{
if (month < 0 || month > 11)
throw new IllegalArgumentException("month out of range");
+
int daysInMonth = getDaysInMonth(month, 1);
if (dayOfWeek == 0)
{
@@ -460,7 +456,6 @@ public class SimpleTimeZone extends TimeZone
}
}
-
/**
* Sets the daylight savings start rule. You must also set the
* end rule with <code>setEndRule</code> or the result of
@@ -514,14 +509,16 @@ public class SimpleTimeZone extends TimeZone
* @since 1.2
* @see SimpleTimeZone
*/
- public void setStartRule(int month, int day, int dayOfWeek, int time, boolean after)
+ public void setStartRule(int month, int day, int dayOfWeek, int time,
+ boolean after)
{
// FIXME: XXX: Validate that checkRule and offset processing work with on
// or before mode.
this.startDay = after ? Math.abs(day) : -Math.abs(day);
this.startDayOfWeek = after ? Math.abs(dayOfWeek) : -Math.abs(dayOfWeek);
- this.startMode = (dayOfWeek != 0) ? (after ? DOW_GE_DOM_MODE : DOW_LE_DOM_MODE)
- : checkRule(month, day, dayOfWeek);
+ this.startMode = (dayOfWeek != 0)
+ ? (after ? DOW_GE_DOM_MODE : DOW_LE_DOM_MODE)
+ : checkRule(month, day, dayOfWeek);
this.startDay = Math.abs(this.startDay);
this.startDayOfWeek = Math.abs(this.startDayOfWeek);
@@ -591,7 +588,7 @@ public class SimpleTimeZone extends TimeZone
*
* Note that this API isn't incredibly well specified. It appears that the
* after flag must override the parameters, since normally, the day and
- * dayofweek can select this. I.e., if day &lt; 0 and dayOfWeek &lt; 0, on or
+ * dayofweek can select this. I.e., if day < 0 and dayOfWeek < 0, on or
* before mode is chosen. But if after == true, this implementation
* overrides the signs of the other arguments. And if dayOfWeek == 0, it
* falls back to the behavior in the other APIs. I guess this should be
@@ -606,14 +603,16 @@ public class SimpleTimeZone extends TimeZone
* @since 1.2
* @see #setStartRule
*/
- public void setEndRule(int month, int day, int dayOfWeek, int time, boolean after)
+ public void setEndRule(int month, int day, int dayOfWeek, int time,
+ boolean after)
{
// FIXME: XXX: Validate that checkRule and offset processing work with on
// or before mode.
this.endDay = after ? Math.abs(day) : -Math.abs(day);
this.endDayOfWeek = after ? Math.abs(dayOfWeek) : -Math.abs(dayOfWeek);
- this.endMode = (dayOfWeek != 0) ? (after ? DOW_GE_DOM_MODE : DOW_LE_DOM_MODE)
- : checkRule(month, day, dayOfWeek);
+ this.endMode = (dayOfWeek != 0)
+ ? (after ? DOW_GE_DOM_MODE : DOW_LE_DOM_MODE)
+ : checkRule(month, day, dayOfWeek);
this.endDay = Math.abs(this.endDay);
this.endDayOfWeek = Math.abs(endDayOfWeek);
@@ -648,7 +647,7 @@ public class SimpleTimeZone extends TimeZone
}
/**
- * Gets the time zone offset, for current date, modified in case of
+ * Gets the time zone offset, for current date, modified in case of
* daylight savings. This is the offset to add to UTC to get the local
* time.
*
@@ -674,8 +673,8 @@ public class SimpleTimeZone extends TimeZone
* @return the time zone offset in milliseconds.
* @throws IllegalArgumentException if arguments are incorrect.
*/
- public int getOffset(int era, int year, int month,
- int day, int dayOfWeek, int millis)
+ public int getOffset(int era, int year, int month, int day, int dayOfWeek,
+ int millis)
{
int daysInMonth = getDaysInMonth(month, year);
if (day < 1 || day > daysInMonth)
@@ -683,7 +682,7 @@ public class SimpleTimeZone extends TimeZone
if (dayOfWeek < Calendar.SUNDAY || dayOfWeek > Calendar.SATURDAY)
throw new IllegalArgumentException("dayOfWeek out of range");
if (month < Calendar.JANUARY || month > Calendar.DECEMBER)
- throw new IllegalArgumentException("month out of range");
+ throw new IllegalArgumentException("month out of range:" + month);
// This method is called by Calendar, so we mustn't use that class.
int daylightSavings = 0;
@@ -691,27 +690,22 @@ public class SimpleTimeZone extends TimeZone
{
// This does only work for Gregorian calendars :-(
// This is mainly because setStartYear doesn't take an era.
-
- boolean afterStart = !isBefore(year, month, day, dayOfWeek, millis,
- startMode, startMonth,
- startDay, startDayOfWeek, startTime);
+ boolean afterStart = ! isBefore(year, month, day, dayOfWeek, millis,
+ startMode, startMonth, startDay,
+ startDayOfWeek, startTime);
boolean beforeEnd = isBefore(year, month, day, dayOfWeek,
millis + dstSavings,
- endMode, endMonth,
- endDay, endDayOfWeek, endTime);
+ endMode, endMonth, endDay, endDayOfWeek,
+ endTime);
if (startMonth < endMonth)
- {
- // use daylight savings, if the date is after the start of
- // savings, and before the end of savings.
- daylightSavings = afterStart && beforeEnd ? dstSavings : 0;
- }
+ // use daylight savings, if the date is after the start of
+ // savings, and before the end of savings.
+ daylightSavings = afterStart && beforeEnd ? dstSavings : 0;
else
- {
- // use daylight savings, if the date is before the end of
- // savings, or after the start of savings.
- daylightSavings = beforeEnd || afterStart ? dstSavings : 0;
- }
+ // use daylight savings, if the date is before the end of
+ // savings, or after the start of savings.
+ daylightSavings = beforeEnd || afterStart ? dstSavings : 0;
}
return rawOffset + daylightSavings;
}
@@ -740,7 +734,7 @@ public class SimpleTimeZone extends TimeZone
* milliseconds with respect to standard time. Typically this
* is one hour, but for some time zones this may be half an our.
* @return the daylight savings offset in milliseconds.
- *
+ *
* @since 1.2
*/
public int getDSTSavings()
@@ -760,7 +754,7 @@ public class SimpleTimeZone extends TimeZone
{
if (dstSavings <= 0)
throw new IllegalArgumentException("illegal value for dstSavings");
-
+
this.dstSavings = dstSavings;
}
@@ -774,23 +768,28 @@ public class SimpleTimeZone extends TimeZone
}
/**
- * Returns the number of days in the given month. It does always
- * use the Gregorian leap year rule.
+ * Returns the number of days in the given month.
+ * Uses gregorian rules prior to 1582 (The default and earliest cutover)
* @param month The month, zero based; use one of the Calendar constants.
* @param year The year.
*/
private int getDaysInMonth(int month, int year)
{
- // Most of this is copied from GregorianCalendar.getActualMaximum()
if (month == Calendar.FEBRUARY)
{
- return ((year & 3) == 0 && (year % 100 != 0 || year % 400 == 0))
- ? 29 : 28;
+ if ((year & 3) != 0)
+ return 28;
+
+ // Assume default Gregorian cutover,
+ // all years prior to this must be Julian
+ if (year < 1582)
+ return 29;
+
+ // Gregorian rules
+ return ((year % 100) != 0 || (year % 400) == 0) ? 29 : 28;
}
- else if (month < Calendar.AUGUST)
- return 31 - (month & 1);
else
- return 30 + (month & 1);
+ return monthArr[month];
}
/**
@@ -804,23 +803,19 @@ public class SimpleTimeZone extends TimeZone
* @param mode the change mode; same semantic as startMode.
* @param month the change month; same semantic as startMonth.
* @param day the change day; same semantic as startDay.
- * @param dayOfWeek the change day of week;
+ * @param dayOfWeek the change day of week;
* @param millis the change time in millis since midnight standard time.
* same semantic as startDayOfWeek.
* @return true, if cal is before the change, false if cal is on
* or after the change.
*/
- private boolean isBefore(int calYear,
- int calMonth, int calDayOfMonth, int calDayOfWeek,
- int calMillis, int mode, int month,
- int day, int dayOfWeek, int millis)
+ private boolean isBefore(int calYear, int calMonth, int calDayOfMonth,
+ int calDayOfWeek, int calMillis, int mode,
+ int month, int day, int dayOfWeek, int millis)
{
-
// This method is called by Calendar, so we mustn't use that class.
// We have to do all calculations by hand.
-
// check the months:
-
// XXX - this is not correct:
// for the DOW_GE_DOM and DOW_LE_DOM modes the change date may
// be in a different month.
@@ -835,7 +830,7 @@ public class SimpleTimeZone extends TimeZone
return calDayOfMonth < day;
break;
case DOW_IN_MONTH_MODE:
- {
+ {
// This computes the day of month of the day of type
// "dayOfWeek" that lies in the same (sunday based) week as cal.
calDayOfMonth += (dayOfWeek - calDayOfWeek);
@@ -844,7 +839,6 @@ public class SimpleTimeZone extends TimeZone
// after dividing by 7). If we count from the end of the
// month, we get want a -7 based number counting the days from
// the end:
-
if (day < 0)
calDayOfMonth -= getDaysInMonth(calMonth, calYear) + 7;
else
@@ -857,9 +851,9 @@ public class SimpleTimeZone extends TimeZone
// 20 21 22 23 24 25 26 -23-22-21-20-19-18-17
// 27 28 29 30 31 32 33 -16-15-14-13-12-11-10
// 34 35 36 -9 -8 -7
-
// Now we calculate the day of week in month:
int week = calDayOfMonth / 7;
+
// day > 0 day < 0
// S M T W T F S S M T W T F S
// 1 1 1 1 1 1 -5 -5 -4 -4 -4 -4
@@ -867,7 +861,6 @@ public class SimpleTimeZone extends TimeZone
// 2 3 3 3 3 3 3 -3 -3 -3 -2 -2 -2 -2
// 3 4 4 4 4 4 4 -2 -2 -2 -1 -1 -1 -1
// 4 5 5 -1 -1 -1
-
if (week != day)
return week < day;
@@ -876,26 +869,25 @@ public class SimpleTimeZone extends TimeZone
// daylight savings starts/ends on the given day.
break;
- }
-
+ }
case DOW_LE_DOM_MODE:
// The greatest sunday before or equal December, 12
// is the same as smallest sunday after or equal December, 6.
day = Math.abs(day) - 6;
-
case DOW_GE_DOM_MODE:
-
// Calculate the day of month of the day of type
// "dayOfWeek" that lies before (or on) the given date.
- calDayOfMonth -= (calDayOfWeek < dayOfWeek ? 7 : 0)
- + calDayOfWeek - dayOfWeek;
+ calDayOfMonth -= (calDayOfWeek < dayOfWeek ? 7 : 0) + calDayOfWeek
+ - dayOfWeek;
if (calDayOfMonth < day)
return true;
if (calDayOfWeek != dayOfWeek || calDayOfMonth >= day + 7)
return false;
+
// now we have the same day
break;
}
+
// the millis decides:
return (calMillis < millis);
}
@@ -914,40 +906,35 @@ public class SimpleTimeZone extends TimeZone
/**
* Generates the hashCode for the SimpleDateFormat object. It is
* the rawOffset, possibly, if useDaylightSavings is true, xored
- * with startYear, startMonth, startDayOfWeekInMonth, ..., endTime.
+ * with startYear, startMonth, startDayOfWeekInMonth, ..., endTime.
*/
public synchronized int hashCode()
{
- return rawOffset ^
- (useDaylight ?
- startMonth ^ startDay ^ startDayOfWeek ^ startTime
- ^ endMonth ^ endDay ^ endDayOfWeek ^ endTime : 0);
+ return rawOffset
+ ^ (useDaylight
+ ? startMonth ^ startDay ^ startDayOfWeek ^ startTime ^ endMonth
+ ^ endDay ^ endDayOfWeek ^ endTime : 0);
}
public synchronized boolean equals(Object o)
{
if (this == o)
return true;
- if (!(o instanceof SimpleTimeZone))
+ if (! (o instanceof SimpleTimeZone))
return false;
SimpleTimeZone zone = (SimpleTimeZone) o;
- if (zone.hashCode() != hashCode()
- || !getID().equals(zone.getID())
- || rawOffset != zone.rawOffset || useDaylight != zone.useDaylight)
+ if (zone.hashCode() != hashCode() || ! getID().equals(zone.getID())
+ || rawOffset != zone.rawOffset || useDaylight != zone.useDaylight)
return false;
- if (!useDaylight)
+ if (! useDaylight)
return true;
- return (startYear == zone.startYear
- && startMonth == zone.startMonth
- && startDay == zone.startDay
- && startDayOfWeek == zone.startDayOfWeek
- && startTime == zone.startTime
- && startTimeMode == zone.startTimeMode
- && endMonth == zone.endMonth
- && endDay == zone.endDay
- && endDayOfWeek == zone.endDayOfWeek
- && endTime == zone.endTime
- && endTimeMode == zone.endTimeMode);
+ return (startYear == zone.startYear && startMonth == zone.startMonth
+ && startDay == zone.startDay
+ && startDayOfWeek == zone.startDayOfWeek
+ && startTime == zone.startTime
+ && startTimeMode == zone.startTimeMode && endMonth == zone.endMonth
+ && endDay == zone.endDay && endDayOfWeek == zone.endDayOfWeek
+ && endTime == zone.endTime && endTimeMode == zone.endTimeMode);
}
/**
@@ -962,25 +949,21 @@ public class SimpleTimeZone extends TimeZone
{
if (this == other)
return true;
- if (!(other instanceof SimpleTimeZone))
+ if (! (other instanceof SimpleTimeZone))
return false;
SimpleTimeZone zone = (SimpleTimeZone) other;
- if (zone.hashCode() != hashCode()
- || rawOffset != zone.rawOffset || useDaylight != zone.useDaylight)
+ if (zone.hashCode() != hashCode() || rawOffset != zone.rawOffset
+ || useDaylight != zone.useDaylight)
return false;
- if (!useDaylight)
+ if (! useDaylight)
return true;
- return (startYear == zone.startYear
- && startMonth == zone.startMonth
- && startDay == zone.startDay
- && startDayOfWeek == zone.startDayOfWeek
- && startTime == zone.startTime
- && startTimeMode == zone.startTimeMode
- && endMonth == zone.endMonth
- && endDay == zone.endDay
- && endDayOfWeek == zone.endDayOfWeek
- && endTime == zone.endTime
- && endTimeMode == zone.endTimeMode);
+ return (startYear == zone.startYear && startMonth == zone.startMonth
+ && startDay == zone.startDay
+ && startDayOfWeek == zone.startDayOfWeek
+ && startTime == zone.startTime
+ && startTimeMode == zone.startTimeMode && endMonth == zone.endMonth
+ && endDay == zone.endDay && endDayOfWeek == zone.endDayOfWeek
+ && endTime == zone.endTime && endTimeMode == zone.endTimeMode);
}
/**
@@ -991,26 +974,17 @@ public class SimpleTimeZone extends TimeZone
{
// the test for useDaylight is an incompatibility to jdk1.2, but
// I think this shouldn't hurt.
- return getClass().getName() + "["
- + "id=" + getID()
- + ",offset=" + rawOffset
- + ",dstSavings=" + dstSavings
- + ",useDaylight=" + useDaylight
- + (useDaylight ?
- ",startYear=" + startYear
- + ",startMode=" + startMode
- + ",startMonth=" + startMonth
- + ",startDay=" + startDay
- + ",startDayOfWeek=" + startDayOfWeek
- + ",startTime=" + startTime
- + ",startTimeMode=" + startTimeMode
- + ",endMode=" + endMode
- + ",endMonth=" + endMonth
- + ",endDay=" + endDay
- + ",endDayOfWeek=" + endDayOfWeek
- + ",endTime=" + endTime
- + ",endTimeMode=" + endTimeMode
- : "") + "]";
+ return getClass().getName() + "[" + "id=" + getID() + ",offset="
+ + rawOffset + ",dstSavings=" + dstSavings + ",useDaylight="
+ + useDaylight
+ + (useDaylight
+ ? ",startYear=" + startYear + ",startMode=" + startMode
+ + ",startMonth=" + startMonth + ",startDay=" + startDay
+ + ",startDayOfWeek=" + startDayOfWeek + ",startTime="
+ + startTime + ",startTimeMode=" + startTimeMode + ",endMode="
+ + endMode + ",endMonth=" + endMonth + ",endDay=" + endDay
+ + ",endDayOfWeek=" + endDayOfWeek + ",endTime=" + endTime
+ + ",endTimeMode=" + endTimeMode : "") + "]";
}
/**
@@ -1029,7 +1003,8 @@ public class SimpleTimeZone extends TimeZone
startMode = DOW_IN_MONTH_MODE;
startTimeMode = WALL_TIME;
endTimeMode = WALL_TIME;
- serialVersionOnStream = 2; }
+ serialVersionOnStream = 2;
+ }
else
{
int length = input.readInt();
@@ -1054,29 +1029,31 @@ public class SimpleTimeZone extends TimeZone
* <code>start/endDay(OfWeek)</code>-Fields are written in the
* DOW_IN_MONTH_MODE rule, since this was the only supported rule
* in 1.1.
- *
+ *
* In the optional section, we write first the length of an byte
* array as int and afterwards the byte array itself. The byte
* array contains in this release four elements, namely the real
* startDay, startDayOfWeek endDay, endDayOfWeek in that Order.
* These fields are needed, because for compatibility reasons only
* approximative values are written to the required section, as
- * described above.
+ * described above.
*/
private void writeObject(java.io.ObjectOutputStream output)
throws java.io.IOException
{
byte[] byteArray = new byte[]
- {
- (byte) startDay, (byte) startDayOfWeek,
- (byte) endDay, (byte) endDayOfWeek};
+ {
+ (byte) startDay, (byte) startDayOfWeek, (byte) endDay,
+ (byte) endDayOfWeek
+ };
/* calculate the approximation for JDK 1.1 */
switch (startMode)
{
case DOM_MODE:
- startDayOfWeek = Calendar.SUNDAY; // random day of week
- // fall through
+ startDayOfWeek = Calendar.SUNDAY; // random day of week
+
+ // fall through
case DOW_GE_DOM_MODE:
case DOW_LE_DOM_MODE:
startDay = (startDay + 6) / 7;
@@ -1085,7 +1062,8 @@ public class SimpleTimeZone extends TimeZone
{
case DOM_MODE:
endDayOfWeek = Calendar.SUNDAY;
- // fall through
+
+ // fall through
case DOW_GE_DOM_MODE:
case DOW_LE_DOM_MODE:
endDay = (endDay + 6) / 7;
diff --git a/libjava/java/util/SortedMap.java b/libjava/java/util/SortedMap.java
index 1d2d5a3cc46..f19809a5e3d 100644
--- a/libjava/java/util/SortedMap.java
+++ b/libjava/java/util/SortedMap.java
@@ -1,5 +1,5 @@
/* SortedMap.java -- A map that makes guarantees about the order of its keys
- Copyright (C) 1998, 2001 Free Software Foundation, Inc.
+ Copyright (C) 1998, 2001, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -61,7 +61,7 @@ package java.util;
* Unfortunately, the Java language does not provide a way to enforce this.
*
* @author Original author unknown
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Eric Blake (ebb9@email.byu.edu)
* @see Map
* @see TreeMap
* @see SortedSet
diff --git a/libjava/java/util/SortedSet.java b/libjava/java/util/SortedSet.java
index 8cdbe878f63..17537b70c70 100644
--- a/libjava/java/util/SortedSet.java
+++ b/libjava/java/util/SortedSet.java
@@ -1,6 +1,6 @@
/* SortedSet.java -- A set that makes guarantees about the order of its
elements
- Copyright (C) 1998, 2001 Free Software Foundation, Inc.
+ Copyright (C) 1998, 2001, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -63,7 +63,7 @@ package java.util;
* enforce this.
*
* @author Original author unknown
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Eric Blake (ebb9@email.byu.edu)
* @see Set
* @see TreeSet
* @see SortedMap
diff --git a/libjava/java/util/Stack.java b/libjava/java/util/Stack.java
index 00e32e5b710..e256eb653b3 100644
--- a/libjava/java/util/Stack.java
+++ b/libjava/java/util/Stack.java
@@ -1,6 +1,6 @@
/* Stack.java - Class that provides a Last In First Out (LIFO)
datatype, known more commonly as a Stack
- Copyright (C) 1998, 1999, 2001 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2001, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -50,8 +50,8 @@ package java.util;
* methods for stack manipulation (push, pop, peek). You can also seek for
* the 1-based position of an element on the stack.
*
- * @author Warren Levy <warrenl@cygnus.com>
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Warren Levy (warrenl@cygnus.com)
+ * @author Eric Blake (ebb9@email.byu.edu)
* @see List
* @see AbstractList
* @see LinkedList
diff --git a/libjava/java/util/StringTokenizer.java b/libjava/java/util/StringTokenizer.java
index 472d8951e5d..90f97dba516 100644
--- a/libjava/java/util/StringTokenizer.java
+++ b/libjava/java/util/StringTokenizer.java
@@ -1,5 +1,5 @@
/* StringTokenizer -- breaks a String into tokens
- Copyright (C) 1998, 1999, 2001, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2001, 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -54,7 +54,7 @@ package java.util;
* single character.
*
* @author Jochen Hoenicke
- * @author Warren Levy <warrenl@cygnus.com>
+ * @author Warren Levy (warrenl@cygnus.com)
* @see java.io.StreamTokenizer
* @status updated to 1.4
*/
diff --git a/libjava/java/util/TimeZone.java b/libjava/java/util/TimeZone.java
index 0685e604600..7c811795790 100644
--- a/libjava/java/util/TimeZone.java
+++ b/libjava/java/util/TimeZone.java
@@ -447,6 +447,7 @@ public abstract class TimeZone implements java.io.Serializable, Cloneable
Calendar.MARCH, -1, Calendar.SUNDAY, 2000 * 3600,
Calendar.OCTOBER, -1, Calendar.SUNDAY, 2000 * 3600);
timezones0.put("CET", tz);
+ timezones0.put("CEST", tz);
timezones0.put("ECT", tz);
timezones0.put("MET", tz);
timezones0.put("Africa/Ceuta", tz);
diff --git a/libjava/java/util/Timer.java b/libjava/java/util/Timer.java
index e4eb246a1db..364d5314a97 100644
--- a/libjava/java/util/Timer.java
+++ b/libjava/java/util/Timer.java
@@ -343,9 +343,16 @@ public class Timer
{
task.run();
}
+ catch (ThreadDeath death)
+ {
+ // If an exception escapes, the Timer becomes invalid.
+ queue.stop();
+ throw death;
+ }
catch (Throwable t)
- {
- /* ignore all errors */
+ {
+ // If an exception escapes, the Timer becomes invalid.
+ queue.stop();
}
}
diff --git a/libjava/java/util/TooManyListenersException.java b/libjava/java/util/TooManyListenersException.java
index 883bdbc7086..dfe326b9aae 100644
--- a/libjava/java/util/TooManyListenersException.java
+++ b/libjava/java/util/TooManyListenersException.java
@@ -1,6 +1,6 @@
/* TooManyListenersException.java -- thrown when a unicast event can't accept
another Listener
- Copyright (C) 1998, 1999, 2001, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2001, 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -46,7 +46,7 @@ package java.util;
* single event listener.
*
* @author Jochen Hoenicke
- * @author Warren Levy <warrenl@cygnus.com>
+ * @author Warren Levy (warrenl@cygnus.com)
* @see EventListener
* @see EventObject
* @since 1.1
diff --git a/libjava/java/util/TreeMap.java b/libjava/java/util/TreeMap.java
index 440536845d7..fd5c12206ee 100644
--- a/libjava/java/util/TreeMap.java
+++ b/libjava/java/util/TreeMap.java
@@ -1,6 +1,6 @@
/* TreeMap.java -- a class providing a basic Red-Black Tree data structure,
mapping Object --> Object
- Copyright (C) 1998, 1999, 2000, 2001, 2002, 2004 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2000, 2001, 2002, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -78,7 +78,7 @@ import java.io.Serializable;
*
* @author Jon Zeppieri
* @author Bryce McKinlay
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Eric Blake (ebb9@email.byu.edu)
* @see Map
* @see HashMap
* @see Hashtable
@@ -160,7 +160,7 @@ public class TreeMap extends AbstractMap
* Class to represent an entry in the tree. Holds a single key-value pair,
* plus pointers to parent and child nodes.
*
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Eric Blake (ebb9@email.byu.edu)
*/
private static final class Node extends AbstractMap.BasicMapEntry
{
@@ -1382,7 +1382,7 @@ public class TreeMap extends AbstractMap
* Iterate over TreeMap's entries. This implementation is parameterized
* to give a sequential view of keys, values, or entries.
*
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Eric Blake (ebb9@email.byu.edu)
*/
private final class TreeIterator implements Iterator
{
@@ -1490,7 +1490,7 @@ public class TreeMap extends AbstractMap
* map, and throws {@link IllegalArgumentException} for attempts to
* access beyond that range.
*
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Eric Blake (ebb9@email.byu.edu)
*/
private final class SubMap extends AbstractMap implements SortedMap
{
diff --git a/libjava/java/util/TreeSet.java b/libjava/java/util/TreeSet.java
index f38357082d3..78504c51e8e 100644
--- a/libjava/java/util/TreeSet.java
+++ b/libjava/java/util/TreeSet.java
@@ -1,5 +1,5 @@
/* TreeSet.java -- a class providing a TreeMap-backed SortedSet
- Copyright (C) 1999, 2000, 2001, 2004 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2000, 2001, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -67,7 +67,7 @@ import java.io.Serializable;
*
* @author Jon Zeppieri
* @author Bryce McKinlay
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Eric Blake (ebb9@email.byu.edu)
* @see Collection
* @see Set
* @see HashSet
diff --git a/libjava/java/util/Vector.java b/libjava/java/util/Vector.java
index 06eab1e9002..13a12b4cc82 100644
--- a/libjava/java/util/Vector.java
+++ b/libjava/java/util/Vector.java
@@ -1,5 +1,5 @@
/* Vector.java -- Class that provides growable arrays.
- Copyright (C) 1998, 1999, 2000, 2001, 2004 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2000, 2001, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -72,7 +72,7 @@ import java.lang.reflect.Array;
*
* @author Scott G. Miller
* @author Bryce McKinlay
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Eric Blake (ebb9@email.byu.edu)
* @see Collection
* @see List
* @see ArrayList
diff --git a/libjava/java/util/jar/JarFile.java b/libjava/java/util/jar/JarFile.java
index 070b3375d19..cb2cbf4900c 100644
--- a/libjava/java/util/jar/JarFile.java
+++ b/libjava/java/util/jar/JarFile.java
@@ -35,13 +35,38 @@ this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
+
package java.util.jar;
+import gnu.java.io.Base64InputStream;
+import gnu.java.security.OID;
+import gnu.java.security.pkcs.PKCS7SignedData;
+import gnu.java.security.pkcs.SignerInfo;
+
+import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileNotFoundException;
+import java.io.FilterInputStream;
import java.io.IOException;
import java.io.InputStream;
+import java.security.InvalidKeyException;
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
+import java.security.Signature;
+import java.security.SignatureException;
+import java.security.cert.CRLException;
+import java.security.cert.Certificate;
+import java.security.cert.CertificateException;
+import java.security.cert.X509Certificate;
+import java.util.Arrays;
import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
import java.util.zip.ZipEntry;
import java.util.zip.ZipException;
import java.util.zip.ZipFile;
@@ -52,11 +77,11 @@ import java.util.zip.ZipFile;
* Note that this class is not a subclass of java.io.File but a subclass of
* java.util.zip.ZipFile and you can only read JarFiles with it (although
* there are constructors that take a File object).
- * <p>
- * XXX - verification of Manifest signatures is not yet implemented.
*
* @since 1.2
* @author Mark Wielaard (mark@klomp.org)
+ * @author Casey Marshall (csm@gnu.org) wrote the certificate and entry
+ * verification code.
*/
public class JarFile extends ZipFile
{
@@ -65,6 +90,29 @@ public class JarFile extends ZipFile
/** The name of the manifest entry: META-INF/MANIFEST.MF */
public static final String MANIFEST_NAME = "META-INF/MANIFEST.MF";
+ /** The META-INF directory entry. */
+ private static final String META_INF = "META-INF/";
+
+ /** The suffix for PKCS7 DSA signature entries. */
+ private static final String PKCS7_DSA_SUFFIX = ".DSA";
+
+ /** The suffix for PKCS7 RSA signature entries. */
+ private static final String PKCS7_RSA_SUFFIX = ".RSA";
+
+ /** The suffix for digest attributes. */
+ private static final String DIGEST_KEY_SUFFIX = "-Digest";
+
+ /** The suffix for signature files. */
+ private static final String SF_SUFFIX = ".SF";
+
+ // Signature OIDs.
+ private static final OID MD2_OID = new OID("1.2.840.113549.2.2");
+ private static final OID MD4_OID = new OID("1.2.840.113549.2.4");
+ private static final OID MD5_OID = new OID("1.2.840.113549.2.5");
+ private static final OID SHA1_OID = new OID("1.3.14.3.2.26");
+ private static final OID DSA_ENCRYPTION_OID = new OID("1.2.840.10040.4.1");
+ private static final OID RSA_ENCRYPTION_OID = new OID("1.2.840.113549.1.1.1");
+
/**
* The manifest of this file, if any, otherwise null.
* Read when first needed.
@@ -72,11 +120,34 @@ public class JarFile extends ZipFile
private Manifest manifest;
/** Whether to verify the manifest and all entries. */
- private boolean verify;
+ boolean verify;
/** Whether the has already been loaded. */
private boolean manifestRead = false;
+ /** Whether the signature files have been loaded. */
+ boolean signaturesRead = false;
+
+ /**
+ * A map between entry names and booleans, signaling whether or
+ * not that entry has been verified.
+ * Only be accessed with lock on this JarFile*/
+ HashMap verified = new HashMap();
+
+ /**
+ * A mapping from entry name to certificates, if any.
+ * Only accessed with lock on this JarFile.
+ */
+ HashMap entryCerts;
+
+ static boolean DEBUG = false;
+ static void debug(Object msg)
+ {
+ System.err.print(JarFile.class.getName());
+ System.err.print(" >>> ");
+ System.err.println(msg);
+ }
+
// Constructors
/**
@@ -235,22 +306,23 @@ public class JarFile extends ZipFile
*/
public Enumeration entries() throws IllegalStateException
{
- return new JarEnumeration(super.entries());
+ return new JarEnumeration(super.entries(), this);
}
/**
* Wraps a given Zip Entries Enumeration. For every zip entry a
* JarEntry is created and the corresponding Attributes are looked up.
- * XXX - Should also look up the certificates.
*/
- private class JarEnumeration implements Enumeration
+ private static class JarEnumeration implements Enumeration
{
private final Enumeration entries;
+ private final JarFile jarfile;
- JarEnumeration(Enumeration e)
+ JarEnumeration(Enumeration e, JarFile f)
{
entries = e;
+ jarfile = f;
}
public boolean hasMoreElements()
@@ -265,7 +337,7 @@ public class JarFile extends ZipFile
Manifest manifest;
try
{
- manifest = getManifest();
+ manifest = jarfile.getManifest();
}
catch (IOException ioe)
{
@@ -276,7 +348,36 @@ public class JarFile extends ZipFile
{
jar.attr = manifest.getAttributes(jar.getName());
}
- // XXX jar.certs
+
+ synchronized(jarfile)
+ {
+ if (!jarfile.signaturesRead)
+ try
+ {
+ jarfile.readSignatures();
+ }
+ catch (IOException ioe)
+ {
+ if (JarFile.DEBUG)
+ {
+ JarFile.debug(ioe);
+ ioe.printStackTrace();
+ }
+ jarfile.signaturesRead = true; // fudge it.
+ }
+
+ // Include the certificates only if we have asserted that the
+ // signatures are valid. This means the certificates will not be
+ // available if the entry hasn't been read yet.
+ if (jarfile.entryCerts != null
+ && jarfile.verified.get(zip.getName()) == Boolean.TRUE)
+ {
+ Set certs = (Set) jarfile.entryCerts.get(jar.getName());
+ if (certs != null)
+ jar.certs = (Certificate[])
+ certs.toArray(new Certificate[certs.size()]);
+ }
+ }
return jar;
}
}
@@ -286,7 +387,7 @@ public class JarFile extends ZipFile
* It actually returns a JarEntry not a zipEntry
* @param name XXX
*/
- public ZipEntry getEntry(String name)
+ public synchronized ZipEntry getEntry(String name)
{
ZipEntry entry = super.getEntry(name);
if (entry != null)
@@ -305,7 +406,33 @@ public class JarFile extends ZipFile
if (manifest != null)
{
jarEntry.attr = manifest.getAttributes(name);
- // XXX jarEntry.certs
+ }
+
+ if (!signaturesRead)
+ try
+ {
+ readSignatures();
+ }
+ catch (IOException ioe)
+ {
+ if (DEBUG)
+ {
+ debug(ioe);
+ ioe.printStackTrace();
+ }
+ signaturesRead = true;
+ }
+ // See the comments in the JarEnumeration for why we do this
+ // check.
+ if (DEBUG)
+ debug("entryCerts=" + entryCerts + " verified " + name
+ + " ? " + verified.get(name));
+ if (entryCerts != null && verified.get(name) == Boolean.TRUE)
+ {
+ Set certs = (Set) entryCerts.get(name);
+ if (certs != null)
+ jarEntry.certs = (Certificate[])
+ certs.toArray(new Certificate[certs.size()]);
}
return jarEntry;
}
@@ -313,15 +440,32 @@ public class JarFile extends ZipFile
}
/**
- * XXX should verify the inputstream
- * @param entry XXX
+ * Returns an input stream for the given entry. If configured to
+ * verify entries, the input stream returned will verify them while
+ * the stream is read, but only on the first time.
+ *
+ * @param entry The entry to get the input stream for.
* @exception ZipException XXX
* @exception IOException XXX
*/
public synchronized InputStream getInputStream(ZipEntry entry) throws
ZipException, IOException
{
- return super.getInputStream(entry); // XXX verify
+ // If we haven't verified the hash, do it now.
+ if (!verified.containsKey(entry.getName()) && verify)
+ {
+ if (DEBUG)
+ debug("reading and verifying " + entry);
+ return new EntryInputStream(entry, super.getInputStream(entry), this);
+ }
+ else
+ {
+ if (DEBUG)
+ debug("reading already verified entry " + entry);
+ if (verify && verified.get(entry.getName()) == Boolean.FALSE)
+ throw new ZipException("digest for " + entry + " is invalid");
+ return super.getInputStream(entry);
+ }
}
/**
@@ -342,11 +486,573 @@ public class JarFile extends ZipFile
* Returns the manifest for this JarFile or null when the JarFile does not
* contain a manifest file.
*/
- public Manifest getManifest() throws IOException
+ public synchronized Manifest getManifest() throws IOException
{
if (!manifestRead)
manifest = readManifest();
return manifest;
}
+
+ // Only called with lock on this JarFile.
+ private void readSignatures() throws IOException
+ {
+ Map pkcs7Dsa = new HashMap();
+ Map pkcs7Rsa = new HashMap();
+ Map sigFiles = new HashMap();
+
+ // Phase 1: Read all signature files. These contain the user
+ // certificates as well as the signatures themselves.
+ for (Enumeration e = super.entries(); e.hasMoreElements(); )
+ {
+ ZipEntry ze = (ZipEntry) e.nextElement();
+ String name = ze.getName();
+ if (name.startsWith(META_INF))
+ {
+ String alias = name.substring(META_INF.length());
+ if (alias.lastIndexOf('.') >= 0)
+ alias = alias.substring(0, alias.lastIndexOf('.'));
+
+ if (name.endsWith(PKCS7_DSA_SUFFIX) || name.endsWith(PKCS7_RSA_SUFFIX))
+ {
+ if (DEBUG)
+ debug("reading PKCS7 info from " + name + ", alias=" + alias);
+ PKCS7SignedData sig = null;
+ try
+ {
+ sig = new PKCS7SignedData(super.getInputStream(ze));
+ }
+ catch (CertificateException ce)
+ {
+ IOException ioe = new IOException("certificate parsing error");
+ ioe.initCause(ce);
+ throw ioe;
+ }
+ catch (CRLException crle)
+ {
+ IOException ioe = new IOException("CRL parsing error");
+ ioe.initCause(crle);
+ throw ioe;
+ }
+ if (name.endsWith(PKCS7_DSA_SUFFIX))
+ pkcs7Dsa.put(alias, sig);
+ else if (name.endsWith(PKCS7_RSA_SUFFIX))
+ pkcs7Rsa.put(alias, sig);
+ }
+ else if (name.endsWith(SF_SUFFIX))
+ {
+ if (DEBUG)
+ debug("reading signature file for " + alias + ": " + name);
+ Manifest sf = new Manifest(super.getInputStream(ze));
+ sigFiles.put(alias, sf);
+ if (DEBUG)
+ debug("result: " + sf);
+ }
+ }
+ }
+
+ // Phase 2: verify the signatures on any signature files.
+ Set validCerts = new HashSet();
+ Map entryCerts = new HashMap();
+ for (Iterator it = sigFiles.entrySet().iterator(); it.hasNext(); )
+ {
+ int valid = 0;
+ Map.Entry e = (Map.Entry) it.next();
+ String alias = (String) e.getKey();
+
+ PKCS7SignedData sig = (PKCS7SignedData) pkcs7Dsa.get(alias);
+ if (sig != null)
+ {
+ Certificate[] certs = sig.getCertificates();
+ Set signerInfos = sig.getSignerInfos();
+ for (Iterator it2 = signerInfos.iterator(); it2.hasNext(); )
+ verify(certs, (SignerInfo) it2.next(), alias, validCerts);
+ }
+
+ sig = (PKCS7SignedData) pkcs7Rsa.get(alias);
+ if (sig != null)
+ {
+ Certificate[] certs = sig.getCertificates();
+ Set signerInfos = sig.getSignerInfos();
+ for (Iterator it2 = signerInfos.iterator(); it2.hasNext(); )
+ verify(certs, (SignerInfo) it2.next(), alias, validCerts);
+ }
+
+ // It isn't a signature for anything. Punt it.
+ if (validCerts.isEmpty())
+ {
+ it.remove();
+ continue;
+ }
+
+ entryCerts.put(e.getValue(), new HashSet(validCerts));
+ validCerts.clear();
+ }
+
+ // Phase 3: verify the signature file signatures against the manifest,
+ // mapping the entry name to the target certificates.
+ this.entryCerts = new HashMap();
+ for (Iterator it = entryCerts.entrySet().iterator(); it.hasNext(); )
+ {
+ Map.Entry e = (Map.Entry) it.next();
+ Manifest sigfile = (Manifest) e.getKey();
+ Map entries = sigfile.getEntries();
+ Set certificates = (Set) e.getValue();
+
+ for (Iterator it2 = entries.entrySet().iterator(); it2.hasNext(); )
+ {
+ Map.Entry e2 = (Map.Entry) it2.next();
+ String entryname = String.valueOf(e2.getKey());
+ Attributes attr = (Attributes) e2.getValue();
+ if (verifyHashes(entryname, attr))
+ {
+ if (DEBUG)
+ debug("entry " + entryname + " has certificates " + certificates);
+ Set s = (Set) this.entryCerts.get(entryname);
+ if (s != null)
+ s.addAll(certificates);
+ else
+ this.entryCerts.put(entryname, new HashSet(certificates));
+ }
+ }
+ }
+
+ signaturesRead = true;
+ }
+
+ /**
+ * Tell if the given signer info is over the given alias's signature file,
+ * given one of the certificates specified.
+ */
+ private void verify(Certificate[] certs, SignerInfo signerInfo,
+ String alias, Set validCerts)
+ {
+ Signature sig = null;
+ try
+ {
+ OID alg = signerInfo.getDigestEncryptionAlgorithmId();
+ if (alg.equals(DSA_ENCRYPTION_OID))
+ {
+ if (!signerInfo.getDigestAlgorithmId().equals(SHA1_OID))
+ return;
+ sig = Signature.getInstance("SHA1withDSA");
+ }
+ else if (alg.equals(RSA_ENCRYPTION_OID))
+ {
+ OID hash = signerInfo.getDigestAlgorithmId();
+ if (hash.equals(MD2_OID))
+ sig = Signature.getInstance("md2WithRsaEncryption");
+ else if (hash.equals(MD4_OID))
+ sig = Signature.getInstance("md4WithRsaEncryption");
+ else if (hash.equals(MD5_OID))
+ sig = Signature.getInstance("md5WithRsaEncryption");
+ else if (hash.equals(SHA1_OID))
+ sig = Signature.getInstance("sha1WithRsaEncryption");
+ else
+ return;
+ }
+ else
+ {
+ if (DEBUG)
+ debug("unsupported signature algorithm: " + alg);
+ return;
+ }
+ }
+ catch (NoSuchAlgorithmException nsae)
+ {
+ if (DEBUG)
+ {
+ debug(nsae);
+ nsae.printStackTrace();
+ }
+ return;
+ }
+ ZipEntry sigFileEntry = super.getEntry(META_INF + alias + SF_SUFFIX);
+ if (sigFileEntry == null)
+ return;
+ for (int i = 0; i < certs.length; i++)
+ {
+ if (!(certs[i] instanceof X509Certificate))
+ continue;
+ X509Certificate cert = (X509Certificate) certs[i];
+ if (!cert.getIssuerX500Principal().equals(signerInfo.getIssuer()) ||
+ !cert.getSerialNumber().equals(signerInfo.getSerialNumber()))
+ continue;
+ try
+ {
+ sig.initVerify(cert.getPublicKey());
+ InputStream in = super.getInputStream(sigFileEntry);
+ if (in == null)
+ continue;
+ byte[] buf = new byte[1024];
+ int len = 0;
+ while ((len = in.read(buf)) != -1)
+ sig.update(buf, 0, len);
+ if (sig.verify(signerInfo.getEncryptedDigest()))
+ {
+ if (DEBUG)
+ debug("signature for " + cert.getSubjectDN() + " is good");
+ validCerts.add(cert);
+ }
+ }
+ catch (IOException ioe)
+ {
+ continue;
+ }
+ catch (InvalidKeyException ike)
+ {
+ continue;
+ }
+ catch (SignatureException se)
+ {
+ continue;
+ }
+ }
+ }
+
+ /**
+ * Verifies that the digest(s) in a signature file were, in fact, made
+ * over the manifest entry for ENTRY.
+ *
+ * @param entry The entry name.
+ * @param attr The attributes from the signature file to verify.
+ */
+ private boolean verifyHashes(String entry, Attributes attr)
+ {
+ int verified = 0;
+
+ // The bytes for ENTRY's manifest entry, which are signed in the
+ // signature file.
+ byte[] entryBytes = null;
+ try
+ {
+ ZipEntry e = super.getEntry(entry);
+ if (e == null)
+ {
+ if (DEBUG)
+ debug("verifyHashes: no entry '" + entry + "'");
+ return false;
+ }
+ entryBytes = readManifestEntry(e);
+ }
+ catch (IOException ioe)
+ {
+ if (DEBUG)
+ {
+ debug(ioe);
+ ioe.printStackTrace();
+ }
+ return false;
+ }
+
+ for (Iterator it = attr.entrySet().iterator(); it.hasNext(); )
+ {
+ Map.Entry e = (Map.Entry) it.next();
+ String key = String.valueOf(e.getKey());
+ if (!key.endsWith(DIGEST_KEY_SUFFIX))
+ continue;
+ String alg = key.substring(0, key.length() - DIGEST_KEY_SUFFIX.length());
+ try
+ {
+ byte[] hash = Base64InputStream.decode((String) e.getValue());
+ MessageDigest md = MessageDigest.getInstance(alg);
+ md.update(entryBytes);
+ byte[] hash2 = md.digest();
+ if (DEBUG)
+ debug("verifying SF entry " + entry + " alg: " + md.getAlgorithm()
+ + " expect=" + new java.math.BigInteger(hash).toString(16)
+ + " comp=" + new java.math.BigInteger(hash2).toString(16));
+ if (!Arrays.equals(hash, hash2))
+ return false;
+ verified++;
+ }
+ catch (IOException ioe)
+ {
+ if (DEBUG)
+ {
+ debug(ioe);
+ ioe.printStackTrace();
+ }
+ return false;
+ }
+ catch (NoSuchAlgorithmException nsae)
+ {
+ if (DEBUG)
+ {
+ debug(nsae);
+ nsae.printStackTrace();
+ }
+ return false;
+ }
+ }
+
+ // We have to find at least one valid digest.
+ return verified > 0;
+ }
+
+ /**
+ * Read the raw bytes that comprise a manifest entry. We can't use the
+ * Manifest object itself, because that loses information (such as line
+ * endings, and order of entries).
+ */
+ private byte[] readManifestEntry(ZipEntry entry) throws IOException
+ {
+ InputStream in = super.getInputStream(super.getEntry(MANIFEST_NAME));
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
+ byte[] target = ("Name: " + entry.getName()).getBytes();
+ int t = 0, c, prev = -1, state = 0, l = -1;
+
+ while ((c = in.read()) != -1)
+ {
+// if (DEBUG)
+// debug("read "
+// + (c == '\n' ? "\\n" : (c == '\r' ? "\\r" : String.valueOf((char) c)))
+// + " state=" + state + " prev="
+// + (prev == '\n' ? "\\n" : (prev == '\r' ? "\\r" : String.valueOf((char) prev)))
+// + " t=" + t + (t < target.length ? (" target[t]=" + (char) target[t]) : "")
+// + " l=" + l);
+ switch (state)
+ {
+
+ // Step 1: read until we find the "target" bytes: the start
+ // of the entry we need to read.
+ case 0:
+ if (((byte) c) != target[t])
+ t = 0;
+ else
+ {
+ t++;
+ if (t == target.length)
+ {
+ out.write(target);
+ state = 1;
+ }
+ }
+ break;
+
+ // Step 2: assert that there is a newline character after
+ // the "target" bytes.
+ case 1:
+ if (c != '\n' && c != '\r')
+ {
+ out.reset();
+ t = 0;
+ state = 0;
+ }
+ else
+ {
+ out.write(c);
+ state = 2;
+ }
+ break;
+
+ // Step 3: read this whole entry, until we reach an empty
+ // line.
+ case 2:
+ if (c == '\n')
+ {
+ out.write(c);
+ // NL always terminates a line.
+ if (l == 0 || (l == 1 && prev == '\r'))
+ return out.toByteArray();
+ l = 0;
+ }
+ else
+ {
+ // Here we see a blank line terminated by a CR,
+ // followed by the next entry. Technically, `c' should
+ // always be 'N' at this point.
+ if (l == 1 && prev == '\r')
+ return out.toByteArray();
+ out.write(c);
+ l++;
+ }
+ prev = c;
+ break;
+
+ default:
+ throw new RuntimeException("this statement should be unreachable");
+ }
+ }
+
+ // The last entry, with a single CR terminating the line.
+ if (state == 2 && prev == '\r' && l == 0)
+ return out.toByteArray();
+
+ // We should not reach this point, we didn't find the entry (or, possibly,
+ // it is the last entry and is malformed).
+ throw new IOException("could not find " + entry + " in manifest");
+ }
+
+ /**
+ * A utility class that verifies jar entries as they are read.
+ */
+ private static class EntryInputStream extends FilterInputStream
+ {
+ private final JarFile jarfile;
+ private final long length;
+ private long pos;
+ private final ZipEntry entry;
+ private final byte[][] hashes;
+ private final MessageDigest[] md;
+ private boolean checked;
+
+ EntryInputStream(final ZipEntry entry,
+ final InputStream in,
+ final JarFile jar)
+ throws IOException
+ {
+ super(in);
+ this.entry = entry;
+ this.jarfile = jar;
+
+ length = entry.getSize();
+ pos = 0;
+ checked = false;
+
+ Attributes attr;
+ Manifest manifest = jarfile.getManifest();
+ if (manifest != null)
+ attr = manifest.getAttributes(entry.getName());
+ else
+ attr = null;
+ if (DEBUG)
+ debug("verifying entry " + entry + " attr=" + attr);
+ if (attr == null)
+ {
+ hashes = new byte[0][];
+ md = new MessageDigest[0];
+ }
+ else
+ {
+ List hashes = new LinkedList();
+ List md = new LinkedList();
+ for (Iterator it = attr.entrySet().iterator(); it.hasNext(); )
+ {
+ Map.Entry e = (Map.Entry) it.next();
+ String key = String.valueOf(e.getKey());
+ if (key == null)
+ continue;
+ if (!key.endsWith(DIGEST_KEY_SUFFIX))
+ continue;
+ hashes.add(Base64InputStream.decode((String) e.getValue()));
+ try
+ {
+ md.add(MessageDigest.getInstance
+ (key.substring(0, key.length() - DIGEST_KEY_SUFFIX.length())));
+ }
+ catch (NoSuchAlgorithmException nsae)
+ {
+ IOException ioe = new IOException("no such message digest: " + key);
+ ioe.initCause(nsae);
+ throw ioe;
+ }
+ }
+ if (DEBUG)
+ debug("digests=" + md);
+ this.hashes = (byte[][]) hashes.toArray(new byte[hashes.size()][]);
+ this.md = (MessageDigest[]) md.toArray(new MessageDigest[md.size()]);
+ }
+ }
+
+ public boolean markSupported()
+ {
+ return false;
+ }
+
+ public void mark(int readLimit)
+ {
+ }
+
+ public void reset()
+ {
+ }
+
+ public int read() throws IOException
+ {
+ int b = super.read();
+ if (b == -1)
+ {
+ eof();
+ return -1;
+ }
+ for (int i = 0; i < md.length; i++)
+ md[i].update((byte) b);
+ pos++;
+ if (length > 0 && pos >= length)
+ eof();
+ return b;
+ }
+
+ public int read(byte[] buf, int off, int len) throws IOException
+ {
+ int count = super.read(buf, off, (int) Math.min(len, (length != 0
+ ? length - pos
+ : Integer.MAX_VALUE)));
+ if (count == -1 || (length > 0 && pos >= length))
+ {
+ eof();
+ return -1;
+ }
+ for (int i = 0; i < md.length; i++)
+ md[i].update(buf, off, count);
+ pos += count;
+ if (length != 0 && pos >= length)
+ eof();
+ return count;
+ }
+
+ public int read(byte[] buf) throws IOException
+ {
+ return read(buf, 0, buf.length);
+ }
+
+ public long skip(long bytes) throws IOException
+ {
+ byte[] b = new byte[1024];
+ long amount = 0;
+ while (amount < bytes)
+ {
+ int l = read(b, 0, (int) Math.min(b.length, bytes - amount));
+ if (l == -1)
+ break;
+ amount += l;
+ }
+ return amount;
+ }
+
+ private void eof() throws IOException
+ {
+ if (checked)
+ return;
+ checked = true;
+ for (int i = 0; i < md.length; i++)
+ {
+ byte[] hash = md[i].digest();
+ if (DEBUG)
+ debug("verifying " + md[i].getAlgorithm() + " expect="
+ + new java.math.BigInteger(hashes[i]).toString(16)
+ + " comp=" + new java.math.BigInteger(hash).toString(16));
+ if (!Arrays.equals(hash, hashes[i]))
+ {
+ synchronized(jarfile)
+ {
+ if (DEBUG)
+ debug(entry + " could NOT be verified");
+ jarfile.verified.put(entry.getName(), Boolean.FALSE);
+ }
+ return;
+ // XXX ??? what do we do here?
+ // throw new ZipException("message digest mismatch");
+ }
+ }
+
+ synchronized(jarfile)
+ {
+ if (DEBUG)
+ debug(entry + " has been VERIFIED");
+ jarfile.verified.put(entry.getName(), Boolean.TRUE);
+ }
+ }
+ }
}
diff --git a/libjava/java/util/logging/FileHandler.java b/libjava/java/util/logging/FileHandler.java
index 6bbc23c0a9c..ae8eb865ae3 100644
--- a/libjava/java/util/logging/FileHandler.java
+++ b/libjava/java/util/logging/FileHandler.java
@@ -1,5 +1,5 @@
/* FileHandler.java -- a class for publishing log messages to log files
- Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -403,7 +403,7 @@ public class FileHandler
* the system property <code>"user.home"</code>, <code>"%g"</code>
* by the value of <code>generation</code>, <code>"%u"</code> by the
* value of <code>uniqueNumber</code>, and <code>"%%"</code> by a
- * single percent character. If <code>pattern<code> does
+ * single percent character. If <code>pattern</code> does
* <em>not</em> contain the sequence <code>"%g"</code>,
* the value of <code>generation</code> will be appended to
* the result.
diff --git a/libjava/java/util/logging/Level.java b/libjava/java/util/logging/Level.java
index b121437dd93..5c3c22bf906 100644
--- a/libjava/java/util/logging/Level.java
+++ b/libjava/java/util/logging/Level.java
@@ -1,5 +1,5 @@
/* Level.java -- a class for indicating logging levels
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -48,7 +48,7 @@ import java.util.ResourceBundle;
* purposes, however, applications can sub-class Level in order to define
* custom logging levels.
*
- * @author Sascha Brawer <brawer@acm.org>
+ * @author Sascha Brawer (brawer@acm.org)
*/
public class Level implements Serializable
{
diff --git a/libjava/java/util/logging/Logger.java b/libjava/java/util/logging/Logger.java
index 99c9be9a311..29635558598 100644
--- a/libjava/java/util/logging/Logger.java
+++ b/libjava/java/util/logging/Logger.java
@@ -1,5 +1,5 @@
/* Logger.java -- a class for logging messages
- Copyright (C) 2002, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -1169,17 +1169,5 @@ public class Logger
* That should be the initial caller of a logging method.
* @return caller of the initial looging method
*/
- private StackTraceElement getCallerStackFrame()
- {
- Throwable t = new Throwable();
- StackTraceElement[] stackTrace = t.getStackTrace();
- int index = 0;
- // skip to stackentries until this class
- while(!stackTrace[index].getClassName().equals(getClass().getName())){index++;}
- // skip the stackentries of this class
- while(stackTrace[index].getClassName().equals(getClass().getName())){index++;}
-
- return stackTrace[index];
- }
-
+ private native StackTraceElement getCallerStackFrame();
}
diff --git a/libjava/java/util/logging/natLogger.cc b/libjava/java/util/logging/natLogger.cc
new file mode 100644
index 00000000000..15d1ab70efd
--- /dev/null
+++ b/libjava/java/util/logging/natLogger.cc
@@ -0,0 +1,55 @@
+// natLogger.cc - Native part of Logger class.
+
+/* Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation
+
+ This Logger is part of libgcj.
+
+This software is copyrighted work licensed under the terms of the
+Libgcj License. Please consult the Logger "LIBGCJ_LICENSE" for
+details. */
+
+#include <config.h>
+#include <platform.h>
+
+#include <string.h>
+
+#pragma implementation "Logger.h"
+
+#include <gcj/cni.h>
+#include <jvm.h>
+
+
+#include <java/lang/Object.h>
+#include <java/lang/Class.h>
+#include <java/util/logging/Logger.h>
+#include <java/lang/StackTraceElement.h>
+#include <java/lang/ArrayIndexOutOfBoundsException.h>
+
+java::lang::StackTraceElement*
+java::util::logging::Logger::getCallerStackFrame ()
+{
+ gnu::gcj::runtime::StackTrace *t
+ = new gnu::gcj::runtime::StackTrace(4);
+ java::lang::Class *klass = NULL;
+ int i = 2;
+ try
+ {
+ // skip until this class
+ while ((klass = t->classAt (i)) != getClass())
+ i++;
+ // skip the stackentries of this class
+ while ((klass = t->classAt (i)) == getClass() || klass == NULL)
+ i++;
+ }
+ catch (::java::lang::ArrayIndexOutOfBoundsException *e)
+ {
+ // FIXME: RuntimeError
+ }
+
+ java::lang::StackTraceElement *e
+ = new java::lang::StackTraceElement
+ (JvNewStringUTF (""), 0,
+ klass->getName(), t->methodAt(i), false);
+
+ return e;
+}
diff --git a/libjava/java/util/prefs/AbstractPreferences.java b/libjava/java/util/prefs/AbstractPreferences.java
index 69f4426e6d3..159a887c831 100644
--- a/libjava/java/util/prefs/AbstractPreferences.java
+++ b/libjava/java/util/prefs/AbstractPreferences.java
@@ -550,6 +550,8 @@ public abstract class AbstractPreferences extends Preferences {
String value;
try {
value = getSpi(key);
+ } catch (ThreadDeath death) {
+ throw death;
} catch (Throwable t) {
value = null;
}
diff --git a/libjava/java/util/prefs/BackingStoreException.java b/libjava/java/util/prefs/BackingStoreException.java
index 2607142d0e8..850825155d9 100644
--- a/libjava/java/util/prefs/BackingStoreException.java
+++ b/libjava/java/util/prefs/BackingStoreException.java
@@ -1,6 +1,6 @@
/* BackingStoreException.java - chained exception thrown when backing store
fails
- Copyright (C) 2001, 2002 Free Software Foundation, Inc.
+ Copyright (C) 2001, 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -52,7 +52,7 @@ import java.io.ObjectOutputStream;
* <p>Note that although this class inherits the Serializable interface, an
* attempt to serialize will fail with a <code>NotSerializableException</code>.
*
- * @author Mark Wielaard <mark@klomp.org>
+ * @author Mark Wielaard (mark@klomp.org)
* @since 1.4
* @status updated to 1.4
*/
diff --git a/libjava/java/util/prefs/InvalidPreferencesFormatException.java b/libjava/java/util/prefs/InvalidPreferencesFormatException.java
index 05996315261..220e1420c52 100644
--- a/libjava/java/util/prefs/InvalidPreferencesFormatException.java
+++ b/libjava/java/util/prefs/InvalidPreferencesFormatException.java
@@ -1,6 +1,6 @@
/* InvalidPreferencesFormatException - indicates reading prefs from stream
failed
- Copyright (C) 2001, 2002 Free Software Foundation, Inc.
+ Copyright (C) 2001, 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -49,8 +49,9 @@ import java.io.ObjectOutputStream;
*
* <p>Note that although this class inherits the Serializable interface, an
* attempt to serialize will fail with a <code>NotSerializableException</code>.
+ * </p>
*
- * @author Mark Wielaard <mark@klomp.org>
+ * @author Mark Wielaard (mark@klomp.org)
* @see Preferences
* @since 1.4
* @status updated to 1.4
diff --git a/libjava/java/util/prefs/Preferences.java b/libjava/java/util/prefs/Preferences.java
index c0f0231951f..4186c805a0c 100644
--- a/libjava/java/util/prefs/Preferences.java
+++ b/libjava/java/util/prefs/Preferences.java
@@ -1,5 +1,5 @@
/* Preferences -- Preference node containing key value entries and subnodes
- Copyright (C) 2001, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2001, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -234,7 +234,7 @@ public abstract class Preferences {
* The package node name of the object is determined by dropping the
* class name of the object of the fully quallified class name and
* replacing all '.' to '/' in the package name. If the class of the
- * object has no package then the package node name is "<unnamed>".
+ * object has no package then the package node name is "&lt;unnamed&gt;".
* The returened node is <code>systemRoot().node(packageNodeName)</code>.
*
* @param o Object whose default system preference node is requested
@@ -253,7 +253,7 @@ public abstract class Preferences {
* The package node name of the object is determined by dropping the
* class name of the object of the fully quallified class name and
* replacing all '.' to '/' in the package name. If the class of the
- * object has no package then the package node name is "<unnamed>".
+ * object has no package then the package node name is "&lt;unnamed&gt;".
* The returened node is <code>userRoot().node(packageNodeName)</code>.
*
* @param o Object whose default user preference node is requested