Ray Milkey
Committed by Gerrit Code Review

[Falcon] fixes for Sonar Critical bugs

Change-Id: I0a63578727693a2517f3002bd4f4c391b6f44aea
......@@ -425,6 +425,7 @@ public class CordFabricManager implements FabricService {
deviceService.isAvailable(event.subject().id())) {
setupDefaultFlows();
}
break;
default:
break;
}
......
......@@ -78,7 +78,7 @@ public class OpenstackRestHandler {
OpenstackNetworkCodec networkCodec = new OpenstackNetworkCodec();
networkList.forEach(n -> openstackNetworks.add(networkCodec.decode((ObjectNode) n, null)));
} catch (IOException e) {
e.printStackTrace();
log.warn("getNetworks()", e);
}
log.debug("networks response:" + response);
......@@ -106,7 +106,7 @@ public class OpenstackRestHandler {
OpenstackPortCodec portCodec = new OpenstackPortCodec();
portList.forEach(p -> openstackPorts.add(portCodec.decode((ObjectNode) p, null)));
} catch (IOException e) {
e.printStackTrace();
log.warn("getPorts()", e);
}
log.debug("port response:" + response);
......@@ -134,7 +134,7 @@ public class OpenstackRestHandler {
OpenstackSubnetCodec subnetCodec = new OpenstackSubnetCodec();
subnetList.forEach(s -> subnets.add(subnetCodec.decode((ObjectNode) s, null)));
} catch (IOException e) {
e.printStackTrace();
log.warn("getSubnets()", e);
}
log.debug("subnets response:" + response);
......@@ -163,7 +163,7 @@ public class OpenstackRestHandler {
ObjectNode node = (ObjectNode) mapper.readTree(response);
tokenId = node.path("access").path("token").path("id").asText();
} catch (IOException e) {
e.printStackTrace();
log.warn("getToken()", e);
}
log.debug("token response:" + response);
}
......
......@@ -184,7 +184,7 @@ public class IntentSynchronizer implements IntentSynchronizationService {
intentsToAdd.add(localIntent);
} else {
IntentState state = intentService.getIntentState(serviceIntent.key());
if (!IntentUtils.equals(serviceIntent, localIntent) || state == null ||
if (!IntentUtils.intentsAreEqual(serviceIntent, localIntent) || state == null ||
state == IntentState.WITHDRAW_REQ ||
state == IntentState.WITHDRAWING ||
state == IntentState.WITHDRAWN) {
......
......@@ -135,7 +135,7 @@ public class PeerConnectivityManager {
buildSpeakerIntents(bgpSpeaker).forEach(i -> {
PointToPointIntent intent = existingIntents.remove(i.key());
if (intent == null || !IntentUtils.equals(i, intent)) {
if (intent == null || !IntentUtils.intentsAreEqual(i, intent)) {
peerIntents.put(i.key(), i);
intentSynchronizer.submit(i);
}
......
......@@ -216,7 +216,7 @@ public class IntentSyncTest extends AbstractIntentTest {
// Compose a intent, which is equal to intent5 but the id is different.
MultiPointToSinglePointIntent intent5New =
staticIntentBuilder(intent5, routeEntry5, "00:00:00:00:00:01");
assertThat(IntentUtils.equals(intent5, intent5New), is(true));
assertThat(IntentUtils.intentsAreEqual(intent5, intent5New), is(true));
assertFalse(intent5.equals(intent5New));
MultiPointToSinglePointIntent intent6 = intentBuilder(
......
......@@ -84,7 +84,7 @@ public final class TestIntentServiceHelper {
Intent providedIntent = (Intent) object;
providedString = providedIntent.toString();
return IntentUtils.equals(intent, providedIntent);
return IntentUtils.intentsAreEqual(intent, providedIntent);
}
}
......
......@@ -310,7 +310,7 @@ public class MessagingPerfApp {
messageSendingExecutor.submit(this::requestReply);
});
} catch (Exception e) {
e.printStackTrace();
log.info("requestReply()", e);
}
}
......@@ -323,7 +323,7 @@ public class MessagingPerfApp {
encoder,
randomPeer());
} catch (Exception e) {
e.printStackTrace();
log.info("unicast()", e);
}
messageSendingExecutor.submit(this::unicast);
}
......@@ -336,7 +336,7 @@ public class MessagingPerfApp {
TEST_UNICAST_MESSAGE_TOPIC,
encoder);
} catch (Exception e) {
e.printStackTrace();
log.info("broadcast()", e);
}
messageSendingExecutor.submit(this::broadcast);
}
......
......@@ -63,6 +63,7 @@ public class AddTestFlowsCommand extends AbstractShellCommand {
String numOfRuns = null;
@Override
@java.lang.SuppressWarnings("squid:S1148")
protected void execute() {
FlowRuleService flowService = get(FlowRuleService.class);
DeviceService deviceService = get(DeviceService.class);
......
......@@ -114,6 +114,7 @@ public class ReviewCommand extends AbstractShellCommand {
print("\t[Other] " + perm.getClass().getSimpleName() +
" " + perm.getName() + " (" + perm.getActions() + ")");
}
break;
default:
break;
}
......
......@@ -42,7 +42,7 @@ public final class IntentUtils {
* @param two second intent
* @return true if the two intents represent the same value, otherwise false
*/
public static boolean equals(Intent one, Intent two) {
public static boolean intentsAreEqual(Intent one, Intent two) {
if (one.getClass() != two.getClass()) {
return false;
}
......
......@@ -232,6 +232,7 @@ public class DistributedSecurityModeStore
break;
case SECURED:
notifyDelegate(new SecurityModeEvent(SecurityModeEvent.Type.POLICY_ACCEPTED, appId));
break;
default:
break;
}
......
......@@ -87,8 +87,7 @@ public class CalientFiberSwitchHandshaker
try {
sendHandshakeOFExperimenterPortDescRequest();
} catch (IOException e) {
log.error("Exception while sending experimenter port desc:", e.getMessage());
e.printStackTrace();
log.error("Exception while sending experimenter port desc:", e);
}
}
......
......@@ -223,7 +223,7 @@ public final class FromJsonUtil {
JsonNode jsonNode = input.get(i);
Operation operation = operations.get(i);
if (jsonNode != null && jsonNode.size() > 0) {
if (i >= operations.size() || operation.getOp() != "select") {
if (i >= operations.size() || !operation.getOp().equals("select")) {
OperationResult or = objectMapper.convertValue(jsonNode, OperationResult.class);
operationResults.add(or);
} else {
......
......@@ -488,7 +488,7 @@ public class OpenFlowRuleProvider extends AbstractProvider
+ " tell us which one.");
}
}
break;
default:
log.debug("Unhandled message type: {}", msg.getType());
}
......
......@@ -36,6 +36,7 @@ import java.util.List;
* Produces ONOS component configuration catalogue resources.
*/
@Mojo(name = "cfg", defaultPhase = LifecyclePhase.GENERATE_RESOURCES)
@java.lang.SuppressWarnings("squid:S1148")
public class OnosCfgMojo extends AbstractMojo {
private static final String COMPONENT = "org.apache.felix.scr.annotations.Component";
......
......@@ -85,6 +85,7 @@ public class PIMHelloOption {
case OPT_ADDRLIST:
this.optLength = 0; // We don't know what the length will be yet.
this.optValue = null;
break;
default:
//log.error("Unkown option type: " + type + "\n" );
......