summaryrefslogtreecommitdiffstats
path: root/libjava/classpath/javax
diff options
context:
space:
mode:
Diffstat (limited to 'libjava/classpath/javax')
-rw-r--r--libjava/classpath/javax/accessibility/AccessibleAction.java16
-rw-r--r--libjava/classpath/javax/accessibility/AccessibleAttributeSequence.java22
-rw-r--r--libjava/classpath/javax/accessibility/AccessibleEditableText.java2
-rw-r--r--libjava/classpath/javax/accessibility/AccessibleRelationSet.java4
-rw-r--r--libjava/classpath/javax/accessibility/AccessibleRole.java13
-rw-r--r--libjava/classpath/javax/accessibility/AccessibleTextSequence.java17
-rw-r--r--libjava/classpath/javax/imageio/ImageReader.java18
-rw-r--r--libjava/classpath/javax/imageio/ImageTypeSpecifier.java6
-rw-r--r--libjava/classpath/javax/imageio/ImageWriter.java4
-rw-r--r--libjava/classpath/javax/imageio/metadata/IIOMetadataFormatImpl.java5
-rw-r--r--libjava/classpath/javax/imageio/metadata/IIOMetadataNode.java2
-rw-r--r--libjava/classpath/javax/imageio/spi/ServiceRegistry.java8
-rw-r--r--libjava/classpath/javax/imageio/stream/ImageInputStream.java2
-rw-r--r--libjava/classpath/javax/imageio/stream/MemoryCacheImageInputStream.java2
-rw-r--r--libjava/classpath/javax/management/MBeanPermission.java2
-rw-r--r--libjava/classpath/javax/management/NotificationBroadcasterSupport.java4
-rw-r--r--libjava/classpath/javax/management/ObjectName.java1
-rw-r--r--libjava/classpath/javax/management/StandardMBean.java6
-rw-r--r--libjava/classpath/javax/management/openmbean/ArrayType.java1
-rw-r--r--libjava/classpath/javax/management/package.html197
-rw-r--r--libjava/classpath/javax/management/remote/NotificationResult.java166
-rw-r--r--libjava/classpath/javax/management/remote/TargetedNotification.java127
-rw-r--r--libjava/classpath/javax/management/remote/package.html53
-rw-r--r--libjava/classpath/javax/management/remote/rmi/RMIConnection.java1151
-rw-r--r--libjava/classpath/javax/management/remote/rmi/RMIServer.java89
-rw-r--r--libjava/classpath/javax/net/ssl/HttpsURLConnection.java1
-rw-r--r--libjava/classpath/javax/print/attribute/standard/JobStateReasons.java2
-rw-r--r--libjava/classpath/javax/print/attribute/standard/MediaSize.java4
-rw-r--r--libjava/classpath/javax/print/attribute/standard/PrinterStateReasons.java2
-rw-r--r--libjava/classpath/javax/rmi/CORBA/PortableRemoteObjectDelegate.java6
-rw-r--r--libjava/classpath/javax/rmi/CORBA/Util.java2
-rw-r--r--libjava/classpath/javax/rmi/CORBA/UtilDelegate.java4
-rw-r--r--libjava/classpath/javax/rmi/CORBA/ValueHandler.java2
-rw-r--r--libjava/classpath/javax/rmi/PortableRemoteObject.java4
-rw-r--r--libjava/classpath/javax/rmi/ssl/SslRMIClientSocketFactory.java10
-rw-r--r--libjava/classpath/javax/swing/JFrame.java2
-rw-r--r--libjava/classpath/javax/swing/JTree.java2
-rw-r--r--libjava/classpath/javax/swing/RepaintManager.java2
-rw-r--r--libjava/classpath/javax/swing/TransferHandler.java2
-rw-r--r--libjava/classpath/javax/swing/plaf/basic/BasicDirectoryModel.java2
-rw-r--r--libjava/classpath/javax/swing/plaf/basic/BasicFileChooserUI.java1
-rw-r--r--libjava/classpath/javax/swing/plaf/basic/BasicGraphicsUtils.java2
-rw-r--r--libjava/classpath/javax/swing/plaf/basic/BasicLabelUI.java1
-rw-r--r--libjava/classpath/javax/swing/plaf/basic/BasicTreeUI.java8
-rw-r--r--libjava/classpath/javax/swing/plaf/metal/MetalScrollButton.java1
-rw-r--r--libjava/classpath/javax/swing/table/DefaultTableCellRenderer.java1
-rw-r--r--libjava/classpath/javax/swing/table/DefaultTableColumnModel.java8
-rw-r--r--libjava/classpath/javax/swing/text/DefaultStyledDocument.java3
-rw-r--r--libjava/classpath/javax/swing/text/GlyphView.java1
-rw-r--r--libjava/classpath/javax/swing/text/ParagraphView.java3
-rw-r--r--libjava/classpath/javax/swing/text/html/MinimalHTMLWriter.java2
-rw-r--r--libjava/classpath/javax/swing/text/html/ResetableToggleButtonModel.java1
-rw-r--r--libjava/classpath/javax/swing/text/html/parser/DTD.java6
-rw-r--r--libjava/classpath/javax/swing/text/html/parser/Entity.java2
-rw-r--r--libjava/classpath/javax/swing/tree/DefaultMutableTreeNode.java61
-rw-r--r--libjava/classpath/javax/swing/tree/DefaultTreeCellEditor.java40
-rw-r--r--libjava/classpath/javax/swing/tree/DefaultTreeCellRenderer.java5
-rw-r--r--libjava/classpath/javax/swing/tree/DefaultTreeSelectionModel.java51
-rw-r--r--libjava/classpath/javax/swing/tree/FixedHeightLayoutCache.java30
-rw-r--r--libjava/classpath/javax/swing/tree/VariableHeightLayoutCache.java30
-rw-r--r--libjava/classpath/javax/swing/undo/StateEdit.java4
-rw-r--r--libjava/classpath/javax/swing/undo/UndoManager.java12
-rw-r--r--libjava/classpath/javax/tools/Diagnostic.java167
-rw-r--r--libjava/classpath/javax/tools/DiagnosticListener.java61
-rw-r--r--libjava/classpath/javax/tools/FileObject.java155
-rw-r--r--libjava/classpath/javax/xml/datatype/DatatypeFactory.java3
-rw-r--r--libjava/classpath/javax/xml/namespace/QName.java3
-rw-r--r--libjava/classpath/javax/xml/stream/XMLEventFactory.java1
-rw-r--r--libjava/classpath/javax/xml/stream/XMLInputFactory.java1
-rw-r--r--libjava/classpath/javax/xml/stream/events/Attribute.java2
70 files changed, 2394 insertions, 237 deletions
diff --git a/libjava/classpath/javax/accessibility/AccessibleAction.java b/libjava/classpath/javax/accessibility/AccessibleAction.java
index a7cf05e4a04..c2e00714176 100644
--- a/libjava/classpath/javax/accessibility/AccessibleAction.java
+++ b/libjava/classpath/javax/accessibility/AccessibleAction.java
@@ -78,6 +78,22 @@ public interface AccessibleAction
static final String TOGGLE_EXPAND = "toggle expand";
/**
+ * The name of an action which causes a component to perform its default
+ * action.
+ *
+ * @since 1.6
+ */
+ static final String CLICK = "click";
+
+ /**
+ * The name of an action which toggles the state of a popup, causing a
+ * hidden popup to be displayed and a visible popup to be hidden.
+ *
+ * @since 1.6
+ */
+ static final String TOGGLE_POPUP = "toggle popup";
+
+ /**
* Get the number possible actions for this object, with the zeroth
* representing the default action.
*
diff --git a/libjava/classpath/javax/accessibility/AccessibleAttributeSequence.java b/libjava/classpath/javax/accessibility/AccessibleAttributeSequence.java
index 5ee50e5d787..de8edcb9706 100644
--- a/libjava/classpath/javax/accessibility/AccessibleAttributeSequence.java
+++ b/libjava/classpath/javax/accessibility/AccessibleAttributeSequence.java
@@ -41,8 +41,12 @@ package javax.accessibility;
import javax.swing.text.AttributeSet;
/**
- * This is a convenience class that represents an accessible
- * attribute sequence.
+ * This is a convenience class that wraps together a sequence
+ * of text with the attributes applied to it. This allows a single
+ * object to be used when
+ * {@link AccessibleContext#ACCESSIBLE_TEXT_ATTRIBUTES_CHANGED}
+ * events are fired.
+ *
* @since 1.5
*/
public class AccessibleAttributeSequence
@@ -63,9 +67,19 @@ public class AccessibleAttributeSequence
public int endIndex;
/**
- * Create a new instance.
+ * Creates a new instance using the specified attributes
+ * and the supplied start and end indicies.
+ *
+ * @param start the index of the start of the text.
+ * @param end the index of the end of the text.
+ * @param attr the attributes applied to the text sequence.
+ * @since 1.6
*/
- public AccessibleAttributeSequence()
+ public AccessibleAttributeSequence(int start, int end, AttributeSet attr)
{
+ startIndex = start;
+ endIndex = end;
+ attributes = attr;
}
+
}
diff --git a/libjava/classpath/javax/accessibility/AccessibleEditableText.java b/libjava/classpath/javax/accessibility/AccessibleEditableText.java
index 07d7530e4f4..308016a3966 100644
--- a/libjava/classpath/javax/accessibility/AccessibleEditableText.java
+++ b/libjava/classpath/javax/accessibility/AccessibleEditableText.java
@@ -125,7 +125,7 @@ public interface AccessibleEditableText extends AccessibleText
* Select the text between two points.
*
* @param start the start position, inclusive
- * @param end the end position, exclusive
+ * @param stop the end position, exclusive
*/
// XXX What happens if indices are out of bounds?
void selectText(int start, int stop);
diff --git a/libjava/classpath/javax/accessibility/AccessibleRelationSet.java b/libjava/classpath/javax/accessibility/AccessibleRelationSet.java
index 768c9cd791c..49161d77e9d 100644
--- a/libjava/classpath/javax/accessibility/AccessibleRelationSet.java
+++ b/libjava/classpath/javax/accessibility/AccessibleRelationSet.java
@@ -168,7 +168,7 @@ public class AccessibleRelationSet
{
int i = relations.size();
while (--i >= 0)
- if (((AccessibleRelation) relations.get(i)).key.equals(key))
+ if ((relations.get(i)).key.equals(key))
return true;
return false;
}
@@ -184,7 +184,7 @@ public class AccessibleRelationSet
int i = relations.size();
while (--i >= 0)
{
- AccessibleRelation r = (AccessibleRelation) relations.get(i);
+ AccessibleRelation r = relations.get(i);
if (r.key.equals(key))
return r;
}
diff --git a/libjava/classpath/javax/accessibility/AccessibleRole.java b/libjava/classpath/javax/accessibility/AccessibleRole.java
index a5396f147f5..c568b4fe93b 100644
--- a/libjava/classpath/javax/accessibility/AccessibleRole.java
+++ b/libjava/classpath/javax/accessibility/AccessibleRole.java
@@ -517,6 +517,19 @@ public class AccessibleRole extends AccessibleBundle
= new AccessibleRole("ruler");
/**
+ * A HTML container is an accessible object which contains other
+ * accessible objects that together form some HTML content. For example,
+ * the content may be a sequence of text containing a link, which
+ * would be represent as two children, one an {@link AccessibleText}
+ * object holding the normal text and the other an
+ * {@link AccessibleHypertext} object representing the link.
+ *
+ * @since 1.6
+ */
+ public static final AccessibleRole HTML_CONTAINER
+ = new AccessibleRole("HTML container");
+
+ /**
* Create a new constant with a locale independent key. Follow the example,
* keep the constructor private and make public constants instead.
*
diff --git a/libjava/classpath/javax/accessibility/AccessibleTextSequence.java b/libjava/classpath/javax/accessibility/AccessibleTextSequence.java
index 88fa4c2b880..b400160aa35 100644
--- a/libjava/classpath/javax/accessibility/AccessibleTextSequence.java
+++ b/libjava/classpath/javax/accessibility/AccessibleTextSequence.java
@@ -39,7 +39,10 @@ exception statement from your version. */
package javax.accessibility;
/**
- * This is a convenience class that encapsulates a String and a range.
+ * This is a convenience class that encapsulates a string of text
+ * and a range specifying where, within a larger body of text, the
+ * string may be found.
+ *
* @since 1.5
*/
public class AccessibleTextSequence
@@ -61,8 +64,18 @@ public class AccessibleTextSequence
/**
* Create a new instance.
+ *
+ * @param start the initial index of the text within a larger
+ * body of text.
+ * @param end the final index of the text within a larger body
+ * of text.
+ * @param txt the text itself.
+ * @since 1.6
*/
- public AccessibleTextSequence()
+ public AccessibleTextSequence(int start, int end, String txt)
{
+ startIndex = start;
+ endIndex = end;
+ text = txt;
}
}
diff --git a/libjava/classpath/javax/imageio/ImageReader.java b/libjava/classpath/javax/imageio/ImageReader.java
index c7eed06fbdc..269493f2330 100644
--- a/libjava/classpath/javax/imageio/ImageReader.java
+++ b/libjava/classpath/javax/imageio/ImageReader.java
@@ -429,7 +429,7 @@ public abstract class ImageReader
* IllegalStateException). If input is null then the current input
* source will be removed.
*
- * @param input the input source object
+ * @param in the input source object
* @param seekForwardOnly true if this reader should be allowed to
* read input from the data stream more than once, false otherwise
*
@@ -1498,7 +1498,7 @@ public abstract class ImageReader
* null. IllegalArgumentException is thrown if either region will
* contain 0 pixels after clipping.
*
- * @param image read parameters, or null
+ * @param param read parameters, or null
* @param srcWidth the width of the source image
* @param srcHeight the height of the source image
* @param image the destination image, or null
@@ -1734,7 +1734,7 @@ public abstract class ImageReader
public ImageTypeSpecifier getRawImageType (int imageIndex)
throws IOException
{
- return (ImageTypeSpecifier) getImageTypes(imageIndex).next();
+ return getImageTypes(imageIndex).next();
}
/**
@@ -1828,7 +1828,7 @@ public abstract class ImageReader
* warning listeners will be notified of read progress, changes in
* sample sets and warnings respectively.
*
- * @param the index of the image frame to read
+ * @param imageIndex the index of the image frame to read
*
* @return a buffered image
*
@@ -1855,8 +1855,8 @@ public abstract class ImageReader
* The source and destination band settings are checked with a call
* to checkReadParamBandSettings.
*
- * @param the index of the image frame to read
- * @param the image read parameters
+ * @param imageIndex the index of the image frame to read
+ * @param param the image read parameters
*
* @return an IIOImage
*
@@ -1902,7 +1902,7 @@ public abstract class ImageReader
* Each set of source and destination band settings are checked with
* a call to checkReadParamBandSettings.
*
- * @param an iterator over the image read parameters
+ * @param params iterator over the image read parameters
*
* @return an IIOImage
*
@@ -1938,8 +1938,8 @@ public abstract class ImageReader
* before this method returns and so listeners will not necessarily
* be notified.
*
- * @param the index of the image frame to read
- * @param the image read parameters
+ * @param imageIndex the index of the image frame to read
+ * @param param the image read parameters
*
* @return a rendered image
*
diff --git a/libjava/classpath/javax/imageio/ImageTypeSpecifier.java b/libjava/classpath/javax/imageio/ImageTypeSpecifier.java
index 05b3a26d493..3faa3c937c3 100644
--- a/libjava/classpath/javax/imageio/ImageTypeSpecifier.java
+++ b/libjava/classpath/javax/imageio/ImageTypeSpecifier.java
@@ -119,7 +119,7 @@ public class ImageTypeSpecifier
* @param colorSpace the color space
* @param bankIndices the bank indices at which each band will be
* stored
- * @param bandOffsets the starting band offset for each band within
+ * @param bankOffsets the starting band offset for each band within
* its bank
* @param dataType the data type, a DataBuffer constant
* @param hasAlpha true if this image type specifier should have an
@@ -168,8 +168,8 @@ public class ImageTypeSpecifier
* Create a buffered image with the given dimensions using that has
* the characteristics specified by this image type specifier.
*
- * @param the width of the buffered image, in pixels
- * @param the height of the buffered image, in pixels
+ * @param width width of the buffered image, in pixels
+ * @param height the height of the buffered image, in pixels
*
* @return a buffered image
*
diff --git a/libjava/classpath/javax/imageio/ImageWriter.java b/libjava/classpath/javax/imageio/ImageWriter.java
index b49e081f002..78d792c72d4 100644
--- a/libjava/classpath/javax/imageio/ImageWriter.java
+++ b/libjava/classpath/javax/imageio/ImageWriter.java
@@ -899,7 +899,7 @@ public abstract class ImageWriter
* IllegalStateException). If input is null then the current input
* source will be removed.
*
- * @param input the output destination object
+ * @param output the output destination object
*
* @exception IllegalArgumentException if input is not a valid input
* source for this writer and is not an ImageInputStream
@@ -1338,7 +1338,7 @@ public abstract class ImageWriter
* @param imageIndex the frame index at which to insert the image
* @param image the image data, metadata and thumbnails to be
* inserted
- * @param the image write parameters, or null
+ * @param param image write parameters, or null
*
* @exception IllegalStateException if output is null
* @exception UnsupportedOperationException if image insertion is
diff --git a/libjava/classpath/javax/imageio/metadata/IIOMetadataFormatImpl.java b/libjava/classpath/javax/imageio/metadata/IIOMetadataFormatImpl.java
index 78fad1a15f0..444497d7dc5 100644
--- a/libjava/classpath/javax/imageio/metadata/IIOMetadataFormatImpl.java
+++ b/libjava/classpath/javax/imageio/metadata/IIOMetadataFormatImpl.java
@@ -39,18 +39,13 @@ exception statement from your version. */
package javax.imageio.metadata;
import org.w3c.dom.Attr;
-import org.w3c.dom.DOMException;
-import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NamedNodeMap;
-import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.w3c.dom.TypeInfo;
-import org.w3c.dom.UserDataHandler;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
-import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.ResourceBundle;
diff --git a/libjava/classpath/javax/imageio/metadata/IIOMetadataNode.java b/libjava/classpath/javax/imageio/metadata/IIOMetadataNode.java
index 2d52e467078..37269f53916 100644
--- a/libjava/classpath/javax/imageio/metadata/IIOMetadataNode.java
+++ b/libjava/classpath/javax/imageio/metadata/IIOMetadataNode.java
@@ -334,7 +334,7 @@ public class IIOMetadataNode
*/
public void setAttribute(String name, String value)
{
- Attr attr = (Attr) getAttributeNode(name);
+ Attr attr = getAttributeNode(name);
if (attr != null)
attr.setValue(value);
else
diff --git a/libjava/classpath/javax/imageio/spi/ServiceRegistry.java b/libjava/classpath/javax/imageio/spi/ServiceRegistry.java
index 3051a813bc3..170ea009ad7 100644
--- a/libjava/classpath/javax/imageio/spi/ServiceRegistry.java
+++ b/libjava/classpath/javax/imageio/spi/ServiceRegistry.java
@@ -787,10 +787,10 @@ public class ServiceRegistry
* @param category the service category to which an ordering
* constraint is to be added.
*
- * @param first the provider which is supposed to come before
+ * @param firstProvider the provider which is supposed to come before
* <code>second</code>.
*
- * @param second the provider which is supposed to come after
+ * @param secondProvider the provider which is supposed to come after
* <code>first</code>.
*
* @throws IllegalArgumentException if <code>first</code> and
@@ -815,10 +815,10 @@ public class ServiceRegistry
* @param category the service category from which an ordering
* constraint is to be removed.
*
- * @param first the provider which is supposed to come before
+ * @param firstProvider the provider which is supposed to come before
* <code>second</code>.
*
- * @param second the provider which is supposed to come after
+ * @param secondProvider the provider which is supposed to come after
* <code>first</code>.
*
* @throws IllegalArgumentException if <code>first</code> and
diff --git a/libjava/classpath/javax/imageio/stream/ImageInputStream.java b/libjava/classpath/javax/imageio/stream/ImageInputStream.java
index a2af6c3e2a1..4d1b5d57aa5 100644
--- a/libjava/classpath/javax/imageio/stream/ImageInputStream.java
+++ b/libjava/classpath/javax/imageio/stream/ImageInputStream.java
@@ -469,7 +469,7 @@ public interface ImageInputStream
* @param offset the index of the first element in <code>i</code>
* that will hold read data.
*
- * @param numLongs the number of signed 32-bit integers to read
+ * @param numInts the number of signed 32-bit integers to read
* (which is one fourth of the number of bytes).
*
* @throws IndexOutOfBoundsException if <code>offset</code> or
diff --git a/libjava/classpath/javax/imageio/stream/MemoryCacheImageInputStream.java b/libjava/classpath/javax/imageio/stream/MemoryCacheImageInputStream.java
index da8a958bb64..72aa5e8d59f 100644
--- a/libjava/classpath/javax/imageio/stream/MemoryCacheImageInputStream.java
+++ b/libjava/classpath/javax/imageio/stream/MemoryCacheImageInputStream.java
@@ -39,10 +39,8 @@ exception statement from your version. */
package javax.imageio.stream;
import java.io.BufferedInputStream;
-import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
-import java.io.InputStreamReader;
/**
* @author Michael Koch (konqueror@gmx.de)
diff --git a/libjava/classpath/javax/management/MBeanPermission.java b/libjava/classpath/javax/management/MBeanPermission.java
index 2c8dfbd622d..1ee0e710433 100644
--- a/libjava/classpath/javax/management/MBeanPermission.java
+++ b/libjava/classpath/javax/management/MBeanPermission.java
@@ -224,7 +224,7 @@ public class MBeanPermission
* or either <code>null</code> or <code>"-"</code> for a
* value which may be implied by any member, but not
* imply any member itself.
- * @param objectName the {@link ObjectName} to which this permission applies,
+ * @param name the {@link ObjectName} to which this permission applies,
* or <code>null</code> for a value which may be implied by
* any object name, but not imply any object name itself.
* @param actions the actions associated with this permission.
diff --git a/libjava/classpath/javax/management/NotificationBroadcasterSupport.java b/libjava/classpath/javax/management/NotificationBroadcasterSupport.java
index 59d9ec28e16..7eba6eccf25 100644
--- a/libjava/classpath/javax/management/NotificationBroadcasterSupport.java
+++ b/libjava/classpath/javax/management/NotificationBroadcasterSupport.java
@@ -105,7 +105,7 @@ public class NotificationBroadcasterSupport
*/
public NotificationBroadcasterSupport()
{
- this(null, null);
+ this(null, (MBeanNotificationInfo[]) null);
}
/**
@@ -124,7 +124,7 @@ public class NotificationBroadcasterSupport
*/
public NotificationBroadcasterSupport(Executor executor)
{
- this(executor, null);
+ this(executor, (MBeanNotificationInfo) null);
}
/**
diff --git a/libjava/classpath/javax/management/ObjectName.java b/libjava/classpath/javax/management/ObjectName.java
index 4ea21cdc7ae..1fb51506f04 100644
--- a/libjava/classpath/javax/management/ObjectName.java
+++ b/libjava/classpath/javax/management/ObjectName.java
@@ -39,7 +39,6 @@ package javax.management;
import java.io.Serializable;
-import java.util.Collections;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.Map;
diff --git a/libjava/classpath/javax/management/StandardMBean.java b/libjava/classpath/javax/management/StandardMBean.java
index 37483845376..bd59c68ae22 100644
--- a/libjava/classpath/javax/management/StandardMBean.java
+++ b/libjava/classpath/javax/management/StandardMBean.java
@@ -228,13 +228,13 @@ public class StandardMBean
Method getter;
try
{
- getter = iface.getMethod("get" + name, null);
+ getter = iface.getMethod("get" + name);
}
catch (NoSuchMethodException e)
{
try
{
- getter = iface.getMethod("is" + name, null);
+ getter = iface.getMethod("is" + name);
}
catch (NoSuchMethodException ex)
{
@@ -246,7 +246,7 @@ public class StandardMBean
Object result;
try
{
- result = getter.invoke(impl, null);
+ result = getter.invoke(impl);
}
catch (IllegalAccessException e)
{
diff --git a/libjava/classpath/javax/management/openmbean/ArrayType.java b/libjava/classpath/javax/management/openmbean/ArrayType.java
index 42f80623d9a..e6cf5261aaa 100644
--- a/libjava/classpath/javax/management/openmbean/ArrayType.java
+++ b/libjava/classpath/javax/management/openmbean/ArrayType.java
@@ -39,7 +39,6 @@ package javax.management.openmbean;
import java.lang.reflect.Array;
-import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
diff --git a/libjava/classpath/javax/management/package.html b/libjava/classpath/javax/management/package.html
new file mode 100644
index 00000000000..3543eec908c
--- /dev/null
+++ b/libjava/classpath/javax/management/package.html
@@ -0,0 +1,197 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<!-- package.html - describes classes in javax.management package.
+ Copyright (C) 2007 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., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 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. -->
+
+<html>
+<head><title>GNU Classpath - javax.management</title></head>
+
+<body>
+
+<p>
+Provides the core classes for the Java Management Extensions (JMX). This API
+builds on the notion of Java beans by providing a layer of abstraction between
+the beans themselves and the method of accessing them. Instead of being accessed
+directly, management beans or <strong>MBeans</strong> are usually accessed via
+a management server (an implementation of the @see MBeanServer interface). Thus,
+the bean itself may be a simple Java object or it may be something
+more complicated (for example, the server may map from Java to SNMP). The server may
+also retrieve the bean from some remote location rather than using a local object.
+</p>
+<p>
+Management beans are usually used for monitoring and/or configuration
+of a particular entity. For example, the platform management beans
+found in the @see java.lang.management package allow the user
+to obtain information about the operating system, current memory usage, etc.
+as well as turning on and off certain additional facilities. To this end,
+an MBean consists of:
+</p>
+<ul>
+<li><emph>attributes</emph> that may be read and/or written to.</li>
+<li><emph>operations</emph> which may be performed.</li>
+<li><emph>notifications</emph> that may emitted by the bean and listened for by users.</li>
+</ul>
+<p>
+The most common type of management bean is the @see StandardMBean, A standard MBean
+relies on the naming patterns established by the JavaBeans framework; the value of an
+attribute <code>name</code> is retrieved by an accessor method named <code>getName</code>
+and changed by a mutator method called <code>setName</code>. If the mutator is absent,
+the attribute is read only. Naming is also used to associate the implementation of a
+bean with its interface; an bean <code>Person</code> is assumed to be an implementation
+of the interface <code>PersonMBean</code> (and vice versa). To avoid these naming constraints,
+the @see StandardMBean class may be used.
+</p>
+<p>
+<h2>Types of Beans</h2>
+<p>
+The @see StandardMBean class is one example of a @see DynamicMBean where the attributes and
+operations of the bean are provided dynamically via the methods provided. With the
+@see StandardMBean class, this simply means that the class uses reflection to access the
+appropriate methods of the bean implementation. In a more complex scenario, the bean's
+data could be supplied from a file or over the network.
+</p>
+<p>
+Once we start talking about accessing beans over network and platform boundaries, we run
+in to the issue of how to deal with the types utilised by these beans. Simple types, such
+as numbers and strings, are usually fine but more complex types need special treatment.
+An <emph>Open MBean</emph> is one that only uses a specific set of types defined in the
+@see javax.management.openmbean package, allowing both sides of a remote connection to provide
+this subset of types and thus interact. An @see MXBean goes a stage further, and defines
+a method whereby a normal Java MBean may become an Open MBean by performing a defined mapping
+on the types of the bean. For example, a @see java.util.List or @see java.util.Set of a
+particular type becomes an array of the same type.
+</p>
+<h2>Accessing Beans</h2>
+<p>
+Although beans can be accessed like normal objects, the normal way of accessing them is
+via an @see MBeanServer. This provides the abstraction from the bean's implementation to
+a set of attributes, operations and notifications. The server identifies each bean via
+an @see ObjectName. This name is unique to a particular bean and is used to identify the
+bean when retrieving the value of an attribute or invoking an operation. Essentially, most
+methods provided by the server are the same as those provided by the @see DynamicMBean
+interface, except that each takes this additional @link ObjectName parameter to identify the
+bean being accessed.
+</p>
+<p>
+The @see MBeanServerFactory keeps track of the current MBean servers in use and allows new
+ones to be created. A special @see MBeanServer instance, called the <emph>platform MBean
+server</emph>, is created when the Java virtual machine is started and a reference to this
+may be obtained from the @see ManagementFactory using
+@see ManagementFactory#getPlatformMBeanServer(). This primarily exists for the purpose of
+creating and registering the platform MBeans, described in @see java.lang.management, which
+provide access to information about the underlying operating system, memory usage, the behaviour
+of the garbage collector, etc. but is equally suitable for creating and registering your own
+beans. Alternatively, a server instance may be obtained from the @see MBeanServerFactory.
+</p>
+<p>
+A bean obtains an @link ObjectName by registering with the server. This operation can be
+performed either by passing an existing instance to the @see MBeanServer#registerMBean method
+or by using the @see MBeanServer#createMBean method to simultaneously create the bean and
+register it with the server. During the registration process, the bean may perform some
+arbitrary behaviour if it implements the @link MBeanRegistration interface. The same is
+true when unregistering a bean.
+</p>
+<p>
+To actually access the attributes and operations of a bean via the server, we use code
+like the following:
+</p>
+<pre>
+// First we obtain the platform MBean server which has the platform MBeans registered
+MBeanServer server = ManagementFactory.getPlatformMBeanServer();
+// We also need the object name of the memory bean so we can address it
+ObjectName name = new ObjectName(ManagementFactory.MEMORY_MXBEAN_NAME);
+// Next we obtain the value of the 'verbose' attribute
+// What actually happens here is that the server invokes the 'isVerbose' method of
+// the MemoryMXBean
+boolean verbose = server.getAttribute(name, "verbose");
+// We can also set the value of verbose. Again the server is actually performing
+// a setVerbose(val) on the bean but we don't need to know this.
+Attribute attrib = new Attribute("verbose", true);
+server.setAttribute(name, attrib);
+// We can also invoke the 'gc' operation which calls the garbage collector.
+server.invoke(name, "gc", new Object[]{}, new String[]{});
+</pre>
+<p>
+As noted above, the server is simply making basic method calls on the object using
+reflection. However, the server provides a layer of abstraction which means that something
+more complicated could actually be going on. The lines above are equally applicable, for
+example, if <code>server</code> is instead an @see MBeanServerConnection connecting us
+to a distant computer.
+</p>
+<p>
+This rather hideous code can be simplified back into simple method calls on an object,
+so that we get the best of both worlds. This is achieved using a <emph>MBean proxy</emph>:
+<pre>
+MBeanServer server = ManagementFactory.getPlatformMBeanServer();
+ObjectName name = new ObjectName(ManagementFactory.MEMORY_MXBEAN_NAME);
+MemoryMXBean bean = JMX.newMBeanProxy(server, name, MemoryMXBean.class);
+boolean verbose = bean.isVerbose();
+bean.setVerbose(true);
+bean.gc();
+</pre>
+<p>
+See how much simpler the operations are? The proxy handles the task of translating the method
+calls into appropriate invocations of methods on the server, simplifying the code for the user.
+</p>
+<p>
+Finally, we have assumed in the code above that the @see ObjectName of the bean is known.
+If this is not the case, then the server's database can be searched. The @see Query class
+provides appropriate operators (e.g. boolean (and,or), value comparison (&gt;, &lt;)) for
+building up relatively complex queries. Once constructed, a query may be passed to either
+the @see MBeanServer#queryNames or @see MBeanServer#queryMBeans to obtain an appropriate
+set of @see ObjectName or MBean instances.
+</p>
+<h2>Notifications</h2>
+<p>
+MBeans also have the capability to emit events. Beans which do so implement either the
+@see NotificationBroadcaster or @see NotificationEmitter interface (the difference between
+the two is simply the existence of a better removal method in the newer
+@see NotificationEmitter interface, which otherwise extends @see NotificationBroadcaster),
+usually by extending the @see NotificationBroadcasterSupport class. As is usual with event
+handling, other classes may <emph>signup</emph> to receive events via the
+@see NotificationListener interface. The signup process can include registering a filter
+(an implementation of @see NotificationFilter) so that only certain events reach the
+listener and others are discarded.
+</p>
+<h2>Remote Access</h2>
+<p>
+The subpackage @see javax.management.remote provides facilities to access remote MBean
+servers. This consists of a <emph>connector</emph> framework which abstracts the method
+of accessing remote servers from the actual implementation, so that the same method is
+used to connect to a remote server, regardless of how it is accessed.
+</p>
+</body>
+</html>
diff --git a/libjava/classpath/javax/management/remote/NotificationResult.java b/libjava/classpath/javax/management/remote/NotificationResult.java
new file mode 100644
index 00000000000..c0b2d9ba1a6
--- /dev/null
+++ b/libjava/classpath/javax/management/remote/NotificationResult.java
@@ -0,0 +1,166 @@
+/* NotificationResult.java -- Wrapper for a series of buffered notifications.
+ Copyright (C) 2008 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., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package javax.management.remote;
+
+import java.io.Serializable;
+
+/**
+ * <p>
+ * Wraps the result of a query for buffered notifications. In a remote
+ * scenario, it may be more practical for the server to buffer individual
+ * notifications from its beans and then return them in bulk on request.
+ * This class contains the notifications returned by such a request.
+ * </p>
+ * <p>
+ * It consists of a series of {@link Notification} and identifier pairs,
+ * wrapped in a {@link TargetedNotification} object. The identifiers
+ * serve to pair up the notification with the listener that requested
+ * it. Two positive numbers are also included: the first sequence number
+ * used by the returned notifications, and the sequence number of the
+ * notification which will be returned by the next query. The first
+ * sequence number may be greater than the next sequence number if some
+ * notifications have been lost.
+ * </p>
+ *
+ * @author Andrew John Hughes (gnu_andrew@member.fsf.org)
+ * @since 1.5
+ */
+public class NotificationResult
+ implements Serializable
+{
+
+ /**
+ * Compatible with JDK 1.6
+ */
+ private static final long serialVersionUID = 1191800228721395279L;
+
+ /**
+ * The sequence number of the first notification.
+ */
+ private long earliestSequenceNumber;
+
+ /**
+ * The sequence number of the next notification to be
+ * returned by a future query.
+ */
+ private long nextSequenceNumber;
+
+ /**
+ * The pairs of notifications and identifiers returned
+ * by the query.
+ */
+ private TargetedNotification[] targetedNotifications;
+
+ /**
+ * Constructs a new {@link NotificationResult} using the specified
+ * sequence numbers and the supplied array of notification pairs.
+ *
+ * @param startSeqNumber the sequence number of the first notification
+ * being returned.
+ * @param nextSeqNumber the sequence numbr of the next notification
+ * that will be returned from a future query.
+ * @param notifications the notification and identifier pairs. This
+ * may be empty.
+ * @throws IllegalArgumentException if a sequence number is negative
+ * or <code>notifications</code> is
+ * <code>null</code>.
+ */
+ public NotificationResult(long startSeqNumber, long nextSeqNumber,
+ TargetedNotification[] notifications)
+ {
+ if (startSeqNumber < 0)
+ throw new IllegalArgumentException("Starting sequence number is " +
+ "less than 0.");
+ if (nextSeqNumber < 0)
+ throw new IllegalArgumentException("Next sequence number is " +
+ "less than 0.");
+ if (notifications == null)
+ throw new IllegalArgumentException("The array of notifications is null.");
+ earliestSequenceNumber = startSeqNumber;
+ nextSequenceNumber = nextSeqNumber;
+ targetedNotifications = notifications;
+ }
+
+ /**
+ * Returns the sequence number of the earliest notification
+ * in the buffer.
+ *
+ * @return the sequence number of the earliest notification.
+ */
+ public long getEarliestSequenceNumber()
+ {
+ return earliestSequenceNumber;
+ }
+
+ /**
+ * Returns the sequence number of the next notification to
+ * be returned by a future query.
+ *
+ * @return the sequence number of the next notification.
+ */
+ public long getNextSequenceNumber()
+ {
+ return nextSequenceNumber;
+ }
+
+ /**
+ * Returns the notification and identifier pairs returned
+ * by the query.
+ *
+ * @return the notification and identifier pairs.
+ */
+ public TargetedNotification[] getTargetedNotifications()
+ {
+ return targetedNotifications;
+ }
+
+ /**
+ * Returns a textual representation of the object.
+ *
+ * @return a textual representation.
+ */
+ public String toString()
+ {
+ return getClass().getName() +
+ "[earliestSequenceNumber=" + earliestSequenceNumber +
+ ",nextSequenceNumber=" + nextSequenceNumber +
+ ",targetedNotifications=" + targetedNotifications +
+ "]";
+ }
+
+}
diff --git a/libjava/classpath/javax/management/remote/TargetedNotification.java b/libjava/classpath/javax/management/remote/TargetedNotification.java
new file mode 100644
index 00000000000..c383c9184c0
--- /dev/null
+++ b/libjava/classpath/javax/management/remote/TargetedNotification.java
@@ -0,0 +1,127 @@
+/* TargetedNotificaton.java -- Wrapper for a notification and identifier pair.
+ Copyright (C) 2008 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., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package javax.management.remote;
+
+import java.io.Serializable;
+
+import javax.management.Notification;
+
+/**
+ * Wraps a notification with an identifier that specifies
+ * the listener which received it.
+ *
+ * @author Andrew John Hughes (gnu_andrew@member.fsf.org)
+ * @since 1.5
+ */
+public class TargetedNotification
+ implements Serializable
+{
+
+ /**
+ * Compatible with JDK 1.6
+ */
+ private static final long serialVersionUID = 7676132089779300926L;
+
+ /**
+ * The notification that was recieved by the listener.
+ */
+ private Notification notif;
+
+ /**
+ * The identifier for the listener that received the notification;
+ */
+ private Integer id;
+
+ /**
+ * Constructs a new {@link TargetedNotification} which connects
+ * the supplied notification with the specified identifier. The
+ * identifier matches one of those returned by a previous call
+ * to add a new notification listener.
+ *
+ * @param notif the notification.
+ * @param id the identifier of the listener that received the
+ * notification.
+ * @throws IllegalArgumentException if either argument is
+ * <code>null</code>.
+ */
+ public TargetedNotification(Notification notif, Integer id)
+ {
+ if (notif == null)
+ throw new IllegalArgumentException("The notification is null.");
+ if (id == null)
+ throw new IllegalArgumentException("The identifier is null.");
+ this.notif = notif;
+ this.id = id;
+ }
+
+ /**
+ * Returns the notification.
+ *
+ * @return the notification.
+ */
+ public Notification getNotification()
+ {
+ return notif;
+ }
+
+ /**
+ * Returns the identifier for the listener
+ * which received the notification.
+ *
+ * @return the identifier.
+ */
+ public Integer getListenerID()
+ {
+ return id;
+ }
+
+ /**
+ * Returns a textual representation of the object.
+ *
+ * @return a textual representation.
+ */
+ public String toString()
+ {
+ return getClass().getName() +
+ "[notif=" + notif +
+ ",id=" + id +
+ "]";
+ }
+
+}
+
diff --git a/libjava/classpath/javax/management/remote/package.html b/libjava/classpath/javax/management/remote/package.html
new file mode 100644
index 00000000000..f1d469f3ab1
--- /dev/null
+++ b/libjava/classpath/javax/management/remote/package.html
@@ -0,0 +1,53 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<!-- package.html - describes classes in javax.management.remote package.
+ Copyright (C) 2006 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., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 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. -->
+
+<html>
+<head><title>GNU Classpath - javax.management.remote</title></head>
+
+<body>
+
+<p>
+Provides a framework for accessing remote MBean servers. The JMX
+remote API introduces the notion of a <emph>connector</emph>. On
+the server side, the connector wraps the MBean server, processing
+calls from remote clients. The client sends its requests via
+a connector which is responsible for transmitting the request
+to the server.
+</p>
+</body>
+</html>
diff --git a/libjava/classpath/javax/management/remote/rmi/RMIConnection.java b/libjava/classpath/javax/management/remote/rmi/RMIConnection.java
new file mode 100644
index 00000000000..38fb544fe45
--- /dev/null
+++ b/libjava/classpath/javax/management/remote/rmi/RMIConnection.java
@@ -0,0 +1,1151 @@
+/* RMIConnection.java -- RMI object representing a MBean server connection.
+ Copyright (C) 2007, 2008 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., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package javax.management.remote.rmi;
+
+import java.io.Closeable;
+import java.io.IOException;
+
+import java.rmi.MarshalledObject;
+import java.rmi.Remote;
+
+import java.util.Set;
+
+import javax.management.AttributeList;
+import javax.management.AttributeNotFoundException;
+import javax.management.InstanceAlreadyExistsException;
+import javax.management.InstanceNotFoundException;
+import javax.management.IntrospectionException;
+import javax.management.InvalidAttributeValueException;
+import javax.management.ListenerNotFoundException;
+import javax.management.MBeanInfo;
+import javax.management.MBeanException;
+import javax.management.MBeanRegistrationException;
+import javax.management.NotCompliantMBeanException;
+import javax.management.ObjectInstance;
+import javax.management.ObjectName;
+import javax.management.ReflectionException;
+
+import javax.management.remote.NotificationResult;
+
+import javax.security.auth.Subject;
+
+/**
+ * <p>
+ * RMI interface for forwarding requests to a remote
+ * {@link javax.management.MBeanServer}. This interface
+ * parallels the {@link javax.management.MBeanServerConnection}
+ * interface, providing a way of invoking those methods using
+ * the RMI protocol. When a client wishes to call a method
+ * of an MBean server using RMI, the method is called on the stub
+ * on the client side, which serializes the object parameters
+ * and sends them to the server where they are deserialized and
+ * an implementation of this interface forwards them to the
+ * appropriate MBean server. Return values follow the same
+ * process, only in reverse. Each client obtains its own
+ * implementation of this interface from an {@link RMIServer}
+ * instance.
+ * </p>
+ * <p>
+ * Implementations of this interface do more than simply
+ * forward requests directly to the server. The arguments
+ * of the server methods are wrapped in {@link MarshalledObject}
+ * instances, so that the correct classloader can be used to
+ * deserialize the arguments. When a method is called, the
+ * implementation must first retrieve the appropriate classloader
+ * and then use it to deserialize the marshalled object. Unless
+ * explicitly specified in the documentation for the method,
+ * a parameter of the type {@link MarshalledObject} or an array
+ * of that type should not be {@code null}.
+ * </p>
+ * <p>
+ * Security is also handled by this interface, as the methods
+ * use an additional {@link javax.security.auth.Subject} parameter
+ * for role delegation.
+ * </p>
+ *
+ * @author Andrew John Hughes (gnu_andrew@member.fsf.org)
+ * @since 1.5
+ */
+public interface RMIConnection
+ extends Closeable, Remote
+{
+
+ /**
+ * Handles {@link
+ * MBeanServerConnection#addNotificationListener(ObjectName,
+ * ObjectName, NotificationFilter, Object)} by
+ * registering the supplied listener with the specified management
+ * bean. Notifications emitted by the management bean are forwarded
+ * to the listener via the server, which will convert any MBean
+ * references in the source to portable {@link ObjectName}
+ * instances. The notification is otherwise unchanged. The filter
+ * and handback object are wrapped in a {@link MarshalledObject}
+ * so that they are deserialised using the bean's classloader.
+ *
+ * @param name the name of the management bean with which the listener
+ * should be registered.
+ * @param listener the listener which will handle notifications from
+ * the bean.
+ * @param filter a wrapper containing a filter to apply to incoming
+ * notifications, or <code>null</code> if no filtering
+ * should be applied.
+ * @param passback a wrapper containing an object to be passed to the
+ * listener when a notification is emitted.
+ * @param delegationSubject a {@link javax.security.auth.Subject} instance
+ * containing the delegation principles or
+ * {@code null} if authentication is used.
+ * @throws InstanceNotFoundException if the name of the management bean
+ * could not be resolved.
+ * @throws RuntimeOperationsException if the bean associated with the given
+ * object name is not a
+ * {@link NotificationListener}. This
+ * exception wraps an
+ * {@link IllegalArgumentException}.
+ * @throws SecurityException if the client or delegated subject (if any)
+ * does not have permission to invoke this operation.
+ * @throws IOException if an I/O error occurred in communicating with
+ * the bean server.
+ * @see #removeNotificationListener(ObjectName, ObjectName,
+ * javax.security.auth.Subject)
+ * @see #removeNotificationListener(ObjectName, ObjectName,
+ * java.rmi.MarshalledObject,
+ * java.rmi.MarshalledObject,
+ * javax.security.auth.Subject)
+ * @see #removeNotificationListeners(ObjectName, Integer[],
+ * javax.security.auth.Subject)
+ * @see NotificationBroadcaster#addNotificationListener(NotificationListener,
+ * NotificationFilter,
+ * Object)
+ */
+ void addNotificationListener(ObjectName name, ObjectName listener,
+ MarshalledObject filter, MarshalledObject passback,
+ Subject delegationSubject)
+ throws InstanceNotFoundException, IOException;
+
+ /**
+ * Handles {@link
+ * MBeanServerConnection#addNotificationListener(ObjectName,
+ * NotificationListener, NotificationFilter, Object)} by
+ * registering for notifications from the specified management
+ * beans. The array of filters is assumed to be aligned with
+ * the array of bean names, so that the notifications from each
+ * bean are matched against the appropriate filter (or left as
+ * is if the filter is {@code null}. Notifications emitted by
+ * the management beans are forwarded to a local listener created
+ * by this method, via the server, which converts any MBean
+ * references in the source to portable {@link ObjectName}
+ * instances. The notification is otherwise unchanged.
+ * </p>
+ * <p>
+ * This local listener buffers the notifications for retrieval by
+ * {@link #fetchNotifications(long,int,long). This method returns
+ * an array of listener identifiers which aligns with the supplied
+ * array of beans so that the appropriate listener can be identified
+ * by the client, which retains its own listener and handback object.
+ * The filters are wrapped in {@link MarshalledObject}s so that they are
+ * deserialised using the bean's classloader.
+ * </p>
+ *
+ * @param names the names of the management bean whose notifications
+ * should be recorded.
+ * @param filters an array of wrappers containing filters to apply to
+ * incoming notifications. An element may be <code>null</code>
+ * if no filtering should be applied to a bean's notifications.
+ * @param delegationSubjects an array of {@link javax.security.auth.Subject}
+ * instances containing the delegation principles for
+ * each listener. An element may be {@code null} if
+ * authentication is used instead, or the entire
+ * argument itself may be {@code null}. In the latter
+ * case, this is treated as an array of {@code null}
+ * values.
+ * @return an array of integers which act as listener identifiers, so that
+ * notifications retrieved from {@link #fetchNotifications(long,int,long)
+ * can be matched to the beans they were emitted from. The array is
+ * aligned against the array of beans supplied to this methods, so that
+ * the identifier in position 0 represents the bean in position 0 of the
+ * input array.
+ * @throws IllegalArgumentException if the {@code names} or {@code filters} array
+ * is {@code null}, the {@code names} array contains
+ * a {@code null} value or the three arrays are not
+ * of the same size.
+ * @throws ClassCastException if an element of the {@code filters} array unmarshalls
+ * as a non-null object that is not a {@link NotificationFilter}.
+ * @throws InstanceNotFoundException if the name of one of the management beans
+ * could not be resolved.
+ * @throws SecurityException if, for one of the beans, the client or delegated subject
+ * (if any) does not have permission to invoke this operation.
+ * @throws IOException if an I/O error occurred in communicating with
+ * the bean server.
+ * @see #removeNotificationListener(ObjectName, ObjectName,
+ * javax.security.auth.Subject)
+ * @see #removeNotificationListener(ObjectName, ObjectName,
+ * java.rmi.MarshalledObject,
+ * java.rmi.MarshalledObject,
+ * javax.security.auth.Subject)
+ * @see #removeNotificationListeners(ObjectName, Integer[],
+ * javax.security.auth.Subject)
+ * @see NotificationBroadcaster#addNotificationListener(NotificationListener,
+ * NotificationFilter,
+ * Object)
+ */
+ Integer[] addNotificationListeners(ObjectName[] names, MarshalledObject[] filters,
+ Subject[] delegationSubjects)
+ throws InstanceNotFoundException, IOException;
+
+ /**
+ * Closes the connection and unexports the RMI object implementing this
+ * interface. Following this call, future method calls to this instance
+ * will fail.
+ *
+ * @throws IOException if there is an I/O error in transmitting the close
+ * request via RMI, closing the connection, or unexporting
+ * the RMI object.
+ */
+ void close()
+ throws IOException;
+
+ /**
+ * <p>
+ * Handles {@link
+ * MBeanServerConnection#createMBean(String, ObjectName,
+ * Object[], String[])}. The array of parameters is wrapped in
+ * a {@link MarshalledObject} so that it is deserialised using the
+ * bean's classloader.
+ * </p>
+ * <p>
+ * Instantiates a new instance of the specified management bean
+ * using the given constructor and registers it with the server
+ * under the supplied name. The class is loaded using the
+ * {@link javax.management.loading.ClassLoaderRepository default
+ * loader repository} of the server.
+ * </p>
+ * <p>
+ * If the name supplied is <code>null</code>, then the bean is
+ * expected to implement the {@link MBeanRegistration} interface.
+ * The {@link MBeanRegistration#preRegister preRegister} method
+ * of this interface will be used to obtain the name in this case.
+ * </p>
+ *
+ * @param className the class of the management bean, of which
+ * an instance should be created.
+ * @param name the name to register the new bean with. This may
+ * be <code>null</code>.
+ * @param params the parameters for the bean's constructor, encapsulated
+ * in a {@link MarshalledObject}. If this parameter is
+ * <code>null</code>, it will be judged equivalent to an
+ * empty array.
+ * @param sig the signature of the constructor to use. If this parameter
+ * is <code>null</code>, it will be judged equivalent to an
+ * empty array.
+ * @param delegationSubject an instance of {@link javax.security.auth.Subject}
+ * containing the delegation principles. This may be
+ * {@code null} is authentication is used instead.
+ * @return an {@link ObjectInstance} containing the {@link ObjectName}
+ * and Java class name of the created instance.
+ * @throws ReflectionException if an exception occurs in creating
+ * an instance of the bean.
+ * @throws InstanceAlreadyExistsException if a matching instance
+ * already exists.
+ * @throws MBeanRegistrationException if an exception occurs in
+ * calling the preRegister
+ * method.
+ * @throws MBeanException if the bean's constructor throws an exception.
+ * @throws NotCompliantMBeanException if the created bean is not
+ * compliant with the JMX specification.
+ * @throws RuntimeOperationsException if an {@link IllegalArgumentException}
+ * is thrown by the server due to a
+ * <code>null</code> class name or object
+ * name or if the object name is a pattern.
+ * @throws SecurityException if the client or delegated subject (if any) does
+ * not have permission to invoke this operation.
+ * @throws IOException if an I/O error occurred in communicating with
+ * the bean server.
+ */
+ ObjectInstance createMBean(String className, ObjectName name,
+ MarshalledObject params, String[] sig,
+ Subject delegationSubject)
+ throws ReflectionException, InstanceAlreadyExistsException,
+ MBeanRegistrationException, MBeanException,
+ NotCompliantMBeanException, IOException;
+
+ /**
+ * <p>
+ * Handles {@link
+ * MBeanServerConnection#createMBean(String, ObjectName,
+ * ObjectName, Object[], String[])}. The array of parameters is
+ * wrapped in a {@link MarshalledObject} so that it is deserialised
+ * using the bean's classloader.
+ * </p>
+ * <p>
+ * Instantiates a new instance of the specified management bean
+ * using the given constructor and registers it with the server
+ * under the supplied name. The class is loaded using the
+ * given class loader. If this argument is <code>null</code>,
+ * then the same class loader as was used to load the server
+ * is used.
+ * </p>
+ * <p>
+ * If the name supplied is <code>null</code>, then the bean is
+ * expected to implement the {@link MBeanRegistration} interface.
+ * The {@link MBeanRegistration#preRegister preRegister} method
+ * of this interface will be used to obtain the name in this case.
+ * </p>
+ *
+ * @param className the class of the management bean, of which
+ * an instance should be created.
+ * @param name the name to register the new bean with. This may
+ * be <code>null</code>.
+ * @param loaderName the name of the class loader.
+ * @param params the parameters for the bean's constructor, encapsulated
+ * in a {@link MarshalledObject}. If this parameter is
+ * <code>null</code>, it will be judged equivalent to an
+ * empty array.
+ * @param sig the signature of the constructor to use. If this parameter
+ * is <code>null</code>, it will be judged equivalent to an
+ * empty array.
+ * @param delegationSubject an instance of {@link javax.security.auth.Subject}
+ * containing the delegation principles. This may be
+ * {@code null} is authentication is used instead.
+ * @return an {@link ObjectInstance} containing the {@link ObjectName}
+ * and Java class name of the created instance.
+ * @throws ReflectionException if an exception occurs in creating
+ * an instance of the bean.
+ * @throws InstanceAlreadyExistsException if a matching instance
+ * already exists.
+ * @throws MBeanRegistrationException if an exception occurs in
+ * calling the preRegister
+ * method.
+ * @throws MBeanException if the bean's constructor throws an exception.
+ * @throws NotCompliantMBeanException if the created bean is not
+ * compliant with the JMX specification.
+ * @throws InstanceNotFoundException if the specified class loader is not
+ * registered with the server.
+ * @throws RuntimeOperationsException if an {@link IllegalArgumentException}
+ * is thrown by the server due to a
+ * <code>null</code> class name or object
+ * name or if the object name is a pattern.
+ * @throws SecurityException if the client or delegated subject (if any) does
+ * not have permission to invoke this operation.
+ * @throws IOException if an I/O error occurred in communicating with
+ * the bean server.
+ */
+ ObjectInstance createMBean(String className, ObjectName name,
+ ObjectName loaderName, MarshalledObject params,
+ String[] sig, Subject delegationSubject)
+ throws ReflectionException, InstanceAlreadyExistsException,
+ MBeanRegistrationException, MBeanException,
+ NotCompliantMBeanException, InstanceNotFoundException,
+ IOException;
+
+ /**
+ * <p>
+ * Handles {@link
+ * MBeanServerConnection#createMBean(String, ObjectName,
+ * ObjectName)} by instantiating a new instance of the specified
+ * management bean using the default constructor and registering
+ * it with the server under the supplied name. The class is loaded
+ * using the given class loader. If this argument is <code>null</code>,
+ * then the same class loader as was used to load the server
+ * is used.
+ * </p>
+ * <p>
+ * If the name supplied is <code>null</code>, then the bean is
+ * expected to implement the {@link MBeanRegistration} interface.
+ * The {@link MBeanRegistration#preRegister preRegister} method
+ * of this interface will be used to obtain the name in this case.
+ * </p>
+ * <p>
+ * This method is equivalent to calling {@link
+ * #createMBean(String, ObjectName, ObjectName, Object[], String)
+ * <code>createMBean(className, name, loaderName, (Object[]) null,
+ * (String) null)</code>} with <code>null</code> parameters
+ * and signature.
+ * </p>
+ *
+ * @param className the class of the management bean, of which
+ * an instance should be created.
+ * @param name the name to register the new bean with. This may
+ * be <code>null</code>.
+ * @param loaderName the name of the class loader.
+ * @param delegationSubject an instance of {@link javax.security.auth.Subject}
+ * containing the delegation principles. This may be
+ * {@code null} is authentication is used instead.
+ * @return an {@link ObjectInstance} containing the {@link ObjectName}
+ * and Java class name of the created instance.
+ * @throws ReflectionException if an exception occurs in creating
+ * an instance of the bean.
+ * @throws InstanceAlreadyExistsException if a matching instance
+ * already exists.
+ * @throws MBeanRegistrationException if an exception occurs in
+ * calling the preRegister
+ * method.
+ * @throws MBeanException if the bean's constructor throws an exception.
+ * @throws NotCompliantMBeanException if the created bean is not
+ * compliant with the JMX specification.
+ * @throws InstanceNotFoundException if the specified class loader is not
+ * registered with the server.
+ * @throws RuntimeOperationsException if an {@link IllegalArgumentException}
+ * is thrown by the server due to a
+ * <code>null</code> class name or object
+ * name or if the object name is a pattern.
+ * @throws SecurityException if the client or delegated subject (if any) does
+ * not have permission to invoke this operation.
+ * @throws IOException if an I/O error occurred in communicating with
+ * the bean server.
+ * @see #createMBean(String, ObjectName, ObjectName, MarshalledObject,
+ * String[], Subject)
+ */
+ ObjectInstance createMBean(String className, ObjectName name,
+ ObjectName loaderName, Subject delegationSubject)
+ throws ReflectionException, InstanceAlreadyExistsException,
+ MBeanRegistrationException, MBeanException,
+ NotCompliantMBeanException, InstanceNotFoundException,
+ IOException;
+
+ /**
+ * <p>
+ * Handles {@link
+ * MBeanServerConnection#createMBean(String, ObjectName)} by
+ * instantiating a new instance of the specified management bean
+ * using the default constructor and registering it with the server
+ * under the supplied name. The class is loaded using the
+ * {@link javax.management.loading.ClassLoaderRepository default
+ * loader repository} of the server.
+ * </p>
+ * <p>
+ * If the name supplied is <code>null</code>, then the bean is
+ * expected to implement the {@link MBeanRegistration} interface.
+ * The {@link MBeanRegistration#preRegister preRegister} method
+ * of this interface will be used to obtain the name in this case.
+ * </p>
+ * <p>
+ * This method is equivalent to calling {@link
+ * #createMBean(String, ObjectName, Object[], String[])
+ * <code>createMBean(className, name, (Object[]) null,
+ * (String[]) null)</code>} with <code>null</code> parameters
+ * and signature.
+ * </p>
+ *
+ * @param className the class of the management bean, of which
+ * an instance should be created.
+ * @param name the name to register the new bean with. This may
+ * be <code>null</code>.
+ * @param delegationSubject an instance of {@link javax.security.auth.Subject}
+ * containing the delegation principles. This may be
+ * {@code null} is authentication is used instead.
+ * @return an {@link ObjectInstance} containing the {@link ObjectName}
+ * and Java class name of the created instance.
+ * @throws ReflectionException if an exception occurs in creating
+ * an instance of the bean.
+ * @throws InstanceAlreadyExistsException if a matching instance
+ * already exists.
+ * @throws MBeanRegistrationException if an exception occurs in
+ * calling the preRegister
+ * method.
+ * @throws MBeanException if the bean's constructor throws an exception.
+ * @throws NotCompliantMBeanException if the created bean is not
+ * compliant with the JMX specification.
+ * @throws RuntimeOperationsException if an {@link IllegalArgumentException}
+ * is thrown by the server due to a
+ * <code>null</code> class name or object
+ * name or if the object name is a pattern.
+ * @throws SecurityException if the client or delegated subject (if any) does
+ * not have permission to invoke this operation.
+ * @throws IOException if an I/O error occurred in communicating with
+ * the bean server.
+ * @see #createMBean(String, ObjectName, MarshalledObject, String[], Subject)
+ */
+ ObjectInstance createMBean(String className, ObjectName name,
+ Subject delegationSubject)
+ throws ReflectionException, InstanceAlreadyExistsException,
+ MBeanRegistrationException, MBeanException,
+ NotCompliantMBeanException, IOException;
+
+ /**
+ * <p>
+ * Retrieves any waiting notifications from the server. When notifications
+ * are requested using the {@link #addNotificationListeners(ObjectName[],
+ * MarshalledObject[], Subject[])} method, the server sets up an internal
+ * listener to receive notifications from the bean and buffer them. When
+ * this method is called, these buffered notifications can be retrieved.
+ * </p>
+ * <p>
+ * The blocking behaviour of this method depends on the timeout value specified.
+ * If there are no waiting notifications in the buffer, a value of 0 will cause
+ * the method to return immediately. Conversely, if the value is
+ * {@link Long#MAX_VALUE}, then it will wait indefinitely until a notification
+ * arrives. For any other value, it waits until a notification arrives or the
+ * number of milliseconds specified by the timeout value is exceeded. The
+ * behaviour for a negative timeout value is undefined.
+ * </p>
+ * <p>
+ * For a notification to be returned, the following criteria must be fulfilled:
+ * </p>
+ * <ul>
+ * <li>the client must have previously requested notifications from at least
+ * one bean</li>
+ * <li>a bean from which notifications have been requested must have emitted
+ * a notification since the last call to this method</li>
+ * <li>the emitted notification must pass through any filters established
+ * when notifications were requested</li>
+ * <li>the sequence number of the notification must be greater than or equal
+ * to the specified sequence number (if non-negative)</li>
+ * </ul>
+ *
+ * @param sequenceNumber the sequence number of each notification returned
+ * must be greater than or equal to this value. If
+ * the number is negative, this is interpreted as
+ * meaning the sequence number of the next notification
+ * and so all notifications are allowed through.
+ * @param maxNotifications the maximum number of notifications to return.
+ * This does not include any duplicates so the
+ * number of actual notifications returned may
+ * be larger.
+ * @param timeout the number of milliseconds to wait for a notification
+ * if the buffer is empty. <code>0</code> causes the
+ * method to return immediately even if there are no
+ * notifications available (non-blocking behaviour) while
+ * a value of {@link Long#MAX_VALUE} causes it to wait
+ * indefinitely (blocking behaviour). The response to
+ * a negative value is undefined.
+ * @return a {@link NotificationResult} object containing the buffered
+ * notifications.
+ * @throws IOException if an I/O error occurs.
+ */
+ NotificationResult fetchNotifications(long sequenceNumber,
+ int maxNotifications,
+ long timeout)
+ throws IOException;
+
+ /**
+ * Handles {@link
+ * MBeanServerConnection#getAttribute(ObjectName, String)},
+ * returning the value of the supplied attribute from the specified
+ * management bean.
+ *
+ * @param bean the bean to retrieve the value from.
+ * @param name the name of the attribute to retrieve.
+ * @param delegationSubject an instance of {@link javax.security.auth.Subject}
+ * containing the delegation principles. This may be
+ * {@code null} is authentication is used instead.
+ * @return the value of the attribute.
+ * @throws AttributeNotFoundException if the attribute could not be
+ * accessed from the bean.
+ * @throws MBeanException if the management bean's accessor throws
+ * an exception.
+ * @throws InstanceNotFoundException if the bean can not be found.
+ * @throws ReflectionException if an exception was thrown in trying
+ * to invoke the bean's accessor.
+ * @throws RuntimeOperationsException if an {@link IllegalArgumentException}
+ * is thrown by the server due to a
+ * <code>null</code> bean or attribute
+ * name.
+ * @throws SecurityException if the client or delegated subject (if any) does
+ * not have permission to invoke this operation.
+ * @throws IOException if an I/O error occurred in communicating with
+ * the bean server.
+ * @see DynamicMBean#getAttribute(String)
+ */
+ Object getAttribute(ObjectName bean, String name, Subject delegationSubject)
+ throws MBeanException, AttributeNotFoundException,
+ InstanceNotFoundException, ReflectionException,
+ IOException;
+
+ /**
+ * Handles {@link
+ * MBeanServerConnection#getAttribute(ObjectName, String)},
+ * returning the values of the named attributes from the specified
+ * management bean.
+ *
+ * @param bean the bean to retrieve the value from.
+ * @param names the names of the attributes to retrieve.
+ * @param delegationSubject an instance of {@link javax.security.auth.Subject}
+ * containing the delegation principles. This may be
+ * {@code null} is authentication is used instead.
+ * @return the values of the attributes.
+ * @throws InstanceNotFoundException if the bean can not be found.
+ * @throws ReflectionException if an exception was thrown in trying
+ * to invoke the bean's accessor.
+ * @throws RuntimeOperationsException if an {@link IllegalArgumentException}
+ * is thrown by the server due to a
+ * <code>null</code> bean or attribute
+ * name.
+ * @throws SecurityException if the client or delegated subject (if any) does
+ * not have permission to invoke this operation.
+ * @throws IOException if an I/O error occurred in communicating with
+ * the bean server.
+ * @see DynamicMBean#getAttributes(String[])
+ */
+ AttributeList getAttributes(ObjectName bean, String[] names,
+ Subject delegationSubject)
+ throws InstanceNotFoundException, ReflectionException,
+ IOException;
+
+ /**
+ * Returns the unique identifier for this connection to the RMI
+ * server.
+ *
+ * @return the connection ID.
+ * @throws IOException if an I/O error occurred.
+ */
+ String getConnectionId()
+ throws IOException;
+
+ /**
+ * Handles {@link
+ * MBeanServerConnection#getDefaultDomain()} by returning the default
+ * domain this server applies to beans that have no specified domain.
+ *
+ * @param delegationSubject an instance of {@link javax.security.auth.Subject}
+ * containing the delegation principles. This may be
+ * {@code null} is authentication is used instead.
+ * @return the default domain.
+ * @throws SecurityException if the client or delegated subject (if any) does
+ * not have permission to invoke this operation.
+ * @throws IOException if an I/O error occurred in communicating with
+ * the bean server.
+ */
+ String getDefaultDomain(Subject delegationSubject)
+ throws IOException;
+
+ /**
+ * Handles {@link
+ * MBeanServerConnection#getDomains()} by returning an array
+ * containing all the domains used by beans registered with
+ * this server. The ordering of the array is undefined.
+ *
+ * @param delegationSubject an instance of {@link javax.security.auth.Subject}
+ * containing the delegation principles. This may be
+ * {@code null} is authentication is used instead.
+ * @return the list of domains.
+ * @throws SecurityException if the client or delegated subject (if any) does
+ * not have permission to invoke this operation.
+ * @throws IOException if an I/O error occurred in communicating with
+ * the bean server.
+ * @see ObjectName#getDomain()
+ */
+ String[] getDomains(Subject delegationSubject)
+ throws IOException;
+
+ /**
+ * Handles {@link
+ * MBeanServerConnection#getMBeanCount()} by returning the number of
+ * management beans registered with this server.
+ *
+ * @param delegationSubject an instance of {@link javax.security.auth.Subject}
+ * containing the delegation principles. This may be
+ * {@code null} is authentication is used instead.
+ * @return the number of registered beans.
+ * @throws SecurityException if the client or delegated subject (if any) does
+ * not have permission to invoke this operation.
+ * @throws IOException if an I/O error occurred in communicating with
+ * the bean server.
+ */
+ Integer getMBeanCount(Subject delegationSubject)
+ throws IOException;
+
+ /**
+ * Handles {@link
+ * MBeanServerConnection#getMBeanInfo(ObjectName)} by returning
+ * information on the given management bean.
+ *
+ * @param name the name of the management bean.
+ * @param delegationSubject an instance of {@link javax.security.auth.Subject}
+ * containing the delegation principles. This may be
+ * {@code null} is authentication is used instead.
+ * @return an instance of {@link MBeanInfo} for the bean.
+ * @throws IntrospectionException if an exception occurs in examining
+ * the bean.
+ * @throws InstanceNotFoundException if the bean can not be found.
+ * @throws ReflectionException if an exception occurs when trying
+ * to invoke {@link DynamicMBean#getMBeanInfo()}
+ * on the bean.
+ * @throws SecurityException if the client or delegated subject (if any) does
+ * not have permission to invoke this operation.
+ * @throws IOException if an I/O error occurred in communicating with
+ * the bean server.
+ * @see DynamicMBean#getMBeanInfo()
+ */
+ MBeanInfo getMBeanInfo(ObjectName name, Subject delegationSubject)
+ throws InstanceNotFoundException, IntrospectionException,
+ ReflectionException, IOException;
+
+ /**
+ * Handles {@link
+ * MBeanServerConnection#getObjectInstance(ObjectName)} by returning
+ * the {@link ObjectInstance} created for the specified management
+ * bean on registration.
+ *
+ * @param name the name of the bean.
+ * @param delegationSubject an instance of {@link javax.security.auth.Subject}
+ * containing the delegation principles. This may be
+ * {@code null} is authentication is used instead.
+ * @return the corresponding {@link ObjectInstance} instance.
+ * @throws InstanceNotFoundException if the bean can not be found.
+ * @throws SecurityException if the client or delegated subject (if any) does
+ * not have permission to invoke this operation.
+ * @throws IOException if an I/O error occurred in communicating with
+ * the bean server.
+ * @see #createMBean(String, ObjectName, Subject)
+ */
+ ObjectInstance getObjectInstance(ObjectName name, Subject delegationSubject)
+ throws InstanceNotFoundException, IOException;
+
+ /**
+ * <p>
+ * Handles {@link
+ * MBeanServerConnection#invoke(ObjectName, String, Object[],
+ * String[])}. The array of parameters is wrapped in a
+ * {@link MarshalledObject} so that it is deserialised
+ * using the bean's classloader.
+ * </p>
+ * <p>
+ * Invokes the supplied operation on the specified management
+ * bean. The class objects specified in the signature are loaded
+ * using the same class loader as was used for the management bean.
+ *
+ * @param bean the management bean whose operation should be invoked.
+ * @param name the name of the operation to invoke.
+ * @param params the parameters for the bean's constructor, encapsulated
+ * in a {@link MarshalledObject}. If this parameter is
+ * <code>null</code>, it will be judged equivalent to an
+ * empty array.
+ * @param sig the signature of the constructor to use. If this parameter
+ * is <code>null</code>, it will be judged equivalent to an
+ * empty array. The class objects will be loaded using the
+ * bean's classloader.
+ * @param delegationSubject an instance of {@link javax.security.auth.Subject}
+ * containing the delegation principles. This may be
+ * {@code null} is authentication is used instead.
+ * @return the return value of the method.
+ * @throws InstanceNotFoundException if the bean can not be found.
+ * @throws MBeanException if the method invoked throws an exception.
+ * @throws ReflectionException if an exception is thrown in invoking the
+ * method.
+ * @throws SecurityException if the client or delegated subject (if any) does
+ * not have permission to invoke this operation.
+ * @throws IOException if an I/O error occurred in communicating with
+ * the bean server.
+ * @see DynamicMBean#invoke(String, Object[], String[])
+ */
+ Object invoke(ObjectName bean, String name, MarshalledObject params,
+ String[] sig, Subject delegationSubject)
+ throws InstanceNotFoundException, MBeanException,
+ ReflectionException, IOException;
+
+ /**
+ * <p>
+ * Handles {@link
+ * MBeanServerConnection#isInstanceOf(ObjectName, String) by
+ * returning true if the specified management bean is an instance
+ * of the supplied class.
+ * </p>
+ * <p>
+ * A bean, B, is an instance of a class, C, if either of the following
+ * conditions holds:
+ * </p>
+ * <ul>
+ * <li>The class name in B's {@link MBeanInfo} is equal to the supplied
+ * name.</li>
+ * <li>Both the class of B and C were loaded by the same class loader,
+ * and B is assignable to C.</li>
+ * </ul>
+ *
+ * @param name the name of the management bean.
+ * @param className the name of the class to test if <code>name</code> is
+ * an instance of.
+ * @param delegationSubject an instance of {@link javax.security.auth.Subject}
+ * containing the delegation principles. This may be
+ * {@code null} is authentication is used instead.
+ * @return true if either B is directly an instance of the named class,
+ * or B is assignable to the class, given that both it and B's
+ * current class were loaded using the same class loader.
+ * @throws InstanceNotFoundException if the bean can not be found.
+ * @throws SecurityException if the client or delegated subject (if any) does
+ * not have permission to invoke this operation.
+ * @throws IOException if an I/O error occurred in communicating with
+ * the bean server.
+ */
+ boolean isInstanceOf(ObjectName name, String className,
+ Subject delegationSubject)
+ throws InstanceNotFoundException, IOException;
+
+ /**
+ * Handles {@link
+ * MBeanServerConnection#isRegistered(ObjectName) by returning
+ * true if the specified management bean is registered with
+ * the server.
+ *
+ * @param name the name of the management bean.
+ * @param delegationSubject an instance of {@link javax.security.auth.Subject}
+ * containing the delegation principles. This may be
+ * {@code null} is authentication is used instead.
+ * @return true if the bean is registered.
+ * @throws RuntimeOperationsException if an {@link IllegalArgumentException}
+ * is thrown by the server due to a
+ * <code>null</code> bean name.
+ * @throws SecurityException if the client or delegated subject (if any) does
+ * not have permission to invoke this operation.
+ * @throws IOException if an I/O error occurred in communicating with
+ * the bean server.
+ */
+ boolean isRegistered(ObjectName name, Subject delegationSubject)
+ throws IOException;
+
+ /**
+ * <p>
+ * Handles {@link
+ * MBeanServerConnection#queryMBeans(ObjectName, QueryExp)}.
+ * The query expression is wrapped in a {@link MarshalledObject}
+ * so that it is deserialised using the bean's classloader.
+ * </p>
+ * <p>
+ * Returns a set of {@link ObjectInstance}s matching the specified
+ * criteria. The full set of beans registered with the server
+ * are passed through two filters:
+ * </p>
+ * <ol>
+ * <li>Pattern matching is performed using the supplied
+ * {@link ObjectName}.</li>
+ * <li>The supplied query expression is applied.</li>
+ * </ol>
+ * <p>
+ * If both the object name and the query expression are <code>null</code>,
+ * or the object name has no domain and no key properties,
+ * no filtering will be performed and all beans are returned.
+ * </p>
+ *
+ * @param name an {@link ObjectName} to use as a filter.
+ * @param query a query expression to apply to each of the beans that match
+ * the given object name, encapsulated in a
+ * {@link MarshalledObject}. If a <code>null</code> value is
+ * encapsulated, then the beans will only be filtered using
+ * pattern matching on the supplied {@link ObjectName}.
+ * @param delegationSubject an instance of {@link javax.security.auth.Subject}
+ * containing the delegation principles. This may be
+ * {@code null} is authentication is used instead.
+ * @return a set of {@link ObjectInstance}s matching the filtered beans.
+ * This is empty if no beans survived the filters.
+ * @throws IOException if an I/O error occurred in communicating with
+ * the bean server.
+ * @throws SecurityException if the client or delegated subject (if any) does
+ * not have permission to invoke this operation.
+ */
+ Set<ObjectInstance> queryMBeans(ObjectName name, MarshalledObject query,
+ Subject delegationSubject)
+ throws IOException;
+
+ /**
+ * <p>
+ * Handles {@link
+ * MBeanServerConnection#queryNames(ObjectName, QueryExp)}.
+ * The query expression is wrapped in a {@link MarshalledObject}
+ * so that it is deserialised using the bean's classloader.
+ * </p>
+ * <p>
+ * Returns a set of {@link ObjectName}s matching the specified
+ * criteria. The full set of beans registered with the server
+ * are passed through two filters:
+ * </p>
+ * <ol>
+ * <li>Pattern matching is performed using the supplied
+ * {@link ObjectName}.</li>
+ * <li>The supplied query expression is applied.</li>
+ * </ol>
+ * <p>
+ * If both the object name and the query expression are <code>null</code>,
+ * or the object name has no domain and no key properties,
+ * no filtering will be performed and all beans are returned.
+ * </p>
+ *
+ * @param name an {@link ObjectName} to use as a filter.
+ * @param query a query expression to apply to each of the beans that match
+ * the given object name, encapsulated in a
+ * {@link MarshalledObject}. If a <code>null</code> value is
+ * encapsulated, then the beans will only be filtered using
+ * pattern matching on the supplied {@link ObjectName}.
+ * @param delegationSubject an instance of {@link javax.security.auth.Subject}
+ * containing the delegation principles. This may be
+ * {@code null} is authentication is used instead.
+ * @return a set of {@link ObjectName}s matching the filtered beans.
+ * @throws SecurityException if the client or delegated subject (if any) does
+ * not have permission to invoke this operation.
+ * @throws IOException if an I/O error occurred in communicating with
+ * the bean server.
+ */
+ Set<ObjectName> queryNames(ObjectName name, MarshalledObject query,
+ Subject delegationSubject)
+ throws IOException;
+
+ /**
+ * <p>
+ * Handles {@link
+ * MBeanServerConnection#removeNotificationListener(ObjectName,
+ * ObjectName, NotificationFilter, Object)}. Both the filter and
+ * the handback object are wrapped in a {@link MarshalledObject}
+ * so that they are deserialised using the bean's classloader.
+ * </p>
+ * <p>
+ * Removes the specified listener from the list of recipients
+ * of notifications from the supplied bean. Only the first instance with
+ * the supplied filter and passback object is removed.
+ * <code>null</code> is used as a valid value for these parameters,
+ * rather than as a way to remove all registration instances for
+ * the specified listener; for this behaviour instead, see
+ * {@link #removeNotificationListener(ObjectName, NotificationListener)}.
+ * </p>
+ *
+ * @param name the name of the management bean from which the
+ * listener should be removed.
+ * @param listener the listener to remove.
+ * @param filter a wrapper containing the filter of the listener
+ * to remove.
+ * @param passback a wrapper containing the handback object of the
+ * listener to remove.
+ * @param delegationSubject a {@link javax.security.auth.Subject} instance
+ * containing the delegation principles or
+ * {@code null} if authentication is used.
+ * @throws InstanceNotFoundException if the bean can not be found.
+ * @throws ListenerNotFoundException if the specified listener
+ * is not registered with the bean.
+ * @throws SecurityException if the client or delegated subject (if any) does
+ * not have permission to invoke this operation.
+ * @throws IOException if an I/O error occurred in communicating with
+ * the bean server.
+ * @see #addNotificationListener(ObjectName, NotificationListener,
+ * MarshalledObject, MarshalledObject, Subject)
+ * @see NotificationEmitter#removeNotificationListener(NotificationListener,
+ * NotificationFilter,
+ * Object)
+ */
+ void removeNotificationListener(ObjectName name,
+ ObjectName listener,
+ MarshalledObject filter,
+ MarshalledObject passback,
+ Subject delegationSubject)
+ throws InstanceNotFoundException, ListenerNotFoundException,
+ IOException;
+
+ /**
+ * Handles {@link
+ * MBeanServerConnection#removeNotificationListener(ObjectName,
+ * ObjectName)} by removing the specified listener from the list
+ * of recipients of notifications from the supplied bean. This
+ * includes all combinations of filters and passback objects
+ * registered for this listener. For more specific removal of
+ * listeners, see {@link #removeNotificationListener(ObjectName,
+ * ObjectName,MarshalledObject,MarshalledObject,Subject)}
+ *
+ * @param name the name of the management bean from which the
+ * listener should be removed.
+ * @param listener the name of the listener to remove.
+ * @param delegationSubject a {@link javax.security.auth.Subject} instance
+ * containing the delegation principles or
+ * {@code null} if authentication is used.
+ * @throws InstanceNotFoundException if a name doesn't match a registered
+ * bean.
+ * @throws ListenerNotFoundException if the specified listener
+ * is not registered with the bean.
+ * @throws SecurityException if the client or delegated subject (if any) does
+ * not have permission to invoke this operation.
+ * @throws IOException if an I/O error occurred in communicating with
+ * the bean server.
+ * @see #addNotificationListener(ObjectName, NotificationListener,
+ * MarshalledObject, MarshalledObject, Subject)
+ * @see NotificationBroadcaster#removeNotificationListener(NotificationListener)
+ */
+ void removeNotificationListener(ObjectName name, ObjectName listener,
+ Subject delegationSubject)
+ throws InstanceNotFoundException, ListenerNotFoundException,
+ IOException;
+
+ /**
+ * Removes one or more {@link NotificationListener}s from the specified
+ * management bean. This method corresponds to
+ * {@link #addNotificationListeners(ObjectName[], MarshalledObject[],
+ * Subject)} and provides a different way of handling
+ * MBeanServerConnection#removeNotificationListener(ObjectName,
+ * ObjectName)} and
+ * {@link MBeanServerConnection#removeNotificationListener(ObjectName,
+ * ObjectName, NotificationFilter, Object)} by using the integer
+ * identifiers provided by the
+ * {@link #addNotificationListeners(ObjectName[], MarshalledObject[],
+ * Subject)} method to select the listeners to remove.
+ *
+ * @param name the name of the management bean from which the
+ * listeners should be removed.
+ * @param listenerIds the identifiers of the listeners to remove.
+ * @param delegationSubject a {@link javax.security.auth.Subject} instance
+ * containing the delegation principles or
+ * {@code null} if authentication is used.
+ * @throws InstanceNotFoundException if a name doesn't match a registered
+ * bean.
+ * @throws ListenerNotFoundException if the specified listener
+ * is not registered with the bean.
+ * @throws SecurityException if the client or delegated subject (if any) does
+ * not have permission to invoke this operation.
+ * @throws IOException if an I/O error occurred in communicating with
+ * the bean server.
+ * @throws IllegalArgumentException if either <code>name</code>,
+ * <code>listenerIds</code> or an element
+ * of <code>listenerIds</code>
+ * is <code>null</code>.
+ * @see #addNotificationListeners(ObjectName[], MarshalledObject[], Subject)
+ */
+ void removeNotificationListeners(ObjectName name, Integer[] listenerIds,
+ Subject delegationSubject)
+ throws InstanceNotFoundException, ListenerNotFoundException,
+ IOException;
+
+ /**
+ * Handles {@link
+ * MBeanServerConnection#setAttribute(ObjectName, Attribute)}
+ * by setting the value of the specified attribute of the supplied
+ * management bean. The attribute is wrapped in a
+ * {@link MarshalledObject} so that it is deserialised using the
+ * bean's classloader.
+ *
+ * @param name the name of the management bean.
+ * @param attribute the attribute to set, encapsulated in a
+ * {@link MarshalledObject}.
+ * @param delegationSubject a {@link javax.security.auth.Subject} instance
+ * containing the delegation principles or
+ * {@code null} if authentication is used.
+ * @throws InstanceNotFoundException if the bean can not be found.
+ * @throws AttributeNotFoundException if the attribute does not
+ * correspond to an attribute
+ * of the bean.
+ * @throws InvalidAttributeValueException if the value is invalid
+ * for this particular
+ * attribute of the bean.
+ * @throws MBeanException if setting the attribute causes
+ * the bean to throw an exception (which
+ * becomes the cause of this exception).
+ * @throws ReflectionException if an exception occurred in trying
+ * to use the reflection interface
+ * to lookup the attribute. The
+ * thrown exception is the cause of
+ * this exception.
+ * @throws RuntimeOperationsException if an {@link IllegalArgumentException}
+ * is thrown by the server due to a
+ * <code>null</code> bean or attribute
+ * name.
+ * @throws SecurityException if the client or delegated subject (if any) does
+ * not have permission to invoke this operation.
+ * @throws IOException if an I/O error occurred in communicating with
+ * the bean server.
+ * @see #getAttribute(ObjectName, String, Subject)
+ * @see javax.management.DynamicMBean#setAttribute(Attribute)
+ */
+ void setAttribute(ObjectName name, MarshalledObject attribute,
+ Subject delegationSubject)
+ throws InstanceNotFoundException, AttributeNotFoundException,
+ InvalidAttributeValueException, MBeanException,
+ ReflectionException, IOException;
+
+ /**
+ * Handles {@link
+ * MBeanServerConnection#setAttributes(ObjectName, AttributeList)}
+ * by setting the value of each of the specified attributes
+ * of the supplied management bean to that specified by
+ * the {@link Attribute} object. The returned list contains
+ * the attributes that were set and their new values.
+ * The attribute list is wrapped in a {@link MarshalledObject} so
+ * that it is deserialised using the bean's classloader.
+ *
+ * @param name the name of the management bean.
+ * @param attributes the attributes to set, encapsulated in a
+ * {@link MarshalledObject}.
+ * @param delegationSubject a {@link javax.security.auth.Subject} instance
+ * containing the delegation principles or
+ * {@code null} if authentication is used.
+ * @return a list of the changed attributes.
+ * @throws InstanceNotFoundException if the bean can not be found.
+ * @throws ReflectionException if an exception occurred in trying
+ * to use the reflection interface
+ * to lookup the attribute. The
+ * thrown exception is the cause of
+ * this exception.
+ * @throws RuntimeOperationsException if an {@link IllegalArgumentException}
+ * is thrown by the server due to a
+ * <code>null</code> bean or attribute
+ * list.
+ * @throws SecurityException if the client or delegated subject (if any) does
+ * not have permission to invoke this operation.
+ * @throws IOException if an I/O error occurred in communicating with
+ * the bean server.
+ * @see #getAttributes(ObjectName, String[])
+ * @see DynamicMBean#setAttributes(AttributeList)
+ */
+ AttributeList setAttributes(ObjectName name, MarshalledObject attributes,
+ Subject delegationSubject)
+ throws InstanceNotFoundException, ReflectionException,
+ IOException;
+
+ /**
+ * Handles {@link
+ * MBeanServerConnection#unregisterMBean(ObjectName)} by unregistering
+ * the specified management bean. Following this operation,
+ * the bean instance is no longer accessible from the server via this
+ * name. Prior to unregistering the bean, the
+ * {@link MBeanRegistration#preDeregister()} method will be called if
+ * the bean implements the {@link MBeanRegistration} interface.
+ *
+ * @param name the name of the management bean.
+ * @param delegationSubject a {@link javax.security.auth.Subject} instance
+ * containing the delegation principles or
+ * {@code null} if authentication is used.
+ * @throws InstanceNotFoundException if the bean can not be found.
+ * @throws MBeanRegistrationException if an exception occurs in
+ * calling the preDeregister
+ * method.
+ * @throws RuntimeOperationsException if an {@link IllegalArgumentException}
+ * is thrown by the server due to a
+ * <code>null</code> bean name or a
+ * request being made to unregister the
+ * {@link MBeanServerDelegate} bean.
+ * @throws SecurityException if the client or delegated subject (if any) does
+ * not have permission to invoke this operation.
+ * @throws IOException if an I/O error occurred in communicating with
+ * the bean server.
+ */
+ void unregisterMBean(ObjectName name, Subject delegationSubject)
+ throws InstanceNotFoundException, MBeanRegistrationException,
+ IOException;
+
+}
diff --git a/libjava/classpath/javax/management/remote/rmi/RMIServer.java b/libjava/classpath/javax/management/remote/rmi/RMIServer.java
new file mode 100644
index 00000000000..d862372ace7
--- /dev/null
+++ b/libjava/classpath/javax/management/remote/rmi/RMIServer.java
@@ -0,0 +1,89 @@
+/* RMIServer.java -- RMI object for connecting to an RMI JMX connector.
+ Copyright (C) 2007 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., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package javax.management.remote.rmi;
+
+import java.io.IOException;
+
+import java.rmi.Remote;
+import java.rmi.RemoteException;
+
+/**
+ * RMI interface for obtaining an instance of an
+ * {@link RMIConnection}. An implementation of this
+ * interface exists for each RMI connector.
+ *
+ * @author Andrew John Hughes (gnu_andrew@member.fsf.org)
+ * @since 1.5
+ */
+public interface RMIServer
+ extends Remote
+{
+
+ /**
+ * Returns the version of the RMI connection protocol used
+ * by this server. The returned string takes the form of
+ * <emph>protocol-version implementation-name</emph> where
+ * <emph>protocol-version</emph> is a series of two or more
+ * non-negative integers, separated by a decimal point (.)
+ * (currently {@code 1.0}) and <emph>implementation-name</emph>
+ * is the string {@code "GNU Classpath"} followed by the version
+ * of GNU Classpath in use.
+ *
+ * @return the string specified above.
+ * @throws RemoteException if there is a problem with the transfer
+ * of the string via RMI.
+ */
+ String getVersion()
+ throws RemoteException;
+
+ /**
+ * Constructs and returns a new RMI connection using the specified
+ * authentication credentials. Each client calls this method to
+ * obtain a connection to the server.
+ *
+ * @param credentials a user-defined object passed to the server
+ * to authenticate the client. May be {@code null}.
+ * @return the new connection.
+ * @throws IOException if the new connection can not be created or
+ * exported, or an error occurs in the RMI transmission.
+ * @throws SecurityException if the client could not be authenticated
+ * correctly using the supplied credientials.
+ */
+ RMIConnection newClient(Object credentials)
+ throws IOException;
+}
diff --git a/libjava/classpath/javax/net/ssl/HttpsURLConnection.java b/libjava/classpath/javax/net/ssl/HttpsURLConnection.java
index 7d68162c96a..c02cb9e7b5c 100644
--- a/libjava/classpath/javax/net/ssl/HttpsURLConnection.java
+++ b/libjava/classpath/javax/net/ssl/HttpsURLConnection.java
@@ -38,7 +38,6 @@ exception statement from your version. */
package javax.net.ssl;
-import java.io.IOException;
import java.net.HttpURLConnection;
import java.net.URL;
import java.security.Principal;
diff --git a/libjava/classpath/javax/print/attribute/standard/JobStateReasons.java b/libjava/classpath/javax/print/attribute/standard/JobStateReasons.java
index 997dcbc3779..503c06c0290 100644
--- a/libjava/classpath/javax/print/attribute/standard/JobStateReasons.java
+++ b/libjava/classpath/javax/print/attribute/standard/JobStateReasons.java
@@ -40,8 +40,6 @@ package javax.print.attribute.standard;
import java.util.Collection;
import java.util.HashSet;
-import java.util.Iterator;
-
import javax.print.attribute.Attribute;
import javax.print.attribute.PrintJobAttribute;
diff --git a/libjava/classpath/javax/print/attribute/standard/MediaSize.java b/libjava/classpath/javax/print/attribute/standard/MediaSize.java
index be3f1567812..f2fa100a05c 100644
--- a/libjava/classpath/javax/print/attribute/standard/MediaSize.java
+++ b/libjava/classpath/javax/print/attribute/standard/MediaSize.java
@@ -214,7 +214,7 @@ public class MediaSize extends Size2DSyntax
for (int i = 0; i < mediaCache.size(); i++)
{
- MediaSize size = (MediaSize) mediaCache.get(i);
+ MediaSize size = mediaCache.get(i);
int dist = (Math.abs(size.getXMicrometers() - xMicro)
+ Math.abs(size.getYMicrometers() - yMicro));
@@ -240,7 +240,7 @@ public class MediaSize extends Size2DSyntax
{
for (int i = 0; i < mediaCache.size(); i++)
{
- MediaSize size = (MediaSize) mediaCache.get(i);
+ MediaSize size = mediaCache.get(i);
if (size.getMediaSizeName().equals(media))
return size;
diff --git a/libjava/classpath/javax/print/attribute/standard/PrinterStateReasons.java b/libjava/classpath/javax/print/attribute/standard/PrinterStateReasons.java
index c58dd53795e..3e77e181e55 100644
--- a/libjava/classpath/javax/print/attribute/standard/PrinterStateReasons.java
+++ b/libjava/classpath/javax/print/attribute/standard/PrinterStateReasons.java
@@ -178,7 +178,7 @@ public final class PrinterStateReasons
if (severity == null)
throw new NullPointerException("severity is null");
- return super.put((PrinterStateReason) reason, (Severity) severity);
+ return super.put(reason, severity);
}
/**
diff --git a/libjava/classpath/javax/rmi/CORBA/PortableRemoteObjectDelegate.java b/libjava/classpath/javax/rmi/CORBA/PortableRemoteObjectDelegate.java
index 2849707632b..f376bedfe80 100644
--- a/libjava/classpath/javax/rmi/CORBA/PortableRemoteObjectDelegate.java
+++ b/libjava/classpath/javax/rmi/CORBA/PortableRemoteObjectDelegate.java
@@ -84,7 +84,7 @@ public interface PortableRemoteObjectDelegate
* unexported. Also, such object cannot be collected by garbage collector.
* This is usually impemented via {@link Util#unexportObject}
*
- * @param object the object to export.
+ * @param obj the object to export.
*
* @throws RemoteException
*/
@@ -113,7 +113,7 @@ public interface PortableRemoteObjectDelegate
* returned stub is also connected to the same ORB. If the target is
* unconnected, the returned stub is unconnected.
*
- * @param target a server side object.
+ * @param obj a server side object.
* @return a stub object that can be used to access that server object.
*
* @throws NoSuchObjectException if a stub cannot be located for the given
@@ -127,7 +127,7 @@ public interface PortableRemoteObjectDelegate
* object to becomes available for garbage collection. This is usually
* impemented via {@link Util#unexportObject}
*
- * @param object the object to unexport.
+ * @param obj the object to unexport.
*
* @throws NoSuchObjectException if the passed object is not currently
* exported.
diff --git a/libjava/classpath/javax/rmi/CORBA/Util.java b/libjava/classpath/javax/rmi/CORBA/Util.java
index cfd3d7bd686..04b6f63a6fb 100644
--- a/libjava/classpath/javax/rmi/CORBA/Util.java
+++ b/libjava/classpath/javax/rmi/CORBA/Util.java
@@ -332,7 +332,7 @@ public class Util
* </tr>
* </table>
*
- * @param ex an exception that was thrown on a server side implementation.
+ * @param exception an exception that was thrown on a server side implementation.
*
* @return the corresponding RemoteException unless it is a RuntimeException.
*
diff --git a/libjava/classpath/javax/rmi/CORBA/UtilDelegate.java b/libjava/classpath/javax/rmi/CORBA/UtilDelegate.java
index cacb925810b..79d740e7b0a 100644
--- a/libjava/classpath/javax/rmi/CORBA/UtilDelegate.java
+++ b/libjava/classpath/javax/rmi/CORBA/UtilDelegate.java
@@ -243,7 +243,7 @@ public interface UtilDelegate
* </tr>
* </table>
*
- * @param ex an exception that was thrown on a server side implementation.
+ * @param e an exception that was thrown on a server side implementation.
*
* @return the corresponding RemoteException unless it is a RuntimeException.
*
@@ -266,7 +266,7 @@ public interface UtilDelegate
*
* @param output a stream to write to, must be
* org.omg.CORBA_2_3.portable.OutputStream
- * @param object an object to write.
+ * @param obj an object to write.
*/
void writeRemoteObject(OutputStream output, Object obj);
diff --git a/libjava/classpath/javax/rmi/CORBA/ValueHandler.java b/libjava/classpath/javax/rmi/CORBA/ValueHandler.java
index c4213efdcfb..acc44aa2f4a 100644
--- a/libjava/classpath/javax/rmi/CORBA/ValueHandler.java
+++ b/libjava/classpath/javax/rmi/CORBA/ValueHandler.java
@@ -114,7 +114,7 @@ public interface ValueHandler
* When the value provides the writeReplace method, the result of this method
* is written. Otherwise, the value itself is written.
*
- * @param the value that should be written to the stream.
+ * @param value the value that should be written to the stream.
*
* @return the value that will be actually written to the stream.
*/
diff --git a/libjava/classpath/javax/rmi/PortableRemoteObject.java b/libjava/classpath/javax/rmi/PortableRemoteObject.java
index 5bb6b112613..db2ea6b8069 100644
--- a/libjava/classpath/javax/rmi/PortableRemoteObject.java
+++ b/libjava/classpath/javax/rmi/PortableRemoteObject.java
@@ -97,10 +97,10 @@ public class PortableRemoteObject
* <code>a_source</code> parameter. The a_target is connected to the same
* ORB (and, if applicable, to the same {@link POA}) as the a_source.
*
- * @param a_target the target to connect to ORB, must be an instance of either
+ * @param target the target to connect to ORB, must be an instance of either
* {@link ObjectImpl} (Stubs and old-style ties) or {@link Tie}.
*
- * @param a_source the object, providing the connection information, must be
+ * @param source the object, providing the connection information, must be
* an instance of either {@link ObjectImpl} (Stubs and old-style ties) or
* {@link Servant} (the next-generation Ties supporting {@link POA}).
*
diff --git a/libjava/classpath/javax/rmi/ssl/SslRMIClientSocketFactory.java b/libjava/classpath/javax/rmi/ssl/SslRMIClientSocketFactory.java
index 1fed5824cd4..3a4c6cebeff 100644
--- a/libjava/classpath/javax/rmi/ssl/SslRMIClientSocketFactory.java
+++ b/libjava/classpath/javax/rmi/ssl/SslRMIClientSocketFactory.java
@@ -50,7 +50,7 @@ import java.rmi.server.RMIClientSocketFactory;
* SslRMIClientSocketFactory
*
* This class implements an RMIClientSocketFactory for SSL sockets.
- * it uses the defeult SSLClientSocketFactory.
+ * it uses the default SSLClientSocketFactory.
*
* This class can optionally use the following system properties, if set:
* <code>javax.rmi.ssl.client.enabledCipherSuites</code>
@@ -92,17 +92,19 @@ public class SslRMIClientSocketFactory
private String[] getProp(String p)
{
- StringTokenizer st;
+ String o;
try
{
- String o = (String)System.getProperty( p );
- st = new StringTokenizer( o, "," );
+ o = System.getProperty(p);
}
catch(SecurityException se)
{
return null;
}
+ if (o == null)
+ return null;
+ StringTokenizer st = new StringTokenizer( o, "," );
int n = st.countTokens();
if( n < 1 )
return null;
diff --git a/libjava/classpath/javax/swing/JFrame.java b/libjava/classpath/javax/swing/JFrame.java
index 0ae23f101fa..e54d453b8df 100644
--- a/libjava/classpath/javax/swing/JFrame.java
+++ b/libjava/classpath/javax/swing/JFrame.java
@@ -258,7 +258,7 @@ public class JFrame extends Frame
{
// If we're adding in the initialization stage use super.add.
// Otherwise pass the add onto the content pane.
- if (isRootPaneCheckingEnabled())
+ if (isRootPaneCheckingEnabled() && comp != rootPane)
getContentPane().add(comp,constraints,index);
else
super.addImpl(comp, constraints, index);
diff --git a/libjava/classpath/javax/swing/JTree.java b/libjava/classpath/javax/swing/JTree.java
index 332ec74247d..c0365bc385b 100644
--- a/libjava/classpath/javax/swing/JTree.java
+++ b/libjava/classpath/javax/swing/JTree.java
@@ -3105,7 +3105,7 @@ public class JTree extends JComponent implements Scrollable, Accessible
{
while (toRemove.hasMoreElements())
{
- TreePath current = (TreePath) toRemove.nextElement();
+ TreePath current = toRemove.nextElement();
Enumeration descendants = getDescendantToggledPaths(current);
while (descendants.hasMoreElements())
diff --git a/libjava/classpath/javax/swing/RepaintManager.java b/libjava/classpath/javax/swing/RepaintManager.java
index 773371489d9..bb88ebfcdce 100644
--- a/libjava/classpath/javax/swing/RepaintManager.java
+++ b/libjava/classpath/javax/swing/RepaintManager.java
@@ -59,8 +59,6 @@ import java.util.Iterator;
import java.util.Set;
import java.util.WeakHashMap;
-import javax.swing.text.JTextComponent;
-
/**
* <p>The repaint manager holds a set of dirty regions, invalid components,
* and a double buffer surface. The dirty regions and invalid components
diff --git a/libjava/classpath/javax/swing/TransferHandler.java b/libjava/classpath/javax/swing/TransferHandler.java
index 2e5963f443f..276697475f0 100644
--- a/libjava/classpath/javax/swing/TransferHandler.java
+++ b/libjava/classpath/javax/swing/TransferHandler.java
@@ -149,7 +149,7 @@ public class TransferHandler implements Serializable
Object o;
try
{
- o = getter.invoke(component, null);
+ o = getter.invoke(component);
return o;
}
catch (Exception ex)
diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicDirectoryModel.java b/libjava/classpath/javax/swing/plaf/basic/BasicDirectoryModel.java
index de82bd47bb6..b1fb727feeb 100644
--- a/libjava/classpath/javax/swing/plaf/basic/BasicDirectoryModel.java
+++ b/libjava/classpath/javax/swing/plaf/basic/BasicDirectoryModel.java
@@ -40,10 +40,8 @@ package javax.swing.plaf.basic;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.io.File;
-import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
-import java.util.Enumeration;
import java.util.Iterator;
import java.util.List;
import java.util.Vector;
diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicFileChooserUI.java b/libjava/classpath/javax/swing/plaf/basic/BasicFileChooserUI.java
index e1f8e4b28ba..4b6e2f79856 100644
--- a/libjava/classpath/javax/swing/plaf/basic/BasicFileChooserUI.java
+++ b/libjava/classpath/javax/swing/plaf/basic/BasicFileChooserUI.java
@@ -42,7 +42,6 @@ import java.awt.event.ActionEvent;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
-import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.io.File;
import java.io.IOException;
diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicGraphicsUtils.java b/libjava/classpath/javax/swing/plaf/basic/BasicGraphicsUtils.java
index 4c270682d88..e73c39bf6ac 100644
--- a/libjava/classpath/javax/swing/plaf/basic/BasicGraphicsUtils.java
+++ b/libjava/classpath/javax/swing/plaf/basic/BasicGraphicsUtils.java
@@ -642,7 +642,7 @@ public class BasicGraphicsUtils
fmet = g.getFontMetrics();
g.fillRect(
/* x */ x + fmet.stringWidth(text.substring(0, underlinedIndex)),
- /* y */ y + fmet.getDescent() - 1,
+ /* y */ y + 1,
/* width */ fmet.charWidth(text.charAt(underlinedIndex)),
/* height */ 1);
}
diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicLabelUI.java b/libjava/classpath/javax/swing/plaf/basic/BasicLabelUI.java
index ae992594d6b..045740df609 100644
--- a/libjava/classpath/javax/swing/plaf/basic/BasicLabelUI.java
+++ b/libjava/classpath/javax/swing/plaf/basic/BasicLabelUI.java
@@ -59,7 +59,6 @@ import javax.swing.JLabel;
import javax.swing.KeyStroke;
import javax.swing.LookAndFeel;
import javax.swing.SwingUtilities;
-import javax.swing.UIManager;
import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.LabelUI;
import javax.swing.text.View;
diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicTreeUI.java b/libjava/classpath/javax/swing/plaf/basic/BasicTreeUI.java
index 3952ea18d17..1c28a5f961d 100644
--- a/libjava/classpath/javax/swing/plaf/basic/BasicTreeUI.java
+++ b/libjava/classpath/javax/swing/plaf/basic/BasicTreeUI.java
@@ -279,14 +279,6 @@ public class BasicTreeUI
static Icon nullIcon;
/**
- * The special value of the mouse event is sent indicating that this is not
- * just the mouse click, but the mouse click on the selected node. Sending
- * such event forces to start the cell editing session.
- */
- static final MouseEvent EDIT = new MouseEvent(new Label(), 7, 7, 7, 7, 7, 7,
- false);
-
- /**
* Creates a new BasicTreeUI object.
*/
public BasicTreeUI()
diff --git a/libjava/classpath/javax/swing/plaf/metal/MetalScrollButton.java b/libjava/classpath/javax/swing/plaf/metal/MetalScrollButton.java
index a55dc091665..8678f680d33 100644
--- a/libjava/classpath/javax/swing/plaf/metal/MetalScrollButton.java
+++ b/libjava/classpath/javax/swing/plaf/metal/MetalScrollButton.java
@@ -38,7 +38,6 @@ exception statement from your version. */
package javax.swing.plaf.metal;
-import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Rectangle;
diff --git a/libjava/classpath/javax/swing/table/DefaultTableCellRenderer.java b/libjava/classpath/javax/swing/table/DefaultTableCellRenderer.java
index a9bbe9a7848..7fecefe0b4c 100644
--- a/libjava/classpath/javax/swing/table/DefaultTableCellRenderer.java
+++ b/libjava/classpath/javax/swing/table/DefaultTableCellRenderer.java
@@ -43,7 +43,6 @@ import java.awt.Component;
import java.awt.Rectangle;
import java.io.Serializable;
-import javax.swing.BorderFactory;
import javax.swing.JLabel;
import javax.swing.JTable;
import javax.swing.UIManager;
diff --git a/libjava/classpath/javax/swing/table/DefaultTableColumnModel.java b/libjava/classpath/javax/swing/table/DefaultTableColumnModel.java
index e4e7201b184..717ea98684a 100644
--- a/libjava/classpath/javax/swing/table/DefaultTableColumnModel.java
+++ b/libjava/classpath/javax/swing/table/DefaultTableColumnModel.java
@@ -243,7 +243,7 @@ public class DefaultTableColumnModel
int columnCount = tableColumns.size();
for (int i = 0; i < columnCount; i++)
{
- TableColumn tc = (TableColumn) tableColumns.get(i);
+ TableColumn tc = tableColumns.get(i);
if (identifier.equals(tc.getIdentifier()))
return i;
}
@@ -264,7 +264,7 @@ public class DefaultTableColumnModel
*/
public TableColumn getColumn(int columnIndex)
{
- return (TableColumn) tableColumns.get(columnIndex);
+ return tableColumns.get(columnIndex);
}
/**
@@ -299,7 +299,7 @@ public class DefaultTableColumnModel
{
for (int i = 0; i < tableColumns.size(); ++i)
{
- int w = ((TableColumn) tableColumns.get(i)).getWidth();
+ int w = (tableColumns.get(i)).getWidth();
if (0 <= x && x < w)
return i;
else
@@ -654,7 +654,7 @@ public class DefaultTableColumnModel
totalColumnWidth = 0;
for (int i = 0; i < tableColumns.size(); ++i)
{
- totalColumnWidth += ((TableColumn) tableColumns.get(i)).getWidth();
+ totalColumnWidth += tableColumns.get(i).getWidth();
}
}
}
diff --git a/libjava/classpath/javax/swing/text/DefaultStyledDocument.java b/libjava/classpath/javax/swing/text/DefaultStyledDocument.java
index 4ed8aa2d264..341579e3df8 100644
--- a/libjava/classpath/javax/swing/text/DefaultStyledDocument.java
+++ b/libjava/classpath/javax/swing/text/DefaultStyledDocument.java
@@ -1158,6 +1158,9 @@ public class DefaultStyledDocument extends AbstractDocument implements
private void insertElement(ElementSpec spec)
{
+ if (elementStack.isEmpty())
+ return;
+
Edit edit = (Edit) elementStack.peek();
switch (spec.getType())
{
diff --git a/libjava/classpath/javax/swing/text/GlyphView.java b/libjava/classpath/javax/swing/text/GlyphView.java
index 1e418d2e06a..6bc2a382c52 100644
--- a/libjava/classpath/javax/swing/text/GlyphView.java
+++ b/libjava/classpath/javax/swing/text/GlyphView.java
@@ -736,7 +736,6 @@ public class GlyphView extends View implements TabableView, Cloneable
if (bg != null)
{
g.setColor(bg);
- System.err.println("fill background: " + bg);
g.fillRect(r.x, r.y, r.width, r.height);
}
diff --git a/libjava/classpath/javax/swing/text/ParagraphView.java b/libjava/classpath/javax/swing/text/ParagraphView.java
index fb4ac65d835..f2795e2c38a 100644
--- a/libjava/classpath/javax/swing/text/ParagraphView.java
+++ b/libjava/classpath/javax/swing/text/ParagraphView.java
@@ -38,9 +38,6 @@ exception statement from your version. */
package javax.swing.text;
-import java.awt.Color;
-import java.awt.Graphics;
-import java.awt.Rectangle;
import java.awt.Shape;
import javax.swing.SizeRequirements;
diff --git a/libjava/classpath/javax/swing/text/html/MinimalHTMLWriter.java b/libjava/classpath/javax/swing/text/html/MinimalHTMLWriter.java
index d42951a05ec..acb2c04acc2 100644
--- a/libjava/classpath/javax/swing/text/html/MinimalHTMLWriter.java
+++ b/libjava/classpath/javax/swing/text/html/MinimalHTMLWriter.java
@@ -321,7 +321,7 @@ public class MinimalHTMLWriter extends AbstractWriter
}
else
{ // What else to do here?
- Style s = (Style)doc.getStyle("default");
+ Style s = doc.getStyle("default");
if(s != null)
writeStyle( s );
}
diff --git a/libjava/classpath/javax/swing/text/html/ResetableToggleButtonModel.java b/libjava/classpath/javax/swing/text/html/ResetableToggleButtonModel.java
index 619c24e477c..637ece15149 100644
--- a/libjava/classpath/javax/swing/text/html/ResetableToggleButtonModel.java
+++ b/libjava/classpath/javax/swing/text/html/ResetableToggleButtonModel.java
@@ -38,7 +38,6 @@ exception statement from your version. */
package javax.swing.text.html;
-import javax.swing.ButtonGroup;
import javax.swing.JToggleButton.ToggleButtonModel;
class ResetableToggleButtonModel
diff --git a/libjava/classpath/javax/swing/text/html/parser/DTD.java b/libjava/classpath/javax/swing/text/html/parser/DTD.java
index ae3c184f153..09b50fee7de 100644
--- a/libjava/classpath/javax/swing/text/html/parser/DTD.java
+++ b/libjava/classpath/javax/swing/text/html/parser/DTD.java
@@ -181,7 +181,7 @@ public class DTD
public static DTD getDTD(String name)
throws IOException
{
- DTD d = (DTD) dtdHash.get(name);
+ DTD d = dtdHash.get(name);
if (d == null)
{
@@ -210,7 +210,7 @@ public class DTD
*/
public Element getElement(int index)
{
- return (Element) elements.get(index);
+ return elements.get(index);
}
/**
@@ -235,7 +235,7 @@ public class DTD
*/
public Entity getEntity(String entity_name)
{
- return (Entity) entityHash.get(entity_name);
+ return entityHash.get(entity_name);
}
/**
diff --git a/libjava/classpath/javax/swing/text/html/parser/Entity.java b/libjava/classpath/javax/swing/text/html/parser/Entity.java
index cf294c748db..1d59df237b8 100644
--- a/libjava/classpath/javax/swing/text/html/parser/Entity.java
+++ b/libjava/classpath/javax/swing/text/html/parser/Entity.java
@@ -41,8 +41,6 @@ package javax.swing.text.html.parser;
import gnu.javax.swing.text.html.parser.support.gnuStringIntMapper;
-import java.io.Serializable;
-
/**
* <p>Stores information, obtained by parsing SGML DTL
* &lt;!ENTITY % .. &gt; tag.</p>
diff --git a/libjava/classpath/javax/swing/tree/DefaultMutableTreeNode.java b/libjava/classpath/javax/swing/tree/DefaultMutableTreeNode.java
index 9f587946fc2..a1afe781324 100644
--- a/libjava/classpath/javax/swing/tree/DefaultMutableTreeNode.java
+++ b/libjava/classpath/javax/swing/tree/DefaultMutableTreeNode.java
@@ -202,7 +202,7 @@ public class DefaultMutableTreeNode
*/
public void remove(int index)
{
- MutableTreeNode child = (MutableTreeNode) children.remove(index);
+ MutableTreeNode child = children.remove(index);
child.setParent(null);
}
@@ -553,7 +553,7 @@ public class DefaultMutableTreeNode
{
node = node.getParent();
size = node.getChildCount();
- index = ((Integer) stack.pop()).intValue() + 1;
+ index = stack.pop().intValue() + 1;
current--;
}
while (index >= size
@@ -1052,10 +1052,10 @@ public class DefaultMutableTreeNode
/** Provides an enumeration of a tree in breadth-first traversal
* order.
*/
- static class BreadthFirstEnumeration implements Enumeration
+ static class BreadthFirstEnumeration implements Enumeration<TreeNode>
{
- LinkedList queue = new LinkedList();
+ LinkedList<TreeNode> queue = new LinkedList<TreeNode>();
BreadthFirstEnumeration(TreeNode node)
{
@@ -1067,14 +1067,16 @@ public class DefaultMutableTreeNode
return !queue.isEmpty();
}
- public Object nextElement()
+ @SuppressWarnings("unchecked")
+ public TreeNode nextElement()
{
if (queue.isEmpty())
throw new NoSuchElementException("No more elements left.");
- TreeNode node = (TreeNode) queue.removeFirst();
+ TreeNode node = queue.removeFirst();
- Enumeration children = node.children();
+ Enumeration<TreeNode> children =
+ (Enumeration<TreeNode>) node.children();
while (children.hasMoreElements())
queue.add(children.nextElement());
@@ -1085,16 +1087,18 @@ public class DefaultMutableTreeNode
/** Provides an enumeration of a tree traversing it
* preordered.
*/
- static class PreorderEnumeration implements Enumeration
+ static class PreorderEnumeration implements Enumeration<TreeNode>
{
TreeNode next;
- Stack childrenEnums = new Stack();
+ Stack<Enumeration<TreeNode>> childrenEnums =
+ new Stack<Enumeration<TreeNode>>();
+ @SuppressWarnings("unchecked")
PreorderEnumeration(TreeNode node)
{
next = node;
- childrenEnums.push(node.children());
+ childrenEnums.push((Enumeration<TreeNode>) node.children());
}
public boolean hasMoreElements()
@@ -1102,14 +1106,14 @@ public class DefaultMutableTreeNode
return next != null;
}
- public Object nextElement()
+ public TreeNode nextElement()
{
if (next == null)
throw new NoSuchElementException("No more elements left.");
- Object current = next;
+ TreeNode current = next;
- Enumeration children = (Enumeration) childrenEnums.peek();
+ Enumeration<TreeNode> children = childrenEnums.peek();
// Retrieves the next element.
next = traverse(children);
@@ -1117,13 +1121,14 @@ public class DefaultMutableTreeNode
return current;
}
- private TreeNode traverse(Enumeration children)
+ @SuppressWarnings("unchecked")
+ private TreeNode traverse(Enumeration<TreeNode> children)
{
// If more children are available step down.
if (children.hasMoreElements())
{
- TreeNode child = (TreeNode) children.nextElement();
- childrenEnums.push(child.children());
+ TreeNode child = children.nextElement();
+ childrenEnums.push((Enumeration<TreeNode>) child.children());
return child;
}
@@ -1137,7 +1142,7 @@ public class DefaultMutableTreeNode
return null;
else
{
- return traverse((Enumeration) childrenEnums.peek());
+ return traverse(childrenEnums.peek());
}
}
}
@@ -1145,16 +1150,18 @@ public class DefaultMutableTreeNode
/** Provides an enumeration of a tree traversing it
* postordered (= depth-first).
*/
- static class PostorderEnumeration implements Enumeration
+ static class PostorderEnumeration implements Enumeration<TreeNode>
{
Stack<TreeNode> nodes = new Stack<TreeNode>();
- Stack childrenEnums = new Stack();
+ Stack<Enumeration<TreeNode>> childrenEnums =
+ new Stack<Enumeration<TreeNode>>();
+ @SuppressWarnings("unchecked")
PostorderEnumeration(TreeNode node)
{
nodes.push(node);
- childrenEnums.push(node.children());
+ childrenEnums.push((Enumeration<TreeNode>) node.children());
}
public boolean hasMoreElements()
@@ -1162,24 +1169,26 @@ public class DefaultMutableTreeNode
return !nodes.isEmpty();
}
- public Object nextElement()
+ public TreeNode nextElement()
{
if (nodes.isEmpty())
throw new NoSuchElementException("No more elements left!");
- Enumeration children = (Enumeration) childrenEnums.peek();
+ Enumeration<TreeNode> children = childrenEnums.peek();
return traverse(children);
}
- private Object traverse(Enumeration children)
+ @SuppressWarnings("unchecked")
+ private TreeNode traverse(Enumeration<TreeNode> children)
{
if (children.hasMoreElements())
{
- TreeNode node = (TreeNode) children.nextElement();
+ TreeNode node = children.nextElement();
nodes.push(node);
- Enumeration newChildren = node.children();
+ Enumeration<TreeNode> newChildren =
+ (Enumeration<TreeNode>) node.children();
childrenEnums.push(newChildren);
return traverse(newChildren);
@@ -1190,7 +1199,7 @@ public class DefaultMutableTreeNode
// Returns the node whose children
// have all been visited. (= postorder)
- Object next = nodes.peek();
+ TreeNode next = nodes.peek();
nodes.pop();
return next;
diff --git a/libjava/classpath/javax/swing/tree/DefaultTreeCellEditor.java b/libjava/classpath/javax/swing/tree/DefaultTreeCellEditor.java
index 4c10bfe1af2..04897986d49 100644
--- a/libjava/classpath/javax/swing/tree/DefaultTreeCellEditor.java
+++ b/libjava/classpath/javax/swing/tree/DefaultTreeCellEditor.java
@@ -306,13 +306,7 @@ public class DefaultTreeCellEditor
* Font to paint with, null indicates font of renderer is to be used.
*/
protected Font font;
-
- /**
- * Helper field used to save the last path seen while the timer was
- * running.
- */
- private TreePath tPath;
-
+
/**
* Constructs a DefaultTreeCellEditor object for a JTree using the
* specified renderer and a default editor. (Use this constructor
@@ -347,38 +341,6 @@ public class DefaultTreeCellEditor
Color c = UIManager.getColor("Tree.editorBorderSelectionColor");
setBorderSelectionColor(c);
}
-
- /**
- * Configures the editing component whenever it is null.
- *
- * @param tree the tree to configure to component for.
- * @param renderer the renderer used to set up the nodes
- * @param editor the editor used
- */
- private void configureEditingComponent(JTree tree,
- DefaultTreeCellRenderer renderer,
- TreeCellEditor editor)
- {
- if (tree != null && lastPath != null)
- {
- Object val = lastPath.getLastPathComponent();
- boolean isLeaf = tree.getModel().isLeaf(val);
- boolean expanded = tree.isExpanded(lastPath);
- determineOffset(tree, val, true, expanded, isLeaf, lastRow);
-
- // set up icon
- if (isLeaf)
- renderer.setIcon(renderer.getLeafIcon());
- else if (expanded)
- renderer.setIcon(renderer.getOpenIcon());
- else
- renderer.setIcon(renderer.getClosedIcon());
- editingIcon = renderer.getIcon();
-
- editingComponent = getTreeCellEditorComponent(tree, val, true,
- expanded, isLeaf, lastRow);
- }
- }
/**
* writeObject
diff --git a/libjava/classpath/javax/swing/tree/DefaultTreeCellRenderer.java b/libjava/classpath/javax/swing/tree/DefaultTreeCellRenderer.java
index 3766485abdb..b9c84013d16 100644
--- a/libjava/classpath/javax/swing/tree/DefaultTreeCellRenderer.java
+++ b/libjava/classpath/javax/swing/tree/DefaultTreeCellRenderer.java
@@ -42,18 +42,14 @@ import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.Font;
-import java.awt.FontMetrics;
import java.awt.Graphics;
-import java.awt.Insets;
import java.awt.Rectangle;
import javax.swing.Icon;
import javax.swing.JLabel;
import javax.swing.JTree;
import javax.swing.LookAndFeel;
-import javax.swing.SwingUtilities;
import javax.swing.UIManager;
-import javax.swing.border.Border;
import javax.swing.plaf.UIResource;
/**
@@ -515,7 +511,6 @@ public class DefaultTreeCellRenderer
int xOffset = -1;
if (bgColor != null)
{
- Icon i = getIcon();
xOffset = getXOffset();
g.setColor(bgColor);
g.fillRect(xOffset, 0, getWidth() - xOffset, getHeight());
diff --git a/libjava/classpath/javax/swing/tree/DefaultTreeSelectionModel.java b/libjava/classpath/javax/swing/tree/DefaultTreeSelectionModel.java
index 3d9c67728bd..2bb0d0045a6 100644
--- a/libjava/classpath/javax/swing/tree/DefaultTreeSelectionModel.java
+++ b/libjava/classpath/javax/swing/tree/DefaultTreeSelectionModel.java
@@ -164,7 +164,7 @@ public class DefaultTreeSelectionModel
* @see #removeSelectionPaths(TreePath[])
* @see #setSelectionPaths(TreePath[])
*/
- private transient HashSet selectedPaths;
+ private transient HashSet<TreePath> selectedPaths;
/**
* A supporting datastructure that is used in addSelectionPaths() and
@@ -174,7 +174,7 @@ public class DefaultTreeSelectionModel
* @see #removeSelectionPaths(TreePath[])
* @see #setSelectionPaths(TreePath[])
*/
- private transient HashSet tmpPaths;
+ private transient HashSet<TreePath> tmpPaths;
/**
* Constructs a new DefaultTreeSelectionModel.
@@ -185,8 +185,8 @@ public class DefaultTreeSelectionModel
listSelectionModel = new DefaultListSelectionModel();
listenerList = new EventListenerList();
leadIndex = -1;
- tmpPaths = new HashSet();
- selectedPaths = new HashSet();
+ tmpPaths = new HashSet<TreePath>();
+ selectedPaths = new HashSet<TreePath>();
}
/**
@@ -206,8 +206,8 @@ public class DefaultTreeSelectionModel
cloned.listenerList = new EventListenerList();
cloned.listSelectionModel =
(DefaultListSelectionModel) listSelectionModel.clone();
- cloned.selectedPaths = new HashSet();
- cloned.tmpPaths = new HashSet();
+ cloned.selectedPaths = new HashSet<TreePath>();
+ cloned.tmpPaths = new HashSet<TreePath>();
return cloned;
}
@@ -394,7 +394,7 @@ public class DefaultTreeSelectionModel
newLength = 1;
}
// Find new paths.
- Vector changedPaths = null;
+ Vector<PathPlaceHolder> changedPaths = null;
tmpPaths.clear();
int validPaths = 0;
TreePath oldLeadPath = leadPath;
@@ -407,7 +407,7 @@ public class DefaultTreeSelectionModel
if (! selectedPaths.contains(paths[i]))
{
if (changedPaths == null)
- changedPaths = new Vector();
+ changedPaths = new Vector<PathPlaceHolder>();
changedPaths.add(new PathPlaceHolder(paths[i], true));
}
leadPath = paths[i];
@@ -422,10 +422,10 @@ public class DefaultTreeSelectionModel
// Some of the paths are already selected, put together
// the new selection carefully.
newSelection = new TreePath[validPaths];
- Iterator newPaths = tmpPaths.iterator();
+ Iterator<TreePath> newPaths = tmpPaths.iterator();
validPaths = 0;
for (int i = 0; newPaths.hasNext(); i++)
- newSelection[i] = (TreePath) newPaths.next();
+ newSelection[i] = newPaths.next();
}
else
{
@@ -440,14 +440,14 @@ public class DefaultTreeSelectionModel
if (selection[i] != null && ! tmpPaths.contains(selection[i]))
{
if (changedPaths == null)
- changedPaths = new Vector();
+ changedPaths = new Vector<PathPlaceHolder>();
changedPaths.add(new PathPlaceHolder(selection[i], false));
}
}
// Perform changes and notification.
selection = newSelection;
- HashSet tmp = selectedPaths;
+ HashSet<TreePath> tmp = selectedPaths;
selectedPaths = tmpPaths;
tmpPaths = tmp;
tmpPaths.clear();
@@ -505,7 +505,7 @@ public class DefaultTreeSelectionModel
}
else
{
- Vector changedPaths = null;
+ Vector<PathPlaceHolder> changedPaths = null;
tmpPaths.clear();
int validPaths = 0;
TreePath oldLeadPath = leadPath;
@@ -521,7 +521,7 @@ public class DefaultTreeSelectionModel
{
validPaths++;
if (changedPaths == null)
- changedPaths = new Vector();
+ changedPaths = new Vector<PathPlaceHolder>();
changedPaths.add(new PathPlaceHolder(paths[i], true));
selectedPaths.add(paths[i]);
tmpPaths.add(paths[i]);
@@ -538,11 +538,11 @@ public class DefaultTreeSelectionModel
{
// Some of the paths are already selected, put together
// the new selection carefully.
- Iterator newPaths = tmpPaths.iterator();
+ Iterator<TreePath> newPaths = tmpPaths.iterator();
i = oldPaths;
while (newPaths.hasNext())
{
- newSelection[i] = (TreePath) newPaths.next();
+ newSelection[i] = newPaths.next();
i++;
}
}
@@ -589,13 +589,13 @@ public class DefaultTreeSelectionModel
clearSelection();
else
{
- Vector pathsToRemove = null;
+ Vector<PathPlaceHolder> pathsToRemove = null;
for (int i = paths.length - 1; i >= 0; i--)
{
if (paths[i] != null && selectedPaths.contains(paths[i]))
{
if (pathsToRemove == null)
- pathsToRemove = new Vector();
+ pathsToRemove = new Vector<PathPlaceHolder>();
selectedPaths.remove(paths[i]);
pathsToRemove.add(new PathPlaceHolder(paths[i],
false));
@@ -610,9 +610,9 @@ public class DefaultTreeSelectionModel
else
{
selection = new TreePath[selection.length - numRemove];
- Iterator keep = selectedPaths.iterator();
+ Iterator<TreePath> keep = selectedPaths.iterator();
for (int valid = 0; keep.hasNext(); valid++)
- selection[valid] = (TreePath) keep.next();
+ selection[valid] = keep.next();
}
// Update lead path.
if (leadPath != null && ! selectedPaths.contains(leadPath))
@@ -1120,7 +1120,7 @@ public class DefaultTreeSelectionModel
|| selectionMode == DISCONTIGUOUS_TREE_SELECTION)
return true;
- HashSet set = new HashSet();
+ HashSet<TreePath> set = new HashSet<TreePath>();
for (int i = 0; i < selection.length; i++)
set.add(selection[i]);
@@ -1128,10 +1128,10 @@ public class DefaultTreeSelectionModel
set.remove(paths[i]);
TreePath[] remaining = new TreePath[set.size()];
- Iterator iter = set.iterator();
+ Iterator<TreePath> iter = set.iterator();
for (int i = 0; i < remaining.length; i++)
- remaining[i] = (TreePath) iter.next();
+ remaining[i] = iter.next();
return arePathsContiguous(remaining);
}
@@ -1144,7 +1144,8 @@ public class DefaultTreeSelectionModel
* @param vPaths the vector of the changed patches
* @param oldLeadSelection the old selection index
*/
- protected void notifyPathChange(Vector vPaths, TreePath oldLeadSelection)
+ protected void notifyPathChange(Vector<PathPlaceHolder> vPaths,
+ TreePath oldLeadSelection)
{
int numChangedPaths = vPaths.size();
@@ -1152,7 +1153,7 @@ public class DefaultTreeSelectionModel
TreePath[] paths = new TreePath[numChangedPaths];
for (int i = 0; i < numChangedPaths; i++)
{
- PathPlaceHolder p = (PathPlaceHolder) vPaths.get(i);
+ PathPlaceHolder p = vPaths.get(i);
news[i] = p.isNew;
paths[i] = p.path;
}
diff --git a/libjava/classpath/javax/swing/tree/FixedHeightLayoutCache.java b/libjava/classpath/javax/swing/tree/FixedHeightLayoutCache.java
index dff9298e8f5..488809e0232 100644
--- a/libjava/classpath/javax/swing/tree/FixedHeightLayoutCache.java
+++ b/libjava/classpath/javax/swing/tree/FixedHeightLayoutCache.java
@@ -135,7 +135,7 @@ public class FixedHeightLayoutCache
}
}
- LinkedList lpath = new LinkedList();
+ LinkedList<Object> lpath = new LinkedList<Object>();
NodeRecord rp = this;
while (rp != null)
{
@@ -173,17 +173,17 @@ public class FixedHeightLayoutCache
/**
* The set of all expanded tree nodes.
*/
- Set expanded = new HashSet();
+ Set<Object> expanded = new HashSet<Object>();
/**
* Maps nodes to the row numbers.
*/
- Hashtable nodes = new Hashtable();
+ Hashtable<Object,NodeRecord> nodes = new Hashtable<Object,NodeRecord>();
/**
* Maps row numbers to nodes.
*/
- Hashtable row2node = new Hashtable();
+ Hashtable<Integer,Object> row2node = new Hashtable<Integer,Object>();
/**
* If true, the row map must be recomputed before using.
@@ -338,7 +338,7 @@ public class FixedHeightLayoutCache
if (dirty)
update();
Object last = path.getLastPathComponent();
- NodeRecord r = (NodeRecord) nodes.get(last);
+ NodeRecord r = nodes.get(last);
if (r == null)
// This node is not visible.
{
@@ -373,7 +373,7 @@ public class FixedHeightLayoutCache
return null;
else
{
- NodeRecord r = (NodeRecord) nodes.get(last);
+ NodeRecord r = nodes.get(last);
return r.getPath();
}
}
@@ -391,7 +391,7 @@ public class FixedHeightLayoutCache
if (dirty) update();
- NodeRecord r = (NodeRecord) nodes.get(path.getLastPathComponent());
+ NodeRecord r = nodes.get(path.getLastPathComponent());
if (r == null)
return - 1;
else
@@ -413,13 +413,13 @@ public class FixedHeightLayoutCache
// As the rows have arbitrary height, we need to iterate.
NodeRecord best = null;
NodeRecord r;
- Enumeration en = nodes.elements();
+ Enumeration<NodeRecord> en = nodes.elements();
int dist = Integer.MAX_VALUE;
while (en.hasMoreElements() && dist > 0)
{
- r = (NodeRecord) en.nextElement();
+ r = en.nextElement();
if (best == null)
{
best = r;
@@ -474,7 +474,7 @@ public class FixedHeightLayoutCache
}
/**
- * Get the enumeration over all visible pathes that start from the given
+ * Get the enumeration over all visible paths that start from the given
* parent path.
*
* @param parentPath the parent path
@@ -491,7 +491,7 @@ public class FixedHeightLayoutCache
for (int i = 0; i < parentPath.getPathCount(); i++)
{
node = parentPath.getPathComponent(i);
- nr = (NodeRecord) nodes.get(node);
+ nr = nodes.get(node);
if (nr.row >= 0)
p.add(node);
}
@@ -583,10 +583,10 @@ public class FixedHeightLayoutCache
if (dirty)
update();
totalHeight = 0;
- Enumeration en = nodes.elements();
+ Enumeration<NodeRecord> en = nodes.elements();
while (en.hasMoreElements())
{
- NodeRecord nr = (NodeRecord) en.nextElement();
+ NodeRecord nr = en.nextElement();
Rectangle r = nr.getBounds();
totalHeight += r.height;
}
@@ -602,10 +602,10 @@ public class FixedHeightLayoutCache
update();
maximalWidth = 0;
- Enumeration en = nodes.elements();
+ Enumeration<NodeRecord> en = nodes.elements();
while (en.hasMoreElements())
{
- NodeRecord nr = (NodeRecord) en.nextElement();
+ NodeRecord nr = en.nextElement();
Rectangle r = nr.getBounds();
if (r.x + r.width > maximalWidth)
maximalWidth = r.x + r.width;
diff --git a/libjava/classpath/javax/swing/tree/VariableHeightLayoutCache.java b/libjava/classpath/javax/swing/tree/VariableHeightLayoutCache.java
index 8c70c13afd2..50e8e5ce92e 100644
--- a/libjava/classpath/javax/swing/tree/VariableHeightLayoutCache.java
+++ b/libjava/classpath/javax/swing/tree/VariableHeightLayoutCache.java
@@ -138,7 +138,7 @@ public class VariableHeightLayoutCache
}
}
- LinkedList lpath = new LinkedList();
+ LinkedList<Object> lpath = new LinkedList<Object>();
NodeRecord rp = this;
while (rp != null)
{
@@ -146,7 +146,7 @@ public class VariableHeightLayoutCache
if (rp.parent != null)
{
Object parent = rp.parent;
- rp = (NodeRecord) nodes.get(parent);
+ rp = nodes.get(parent);
// Add the root node, even if it is not visible.
if (rp == null)
lpath.addFirst(parent);
@@ -171,17 +171,17 @@ public class VariableHeightLayoutCache
/**
* The set of all expanded tree nodes.
*/
- Set expanded = new HashSet();
+ Set<Object> expanded = new HashSet<Object>();
/**
* Maps nodes to the row numbers.
*/
- Hashtable nodes = new Hashtable();
+ Hashtable<Object,NodeRecord> nodes = new Hashtable<Object,NodeRecord>();
/**
* Maps row numbers to nodes.
*/
- ArrayList row2node = new ArrayList();
+ ArrayList<Object> row2node = new ArrayList<Object>();
/**
* If true, the row map must be recomputed before using.
@@ -292,7 +292,7 @@ public class VariableHeightLayoutCache
*/
public void invalidatePathBounds(TreePath path)
{
- NodeRecord r = (NodeRecord) nodes.get(path.getLastPathComponent());
+ NodeRecord r = nodes.get(path.getLastPathComponent());
if (r != null)
r.bounds = null;
}
@@ -354,7 +354,7 @@ public class VariableHeightLayoutCache
Object last = path.getLastPathComponent();
Rectangle result = null;
- NodeRecord r = (NodeRecord) nodes.get(last);
+ NodeRecord r = nodes.get(last);
if (r != null)
{
// The RI allows null arguments for rect, in which case a new Rectangle
@@ -405,7 +405,7 @@ public class VariableHeightLayoutCache
if (dirty)
update();
- NodeRecord r = (NodeRecord) nodes.get(path.getLastPathComponent());
+ NodeRecord r = nodes.get(path.getLastPathComponent());
if (r == null)
return - 1;
else
@@ -427,13 +427,13 @@ public class VariableHeightLayoutCache
// As the rows have arbitrary height, we need to iterate.
NodeRecord best = null;
NodeRecord r;
- Enumeration en = nodes.elements();
+ Enumeration<NodeRecord> en = nodes.elements();
int dist = Integer.MAX_VALUE;
while (en.hasMoreElements() && dist > 0)
{
- r = (NodeRecord) en.nextElement();
+ r = en.nextElement();
if (best == null)
{
best = r;
@@ -488,7 +488,7 @@ public class VariableHeightLayoutCache
}
/**
- * Get the enumeration over all visible pathes that start from the given
+ * Get the enumeration over all visible paths that start from the given
* parent path.
*
* @param parentPath the parent path
@@ -505,7 +505,7 @@ public class VariableHeightLayoutCache
for (int i = 0; i < parentPath.getPathCount(); i++)
{
node = parentPath.getPathComponent(i);
- nr = (NodeRecord) nodes.get(node);
+ nr = nodes.get(node);
if (nr != null && nr.row >= 0)
p.add(node);
}
@@ -603,7 +603,7 @@ public class VariableHeightLayoutCache
int rowCount = getRowCount();
if (rowCount > 0)
{
- NodeRecord last = (NodeRecord) nodes.get(row2node.get(rowCount - 1));
+ NodeRecord last = nodes.get(row2node.get(rowCount - 1));
height = last.bounds.y + last.bounds.height;
}
return height;
@@ -618,10 +618,10 @@ public class VariableHeightLayoutCache
update();
maximalWidth = 0;
- Enumeration en = nodes.elements();
+ Enumeration<NodeRecord> en = nodes.elements();
while (en.hasMoreElements())
{
- NodeRecord nr = (NodeRecord) en.nextElement();
+ NodeRecord nr = en.nextElement();
if (nr != null)
{
Rectangle r = nr.getBounds();
diff --git a/libjava/classpath/javax/swing/undo/StateEdit.java b/libjava/classpath/javax/swing/undo/StateEdit.java
index 91fc88faa60..55282ab37c8 100644
--- a/libjava/classpath/javax/swing/undo/StateEdit.java
+++ b/libjava/classpath/javax/swing/undo/StateEdit.java
@@ -177,8 +177,8 @@ public class StateEdit
{
object = obj;
undoRedoName = name;
- preState = new Hashtable();
- postState = new Hashtable();
+ preState = new Hashtable<Object,Object>();
+ postState = new Hashtable<Object,Object>();
obj.storeState(preState);
}
diff --git a/libjava/classpath/javax/swing/undo/UndoManager.java b/libjava/classpath/javax/swing/undo/UndoManager.java
index b9e6de67576..1f47d51706e 100644
--- a/libjava/classpath/javax/swing/undo/UndoManager.java
+++ b/libjava/classpath/javax/swing/undo/UndoManager.java
@@ -196,7 +196,7 @@ public class UndoManager
size = edits.size();
for (int i = size - 1; i >= 0; i--)
- ((UndoableEdit) edits.get(i)).die();
+ edits.get(i).die();
indexOfNextAdd = 0;
edits.clear();
}
@@ -244,7 +244,7 @@ public class UndoManager
return;
for (int i = to; i >= from; i--)
- ((UndoableEdit) edits.get(i)).die();
+ edits.get(i).die();
// Remove the range [from .. to] from edits. If from == to, which
// is likely to be a very common case, we can do better than
@@ -275,7 +275,7 @@ public class UndoManager
for (int i = indexOfNextAdd - 1; i >= 0; i--)
{
- result = (UndoableEdit) edits.get(i);
+ result = edits.get(i);
if (result.isSignificant())
return result;
}
@@ -298,7 +298,7 @@ public class UndoManager
for (int i = indexOfNextAdd; i < edits.size(); i++)
{
- result = (UndoableEdit) edits.get(i);
+ result = edits.get(i);
if (result.isSignificant())
return result;
}
@@ -324,7 +324,7 @@ public class UndoManager
while (true)
{
indexOfNextAdd -= 1;
- cur = (UndoableEdit) edits.get(indexOfNextAdd);
+ cur = edits.get(indexOfNextAdd);
cur.undo();
if (cur == edit)
return;
@@ -348,7 +348,7 @@ public class UndoManager
while (true)
{
- cur = (UndoableEdit) edits.get(indexOfNextAdd);
+ cur = edits.get(indexOfNextAdd);
indexOfNextAdd += 1;
cur.redo();
if (cur == edit)
diff --git a/libjava/classpath/javax/tools/Diagnostic.java b/libjava/classpath/javax/tools/Diagnostic.java
new file mode 100644
index 00000000000..67776e61a4f
--- /dev/null
+++ b/libjava/classpath/javax/tools/Diagnostic.java
@@ -0,0 +1,167 @@
+/* Diagnostic.java --
+ Copyright (C) 2008 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., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package javax.tools;
+
+import java.util.Locale;
+
+/**
+ * Encapsulates diagnostic information from a tool. This usually includes
+ * (but is not required) a position in a source file, line and column number
+ * information and a message.
+ *
+ * @author Roman Kennke (roman@kennke.org)
+ *
+ * @param <S> the type of the source object
+ *
+ * @since 1.6
+ */
+public interface Diagnostic<S>
+{
+ /**
+ * The kind of diagnostic information.
+ */
+ public static enum Kind
+ {
+ /**
+ * Indicates and error.
+ */
+ ERROR,
+
+ /**
+ * Indicates a warning.
+ */
+ WARNING,
+
+ /**
+ * Indicates a mandatory warning.
+ */
+ MANDATORY_WARNING,
+
+ /**
+ * Indicates a note.
+ */
+ NOTE,
+
+ /**
+ * Indicates something else.
+ */
+ OTHER
+ }
+
+ /**
+ * Indicates that this diagnostic object doesn't carry position information.
+ */
+ public static final long NOPOS = -1L;
+
+ /**
+ * Returns the kind of this diagnostic object.
+ *
+ * @return the kind of this diagnostic object
+ */
+ Kind getKind();
+
+ /**
+ * Returns the source of this diagnostic object.
+ *
+ * @return the source of this diagnostic object
+ */
+ S getSource();
+
+ /**
+ * Returns the position in the source object. This is a zero based value,
+ * or {@link # NOPOS}, indicating that this doesn't carry position
+ * information.
+ *
+ * @return the position in the source object
+ */
+ long getPosition();
+
+ /**
+ * Returns the start position in the source object. This is a zero based
+ * value, or {@link #NOPOS}, indicating that this doesn't carry position
+ * information.
+ *
+ * @return the start position in the source object
+ */
+ long getStartPosition();
+
+ /*
+ * Returns the end position in the source object. This is a zero based
+ * value, or {@link #NOPOS}, indicating that this doesn't carry position
+ * information.
+ *
+ * @return the end position in the source object
+ */
+ long getEndPosition();
+
+ /**
+ * Returns the line number or {@link #NOPOS}, indicating that this doesn't
+ * carry position information. This is a 1-based value indicating the line
+ * in the source object.
+ *
+ * @return the line number
+ */
+ long getLineNumber();
+
+ /**
+ * Returns the column number or {@link #NOPOS}, indicating that this doesn't
+ * carry position information. This is a 1-based value indicating the column
+ * in the source object.
+ *
+ * @return the column number
+ */
+ long getColumnNumber();
+
+ /**
+ * Return a diagnostic code. This is implementation dependend and might
+ * be <code>null</code>.
+ *
+ * @return a diagnostic code or <code>null</code>
+ */
+ String getCode();
+
+ /**
+ * Returns a localized message. This is implementation dependend. If
+ * <code>locale</code> is <code>null</code> this uses the default locale.
+ *
+ * @param locale the locale, or <code>null</code>
+ *
+ * @return a localized message
+ */
+ String getMessage(Locale locale);
+}
diff --git a/libjava/classpath/javax/tools/DiagnosticListener.java b/libjava/classpath/javax/tools/DiagnosticListener.java
new file mode 100644
index 00000000000..6a114f988a5
--- /dev/null
+++ b/libjava/classpath/javax/tools/DiagnosticListener.java
@@ -0,0 +1,61 @@
+/* DiagnosticListener.java --
+ Copyright (C) 2008 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., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package javax.tools;
+
+/**
+ * Receices diagnostic notifications from tools.
+ *
+ * @author Roman Kennke (roman@kennke.org)
+ *
+ * @param <S> the type of the source object
+ *
+ * @since 1.6
+ */
+public interface DiagnosticListener<S>
+{
+
+ /**
+ * Receive diagnostic information from tools.
+ *
+ * @param diagnostic the diagnostic information
+ *
+ * @throws NullPointerException if <code>diagnostic</code> is
+ * <code>null</code> and the implemenatation can't handle this
+ */
+ void report(Diagnostic<? extends S> diagnostic);
+}
diff --git a/libjava/classpath/javax/tools/FileObject.java b/libjava/classpath/javax/tools/FileObject.java
new file mode 100644
index 00000000000..56ecaba6d28
--- /dev/null
+++ b/libjava/classpath/javax/tools/FileObject.java
@@ -0,0 +1,155 @@
+/* FileObject.java --
+ Copyright (C) 2008 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., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package javax.tools;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.io.Reader;
+import java.io.Writer;
+import java.net.URI;
+
+/**
+ * Abstraction for all kinds of file objects used by tools, e.g. regular files,
+ * memory cache, or database data.
+ *
+ * @author Roman Kennke (roman@kennke.org)
+ *
+ * @since 1.6
+ */
+public interface FileObject
+{
+
+ /**
+ * Returns a URI that represents this file object.
+ *
+ * @return a URI that represents this file object
+ */
+ URI toURI();
+
+ /**
+ * Returns a name for this file object. The exact name is implementation
+ * dependent.
+ *
+ * @return a name for this file object
+ */
+ String getName();
+
+ /**
+ * Opens this file for reading and returns an input stream.
+ *
+ * @return an input stream to read this file object
+ *
+ * @throws IOException if an I/O error occured
+ * @throws IllegalStateException if this file was opened for writing and
+ * does not support reading
+ * @throws UnsupportedOperationException if this kind of file does not allow
+ * byte reading
+ */
+ InputStream openInputStream() throws IOException;
+
+ /**
+ * Opens this file for writing and returns an output stream.
+ *
+ * @return an output stream for writing this file object
+ *
+ * @throws IOException if an I/O error occurs
+ * @throws IllegalStateException if this file was opened for reading and
+ * does not support writing
+ * @throws UnsupportedOperationException if this kind of file does not allow
+ * byte writing
+ */
+ OutputStream openOutputStream() throws IOException;
+
+ /**
+ * Opens this file for reading and returns a reader.
+ *
+ * @return a reader for reading this file object
+ *
+ * @throws IOException if an I/O error occurs
+ * @throws IllegalStateException if this file was opened for writing and
+ * does not support reading
+ * @throws UnsupportedOperationException if this kind of file does not allow
+ * character reading
+ */
+ Reader openReader() throws IOException;
+
+ /**
+ * Returns the character content of the file, if available. Any byte
+ * that cannot be decoded will be replaced by the default replacement
+ * character. A diagnostic may be reported, unless
+ * <code>ignoreEncodingErrors</code> is <code>true</code>.
+ *
+ * @param ignoreEncodingErrors <code>true</code> when encoding errors should be ignored
+ * <code>false</code> otherwise
+ * @return the character content, or <code>null</code> if not available
+ *
+ * @throws IOException if an I/O error occurs
+ */
+ CharSequence getCharContent(boolean ignoreEncodingErrors) throws IOException;
+
+ /**
+ * Opens this file for writer and returns a writer.
+ *
+ * @return a writer for writing this file object
+ *
+ * @throws IOException if an I/O error occurs
+ * @throws IllegalStateException if this file was opened for reading and
+ * does not support writing
+ * @throws UnsupportedOperationException if this kind of file does not allow
+ * character writing
+ */
+ Writer openWriter() throws IOException;
+
+ /**
+ * Returns the time when the file was last modified. The time is measured
+ * like in <code>System.currentTimeMillis()</code>.
+ *
+ * @return the time when the file was last modified
+ */
+ long getLastModified();
+
+ /**
+ * Deletes this file object. In case of errors this returns
+ * <code>false</code>.
+ *
+ * @return <code>true</code> when the file deletion was successful,
+ * <code>false</code> otherwise
+ */
+ boolean delete();
+}
diff --git a/libjava/classpath/javax/xml/datatype/DatatypeFactory.java b/libjava/classpath/javax/xml/datatype/DatatypeFactory.java
index 14f507416ab..06f465c353e 100644
--- a/libjava/classpath/javax/xml/datatype/DatatypeFactory.java
+++ b/libjava/classpath/javax/xml/datatype/DatatypeFactory.java
@@ -37,11 +37,8 @@ exception statement from your version. */
package javax.xml.datatype;
-import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
-import java.io.InputStream;
-import java.io.InputStreamReader;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.GregorianCalendar;
diff --git a/libjava/classpath/javax/xml/namespace/QName.java b/libjava/classpath/javax/xml/namespace/QName.java
index edc6678e350..18dee79bbff 100644
--- a/libjava/classpath/javax/xml/namespace/QName.java
+++ b/libjava/classpath/javax/xml/namespace/QName.java
@@ -146,6 +146,9 @@ public class QName implements Serializable
public static QName valueOf(String qNameAsString)
{
+ if (qNameAsString == null)
+ throw new IllegalArgumentException("qNameAsString can't be null");
+
String namespaceUri = "", prefix = null;
int start = qNameAsString.indexOf('{');
int end = qNameAsString.indexOf('}');
diff --git a/libjava/classpath/javax/xml/stream/XMLEventFactory.java b/libjava/classpath/javax/xml/stream/XMLEventFactory.java
index ee47af2a90d..cb850baaec8 100644
--- a/libjava/classpath/javax/xml/stream/XMLEventFactory.java
+++ b/libjava/classpath/javax/xml/stream/XMLEventFactory.java
@@ -43,7 +43,6 @@ import java.io.FileInputStream;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.IOException;
-import java.io.Reader;
import java.util.Iterator;
import java.util.Properties;
import javax.xml.namespace.NamespaceContext;
diff --git a/libjava/classpath/javax/xml/stream/XMLInputFactory.java b/libjava/classpath/javax/xml/stream/XMLInputFactory.java
index 4dfd1203a70..f88451e54bf 100644
--- a/libjava/classpath/javax/xml/stream/XMLInputFactory.java
+++ b/libjava/classpath/javax/xml/stream/XMLInputFactory.java
@@ -44,7 +44,6 @@ import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.IOException;
import java.io.Reader;
-import java.io.Writer;
import java.util.Properties;
import javax.xml.stream.util.XMLEventAllocator;
import javax.xml.transform.Source;
diff --git a/libjava/classpath/javax/xml/stream/events/Attribute.java b/libjava/classpath/javax/xml/stream/events/Attribute.java
index cf471137484..6e6d0274c4a 100644
--- a/libjava/classpath/javax/xml/stream/events/Attribute.java
+++ b/libjava/classpath/javax/xml/stream/events/Attribute.java
@@ -59,7 +59,7 @@ public interface Attribute
/**
* Returns the type of this attribute.
*/
- QName getDTDType();
+ String getDTDType();
/**
* Indicates whether this attribute was specified in the input source, or
OpenPOWER on IntegriCloud