From 82f0ed0fdeeccda5810a7bd472e61a792405bbb1 Mon Sep 17 00:00:00 2001 From: "Endi S. Dewata" Date: Mon, 2 Oct 2023 19:41:08 -0500 Subject: [PATCH] Move CAEngine.removeCA() to AuthorityMonitor --- .../main/java/com/netscape/ca/AuthorityMonitor.java | 10 ++++++++-- .../main/java/org/dogtagpki/server/ca/CAEngine.java | 8 +------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/base/ca/src/main/java/com/netscape/ca/AuthorityMonitor.java b/base/ca/src/main/java/com/netscape/ca/AuthorityMonitor.java index 2a89c5354ad..bf128b53fdd 100644 --- a/base/ca/src/main/java/com/netscape/ca/AuthorityMonitor.java +++ b/base/ca/src/main/java/com/netscape/ca/AuthorityMonitor.java @@ -234,7 +234,7 @@ private synchronized void handleMODDN(DN oldDN, LDAPEntry entry) throws Exceptio LDAPAttribute attr = entry.getAttribute("authorityID"); if (attr != null) { AuthorityID aid = new AuthorityID(attr.getStringValueArray()[0]); - engine.removeCA(aid); + removeCA(aid); } } else if (!wasMonitored && isMonitored) { @@ -275,7 +275,7 @@ private synchronized void handleDELETE(LDAPEntry entry) { + "for authority '" + aid + "': " + e.getMessage(), e); } - engine.removeCA(aid); + removeCA(aid); } } @@ -283,6 +283,12 @@ public void addCA(AuthorityID aid, CertificateAuthority ca) { authorities.put(aid, ca); } + public void removeCA(AuthorityID aid) { + authorities.remove(aid); + entryUSNs.remove(aid); + nsUniqueIds.remove(aid); + } + public synchronized void trackUpdate(AuthorityID aid, LDAPControl[] responseControls) { LDAPPostReadControl control = (LDAPPostReadControl) diff --git a/base/ca/src/main/java/org/dogtagpki/server/ca/CAEngine.java b/base/ca/src/main/java/org/dogtagpki/server/ca/CAEngine.java index bee661dd05f..e4120091468 100644 --- a/base/ca/src/main/java/org/dogtagpki/server/ca/CAEngine.java +++ b/base/ca/src/main/java/org/dogtagpki/server/ca/CAEngine.java @@ -1013,12 +1013,6 @@ public CertificateAuthority getCA(X500Name dn) { return null; } - public void removeCA(AuthorityID aid) { - authorityMonitor.authorities.remove(aid); - authorityMonitor.entryUSNs.remove(aid); - authorityMonitor.nsUniqueIds.remove(aid); - } - public void ensureAuthorityDNAvailable(X500Name dn) throws IssuerUnavailableException { @@ -1308,7 +1302,7 @@ public synchronized void deleteAuthorityEntry(AuthorityID aid) throws EBaseExcep authorityMonitor.deletedNsUniqueIds.add(nsUniqueId); } - removeCA(aid); + authorityMonitor.removeCA(aid); } public synchronized void readAuthority(LDAPEntry entry) throws Exception {