All of lore.kernel.org
 help / color / mirror / Atom feed
From: Noah Watkins <jayhawk@soe.ucsc.edu>
To: ceph-devel <ceph-devel@vger.kernel.org>
Cc: Gregory Farnum <gregory.farnum@dreamhost.com>
Subject: [PATCH] hadoop: fix contract for listStatus
Date: Fri, 28 Oct 2011 17:25:28 -0700 (PDT)	[thread overview]
Message-ID: <975279467.13273.1319847928971.JavaMail.root@mail-01.cse.ucsc.edu> (raw)

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@gmail.com>
---
 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

             reply	other threads:[~2011-10-29  0:25 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-29  0:25 Noah Watkins [this message]
2011-10-31 18:22 ` [PATCH] hadoop: fix contract for listStatus Gregory Farnum

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=975279467.13273.1319847928971.JavaMail.root@mail-01.cse.ucsc.edu \
    --to=jayhawk@soe.ucsc.edu \
    --cc=ceph-devel@vger.kernel.org \
    --cc=gregory.farnum@dreamhost.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.