8213210: Change ServerSocket(SocketImpl impl) constructor to protected access
Brian Burkhalter
brian.burkhalter at oracle.com
Wed Oct 31 19:26:41 UTC 2018
> On Oct 31, 2018, at 12:20 PM, Brian Burkhalter <brian.burkhalter at oracle.com> wrote:
>
> - ServerSocket(SocketImpl impl) {
> + protected ServerSocket(SocketImpl impl) {
> this.impl = impl;
> impl.setServerSocket(this); // <- NPE if impl == null
> }
Oops, it can throw null as indicated above. Revised patch below.
Brian
--- a/src/java.base/share/classes/java/net/ServerSocket.java
+++ b/src/java.base/share/classes/java/net/ServerSocket.java
@@ -76,10 +76,16 @@
private boolean oldImpl = false;
/**
- * Package-private constructor to create a ServerSocket associated with
- * the given SocketImpl.
+ * Creates a server socket with a user-specified {@code SocketImpl}.
+ *
+ * @param impl an instance of a SocketImpl the subclass
+ * wishes to use on the ServerSocket.
+ *
+ * @throws NullPointerException if impl is {@code null}
+ *
+ * @since 12
*/
- ServerSocket(SocketImpl impl) {
+ protected ServerSocket(SocketImpl impl) {
this.impl = impl;
impl.setServerSocket(this);
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/net-dev/attachments/20181031/5eb725f3/attachment-0001.html>
More information about the net-dev
mailing list