Skip to content

Commit ea0efb1

Browse files
committed
added a check of ip type
1 parent b4d35ce commit ea0efb1

File tree

1 file changed

+6
-3
lines changed
  • vertx-pg-client/src/main/java/io/vertx/pgclient/data

1 file changed

+6
-3
lines changed

vertx-pg-client/src/main/java/io/vertx/pgclient/data/Cidr.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,15 @@ public class Cidr {
1111
private InetAddress address;
1212
private Integer netmask;
1313

14-
1514
public InetAddress getAddress(){
1615
return address;
1716
}
18-
public Cidr setAddress(InetAddress address){
19-
this.address=address;
17+
public Cidr setAddress(InetAddress address) {
18+
if (address instanceof Inet4Address || address instanceof Inet6Address) {
19+
this.address = address;
20+
} else {
21+
throw new IllegalArgumentException("Invalid IP address type");
22+
}
2023
return this;
2124
}
2225

0 commit comments

Comments
 (0)