< prev index next >
src/java.base/share/classes/sun/nio/ch/ServerSocketChannelImpl.java
Print this page
@@ -145,15 +145,18 @@
throws IOException
{
Objects.requireNonNull(name);
if (!supportedOptions().contains(name))
throw new UnsupportedOperationException("'" + name + "' not supported");
+
synchronized (stateLock) {
ensureOpen();
if (name == StandardSocketOptions.SO_REUSEADDR && Net.useExclusiveBind()) {
// SO_REUSEADDR emulated when using exclusive bind
+ if (!(value instanceof Boolean))
+ throw new IllegalArgumentException("Invalid value '" + value + "'");
isReuseAddress = (Boolean)value;
} else {
// no options that require special handling
Net.setSocketOption(fd, Net.UNSPEC, name, value);
}
< prev index next >