Re: [PATCH] hadoop: fix contract for listStatus

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Just pushed this to master in
commit:f9b7ecdb5bba1439dc4c13005a6213ddb6ecfcc5, with a minor change
to the patch description. :)
Thanks!

On Fri, Oct 28, 2011 at 5:25 PM, Noah Watkins <jayhawk@xxxxxxxxxxxx> wrote:
> Return NULL when the path does not exist. Although
> unspecified in the declaration header, other file
> systems return a single result when the path is a file.
>
> This fixes tracker issue #1661
>
> Signed-off-by: Noah Watkins <noahwatkins@xxxxxxxxx>
> ---
>  src/client/hadoop/ceph/CephFileSystem.java |   14 +++++++-------
>  1 files changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/src/client/hadoop/ceph/CephFileSystem.java b/src/client/hadoop/ceph/CephFileSystem.java
> index c697075..a7317b1 100644
> --- a/src/client/hadoop/ceph/CephFileSystem.java
> +++ b/src/client/hadoop/ceph/CephFileSystem.java
> @@ -435,9 +435,8 @@ public class CephFileSystem extends FileSystem {
>    * Get the FileStatus for each listing in a directory.
>    * @param path The directory to get listings from.
>    * @return FileStatus[] containing one FileStatus for each directory listing;
> -   * null if path is not a directory.
> +   *         null if path does not exist.
>    * @throws IOException if initialize() hasn't been called.
> -   * @throws FileNotFoundException if the input path can't be found.
>    */
>   public FileStatus[] listStatus(Path path) throws IOException {
>     if (!initialized) {
> @@ -458,11 +457,12 @@ public class CephFileSystem extends FileSystem {
>       ceph.debug("listStatus:exit", ceph.DEBUG);
>       return statuses;
>     }
> -    if (!isFile(path)) {
> -      throw new FileNotFoundException();
> -    } // if we get here, listPaths returned null
> -    // which means that the input wasn't a directory, so throw an Exception if it's not a file
> -    return null; // or return null if it's a file
> +
> +    if (isFile(path)) {
> +      return new FileStatus[] { getFileStatus(path) };
> +    }
> +
> +    return null;
>   }
>
>   @Override
> --
> 1.7.5.4
> --
> To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>
--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [CEPH Users]     [Ceph Large]     [Information on CEPH]     [Linux BTRFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux