Repository: ignite
Updated Branches:
  refs/heads/ignite-gg-11810 0c57ede37 -> fc9c4886c


Fixed assert for empty byte array.


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

Branch: refs/heads/ignite-gg-11810
Commit: fc9c4886c55b611a2e7484599aca87068810ed34
Parents: 0c57ede
Author: sboikov <sboi...@gridgain.com>
Authored: Fri Jan 13 14:59:54 2017 +0300
Committer: sboikov <sboi...@gridgain.com>
Committed: Fri Jan 13 14:59:54 2017 +0300

----------------------------------------------------------------------
 .../ignite/internal/pagemem/PageUtils.java      |  2 +-
 .../cache/database/CacheDataRowAdapter.java     | 28 +++++++-------------
 2 files changed, 11 insertions(+), 19 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/fc9c4886/modules/core/src/main/java/org/apache/ignite/internal/pagemem/PageUtils.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/pagemem/PageUtils.java 
b/modules/core/src/main/java/org/apache/ignite/internal/pagemem/PageUtils.java
index e9e228a..f824368 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/pagemem/PageUtils.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/pagemem/PageUtils.java
@@ -130,7 +130,7 @@ public class PageUtils {
         assert addr > 0 : addr;
         assert off >= 0;
         assert bytes != null;
-        assert bytesOff >= 0 && bytesOff < bytes.length : bytesOff;
+        assert bytesOff >= 0 && (bytesOff < bytes.length || bytes.length == 0) 
: bytesOff;
 
         GridUnsafe.copyMemory(bytes, GridUnsafe.BYTE_ARR_OFF + bytesOff, null, 
addr + off, bytes.length - bytesOff);
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/fc9c4886/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/database/CacheDataRowAdapter.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/database/CacheDataRowAdapter.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/database/CacheDataRowAdapter.java
index acb435e..5288aad 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/database/CacheDataRowAdapter.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/database/CacheDataRowAdapter.java
@@ -200,17 +200,13 @@ public class CacheDataRowAdapter implements CacheDataRow {
         int len = PageUtils.getInt(addr, off);
         off += 4;
 
-        if (len == 0)
-            key = null;
-        else {
-            byte type = PageUtils.getByte(addr, off);
-            off++;
+        byte type = PageUtils.getByte(addr, off);
+        off++;
 
-            byte[] bytes = PageUtils.getBytes(addr, off, len);
-            off += len;
+        byte[] bytes = PageUtils.getBytes(addr, off, len);
+        off += len;
 
-            key = coctx.processor().toKeyCacheObject(coctx, type, bytes);
-        }
+        key = coctx.processor().toKeyCacheObject(coctx, type, bytes);
 
         if (keyOnly) {
             assert key != null: "key";
@@ -221,17 +217,13 @@ public class CacheDataRowAdapter implements CacheDataRow {
         len = PageUtils.getInt(addr, off);
         off += 4;
 
-        if (len == 0)
-            val = null;
-        else {
-            byte type = PageUtils.getByte(addr, off);
-            off++;
+        type = PageUtils.getByte(addr, off);
+        off++;
 
-            byte[] bytes = PageUtils.getBytes(addr, off, len);
-            off += len;
+        bytes = PageUtils.getBytes(addr, off, len);
+        off += len;
 
-            val = coctx.processor().toCacheObject(coctx, type, bytes);
-        }
+        val = coctx.processor().toCacheObject(coctx, type, bytes);
 
         ver = CacheVersionIO.read(addr + off, false);
 

Reply via email to