Retrieving Long values throws TranscodingException

In the DAO layer I am trying to increment a Long value as following.

private final String MERCHANT_ITEM_COUNT_SUFFIX = "_item_count";

@Override
public Observable<Long> incrMerchantItemCount(String merchantId) {
        return _bucket.async().counter(merchantId + MERCHANT_ITEM_COUNT_SUFFIX, 1,1).map((jsoncLongDoc)->{
            return jsoncLongDoc.content();
        });
}

DAO method to retrieve the Long value is as follows :

@Override
public Observable<Long> getMerchantItemCount(String merchantId) {
        return _bucket
                .async()
                
                .get(merchantId + MERCHANT_ITEM_COUNT_SUFFIX, JsonLongDocument.class)
                .onErrorReturn((throwable)->{ 
                    throw new DaoException(throwable);
                    })
                .map((jsonLongDoc)->{
                    return jsonLongDoc.content();
                    }).defaultIfEmpty(new Long(0));
}

But everytime this getMerchantItemCount() method throws following TranscodingException exception.

What am I doing wrong ?

Caused by: com.couchbase.client.java.error.TranscodingException: Flags
(0x0) indicate non JsonLongDocument id
9959dac0-c98d-11e1-8f0e-005056bd6853_itemcount, could not decode. at
com.couchbase.client.java.transcoder.JsonLongTranscoder.doDecode(JsonLongTranscoder.java:59)
~[java-client-2.0.2.jar:2.0.2] at
com.couchbase.client.java.transcoder.JsonLongTranscoder.doDecode(JsonLongTranscoder.java:40)
~[java-client-2.0.2.jar:2.0.2] at
com.couchbase.client.java.transcoder.AbstractTranscoder.decode(AbstractTranscoder.java:42)
~[java-client-2.0.2.jar:2.0.2] at
com.couchbase.client.java.CouchbaseAsyncBucket$1.call(CouchbaseAsyncBucket.java:137)
~[java-client-2.0.2.jar:2.0.2] at
com.couchbase.client.java.CouchbaseAsyncBucket$1.call(CouchbaseAsyncBucket.java:133)
~[java-client-2.0.2.jar:2.0.2] at
rx.internal.operators.OperatorMap$1.onNext(OperatorMap.java:55)
[rxjava-1.0.4.jar:1.0.4] … 13 common frames omitted

I ask the same question on SO and was asked to report a bug.But eventhough I could not login to “couch base forums” I could not loging to “JIRA”.

There was a minor problem with your user profile which I’ve fixed. After that, you should be able to file an issue without a problem. It may take a few minutes for the profile change to sync.

Thanks for reporting it, that definitely looks like a bug. I see that you’ve created https://issues.couchbase.com/browse/JCBC-728 and we are going to address it as soon as possible.

Hi,

we’ve published a developer preview of 2.1.2 to get quicker feedback if the bug is properly fixed and your issues are addressed. You can get it from our couchbase repository like all pre-releases, the 2.1.2 GA release will be published to maven central as usual.

You can get it like this:

<dependencies>
    <dependency>
        <groupId>com.couchbase.client</groupId>
        <artifactId>java-client</artifactId>
        <version>2.1.2-dp</version>
    </dependency>
</dependencies>

<repositories>
    <repository>
        <id>couchbase</id>
        <name>couchbase repo</name>
        <url>http://files.couchbase.com/maven2</url>
        <snapshots><enabled>false</enabled></snapshots>
    </repository>
</repositories>

Keep in mind that this is not an officially tested release since it has not gone trough extensive QE testing yet. Please let us know if it works and upgrade to 2.1.2 as soon as it is released.

Thanks!