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 "Tsuyoshi OZAWA (JIRA)" <ji...@apache.org> on 2014/12/22 05:02:13 UTC

[jira] [Updated] (HADOOP-11414) FileBasedIPList#readLines() can leak file descriptors

     [ https://issues.apache.org/jira/browse/HADOOP-11414?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Tsuyoshi OZAWA updated HADOOP-11414:
------------------------------------
    Summary: FileBasedIPList#readLines() can leak file descriptors  (was: Close of Reader should be enclosed in finally block in FileBasedIPList#readLines())

> FileBasedIPList#readLines() can leak file descriptors
> -----------------------------------------------------
>
>                 Key: HADOOP-11414
>                 URL: https://issues.apache.org/jira/browse/HADOOP-11414
>             Project: Hadoop Common
>          Issue Type: Bug
>    Affects Versions: 2.6.0
>            Reporter: Ted Yu
>            Assignee: Tsuyoshi OZAWA
>            Priority: Minor
>             Fix For: 2.7.0
>
>         Attachments: HADOOP-11414.1.patch, HADOOP-11414.2.patch, HADOOP-11414.3.patch, HADOOP-11414.4.patch
>
>
> {code}
>           Reader fileReader = new InputStreamReader(
>               new FileInputStream(file), Charsets.UTF_8);
>           BufferedReader bufferedReader = new BufferedReader(fileReader);
>           List<String> lines = new ArrayList<String>();
>           String line = null;
>           while ((line = bufferedReader.readLine()) != null) {
>             lines.add(line);
>           }
>           bufferedReader.close();
> {code}
> Since bufferedReader.readLine() may throw IOE, so the close of bufferedReader should be enclosed within finally block.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)