diff --git a/api/src/org/apache/cloudstack/api/BaseListCmd.java b/api/src/org/apache/cloudstack/api/BaseListCmd.java index 4d9b350dc2e..071c02d1caa 100644 --- a/api/src/org/apache/cloudstack/api/BaseListCmd.java +++ b/api/src/org/apache/cloudstack/api/BaseListCmd.java @@ -53,7 +53,7 @@ public abstract class BaseListCmd extends BaseCmd { } public Integer getPageSize() { - if (pageSize != null && MAX_PAGESIZE != null && pageSize.longValue() > MAX_PAGESIZE.longValue()) { + if (pageSize != null && MAX_PAGESIZE.longValue() != PAGESIZE_UNLIMITED && pageSize.longValue() > MAX_PAGESIZE.longValue()) { throw new InvalidParameterValueException("Page size can't exceed max allowed page size value: " + MAX_PAGESIZE.longValue()); } @@ -84,12 +84,12 @@ public abstract class BaseListCmd extends BaseCmd { Long defaultPageSize = MAX_PAGESIZE; Integer pageSizeInt = getPageSize(); if (pageSizeInt != null) { - if (pageSizeInt.longValue() == PAGESIZE_UNLIMITED) { - defaultPageSize = null; - } else { - defaultPageSize = pageSizeInt.longValue(); - } + defaultPageSize = pageSizeInt.longValue(); } + if (defaultPageSize.longValue() == PAGESIZE_UNLIMITED) { + defaultPageSize = null; + } + return defaultPageSize; } diff --git a/api/src/org/apache/cloudstack/api/command/admin/config/ListCfgsByCmd.java b/api/src/org/apache/cloudstack/api/command/admin/config/ListCfgsByCmd.java index a11904e90ce..dce87c3d818 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/config/ListCfgsByCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/config/ListCfgsByCmd.java @@ -88,12 +88,16 @@ public class ListCfgsByCmd extends BaseListCmd { @Override public Long getPageSizeVal() { - Long pageSizeVal = 500L; - Integer pageSize = getPageSize(); - if (pageSize != null) { - pageSizeVal = pageSize.longValue(); + Long defaultPageSize = 500L; + Integer pageSizeInt = getPageSize(); + if (pageSizeInt != null) { + if (pageSizeInt.longValue() == PAGESIZE_UNLIMITED) { + defaultPageSize = null; + } else { + defaultPageSize = pageSizeInt.longValue(); + } } - return pageSizeVal; + return defaultPageSize; } // ///////////////////////////////////////////////////