From: Michael Vorburger Date: Fri, 3 Feb 2017 10:58:51 +0000 (+0100) Subject: sal-distributed-datastore Checkstyle fixes (for next version) X-Git-Tag: release/carbon~265 X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=commitdiff_plain;h=b66d5a3c59525a1c7885c3d653d9657a99f4103d sal-distributed-datastore Checkstyle fixes (for next version) Even though sal-distributed-datastore currentla already has CS enforcement, these violations don't show up in the build, but I see them as red in Eclipse; I think this must be becaues the CS version used in the Eclipse plugin-in is more recent than the CS used in odlparent, and one of the existing activated checks got a little more stringent. Cleaning this up thus helps both to (a) not have read in Eclipse; (b) pave the way to upgrade Checkstyle in odlparent some day. Change-Id: Ib5649a95a1b26b5791f2c3f3f83924b569f965a2 Signed-off-by: Michael Vorburger --- diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/databroker/AbstractDOMBrokerTransaction.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/databroker/AbstractDOMBrokerTransaction.java index d033785588..800460c712 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/databroker/AbstractDOMBrokerTransaction.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/databroker/AbstractDOMBrokerTransaction.java @@ -61,7 +61,7 @@ public abstract class AbstractDOMBrokerTransaction future; do { future = commitFuture; - } while (future == null); + } + while (future == null); return future.cancel(false); } diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/databroker/actors/dds/AbstractClientHistory.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/databroker/actors/dds/AbstractClientHistory.java index 47283843d4..03d2a0377f 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/databroker/actors/dds/AbstractClientHistory.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/databroker/actors/dds/AbstractClientHistory.java @@ -134,8 +134,8 @@ abstract class AbstractClientHistory extends LocalAbortable implements Identifia return ret; } - abstract ProxyHistory createHistoryProxy(final LocalHistoryIdentifier historyId, - final AbstractClientConnection connection); + abstract ProxyHistory createHistoryProxy(LocalHistoryIdentifier historyId, + AbstractClientConnection connection); private void createHistoryCallback(final Response response) { LOG.debug("Create history response {}", response); diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/databroker/actors/dds/AbstractDataStoreClientBehavior.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/databroker/actors/dds/AbstractDataStoreClientBehavior.java index 9af88a8a5a..ef5590fe84 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/databroker/actors/dds/AbstractDataStoreClientBehavior.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/databroker/actors/dds/AbstractDataStoreClientBehavior.java @@ -215,5 +215,5 @@ abstract class AbstractDataStoreClientBehavior extends ClientActorBehavior data); + abstract void doMerge(YangInstanceIdentifier path, NormalizedNode data); - abstract void doWrite(final YangInstanceIdentifier path, final NormalizedNode data); + abstract void doWrite(YangInstanceIdentifier path, NormalizedNode data); - abstract CheckedFuture doExists(final YangInstanceIdentifier path); + abstract CheckedFuture doExists(YangInstanceIdentifier path); - abstract CheckedFuture>, ReadFailedException> doRead( - final YangInstanceIdentifier path); + abstract CheckedFuture>, ReadFailedException> doRead(YangInstanceIdentifier path); abstract void doSeal(); diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/AbstractFrontendHistory.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/AbstractFrontendHistory.java index 7c2ddb05b2..d7e3c6533f 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/AbstractFrontendHistory.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/AbstractFrontendHistory.java @@ -106,5 +106,5 @@ abstract class AbstractFrontendHistory implements Identifiable handleRequest(final TransactionRequest request, - final RequestEnvelope envelope, final long now) throws RequestException; + abstract @Nullable TransactionSuccess handleRequest(TransactionRequest request, + RequestEnvelope envelope, long now) throws RequestException; private void recordResponse(final long sequence, final Object response) { if (replayQueue.isEmpty()) { diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/Shard.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/Shard.java index d5d129f221..b3dc07b0e5 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/Shard.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/Shard.java @@ -259,7 +259,7 @@ public class Shard extends RaftActor { @SuppressWarnings("checkstyle:IllegalCatch") @Override protected void handleNonRaftCommand(final Object message) { - try (final MessageTracker.Context context = appendEntriesReplyTracker.received(message)) { + try (MessageTracker.Context context = appendEntriesReplyTracker.received(message)) { final Optional maybeError = context.error(); if (maybeError.isPresent()) { LOG.trace("{} : AppendEntriesReply failed to arrive at the expected interval {}", persistenceId(), diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ShardDataChangeListenerPublisher.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ShardDataChangeListenerPublisher.java index 291cca0313..87a0c8d64b 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ShardDataChangeListenerPublisher.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ShardDataChangeListenerPublisher.java @@ -22,5 +22,5 @@ interface ShardDataChangeListenerPublisher extends ShardDataTreeNotificationPubl ShardDataChangeListenerPublisher newInstance(); >> DataChangeListenerRegistration - registerDataChangeListener(final YangInstanceIdentifier path,final L listener, final DataChangeScope scope); + registerDataChangeListener(YangInstanceIdentifier path, L listener, DataChangeScope scope); } diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ShardDataTreeNotificationPublisher.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ShardDataTreeNotificationPublisher.java index e51b81cc94..30b7eaf2ae 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ShardDataTreeNotificationPublisher.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ShardDataTreeNotificationPublisher.java @@ -18,5 +18,5 @@ import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidate; interface ShardDataTreeNotificationPublisher { long PUBLISH_DELAY_THRESHOLD_IN_MS = TimeUnit.MILLISECONDS.convert(1, TimeUnit.SECONDS); - void publishChanges(final DataTreeCandidate candidate, String logContext); + void publishChanges(DataTreeCandidate candidate, String logContext); } diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/persisted/AbstractVersionedShardDataTreeSnapshot.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/persisted/AbstractVersionedShardDataTreeSnapshot.java index 1d9b58f270..190c815dd3 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/persisted/AbstractVersionedShardDataTreeSnapshot.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/persisted/AbstractVersionedShardDataTreeSnapshot.java @@ -35,7 +35,7 @@ abstract class AbstractVersionedShardDataTreeSnapshot extends ShardDataTreeSnaps switch (version) { case BORON: // Boron snapshots use Java Serialization - try (final ObjectInputStream ois = new ObjectInputStream(is)) { + try (ObjectInputStream ois = new ObjectInputStream(is)) { return (ShardDataTreeSnapshot) ois.readObject(); } catch (ClassNotFoundException e) { LOG.error("Failed to serialize data tree snapshot", e); @@ -94,7 +94,7 @@ abstract class AbstractVersionedShardDataTreeSnapshot extends ShardDataTreeSnaps @Override public void serialize(final OutputStream os) throws IOException { - try (final DataOutputStream dos = new DataOutputStream(os)) { + try (DataOutputStream dos = new DataOutputStream(os)) { final PayloadVersion version = version(); version.writeTo(dos); versionedSerialize(dos, version); diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/persisted/DataTreeCandidateInputOutput.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/persisted/DataTreeCandidateInputOutput.java index b8cf731b94..c2a873331d 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/persisted/DataTreeCandidateInputOutput.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/persisted/DataTreeCandidateInputOutput.java @@ -174,7 +174,7 @@ public final class DataTreeCandidateInputOutput { } public static void writeDataTreeCandidate(final DataOutput out, DataTreeCandidate candidate) throws IOException { - try (final NormalizedNodeDataOutput writer = NormalizedNodeInputOutput.newDataOutput(out)) { + try (NormalizedNodeDataOutput writer = NormalizedNodeInputOutput.newDataOutput(out)) { writer.writeYangInstanceIdentifier(candidate.getRootPath()); final DataTreeCandidateNode node = candidate.getRootNode(); diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/persisted/ShardDataTreeSnapshot.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/persisted/ShardDataTreeSnapshot.java index 7b8382e9c2..e82ddb6d76 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/persisted/ShardDataTreeSnapshot.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/persisted/ShardDataTreeSnapshot.java @@ -50,7 +50,7 @@ public abstract class ShardDataTreeSnapshot { } try { - try (final InputStream is = new ByteArrayInputStream(bytes)) { + try (InputStream is = new ByteArrayInputStream(bytes)) { return deserialize(is); } } catch (IOException e) { @@ -60,7 +60,7 @@ public abstract class ShardDataTreeSnapshot { } public static ShardDataTreeSnapshot deserialize(final InputStream is) throws IOException { - try (final DataInputStream dis = new DataInputStream(is)) { + try (DataInputStream dis = new DataInputStream(is)) { final ShardDataTreeSnapshot ret = AbstractVersionedShardDataTreeSnapshot.deserialize(dis); // Make sure we consume all bytes, otherwise something went very wrong @@ -81,7 +81,7 @@ public abstract class ShardDataTreeSnapshot { */ public abstract Optional> getRootNode(); - public abstract void serialize(final OutputStream os) throws IOException; + public abstract void serialize(OutputStream os) throws IOException; @Deprecated private static boolean isLegacyStream(final byte[] bytes) { diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/DataTreeCohortIntegrationTest.java b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/DataTreeCohortIntegrationTest.java index 0352db6f76..20ecb0c578 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/DataTreeCohortIntegrationTest.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/DataTreeCohortIntegrationTest.java @@ -86,7 +86,7 @@ public class DataTreeCohortIntegrationTest { ArgumentCaptor candidateCapt = ArgumentCaptor.forClass(DOMDataTreeCandidate.class); new IntegrationTestKit(getSystem(), datastoreContextBuilder) { { - try (final AbstractDataStore dataStore = setupDistributedDataStore("transactionIntegrationTest", + try (AbstractDataStore dataStore = setupDistributedDataStore("transactionIntegrationTest", "test-1")) { final ObjectRegistration cohortReg = dataStore.registerCommitCohort(TEST_ID, cohort); @@ -122,7 +122,7 @@ public class DataTreeCohortIntegrationTest { new IntegrationTestKit(getSystem(), datastoreContextBuilder) { { - try (final AbstractDataStore dataStore = + try (AbstractDataStore dataStore = setupDistributedDataStore("transactionIntegrationTest", "test-1")) { dataStore.registerCommitCohort(TEST_ID, failedCohort); Thread.sleep(1000); // Registration is asynchronous @@ -157,7 +157,7 @@ public class DataTreeCohortIntegrationTest { Mockito.doReturn(ThreePhaseCommitStep.NOOP_ABORT_FUTURE).when(stepToAbort).abort(); new IntegrationTestKit(getSystem(), datastoreContextBuilder) { { - try (final AbstractDataStore dataStore = + try (AbstractDataStore dataStore = setupDistributedDataStore("transactionIntegrationTest", "test-1")) { dataStore.registerCommitCohort(TEST_ID, cohortToAbort); Thread.sleep(1000); // Registration is asynchronous diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/DistributedDataStoreIntegrationTest.java b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/DistributedDataStoreIntegrationTest.java index 1b885c467f..f8a70816d7 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/DistributedDataStoreIntegrationTest.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/DistributedDataStoreIntegrationTest.java @@ -685,7 +685,7 @@ public class DistributedDataStoreIntegrationTest { // Create the write Tx. - try (final DOMStoreWriteTransaction writeTx = writeOnly ? dataStore.newWriteOnlyTransaction() + try (DOMStoreWriteTransaction writeTx = writeOnly ? dataStore.newWriteOnlyTransaction() : dataStore.newReadWriteTransaction()) { assertNotNull("newReadWriteTransaction returned null", writeTx); diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/DistributedDataStoreTest.java b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/DistributedDataStoreTest.java index 923ec5a01c..8a4069e2e6 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/DistributedDataStoreTest.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/DistributedDataStoreTest.java @@ -106,7 +106,7 @@ public class DistributedDataStoreTest extends AbstractActorTest { @Test public void testWaitTillReadyCountDown() { - try (final DistributedDataStore distributedDataStore = new DistributedDataStore(actorContext, UNKNOWN_ID)) { + try (DistributedDataStore distributedDataStore = new DistributedDataStore(actorContext, UNKNOWN_ID)) { doReturn(datastoreContext).when(actorContext).getDatastoreContext(); doReturn(shardElectionTimeout).when(datastoreContext).getShardLeaderElectionTimeout(); doReturn(FiniteDuration.apply(5000, TimeUnit.MILLISECONDS)).when(shardElectionTimeout).duration();