--- a/jdk/src/java.base/unix/classes/java/net/PlainDatagramSocketImpl.java Tue Feb 23 09:49:04 2016 +0100
+++ b/jdk/src/java.base/unix/classes/java/net/PlainDatagramSocketImpl.java Tue Feb 23 17:41:00 2016 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -45,7 +45,15 @@
protected <T> void setOption(SocketOption<T> name, T value) throws IOException {
if (!name.equals(ExtendedSocketOptions.SO_FLOW_SLA)) {
- super.setOption(name, value);
+ if (!name.equals(StandardSocketOptions.SO_REUSEPORT)) {
+ super.setOption(name, value);
+ } else {
+ if (supportedOptions().contains(name)) {
+ super.setOption(name, value);
+ } else {
+ throw new UnsupportedOperationException("unsupported option");
+ }
+ }
} else {
if (!flowSupported()) {
throw new UnsupportedOperationException("unsupported option");
@@ -62,7 +70,15 @@
@SuppressWarnings("unchecked")
protected <T> T getOption(SocketOption<T> name) throws IOException {
if (!name.equals(ExtendedSocketOptions.SO_FLOW_SLA)) {
- return super.getOption(name);
+ if (!name.equals(StandardSocketOptions.SO_REUSEPORT)) {
+ return super.getOption(name);
+ } else {
+ if (supportedOptions().contains(name)) {
+ return super.getOption(name);
+ } else {
+ throw new UnsupportedOperationException("unsupported option");
+ }
+ }
}
if (!flowSupported()) {
throw new UnsupportedOperationException("unsupported option");
@@ -87,6 +103,9 @@
}
protected void socketSetOption(int opt, Object val) throws SocketException {
+ if (opt == SocketOptions.SO_REUSEPORT && !supportedOptions().contains(StandardSocketOptions.SO_REUSEPORT)) {
+ throw new UnsupportedOperationException("unsupported option");
+ }
try {
socketSetOption0(opt, val);
} catch (SocketException se) {