ReactiveCouchbase / ReactiveCouchbase-core

Core library for ReactiveCouchbase
Apache License 2.0
64 stars 28 forks source link

Response of getAndLock fails with class cast exception #53

Open vega113 opened 9 years ago

vega113 commented 9 years ago

Response of getAndLock fails with class cast exception. Here's the following cast: f.get().asInstanceOf[CASValue[T]] However, f is of type OperationFuture[CASValue[Object]], so the getValue of the CASValue returns String. In comparison, the regular bucket.get() uses the Reads[T] to parse the value, i.e.
case doc: String => Some(r.reads(Json.parse(doc)))

le-doude commented 9 years ago

in CouchbaseFutures.waitForGetAndCas[T](future: OperationFuture[CASValue[Object]], b: CouchbaseBucket, ec: ExecutionContext, r: Reads[T]): Future[CASValue[T]]

The Reads[T] is never used to deserialize the result. So you end up always passing a String. This is a bug.