Polish "Properly close input streams when loading key stores"
See gh-25884
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2020 the original author or authors.
|
||||
* Copyright 2012-2021 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -108,8 +108,8 @@ public class CouchbaseAutoConfiguration {
|
||||
private KeyStore loadKeyStore(String resource, String keyStorePassword) throws Exception {
|
||||
KeyStore store = KeyStore.getInstance(KeyStore.getDefaultType());
|
||||
URL url = ResourceUtils.getURL(resource);
|
||||
try (InputStream inputStream = url.openStream()) {
|
||||
store.load(inputStream, (keyStorePassword != null) ? keyStorePassword.toCharArray() : null);
|
||||
try (InputStream stream = url.openStream()) {
|
||||
store.load(stream, (keyStorePassword != null) ? keyStorePassword.toCharArray() : null);
|
||||
}
|
||||
return store;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user