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

This commit is contained in:
Yongjun Zhang 2016-01-05 10:58:59 -08:00
parent 96d8f1d6f3
commit 28bd138018
2 changed files with 6 additions and 9 deletions

View File

@ -1028,6 +1028,9 @@ Release 2.8.0 - UNRELEASED
HADOOP-12658. Clear javadoc and check style issues around DomainSocket HADOOP-12658. Clear javadoc and check style issues around DomainSocket
(Kai Zheng via umamahesh) (Kai Zheng via umamahesh)
HADOOP-12604. Exception may be swallowed in KMSClientProvider.
(Yongjun Zhang)
OPTIMIZATIONS OPTIMIZATIONS
HADOOP-11785. Reduce the number of listStatus operation in distcp HADOOP-11785. Reduce the number of listStatus operation in distcp

View File

@ -27,6 +27,7 @@
import org.apache.hadoop.crypto.key.KeyProviderFactory; import org.apache.hadoop.crypto.key.KeyProviderFactory;
import org.apache.hadoop.fs.CommonConfigurationKeysPublic; import org.apache.hadoop.fs.CommonConfigurationKeysPublic;
import org.apache.hadoop.fs.Path; import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.IOUtils;
import org.apache.hadoop.io.Text; import org.apache.hadoop.io.Text;
import org.apache.hadoop.security.Credentials; import org.apache.hadoop.security.Credentials;
import org.apache.hadoop.security.ProviderUtils; import org.apache.hadoop.security.ProviderUtils;
@ -515,7 +516,7 @@ private <T> T call(HttpURLConnection conn, Map jsonOutput,
writeJson(jsonOutput, conn.getOutputStream()); writeJson(jsonOutput, conn.getOutputStream());
} }
} catch (IOException ex) { } catch (IOException ex) {
conn.getInputStream().close(); IOUtils.closeStream(conn.getInputStream());
throw ex; throw ex;
} }
if ((conn.getResponseCode() == HttpURLConnection.HTTP_FORBIDDEN if ((conn.getResponseCode() == HttpURLConnection.HTTP_FORBIDDEN
@ -555,15 +556,8 @@ private <T> T call(HttpURLConnection conn, Map jsonOutput,
try { try {
is = conn.getInputStream(); is = conn.getInputStream();
ret = mapper.readValue(is, klass); ret = mapper.readValue(is, klass);
} catch (IOException ex) {
if (is != null) {
is.close();
}
throw ex;
} finally { } finally {
if (is != null) { IOUtils.closeStream(is);
is.close();
}
} }
} }
return ret; return ret;