Enable checkstyle check for blocks without braces.
Enable the checkstyle rule to check for block statements
without curly braces and fix any violations it finds.
Change-Id: Id4c58cea26f0d9ce7ed78643a4943c042886a12d
diff --git a/src/main/java/net/onrc/onos/core/util/DataPath.java b/src/main/java/net/onrc/onos/core/util/DataPath.java
index 0c8b7c7..0a124e5 100644
--- a/src/main/java/net/onrc/onos/core/util/DataPath.java
+++ b/src/main/java/net/onrc/onos/core/util/DataPath.java
@@ -87,13 +87,15 @@
* @param flowPathFlags the Flow Path Flags to apply.
*/
public void applyFlowPathFlags(FlowPathFlags flowPathFlags) {
- if (flowPathFlags == null)
+ if (flowPathFlags == null) {
return; // Nothing to do
+ }
// Discard the first Flow Entry
if (flowPathFlags.isDiscardFirstHopEntry()) {
- if (flowEntries.size() > 0)
+ if (flowEntries.size() > 0) {
flowEntries.remove(0);
+ }
}
// Keep only the first Flow Entry
@@ -127,8 +129,9 @@
break;
}
}
- if (!foundDeletedFlowEntry)
+ if (!foundDeletedFlowEntry) {
return; // Nothing to do
+ }
// Create a new collection and exclude the deleted flow entries
ArrayList<FlowEntry> newFlowEntries = new ArrayList<FlowEntry>();
diff --git a/src/main/java/net/onrc/onos/core/util/FlowEntry.java b/src/main/java/net/onrc/onos/core/util/FlowEntry.java
index 0204590..768f942 100644
--- a/src/main/java/net/onrc/onos/core/util/FlowEntry.java
+++ b/src/main/java/net/onrc/onos/core/util/FlowEntry.java
@@ -144,8 +144,9 @@
*/
@JsonIgnore
public boolean isValidFlowId() {
- if (this.flowId == null)
+ if (this.flowId == null) {
return false;
+ }
return (this.flowId.isValid());
}
@@ -176,8 +177,9 @@
*/
@JsonIgnore
public boolean isValidFlowEntryId() {
- if (this.flowEntryId == null)
+ if (this.flowEntryId == null) {
return false;
+ }
return (this.flowEntryId.isValid());
}
diff --git a/src/main/java/net/onrc/onos/core/util/FlowEntryAction.java b/src/main/java/net/onrc/onos/core/util/FlowEntryAction.java
index f619fea..cefc316 100644
--- a/src/main/java/net/onrc/onos/core/util/FlowEntryAction.java
+++ b/src/main/java/net/onrc/onos/core/util/FlowEntryAction.java
@@ -76,8 +76,9 @@
* @param other the object to copy from.
*/
public ActionOutput(ActionOutput other) {
- if (other.port != null)
+ if (other.port != null) {
this.port = new Port(other.port);
+ }
this.maxLen = other.maxLen;
}
@@ -168,8 +169,9 @@
String decode = null;
// Decode the "port=XXX" part
- if (parts.length > 0)
+ if (parts.length > 0) {
decode = parts[0];
+ }
if (decode != null) {
String[] tokens = decode.split("port=");
if (tokens.length > 1 && tokens[1] != null) {
@@ -186,8 +188,9 @@
// Decode the "maxLen=XXX" part
decode = null;
- if (parts.length > 1)
+ if (parts.length > 1) {
decode = parts[1];
+ }
if (decode != null) {
decode = decode.replace("]", "");
String[] tokens = decode.split("maxLen=");
@@ -287,8 +290,9 @@
String decode = null;
// Decode the value
- if (parts.length > 1)
+ if (parts.length > 1) {
decode = parts[1];
+ }
if (decode != null) {
decode = decode.replace("]", "");
try {
@@ -385,8 +389,9 @@
String decode = null;
// Decode the value
- if (parts.length > 1)
+ if (parts.length > 1) {
decode = parts[1];
+ }
if (decode != null) {
decode = decode.replace("]", "");
try {
@@ -483,8 +488,9 @@
String decode = null;
// Decode the value
- if (parts.length > 1)
+ if (parts.length > 1) {
decode = parts[1];
+ }
if (decode != null) {
decode = decode.replace("]", "");
stripVlan = Boolean.valueOf(decode);
@@ -514,8 +520,9 @@
* @param other the object to copy from.
*/
public ActionSetEthernetAddr(ActionSetEthernetAddr other) {
- if (other.addr != null)
+ if (other.addr != null) {
this.addr = MACAddress.valueOf(other.addr.toLong());
+ }
}
/**
@@ -579,8 +586,9 @@
String decode = null;
// Decode the value
- if (parts.length > 1)
+ if (parts.length > 1) {
decode = parts[1];
+ }
if (decode != null) {
decode = decode.replace("]", "");
try {
@@ -614,8 +622,9 @@
* @param other the object to copy from.
*/
public ActionSetIPv4Addr(ActionSetIPv4Addr other) {
- if (other.addr != null)
+ if (other.addr != null) {
this.addr = new IPv4(other.addr);
+ }
}
/**
@@ -679,8 +688,9 @@
String decode = null;
// Decode the value
- if (parts.length > 1)
+ if (parts.length > 1) {
decode = parts[1];
+ }
if (decode != null) {
decode = decode.replace("]", "");
try {
@@ -778,8 +788,9 @@
String decode = null;
// Decode the value
- if (parts.length > 1)
+ if (parts.length > 1) {
decode = parts[1];
+ }
if (decode != null) {
decode = decode.replace("]", "");
try {
@@ -877,8 +888,9 @@
String decode = null;
// Decode the value
- if (parts.length > 1)
+ if (parts.length > 1) {
decode = parts[1];
+ }
if (decode != null) {
decode = decode.replace("]", "");
try {
@@ -915,8 +927,9 @@
* @param other the object to copy from.
*/
public ActionEnqueue(ActionEnqueue other) {
- if (other.port != null)
+ if (other.port != null) {
this.port = new Port(other.port);
+ }
this.queueId = other.queueId;
}
@@ -994,8 +1007,9 @@
String decode = null;
// Decode the "port=XXX" part
- if (parts.length > 0)
+ if (parts.length > 0) {
decode = parts[0];
+ }
if (decode != null) {
String[] tokens = decode.split("port=");
if (tokens.length > 1 && tokens[1] != null) {
@@ -1012,8 +1026,9 @@
// Decode the "queueId=XXX" part
decode = null;
- if (parts.length > 1)
+ if (parts.length > 1) {
decode = parts[1];
+ }
if (decode != null) {
decode = decode.replace("]", "");
String[] tokens = decode.split("queueId=");
@@ -1065,65 +1080,77 @@
this.actionType = other.actionType;
//
- if (other.actionOutput != null)
+ if (other.actionOutput != null) {
this.actionOutput = new ActionOutput(other.actionOutput);
- else
+ } else {
this.actionOutput = null;
+ }
//
- if (other.actionSetVlanId != null)
+ if (other.actionSetVlanId != null) {
this.actionSetVlanId = new ActionSetVlanId(other.actionSetVlanId);
- else
+ } else {
this.actionSetVlanId = null;
+ }
//
- if (other.actionSetVlanPriority != null)
+ if (other.actionSetVlanPriority != null) {
this.actionSetVlanPriority = new ActionSetVlanPriority(other.actionSetVlanPriority);
- else
+ } else {
this.actionSetVlanPriority = null;
+ }
//
- if (other.actionStripVlan != null)
+ if (other.actionStripVlan != null) {
this.actionStripVlan = new ActionStripVlan(other.actionStripVlan);
- else
+ } else {
this.actionStripVlan = null;
+ }
//
- if (other.actionSetEthernetSrcAddr != null)
+ if (other.actionSetEthernetSrcAddr != null) {
this.actionSetEthernetSrcAddr = new ActionSetEthernetAddr(other.actionSetEthernetSrcAddr);
- else
+ } else {
this.actionSetEthernetSrcAddr = null;
+ }
//
- if (other.actionSetEthernetDstAddr != null)
+ if (other.actionSetEthernetDstAddr != null) {
this.actionSetEthernetDstAddr = new ActionSetEthernetAddr(other.actionSetEthernetDstAddr);
- else
+ } else {
this.actionSetEthernetDstAddr = null;
+ }
//
- if (other.actionSetIPv4SrcAddr != null)
+ if (other.actionSetIPv4SrcAddr != null) {
this.actionSetIPv4SrcAddr = new ActionSetIPv4Addr(other.actionSetIPv4SrcAddr);
- else
+ } else {
this.actionSetIPv4SrcAddr = null;
+ }
//
- if (other.actionSetIPv4DstAddr != null)
+ if (other.actionSetIPv4DstAddr != null) {
this.actionSetIPv4DstAddr = new ActionSetIPv4Addr(other.actionSetIPv4DstAddr);
- else
+ } else {
this.actionSetIPv4DstAddr = null;
+ }
//
- if (other.actionSetIpToS != null)
+ if (other.actionSetIpToS != null) {
this.actionSetIpToS = new ActionSetIpToS(other.actionSetIpToS);
- else
+ } else {
this.actionSetIpToS = null;
+ }
//
- if (other.actionSetTcpUdpSrcPort != null)
+ if (other.actionSetTcpUdpSrcPort != null) {
this.actionSetTcpUdpSrcPort = new ActionSetTcpUdpPort(other.actionSetTcpUdpSrcPort);
- else
+ } else {
this.actionSetTcpUdpSrcPort = null;
+ }
//
- if (other.actionSetTcpUdpDstPort != null)
+ if (other.actionSetTcpUdpDstPort != null) {
this.actionSetTcpUdpDstPort = new ActionSetTcpUdpPort(other.actionSetTcpUdpDstPort);
- else
+ } else {
this.actionSetTcpUdpDstPort = null;
+ }
//
- if (other.actionEnqueue != null)
+ if (other.actionEnqueue != null) {
this.actionEnqueue = new ActionEnqueue(other.actionEnqueue);
- else
+ } else {
this.actionEnqueue = null;
+ }
}
/**
@@ -1603,10 +1630,12 @@
String decode = null;
// Extract the string after the "type="
- if (parts.length > 1)
+ if (parts.length > 1) {
decode = parts[1];
- if (decode == null)
+ }
+ if (decode == null) {
throw new IllegalArgumentException("Invalid action string");
+ }
// Remove the trailing ']'
if ((decode.length() > 0) && (decode.charAt(decode.length() - 1) == ']')) {
@@ -1619,8 +1648,9 @@
parts = decode.split(" action=");
// Decode the "type=XXX" payload
- if (parts.length > 0)
+ if (parts.length > 0) {
decode = parts[0];
+ }
if (decode != null) {
try {
actionType = Enum.valueOf(ActionValues.class, decode);
@@ -1633,10 +1663,12 @@
// Decode the "action=XXX" payload
decode = null;
- if (parts.length > 1)
+ if (parts.length > 1) {
decode = parts[1];
- if (decode == null)
+ }
+ if (decode == null) {
throw new IllegalArgumentException("Invalid action string");
+ }
//
try {
switch (actionType) {
diff --git a/src/main/java/net/onrc/onos/core/util/FlowEntryActions.java b/src/main/java/net/onrc/onos/core/util/FlowEntryActions.java
index 421312e..62d9a65 100644
--- a/src/main/java/net/onrc/onos/core/util/FlowEntryActions.java
+++ b/src/main/java/net/onrc/onos/core/util/FlowEntryActions.java
@@ -119,8 +119,9 @@
actions = new ArrayList<FlowEntryAction>();
- if (decode.isEmpty())
+ if (decode.isEmpty()) {
return; // Nothing to do
+ }
// Remove the '[' and ']' in the beginning and the end of the string
if ((decode.length() > 1) && (decode.charAt(0) == '[') &&
@@ -134,8 +135,9 @@
String[] parts = decode.split(";");
for (int i = 0; i < parts.length; i++) {
decode = parts[i];
- if ((decode == null) || decode.isEmpty())
+ if ((decode == null) || decode.isEmpty()) {
continue;
+ }
FlowEntryAction flowEntryAction = null;
try {
flowEntryAction = new FlowEntryAction(decode);
@@ -143,8 +145,9 @@
// TODO: Ignore invalid actions for now
continue;
}
- if (flowEntryAction != null)
+ if (flowEntryAction != null) {
actions.add(flowEntryAction);
+ }
}
}
}
diff --git a/src/main/java/net/onrc/onos/core/util/FlowEntryId.java b/src/main/java/net/onrc/onos/core/util/FlowEntryId.java
index 5b19e91..a46549f 100644
--- a/src/main/java/net/onrc/onos/core/util/FlowEntryId.java
+++ b/src/main/java/net/onrc/onos/core/util/FlowEntryId.java
@@ -46,12 +46,14 @@
// large unsigned hex long values.
//
char c = 0;
- if (value.length() > 2)
+ if (value.length() > 2) {
c = value.charAt(1);
- if ((c == 'x') || (c == 'X'))
+ }
+ if ((c == 'x') || (c == 'X')) {
this.value = new BigInteger(value.substring(2), 16).longValue();
- else
+ } else {
this.value = Long.decode(value);
+ }
}
/**
diff --git a/src/main/java/net/onrc/onos/core/util/FlowEntryMatch.java b/src/main/java/net/onrc/onos/core/util/FlowEntryMatch.java
index ce6a202..f0b1152 100644
--- a/src/main/java/net/onrc/onos/core/util/FlowEntryMatch.java
+++ b/src/main/java/net/onrc/onos/core/util/FlowEntryMatch.java
@@ -98,30 +98,42 @@
* @param other the object to copy from.
*/
public FlowEntryMatch(FlowEntryMatch other) {
- if ((other.inPort != null) && other.inPort.enabled())
+ if ((other.inPort != null) && other.inPort.enabled()) {
this.enableInPort(other.inPort.value());
- if ((other.srcMac != null) && other.srcMac.enabled())
+ }
+ if ((other.srcMac != null) && other.srcMac.enabled()) {
this.enableSrcMac(other.srcMac.value());
- if ((other.dstMac != null) && other.dstMac.enabled())
+ }
+ if ((other.dstMac != null) && other.dstMac.enabled()) {
this.enableDstMac(other.dstMac.value());
- if ((other.ethernetFrameType != null) && other.ethernetFrameType.enabled())
+ }
+ if ((other.ethernetFrameType != null) && other.ethernetFrameType.enabled()) {
this.enableEthernetFrameType(other.ethernetFrameType.value());
- if ((other.vlanId != null) && other.vlanId.enabled())
+ }
+ if ((other.vlanId != null) && other.vlanId.enabled()) {
this.enableVlanId(other.vlanId.value());
- if ((other.vlanPriority != null) && other.vlanPriority.enabled())
+ }
+ if ((other.vlanPriority != null) && other.vlanPriority.enabled()) {
this.enableVlanPriority(other.vlanPriority.value());
- if ((other.srcIPv4Net != null) && other.srcIPv4Net.enabled())
+ }
+ if ((other.srcIPv4Net != null) && other.srcIPv4Net.enabled()) {
this.enableSrcIPv4Net(other.srcIPv4Net.value());
- if ((other.dstIPv4Net != null) && other.dstIPv4Net.enabled())
+ }
+ if ((other.dstIPv4Net != null) && other.dstIPv4Net.enabled()) {
this.enableDstIPv4Net(other.dstIPv4Net.value());
- if ((other.ipProto != null) && other.ipProto.enabled())
+ }
+ if ((other.ipProto != null) && other.ipProto.enabled()) {
this.enableIpProto(other.ipProto.value());
- if ((other.ipToS != null) && other.ipToS.enabled())
+ }
+ if ((other.ipToS != null) && other.ipToS.enabled()) {
this.enableIpToS(other.ipToS.value());
- if ((other.srcTcpUdpPort != null) && other.srcTcpUdpPort.enabled())
+ }
+ if ((other.srcTcpUdpPort != null) && other.srcTcpUdpPort.enabled()) {
this.enableSrcTcpUdpPort(other.srcTcpUdpPort.value());
- if ((other.dstTcpUdpPort != null) && other.dstTcpUdpPort.enabled())
+ }
+ if ((other.dstTcpUdpPort != null) && other.dstTcpUdpPort.enabled()) {
this.enableDstTcpUdpPort(other.dstTcpUdpPort.value());
+ }
}
/**
@@ -131,8 +143,9 @@
*/
@JsonProperty("inPort")
public Port inPort() {
- if (inPort != null)
+ if (inPort != null) {
return inPort.value();
+ }
return null;
}
@@ -160,8 +173,9 @@
*/
@JsonProperty("matchInPort")
public boolean matchInPort() {
- if (inPort != null)
+ if (inPort != null) {
return inPort.enabled();
+ }
return false;
}
@@ -172,8 +186,9 @@
*/
@JsonProperty("srcMac")
public MACAddress srcMac() {
- if (srcMac != null)
+ if (srcMac != null) {
return srcMac.value();
+ }
return null;
}
@@ -201,8 +216,9 @@
*/
@JsonProperty("matchSrcMac")
public boolean matchSrcMac() {
- if (srcMac != null)
+ if (srcMac != null) {
return srcMac.enabled();
+ }
return false;
}
@@ -213,8 +229,9 @@
*/
@JsonProperty("dstMac")
public MACAddress dstMac() {
- if (dstMac != null)
+ if (dstMac != null) {
return dstMac.value();
+ }
return null;
}
@@ -242,8 +259,9 @@
*/
@JsonProperty("matchDstMac")
public boolean matchDstMac() {
- if (dstMac != null)
+ if (dstMac != null) {
return dstMac.enabled();
+ }
return false;
}
@@ -254,8 +272,9 @@
*/
@JsonProperty("ethernetFrameType")
public Short ethernetFrameType() {
- if (ethernetFrameType != null)
+ if (ethernetFrameType != null) {
return ethernetFrameType.value();
+ }
return null;
}
@@ -284,8 +303,9 @@
*/
@JsonProperty("matchEthernetFrameType")
public boolean matchEthernetFrameType() {
- if (ethernetFrameType != null)
+ if (ethernetFrameType != null) {
return ethernetFrameType.enabled();
+ }
return false;
}
@@ -296,8 +316,9 @@
*/
@JsonProperty("vlanId")
public Short vlanId() {
- if (vlanId != null)
+ if (vlanId != null) {
return vlanId.value();
+ }
return null;
}
@@ -325,8 +346,9 @@
*/
@JsonProperty("matchVlanId")
public boolean matchVlanId() {
- if (vlanId != null)
+ if (vlanId != null) {
return vlanId.enabled();
+ }
return false;
}
@@ -337,8 +359,9 @@
*/
@JsonProperty("vlanPriority")
public Byte vlanPriority() {
- if (vlanPriority != null)
+ if (vlanPriority != null) {
return vlanPriority.value();
+ }
return null;
}
@@ -366,8 +389,9 @@
*/
@JsonProperty("matchVlanPriority")
public boolean matchVlanPriority() {
- if (vlanPriority != null)
+ if (vlanPriority != null) {
return vlanPriority.enabled();
+ }
return false;
}
@@ -378,8 +402,9 @@
*/
@JsonProperty("srcIPv4Net")
public IPv4Net srcIPv4Net() {
- if (srcIPv4Net != null)
+ if (srcIPv4Net != null) {
return srcIPv4Net.value();
+ }
return null;
}
@@ -407,8 +432,9 @@
*/
@JsonProperty("matchSrcIPv4Net")
public boolean matchSrcIPv4Net() {
- if (srcIPv4Net != null)
+ if (srcIPv4Net != null) {
return srcIPv4Net.enabled();
+ }
return false;
}
@@ -419,8 +445,9 @@
*/
@JsonProperty("dstIPv4Net")
public IPv4Net dstIPv4Net() {
- if (dstIPv4Net != null)
+ if (dstIPv4Net != null) {
return dstIPv4Net.value();
+ }
return null;
}
@@ -449,8 +476,9 @@
*/
@JsonProperty("matchDstIPv4Net")
public boolean matchDstIPv4Net() {
- if (dstIPv4Net != null)
+ if (dstIPv4Net != null) {
return dstIPv4Net.enabled();
+ }
return false;
}
@@ -461,8 +489,9 @@
*/
@JsonProperty("ipProto")
public Byte ipProto() {
- if (ipProto != null)
+ if (ipProto != null) {
return ipProto.value();
+ }
return null;
}
@@ -490,8 +519,9 @@
*/
@JsonProperty("matchIpProto")
public boolean matchIpProto() {
- if (ipProto != null)
+ if (ipProto != null) {
return ipProto.enabled();
+ }
return false;
}
@@ -502,8 +532,9 @@
*/
@JsonProperty("ipToS")
public Byte ipToS() {
- if (ipToS != null)
+ if (ipToS != null) {
return ipToS.value();
+ }
return null;
}
@@ -531,8 +562,9 @@
*/
@JsonProperty("matchIpToS")
public boolean matchIpToS() {
- if (ipToS != null)
+ if (ipToS != null) {
return ipToS.enabled();
+ }
return false;
}
@@ -543,8 +575,9 @@
*/
@JsonProperty("srcTcpUdpPort")
public Short srcTcpUdpPort() {
- if (srcTcpUdpPort != null)
+ if (srcTcpUdpPort != null) {
return srcTcpUdpPort.value();
+ }
return null;
}
@@ -572,8 +605,9 @@
*/
@JsonProperty("matchSrcTcpUdpPort")
public boolean matchSrcTcpUdpPort() {
- if (srcTcpUdpPort != null)
+ if (srcTcpUdpPort != null) {
return srcTcpUdpPort.enabled();
+ }
return false;
}
@@ -584,8 +618,9 @@
*/
@JsonProperty("dstTcpUdpPort")
public Short dstTcpUdpPort() {
- if (dstTcpUdpPort != null)
+ if (dstTcpUdpPort != null) {
return dstTcpUdpPort.value();
+ }
return null;
}
@@ -614,8 +649,9 @@
*/
@JsonProperty("matchDstTcpUdpPort")
public boolean matchDstTcpUdpPort() {
- if (dstTcpUdpPort != null)
+ if (dstTcpUdpPort != null) {
return dstTcpUdpPort.enabled();
+ }
return false;
}
@@ -636,74 +672,86 @@
// Conditionally add only those matching fields that are enabled
//
if (matchInPort()) {
- if (addSpace)
+ if (addSpace) {
ret += " ";
+ }
addSpace = true;
ret += "inPort=" + this.inPort().toString();
}
if (matchSrcMac()) {
- if (addSpace)
+ if (addSpace) {
ret += " ";
+ }
addSpace = true;
ret += "srcMac=" + this.srcMac().toString();
}
if (matchDstMac()) {
- if (addSpace)
+ if (addSpace) {
ret += " ";
+ }
addSpace = true;
ret += "dstMac=" + this.dstMac().toString();
}
if (matchEthernetFrameType()) {
- if (addSpace)
+ if (addSpace) {
ret += " ";
+ }
addSpace = true;
ret += "ethernetFrameType=" + this.ethernetFrameType().toString();
}
if (matchVlanId()) {
- if (addSpace)
+ if (addSpace) {
ret += " ";
+ }
addSpace = true;
ret += "vlanId=" + this.vlanId().toString();
}
if (matchVlanPriority()) {
- if (addSpace)
+ if (addSpace) {
ret += " ";
+ }
addSpace = true;
ret += "vlanPriority=" + this.vlanPriority().toString();
}
if (matchSrcIPv4Net()) {
- if (addSpace)
+ if (addSpace) {
ret += " ";
+ }
addSpace = true;
ret += "srcIPv4Net=" + this.srcIPv4Net().toString();
}
if (matchDstIPv4Net()) {
- if (addSpace)
+ if (addSpace) {
ret += " ";
+ }
addSpace = true;
ret += "dstIPv4Net=" + this.dstIPv4Net().toString();
}
if (matchIpProto()) {
- if (addSpace)
+ if (addSpace) {
ret += " ";
+ }
addSpace = true;
ret += "ipProto=" + this.ipProto().toString();
}
if (matchIpToS()) {
- if (addSpace)
+ if (addSpace) {
ret += " ";
+ }
addSpace = true;
ret += "ipToS=" + this.ipToS().toString();
}
if (matchSrcTcpUdpPort()) {
- if (addSpace)
+ if (addSpace) {
ret += " ";
+ }
addSpace = true;
ret += "srcTcpUdpPort=" + this.srcTcpUdpPort().toString();
}
if (matchDstTcpUdpPort()) {
- if (addSpace)
+ if (addSpace) {
ret += " ";
+ }
addSpace = true;
ret += "dstTcpUdpPort=" + this.dstTcpUdpPort().toString();
}
diff --git a/src/main/java/net/onrc/onos/core/util/FlowId.java b/src/main/java/net/onrc/onos/core/util/FlowId.java
index d397918..a889fb3 100644
--- a/src/main/java/net/onrc/onos/core/util/FlowId.java
+++ b/src/main/java/net/onrc/onos/core/util/FlowId.java
@@ -46,12 +46,14 @@
// large unsigned hex long values.
//
char c = 0;
- if (value.length() > 2)
+ if (value.length() > 2) {
c = value.charAt(1);
- if ((c == 'x') || (c == 'X'))
+ }
+ if ((c == 'x') || (c == 'X')) {
this.value = new BigInteger(value.substring(2), 16).longValue();
- else
+ } else {
this.value = Long.decode(value);
+ }
}
/**
diff --git a/src/main/java/net/onrc/onos/core/util/FlowPath.java b/src/main/java/net/onrc/onos/core/util/FlowPath.java
index 0286bd2..2314dfc 100644
--- a/src/main/java/net/onrc/onos/core/util/FlowPath.java
+++ b/src/main/java/net/onrc/onos/core/util/FlowPath.java
@@ -64,8 +64,9 @@
*/
@JsonIgnore
public boolean isValidFlowId() {
- if (this.flowId == null)
+ if (this.flowId == null) {
return false;
+ }
return (this.flowId.isValid());
}
@@ -316,12 +317,15 @@
ret += " idleTimeout=" + this.idleTimeout;
ret += " hardTimeout=" + this.hardTimeout;
ret += " priority=" + this.priority;
- if (dataPath != null)
+ if (dataPath != null) {
ret += " dataPath=" + this.dataPath.toString();
- if (flowEntryMatch != null)
+ }
+ if (flowEntryMatch != null) {
ret += " flowEntryMatch=" + this.flowEntryMatch.toString();
- if (flowEntryActions != null)
+ }
+ if (flowEntryActions != null) {
ret += " flowEntryActions=" + this.flowEntryActions.toString();
+ }
ret += "]";
return ret;
}
diff --git a/src/main/java/net/onrc/onos/core/util/FlowPathFlags.java b/src/main/java/net/onrc/onos/core/util/FlowPathFlags.java
index e1e67c5..138f961 100644
--- a/src/main/java/net/onrc/onos/core/util/FlowPathFlags.java
+++ b/src/main/java/net/onrc/onos/core/util/FlowPathFlags.java
@@ -75,10 +75,12 @@
this.flags = 0L;
// Test all flags
- if (flagsStr.contains("DISCARD_FIRST_HOP_ENTRY"))
+ if (flagsStr.contains("DISCARD_FIRST_HOP_ENTRY")) {
this.flags |= DISCARD_FIRST_HOP_ENTRY;
- if (flagsStr.contains("KEEP_ONLY_FIRST_HOP_ENTRY"))
+ }
+ if (flagsStr.contains("KEEP_ONLY_FIRST_HOP_ENTRY")) {
this.flags |= KEEP_ONLY_FIRST_HOP_ENTRY;
+ }
}
/**
@@ -119,12 +121,14 @@
flagsStr += "DISCARD_FIRST_HOP_ENTRY";
}
if ((this.flags & KEEP_ONLY_FIRST_HOP_ENTRY) != 0) {
- if (flagsStr != null)
+ if (flagsStr != null) {
flagsStr += ",";
+ }
flagsStr += "KEEP_ONLY_FIRST_HOP_ENTRY";
}
- if (flagsStr != null)
+ if (flagsStr != null) {
ret += flagsStr;
+ }
ret += "]";
return ret;
diff --git a/src/main/java/net/onrc/onos/core/util/IPv4.java b/src/main/java/net/onrc/onos/core/util/IPv4.java
index b25099a..0b5c081 100644
--- a/src/main/java/net/onrc/onos/core/util/IPv4.java
+++ b/src/main/java/net/onrc/onos/core/util/IPv4.java
@@ -47,9 +47,10 @@
*/
public IPv4(String value) {
String[] splits = value.split("\\.");
- if (splits.length != 4)
+ if (splits.length != 4) {
throw new IllegalArgumentException("Specified IPv4 address must contain four " +
"numerical digits separated by '.'");
+ }
int result = 0;
for (int i = 0; i < 4; ++i) {
diff --git a/src/main/java/net/onrc/onos/core/util/IPv4Net.java b/src/main/java/net/onrc/onos/core/util/IPv4Net.java
index 6a04635..3b8fad6 100644
--- a/src/main/java/net/onrc/onos/core/util/IPv4Net.java
+++ b/src/main/java/net/onrc/onos/core/util/IPv4Net.java
@@ -30,10 +30,11 @@
* @param other the object to copy from.
*/
public IPv4Net(IPv4Net other) {
- if (other.address != null)
+ if (other.address != null) {
this.address = new IPv4(other.address);
- else
+ } else {
this.address = null;
+ }
this.prefixLen = other.prefixLen;
}
diff --git a/src/main/java/net/onrc/onos/core/util/IPv6Net.java b/src/main/java/net/onrc/onos/core/util/IPv6Net.java
index 72ec5e9..064e22e 100644
--- a/src/main/java/net/onrc/onos/core/util/IPv6Net.java
+++ b/src/main/java/net/onrc/onos/core/util/IPv6Net.java
@@ -30,10 +30,11 @@
* @param other the object to copy from.
*/
public IPv6Net(IPv6Net other) {
- if (other.address != null)
+ if (other.address != null) {
this.address = new IPv6(other.address);
- else
+ } else {
this.address = null;
+ }
this.prefixLen = other.prefixLen;
}