Streaming: Enforce valid port in setters

This commit is contained in:
zzz
2018-06-26 18:48:04 +00:00
parent 96c565d486
commit 2d24f21327

View File

@@ -230,9 +230,12 @@ class I2PSocketOptionsImpl implements I2PSocketOptions {
/**
* The remote port.
* @param port 0 - 65535
* @throws IllegalArgumentException
* @since 0.8.9
*/
public void setPort(int port) {
if (port < 0 || port > 65535)
throw new IllegalArgumentException("bad port");
_remotePort = port;
}
@@ -251,9 +254,12 @@ class I2PSocketOptionsImpl implements I2PSocketOptions {
* Nonzero means you will get traffic ONLY for that port, use with care,
* as most applications do not specify a remote port.
* @param port 0 - 65535
* @throws IllegalArgumentException
* @since 0.8.9
*/
public void setLocalPort(int port) {
if (port < 0 || port > 65535)
throw new IllegalArgumentException("bad port");
_localPort = port;
}
}