diff a/src/java.base/share/classes/java/net/HttpRetryException.java b/src/java.base/share/classes/java/net/HttpRetryException.java --- a/src/java.base/share/classes/java/net/HttpRetryException.java +++ b/src/java.base/share/classes/java/net/HttpRetryException.java @@ -37,11 +37,18 @@ */ public class HttpRetryException extends IOException { @java.io.Serial private static final long serialVersionUID = -9186022286469111381L; + /** + * The response code. + */ private int responseCode; + + /** + * The URL to be redirected to. + */ private String location; /** * Constructs a new {@code HttpRetryException} from the * specified response code and exception detail message diff a/src/java.base/share/classes/java/net/Inet6Address.java b/src/java.base/share/classes/java/net/Inet6Address.java --- a/src/java.base/share/classes/java/net/Inet6Address.java +++ b/src/java.base/share/classes/java/net/Inet6Address.java @@ -555,15 +555,19 @@ } throw new UnknownHostException ("No matching address found for interface : " +ifname); } /** - * @serialField ipaddress byte[] - * @serialField scope_id int - * @serialField scope_id_set boolean - * @serialField scope_ifname_set boolean - * @serialField ifname String + * @serialField ipaddress byte[] holds a 128-bit (16 bytes) IPv6 address + * @serialField scope_id int the address scope id. {@code 0} if undefined + * @serialField scope_id_set boolean {@code true} when the scope_id field + * contains a valid integer scope_id + * @serialField scope_ifname_set boolean {@code true} if the object is + * constructed with a scoped interface instead of a numeric + * scope id + * @serialField ifname String the name of the scoped network interface. + * {@code null} if undefined */ @java.io.Serial private static final ObjectStreamField[] serialPersistentFields = { new ObjectStreamField("ipaddress", byte[].class), new ObjectStreamField("scope_id", int.class), @@ -576,13 +580,17 @@ = jdk.internal.misc.Unsafe.getUnsafe(); private static final long FIELDS_OFFSET = UNSAFE.objectFieldOffset( Inet6Address.class, "holder6"); /** - * restore the state of this object from stream - * including the scope information, only if the - * scoped interface name is valid on this system + * Restores the state of this object from the stream. + * This includes the scope information, but only if the + * scoped interface name is valid on this system. + * + * @param s the {@code ObjectInputStream} from which data is read + * @throws IOException if an I/O error occurs + * @throws ClassNotFoundException if a serialized class cannot be loaded */ @java.io.Serial private void readObject(ObjectInputStream s) throws IOException, ClassNotFoundException { NetworkInterface scope_ifname = null; @@ -640,13 +648,16 @@ UNSAFE.putReference(this, FIELDS_OFFSET, h); } /** - * default behavior is overridden in order to write the - * scope_ifname field as a String, rather than a NetworkInterface - * which is not serializable + * The default behavior of this method is overridden in order to + * write the scope_ifname field as a {@code String}, rather than a + * {@code NetworkInterface} which is not serializable. + * + * @param s the {@code ObjectOutputStream} to which data is written + * @throws IOException if an I/O error occurs */ @java.io.Serial private synchronized void writeObject(ObjectOutputStream s) throws IOException { diff a/src/java.base/share/classes/java/net/InetAddress.java b/src/java.base/share/classes/java/net/InetAddress.java --- a/src/java.base/share/classes/java/net/InetAddress.java +++ b/src/java.base/share/classes/java/net/InetAddress.java @@ -1710,10 +1710,13 @@ } return (InetAddressImpl) impl; } + /** + * Initializes an empty InetAddress. + */ @java.io.Serial private void readObjectNoData () { if (getClass().getClassLoader() != null) { throw new SecurityException ("invalid address type"); } @@ -1722,10 +1725,17 @@ private static final jdk.internal.misc.Unsafe UNSAFE = jdk.internal.misc.Unsafe.getUnsafe(); private static final long FIELDS_OFFSET = UNSAFE.objectFieldOffset(InetAddress.class, "holder"); + /** + * Restores the state of this object from the stream. + * + * @param s the {@code ObjectInputStream} from which data is read + * @throws IOException if an I/O error occurs + * @throws ClassNotFoundException if a serialized class cannot be loaded + */ @java.io.Serial private void readObject (ObjectInputStream s) throws IOException, ClassNotFoundException { if (getClass().getClassLoader() != null) { throw new SecurityException ("invalid address type"); @@ -1742,21 +1752,28 @@ } /* needed because the serializable fields no longer exist */ /** - * @serialField hostName String - * @serialField address int - * @serialField family int + * @serialField hostName String the hostname for this address + * @serialField address int holds a 32-bit IPv4 address. + * @serialField family int specifies the address family type, for instance, + * {@code '1'} for IPv4 addresses, and {@code '2'} for IPv6 addresses. */ @java.io.Serial private static final ObjectStreamField[] serialPersistentFields = { new ObjectStreamField("hostName", String.class), new ObjectStreamField("address", int.class), new ObjectStreamField("family", int.class), }; + /** + * Writes the state of this object to the stream. + * + * @param s the {@code ObjectOutputStream} to which data is written + * @throws IOException if an I/O error occurs + */ @java.io.Serial private void writeObject (ObjectOutputStream s) throws IOException { if (getClass().getClassLoader() != null) { throw new SecurityException ("invalid address type"); diff a/src/java.base/share/classes/java/net/InetSocketAddress.java b/src/java.base/share/classes/java/net/InetSocketAddress.java --- a/src/java.base/share/classes/java/net/InetSocketAddress.java +++ b/src/java.base/share/classes/java/net/InetSocketAddress.java @@ -262,20 +262,26 @@ public static InetSocketAddress createUnresolved(String host, int port) { return new InetSocketAddress(checkPort(port), checkHost(host)); } /** - * @serialField hostname String - * @serialField addr InetAddress - * @serialField port int + * @serialField hostname String the hostname of the Socket Address + * @serialField addr InetAddress the IP address of the Socket Address + * @serialField port int the port number of the Socket Address */ @java.io.Serial private static final ObjectStreamField[] serialPersistentFields = { new ObjectStreamField("hostname", String.class), new ObjectStreamField("addr", InetAddress.class), new ObjectStreamField("port", int.class)}; + /** + * Writes the state of this object to the stream. + * + * @param out the {@code ObjectOutputStream} to which data is written + * @throws IOException if an I/O error occurs + */ @java.io.Serial private void writeObject(ObjectOutputStream out) throws IOException { // Don't call defaultWriteObject() @@ -284,10 +290,17 @@ pfields.put("addr", holder.addr); pfields.put("port", holder.port); out.writeFields(); } + /** + * Restores the state of this object from the stream. + * + * @param in the {@code ObjectInputStream} from which data is read + * @throws IOException if an I/O error occurs + * @throws ClassNotFoundException if a serialized class cannot be loaded + */ @java.io.Serial private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException { // Don't call defaultReadObject() @@ -306,10 +319,14 @@ oisAddr, oisPort); UNSAFE.putReference(this, FIELDS_OFFSET, h); } + /** + * Throws {@code InvalidObjectException}, always. + * @throws ObjectStreamException always + */ @java.io.Serial private void readObjectNoData() throws ObjectStreamException { throw new InvalidObjectException("Stream data required"); diff a/src/java.base/share/classes/java/net/SocketPermission.java b/src/java.base/share/classes/java/net/SocketPermission.java --- a/src/java.base/share/classes/java/net/SocketPermission.java +++ b/src/java.base/share/classes/java/net/SocketPermission.java @@ -1187,13 +1187,16 @@ public PermissionCollection newPermissionCollection() { return new SocketPermissionCollection(); } /** - * WriteObject is called to save the state of the SocketPermission - * to a stream. The actions are serialized, and the superclass - * takes care of the name. + * {@code writeObject} is called to save the state of the + * {@code SocketPermission} to a stream. The actions are serialized, + * and the superclass takes care of the name. + * + * @param s the {@code ObjectOutputStream} to which data is written + * @throws IOException if an I/O error occurs */ @java.io.Serial private synchronized void writeObject(java.io.ObjectOutputStream s) throws IOException { @@ -1203,12 +1206,16 @@ getActions(); s.defaultWriteObject(); } /** - * readObject is called to restore the state of the SocketPermission from - * a stream. + * {@code readObject} is called to restore the state of the + * {@code SocketPermission} from a stream. + * + * @param s the {@code ObjectInputStream} from which data is read + * @throws IOException if an I/O error occurs + * @throws ClassNotFoundException if a serialized class cannot be loaded */ @java.io.Serial private synchronized void readObject(java.io.ObjectInputStream s) throws IOException, ClassNotFoundException { @@ -1486,11 +1493,15 @@ private static final ObjectStreamField[] serialPersistentFields = { new ObjectStreamField("permissions", Vector.class), }; /** + * Writes the state of this object to the stream. * @serialData "permissions" field (a Vector containing the SocketPermissions). + * + * @param out the {@code ObjectOutputStream} to which data is written + * @throws IOException if an I/O error occurs */ /* * Writes the contents of the perms field out as a Vector for * serialization compatibility with earlier releases. */ @@ -1504,12 +1515,17 @@ ObjectOutputStream.PutField pfields = out.putFields(); pfields.put("permissions", permissions); out.writeFields(); } - /* - * Reads in a Vector of SocketPermissions and saves them in the perms field. + /** + * Reads in a {@code Vector} of {@code SocketPermission} and saves + * them in the perms field. + * + * @param in the {@code ObjectInputStream} from which data is read + * @throws IOException if an I/O error occurs + * @throws ClassNotFoundException if a serialized class cannot be loaded */ @java.io.Serial private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException { diff a/src/java.base/share/classes/java/net/URI.java b/src/java.base/share/classes/java/net/URI.java --- a/src/java.base/share/classes/java/net/URI.java +++ b/src/java.base/share/classes/java/net/URI.java @@ -1775,10 +1775,13 @@ * and then the {@link java.io.ObjectOutputStream#defaultWriteObject()} * method of the given object-output stream is invoked.
* * @param os The object-output stream to which this object * is to be written + * + * @throws IOException + * If an I/O error occurs */ @java.io.Serial private void writeObject(ObjectOutputStream os) throws IOException { @@ -1793,10 +1796,16 @@ * invoked to read the value of the {@code string} field. The result is * then parsed in the usual way. * * @param is The object-input stream from which this object * is being read + * + * @throws IOException + * If an I/O error occurs + * + * @throws ClassNotFoundException + * If a serialized class cannot be loaded */ @java.io.Serial private void readObject(ObjectInputStream is) throws ClassNotFoundException, IOException { diff a/src/java.base/share/classes/java/net/URISyntaxException.java b/src/java.base/share/classes/java/net/URISyntaxException.java --- a/src/java.base/share/classes/java/net/URISyntaxException.java +++ b/src/java.base/share/classes/java/net/URISyntaxException.java @@ -39,11 +39,18 @@ extends Exception { @java.io.Serial private static final long serialVersionUID = 2137979680897488891L; + /** + * The input string. + */ private String input; + /** + * The index at which the parse error occurred, + * or {@code -1} if the index is not known. + */ private int index; /** * Constructs an instance from the given input string, reason, and error * index. diff a/src/java.base/share/classes/java/net/URL.java b/src/java.base/share/classes/java/net/URL.java --- a/src/java.base/share/classes/java/net/URL.java +++ b/src/java.base/share/classes/java/net/URL.java @@ -1479,23 +1479,24 @@ } return handler; } /** - * @serialField protocol String + * @serialField protocol String the protocol to use (ftp, http, nntp, ... etc.) * - * @serialField host String + * @serialField host String the host name to connect to * - * @serialField port int + * @serialField port int the protocol port to connect to * - * @serialField authority String + * @serialField authority String the authority part of this URL * - * @serialField file String + * @serialField file String the specified file name on that host. {@code file} is + * defined as {@code path[?query]} * - * @serialField ref String + * @serialField ref String the fragment part of this URL * - * @serialField hashCode int + * @serialField hashCode int the hashCode of this URL * */ @java.io.Serial private static final ObjectStreamField[] serialPersistentFields = { new ObjectStreamField("protocol", String.class), @@ -1513,10 +1514,13 @@ * * @serialData the default write object value. When read back in, * the reader must ensure that calling getURLStreamHandler with * the protocol variable returns a valid URLStreamHandler and * throw an IOException if it does not. + * + * @param s the {@code ObjectOutputStream} to which data is written + * @throws IOException if an I/O error occurs */ @java.io.Serial private synchronized void writeObject(java.io.ObjectOutputStream s) throws IOException { @@ -1525,10 +1529,14 @@ /** * readObject is called to restore the state of the URL from the * stream. It reads the components of the URL and finds the local * stream handler. + * + * @param s the {@code ObjectInputStream} from which data is read + * @throws IOException if an I/O error occurs + * @throws ClassNotFoundException if a serialized class cannot be loaded */ @java.io.Serial private synchronized void readObject(java.io.ObjectInputStream s) throws IOException, ClassNotFoundException { GetField gf = s.readFields(); diff a/src/java.base/share/classes/java/net/URLPermission.java b/src/java.base/share/classes/java/net/URLPermission.java --- a/src/java.base/share/classes/java/net/URLPermission.java +++ b/src/java.base/share/classes/java/net/URLPermission.java @@ -160,10 +160,13 @@ private transient List