* [PATCH] hadoop: fix contract for listStatus
@ 2011-10-29 0:25 Noah Watkins
2011-10-31 18:22 ` Gregory Farnum
0 siblings, 1 reply; 2+ messages in thread
From: Noah Watkins @ 2011-10-29 0:25 UTC (permalink / raw)
To: ceph-devel; +Cc: Gregory Farnum
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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] hadoop: fix contract for listStatus
2011-10-29 0:25 [PATCH] hadoop: fix contract for listStatus Noah Watkins
@ 2011-10-31 18:22 ` Gregory Farnum
0 siblings, 0 replies; 2+ messages in thread
From: Gregory Farnum @ 2011-10-31 18:22 UTC (permalink / raw)
To: Noah Watkins; +Cc: ceph-devel
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@soe.ucsc.edu> 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@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
> --
> To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
> the body of a message to majordomo@vger.kernel.org
> 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@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-10-31 18:22 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-10-29 0:25 [PATCH] hadoop: fix contract for listStatus Noah Watkins
2011-10-31 18:22 ` Gregory Farnum
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.