This is an automated email from the ASF dual-hosted git repository. zhangduo pushed a commit to branch branch-2.3 in repository https://gitbox.apache.org/repos/asf/hbase.git
The following commit(s) were added to refs/heads/branch-2.3 by this push: new 100c750 HBASE-25657 Fix spotbugs warnings after upgrading spotbugs to 4.x (#3041) 100c750 is described below commit 100c750f6f69191aea5c603d7792982e923d8c6e Author: Duo Zhang <zhang...@apache.org> AuthorDate: Fri Mar 12 14:34:10 2021 +0800 HBASE-25657 Fix spotbugs warnings after upgrading spotbugs to 4.x (#3041) Signed-off-by: meiyi <myime...@gmail.com> Signed-off-by: stack <st...@apache.org> --- .../java/org/apache/hadoop/hbase/rest/client/Client.java | 16 ++++++++++------ .../apache/hadoop/hbase/master/cleaner/CleanerChore.java | 2 +- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/client/Client.java b/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/client/Client.java index 47700aa..76f8ab1 100644 --- a/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/client/Client.java +++ b/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/client/Client.java @@ -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; @@ -28,6 +29,7 @@ import java.io.InputStream; 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; @@ -156,15 +158,17 @@ public class Client { 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)); diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/cleaner/CleanerChore.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/cleaner/CleanerChore.java index 4331d49..1d01281 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/cleaner/CleanerChore.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/cleaner/CleanerChore.java @@ -122,7 +122,7 @@ public abstract class CleanerChore<T extends FileCleanerDelegate> extends Schedu } 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;