hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From yjzhan...@apache.org
Subject hadoop git commit: HADOOP-12604. Exception may be swallowed in KMSClientProvider. (Yongjun Zhang)
Date Tue, 05 Jan 2016 19:26:47 GMT
Repository: hadoop
Updated Branches:
  refs/heads/branch-2 f41db81d5 -> fc6c94046


HADOOP-12604. Exception may be swallowed in KMSClientProvider. (Yongjun Zhang)

(cherry picked from commit 28bd138018bea6fc9c3bfb94c7a4143420f02ced)


Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/fc6c9404
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/fc6c9404
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/fc6c9404

Branch: refs/heads/branch-2
Commit: fc6c94046451c42782b70f5a94742e0514b94ee9
Parents: f41db81
Author: Yongjun Zhang <yzhang@cloudera.com>
Authored: Tue Jan 5 10:58:59 2016 -0800
Committer: Yongjun Zhang <yzhang@cloudera.com>
Committed: Tue Jan 5 11:19:22 2016 -0800

----------------------------------------------------------------------
 hadoop-common-project/hadoop-common/CHANGES.txt         |  3 +++
 .../apache/hadoop/crypto/key/kms/KMSClientProvider.java | 12 +++---------
 2 files changed, 6 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/fc6c9404/hadoop-common-project/hadoop-common/CHANGES.txt
----------------------------------------------------------------------
diff --git a/hadoop-common-project/hadoop-common/CHANGES.txt b/hadoop-common-project/hadoop-common/CHANGES.txt
index 474612c..45ed2c4 100644
--- a/hadoop-common-project/hadoop-common/CHANGES.txt
+++ b/hadoop-common-project/hadoop-common/CHANGES.txt
@@ -389,6 +389,9 @@ Release 2.8.0 - UNRELEASED
     HADOOP-12658. Clear javadoc and check style issues around DomainSocket
     (Kai Zheng via umamahesh)
 
+    HADOOP-12604. Exception may be swallowed in KMSClientProvider.
+    (Yongjun Zhang)
+
   OPTIMIZATIONS
 
     HADOOP-11785. Reduce the number of listStatus operation in distcp

http://git-wip-us.apache.org/repos/asf/hadoop/blob/fc6c9404/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/crypto/key/kms/KMSClientProvider.java
----------------------------------------------------------------------
diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/crypto/key/kms/KMSClientProvider.java
b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/crypto/key/kms/KMSClientProvider.java
index b113cec..9c38181 100644
--- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/crypto/key/kms/KMSClientProvider.java
+++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/crypto/key/kms/KMSClientProvider.java
@@ -27,6 +27,7 @@ import org.apache.hadoop.crypto.key.KeyProviderDelegationTokenExtension;
 import org.apache.hadoop.crypto.key.KeyProviderFactory;
 import org.apache.hadoop.fs.CommonConfigurationKeysPublic;
 import org.apache.hadoop.fs.Path;
+import org.apache.hadoop.io.IOUtils;
 import org.apache.hadoop.io.Text;
 import org.apache.hadoop.security.Credentials;
 import org.apache.hadoop.security.ProviderUtils;
@@ -515,7 +516,7 @@ public class KMSClientProvider extends KeyProvider implements CryptoExtension,
         writeJson(jsonOutput, conn.getOutputStream());
       }
     } catch (IOException ex) {
-      conn.getInputStream().close();
+      IOUtils.closeStream(conn.getInputStream());
       throw ex;
     }
     if ((conn.getResponseCode() == HttpURLConnection.HTTP_FORBIDDEN
@@ -555,15 +556,8 @@ public class KMSClientProvider extends KeyProvider implements CryptoExtension,
       try {
         is = conn.getInputStream();
         ret = mapper.readValue(is, klass);
-      } catch (IOException ex) {
-        if (is != null) {
-          is.close();
-        }
-        throw ex;
       } finally {
-        if (is != null) {
-          is.close();
-        }
+        IOUtils.closeStream(is);
       }
     }
     return ret;


Mime
View raw message