Skip to content
Open
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 20 additions & 8 deletions api/src/main/java/io/minio/Http.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import com.google.common.collect.Multimap;
import io.minio.credentials.Credentials;
import io.minio.errors.MinioException;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.RandomAccessFile;
Expand Down Expand Up @@ -451,14 +452,16 @@ private static X509TrustManager getTrustManagerFromDir(String dirPath)
ks.load(null);

int index = 0;
try (Stream<Path> paths = Files.walk(Paths.get(dirPath))) {
int number = 1;
for (Path file : (Iterable<Path>) paths.filter(Files::isRegularFile)::iterator) {
try {
index += setCertificateEntry(cf, ks, file, "cert-dir-file-" + number + "-");
number++;
} catch (CertificateException | IOException | KeyStoreException e) {
// Ignore these errors.
int number = 1;
for (Path directory : getDirectories(dirPath)) {
try (Stream<Path> paths = Files.walk(directory)) {
for (Path file : (Iterable<Path>) paths.filter(Files::isRegularFile)::iterator) {
try {
index += setCertificateEntry(cf, ks, file, "cert-dir-file-" + number + "-");
number++;
} catch (CertificateException | IOException | KeyStoreException e) {
// Ignore these errors.
}
}
}
}
Expand All @@ -468,6 +471,15 @@ private static X509TrustManager getTrustManagerFromDir(String dirPath)
return buildTrustManagerFromKeyStore(ks);
}

private static List<Path> getDirectories(String dirPath) {
return Stream.of(dirPath.split(File.pathSeparator))
Comment thread
balamurugana marked this conversation as resolved.
Outdated
.map(String::trim)
.filter(s -> !s.isEmpty())
.map(Paths::get)
.filter(Files::isDirectory)
.collect(Collectors.toList());
}

private static X509TrustManager getDefaultTrustManager()
throws CertificateException, IOException, KeyStoreException, NoSuchAlgorithmException {
TrustManagerFactory factory =
Expand Down
Loading