Committed by
Gerrit Code Review
[Falcon] fixes for Sonar Critical bugs
Change-Id: I0a63578727693a2517f3002bd4f4c391b6f44aea
Showing
16 changed files
with
22 additions
and
17 deletions
| ... | @@ -425,6 +425,7 @@ public class CordFabricManager implements FabricService { | ... | @@ -425,6 +425,7 @@ public class CordFabricManager implements FabricService { |
| 425 | deviceService.isAvailable(event.subject().id())) { | 425 | deviceService.isAvailable(event.subject().id())) { |
| 426 | setupDefaultFlows(); | 426 | setupDefaultFlows(); |
| 427 | } | 427 | } |
| 428 | + break; | ||
| 428 | default: | 429 | default: |
| 429 | break; | 430 | break; |
| 430 | } | 431 | } | ... | ... |
| ... | @@ -78,7 +78,7 @@ public class OpenstackRestHandler { | ... | @@ -78,7 +78,7 @@ public class OpenstackRestHandler { |
| 78 | OpenstackNetworkCodec networkCodec = new OpenstackNetworkCodec(); | 78 | OpenstackNetworkCodec networkCodec = new OpenstackNetworkCodec(); |
| 79 | networkList.forEach(n -> openstackNetworks.add(networkCodec.decode((ObjectNode) n, null))); | 79 | networkList.forEach(n -> openstackNetworks.add(networkCodec.decode((ObjectNode) n, null))); |
| 80 | } catch (IOException e) { | 80 | } catch (IOException e) { |
| 81 | - e.printStackTrace(); | 81 | + log.warn("getNetworks()", e); |
| 82 | } | 82 | } |
| 83 | 83 | ||
| 84 | log.debug("networks response:" + response); | 84 | log.debug("networks response:" + response); |
| ... | @@ -106,7 +106,7 @@ public class OpenstackRestHandler { | ... | @@ -106,7 +106,7 @@ public class OpenstackRestHandler { |
| 106 | OpenstackPortCodec portCodec = new OpenstackPortCodec(); | 106 | OpenstackPortCodec portCodec = new OpenstackPortCodec(); |
| 107 | portList.forEach(p -> openstackPorts.add(portCodec.decode((ObjectNode) p, null))); | 107 | portList.forEach(p -> openstackPorts.add(portCodec.decode((ObjectNode) p, null))); |
| 108 | } catch (IOException e) { | 108 | } catch (IOException e) { |
| 109 | - e.printStackTrace(); | 109 | + log.warn("getPorts()", e); |
| 110 | } | 110 | } |
| 111 | 111 | ||
| 112 | log.debug("port response:" + response); | 112 | log.debug("port response:" + response); |
| ... | @@ -134,7 +134,7 @@ public class OpenstackRestHandler { | ... | @@ -134,7 +134,7 @@ public class OpenstackRestHandler { |
| 134 | OpenstackSubnetCodec subnetCodec = new OpenstackSubnetCodec(); | 134 | OpenstackSubnetCodec subnetCodec = new OpenstackSubnetCodec(); |
| 135 | subnetList.forEach(s -> subnets.add(subnetCodec.decode((ObjectNode) s, null))); | 135 | subnetList.forEach(s -> subnets.add(subnetCodec.decode((ObjectNode) s, null))); |
| 136 | } catch (IOException e) { | 136 | } catch (IOException e) { |
| 137 | - e.printStackTrace(); | 137 | + log.warn("getSubnets()", e); |
| 138 | } | 138 | } |
| 139 | 139 | ||
| 140 | log.debug("subnets response:" + response); | 140 | log.debug("subnets response:" + response); |
| ... | @@ -163,7 +163,7 @@ public class OpenstackRestHandler { | ... | @@ -163,7 +163,7 @@ public class OpenstackRestHandler { |
| 163 | ObjectNode node = (ObjectNode) mapper.readTree(response); | 163 | ObjectNode node = (ObjectNode) mapper.readTree(response); |
| 164 | tokenId = node.path("access").path("token").path("id").asText(); | 164 | tokenId = node.path("access").path("token").path("id").asText(); |
| 165 | } catch (IOException e) { | 165 | } catch (IOException e) { |
| 166 | - e.printStackTrace(); | 166 | + log.warn("getToken()", e); |
| 167 | } | 167 | } |
| 168 | log.debug("token response:" + response); | 168 | log.debug("token response:" + response); |
| 169 | } | 169 | } | ... | ... |
| ... | @@ -184,7 +184,7 @@ public class IntentSynchronizer implements IntentSynchronizationService { | ... | @@ -184,7 +184,7 @@ public class IntentSynchronizer implements IntentSynchronizationService { |
| 184 | intentsToAdd.add(localIntent); | 184 | intentsToAdd.add(localIntent); |
| 185 | } else { | 185 | } else { |
| 186 | IntentState state = intentService.getIntentState(serviceIntent.key()); | 186 | IntentState state = intentService.getIntentState(serviceIntent.key()); |
| 187 | - if (!IntentUtils.equals(serviceIntent, localIntent) || state == null || | 187 | + if (!IntentUtils.intentsAreEqual(serviceIntent, localIntent) || state == null || |
| 188 | state == IntentState.WITHDRAW_REQ || | 188 | state == IntentState.WITHDRAW_REQ || |
| 189 | state == IntentState.WITHDRAWING || | 189 | state == IntentState.WITHDRAWING || |
| 190 | state == IntentState.WITHDRAWN) { | 190 | state == IntentState.WITHDRAWN) { | ... | ... |
| ... | @@ -135,7 +135,7 @@ public class PeerConnectivityManager { | ... | @@ -135,7 +135,7 @@ public class PeerConnectivityManager { |
| 135 | 135 | ||
| 136 | buildSpeakerIntents(bgpSpeaker).forEach(i -> { | 136 | buildSpeakerIntents(bgpSpeaker).forEach(i -> { |
| 137 | PointToPointIntent intent = existingIntents.remove(i.key()); | 137 | PointToPointIntent intent = existingIntents.remove(i.key()); |
| 138 | - if (intent == null || !IntentUtils.equals(i, intent)) { | 138 | + if (intent == null || !IntentUtils.intentsAreEqual(i, intent)) { |
| 139 | peerIntents.put(i.key(), i); | 139 | peerIntents.put(i.key(), i); |
| 140 | intentSynchronizer.submit(i); | 140 | intentSynchronizer.submit(i); |
| 141 | } | 141 | } | ... | ... |
| ... | @@ -216,7 +216,7 @@ public class IntentSyncTest extends AbstractIntentTest { | ... | @@ -216,7 +216,7 @@ public class IntentSyncTest extends AbstractIntentTest { |
| 216 | // Compose a intent, which is equal to intent5 but the id is different. | 216 | // Compose a intent, which is equal to intent5 but the id is different. |
| 217 | MultiPointToSinglePointIntent intent5New = | 217 | MultiPointToSinglePointIntent intent5New = |
| 218 | staticIntentBuilder(intent5, routeEntry5, "00:00:00:00:00:01"); | 218 | staticIntentBuilder(intent5, routeEntry5, "00:00:00:00:00:01"); |
| 219 | - assertThat(IntentUtils.equals(intent5, intent5New), is(true)); | 219 | + assertThat(IntentUtils.intentsAreEqual(intent5, intent5New), is(true)); |
| 220 | assertFalse(intent5.equals(intent5New)); | 220 | assertFalse(intent5.equals(intent5New)); |
| 221 | 221 | ||
| 222 | MultiPointToSinglePointIntent intent6 = intentBuilder( | 222 | MultiPointToSinglePointIntent intent6 = intentBuilder( | ... | ... |
| ... | @@ -84,7 +84,7 @@ public final class TestIntentServiceHelper { | ... | @@ -84,7 +84,7 @@ public final class TestIntentServiceHelper { |
| 84 | Intent providedIntent = (Intent) object; | 84 | Intent providedIntent = (Intent) object; |
| 85 | providedString = providedIntent.toString(); | 85 | providedString = providedIntent.toString(); |
| 86 | 86 | ||
| 87 | - return IntentUtils.equals(intent, providedIntent); | 87 | + return IntentUtils.intentsAreEqual(intent, providedIntent); |
| 88 | } | 88 | } |
| 89 | } | 89 | } |
| 90 | 90 | ... | ... |
| ... | @@ -310,7 +310,7 @@ public class MessagingPerfApp { | ... | @@ -310,7 +310,7 @@ public class MessagingPerfApp { |
| 310 | messageSendingExecutor.submit(this::requestReply); | 310 | messageSendingExecutor.submit(this::requestReply); |
| 311 | }); | 311 | }); |
| 312 | } catch (Exception e) { | 312 | } catch (Exception e) { |
| 313 | - e.printStackTrace(); | 313 | + log.info("requestReply()", e); |
| 314 | } | 314 | } |
| 315 | } | 315 | } |
| 316 | 316 | ||
| ... | @@ -323,7 +323,7 @@ public class MessagingPerfApp { | ... | @@ -323,7 +323,7 @@ public class MessagingPerfApp { |
| 323 | encoder, | 323 | encoder, |
| 324 | randomPeer()); | 324 | randomPeer()); |
| 325 | } catch (Exception e) { | 325 | } catch (Exception e) { |
| 326 | - e.printStackTrace(); | 326 | + log.info("unicast()", e); |
| 327 | } | 327 | } |
| 328 | messageSendingExecutor.submit(this::unicast); | 328 | messageSendingExecutor.submit(this::unicast); |
| 329 | } | 329 | } |
| ... | @@ -336,7 +336,7 @@ public class MessagingPerfApp { | ... | @@ -336,7 +336,7 @@ public class MessagingPerfApp { |
| 336 | TEST_UNICAST_MESSAGE_TOPIC, | 336 | TEST_UNICAST_MESSAGE_TOPIC, |
| 337 | encoder); | 337 | encoder); |
| 338 | } catch (Exception e) { | 338 | } catch (Exception e) { |
| 339 | - e.printStackTrace(); | 339 | + log.info("broadcast()", e); |
| 340 | } | 340 | } |
| 341 | messageSendingExecutor.submit(this::broadcast); | 341 | messageSendingExecutor.submit(this::broadcast); |
| 342 | } | 342 | } | ... | ... |
| ... | @@ -63,6 +63,7 @@ public class AddTestFlowsCommand extends AbstractShellCommand { | ... | @@ -63,6 +63,7 @@ public class AddTestFlowsCommand extends AbstractShellCommand { |
| 63 | String numOfRuns = null; | 63 | String numOfRuns = null; |
| 64 | 64 | ||
| 65 | @Override | 65 | @Override |
| 66 | + @java.lang.SuppressWarnings("squid:S1148") | ||
| 66 | protected void execute() { | 67 | protected void execute() { |
| 67 | FlowRuleService flowService = get(FlowRuleService.class); | 68 | FlowRuleService flowService = get(FlowRuleService.class); |
| 68 | DeviceService deviceService = get(DeviceService.class); | 69 | DeviceService deviceService = get(DeviceService.class); | ... | ... |
| ... | @@ -114,6 +114,7 @@ public class ReviewCommand extends AbstractShellCommand { | ... | @@ -114,6 +114,7 @@ public class ReviewCommand extends AbstractShellCommand { |
| 114 | print("\t[Other] " + perm.getClass().getSimpleName() + | 114 | print("\t[Other] " + perm.getClass().getSimpleName() + |
| 115 | " " + perm.getName() + " (" + perm.getActions() + ")"); | 115 | " " + perm.getName() + " (" + perm.getActions() + ")"); |
| 116 | } | 116 | } |
| 117 | + break; | ||
| 117 | default: | 118 | default: |
| 118 | break; | 119 | break; |
| 119 | } | 120 | } | ... | ... |
| ... | @@ -42,7 +42,7 @@ public final class IntentUtils { | ... | @@ -42,7 +42,7 @@ public final class IntentUtils { |
| 42 | * @param two second intent | 42 | * @param two second intent |
| 43 | * @return true if the two intents represent the same value, otherwise false | 43 | * @return true if the two intents represent the same value, otherwise false |
| 44 | */ | 44 | */ |
| 45 | - public static boolean equals(Intent one, Intent two) { | 45 | + public static boolean intentsAreEqual(Intent one, Intent two) { |
| 46 | if (one.getClass() != two.getClass()) { | 46 | if (one.getClass() != two.getClass()) { |
| 47 | return false; | 47 | return false; |
| 48 | } | 48 | } | ... | ... |
| ... | @@ -232,6 +232,7 @@ public class DistributedSecurityModeStore | ... | @@ -232,6 +232,7 @@ public class DistributedSecurityModeStore |
| 232 | break; | 232 | break; |
| 233 | case SECURED: | 233 | case SECURED: |
| 234 | notifyDelegate(new SecurityModeEvent(SecurityModeEvent.Type.POLICY_ACCEPTED, appId)); | 234 | notifyDelegate(new SecurityModeEvent(SecurityModeEvent.Type.POLICY_ACCEPTED, appId)); |
| 235 | + break; | ||
| 235 | default: | 236 | default: |
| 236 | break; | 237 | break; |
| 237 | } | 238 | } |
| ... | @@ -312,4 +313,4 @@ public class DistributedSecurityModeStore | ... | @@ -312,4 +313,4 @@ public class DistributedSecurityModeStore |
| 312 | public void unsetDelegate(SecurityModeStoreDelegate delegate) { | 313 | public void unsetDelegate(SecurityModeStoreDelegate delegate) { |
| 313 | super.setDelegate(delegate); | 314 | super.setDelegate(delegate); |
| 314 | } | 315 | } |
| 315 | -} | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 316 | +} | ... | ... |
| ... | @@ -87,8 +87,7 @@ public class CalientFiberSwitchHandshaker | ... | @@ -87,8 +87,7 @@ public class CalientFiberSwitchHandshaker |
| 87 | try { | 87 | try { |
| 88 | sendHandshakeOFExperimenterPortDescRequest(); | 88 | sendHandshakeOFExperimenterPortDescRequest(); |
| 89 | } catch (IOException e) { | 89 | } catch (IOException e) { |
| 90 | - log.error("Exception while sending experimenter port desc:", e.getMessage()); | 90 | + log.error("Exception while sending experimenter port desc:", e); |
| 91 | - e.printStackTrace(); | ||
| 92 | } | 91 | } |
| 93 | 92 | ||
| 94 | } | 93 | } | ... | ... |
| ... | @@ -223,7 +223,7 @@ public final class FromJsonUtil { | ... | @@ -223,7 +223,7 @@ public final class FromJsonUtil { |
| 223 | JsonNode jsonNode = input.get(i); | 223 | JsonNode jsonNode = input.get(i); |
| 224 | Operation operation = operations.get(i); | 224 | Operation operation = operations.get(i); |
| 225 | if (jsonNode != null && jsonNode.size() > 0) { | 225 | if (jsonNode != null && jsonNode.size() > 0) { |
| 226 | - if (i >= operations.size() || operation.getOp() != "select") { | 226 | + if (i >= operations.size() || !operation.getOp().equals("select")) { |
| 227 | OperationResult or = objectMapper.convertValue(jsonNode, OperationResult.class); | 227 | OperationResult or = objectMapper.convertValue(jsonNode, OperationResult.class); |
| 228 | operationResults.add(or); | 228 | operationResults.add(or); |
| 229 | } else { | 229 | } else { | ... | ... |
| ... | @@ -488,7 +488,7 @@ public class OpenFlowRuleProvider extends AbstractProvider | ... | @@ -488,7 +488,7 @@ public class OpenFlowRuleProvider extends AbstractProvider |
| 488 | + " tell us which one."); | 488 | + " tell us which one."); |
| 489 | } | 489 | } |
| 490 | } | 490 | } |
| 491 | - | 491 | + break; |
| 492 | default: | 492 | default: |
| 493 | log.debug("Unhandled message type: {}", msg.getType()); | 493 | log.debug("Unhandled message type: {}", msg.getType()); |
| 494 | } | 494 | } | ... | ... |
| ... | @@ -36,6 +36,7 @@ import java.util.List; | ... | @@ -36,6 +36,7 @@ import java.util.List; |
| 36 | * Produces ONOS component configuration catalogue resources. | 36 | * Produces ONOS component configuration catalogue resources. |
| 37 | */ | 37 | */ |
| 38 | @Mojo(name = "cfg", defaultPhase = LifecyclePhase.GENERATE_RESOURCES) | 38 | @Mojo(name = "cfg", defaultPhase = LifecyclePhase.GENERATE_RESOURCES) |
| 39 | +@java.lang.SuppressWarnings("squid:S1148") | ||
| 39 | public class OnosCfgMojo extends AbstractMojo { | 40 | public class OnosCfgMojo extends AbstractMojo { |
| 40 | 41 | ||
| 41 | private static final String COMPONENT = "org.apache.felix.scr.annotations.Component"; | 42 | private static final String COMPONENT = "org.apache.felix.scr.annotations.Component"; | ... | ... |
| ... | @@ -85,6 +85,7 @@ public class PIMHelloOption { | ... | @@ -85,6 +85,7 @@ public class PIMHelloOption { |
| 85 | case OPT_ADDRLIST: | 85 | case OPT_ADDRLIST: |
| 86 | this.optLength = 0; // We don't know what the length will be yet. | 86 | this.optLength = 0; // We don't know what the length will be yet. |
| 87 | this.optValue = null; | 87 | this.optValue = null; |
| 88 | + break; | ||
| 88 | 89 | ||
| 89 | default: | 90 | default: |
| 90 | //log.error("Unkown option type: " + type + "\n" ); | 91 | //log.error("Unkown option type: " + type + "\n" ); | ... | ... |
-
Please register or login to post a comment