Guard against null transaction IDs 25/31425/1
authorRobert Varga <rovarga@cisco.com>
Wed, 16 Dec 2015 13:55:09 +0000 (14:55 +0100)
committerRobert Varga <rovarga@cisco.com>
Wed, 16 Dec 2015 13:56:15 +0000 (14:56 +0100)
This pushes down the null guards so that we can track down the source of
nulls.

Change-Id: Id94db7ba1810b2331f625f335ee610b3a22b3c44
Signed-off-by: Robert Varga <rovarga@cisco.com>
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ShardTransaction.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/CreateTransaction.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/ForwardedReadyTransaction.java

index 4f59f9f..6597ce3 100644 (file)
@@ -58,7 +58,7 @@ public abstract class ShardTransaction extends AbstractUntypedActorWithMetering
         super("shard-tx"); //actor name override used for metering. This does not change the "real" actor name
         this.shardActor = shardActor;
         this.shardStats = shardStats;
-        this.transactionID = transactionID;
+        this.transactionID = Preconditions.checkNotNull(transactionID);
         this.clientTxVersion = clientTxVersion;
     }
 
@@ -164,7 +164,7 @@ public abstract class ShardTransaction extends AbstractUntypedActorWithMetering
             this.shardActor = shardActor;
             this.shardStats = shardStats;
             this.datastoreContext = datastoreContext;
-            this.transactionID = transactionID;
+            this.transactionID = Preconditions.checkNotNull(transactionID);
             this.txnClientVersion = txnClientVersion;
             this.type = type;
         }
index ea3caef..21f16e7 100644 (file)
@@ -9,6 +9,7 @@
 package org.opendaylight.controller.cluster.datastore.messages;
 
 
+import com.google.common.base.Preconditions;
 import org.opendaylight.controller.cluster.datastore.DataStoreVersions;
 import org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages;
 
@@ -32,7 +33,7 @@ public class CreateTransaction implements SerializableMessage {
 
     private CreateTransaction(String transactionId, int transactionType, String transactionChainId,
             short version) {
-        this.transactionId = transactionId;
+        this.transactionId = Preconditions.checkNotNull(transactionId);
         this.transactionType = transactionType;
         this.transactionChainId = transactionChainId;
         this.version = version;
index b3d7f2c..e30d205 100644 (file)
@@ -25,7 +25,7 @@ public class ForwardedReadyTransaction {
     public ForwardedReadyTransaction(String transactionID, short txnClientVersion,
             ReadWriteShardDataTreeTransaction transaction, boolean returnSerialized,
             boolean doImmediateCommit) {
-        this.transactionID = transactionID;
+        this.transactionID = Preconditions.checkNotNull(transactionID);
         this.transaction = Preconditions.checkNotNull(transaction);
         this.returnSerialized = returnSerialized;
         this.txnClientVersion = txnClientVersion;