There are a bit too many method calls on this line, but I can rule out that JsonUtil is null because convertObject() is static.
I checked that convertObject(null,…) does not throw a NullPointer. That leaves only the possibility that row is null or row.getDocument() returns null.
How is this possible? Can it be avoided? How should I deal with it?
When you query a view it returns by default only the key and values. Like that we do not consume too much network when it is not needed.
If you want to get the document you call this method, in the query, the Java SDK will do a client.get(row.id) for you automatically an return the document.
I did set includeDocs to true. Here is the complete query.
public List findReports(long fromMillis, long toMillis)
{
View view = this.client.getView(“psek_kbox”, “by_looptimestamp”);
Query query = new Query();
query.setIncludeDocs(true);
query.setStale(Stale.FALSE);
query.setRangeStart(String.valueOf(fromMillis));
query.setRangeEnd(String.valueOf(toMillis));
query.setDescending(false);
query.setInclusiveEnd(false);
List reports = new ArrayList();
Most often this method works, but from time to time a document is missing. I’m still looking at this, but it seems that something might be wrong with what’s written in couchbase.