You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In this case, the 3 element in the array would be null . The BatchWrite class internally tries to access all the elements of the array as
for (Operation op : ops) {
if (op.type.isWrite) {
hasWrite = true;
}
size += Buffer.estimateSizeUtf8(op.binName) + Command.OPERATION_HEADER_SIZE;
size += op.value.estimateSize();
}
This would cause a crash.
Adding individual checks doesn't seem helpful since the same array might be passed down to other classes like BatchAttr, hence filtering at constructor level seems to make sense .
The text was updated successfully, but these errors were encountered:
If one of the operations in the array is null, a null pointer exception is generated which is not a crash. This is the intended behavior.
The pull request silently reduces the operations array size if there is a null operation. This will cause errors when the user code retrieves results for each operation because the expected offset in the results may now be different.
zsfVishnu
changed the title
Java client crashes when the BatchWrite class is initialised with Operation array with null value
Java client throws a NPE when the BatchWrite class is initialised with Operation array with null value
Jan 29, 2025
The text was updated successfully, but these errors were encountered: