create a method for getMaximumItemPerPage
@@ -1218,6 +1218,24 @@ public class IdentityProviderManager implements IdpManager {
*/
private int validateLimit(int limit) {
+ int maximumItemsPerPage = getMaximumItemPerPage();
+ if (limit > maximumItemsPerPage) {
+ if (log.isDebugEnabled()) {
+ log.debug("Given limit exceed the maximum limit. Therefore we get the default limit from " +
+ "identity.xml. limit: " + maximumItemsPerPage);
+ }
+ limit = maximumItemsPerPage;
+ }
+ return limit;
+ }
+
+ /**
+ * Get the Maximum Item per Page need to display.
+ *
+ * @return maximumItemsPerPage need to display.
+ */
+ private int getMaximumItemPerPage() {
+
int maximumItemsPerPage = IdPManagementConstants.DEFAULT_MAXIMUM_ITEMS_PRE_PAGE;
String maximumItemsPerPagePropertyValue =
IdentityUtil.getProperty(IdPManagementConstants.MAXIMUM_ITEMS_PRE_PAGE_PROPERTY);
@@ -1225,18 +1243,11 @@ public class IdentityProviderManager implements IdpManager {
try {
maximumItemsPerPage = Integer.parseInt(maximumItemsPerPagePropertyValue);
} catch (NumberFormatException e) {
- limit = IdPManagementConstants.DEFAULT_MAXIMUM_ITEMS_PRE_PAGE;
+ maximumItemsPerPage = IdPManagementConstants.DEFAULT_MAXIMUM_ITEMS_PRE_PAGE;
log.warn("Error occurred while parsing the 'MaximumItemsPerPage' property value in identity.xml.", e);
}
}
- if (limit > maximumItemsPerPage) {
- if (log.isDebugEnabled()) {
- log.debug("Given limit exceed the maximum limit. Therefore we get the default limit from " +
- "identity.xml. limit: " + maximumItemsPerPage);
- }
- limit = maximumItemsPerPage;
- }
- return limit;
+ return maximumItemsPerPage;
}
/**
