You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-issues@hadoop.apache.org by "Steve Loughran (JIRA)" <ji...@apache.org> on 2014/09/17 11:14:34 UTC
[jira] [Commented] (HADOOP-11095) How about Null check when closing
inputstream object in JavaKeyStoreProvider#() ?
[ https://issues.apache.org/jira/browse/HADOOP-11095?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14136988#comment-14136988 ]
Steve Loughran commented on HADOOP-11095:
-----------------------------------------
It's not needed. By the time the try/finally block is hit, is MUST be non-null. If openStream failed the assignment would fail, and hence the value of {{is}} wouldn't have been assigned.
Have you actually seen this occur?
if so, {{IOUtils.closeStream()}} is the way to close streams in the Hadoop code
> How about Null check when closing inputstream object in JavaKeyStoreProvider#() ?
> ---------------------------------------------------------------------------------
>
> Key: HADOOP-11095
> URL: https://issues.apache.org/jira/browse/HADOOP-11095
> Project: Hadoop Common
> Issue Type: Improvement
> Affects Versions: 2.5.1
> Reporter: skrho
> Priority: Minor
> Attachments: HADOOP-11095_001.patch
>
>
> In the finally block:
> InputStream is = pwdFile.openStream();
> try {
> password = IOUtils.toCharArray(is);
> } finally {
> is.close();
> }
>
> How about Null check when closing inputstream object?
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)