DirectByteBufferStreamImpl: converted asserts into exceptions.
@@ -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:
