Mike Kolesnik has posted comments on this change.

Change subject: findbugs: When implementing compareTo implement Object.equals 
as well
......................................................................


Patch Set 2: (3 inline comments)

Please see my comments on NetworkStatistics class and implement them on the 
other classes as well

....................................................
File 
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/network/NetworkStatistics.java
Line 11:     private static final long serialVersionUID = -748737255583275169L;
Line 12: 
Line 13:     private Guid id;
Line 14: 
Line 15:     @Override
Please put the methods after the fields.
Line 16:     public int hashCode() {
Line 17:         final int prime = 31;
Line 18:         int result = 1;
Line 19:         result = prime * result + ((id == null) ? 0 : id.hashCode());


Line 15:     @Override
Line 16:     public int hashCode() {
Line 17:         final int prime = 31;
Line 18:         int result = 1;
Line 19:         result = prime * result + ((id == null) ? 0 : id.hashCode());
Please use getters in hashCode & equals methods instead of direct field calls, 
otherwise you're assuming the fields access is always done directly.
Line 20:         result = prime * result + ((receiveDropRate == null) ? 0 : 
receiveDropRate.hashCode());
Line 21:         result = prime * result + ((receiveRate == null) ? 0 : 
receiveRate.hashCode());
Line 22:         result = prime * result + ((status == null) ? 0 : 
status.hashCode());
Line 23:         result = prime * result + ((transmitDropRate == null) ? 0 : 
transmitDropRate.hashCode());


Line 30:         if (this == obj)
Line 31:             return true;
Line 32:         if (obj == null)
Line 33:             return false;
Line 34:         if (getClass() != obj.getClass())
Please use instanceof check otherwise you're breaking the Liskov substitution 
principal.
Line 35:             return false;
Line 36:         NetworkStatistics other = (NetworkStatistics) obj;
Line 37:         if (id == null) {
Line 38:             if (other.id != null)


--
To view, visit http://gerrit.ovirt.org/14039
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I69d3ee3cded96c33c4e833fdca09461b7825cf07
Gerrit-PatchSet: 2
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Shahar Havivi <[email protected]>
Gerrit-Reviewer: Allon Mureinik <[email protected]>
Gerrit-Reviewer: Doron Fediuck <[email protected]>
Gerrit-Reviewer: Mike Kolesnik <[email protected]>
Gerrit-Reviewer: Moti Asayag <[email protected]>
Gerrit-Reviewer: Oved Ourfali <[email protected]>
Gerrit-Reviewer: Shahar Havivi <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to