X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fsal%2Fapi%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fsal%2Fflowprogrammer%2FFlow.java;h=f56c13d34524efe0685047c005baeb71ed26130f;hb=refs%2Fchanges%2F49%2F449%2F1;hp=f39de8f023b792beb6c38e6845d53330d526fe8a;hpb=cffdfafd2b23b24025f5ba4b32f16bca501bfeb5;p=controller.git diff --git a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/flowprogrammer/Flow.java b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/flowprogrammer/Flow.java index f39de8f023..f56c13d345 100644 --- a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/flowprogrammer/Flow.java +++ b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/flowprogrammer/Flow.java @@ -20,8 +20,6 @@ import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; -import org.apache.commons.lang3.builder.EqualsBuilder; -import org.apache.commons.lang3.builder.HashCodeBuilder; import org.opendaylight.controller.sal.action.Action; import org.opendaylight.controller.sal.action.ActionType; import org.opendaylight.controller.sal.action.SetDlType; @@ -29,6 +27,8 @@ import org.opendaylight.controller.sal.action.SetNwDst; import org.opendaylight.controller.sal.action.SetNwSrc; import org.opendaylight.controller.sal.match.Match; import org.opendaylight.controller.sal.utils.EtherTypes; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * Represent a flow: match + actions + flow specific properties @@ -37,6 +37,8 @@ import org.opendaylight.controller.sal.utils.EtherTypes; @XmlRootElement @XmlAccessorType(XmlAccessType.NONE) public class Flow implements Cloneable, Serializable { + protected static final Logger logger = LoggerFactory + .getLogger(Flow.class); private static final long serialVersionUID = 1L; @XmlElement private Match match; @@ -61,7 +63,7 @@ public class Flow implements Cloneable, Serializable { try { throw new Exception("Conflicting Match and Action list"); } catch (Exception e) { - e.printStackTrace(); + logger.error("",e); } } else { this.match = match; @@ -170,19 +172,52 @@ public class Flow implements Cloneable, Serializable { cloned.match = this.getMatch(); cloned.actions = this.getActions(); } catch (CloneNotSupportedException e) { - e.printStackTrace(); + logger.error("",e); } return cloned; } @Override public int hashCode() { - return HashCodeBuilder.reflectionHashCode(this); + final int prime = 31; + int result = 1; + result = prime * result + ((actions == null) ? 0 : actions.hashCode()); + result = prime * result + hardTimeout; + result = prime * result + (int) (id ^ (id >>> 32)); + result = prime * result + idleTimeout; + result = prime * result + ((match == null) ? 0 : match.hashCode()); + result = prime * result + priority; + return result; } @Override public boolean equals(Object obj) { - return EqualsBuilder.reflectionEquals(this, obj); + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + Flow other = (Flow) obj; + if (actions == null) { + if (other.actions != null) + return false; + } else if (!actions.equals(other.actions)) + return false; + if (hardTimeout != other.hardTimeout) + return false; + if (id != other.id) + return false; + if (idleTimeout != other.idleTimeout) + return false; + if (match == null) { + if (other.match != null) + return false; + } else if (!match.equals(other.match)) + return false; + if (priority != other.priority) + return false; + return true; } @Override