Bug 4035: Fixed some sonar / findbugs issues in DOM MD-SAL. 65/24465/9
authorTony Tkacik <ttkacik@cisco.com>
Thu, 23 Jul 2015 11:11:08 +0000 (13:11 +0200)
committerGerrit Code Review <gerrit@opendaylight.org>
Tue, 18 Aug 2015 18:55:36 +0000 (18:55 +0000)
Change-Id: Id0ab9f65e4f1663f9e6cd85a6235a0a5fdee6f88
Signed-off-by: Tony Tkacik <ttkacik@cisco.com>
12 files changed:
opendaylight/md-sal/sal-dom-api/src/main/java/org/opendaylight/controller/sal/core/api/AbstractConsumer.java
opendaylight/md-sal/sal-dom-api/src/main/java/org/opendaylight/controller/sal/core/api/AbstractProvider.java
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/broker/impl/CommitCoordinationTask.java
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/broker/impl/PingPongDataBroker.java
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/broker/impl/PingPongFuture.java
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/broker/impl/PingPongTransactionChain.java
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/broker/impl/ShardedDOMDataTree.java
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/broker/impl/ShardedDOMDataTreeProducer.java
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/broker/impl/TransactionCommitFailedExceptionMapper.java
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/BrokerImpl.java
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/impl/SchemaContextProviders.java
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/osgi/ProxyFactory.java

index c14d5a679cf8c2f8bcb2172f520273fac160ea50..12c26a98564ee35a8594e01edeb58bc4cdcf351a 100644 (file)
@@ -9,7 +9,6 @@ package org.opendaylight.controller.sal.core.api;
 
 import java.util.Collection;
 import java.util.Collections;
-
 import org.osgi.framework.BundleActivator;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.ServiceReference;
@@ -18,15 +17,12 @@ import org.osgi.util.tracker.ServiceTrackerCustomizer;
 
 public abstract class AbstractConsumer implements Consumer, BundleActivator,ServiceTrackerCustomizer<Broker, Broker> {
 
-
-
-
     private BundleContext context;
     private ServiceTracker<Broker, Broker> tracker;
     private Broker broker;
 
     @Override
-    public final void start(BundleContext context) throws Exception {
+    public final void start(final BundleContext context) throws Exception {
         this.context = context;
         this.startImpl(context);
         tracker = new ServiceTracker<>(context, Broker.class, this);
@@ -36,16 +32,16 @@ public abstract class AbstractConsumer implements Consumer, BundleActivator,Serv
 
 
     @Override
-    public final void stop(BundleContext context) throws Exception {
+    public final void stop(final BundleContext context) throws Exception {
         stopImpl(context);
         broker = null;
         tracker.close();
     }
 
-    protected void startImpl(BundleContext context) {
+    protected void startImpl(final BundleContext context) {
         // NOOP
     }
-    protected void stopImpl(BundleContext context) {
+    protected void stopImpl(final BundleContext context) {
         // NOOP
     }
 
@@ -56,7 +52,7 @@ public abstract class AbstractConsumer implements Consumer, BundleActivator,Serv
 
 
     @Override
-    public Broker addingService(ServiceReference<Broker> reference) {
+    public Broker addingService(final ServiceReference<Broker> reference) {
         if(broker == null) {
             broker = context.getService(reference);
             broker.registerConsumer(this, context);
@@ -67,12 +63,12 @@ public abstract class AbstractConsumer implements Consumer, BundleActivator,Serv
     }
 
     @Override
-    public void modifiedService(ServiceReference<Broker> reference, Broker service) {
+    public void modifiedService(final ServiceReference<Broker> reference, final Broker service) {
         // NOOP
     }
 
     @Override
-    public void removedService(ServiceReference<Broker> reference, Broker service) {
+    public void removedService(final ServiceReference<Broker> reference, final Broker service) {
         stopImpl(context);
     }
 }
index 22b0bf25cf9b65958131ace905b0176d351f4147..e300279d7b431ef02bbbed600852631c349df234 100644 (file)
@@ -9,7 +9,6 @@ package org.opendaylight.controller.sal.core.api;
 
 import java.util.Collection;
 import java.util.Collections;
-
 import org.osgi.framework.BundleActivator;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.ServiceReference;
@@ -21,28 +20,29 @@ public abstract class AbstractProvider implements BundleActivator, Provider,Serv
     private Broker broker;
     private BundleContext context;
     private ServiceTracker<Broker, Broker> tracker;
+
     @Override
     public Collection<ProviderFunctionality> getProviderFunctionality() {
         return Collections.emptySet();
     }
 
     @Override
-    public final void start(BundleContext context) throws Exception {
+    public final void start(final BundleContext context) throws Exception {
         this.context = context;
         this.startImpl(context);
         tracker = new ServiceTracker<>(context, Broker.class, this);
         tracker.open();
     }
 
-    protected void startImpl(BundleContext context) {
+    protected void startImpl(final BundleContext context) {
         // NOOP
     }
-    protected void stopImpl(BundleContext context) {
+    protected void stopImpl(final BundleContext context) {
         // NOOP
     }
 
     @Override
-    public final void stop(BundleContext context) throws Exception {
+    public final void stop(final BundleContext context) throws Exception {
         broker = null;
         tracker.close();
         tracker = null;
@@ -50,7 +50,7 @@ public abstract class AbstractProvider implements BundleActivator, Provider,Serv
     }
 
     @Override
-    public Broker addingService(ServiceReference<Broker> reference) {
+    public Broker addingService(final ServiceReference<Broker> reference) {
         if(broker == null) {
             broker = context.getService(reference);
             broker.registerProvider(this, context);
@@ -61,12 +61,12 @@ public abstract class AbstractProvider implements BundleActivator, Provider,Serv
     }
 
     @Override
-    public void modifiedService(ServiceReference<Broker> reference, Broker service) {
+    public void modifiedService(final ServiceReference<Broker> reference, final Broker service) {
         // NOOP
     }
 
     @Override
-    public void removedService(ServiceReference<Broker> reference, Broker service) {
+    public void removedService(final ServiceReference<Broker> reference, final Broker service) {
         stopImpl(context);
     }
 
index a644f4d28369fd52d5cc9c8509dcf290c79c6acf..da7a0d19f0a8df00810dc5ec641359c71cdadc35 100644 (file)
@@ -31,7 +31,7 @@ final class CommitCoordinationTask implements Callable<Void> {
         canCommit,
         preCommit,
         doCommit,
-    };
+    }
 
     private static final Logger LOG = LoggerFactory.getLogger(CommitCoordinationTask.class);
     private final Collection<DOMStoreThreePhaseCommitCohort> cohorts;
@@ -66,7 +66,7 @@ final class CommitCoordinationTask implements Callable<Void> {
 
             LOG.debug("Transaction {}: doCommit completed", tx.getIdentifier());
             return null;
-        } catch (TransactionCommitFailedException e) {
+        } catch (final TransactionCommitFailedException e) {
             LOG.warn("Tx: {} Error during phase {}, starting Abort", tx.getIdentifier(), phase, e);
             abortBlocking(e);
             throw e;
@@ -90,7 +90,7 @@ final class CommitCoordinationTask implements Callable<Void> {
      *
      */
     private void canCommitBlocking() throws TransactionCommitFailedException {
-        for (ListenableFuture<?> canCommit : canCommitAll()) {
+        for (final ListenableFuture<?> canCommit : canCommitAll()) {
             try {
                 final Boolean result = (Boolean)canCommit.get();
                 if (result == null || !result) {
@@ -117,7 +117,7 @@ final class CommitCoordinationTask implements Callable<Void> {
     private ListenableFuture<?>[] canCommitAll() {
         final ListenableFuture<?>[] ops = new ListenableFuture<?>[cohorts.size()];
         int i = 0;
-        for (DOMStoreThreePhaseCommitCohort cohort : cohorts) {
+        for (final DOMStoreThreePhaseCommitCohort cohort : cohorts) {
             ops[i++] = cohort.canCommit();
         }
         return ops;
@@ -139,7 +139,7 @@ final class CommitCoordinationTask implements Callable<Void> {
     private void preCommitBlocking() throws TransactionCommitFailedException {
         final ListenableFuture<?>[] preCommitFutures = preCommitAll();
         try {
-            for(ListenableFuture<?> future : preCommitFutures) {
+            for(final ListenableFuture<?> future : preCommitFutures) {
                 future.get();
             }
         } catch (InterruptedException | ExecutionException e) {
@@ -164,7 +164,7 @@ final class CommitCoordinationTask implements Callable<Void> {
     private ListenableFuture<?>[] preCommitAll() {
         final ListenableFuture<?>[] ops = new ListenableFuture<?>[cohorts.size()];
         int i = 0;
-        for (DOMStoreThreePhaseCommitCohort cohort : cohorts) {
+        for (final DOMStoreThreePhaseCommitCohort cohort : cohorts) {
             ops[i++] = cohort.preCommit();
         }
         return ops;
@@ -185,7 +185,7 @@ final class CommitCoordinationTask implements Callable<Void> {
     private void commitBlocking() throws TransactionCommitFailedException {
         final ListenableFuture<?>[] commitFutures = commitAll();
         try {
-            for(ListenableFuture<?> future : commitFutures) {
+            for(final ListenableFuture<?> future : commitFutures) {
                 future.get();
             }
         } catch (InterruptedException | ExecutionException e) {
@@ -207,7 +207,7 @@ final class CommitCoordinationTask implements Callable<Void> {
     private ListenableFuture<?>[] commitAll() {
         final ListenableFuture<?>[] ops = new ListenableFuture<?>[cohorts.size()];
         int i = 0;
-        for (DOMStoreThreePhaseCommitCohort cohort : cohorts) {
+        for (final DOMStoreThreePhaseCommitCohort cohort : cohorts) {
             ops[i++] = cohort.commit();
         }
         return ops;
@@ -254,11 +254,12 @@ final class CommitCoordinationTask implements Callable<Void> {
      * @return Future which will complete once all cohorts completed
      *         abort.
      */
+    @SuppressWarnings({"unchecked", "rawtypes"})
     private ListenableFuture<Void> abortAsyncAll() {
 
         final ListenableFuture<?>[] ops = new ListenableFuture<?>[cohorts.size()];
         int i = 0;
-        for (DOMStoreThreePhaseCommitCohort cohort : cohorts) {
+        for (final DOMStoreThreePhaseCommitCohort cohort : cohorts) {
             ops[i++] = cohort.abort();
         }
 
@@ -267,8 +268,6 @@ final class CommitCoordinationTask implements Callable<Void> {
          * order to fail composite future if any of them failed.
          * See Futures.allAsList for this description.
          */
-        @SuppressWarnings({ "unchecked", "rawtypes" })
-        ListenableFuture<Void> compositeResult = (ListenableFuture) Futures.allAsList(ops);
-        return compositeResult;
+        return (ListenableFuture) Futures.allAsList(ops);
     }
 }
index b5ec58d54add8151632b955b30fe76f42fde894e..55f8a1557de58d874afcbd4508e2a356b425d629 100644 (file)
@@ -33,7 +33,7 @@ public final class PingPongDataBroker extends ForwardingDOMDataBroker implements
      *
      * @param delegate Backend broker, may not be null.
      */
-    public PingPongDataBroker(final @Nonnull DOMDataBroker delegate) {
+    public PingPongDataBroker(@Nonnull final DOMDataBroker delegate) {
         this.delegate = Preconditions.checkNotNull(delegate);
     }
 
index 611303a41adcfede958c88fb1bb1d8d32304c129..68ef76056af37c187642afcd94d7a43795b895ce 100644 (file)
@@ -12,7 +12,8 @@ import com.google.common.util.concurrent.ListenableFuture;
 import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException;
 
 /**
- * A {@link Future} used to report the status of an future {@link java.util.concurrent.Future}.
+ * A {@link java.util.concurrent.Future} used to report the status of an future
+ * {@link java.util.concurrent.Future}.
  */
 final class PingPongFuture extends AbstractCheckedFuture<Void, TransactionCommitFailedException> {
   protected PingPongFuture(final ListenableFuture<Void> delegate) {
@@ -24,7 +25,7 @@ final class PingPongFuture extends AbstractCheckedFuture<Void, TransactionCommit
     if (e.getCause() instanceof TransactionCommitFailedException){
       return (TransactionCommitFailedException) e.getCause();
     } else {
-      return new TransactionCommitFailedException(e.getMessage(), e.getCause(), null);
+            return new TransactionCommitFailedException(e.getMessage(), e.getCause());
     }
   }
 }
index 9895ff9ad5e87af9901b7ffe03b4a2e82726b307..20e8422800312a0c415a8b182f5a65525c517436 100644 (file)
@@ -178,7 +178,7 @@ public final class PingPongTransactionChain implements DOMTransactionChain {
      * @param tx Transaction which needs processing.
      */
     @GuardedBy("this")
-    private void processTransaction(final @Nonnull PingPongTransaction tx) {
+    private void processTransaction(@Nonnull final PingPongTransaction tx) {
         if (failed) {
             LOG.debug("Cancelling transaction {}", tx);
             tx.getTransaction().cancel();
@@ -226,7 +226,7 @@ public final class PingPongTransactionChain implements DOMTransactionChain {
         tx.onFailure(t);
     }
 
-    private void readyTransaction(final @Nonnull PingPongTransaction tx) {
+    private void readyTransaction(@Nonnull final PingPongTransaction tx) {
         // First mark the transaction as not locked.
         final boolean lockedMatch = LOCKED_UPDATER.compareAndSet(this, tx, null);
         Preconditions.checkState(lockedMatch, "Attempted to submit transaction %s while we have %s", tx, lockedTx);
index c882d5c522f85c4c7675eb33a556f42f0e5b32a0..827baa55dac7786929353430a1b5fd9b433691c9 100644 (file)
@@ -130,7 +130,7 @@ public final class ShardedDOMDataTree implements DOMDataTreeService, DOMDataTree
         for (final DOMDataTreeIdentifier s : producer.getSubtrees()) {
             final DOMDataTreeProducer r = idToProducer.remove(s);
             if (!producer.equals(r)) {
-                LOG.error("Removed producer %s on subtree %s while removing %s", r, s, producer);
+                LOG.error("Removed producer {} on subtree {} while removing {}", r, s, producer);
             }
         }
     }
@@ -139,7 +139,7 @@ public final class ShardedDOMDataTree implements DOMDataTreeService, DOMDataTree
     private DOMDataTreeProducer createProducer(final Map<DOMDataTreeIdentifier, DOMDataTreeShard> shardMap) {
         // Record the producer's attachment points
         final DOMDataTreeProducer ret = ShardedDOMDataTreeProducer.create(this, shardMap);
-        for (final DOMDataTreeIdentifier s : shardMap.keySet()) {
+        for (DOMDataTreeIdentifier s : shardMap.keySet()) {
             idToProducer.put(s, ret);
         }
 
index 9712b25ac9c805d6b85f0b4531656cb01b2fb5ac..9b485df13a95a0b4a9e038c607a016a058a543f8 100644 (file)
@@ -54,13 +54,13 @@ final class ShardedDOMDataTreeProducer implements DOMDataTreeProducer {
         final Builder<DOMDataTreeShard, DOMStoreTransactionChain> cb = ImmutableBiMap.builder();
         final Queue<Exception> es = new LinkedList<>();
 
-        for (DOMDataTreeShard s : shards) {
+        for (final DOMDataTreeShard s : shards) {
             if (s instanceof DOMStore) {
                 try {
                     final DOMStoreTransactionChain c = ((DOMStore)s).createTransactionChain();
                     LOG.trace("Using DOMStore chain {} to access shard {}", c, s);
                     cb.put(s, c);
-                } catch (Exception e) {
+                } catch (final Exception e) {
                     LOG.error("Failed to instantiate chain for shard {}", s, e);
                     es.add(e);
                 }
@@ -72,11 +72,11 @@ final class ShardedDOMDataTreeProducer implements DOMDataTreeProducer {
 
         // An error was encountered, close chains and report the error
         if (shardToChain.size() != shards.size()) {
-            for (DOMStoreTransactionChain c : shardToChain.values()) {
+            for (final DOMStoreTransactionChain c : shardToChain.values()) {
                 try {
                     c.close();
-                } catch (Exception e) {
-                    LOG.warn("Exception raised while closing chain %s", c, e);
+                } catch (final Exception e) {
+                    LOG.warn("Exception raised while closing chain {}", c, e);
                 }
             }
 
@@ -98,13 +98,13 @@ final class ShardedDOMDataTreeProducer implements DOMDataTreeProducer {
 
         // Allocate backing transactions
         final Map<DOMDataTreeShard, DOMStoreWriteTransaction> shardToTx = new HashMap<>();
-        for (Entry<DOMDataTreeShard, DOMStoreTransactionChain> e : shardToChain.entrySet()) {
+        for (final Entry<DOMDataTreeShard, DOMStoreTransactionChain> e : shardToChain.entrySet()) {
             shardToTx.put(e.getKey(), e.getValue().newWriteOnlyTransaction());
         }
 
         // Create the ID->transaction map
         final ImmutableMap.Builder<DOMDataTreeIdentifier, DOMStoreWriteTransaction> b = ImmutableMap.builder();
-        for (Entry<DOMDataTreeIdentifier, DOMDataTreeShard> e : idToShard.entrySet()) {
+        for (final Entry<DOMDataTreeIdentifier, DOMDataTreeShard> e : idToShard.entrySet()) {
             b.put(e.getKey(), shardToTx.get(e.getValue()));
         }
 
@@ -115,7 +115,7 @@ final class ShardedDOMDataTreeProducer implements DOMDataTreeProducer {
 
     @GuardedBy("this")
     private boolean haveSubtree(final DOMDataTreeIdentifier subtree) {
-        for (DOMDataTreeIdentifier i : idToShard.keySet()) {
+        for (final DOMDataTreeIdentifier i : idToShard.keySet()) {
             if (i.contains(subtree)) {
                 return true;
             }
@@ -126,7 +126,7 @@ final class ShardedDOMDataTreeProducer implements DOMDataTreeProducer {
 
     @GuardedBy("this")
     private DOMDataTreeProducer lookupChild(final DOMDataTreeIdentifier s) {
-        for (Entry<DOMDataTreeIdentifier, DOMDataTreeProducer> e : children.entrySet()) {
+        for (final Entry<DOMDataTreeIdentifier, DOMDataTreeProducer> e : children.entrySet()) {
             if (e.getKey().contains(s)) {
                 return e.getValue();
             }
@@ -140,7 +140,7 @@ final class ShardedDOMDataTreeProducer implements DOMDataTreeProducer {
         Preconditions.checkState(!closed, "Producer is already closed");
         Preconditions.checkState(openTx == null, "Transaction %s is still open", openTx);
 
-        for (DOMDataTreeIdentifier s : subtrees) {
+        for (final DOMDataTreeIdentifier s : subtrees) {
             // Check if the subtree was visible at any time
             if (!haveSubtree(s)) {
                 throw new IllegalArgumentException(String.format("Subtree %s was never available in producer %s", s, this));
@@ -151,7 +151,7 @@ final class ShardedDOMDataTreeProducer implements DOMDataTreeProducer {
             Preconditions.checkArgument(child == null, "Subtree %s is delegated to child producer %s", s, child);
 
             // Check if part of the requested subtree is not delegated to a child.
-            for (DOMDataTreeIdentifier c : children.keySet()) {
+            for (final DOMDataTreeIdentifier c : children.keySet()) {
                 if (s.contains(c)) {
                     throw new IllegalArgumentException(String.format("Subtree %s cannot be delegated as it is superset of already-delegated %s", s, c));
                 }
@@ -161,7 +161,7 @@ final class ShardedDOMDataTreeProducer implements DOMDataTreeProducer {
         final DOMDataTreeProducer ret = dataTree.createProducer(this, subtrees);
         final ImmutableMap.Builder<DOMDataTreeIdentifier, DOMDataTreeProducer> cb = ImmutableMap.builder();
         cb.putAll(children);
-        for (DOMDataTreeIdentifier s : subtrees) {
+        for (final DOMDataTreeIdentifier s : subtrees) {
             cb.put(s, ret);
         }
 
index 6958f7a249de54a19b8677218811cc029bd7f3f6..11e2a195d9acffbc0be3e457b79e05db492239ba 100644 (file)
@@ -28,7 +28,7 @@ public final class TransactionCommitFailedExceptionMapper
         super( opName, TransactionCommitFailedException.class );
     }
 
-    public static final TransactionCommitFailedExceptionMapper create(final String opName) {
+    public static TransactionCommitFailedExceptionMapper create(final String opName) {
         return new TransactionCommitFailedExceptionMapper(opName);
     }
 
index 17d8229675376242a5d3c843ee4f198e08eabde3..03fbb18cae31eefbb56d6c8db19e10cc44464bed 100644 (file)
@@ -12,6 +12,11 @@ import com.google.common.base.Preconditions;
 import com.google.common.collect.ClassToInstanceMap;
 import com.google.common.collect.ImmutableClassToInstanceMap;
 import com.google.common.util.concurrent.CheckedFuture;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Set;
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
 import org.opendaylight.controller.md.sal.dom.api.DOMRpcAvailabilityListener;
 import org.opendaylight.controller.md.sal.dom.api.DOMRpcException;
 import org.opendaylight.controller.md.sal.dom.api.DOMRpcIdentifier;
@@ -32,12 +37,6 @@ import org.osgi.framework.BundleContext;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Set;
-
 public class BrokerImpl implements Broker, DOMRpcProviderService, DOMRpcService, AutoCloseable {
     private final static Logger log = LoggerFactory.getLogger(BrokerImpl.class);
 
@@ -74,7 +73,7 @@ public class BrokerImpl implements Broker, DOMRpcProviderService, DOMRpcService,
     // Validation
     private void checkPredicates(final Provider prov) {
         Preconditions.checkNotNull(prov, "Provider should not be null.");
-        for (ProviderContextImpl session : providerSessions) {
+        for (final ProviderContextImpl session : providerSessions) {
             if (prov.equals(session.getProvider())) {
                 throw new IllegalStateException("Provider already registered");
             }
@@ -84,7 +83,7 @@ public class BrokerImpl implements Broker, DOMRpcProviderService, DOMRpcService,
 
     private void checkPredicates(final Consumer cons) {
         Preconditions.checkNotNull(cons, "Consumer should not be null.");
-        for (ConsumerContextImpl session : sessions) {
+        for (final ConsumerContextImpl session : sessions) {
             if (cons.equals(session.getConsumer())) {
                 throw new IllegalStateException("Consumer already registered");
             }
@@ -93,12 +92,12 @@ public class BrokerImpl implements Broker, DOMRpcProviderService, DOMRpcService,
 
     // Private Factory methods
     private ConsumerContextImpl newSessionFor(final Consumer provider) {
-        ConsumerContextImpl ret = new ConsumerContextImpl(provider, this);
+        final ConsumerContextImpl ret = new ConsumerContextImpl(provider, this);
         return ret;
     }
 
     private ProviderContextImpl newSessionFor(final Provider provider) {
-        ProviderContextImpl ret = new ProviderContextImpl(provider, this);
+        final ProviderContextImpl ret = new ProviderContextImpl(provider, this);
         return ret;
     }
 
@@ -152,7 +151,7 @@ public class BrokerImpl implements Broker, DOMRpcProviderService, DOMRpcService,
 
 
     @Override
-    public ConsumerSession registerConsumer(Consumer consumer) {
+    public ConsumerSession registerConsumer(final Consumer consumer) {
         checkPredicates(consumer);
         log.trace("Registering consumer {}", consumer);
         final ConsumerContextImpl session = newSessionFor(consumer);
@@ -163,7 +162,7 @@ public class BrokerImpl implements Broker, DOMRpcProviderService, DOMRpcService,
 
 
     @Override
-    public ProviderSession registerProvider(Provider provider) {
+    public ProviderSession registerProvider(final Provider provider) {
         checkPredicates(provider);
         final ProviderContextImpl session = newSessionFor(provider);
         provider.onSessionInitiated(session);
index 0d1e1af671a9fe2bffdbd57fef898c5b12a23ae8..6806c5d4a42069af9d2a3f9802d9238abe40c12c 100644 (file)
@@ -14,6 +14,10 @@ import org.opendaylight.yangtools.yang.model.api.SchemaContextProvider;
 
 public class SchemaContextProviders {
 
+    private SchemaContextProviders() {
+        throw new UnsupportedOperationException("Utility class.");
+    }
+
     public static final SchemaContextProvider fromSchemaService(final SchemaService schemaService) {
         if (schemaService instanceof SchemaContextProvider) {
             return (SchemaContextProvider) schemaService;
@@ -21,7 +25,7 @@ public class SchemaContextProviders {
         return new SchemaServiceAdapter(schemaService);
     }
 
-    private final static class SchemaServiceAdapter implements SchemaContextProvider, Delegator<SchemaService> {
+    private static final class SchemaServiceAdapter implements SchemaContextProvider, Delegator<SchemaService> {
 
         private final SchemaService service;
 
index fdacd8b3d6ab34210cfa1ad328c1ab573ab89f84..c397eec19240453ca0ae52c709ca8fe670dfc588 100644 (file)
@@ -26,28 +26,28 @@ public class ProxyFactory {
         return ((T) _createProxyImpl);
     }
 
-    private static Object _createProxyImpl(final ServiceReference<?> ref,
+    private static Object createProxyImpl(final ServiceReference<?> ref,
             final DOMMountPointService service) {
 
         return new DOMMountPointServiceProxy(
                 ((ServiceReference<DOMMountPointService>) ref), service);
     }
 
-    private static Object _createProxyImpl(final ServiceReference<?> ref,
+    private static Object createProxyImpl(final ServiceReference<?> ref,
             final SchemaService service) {
 
         return new SchemaServiceProxy(((ServiceReference<SchemaService>) ref),
                 service);
     }
 
-    private static DOMDataBrokerProxy _createProxyImpl(
+    private static DOMDataBrokerProxy createProxyImpl(
             final ServiceReference<?> ref, final DOMDataBroker service) {
 
         return new DOMDataBrokerProxy(((ServiceReference<DOMDataBroker>) ref),
                 service);
     }
 
-    private static Object _createProxyImpl(final ServiceReference<?> reference,
+    private static Object createProxyImplFallback(final ServiceReference<?> reference,
             final BrokerService service) {
 
        return service;
@@ -57,13 +57,13 @@ public class ProxyFactory {
             final BrokerService service) {
 
         if (service instanceof DOMDataBroker) {
-            return _createProxyImpl(ref, (DOMDataBroker) service);
+            return createProxyImpl(ref, (DOMDataBroker) service);
         } else if (service instanceof SchemaService) {
-            return _createProxyImpl(ref, (SchemaService) service);
+            return createProxyImpl(ref, (SchemaService) service);
         } else if (service instanceof DOMMountPointService) {
-            return _createProxyImpl(ref, (DOMMountPointService) service);
+            return createProxyImpl(ref, (DOMMountPointService) service);
         } else if (service != null) {
-            return _createProxyImpl(ref, service);
+            return createProxyImplFallback(ref, service);
         } else {
             throw new IllegalArgumentException("Unhandled parameter types: "
                     + Arrays.<Object> asList(ref, service).toString());