Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

package org.apache.hadoop.hbase.rest.client;

import java.io.BufferedInputStream;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
Expand All @@ -28,6 +29,7 @@
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
import java.nio.file.Files;
import java.security.KeyManagementException;
import java.security.KeyStore;
import java.security.KeyStoreException;
Expand Down Expand Up @@ -156,15 +158,17 @@ public Client(Cluster cluster, String trustStorePath,
String type = trustStoreType.orElse(KeyStore.getDefaultType());

KeyStore trustStore;
try(FileInputStream inputStream = new FileInputStream(new File(trustStorePath))) {
try {
trustStore = KeyStore.getInstance(type);
trustStore.load(inputStream, password);
} catch (KeyStoreException e) {
throw new ClientTrustStoreInitializationException(
"Invalid trust store type: " + type, e);
throw new ClientTrustStoreInitializationException("Invalid trust store type: " + type, e);
}
try (InputStream inputStream =
new BufferedInputStream(Files.newInputStream(new File(trustStorePath).toPath()))) {
trustStore.load(inputStream, password);
} catch (CertificateException | NoSuchAlgorithmException | IOException e) {
throw new ClientTrustStoreInitializationException(
"Trust store load error: " + trustStorePath, e);
throw new ClientTrustStoreInitializationException("Trust store load error: " + trustStorePath,
e);
}

initialize(cluster, true, Optional.of(trustStore));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ static int calculatePoolSize(String poolSize) {
} else if (poolSize.matches("0.[0-9]+|1.0")) {
// if poolSize is a double, return poolSize * availableProcessors;
// Ensure that we always return at least one.
int computedThreads = (int) (AVAIL_PROCESSORS * Double.valueOf(poolSize));
int computedThreads = (int) (AVAIL_PROCESSORS * Double.parseDouble(poolSize));
if (computedThreads < 1) {
LOG.debug("Computed {} threads for CleanerChore, using 1 instead", computedThreads);
return 1;
Expand Down