Merge pull request #503 from y-higuchi/thread_name
Give each Thread a name
diff --git a/src/main/java/net/onrc/onos/ofcontroller/bgproute/PatriciaTrie.java b/src/main/java/net/onrc/onos/ofcontroller/bgproute/PatriciaTrie.java
index 89dfb30..67458e3 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/bgproute/PatriciaTrie.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/bgproute/PatriciaTrie.java
@@ -17,16 +17,16 @@
@Override
public synchronized V put(Prefix prefix, V value) {
+ if (prefix == null || value == null) {
+ throw new NullPointerException();
+ }
+
if (prefix.getPrefixLength() > maxPrefixLength) {
throw new IllegalArgumentException(String.format(
"Prefix length %d is greater than max prefix length %d",
prefix.getPrefixLength(), maxPrefixLength));
}
- if (prefix == null || value == null) {
- throw new NullPointerException();
- }
-
Node node = top;
Node match = null;
diff --git a/src/main/java/net/onrc/onos/ofcontroller/util/FlowEntryId.java b/src/main/java/net/onrc/onos/ofcontroller/util/FlowEntryId.java
index f5728b0..0ecaebe 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/util/FlowEntryId.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/util/FlowEntryId.java
@@ -86,7 +86,7 @@
*/
@Override
public boolean equals(Object obj){
- if(obj.getClass() == this.getClass()) {
+ if(obj != null && obj.getClass() == this.getClass()) {
FlowEntryId entry = (FlowEntryId) obj;
return this.value() == entry.value();
}
diff --git a/src/main/java/net/onrc/onos/registry/controller/ZookeeperRegistry.java b/src/main/java/net/onrc/onos/registry/controller/ZookeeperRegistry.java
index b03aea2..3e4d5bf 100644
--- a/src/main/java/net/onrc/onos/registry/controller/ZookeeperRegistry.java
+++ b/src/main/java/net/onrc/onos/registry/controller/ZookeeperRegistry.java
@@ -99,7 +99,12 @@
//may have since released the request or even begun another request
//(this is why we use == to check the object instance is the same)
SwitchLeadershipData swData = switches.get(dpid);
- if (swData != null && swData.getLatch() == latch){
+ if (swData == null) {
+ log.debug("Leadership data {} not found", dpid);
+ return;
+ }
+
+ if (swData.getLatch() == latch){
swData.getCallback().controlChanged(
HexString.toLong(dpid), latch.hasLeadership());
}
diff --git a/src/main/java/org/openflow/protocol/vendor/OFBasicVendorId.java b/src/main/java/org/openflow/protocol/vendor/OFBasicVendorId.java
index 09365d7..33bb0bd 100644
--- a/src/main/java/org/openflow/protocol/vendor/OFBasicVendorId.java
+++ b/src/main/java/org/openflow/protocol/vendor/OFBasicVendorId.java
@@ -87,7 +87,7 @@
* @return
*/
public OFVendorDataType lookupVendorDataType(int vendorDataType) {
- return dataTypeMap.get(vendorDataType);
+ return dataTypeMap.get((long)vendorDataType);
}
/**
diff --git a/src/main/java/org/openflow/util/HexString.java b/src/main/java/org/openflow/util/HexString.java
index 07cc1f7..9a656dd 100644
--- a/src/main/java/org/openflow/util/HexString.java
+++ b/src/main/java/org/openflow/util/HexString.java
@@ -47,12 +47,12 @@
int i = 0;
for (; i < (padTo * 2 - arr.length); i++) {
ret.append('0');
- if ((i % 2) == 1)
+ if ((i & 1) == 1)
ret.append(':');
}
for (int j = 0; j < arr.length; j++) {
ret.append(arr[j]);
- if ((((i + j) % 2) == 1) && (j < (arr.length - 1)))
+ if ((((i + j) & 1) == 1) && (j < (arr.length - 1)))
ret.append(':');
}
return ret.toString();