You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by GitBox <gi...@apache.org> on 2018/03/19 06:18:31 UTC

[GitHub] rhtyd commented on a change in pull request #2481: CLOUDSTACK-10320 - Invalid pair for response object breaking response parsing

rhtyd commented on a change in pull request #2481: CLOUDSTACK-10320 - Invalid pair for response object breaking response parsing
URL: https://github.com/apache/cloudstack/pull/2481#discussion_r175338811
 
 

 ##########
 File path: framework/db/src/main/java/com/cloud/utils/db/GenericDaoBase.java
 ##########
 @@ -1323,6 +1327,11 @@ protected void addJoins(StringBuilder str, Collection<JoinBuilder<SearchCriteria
     public Pair<List<T>, Integer> searchAndDistinctCount(final SearchCriteria<T> sc, final Filter filter) {
         List<T> objects = search(sc, filter, null, false);
         Integer count = getDistinctCount(sc);
+        // Count cannot be 0 if there is at least a result in the list, see CLOUDSTACK-10320
+        if (count == 0 && !objects.isEmpty()) {
+            // Cannot assume if it's more than one since the count is distinct vs search
+            count = 1;
 
 Review comment:
   why not put count = objects.size() ?

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


With regards,
Apache Git Services