mirror of
https://github.com/opennetworkinglab/onos.git
synced 2025-10-17 02:11:38 +02:00
Sonar suggestions
Change-Id: I68d400185ffc885bf92b558a2565a49af149ef0c
This commit is contained in:
parent
c4d037797d
commit
fe6afd8c38
@ -45,6 +45,7 @@ public class AlarmFieldValueCompleter extends AbstractChoicesCompleter {
|
||||
case TIME_CLEARED:
|
||||
case TIME_UPDATED:
|
||||
choices.add(Instant.now().toString());
|
||||
return choices;
|
||||
default:
|
||||
return choices;
|
||||
}
|
||||
|
@ -28,7 +28,6 @@ import org.onosproject.openstackvtap.api.OpenstackVtapNetwork;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.PrintStream;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
import static org.onosproject.openstacknetworking.api.Constants.ANNOTATION_NETWORK_ID;
|
||||
@ -187,7 +186,6 @@ public final class OpenstackVtapUtil {
|
||||
*/
|
||||
public static void dumpStackTrace(Logger log, Exception e) {
|
||||
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
|
||||
e.printStackTrace(new PrintStream(outputStream));
|
||||
log.error("\n{}", new String(outputStream.toByteArray(), StandardCharsets.UTF_8));
|
||||
}
|
||||
|
||||
|
@ -49,9 +49,6 @@ public class PimApplication {
|
||||
@Reference(cardinality = ReferenceCardinality.MANDATORY)
|
||||
protected CoreService coreService;
|
||||
|
||||
// Our application ID
|
||||
private static ApplicationId appId;
|
||||
|
||||
// Register to receive PIM packets, used to send packets as well
|
||||
@Reference(cardinality = ReferenceCardinality.MANDATORY)
|
||||
protected PacketService packetService;
|
||||
@ -75,7 +72,7 @@ public class PimApplication {
|
||||
@Activate
|
||||
public void activate() {
|
||||
// Get our application ID
|
||||
appId = coreService.registerApplication("org.onosproject.pim");
|
||||
ApplicationId appId = coreService.registerApplication("org.onosproject.pim");
|
||||
|
||||
// Build the traffic selector for PIM packets
|
||||
TrafficSelector.Builder selector = DefaultTrafficSelector.builder();
|
||||
|
@ -22,5 +22,5 @@ import org.onosproject.event.Event;
|
||||
*/
|
||||
@FunctionalInterface
|
||||
public interface EventHintSupplier {
|
||||
String apply(Event event) throws Throwable;
|
||||
String apply(Event event);
|
||||
}
|
||||
|
@ -16,6 +16,7 @@
|
||||
package org.onosproject.workflow.api;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.Objects;
|
||||
import java.util.PriorityQueue;
|
||||
import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
@ -212,6 +213,24 @@ public class TimerChain {
|
||||
return date().compareTo(target.date());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
if (!(o instanceof TimerChainTask)) {
|
||||
return false;
|
||||
}
|
||||
TimerChainTask that = (TimerChainTask) o;
|
||||
|
||||
return this.date().equals(that.date());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(date);
|
||||
}
|
||||
|
||||
/**
|
||||
* Copies timer chain task.
|
||||
* @return timer chain task
|
||||
|
@ -259,7 +259,7 @@ public class WorkFlowEngine extends AbstractListenerManager<WorkflowDataEvent, W
|
||||
log.info("sleep {}", i);
|
||||
Thread.sleep(10L * (i + 1));
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
Thread.currentThread().interrupt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -167,7 +167,7 @@ public class SampleWorkflow {
|
||||
try {
|
||||
Thread.sleep(ms);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
Thread.currentThread().interrupt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -436,7 +436,7 @@ public class OltPipeline extends AbstractHandlerBehaviour implements Pipeliner {
|
||||
|
||||
Criterion metadata = Criteria.matchMetadata((cvid << 32) | outPort);
|
||||
|
||||
if (outerVlan == null || innerVlan == null || inport == null) {
|
||||
if (outerVlan == null || inport == null) {
|
||||
log.error("Forwarding objective is underspecified: {}", fwd);
|
||||
fail(fwd, ObjectiveError.BADPARAMS);
|
||||
return;
|
||||
|
@ -352,7 +352,7 @@ public class P4RuntimeActionGroupProgrammable
|
||||
groupMirror.annotations(handle).value(MAX_MEM_SIZE) != null) {
|
||||
maxMemSize = groupMirror.annotations(handle).value(MAX_MEM_SIZE);
|
||||
}
|
||||
if (maxMemSize == "" || currentMemberSize > Integer.parseInt(maxMemSize)) {
|
||||
if (!maxMemSize.equals("") || currentMemberSize > Integer.parseInt(maxMemSize)) {
|
||||
deleteGroup(group, handle);
|
||||
}
|
||||
}
|
||||
|
@ -83,7 +83,7 @@ public class GrpcChannelControllerImpl implements GrpcChannelController {
|
||||
private static final boolean DEFAULT_LOG_LEVEL = false;
|
||||
|
||||
/** Indicates whether to log all gRPC messages sent and received on all channels. */
|
||||
public static boolean enableMessageLog = DEFAULT_LOG_LEVEL;
|
||||
private static boolean enableMessageLog = DEFAULT_LOG_LEVEL;
|
||||
|
||||
private final Logger log = LoggerFactory.getLogger(getClass());
|
||||
|
||||
|
@ -59,11 +59,11 @@ public class LispAsAddress extends LispAfiAddress {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!super.equals(obj)) {
|
||||
if (obj == null || getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (getClass() != obj.getClass()) {
|
||||
if (!super.equals(obj)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -28,13 +28,13 @@ import java.util.Map;
|
||||
public class EAPOLMkpdu extends BasePacket {
|
||||
|
||||
// Parameter Sets.
|
||||
protected Map<Byte, IPacket> parameterSets = new LinkedHashMap<>();
|
||||
private Map<Byte, IPacket> parameterSets = new LinkedHashMap<>();
|
||||
|
||||
/*
|
||||
* Parameter Serialization Order.
|
||||
* IEEE 802.1x Clause 11.11.3.
|
||||
*/
|
||||
public static byte[] parametersetSerializerKeyList = new byte[]{
|
||||
private static byte[] parametersetSerializerKeyList = new byte[]{
|
||||
EAPOLMkpduParameterSet.PARAMETERSET_TYPE_BASIC,
|
||||
EAPOLMkpduParameterSet.PARAMETERSET_TYPE_LIVE_PEER_LIST,
|
||||
EAPOLMkpduParameterSet.PARAMETERSET_TYPE_POTENTIAL_PEER_LIST,
|
||||
@ -47,7 +47,7 @@ public class EAPOLMkpdu extends BasePacket {
|
||||
|
||||
// Various Parameter Set Deserializers.
|
||||
|
||||
public static final Map<Byte, Deserializer<? extends IPacket>> PARAMETERSET_DESERIALIZER_MAP =
|
||||
private static final Map<Byte, Deserializer<? extends IPacket>> PARAMETERSET_DESERIALIZER_MAP =
|
||||
new LinkedHashMap<>();
|
||||
|
||||
static {
|
||||
|
@ -47,12 +47,12 @@ public class EAPOLMkpduPeerListParameterSet extends BasePacket implements EAPOLM
|
||||
}
|
||||
|
||||
// Peer List Types
|
||||
public static byte peerListTypeLive = 1;
|
||||
public static byte peerListTypePotential = 2;
|
||||
private static final byte PEER_LIST_TYPE_LIVE = 1;
|
||||
private static final byte PEER_LIST_TYPE_POTENTIAL = 2;
|
||||
|
||||
// Type for distinguishing Live & Potential Lists.
|
||||
protected byte peerListType = 1;
|
||||
protected short bodyLength;
|
||||
private byte peerListType = 1;
|
||||
private short bodyLength;
|
||||
|
||||
//Members
|
||||
protected List<MemberDetails> members = new ArrayList<>();
|
||||
@ -146,8 +146,8 @@ public class EAPOLMkpduPeerListParameterSet extends BasePacket implements EAPOLM
|
||||
* and potential peer lists
|
||||
*/
|
||||
public void setPeerListType(byte peerListType) {
|
||||
if ((peerListType != EAPOLMkpduPeerListParameterSet.peerListTypeLive) &&
|
||||
(peerListType != EAPOLMkpduPeerListParameterSet.peerListTypePotential)) {
|
||||
if ((peerListType != EAPOLMkpduPeerListParameterSet.PEER_LIST_TYPE_LIVE) &&
|
||||
(peerListType != EAPOLMkpduPeerListParameterSet.PEER_LIST_TYPE_POTENTIAL)) {
|
||||
throw new IllegalArgumentException("Unknown PeerList Type specified.");
|
||||
}
|
||||
this.peerListType = peerListType;
|
||||
|
Loading…
x
Reference in New Issue
Block a user