Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix fetching varint values #59

Merged
merged 2 commits into from
May 23, 2024

Conversation

kornilova203
Copy link
Contributor

Before the fix it was throwing IndexOutOfBoundsException

java.lang.IndexOutOfBoundsException
	at java.base/java.nio.Buffer.checkIndex(Buffer.java:749)
	at java.base/java.nio.HeapByteBuffer.getInt(HeapByteBuffer.java:439)
	at com.ing.data.cassandra.jdbc.utils.ByteBufferUtil.toInt(ByteBufferUtil.java:113)
	at com.ing.data.cassandra.jdbc.codec.VarintToIntCodec.decode(VarintToIntCodec.java:65)
	at com.ing.data.cassandra.jdbc.codec.VarintToIntCodec.decode(VarintToIntCodec.java:31)
	at com.datastax.oss.driver.api.core.data.GettableByIndex.get(GettableByIndex.java:90)
	at com.datastax.oss.driver.api.core.data.GettableByIndex.getInt(GettableByIndex.java:270)
	at com.ing.data.cassandra.jdbc.CassandraResultSet.getObject(CassandraResultSet.java:986)

Copy link
Collaborator

@maximevw maximevw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kornilova203 Thanks for this finding! Good catch! I let you review my comment to improve this fix.

case VARINT:
return this.currentRow.getObject(columnIndex - 1);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right, it was incorrect to use getInt for varint type, but to be really correct, it will be even better to use getBigInteger instead of getObject.

The same fix should be applied at the following locations:

@kornilova203
Copy link
Contributor Author

@maximevw, thank you for the review! I'll push the fixes

@maximevw maximevw merged commit 0c48a81 into ing-bank:release/next May 23, 2024
1 check passed
@kornilova203 kornilova203 deleted the DataGrip/fix-fetching-varint branch May 23, 2024 12:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants