How to differentiate getAndLock return value when document does not exist and when it is locked

Hi, I am using Couchbase older version.
I am trying to use the getAndLock method, but am unable to differentiate its return value when the document does not exist and when the document is locked.

When document is locked by another client, it returns -1 as the CASValue.
It returns the same value when the document does not exist.

How to differentiate between these 2 types in the method calls ?

Thanks in advance.

Regards.

@rajeev.dalavi which SDK version and server version are you using?

Hi, I am using java sdk 1.4.4 and the server is 4.x

@rajeev.dalavi you could try to perform another get afterwards to see if it exists or if it is locked already.

Please note that the 1.4 sdk has not been supported for many years, same with the server version you are using. Please update as soon as you can both server and client to a recent version. This will also solve your problem, because we are throwing proper exceptions in SDK 3 for example.