We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Michael Reiche opened DATACOUCH-617 and commented
If a 'count' query does not return anything, a mysterious NPE is thrown.
@Query("SELECT 1 FROM `#{#n1ql.bucket}` WHERE nothing = `matches`) Long count();
java.lang.NullPointerExceptionjava.lang.NullPointerException at org.springframework.data.couchbase.core.ExecutableFindByQueryOperationSupport$ExecutableFindByQuerySupport.count(ExecutableFindByQueryOperationSupport.java:90) at org.springframework.data.couchbase.repository.query.N1qlRepositoryQueryExecutor.execute(N1qlRepositoryQueryExecutor.java:70) at org.springframework.data.couchbase.repository.query.CouchbaseRepositoryQuery.execute(CouchbaseRepositoryQuery.java:42)
Adding a check for null would prevent the NPE, but silently ignoring that the query was erroneous is not a good solution.
@Override public long count() { Long l = reactiveSupport.count().block(); return l != null ? l.longValue() : 0; }
Another possibility is changing the return type of the count() method to Long, so that it could actually be null.
Another possibility is explicitly throwing an exception if the return values is null.
No further details from DATACOUCH-617
The text was updated successfully, but these errors were encountered:
Throw an explicit exception if count query does not return a count.
f7835cf
Also just use the first projected property instead of one explicitly named "count". Closes #925,#960..
Throw an explicit exception if count query does not return a count. (#…
7e2963a
…1195) Also just use the first projected property instead of one explicitly named "count". Closes #925,#960.
mikereiche
Successfully merging a pull request may close this issue.
Uh oh!
There was an error while loading. Please reload this page.
Michael Reiche opened DATACOUCH-617 and commented
If a 'count' query does not return anything, a mysterious NPE is thrown.
Adding a check for null would prevent the NPE, but silently ignoring that the query was erroneous is not a good solution.
Another possibility is changing the return type of the count() method to Long, so that it could actually be null.
Another possibility is explicitly throwing an exception if the return values is null.
No further details from DATACOUCH-617
The text was updated successfully, but these errors were encountered: