commit e1ae89e9f110cf4af75f6ea82a38a9ce085617ac
Author: Endi S. Dewata <edewata@redhat.com>
Date: Thu Jan 26 23:38:53 2017 +0100
Fixed problem searching the latest certificate request.
Previously if a certificate request page only has one entry the
entry itself will be removed from the page, resulting in a blank
page.
The QueryReq.trim() has been modified not to remove the marker
entry if it's the only entry in the page.
https://fedorahosted.org/pki/ticket/2450
(cherry picked from commit 755fb2834d22131628ad1929c1bd4b1cd7592203)
(cherry picked from commit 196ae21e55a3210ef9db1ad6b8c84d64d4d1959e)
diff --git a/base/server/cms/src/com/netscape/cms/servlet/request/QueryReq.java b/base/server/cms/src/com/netscape/cms/servlet/request/QueryReq.java
index d05da10..376349b 100644
--- a/base/server/cms/src/com/netscape/cms/servlet/request/QueryReq.java
+++ b/base/server/cms/src/com/netscape/cms/servlet/request/QueryReq.java
@@ -503,6 +503,12 @@ public class QueryReq extends CMSServlet {
*/
private void trim(Vector<IRequest> v, RequestId marker) {
int i = v.size() - 1;
+
+ if (i == 0) {
+ // do not remove the only element in the list
+ return;
+ }
+
if (v.elementAt(i).getRequestId().toString().equals(
marker.toString())) {
v.remove(i);