Fix careless shallow equal check
@@ -249,7 +249,7 @@ public class DHCPInstance {
}
public DHCPInstanceBuilder setServerID(@Nonnull IPv4Address serverID) {
- if(serverID == IPv4Address.NONE){
+ if(serverID.equals(IPv4Address.NONE)){
throw new IllegalArgumentException("Build DHCP instance failed : DHCP server IP address can not be empty");
}
this.serverID = serverID;
@@ -257,7 +257,7 @@ public class DHCPInstance {
}
public DHCPInstanceBuilder setServerMac(@Nonnull MacAddress serverMac) {
- if(serverMac == MacAddress.NONE){
+ if(serverMac.equals(MacAddress.NONE)){
throw new IllegalArgumentException("Build DHCP instance failed : DHCP server Mac address can not be empty");
}
this.serverMac = serverMac;
@@ -265,7 +265,7 @@ public class DHCPInstance {
}
public DHCPInstanceBuilder setBroadcastIP(@Nonnull IPv4Address broadcastIP) {
- if(broadcastIP == IPv4Address.NONE){
+ if(broadcastIP.equals(IPv4Address.NONE)){
throw new IllegalArgumentException("Build DHCP instance failed : Broadcast IP address can not be empty");
}
this.broadcastIP = broadcastIP;
@@ -283,7 +283,7 @@ public class DHCPInstance {
}
public DHCPInstanceBuilder setStartIP(@Nonnull IPv4Address start) {
- if(start == IPv4Address.NONE){
+ if(start.equals(IPv4Address.NONE)){
throw new IllegalArgumentException("Build DHCP instance failed : DHCP Pool Starter IP address can not be empty");
}
this.startIPAddress = start;
@@ -291,7 +291,7 @@ public class DHCPInstance {
}
public DHCPInstanceBuilder setEndIP(@Nonnull IPv4Address end) {
- if(end == IPv4Address.NONE){
+ if(end.equals(IPv4Address.NONE)){
throw new IllegalArgumentException("Build DHCP instance failed : DHCP Pool Stopper IP address can not be empty");
}
this.endIPAddress = end;
@@ -330,7 +330,7 @@ public class DHCPInstance {
}
public DHCPInstanceBuilder setStaticAddresses(@Nonnull MacAddress mac, @Nonnull IPv4Address ip) {
- if(mac == MacAddress.NONE || ip == IPv4Address.NONE){
+ if(mac.equals(MacAddress.NONE) || ip.equals(IPv4Address.NONE)){
throw new IllegalArgumentException("BUild DHCP instance faild : DHCP static address can not be empty");
}
// map structure naturally exclude same mac has multiple IP address entry
