private static void ensureCompatibleDNs(List<CertificateEntries> newEntries, List<CertificateEntries> oldEntries) {
            if (newEntries.size() != oldEntries.size()) {
                throw new ConfigException(String.format("Keystore entries do not match, existing store contains %d entries, new store contains %d entries",
                    oldEntries.size(), newEntries.size()));
            }

            for (int i = 0; i < newEntries.size(); i++) {
                CertificateEntries newEntry = newEntries.get(i);
                CertificateEntries oldEntry = oldEntries.get(i);
                Principal newPrincipal = newEntry.subjectPrincipal;
                Principal oldPrincipal = oldEntry.subjectPrincipal;

                // Compare principal objects to compare canonical names (e.g. to ignore leading/trailing whitespaces).
                // Canonical names may differ if the tags of a field changes from one with a printable string representation
                // to one without or vice-versa due to optional conversion to hex representation based on the tag. So we
                // also compare Principal.getName which compares the RFC2253 name. If either matches, allow dynamic update.
                if (!Objects.equals(newPrincipal, oldPrincipal) && !newPrincipal.getName().equalsIgnoreCase(oldPrincipal.getName())) {
                    throw new ConfigException(String.format("Keystore DistinguishedName does not match: " +
                        " existing={alias=%s, DN=%s}, new={alias=%s, DN=%s}",
                        oldEntry.alias, oldEntry.subjectPrincipal, newEntry.alias, newEntry.subjectPrincipal));
                }
            }
        }
Copy entry from one map into another.

@param destMap   The map to copy entries into.
@param srcMap    The map to copy entries from.
@param key       The entry with this key will be copied
@param <K>       The map key type.
@param <V>       The map value type.
clients/src/main/java/org/apache/kafka/common/security/ssl/SslFactory.java