From f05a61b11c1270155c6531d2af5982c56700520b Mon Sep 17 00:00:00 2001 From: awnuk Date: Sun, 31 May 2009 02:20:40 +0000 Subject: Fixed bugzilla bug #482935. git-svn-id: svn+ssh://svn.fedorahosted.org/svn/pki/trunk@526 c9f7a03b-bd48-0410-a16d-cbbf54688b0b --- .../src/com/netscape/cms/servlet/cert/SrchCerts.java | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'pki/base') diff --git a/pki/base/common/src/com/netscape/cms/servlet/cert/SrchCerts.java b/pki/base/common/src/com/netscape/cms/servlet/cert/SrchCerts.java index 409a1275..7e6396d5 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/cert/SrchCerts.java +++ b/pki/base/common/src/com/netscape/cms/servlet/cert/SrchCerts.java @@ -104,6 +104,13 @@ public class SrchCerts extends CMSServlet { mFormPath = "/" + mAuthority.getId() + "/" + TPL_FILE; /* Server-Side time limit */ + try { + int maxResults = Integer.parseInt(sc.getInitParameter("maxResults")); + if (maxResults < mMaxReturns) + mMaxReturns = maxResults; + } catch (Exception e) { + /* do nothing, just use the default if integer parsing failed */ + } try { mTimeLimits = Integer.parseInt(sc.getInitParameter("timeLimits")); } catch (Exception e) { @@ -590,13 +597,16 @@ public class SrchCerts extends CMSServlet { } // xxx the filter includes serial number range??? - int mr = (maxResults > 0) ? maxResults : mMaxReturns; + if (maxResults == -1 || maxResults > mMaxReturns) { + CMS.debug("Resetting maximum of returned results from " + maxResults + " to " + mMaxReturns); + maxResults = mMaxReturns; + } if (timeLimit == -1 || timeLimit > mTimeLimits) { CMS.debug("Resetting timelimit from " + timeLimit + " to " + mTimeLimits); timeLimit = mTimeLimits; } - CMS.debug("Start searching ... " + "filter=" + filter + " maxreturns=" + mr + " timelimit=" + timeLimit); - Enumeration e = mCertDB.searchCertificates(filter, mr, timeLimit); + CMS.debug("Start searching ... " + "filter=" + filter + " maxreturns=" + maxResults + " timelimit=" + timeLimit); + Enumeration e = mCertDB.searchCertificates(filter, maxResults, timeLimit); int count = 0; @@ -623,7 +633,7 @@ public class SrchCerts extends CMSServlet { if (revokeAll != null) header.addStringValue("revokeAll", revokeAll); header.addIntegerValue("totalRecordCount", count); - header.addIntegerValue("maxSize", mr); + header.addIntegerValue("maxSize", maxResults); } catch (EBaseException e) { CMS.getLogMessage("CMSGW_ERROR_LISTCERTS", e.toString()); throw e; -- cgit