Skip to content

Commit

Permalink
Fix sorkey array control and TPS ActivityServlet
Browse files Browse the repository at this point in the history
Sorkey array control generation get error when it is null.

ActivityServlet reports wrong message when resource is not found
  • Loading branch information
fmarco76 committed Jun 6, 2024
1 parent efc58e1 commit 841112b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,10 @@ public LDAPPagedSearch(Class<E> contentClassType, DBRegistry registry, LDAPConne
this.base = base;
this.filter = filter;
this.attrs = attrs;
this.sortKeys = new String[1];
this.sortKeys[0] = sortKey;
if (sortKey != null) {
this.sortKeys = new String[1];
this.sortKeys[0] = sortKey;
}
try {
this.conn = (LDAPConnection) conn.clone();
} catch (Exception e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@

import com.netscape.certsrv.base.BadRequestException;
import com.netscape.certsrv.base.PKIException;
import com.netscape.certsrv.base.ResourceNotFoundException;
import com.netscape.certsrv.base.SessionContext;
import com.netscape.certsrv.base.UnauthorizedException;
import com.netscape.certsrv.logging.ActivityCollection;
Expand Down Expand Up @@ -65,10 +66,15 @@ public void get(HttpServletRequest request, HttpServletResponse response) throws
throw new BadRequestException("Id is empty");
}
logger.debug("{} (\"{}\")", method, id);
ActivityRecord aRec = database.getRecord(id);
ActivityRecord aRec = null;
try {
aRec = database.getRecord(id);
} catch (PKIException pe) {
throw new ResourceNotFoundException("Record " + id + " not found");
}
if (aRec == null) {
logger.debug("{} record not found", method);
throw new PKIException(method + " record not found");
throw new ResourceNotFoundException("Record " + id + " not found");
}
String type = aRec.getType();

Expand Down

0 comments on commit 841112b

Please sign in to comment.