Skip to content

Commit 43d4aad

Browse files
committed
Catch specific exception only
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/net/branches/NET_2_0@762020 13f79535-47bb-0310-9956-ffa450edef68
1 parent c3135a7 commit 43d4aad

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/test/java/org/apache/commons/net/SubnetUtilsTest.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public void testAddresses() {
5151
SubnetUtils utils = new SubnetUtils("192.168.0.1/29");
5252
SubnetInfo info = utils.getInfo();
5353
assertTrue(info.isInRange("192.168.0.1"));
54-
// We dont count the broadcast address as usable
54+
// We don't count the broadcast address as usable
5555
assertFalse(info.isInRange("192.168.0.7"));
5656
assertFalse(info.isInRange("192.168.0.8"));
5757
assertFalse(info.isInRange("10.10.2.1"));
@@ -61,11 +61,11 @@ public void testAddresses() {
6161

6262
public void testZeroNetmaskBits() {
6363
try {
64-
SubnetUtils utils = new SubnetUtils("192.168.0.1/0");
65-
assertTrue("/0 should be an invalid mask", false);
64+
@SuppressWarnings("unused")
65+
SubnetUtils utils = new SubnetUtils("192.168.0.1/0");
66+
fail("Mask /0 should have generated an IllegalArgumentException");
6667
}
67-
catch (Exception e) {
68-
;
68+
catch (IllegalArgumentException expected) {
6969
}
7070
}
7171
}

0 commit comments

Comments
 (0)