Bug 8424: Don't output data tree and tree candidates wih debug
[controller.git] / opendaylight / md-sal / cds-access-api / src / main / java / org / opendaylight / controller / cluster / access / commands / ConnectClientSuccess.java
index 65389ec17c4ca589ecc15c4895c2c69471eb9b2e..90eff1b227922f9892186df9a6acae40c2d2dc91 100644 (file)
@@ -13,6 +13,7 @@ import com.google.common.annotations.Beta;
 import com.google.common.base.MoreObjects.ToStringHelper;
 import com.google.common.base.Preconditions;
 import com.google.common.collect.ImmutableList;
+import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
 import java.util.List;
 import java.util.Optional;
 import javax.annotation.Nonnull;
@@ -32,7 +33,12 @@ import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTree;
 public final class ConnectClientSuccess extends RequestSuccess<ClientIdentifier, ConnectClientSuccess> {
     private static final long serialVersionUID = 1L;
 
+    @SuppressFBWarnings(value = "SE_BAD_FIELD", justification = "This field is not Serializable but this class "
+            + "implements writeReplace to delegate serialization to a Proxy class and thus instances of this class "
+            + "aren't serialized. FindBugs does not recognize this.")
     private final List<ActorSelection> alternates;
+
+    @SuppressFBWarnings(value = "SE_BAD_FIELD", justification = "See justification above.")
     private final DataTree dataTree;
     private final ActorRef backend;
     private final int maxMessages;
@@ -47,9 +53,9 @@ public final class ConnectClientSuccess extends RequestSuccess<ClientIdentifier,
         this.maxMessages = maxMessages;
     }
 
-    public ConnectClientSuccess(final @Nonnull ClientIdentifier target, final long sequence,
-            final @Nonnull ActorRef backend, final @Nonnull List<ActorSelection> alternates,
-            final @Nonnull DataTree dataTree, final int maxMessages) {
+    public ConnectClientSuccess(@Nonnull final ClientIdentifier target, final long sequence,
+            @Nonnull final ActorRef backend, @Nonnull final List<ActorSelection> alternates,
+            @Nonnull final DataTree dataTree, final int maxMessages) {
         this(target, sequence, backend, alternates, Optional.of(dataTree), maxMessages);
     }
 
@@ -58,11 +64,13 @@ public final class ConnectClientSuccess extends RequestSuccess<ClientIdentifier,
      *
      * @return a list of known backend alternates
      */
-    public @Nonnull List<ActorSelection> getAlternates() {
+    @Nonnull
+    public List<ActorSelection> getAlternates() {
         return alternates;
     }
 
-    public @Nonnull ActorRef getBackend() {
+    @Nonnull
+    public ActorRef getBackend() {
         return backend;
     }
 
@@ -86,7 +94,7 @@ public final class ConnectClientSuccess extends RequestSuccess<ClientIdentifier,
 
     @Override
     protected ToStringHelper addToStringAttributes(final ToStringHelper toStringHelper) {
-        return super.addToStringAttributes(toStringHelper).add("alternates", alternates).add("dataTree", dataTree)
-                .add("maxMessages", maxMessages);
+        return super.addToStringAttributes(toStringHelper).add("alternates", alternates)
+                .add("dataTree present", getDataTree().isPresent()).add("maxMessages", maxMessages);
     }
 }