public static FileStatus[] listStatus(final FileSystem fs, final Path dir,
    final PathFilter filter) throws IOException {
    FileStatus[] status = null;
    try {
      status = filter == null ? fs.listStatus(dir) : fs.listStatus(dir, filter);
    } catch (FileNotFoundException fnfe) {
      // if directory doesn't exist, return null
      if (LOG.isTraceEnabled()) {
        LOG.trace("{} doesn't exist", dir);
      }
    }
    if (status == null || status.length < 1) {
      return null;
    }
    return status;
  }
Calls fs.listStatus() and treats FileNotFoundException as non-fatal This accommodates
differences between hadoop versions, where hadoop 1 does not throw a FileNotFoundException, and
return an empty FileStatus[] while Hadoop 2 will throw FileNotFoundException. Where possible,
prefer FSUtils#listStatusWithStatusFilter(FileSystem, Path, FileStatusFilter) instead.
@param fs     file system
@param dir    directory
@param filter path filter
@return null if dir is empty or doesn't exist, otherwise FileStatus array
hbase-common/src/main/java/org/apache/hadoop/hbase/util/CommonFSUtils.java