tom

Fixed some sonar-reported issues.

...@@ -45,7 +45,7 @@ public class AbstractListenerRegistry<E extends Event, L extends EventListener<E ...@@ -45,7 +45,7 @@ public class AbstractListenerRegistry<E extends Event, L extends EventListener<E
45 for (L listener : listeners) { 45 for (L listener : listeners) {
46 try { 46 try {
47 listener.event(event); 47 listener.event(event);
48 - } catch (Throwable error) { 48 + } catch (Exception error) {
49 reportProblem(event, error); 49 reportProblem(event, error);
50 } 50 }
51 } 51 }
......
...@@ -82,7 +82,7 @@ public class SimpleEventDispatcher extends DefaultEventSinkRegistry ...@@ -82,7 +82,7 @@ public class SimpleEventDispatcher extends DefaultEventSinkRegistry
82 log.warn("No sink registered for event class {}", 82 log.warn("No sink registered for event class {}",
83 event.getClass()); 83 event.getClass());
84 } 84 }
85 - } catch (Throwable e) { 85 + } catch (Exception e) {
86 log.warn("Error encountered while dispatching event:", e); 86 log.warn("Error encountered while dispatching event:", e);
87 } 87 }
88 } 88 }
......
...@@ -141,7 +141,6 @@ public class SimpleDeviceManager ...@@ -141,7 +141,6 @@ public class SimpleDeviceManager
141 public void updatePorts(DeviceId deviceId, List<PortDescription> portDescriptions) { 141 public void updatePorts(DeviceId deviceId, List<PortDescription> portDescriptions) {
142 checkNotNull(deviceId, DEVICE_ID_NULL); 142 checkNotNull(deviceId, DEVICE_ID_NULL);
143 checkNotNull(portDescriptions, "Port descriptions list cannot be null"); 143 checkNotNull(portDescriptions, "Port descriptions list cannot be null");
144 - // FIXME: fix the interface to accept DeviceId separately
145 log.info("Device {} ports updated: {}", portDescriptions); 144 log.info("Device {} ports updated: {}", portDescriptions);
146 List<DeviceEvent> events = store.updatePorts(deviceId, portDescriptions); 145 List<DeviceEvent> events = store.updatePorts(deviceId, portDescriptions);
147 for (DeviceEvent event : events) { 146 for (DeviceEvent event : events) {
......
...@@ -22,8 +22,6 @@ public class AdjacencyListsGraph<V extends Vertex, E extends Edge<V>> implements ...@@ -22,8 +22,6 @@ public class AdjacencyListsGraph<V extends Vertex, E extends Edge<V>> implements
22 private final ImmutableSetMultimap<V, E> sources; 22 private final ImmutableSetMultimap<V, E> sources;
23 private final ImmutableSetMultimap<V, E> destinations; 23 private final ImmutableSetMultimap<V, E> destinations;
24 24
25 - private final Set<E> noEdges = ImmutableSet.of();
26 -
27 /** 25 /**
28 * Creates a graph comprising of the specified vertexes and edges. 26 * Creates a graph comprising of the specified vertexes and edges.
29 * 27 *
......
...@@ -21,8 +21,8 @@ public class BreadthFirstSearch<V extends Vertex, E extends Edge<V>> ...@@ -21,8 +21,8 @@ public class BreadthFirstSearch<V extends Vertex, E extends Edge<V>>
21 result.costs.put(src, 0.0); 21 result.costs.put(src, 0.0);
22 frontier.add(src); 22 frontier.add(src);
23 23
24 - search: 24 + boolean reachedEnd = false;
25 - while (!frontier.isEmpty()) { 25 + while (!reachedEnd && !frontier.isEmpty()) {
26 // Prepare the next frontier. 26 // Prepare the next frontier.
27 Set<V> next = new HashSet<>(); 27 Set<V> next = new HashSet<>();
28 28
...@@ -40,10 +40,15 @@ public class BreadthFirstSearch<V extends Vertex, E extends Edge<V>> ...@@ -40,10 +40,15 @@ public class BreadthFirstSearch<V extends Vertex, E extends Edge<V>>
40 true); 40 true);
41 // If we have reached our intended destination, bail. 41 // If we have reached our intended destination, bail.
42 if (nextVertex.equals(dst)) { 42 if (nextVertex.equals(dst)) {
43 - break search; 43 + reachedEnd = true;
44 + break;
44 } 45 }
45 next.add(nextVertex); 46 next.add(nextVertex);
46 } 47 }
48 +
49 + if (reachedEnd) {
50 + break;
51 + }
47 } 52 }
48 } 53 }
49 54
......
...@@ -25,9 +25,6 @@ import static com.google.common.base.Preconditions.checkNotNull; ...@@ -25,9 +25,6 @@ import static com.google.common.base.Preconditions.checkNotNull;
25 */ 25 */
26 public class Heap<T> { 26 public class Heap<T> {
27 27
28 - private static final String E_HEAP_READONLY = "Heap iterator is read-only";
29 - private static final String E_HEAP_END = "Heap iterator reached end of heap";
30 -
31 private final List<T> data; 28 private final List<T> data;
32 private final Comparator<T> comparator; 29 private final Comparator<T> comparator;
33 30
......