Fix Sonar issue:
Strings literals should be placed on the left side when checking for
equality
Change-Id: I4537e08936731ace55aeecb3ad941269ec1eb191
diff --git a/apps/vtn/sfcmgr/src/main/java/org/onosproject/sfc/installer/impl/SfcFlowRuleInstallerImpl.java b/apps/vtn/sfcmgr/src/main/java/org/onosproject/sfc/installer/impl/SfcFlowRuleInstallerImpl.java
index 52ecde6..2d1bae6 100644
--- a/apps/vtn/sfcmgr/src/main/java/org/onosproject/sfc/installer/impl/SfcFlowRuleInstallerImpl.java
+++ b/apps/vtn/sfcmgr/src/main/java/org/onosproject/sfc/installer/impl/SfcFlowRuleInstallerImpl.java
@@ -697,11 +697,11 @@
}
if ((flowClassifier.protocol() != null) && (!flowClassifier.protocol().isEmpty())) {
- if (flowClassifier.protocol().equalsIgnoreCase("TCP")) {
+ if ("TCP".equalsIgnoreCase(flowClassifier.protocol())) {
selector.add(Criteria.matchIPProtocol(IPv4.PROTOCOL_TCP));
- } else if (flowClassifier.protocol().equalsIgnoreCase("UDP")) {
+ } else if ("UDP".equalsIgnoreCase(flowClassifier.protocol())) {
selector.add(Criteria.matchIPProtocol(IPv4.PROTOCOL_UDP));
- } else if (flowClassifier.protocol().equalsIgnoreCase("ICMP")) {
+ } else if ("ICMP".equalsIgnoreCase(flowClassifier.protocol())) {
selector.add(Criteria.matchIPProtocol(IPv4.PROTOCOL_ICMP));
}
} else if (fiveTuple != null && fiveTuple.protocol() != 0) {
@@ -709,8 +709,8 @@
}
if (((flowClassifier.etherType() != null) && (!flowClassifier.etherType().isEmpty()))
- && (flowClassifier.etherType().equals("IPv4") || flowClassifier.etherType().equals("IPv6"))) {
- if (flowClassifier.etherType().equals("IPv4")) {
+ && ("IPv4".equals(flowClassifier.etherType()) || "IPv6".equals(flowClassifier.etherType()))) {
+ if ("IPv4".equals(flowClassifier.etherType())) {
selector.matchEthType(Ethernet.TYPE_IPV4);
} else {
selector.matchEthType(Ethernet.TYPE_IPV6);
diff --git a/apps/vtn/sfcmgr/src/main/java/org/onosproject/sfc/manager/impl/SfcManager.java b/apps/vtn/sfcmgr/src/main/java/org/onosproject/sfc/manager/impl/SfcManager.java
index eb63917..d429fc9 100644
--- a/apps/vtn/sfcmgr/src/main/java/org/onosproject/sfc/manager/impl/SfcManager.java
+++ b/apps/vtn/sfcmgr/src/main/java/org/onosproject/sfc/manager/impl/SfcManager.java
@@ -407,11 +407,11 @@
boolean match = false;
// Check whether protocol is set in flow classifier
if (flowClassifier.protocol() != null) {
- if ((flowClassifier.protocol().equalsIgnoreCase("TCP")
+ if (("TCP".equalsIgnoreCase(flowClassifier.protocol())
&& fiveTuple.protocol() == IPv4.PROTOCOL_TCP)
- || (flowClassifier.protocol().equalsIgnoreCase("UDP")
+ || ("UDP".equalsIgnoreCase(flowClassifier.protocol())
&& fiveTuple.protocol() == IPv4.PROTOCOL_UDP)
- || (flowClassifier.protocol().equalsIgnoreCase("ICMP")
+ || ("ICMP".equalsIgnoreCase(flowClassifier.protocol())
&& fiveTuple.protocol() == IPv4.PROTOCOL_ICMP)) {
match = true;
} else {