-
Bug
-
Resolution: Fixed
-
P3
-
9, 10, 11, 12, 13
-
b23
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8225836 | 14 | Chris Hegarty | P3 | Resolved | Fixed | team |
The scope of this issue has been extended to cover the default
implementation of the three new-style socket option method of
`SocketImpl` and `DatagramSocketImpl`. The associated CSR contains the
specific details.
---
The `getOption` and `setOption` methods of the four java.net socket
types ( ServerSocket, Socket, DatagramSocket, and MulticastSocket ),
should conform to their specification. Specifically:
1) Throw NullPointerException if the option name is null.
Specification:
* @throws NullPointerException if name is {@code null}
Example of existing behaviour:
jshell> (new Socket()).setOption(null, 1);
| Exception java.lang.UnsupportedOperationException: unsupported option
| at PlainSocketImpl.setOption (PlainSocketImpl.java:72)
| at Socket.setOption (Socket.java:1760)
| at (#2:1)
2) Throw IllegalArgumentException when passed a bad value.
A bad value is one of null ( since no specified options accept a
null value ), or a value outside of the options textually specified
range, e.g. StandardSocketOptions.SO_SNDBUF specifies "a negative
size is not allowed". This applied to `setOption` only.
Specification:
* @throws IllegalArgumentException if the value is not valid for
* the option.
The options that specify, either explicitly or implicitly, a value
range (in StandardSocketOptions) are SO_RCVBUF, SO_SNDBUF, IP_TOS,
and IP_MULTICAST_TTL.
Example of existing behaviour:
jshell> (new Socket()).setOption(StandardSocketOptions.SO_RCVBUF,-1);
| Exception java.net.SocketException: bad parameter for SO_SNDBUF or SO_RCVBUF
| at AbstractPlainSocketImpl.setOption (AbstractPlainSocketImpl.java:289)
| at SocketImpl.setOption (SocketImpl.java:384)
| at PlainSocketImpl.setOption (PlainSocketImpl.java:69)
| at Socket.setOption (Socket.java:1760)
| at (#1:1)
3) Throw an IOException after the socket has been closed.
Specification:
* @throws IOException if an I/O error occurs, or if the socket is closed.
Example of existing behaviour:
jshell> var s = new Socket()
s ==> Socket[unconnected]
jshell> s.close()
jshell> s.getOption(StandardSocketOptions.SO_RCVBUF)
$8 ==> 131072
implementation of the three new-style socket option method of
`SocketImpl` and `DatagramSocketImpl`. The associated CSR contains the
specific details.
---
The `getOption` and `setOption` methods of the four java.net socket
types ( ServerSocket, Socket, DatagramSocket, and MulticastSocket ),
should conform to their specification. Specifically:
1) Throw NullPointerException if the option name is null.
Specification:
* @throws NullPointerException if name is {@code null}
Example of existing behaviour:
jshell> (new Socket()).setOption(null, 1);
| Exception java.lang.UnsupportedOperationException: unsupported option
| at PlainSocketImpl.setOption (PlainSocketImpl.java:72)
| at Socket.setOption (Socket.java:1760)
| at (#2:1)
2) Throw IllegalArgumentException when passed a bad value.
A bad value is one of null ( since no specified options accept a
null value ), or a value outside of the options textually specified
range, e.g. StandardSocketOptions.SO_SNDBUF specifies "a negative
size is not allowed". This applied to `setOption` only.
Specification:
* @throws IllegalArgumentException if the value is not valid for
* the option.
The options that specify, either explicitly or implicitly, a value
range (in StandardSocketOptions) are SO_RCVBUF, SO_SNDBUF, IP_TOS,
and IP_MULTICAST_TTL.
Example of existing behaviour:
jshell> (new Socket()).setOption(StandardSocketOptions.SO_RCVBUF,-1);
| Exception java.net.SocketException: bad parameter for SO_SNDBUF or SO_RCVBUF
| at AbstractPlainSocketImpl.setOption (AbstractPlainSocketImpl.java:289)
| at SocketImpl.setOption (SocketImpl.java:384)
| at PlainSocketImpl.setOption (PlainSocketImpl.java:69)
| at Socket.setOption (Socket.java:1760)
| at (#1:1)
3) Throw an IOException after the socket has been closed.
Specification:
* @throws IOException if an I/O error occurs, or if the socket is closed.
Example of existing behaviour:
jshell> var s = new Socket()
s ==> Socket[unconnected]
jshell> s.close()
jshell> s.getOption(StandardSocketOptions.SO_RCVBUF)
$8 ==> 131072
- backported by
-
JDK-8225836 java.net socket types new-style socket option methods - spec and impl mismatch
-
- Resolved
-
- csr for
-
JDK-8224792 java.net socket types new-style socket option methods - spec and impl mismatch
-
- Closed
-
- relates to
-
JDK-8225651 Missed the `@` in a couple of code tags of SocketImpl
-
- Closed
-
-
JDK-8233860 java/net/SocketOption/AfterClose.java test incorrectly handles IP_MULTICAST_IF
-
- Resolved
-