You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by el...@apache.org on 2014/06/15 05:04:50 UTC

git commit: ACCUMULO-2910 Remove unnecessary null conditional check. Add null-check on setter.

Repository: accumulo
Updated Branches:
  refs/heads/master a2aabbcbb -> e5c785413


ACCUMULO-2910 Remove unnecessary null conditional check. Add null-check on setter.


Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/e5c78541
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/e5c78541
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/e5c78541

Branch: refs/heads/master
Commit: e5c785413baefeec2c368c01d4a9c744773fb90a
Parents: a2aabbc
Author: Josh Elser <el...@apache.org>
Authored: Sat Jun 14 23:04:10 2014 -0400
Committer: Josh Elser <el...@apache.org>
Committed: Sat Jun 14 23:04:10 2014 -0400

----------------------------------------------------------------------
 .../java/org/apache/accumulo/core/data/Mutation.java   | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/e5c78541/core/src/main/java/org/apache/accumulo/core/data/Mutation.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/data/Mutation.java b/core/src/main/java/org/apache/accumulo/core/data/Mutation.java
index a134ec8..0751ba4 100644
--- a/core/src/main/java/org/apache/accumulo/core/data/Mutation.java
+++ b/core/src/main/java/org/apache/accumulo/core/data/Mutation.java
@@ -34,6 +34,8 @@ import org.apache.hadoop.io.Text;
 import org.apache.hadoop.io.Writable;
 import org.apache.hadoop.io.WritableUtils;
 
+import com.google.common.base.Preconditions;
+
 /**
  * <p>
  * Mutation represents an action that manipulates a row in a table. A mutation holds a list of column/value pairs that represent an atomic set of modifications
@@ -776,6 +778,7 @@ public class Mutation implements Writable {
    * @since 1.7.0
    */
   public void setReplicationSources(Set<String> sources) {
+    Preconditions.checkNotNull(sources);
     this.replicationSources = sources;
   }
 
@@ -929,13 +932,9 @@ public class Mutation implements Writable {
       }
     }
     if (0x02 == (0x02 & hasValues)) {
-      if (null == replicationSources) {
-        WritableUtils.writeVInt(out, 0);
-      } else {
-        WritableUtils.writeVInt(out, replicationSources.size());
-        for (String source : replicationSources) {
-          WritableUtils.writeString(out, source);
-        }
+      WritableUtils.writeVInt(out, replicationSources.size());
+      for (String source : replicationSources) {
+        WritableUtils.writeString(out, source);
       }
     }
   }