File tree Expand file tree Collapse file tree 2 files changed +13
-0
lines changed
spring-boot-project/spring-boot/src
main/java/org/springframework/boot/info
test/java/org/springframework/boot/info Expand file tree Collapse file tree 2 files changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -76,6 +76,9 @@ private BundleInfo(String name, SslBundle sslBundle) {
7676 }
7777
7878 private List <CertificateChainInfo > extractCertificateChains (KeyStore keyStore ) {
79+ if (keyStore == null ) {
80+ return Collections .emptyList ();
81+ }
7982 try {
8083 return Collections .list (keyStore .aliases ())
8184 .stream ()
Original file line number Diff line number Diff line change 3434import org .springframework .boot .info .SslInfo .CertificateValidityInfo .Status ;
3535import org .springframework .boot .ssl .DefaultSslBundleRegistry ;
3636import org .springframework .boot .ssl .SslBundle ;
37+ import org .springframework .boot .ssl .SslBundleKey ;
3738import org .springframework .boot .ssl .SslStoreBundle ;
3839import org .springframework .boot .ssl .jks .JksSslStoreBundle ;
3940import org .springframework .boot .ssl .jks .JksSslStoreDetails ;
@@ -211,6 +212,15 @@ void multipleBundlesShouldProvideSslInfo(@TempDir Path tempDir) throws IOExcepti
211212 });
212213 }
213214
215+ @ Test
216+ void nullKeyStore () {
217+ DefaultSslBundleRegistry sslBundleRegistry = new DefaultSslBundleRegistry ();
218+ sslBundleRegistry .registerBundle ("test" , SslBundle .of (SslStoreBundle .NONE , SslBundleKey .NONE ));
219+ SslInfo sslInfo = new SslInfo (sslBundleRegistry , Duration .ofDays (7 ));
220+ assertThat (sslInfo .getBundles ()).hasSize (1 );
221+ assertThat (sslInfo .getBundles ().get (0 ).getCertificateChains ()).isEmpty ();
222+ }
223+
214224 private SslInfo createSslInfo (String ... locations ) {
215225 DefaultSslBundleRegistry sslBundleRegistry = new DefaultSslBundleRegistry ();
216226 for (int i = 0 ; i < locations .length ; i ++) {
You can’t perform that action at this time.
0 commit comments