private FileStatus[] listStatuses(final String pattern) throws IllegalStateException {
        final FileStatus[] result;
        final String actualPattern;

        actualPattern = tryHomeDirectory(pattern);

        try {
            if ( fs.isDirectory(new Path(actualPattern)) ) { // a directory path - list its contents
                if ( actualPattern.endsWith( "/" ) ) {
                    result = fs.globStatus(new Path(actualPattern + "*"));
                } else {
                    result = fs.globStatus(new Path(actualPattern + "/*"));
                }
            } else { // a pattern or file path
                result = fs.globStatus(new Path(actualPattern));
            }
        } catch (final IOException e) {
          throw new IllegalStateException(e.getMessage(), e);
        }
        return result == null ? new FileStatus[0] : result;
    }
@param pattern refers directory or a set of files
@return a non-null array of the files and directories the pattern refers as of {@link Storage#ls(String)}
hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/structure/io/FileSystemStorage.java