accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ctubb...@apache.org
Subject [2/5] accumulo git commit: ACCUMULO-3900 Fix Lexicoder precondition check and bad test.
Date Fri, 12 Jun 2015 16:54:07 GMT
ACCUMULO-3900 Fix Lexicoder precondition check and bad test.


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

Branch: refs/heads/master
Commit: 246129f1b2155f1abc4f8a0f2213a2f14aae6135
Parents: 699b8bf
Author: Dylan Hutchison <dhutchis@mit.edu>
Authored: Thu Jun 11 20:12:08 2015 -0400
Committer: Dylan Hutchison <dhutchis@mit.edu>
Committed: Fri Jun 12 02:28:40 2015 -0400

----------------------------------------------------------------------
 .../apache/accumulo/core/client/lexicoder/AbstractEncoder.java  | 2 +-
 .../core/client/lexicoder/impl/AbstractLexicoderTest.java       | 5 -----
 2 files changed, 1 insertion(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/246129f1/core/src/main/java/org/apache/accumulo/core/client/lexicoder/AbstractEncoder.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/client/lexicoder/AbstractEncoder.java
b/core/src/main/java/org/apache/accumulo/core/client/lexicoder/AbstractEncoder.java
index 6ba7e02..d776329 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/lexicoder/AbstractEncoder.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/lexicoder/AbstractEncoder.java
@@ -51,7 +51,7 @@ public abstract class AbstractEncoder<T> implements Encoder<T>
{
     Preconditions.checkNotNull(b, "cannot decode null byte array");
     Preconditions.checkArgument(offset >= 0, "offset %s cannot be negative", offset);
     Preconditions.checkArgument(len >= 0, "length %s cannot be negative", len);
-    Preconditions.checkArgument(offset + len < b.length, "offset + length %s exceeds byte
array length %s", (offset + len), b.length);
+    Preconditions.checkArgument(offset + len <= b.length, "offset + length %s exceeds
byte array length %s", (offset + len), b.length);
 
     return decodeUnchecked(b, offset, len);
   }

http://git-wip-us.apache.org/repos/asf/accumulo/blob/246129f1/core/src/test/java/org/apache/accumulo/core/client/lexicoder/impl/AbstractLexicoderTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/accumulo/core/client/lexicoder/impl/AbstractLexicoderTest.java
b/core/src/test/java/org/apache/accumulo/core/client/lexicoder/impl/AbstractLexicoderTest.java
index d695ce9..d0f7571 100644
--- a/core/src/test/java/org/apache/accumulo/core/client/lexicoder/impl/AbstractLexicoderTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/client/lexicoder/impl/AbstractLexicoderTest.java
@@ -78,11 +78,6 @@ public abstract class AbstractLexicoderTest extends LexicoderTest {
     } catch (IllegalArgumentException e) {}
 
     try {
-      lexicoder.decode(encoded, encoded.length, 0);
-      fail("Should throw on offset==length.");
-    } catch (IllegalArgumentException e) {}
-
-    try {
       lexicoder.decode(encoded, 0, -1);
       fail("Should throw on negative length.");
     } catch (IllegalArgumentException e) {}


Mime
View raw message