Record.getLong() method throws ClassCastException

I got a Bin which is of Integer Type. I create it and increment it by doing something like:

Bin bin = new Bin("__BIN__", 1);
WritePolicy policy = new WritePolicy();
policy.expiration = __SOME_EXPIRATION_VALUE__;
client.operate(policy, "__KEY__", Operation.add(bin));

So when i want to fetch the data:

Record record = client.get(null,"__KEY__");

When i try to get the the bin value as a Long value like:

long myValue = record.getLong("__BIN__");

a ClassCastException is thrown saying: “java.lang.Integer cannot be cast to java.lang.Long”.

So i guess it’s a bug in the client or do i miss something? I used client version 3.0.32 where the bug appeared so i upgraded to version 3.0.33 but it still no difference. Anyhow if i use:

 int myValue = record.getInt("__BIN__");

everything is fine. Currently i can live with using a int value instead of a long value. But i want to avoid some overflow scenario in the future. So any ideas what may be wrong?

Thanks in Advance JayJayOne

This is fixed in java client version 3.0.34.

1 Like