accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ctubb...@apache.org
Subject [accumulo] branch 1.7 updated: ACCUMULO-1972 fix Range constructor
Date Sun, 31 Dec 2017 09:12:39 GMT
This is an automated email from the ASF dual-hosted git repository.

ctubbsii pushed a commit to branch 1.7
in repository https://gitbox.apache.org/repos/asf/accumulo.git


The following commit(s) were added to refs/heads/1.7 by this push:
     new 21d2ea2  ACCUMULO-1972 fix Range constructor
21d2ea2 is described below

commit 21d2ea28494005fcd6860244b9d7d86d4f29993b
Author: Matt Dinep <matt.dinep@gmail.com>
AuthorDate: Sat Dec 30 18:49:49 2017 -0500

    ACCUMULO-1972 fix Range constructor
    
    Updated Range constructor to use a private implementation of
    beforeStartKey, so that it does not cause a problem if a subclass
    overrides the public beforeStartKey method.
    
    (commit message updated by ctubbsii to provide additional detail)
---
 .../src/main/java/org/apache/accumulo/core/data/Range.java | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/core/src/main/java/org/apache/accumulo/core/data/Range.java b/core/src/main/java/org/apache/accumulo/core/data/Range.java
index 306ee2d..11db8ca 100644
--- a/core/src/main/java/org/apache/accumulo/core/data/Range.java
+++ b/core/src/main/java/org/apache/accumulo/core/data/Range.java
@@ -171,7 +171,7 @@ public class Range implements WritableComparable<Range> {
     this.stopKeyInclusive = endKeyInclusive;
     this.infiniteStopKey = stop == null;
 
-    if (!infiniteStartKey && !infiniteStopKey && beforeStartKey(endKey))
{
+    if (!infiniteStartKey && !infiniteStopKey && beforeStartKeyImpl(endKey))
{
       throw new IllegalArgumentException("Start key must be less than end key in range ("
+ startKey + ", " + endKey + ")");
     }
   }
@@ -206,7 +206,7 @@ public class Range implements WritableComparable<Range> {
    */
   public Range(Key start, Key stop, boolean startKeyInclusive, boolean stopKeyInclusive,
boolean infiniteStartKey, boolean infiniteStopKey) {
     this(start, startKeyInclusive, infiniteStartKey, stop, stopKeyInclusive, infiniteStopKey);
-    if (!infiniteStartKey && !infiniteStopKey && beforeStartKey(stop)) {
+    if (!infiniteStartKey && !infiniteStopKey && beforeStartKeyImpl(stop))
{
       throw new IllegalArgumentException("Start key must be less than end key in range ("
+ start + ", " + stop + ")");
     }
   }
@@ -254,7 +254,7 @@ public class Range implements WritableComparable<Range> {
   public Range(TRange trange) {
     this(trange.start == null ? null : new Key(trange.start), trange.startKeyInclusive, trange.infiniteStartKey,
trange.stop == null ? null : new Key(
         trange.stop), trange.stopKeyInclusive, trange.infiniteStopKey);
-    if (!infiniteStartKey && !infiniteStopKey && beforeStartKey(stop)) {
+    if (!infiniteStartKey && !infiniteStopKey && beforeStartKeyImpl(stop))
{
       throw new IllegalArgumentException("Start key must be less than end key in range ("
+ start + ", " + stop + ")");
     }
   }
@@ -279,6 +279,14 @@ public class Range implements WritableComparable<Range> {
    * @return true if the given key is before the range, otherwise false
    */
   public boolean beforeStartKey(Key key) {
+    return beforeStartKeyImpl(key);
+  }
+
+  /**
+   * Implements logic of {@code #beforeStartKey(Key)}, but in a private method, so that it
can be safely used by constructors if a subclass overrides that
+   * {@link #beforeStartKey(Key)}
+   */
+  private boolean beforeStartKeyImpl(Key key) {
     if (infiniteStartKey) {
       return false;
     }

-- 
To stop receiving notification emails like this one, please contact
['"commits@accumulo.apache.org" <commits@accumulo.apache.org>'].

Mime
View raw message