added a comment - - edited
Here is a quick sample on how to reproduce it, but I'm adding a correct test case to the code as well (the view used is just the default "emit key and null" view with no reduce).
import com.couchbase.client.CouchbaseClient;
import com.couchbase.client.CouchbaseConnectionFactory;
import com.couchbase.client.protocol.views.Query;
import com.couchbase.client.protocol.views.View;
import com.couchbase.client.protocol.views.ViewResponse;
import com.couchbase.client.protocol.views.ViewRow;
import java.io.IOException;
import java.net.URI;
import java.util.Arrays;
import java.util.Date;
import java.util.Iterator;
public class BinaryviewTest {
/**
* @param args the command line arguments
*/
public static void main(String[] args) throws IOException {
// Initialize Connection
CouchbaseClient cb = new CouchbaseClient(
new CouchbaseConnectionFactory(
Arrays.asList(
URI.create("
http://192.168.1.105:8091/pools")
),
"default",
""
)
);
// Store binary objects
Object ob1 = new Date();
cb.set("date1", 0, ob1);
Object result = cb.get("date1");
System.out.println(result.getClass());
Query query = new Query();
query.setIncludeDocs(true);
View view = cb.getView("testing", "binary");
ViewResponse response = cb.query(view, query);
Iterator<ViewRow> iterator = response.iterator();
ViewRow row;
while(iterator.hasNext()) {
row = iterator.next();
Object obj = row.getDocument();
System.out.println(obj.getClass());
}
cb.shutdown();
}
}
When run two times, this raises the exception as described here:
http://www.couchbase.com/forums/thread/couchbase-2-view-non-json-docs
I'll update it when I have the fix and test ready.
import com.couchbase.client.CouchbaseClient;
import com.couchbase.client.CouchbaseConnectionFactory;
import com.couchbase.client.protocol.views.Query;
import com.couchbase.client.protocol.views.View;
import com.couchbase.client.protocol.views.ViewResponse;
import com.couchbase.client.protocol.views.ViewRow;
import java.io.IOException;
import java.net.URI;
import java.util.Arrays;
import java.util.Date;
import java.util.Iterator;
public class BinaryviewTest {
/**
* @param args the command line arguments
*/
public static void main(String[] args) throws IOException {
// Initialize Connection
CouchbaseClient cb = new CouchbaseClient(
new CouchbaseConnectionFactory(
Arrays.asList(
URI.create("http://192.168.1.105:8091/pools")
),
"default",
""
)
);
// Store binary objects
Object ob1 = new Date();
cb.set("date1", 0, ob1);
Object result = cb.get("date1");
System.out.println(result.getClass());
Query query = new Query();
query.setIncludeDocs(true);
View view = cb.getView("testing", "binary");
ViewResponse response = cb.query(view, query);
Iterator<ViewRow> iterator = response.iterator();
ViewRow row;
while(iterator.hasNext()) {
row = iterator.next();
Object obj = row.getDocument();
System.out.println(obj.getClass());
}
cb.shutdown();
}
}
When run two times, this raises the exception as described here: http://www.couchbase.com/forums/thread/couchbase-2-view-non-json-docs
I'll update it when I have the fix and test ready.