HADOOP-12604. Exception may be swallowed in KMSClientProvider. (Yongjun Zhang)
(cherry picked from commit 28bd138018
)
This commit is contained in:
parent
68ee13e4f5
commit
f372d3faae
|
@ -370,6 +370,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
|
||||||
|
|
|
@ -27,6 +27,7 @@ import org.apache.hadoop.crypto.key.KeyProviderDelegationTokenExtension;
|
||||||
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 @@ public class KMSClientProvider extends KeyProvider implements CryptoExtension,
|
||||||
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 @@ public class KMSClientProvider extends KeyProvider implements CryptoExtension,
|
||||||
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;
|
||||||
|
|
Loading…
Reference in New Issue