[Falcon] Fix SONAR flagged blocker issues
- add comments to suppress two instances where we really do want to catch Throwable
- implement equals() methods where only hashValue() was implemented
Change-Id: Iecfd66ff50fbd433977d1affd74f5f05d0a047e5
diff --git a/utils/misc/src/main/java/org/onlab/packet/EAP.java b/utils/misc/src/main/java/org/onlab/packet/EAP.java
index 8450e59..bf53671 100644
--- a/utils/misc/src/main/java/org/onlab/packet/EAP.java
+++ b/utils/misc/src/main/java/org/onlab/packet/EAP.java
@@ -264,6 +264,31 @@
}
@Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (!(o instanceof EAP)) {
+ return false;
+ }
+ EAP that = (EAP) o;
+
+ if (this.code != that.code) {
+ return false;
+ }
+ if (this.identifier != that.identifier) {
+ return false;
+ }
+ if (this.length != that.length) {
+ return false;
+ }
+ if (this.type != that.type) {
+ return false;
+ }
+ return true;
+ }
+
+ @Override
public String toString() {
return toStringHelper(getClass())
.add("code", Byte.toString(code))
diff --git a/utils/misc/src/main/java/org/onlab/packet/EAPOL.java b/utils/misc/src/main/java/org/onlab/packet/EAPOL.java
index 3849caa..3a2aa52 100644
--- a/utils/misc/src/main/java/org/onlab/packet/EAPOL.java
+++ b/utils/misc/src/main/java/org/onlab/packet/EAPOL.java
@@ -148,6 +148,28 @@
return result;
}
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (!(o instanceof EAPOL)) {
+ return false;
+ }
+ EAPOL that = (EAPOL) o;
+
+ if (this.version != that.version) {
+ return false;
+ }
+ if (this.eapolType != that.eapolType) {
+ return false;
+ }
+ if (this.packetLength != that.packetLength) {
+ return false;
+ }
+ return true;
+ }
+
/**
* Deserializer for EAPOL packets.
*
diff --git a/utils/misc/src/main/java/org/onlab/util/RetryingFunction.java b/utils/misc/src/main/java/org/onlab/util/RetryingFunction.java
index 484e236..1e32053 100644
--- a/utils/misc/src/main/java/org/onlab/util/RetryingFunction.java
+++ b/utils/misc/src/main/java/org/onlab/util/RetryingFunction.java
@@ -42,6 +42,8 @@
this.maxDelayBetweenRetries = maxDelayBetweenRetries;
}
+ @SuppressWarnings("squid:S1181")
+ // Yes we really do want to catch Throwable
@Override
public V apply(U input) {
int retryAttempts = 0;
diff --git a/utils/netty/src/main/java/org/onlab/netty/NettyMessaging.java b/utils/netty/src/main/java/org/onlab/netty/NettyMessaging.java
index 2dda747..b9709cc 100644
--- a/utils/netty/src/main/java/org/onlab/netty/NettyMessaging.java
+++ b/utils/netty/src/main/java/org/onlab/netty/NettyMessaging.java
@@ -106,6 +106,8 @@
protected char[] ksPwd;
protected char[] tsPwd;
+ @SuppressWarnings("squid:S1181")
+ // We really need to catch Throwable due to netty native epoll() handling
private void initEventLoopGroup() {
// try Epoll first and if that does work, use nio.
try {