You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by yz...@apache.org on 2017/05/16 10:29:44 UTC

ignite git commit: DirectByteBufferStreamImpl: converted asserts into exceptions.

Repository: ignite
Updated Branches:
  refs/heads/master 95850b47b -> 88593b6dd


DirectByteBufferStreamImpl: converted asserts into exceptions.

(cherry picked from commit 560ef60)


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

Branch: refs/heads/master
Commit: 88593b6dd872a5ce7d157d75ece907b628736a99
Parents: 95850b4
Author: sboikov <sb...@gridgain.com>
Authored: Tue May 16 11:30:29 2017 +0300
Committer: Yakov Zhdanov <yz...@gridgain.com>
Committed: Tue May 16 13:29:36 2017 +0300

----------------------------------------------------------------------
 .../stream/v2/DirectByteBufferStreamImplV2.java | 27 +++++++++++++-------
 1 file changed, 18 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/88593b6d/modules/core/src/main/java/org/apache/ignite/internal/direct/stream/v2/DirectByteBufferStreamImplV2.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/direct/stream/v2/DirectByteBufferStreamImplV2.java b/modules/core/src/main/java/org/apache/ignite/internal/direct/stream/v2/DirectByteBufferStreamImplV2.java
index 9464186..c92c470 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/direct/stream/v2/DirectByteBufferStreamImplV2.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/direct/stream/v2/DirectByteBufferStreamImplV2.java
@@ -1,4 +1,4 @@
-/*
+ /*
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
@@ -27,6 +27,7 @@ import java.util.List;
 import java.util.Map;
 import java.util.RandomAccess;
 import java.util.UUID;
+import org.apache.ignite.IgniteException;
 import org.apache.ignite.internal.direct.stream.DirectByteBufferStream;
 import org.apache.ignite.internal.util.GridUnsafe;
 import org.apache.ignite.internal.util.tostring.GridToStringExclude;
@@ -80,7 +81,8 @@ public class DirectByteBufferStreamImplV2 implements DirectByteBufferStream {
     /** */
     private static final ArrayCreator<byte[]> BYTE_ARR_CREATOR = new ArrayCreator<byte[]>() {
         @Override public byte[] create(int len) {
-            assert len >= 0;
+            if (len < 0)
+                throw new IgniteException("Read invalid byte array length: " + len);
 
             switch (len) {
                 case 0:
@@ -95,7 +97,8 @@ public class DirectByteBufferStreamImplV2 implements DirectByteBufferStream {
     /** */
     private static final ArrayCreator<short[]> SHORT_ARR_CREATOR = new ArrayCreator<short[]>() {
         @Override public short[] create(int len) {
-            assert len >= 0;
+            if (len < 0)
+                throw new IgniteException("Read invalid short array length: " + len);
 
             switch (len) {
                 case 0:
@@ -110,7 +113,8 @@ public class DirectByteBufferStreamImplV2 implements DirectByteBufferStream {
     /** */
     private static final ArrayCreator<int[]> INT_ARR_CREATOR = new ArrayCreator<int[]>() {
         @Override public int[] create(int len) {
-            assert len >= 0;
+            if (len < 0)
+                throw new IgniteException("Read invalid int array length: " + len);
 
             switch (len) {
                 case 0:
@@ -125,7 +129,8 @@ public class DirectByteBufferStreamImplV2 implements DirectByteBufferStream {
     /** */
     private static final ArrayCreator<long[]> LONG_ARR_CREATOR = new ArrayCreator<long[]>() {
         @Override public long[] create(int len) {
-            assert len >= 0;
+            if (len < 0)
+                throw new IgniteException("Read invalid long array length: " + len);
 
             switch (len) {
                 case 0:
@@ -140,7 +145,8 @@ public class DirectByteBufferStreamImplV2 implements DirectByteBufferStream {
     /** */
     private static final ArrayCreator<float[]> FLOAT_ARR_CREATOR = new ArrayCreator<float[]>() {
         @Override public float[] create(int len) {
-            assert len >= 0;
+            if (len < 0)
+                throw new IgniteException("Read invalid float array length: " + len);
 
             switch (len) {
                 case 0:
@@ -155,7 +161,8 @@ public class DirectByteBufferStreamImplV2 implements DirectByteBufferStream {
     /** */
     private static final ArrayCreator<double[]> DOUBLE_ARR_CREATOR = new ArrayCreator<double[]>() {
         @Override public double[] create(int len) {
-            assert len >= 0;
+            if (len < 0)
+                throw new IgniteException("Read invalid double array length: " + len);
 
             switch (len) {
                 case 0:
@@ -170,7 +177,8 @@ public class DirectByteBufferStreamImplV2 implements DirectByteBufferStream {
     /** */
     private static final ArrayCreator<char[]> CHAR_ARR_CREATOR = new ArrayCreator<char[]>() {
         @Override public char[] create(int len) {
-            assert len >= 0;
+            if (len < 0)
+                throw new IgniteException("Read invalid char array length: " + len);
 
             switch (len) {
                 case 0:
@@ -185,7 +193,8 @@ public class DirectByteBufferStreamImplV2 implements DirectByteBufferStream {
     /** */
     private static final ArrayCreator<boolean[]> BOOLEAN_ARR_CREATOR = new ArrayCreator<boolean[]>() {
         @Override public boolean[] create(int len) {
-            assert len >= 0;
+            if (len < 0)
+                throw new IgniteException("Read invalid boolean array length: " + len);
 
             switch (len) {
                 case 0: