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 13:07:55 UTC

[commons-net] 05/06: SubnetUtils.SubnetInfo.getPreviousAddress() now throws IllegalStateException 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 5277c76d43e7e74aeb1cbaed31da420e884db230
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Fri Jun 23 09:07:14 2023 -0400

    SubnetUtils.SubnetInfo.getPreviousAddress() now throws
    IllegalStateException
    instead of RuntimeException.
---
 src/changes/changes.xml                                    | 3 +++
 src/main/java/org/apache/commons/net/util/SubnetUtils.java | 2 +-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 359a0595..b2e0f635 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -100,6 +100,9 @@ The <action> type attribute can be add,update,fix,remove.
       <action type="fix" dev="ggregory" due-to="Gary Gregory">
         SMTPCommand static initializer now throws IllegalStateException instead of RuntimeException.
       </action>
+      <action type="fix" dev="ggregory" due-to="Gary Gregory">
+        SubnetUtils.SubnetInfo.getPreviousAddress() now throws IllegalStateException instead of RuntimeException.
+      </action>
       <!-- UPDATE -->
       <action type="update" dev="ggregory" due-to="Dependabot">
         Bump commons-parent from 54 to 58 #132, #137, #153.
diff --git a/src/main/java/org/apache/commons/net/util/SubnetUtils.java b/src/main/java/org/apache/commons/net/util/SubnetUtils.java
index 5655c957..c722d6a8 100644
--- a/src/main/java/org/apache/commons/net/util/SubnetUtils.java
+++ b/src/main/java/org/apache/commons/net/util/SubnetUtils.java
@@ -76,7 +76,7 @@ public class SubnetUtils {
         public int getAddressCount() {
             final long countLong = getAddressCountLong();
             if (countLong > Integer.MAX_VALUE) {
-                throw new RuntimeException("Count is larger than an integer: " + countLong);
+                throw new IllegalStateException("Count is larger than an integer: " + countLong);
             }
             // Cannot be negative here
             return (int) countLong;