Skip to content

Commit 8385d18

Browse files
vishnoianilGerrit Code Review
authored andcommitted
Merge changes I400fdd74,I18d70f22,Icc83aef3,I3a67dc87,I05b3e988
* changes: Make two classes _static_ inner classes, as recommended by FindBugs Suppress FindBugs null analysis warning in FlowDescriptorDtoTest Suppress FindBugs concurrency warning which is wrong Fix FindBugs null analysis problems due to wrong @nullable Fix FindBugs level "Scariest" problem in SalAsyncConfigServiceImplTest
2 parents 4b4efb7 + 96a4a4e commit 8385d18

File tree

8 files changed

+32
-30
lines changed

8 files changed

+32
-30
lines changed

openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/connection/ConnectionContextImpl.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public class ConnectionContextImpl implements ConnectionContext {
4848
private OutboundQueueHandlerRegistration<OutboundQueueProvider> outboundQueueHandlerRegistration;
4949
private HandshakeContext handshakeContext;
5050
private DeviceInfo deviceInfo;
51-
private List<PortStatusMessage> portStatusMessages = new ArrayList<>();
51+
private final List<PortStatusMessage> portStatusMessages = new ArrayList<>();
5252

5353
/**
5454
* Constructor.
@@ -288,7 +288,7 @@ public int hashCode() {
288288
return result;
289289
}
290290

291-
private class DeviceInfoImpl implements DeviceInfo {
291+
private static class DeviceInfoImpl implements DeviceInfo {
292292

293293
private final NodeId nodeId;
294294
private final KeyedInstanceIdentifier<Node, NodeKey> nodeII;
@@ -348,10 +348,10 @@ public boolean equals(Object object) {
348348

349349
DeviceInfoImpl that = (DeviceInfoImpl) object;
350350

351-
return (nodeId.equals(that.nodeId)
351+
return nodeId.equals(that.nodeId)
352352
&& nodeII.equals(that.nodeII)
353353
&& version.equals(that.version)
354-
&& datapathId.equals(that.datapathId));
354+
&& datapathId.equals(that.datapathId);
355355

356356
}
357357

openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/statistics/ofpspecific/EventsTimeCounter.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
package org.opendaylight.openflowplugin.impl.statistics.ofpspecific;
1010

11+
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
1112
import java.util.ArrayList;
1213
import java.util.HashMap;
1314
import java.util.List;
@@ -84,6 +85,7 @@ public synchronized void markStart() {
8485
delta = System.nanoTime();
8586
}
8687

88+
@SuppressFBWarnings("VO_VOLATILE_INCREMENT") // counter++ is volatile, but this is synchronized, so OK
8789
public synchronized void markEnd() {
8890
if (0 == delta) {
8991
return;
@@ -97,7 +99,7 @@ public synchronized void markEnd() {
9799
if (delta > maximum) {
98100
maximum = delta;
99101
}
100-
if (average > 0 && delta > (average * 1.8)) {
102+
if (average > 0 && delta > average * 1.8) {
101103
summary += average;
102104
} else {
103105
summary += delta;

openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/translator/TranslatorLibraryBuilder.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public TranslatorLibrary build() {
2828
return new TranslatorLibraryImpl(translators);
2929
}
3030

31-
private final class TranslatorLibraryImpl implements TranslatorLibrary {
31+
private static final class TranslatorLibraryImpl implements TranslatorLibrary {
3232
private final Map<TranslatorKey, MessageTranslator<?, ?>> translators;
3333

3434
TranslatorLibraryImpl(final Map<TranslatorKey, MessageTranslator<?, ?>> translators) {

openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/util/FlowUtil.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ private FlowUtil() {
138138
* @return batch flow operation output of given type containing list of flow-ids and corresponding success flag
139139
*/
140140
private static <T extends BatchFlowOutputListGrouping> RpcResultBuilder<T> createCumulativeRpcResult(
141-
final @Nullable RpcResult<List<BatchFailedFlowsOutput>> batchFlowsCumulativeResult,
141+
final RpcResult<List<BatchFailedFlowsOutput>> batchFlowsCumulativeResult,
142142
final T batchOutput) {
143143
final RpcResultBuilder<T> resultBld;
144144
if (batchFlowsCumulativeResult.isSuccessful()) {

openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/util/GroupUtil.java

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -150,22 +150,22 @@ public static List<Long> extractGroupActionsSupportBitmap(final List<ActionType>
150150
for (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ActionType supportedActions
151151
: actionsSupported) {
152152
long supportActionBitmap = 0;
153-
supportActionBitmap |= supportedActions.isOFPATOUTPUT() ? (1) : 0;
154-
supportActionBitmap |= supportedActions.isOFPATCOPYTTLOUT() ? (1 << 11) : 0;
155-
supportActionBitmap |= supportedActions.isOFPATCOPYTTLIN() ? (1 << 12) : 0;
156-
supportActionBitmap |= supportedActions.isOFPATSETMPLSTTL() ? (1 << 15) : 0;
157-
supportActionBitmap |= supportedActions.isOFPATDECMPLSTTL() ? (1 << 16) : 0;
158-
supportActionBitmap |= supportedActions.isOFPATPUSHVLAN() ? (1 << 17) : 0;
159-
supportActionBitmap |= supportedActions.isOFPATPOPVLAN() ? (1 << 18) : 0;
160-
supportActionBitmap |= supportedActions.isOFPATPUSHMPLS() ? (1 << 19) : 0;
161-
supportActionBitmap |= supportedActions.isOFPATPOPMPLS() ? (1 << 20) : 0;
162-
supportActionBitmap |= supportedActions.isOFPATSETQUEUE() ? (1 << 21) : 0;
163-
supportActionBitmap |= supportedActions.isOFPATGROUP() ? (1 << 22) : 0;
164-
supportActionBitmap |= supportedActions.isOFPATSETNWTTL() ? (1 << 23) : 0;
165-
supportActionBitmap |= supportedActions.isOFPATDECNWTTL() ? (1 << 24) : 0;
166-
supportActionBitmap |= supportedActions.isOFPATSETFIELD() ? (1 << 25) : 0;
167-
supportActionBitmap |= supportedActions.isOFPATPUSHPBB() ? (1 << 26) : 0;
168-
supportActionBitmap |= supportedActions.isOFPATPOPPBB() ? (1 << 27) : 0;
153+
supportActionBitmap |= supportedActions.isOFPATOUTPUT() ? 1 : 0;
154+
supportActionBitmap |= supportedActions.isOFPATCOPYTTLOUT() ? 1 << 11 : 0;
155+
supportActionBitmap |= supportedActions.isOFPATCOPYTTLIN() ? 1 << 12 : 0;
156+
supportActionBitmap |= supportedActions.isOFPATSETMPLSTTL() ? 1 << 15 : 0;
157+
supportActionBitmap |= supportedActions.isOFPATDECMPLSTTL() ? 1 << 16 : 0;
158+
supportActionBitmap |= supportedActions.isOFPATPUSHVLAN() ? 1 << 17 : 0;
159+
supportActionBitmap |= supportedActions.isOFPATPOPVLAN() ? 1 << 18 : 0;
160+
supportActionBitmap |= supportedActions.isOFPATPUSHMPLS() ? 1 << 19 : 0;
161+
supportActionBitmap |= supportedActions.isOFPATPOPMPLS() ? 1 << 20 : 0;
162+
supportActionBitmap |= supportedActions.isOFPATSETQUEUE() ? 1 << 21 : 0;
163+
supportActionBitmap |= supportedActions.isOFPATGROUP() ? 1 << 22 : 0;
164+
supportActionBitmap |= supportedActions.isOFPATSETNWTTL() ? 1 << 23 : 0;
165+
supportActionBitmap |= supportedActions.isOFPATDECNWTTL() ? 1 << 24 : 0;
166+
supportActionBitmap |= supportedActions.isOFPATSETFIELD() ? 1 << 25 : 0;
167+
supportActionBitmap |= supportedActions.isOFPATPUSHPBB() ? 1 << 26 : 0;
168+
supportActionBitmap |= supportedActions.isOFPATPOPPBB() ? 1 << 27 : 0;
169169
supportActionByGroups.add(supportActionBitmap);
170170
}
171171
return supportActionByGroups;
@@ -213,7 +213,6 @@ public RpcResult<T> apply(@Nullable final Pair<RpcResult<T>, RpcResult<Void>> in
213213
* @return batch group operation output of given type containing list of group-ids and corresponding success flag
214214
*/
215215
private static <T extends BatchGroupOutputListGrouping> RpcResultBuilder<T> createCumulativeRpcResult(
216-
@Nullable
217216
final RpcResult<List<BatchFailedGroupsOutput>> batchGroupsCumulativeResult, final T batchOutput) {
218217
final RpcResultBuilder<T> resultBld;
219218
if (batchGroupsCumulativeResult.isSuccessful()) {

openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/util/MeterUtil.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ public RpcResult<T> apply(@Nullable final Pair<RpcResult<T>, RpcResult<Void>> in
182182
*/
183183
private static <T extends BatchMeterOutputListGrouping>
184184
RpcResultBuilder<T> createCumulativeRpcResult(
185-
final @Nullable RpcResult<List<BatchFailedMetersOutput>> batchMetersCumulativeResult,
185+
final RpcResult<List<BatchFailedMetersOutput>> batchMetersCumulativeResult,
186186
final T batchOutput) {
187187
final RpcResultBuilder<T> resultBld;
188188
if (batchMetersCumulativeResult.isSuccessful()) {

openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/registry/flow/FlowDescriptorDtoTest.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
package org.opendaylight.openflowplugin.impl.registry.flow;
1010

11+
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
1112
import org.junit.Assert;
1213
import org.junit.Test;
1314
import org.opendaylight.openflowplugin.api.openflow.registry.flow.FlowDescriptor;
@@ -27,7 +28,8 @@ public void testCreate() throws Exception {
2728
}
2829

2930
@Test(expected = Exception.class)
31+
@SuppressFBWarnings("NP_NONNULL_PARAM_VIOLATION") // that is the point of this test
3032
public void testCreateNegative1() throws Exception {
3133
FlowDescriptorFactory.create((short) 1, null);
3234
}
33-
}
35+
}

openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/services/sal/SalAsyncConfigServiceImplTest.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
import com.google.common.util.concurrent.ListenableFuture;
1616
import java.util.concurrent.Future;
1717
import org.junit.Assert;
18-
import org.junit.Before;
1918
import org.junit.Test;
2019
import org.junit.runner.RunWith;
2120
import org.mockito.Matchers;
@@ -39,8 +38,8 @@ public class SalAsyncConfigServiceImplTest extends ServiceMocking {
3938

4039
private SalAsyncConfigServiceImpl salAsyncConfigService;
4140

42-
@Before
43-
public void setUp() throws Exception {
41+
@Override
42+
public void setup() throws Exception {
4443
salAsyncConfigService = new SalAsyncConfigServiceImpl(
4544
mockedRequestContextStack, mockedDeviceContext);
4645
}
@@ -79,4 +78,4 @@ public void testGetAsyncTest() throws Exception {
7978
verify(mockedOutboundQueue).commitEntry(Matchers.eq(ServiceMocking.DUMMY_XID_VALUE),
8079
Matchers.<OfHeader>any(), Matchers.<FutureCallback<OfHeader>>any());
8180
}
82-
}
81+
}

0 commit comments

Comments
 (0)