Skip to content

Commit

Permalink
Make assertion provide more info
Browse files Browse the repository at this point in the history
  • Loading branch information
niloc132 committed Jun 25, 2024
1 parent 3b8992f commit d327ca2
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -268,9 +268,7 @@ static WritableByteChunk<Values> 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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -264,9 +264,7 @@ static WritableCharChunk<Values> 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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -269,9 +269,7 @@ static WritableDoubleChunk<Values> 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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -268,9 +268,7 @@ static WritableFloatChunk<Values> 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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -269,9 +269,7 @@ static WritableIntChunk<Values> 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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -269,9 +269,7 @@ static WritableLongChunk<Values> 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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -268,9 +268,7 @@ static WritableShortChunk<Values> 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);
Expand Down

0 comments on commit d327ca2

Please sign in to comment.