rhtyd commented on a change in pull request #3457: Fix bug in counting items 
for search query
URL: https://github.com/apache/cloudstack/pull/3457#discussion_r299801434
 
 

 ##########
 File path: framework/db/src/main/java/com/cloud/utils/db/GenericDaoBase.java
 ##########
 @@ -2055,7 +2046,17 @@ public Integer getCount(SearchCriteria<T> sc) {
 
     @DB()
     protected StringBuilder createCountSelect(SearchCriteria<?> sc, final 
boolean whereClause) {
-        StringBuilder sql = new StringBuilder(_count);
+        if (sc == null)
 
 Review comment:
   This can potentially cause NPE, @anuragaw can you check who are the users of 
the method and potentially what must be the ideal return value? The 
`createCountSelect` and its indirect users have atleast 70 usages 
codebase-wide, therefore while fixing the bug, new regression should be avoided.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to