Skip to content

Commit

Permalink
Fixed bug introduced by commit 3c27925
Browse files Browse the repository at this point in the history
  • Loading branch information
kaikramer committed Aug 6, 2019
1 parent 84b8e74 commit a860977
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions kse/src/org/kse/gui/dialogs/DViewCertificate.java
Original file line number Diff line number Diff line change
Expand Up @@ -499,22 +499,23 @@ public void run() {
private DefaultMutableTreeNode createCertificateNodes(X509Certificate[] certs) {
DefaultMutableTreeNode certsNode = new DefaultMutableTreeNode();

Set<X509Certificate> originalSet = new TreeSet<>(new X509CertificateComparator());
Collections.addAll(originalSet, certs);
Set<X509Certificate> certSet = new TreeSet<>(new X509CertificateComparator());
Collections.addAll(certSet, certs);

// first find certs with no issuer in set and add them to the tree
certSet.stream()
.filter(cert -> !isIssuerInSet(cert, certSet))
.forEach(cert -> certsNode.add(new DefaultMutableTreeNode(cert)));
certSet.removeIf(cert -> !isIssuerInSet(cert, certSet));
.filter(cert -> !isIssuerInSet(cert, certSet))
.forEach(cert -> certsNode.add(new DefaultMutableTreeNode(cert)));
certSet.removeIf(cert -> !isIssuerInSet(cert, originalSet));

// then add root certs
certSet.stream()
.filter(X509CertUtil::isCertificateSelfSigned)
.forEach(cert -> certsNode.add(new DefaultMutableTreeNode(cert)));
.filter(X509CertUtil::isCertificateSelfSigned)
.forEach(cert -> certsNode.add(new DefaultMutableTreeNode(cert)));
certSet.removeIf(X509CertUtil::isCertificateSelfSigned);


// then attach the other certs to their issuers
while (!certSet.isEmpty()) {

Expand Down

0 comments on commit a860977

Please sign in to comment.