Skip to content

Commit 8ca3d17

Browse files
authored
Merge pull request quarkusio#46966 from cescoffier/tls-registry-fix-no-matching-sni-truststore
Correctly handle trust managers when no trust manager matching the SNI name cannot be found
2 parents 3ef5d91 + 717d53f commit 8ca3d17

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

extensions/tls-registry/runtime/src/main/java/io/quarkus/tls/runtime/keystores/ExpiryTrustOptions.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,11 @@ public TrustManager[] apply(String s) throws Exception {
8484
}
8585

8686
private TrustManager[] getWrappedTrustManagers(TrustManager[] tms) {
87+
// If we do not find any trust managers (for example in the SNI case, where we do not have a trust manager for
88+
// a given name), return `null` and not an empty array.
89+
if (tms == null) {
90+
return null;
91+
}
8792
var wrapped = new TrustManager[tms.length];
8893
for (int i = 0; i < tms.length; i++) {
8994
var manager = tms[i];
@@ -161,4 +166,10 @@ public boolean equals(Object obj) {
161166
}
162167
return false;
163168
}
169+
170+
public String toString() {
171+
return "ExpiryTrustOptions[" +
172+
"delegate=" + delegate + ", " +
173+
"policy=" + policy + ']';
174+
}
164175
}

0 commit comments

Comments
 (0)