diff --git a/extensions/barrage/src/main/java/io/deephaven/extensions/barrage/chunk/ByteChunkInputStreamGenerator.java b/extensions/barrage/src/main/java/io/deephaven/extensions/barrage/chunk/ByteChunkInputStreamGenerator.java index 59efe7bfb33..194e9982d95 100644 --- a/extensions/barrage/src/main/java/io/deephaven/extensions/barrage/chunk/ByteChunkInputStreamGenerator.java +++ b/extensions/barrage/src/main/java/io/deephaven/extensions/barrage/chunk/ByteChunkInputStreamGenerator.java @@ -268,9 +268,7 @@ static WritableByteChunk extractChunkFromInputStreamWithConversion( // consumed entire validity buffer by here final long payloadRead = (long) nodeInfo.numElements * elementSize; - if (payloadBuffer < payloadRead) { - throw new IllegalStateException("payload buffer is too short for expected number of elements"); - } + Assert.geq(payloadBuffer, "payloadBuffer", payloadRead, "payloadRead"); if (options.useDeephavenNulls()) { useDeephavenNulls(conversion, is, nodeInfo, chunk, outOffset); diff --git a/extensions/barrage/src/main/java/io/deephaven/extensions/barrage/chunk/CharChunkInputStreamGenerator.java b/extensions/barrage/src/main/java/io/deephaven/extensions/barrage/chunk/CharChunkInputStreamGenerator.java index 212ef4c33bd..14fd3f8f79b 100644 --- a/extensions/barrage/src/main/java/io/deephaven/extensions/barrage/chunk/CharChunkInputStreamGenerator.java +++ b/extensions/barrage/src/main/java/io/deephaven/extensions/barrage/chunk/CharChunkInputStreamGenerator.java @@ -264,9 +264,7 @@ static WritableCharChunk extractChunkFromInputStreamWithConversion( // consumed entire validity buffer by here final long payloadRead = (long) nodeInfo.numElements * elementSize; - if (payloadBuffer < payloadRead) { - throw new IllegalStateException("payload buffer is too short for expected number of elements"); - } + Assert.geq(payloadBuffer, "payloadBuffer", payloadRead, "payloadRead"); if (options.useDeephavenNulls()) { useDeephavenNulls(conversion, is, nodeInfo, chunk, outOffset); diff --git a/extensions/barrage/src/main/java/io/deephaven/extensions/barrage/chunk/DoubleChunkInputStreamGenerator.java b/extensions/barrage/src/main/java/io/deephaven/extensions/barrage/chunk/DoubleChunkInputStreamGenerator.java index e99ee922cac..a4108804f34 100644 --- a/extensions/barrage/src/main/java/io/deephaven/extensions/barrage/chunk/DoubleChunkInputStreamGenerator.java +++ b/extensions/barrage/src/main/java/io/deephaven/extensions/barrage/chunk/DoubleChunkInputStreamGenerator.java @@ -269,9 +269,7 @@ static WritableDoubleChunk extractChunkFromInputStreamWithConversion( // consumed entire validity buffer by here final long payloadRead = (long) nodeInfo.numElements * elementSize; - if (payloadBuffer < payloadRead) { - throw new IllegalStateException("payload buffer is too short for expected number of elements"); - } + Assert.geq(payloadBuffer, "payloadBuffer", payloadRead, "payloadRead"); if (options.useDeephavenNulls()) { useDeephavenNulls(conversion, is, nodeInfo, chunk, outOffset); diff --git a/extensions/barrage/src/main/java/io/deephaven/extensions/barrage/chunk/FloatChunkInputStreamGenerator.java b/extensions/barrage/src/main/java/io/deephaven/extensions/barrage/chunk/FloatChunkInputStreamGenerator.java index 0daee6eb829..82046928670 100644 --- a/extensions/barrage/src/main/java/io/deephaven/extensions/barrage/chunk/FloatChunkInputStreamGenerator.java +++ b/extensions/barrage/src/main/java/io/deephaven/extensions/barrage/chunk/FloatChunkInputStreamGenerator.java @@ -268,9 +268,7 @@ static WritableFloatChunk extractChunkFromInputStreamWithConversion( // consumed entire validity buffer by here final long payloadRead = (long) nodeInfo.numElements * elementSize; - if (payloadBuffer < payloadRead) { - throw new IllegalStateException("payload buffer is too short for expected number of elements"); - } + Assert.geq(payloadBuffer, "payloadBuffer", payloadRead, "payloadRead"); if (options.useDeephavenNulls()) { useDeephavenNulls(conversion, is, nodeInfo, chunk, outOffset); diff --git a/extensions/barrage/src/main/java/io/deephaven/extensions/barrage/chunk/IntChunkInputStreamGenerator.java b/extensions/barrage/src/main/java/io/deephaven/extensions/barrage/chunk/IntChunkInputStreamGenerator.java index 667c1921c76..4646cc5bdc6 100644 --- a/extensions/barrage/src/main/java/io/deephaven/extensions/barrage/chunk/IntChunkInputStreamGenerator.java +++ b/extensions/barrage/src/main/java/io/deephaven/extensions/barrage/chunk/IntChunkInputStreamGenerator.java @@ -269,9 +269,7 @@ static WritableIntChunk extractChunkFromInputStreamWithConversion( // consumed entire validity buffer by here final long payloadRead = (long) nodeInfo.numElements * elementSize; - if (payloadBuffer < payloadRead) { - throw new IllegalStateException("payload buffer is too short for expected number of elements"); - } + Assert.geq(payloadBuffer, "payloadBuffer", payloadRead, "payloadRead"); if (options.useDeephavenNulls()) { useDeephavenNulls(conversion, is, nodeInfo, chunk, outOffset); diff --git a/extensions/barrage/src/main/java/io/deephaven/extensions/barrage/chunk/LongChunkInputStreamGenerator.java b/extensions/barrage/src/main/java/io/deephaven/extensions/barrage/chunk/LongChunkInputStreamGenerator.java index d8da1b1807d..c0a76261d61 100644 --- a/extensions/barrage/src/main/java/io/deephaven/extensions/barrage/chunk/LongChunkInputStreamGenerator.java +++ b/extensions/barrage/src/main/java/io/deephaven/extensions/barrage/chunk/LongChunkInputStreamGenerator.java @@ -269,9 +269,7 @@ static WritableLongChunk extractChunkFromInputStreamWithConversion( // consumed entire validity buffer by here final long payloadRead = (long) nodeInfo.numElements * elementSize; - if (payloadBuffer < payloadRead) { - throw new IllegalStateException("payload buffer is too short for expected number of elements"); - } + Assert.geq(payloadBuffer, "payloadBuffer", payloadRead, "payloadRead"); if (options.useDeephavenNulls()) { useDeephavenNulls(conversion, is, nodeInfo, chunk, outOffset); diff --git a/extensions/barrage/src/main/java/io/deephaven/extensions/barrage/chunk/ShortChunkInputStreamGenerator.java b/extensions/barrage/src/main/java/io/deephaven/extensions/barrage/chunk/ShortChunkInputStreamGenerator.java index 4bd912e646b..364b04d0d5f 100644 --- a/extensions/barrage/src/main/java/io/deephaven/extensions/barrage/chunk/ShortChunkInputStreamGenerator.java +++ b/extensions/barrage/src/main/java/io/deephaven/extensions/barrage/chunk/ShortChunkInputStreamGenerator.java @@ -268,9 +268,7 @@ static WritableShortChunk extractChunkFromInputStreamWithConversion( // consumed entire validity buffer by here final long payloadRead = (long) nodeInfo.numElements * elementSize; - if (payloadBuffer < payloadRead) { - throw new IllegalStateException("payload buffer is too short for expected number of elements"); - } + Assert.geq(payloadBuffer, "payloadBuffer", payloadRead, "payloadRead"); if (options.useDeephavenNulls()) { useDeephavenNulls(conversion, is, nodeInfo, chunk, outOffset);