You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2023/06/23 12:49:57 UTC
[commons-net] 03/03: TFTPServer setter methods now throws IllegalArgumentException instead of RuntimeException
This is an automated email from the ASF dual-hosted git repository.
ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-net.git
commit ba6a779dd4800676a63675248dcbecef87997857
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Fri Jun 23 08:49:50 2023 -0400
TFTPServer setter methods now throws IllegalArgumentException instead of
RuntimeException
- TFTPServer.setMaxTimeoutRetries() now throws IllegalArgumentException
instead of RuntimeException.
- TFTPServer.setSocketTimeout() now throws IllegalArgumentException
instead of RuntimeException.
- Javadoc
---
src/test/java/org/apache/commons/net/tftp/TFTPServer.java | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/test/java/org/apache/commons/net/tftp/TFTPServer.java b/src/test/java/org/apache/commons/net/tftp/TFTPServer.java
index 30ca4d82..a593713f 100644
--- a/src/test/java/org/apache/commons/net/tftp/TFTPServer.java
+++ b/src/test/java/org/apache/commons/net/tftp/TFTPServer.java
@@ -723,10 +723,11 @@ public class TFTPServer implements Runnable {
* Set the max number of retries in response to a timeout. Default 3. Min 0.
*
* @param retries number of retries, must be > 0
+ * @throws IllegalArgumentException if {@code retries} is less than 0.
*/
public void setMaxTimeoutRetries(final int retries) {
if (retries < 0) {
- throw new RuntimeException("Invalid Value");
+ throw new IllegalArgumentException("Invalid Value");
}
maxTimeoutRetries = retries;
}
@@ -737,10 +738,11 @@ public class TFTPServer implements Runnable {
* Defaults to the value {@link TFTP#DEFAULT_TIMEOUT}. Minimum value of 10.
* </p>
* @param timeout the timeout; must be equal to or larger than 10.
+ * @throws IllegalArgumentException if {@code timeout} is less than 10.
*/
public void setSocketTimeout(final int timeout) {
if (timeout < 10) {
- throw new RuntimeException("Invalid Value");
+ throw new IllegalArgumentException("Invalid Value");
}
socketTimeout = timeout;
}