svn merge -c 1183175 from trunk for HDFS-2424.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-0.23@1189489 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Tsz-wo Sze 2011-10-26 21:38:30 +00:00
parent cb8ab18033
commit 9c5bdd0e66
3 changed files with 9 additions and 4 deletions

View File

@ -1104,6 +1104,9 @@ Release 0.23.0 - Unreleased
to IllegalArgumentException and response it http BAD_REQUEST in webhdfs.
(szetszwo)
HDFS-2424. Added a root element "HdfsFileStatuses" for the response
of webhdfs listStatus. (szetszwo)
BREAKDOWN OF HDFS-1073 SUBTASKS
HDFS-1521. Persist transaction ID on disk between NN restarts.

View File

@ -490,7 +490,8 @@ public class NamenodeWebHdfsMethods {
@Override
public void write(final OutputStream outstream) throws IOException {
final PrintStream out = new PrintStream(outstream);
out.println("{\"" + HdfsFileStatus.class.getSimpleName() + "\":[");
out.println("{\"" + HdfsFileStatus.class.getSimpleName() + "es\":{\""
+ HdfsFileStatus.class.getSimpleName() + "\":[");
final HdfsFileStatus[] partial = first.getPartialListing();
if (partial.length > 0) {
@ -509,7 +510,8 @@ public class NamenodeWebHdfsMethods {
}
}
out.println("]}");
out.println();
out.println("]}}");
}
};
}

View File

@ -404,8 +404,8 @@ public class WebHdfsFileSystem extends HftpFileSystem {
final HttpOpParam.Op op = GetOpParam.Op.LISTSTATUS;
final Map<?, ?> json = run(op, f);
final Object[] array = (Object[])json.get(
HdfsFileStatus.class.getSimpleName());
final Map<?, ?> rootmap = (Map<?, ?>)json.get(HdfsFileStatus.class.getSimpleName() + "es");
final Object[] array = (Object[])rootmap.get(HdfsFileStatus.class.getSimpleName());
//convert FileStatus
final FileStatus[] statuses = new FileStatus[array.length];