8156715: TrustStoreManager does not buffer keystore input stream

Reviewed-by: ascarpino
This commit is contained in:
Artur Barashev 2025-06-24 15:32:13 +00:00
parent 5c1f77fab1
commit 2af869b193

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -376,9 +376,10 @@ final class TrustStoreManager {
}
if (!"NONE".equals(descriptor.storeName)) {
try (FileInputStream fis =
new FileInputStream(descriptor.storeFile)) {
ks.load(fis, password);
try (BufferedInputStream bis =
new BufferedInputStream(
new FileInputStream(descriptor.storeFile))) {
ks.load(bis, password);
} catch (FileNotFoundException fnfe) {
// No file available, no KeyStore available.
if (SSLLogger.isOn && SSLLogger.isOn("trustmanager")) {