mirror of https://github.com/apache/cloudstack.git
bug 10650: making sure that only unique Nics are added to the set
This commit is contained in:
parent
aa757f0303
commit
2fe48b5359
|
|
@ -144,7 +144,28 @@ public class NicResponse extends BaseResponse {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object r){
|
||||
return (r instanceof NicResponse) && id==((NicResponse)r).id;
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + ((id == null) ? 0 : id.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
NicResponse other = (NicResponse) obj;
|
||||
if (id == null) {
|
||||
if (other.id != null)
|
||||
return false;
|
||||
} else if (!id.equals(other.id))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -133,7 +133,27 @@ public class SecurityGroupResponse extends BaseResponse {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object r){
|
||||
return (r instanceof SecurityGroupResponse) && id==((SecurityGroupResponse)r).id;
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + ((id == null) ? 0 : id.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
SecurityGroupResponse other = (SecurityGroupResponse) obj;
|
||||
if (id == null) {
|
||||
if (other.id != null)
|
||||
return false;
|
||||
} else if (!id.equals(other.id))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue