Skip to content

Commit

Permalink
Tidy up CertServlet
Browse files Browse the repository at this point in the history
  • Loading branch information
fmarco76 committed Dec 11, 2023
1 parent 20cfb69 commit dd3b909
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions base/ca/src/main/java/org/dogtagpki/server/ca/v2/CertServlet.java
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
@WebServlet("/v2/certs/*")
public class CertServlet extends CAServlet {
public static final int DEFAULT_MAXTIME = 0;
public final static int DEFAULT_SIZE = 20;
public static final int DEFAULT_SIZE = 20;

private static final long serialVersionUID = 1L;
private static Logger logger = LoggerFactory.getLogger(CertServlet.class);
Expand Down Expand Up @@ -126,8 +126,8 @@ private CertData getCertData(CertId id, Locale loc) throws Exception {
CertificateRepository repo = engine.getCertificateRepository();

//find the cert in question
CertRecord record = repo.readCertificateRecord(id.toBigInteger());
X509CertImpl cert = record.getCertificate();
CertRecord certRecord = repo.readCertificateRecord(id.toBigInteger());
X509CertImpl cert = certRecord.getCertificate();

CertData certData = new CertData();
certData.setSerialNumber(id);
Expand Down Expand Up @@ -165,10 +165,10 @@ private CertData getCertData(CertId id, Locale loc) throws Exception {
Date notAfter = cert.getNotAfter();
if (notAfter != null) certData.setNotAfter(notAfter.toString());

certData.setRevokedOn(record.getRevokedOn());
certData.setRevokedBy(record.getRevokedBy());
certData.setRevokedOn(certRecord.getRevokedOn());
certData.setRevokedBy(certRecord.getRevokedBy());

RevocationInfo revInfo = record.getRevocationInfo();
RevocationInfo revInfo = certRecord.getRevocationInfo();
if (revInfo != null) {
CRLExtensions revExts = revInfo.getCRLEntryExtensions();
if (revExts != null) {
Expand All @@ -182,7 +182,7 @@ private CertData getCertData(CertId id, Locale loc) throws Exception {
}
}

certData.setStatus(record.getStatus());
certData.setStatus(certRecord.getStatus());

return certData;
}
Expand Down Expand Up @@ -228,16 +228,16 @@ private CertDataInfos listCerts(CertSearchRequest searchReq, int maxTime, int st
return infos;
}

private CertDataInfo createCertDataInfo(CertRecord record) throws EBaseException, InvalidKeyException {
private CertDataInfo createCertDataInfo(CertRecord certRecord) throws EBaseException, InvalidKeyException {
CertDataInfo info = new CertDataInfo();

CertId id = new CertId(record.getSerialNumber());
CertId id = new CertId(certRecord.getSerialNumber());
info.setID(id);

X509Certificate cert = record.getCertificate();
X509Certificate cert = certRecord.getCertificate();
info.setIssuerDN(cert.getIssuerDN().toString());
info.setSubjectDN(cert.getSubjectDN().toString());
info.setStatus(record.getStatus());
info.setStatus(certRecord.getStatus());
info.setVersion(cert.getVersion());
info.setType(cert.getType());

Expand All @@ -255,11 +255,11 @@ private CertDataInfo createCertDataInfo(CertRecord record) throws EBaseException
info.setNotValidBefore(cert.getNotBefore());
info.setNotValidAfter(cert.getNotAfter());

info.setIssuedOn(record.getCreateTime());
info.setIssuedBy(record.getIssuedBy());
info.setIssuedOn(certRecord.getCreateTime());
info.setIssuedBy(certRecord.getIssuedBy());

info.setRevokedOn(record.getRevokedOn());
info.setRevokedBy(record.getRevokedBy());
info.setRevokedOn(certRecord.getRevokedOn());
info.setRevokedBy(certRecord.getRevokedBy());

return info;
}
Expand Down

0 comments on commit dd3b909

Please sign in to comment.