hadoop-hdfs-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Colin Patrick McCabe (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HDFS-7540) Add IOUtils#listDirectory
Date Wed, 17 Dec 2014 20:13:13 GMT

    [ https://issues.apache.org/jira/browse/HDFS-7540?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14250450#comment-14250450

Colin Patrick McCabe commented on HDFS-7540:

bq. I wonder if we should really return a ChunkedArrayList here. It only implements a subset
of the AbstractList interface, and this is a pretty general-purpose method. For huge dirs,
we should probably just be using the DirectoryStream iterator directly. I do see the use of
these helper functions for quick-and-dirty listings though.

I think maybe later {{ChunkedArrayList}} will become more general-purpose.  But you're right;
for now, we better use {{ArrayList}}.

bq. Need <p/> tag for javadoc linebreak


bq. I read the docs at http://docs.oracle.com/javase/7/docs/api/java/nio/file/DirectoryStream.html
and it'd be nice to do like the example and unwrap the DirectoryIteratorException into an

Yeah, that's important... io errors should result in io exceptions.  Looks like {{DirectoryIteratorException}}
is a {{RuntimeException}}... probably in order to conform to the {{Iterator}} interface.

I removed the variant that returns a list of File, since I found that the JDK6 file listing
interfaces actually returned an array of String, so returning a list of String is compatible-ish.

> Add IOUtils#listDirectory
> -------------------------
>                 Key: HDFS-7540
>                 URL: https://issues.apache.org/jira/browse/HDFS-7540
>             Project: Hadoop HDFS
>          Issue Type: Improvement
>    Affects Versions: 2.7.0
>            Reporter: Colin Patrick McCabe
>            Assignee: Colin Patrick McCabe
>         Attachments: HDFS-7540.001.patch, HDFS-7540.002.patch
> We should have a drop-in replacement for File#listDir that doesn't hide IOExceptions,
and which returns a ChunkedArrayList rather than a single large array.

This message was sent by Atlassian JIRA

View raw message