directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cohei...@apache.org
Subject [directory-kerby] branch trunk updated: Fixing a few trivial issues thrown up by spotbugs
Date Mon, 04 Nov 2019 10:42:53 GMT
This is an automated email from the ASF dual-hosted git repository.

coheigea pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/directory-kerby.git


The following commit(s) were added to refs/heads/trunk by this push:
     new 06f3448  Fixing a few trivial issues thrown up by spotbugs
06f3448 is described below

commit 06f3448f00a2afc180e32f001c2616035d170daf
Author: Colm O hEigeartaigh <coheigea@apache.org>
AuthorDate: Mon Nov 4 10:27:12 2019 +0000

    Fixing a few trivial issues thrown up by spotbugs
---
 .../org/apache/kerby/has/client/HasClientUtil.java     | 18 +++++++++---------
 .../tool/admin/local/cmd/DeployHTTPSCertsCommand.java  |  2 +-
 .../kerberos/tool/admin/local/cmd/KeytabCommand.java   |  2 +-
 3 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/has-project/has-client/src/main/java/org/apache/kerby/has/client/HasClientUtil.java
b/has-project/has-client/src/main/java/org/apache/kerby/has/client/HasClientUtil.java
index 0d81d40..1b5c97d 100644
--- a/has-project/has-client/src/main/java/org/apache/kerby/has/client/HasClientUtil.java
+++ b/has-project/has-client/src/main/java/org/apache/kerby/has/client/HasClientUtil.java
@@ -110,18 +110,18 @@ public class HasClientUtil {
         StringBuilder data = new StringBuilder();
 
         InputStream inputStream = getInputStream(httpConn);
-        BufferedReader br;
-        if (inputStream != null) {
-          br = new BufferedReader(new InputStreamReader(inputStream));
-        } else {
+        if (inputStream == null) {
             throw new IOException("Failed to get the InputStream");
         }
-        String s;
-        while ((s = br.readLine()) != null) {
-            data.append(s);
-            data.append(System.getProperty("line.separator"));
+
+        try (BufferedReader br = new BufferedReader(new InputStreamReader(inputStream)))
{
+            String s;
+            while ((s = br.readLine()) != null) {
+                data.append(s);
+                data.append(System.getProperty("line.separator"));
+            }
+            return data.toString();
         }
-        return data.toString();
     }
 
     public static InputStream getInputStream(HttpURLConnection httpConn) throws IOException
{
diff --git a/kerby-tool/has-tool/src/main/java/org/apache/kerby/kerberos/tool/admin/local/cmd/DeployHTTPSCertsCommand.java
b/kerby-tool/has-tool/src/main/java/org/apache/kerby/kerberos/tool/admin/local/cmd/DeployHTTPSCertsCommand.java
index ca86b9e..c7d1e1a 100644
--- a/kerby-tool/has-tool/src/main/java/org/apache/kerby/kerberos/tool/admin/local/cmd/DeployHTTPSCertsCommand.java
+++ b/kerby-tool/has-tool/src/main/java/org/apache/kerby/kerberos/tool/admin/local/cmd/DeployHTTPSCertsCommand.java
@@ -170,7 +170,7 @@ public class DeployHTTPSCertsCommand extends HadminCommand {
         String truststoreFile = items[2];
         String truststoreSecret = items[3];
         String pathToDeploy = items[4];
-        int port = Integer.valueOf(items[5]);
+        int port = Integer.parseInt(items[5]);
         String username = items[6];
         String password = "";
         if (items.length == 8) {
diff --git a/kerby-tool/has-tool/src/main/java/org/apache/kerby/kerberos/tool/admin/local/cmd/KeytabCommand.java
b/kerby-tool/has-tool/src/main/java/org/apache/kerby/kerberos/tool/admin/local/cmd/KeytabCommand.java
index edd4353..4d98366 100644
--- a/kerby-tool/has-tool/src/main/java/org/apache/kerby/kerberos/tool/admin/local/cmd/KeytabCommand.java
+++ b/kerby-tool/has-tool/src/main/java/org/apache/kerby/kerberos/tool/admin/local/cmd/KeytabCommand.java
@@ -151,7 +151,7 @@ public class KeytabCommand extends HadminCommand {
                     return;
                 }
                 String pathToDeploy = items[3];
-                int port = Integer.valueOf(items[4]);
+                int port = Integer.parseInt(items[4]);
                 String username = items[5];
                 String password = "";
                 if (items.length == 7) {


Mime
View raw message