From c6eaa8b37fe7749402d9da91bde23f90cd95b44a Mon Sep 17 00:00:00 2001 From: Alejandro Abdelnur Date: Wed, 10 Jul 2013 17:32:05 +0000 Subject: [PATCH] HDFS-4969. WebhdfsFileSystem expects non-standard WEBHDFS Json element. (rkanter via tucu) git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1501868 13f79535-47bb-0310-9956-ffa450edef68 --- hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt | 3 +++ .../src/main/java/org/apache/hadoop/hdfs/web/JsonUtil.java | 4 +++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt index 705b8a9aff..5600cdc6a5 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt +++ b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt @@ -1178,6 +1178,9 @@ Release 2.1.0-beta - 2013-07-02 HDFS-4951. FsShell commands using secure httpfs throw exceptions due to missing TokenRenewer. (rknater via tucu) + HDFS-4969. WebhdfsFileSystem expects non-standard WEBHDFS Json element. + (rkanter via tucu) + Release 2.0.5-alpha - 06/06/2013 INCOMPATIBLE CHANGES diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/web/JsonUtil.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/web/JsonUtil.java index 623ac89222..3afc59b1d9 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/web/JsonUtil.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/web/JsonUtil.java @@ -248,7 +248,9 @@ public static HdfsFileStatus toFileStatus(final Map json, boolean includes final short replication = (short) (long) (Long) m.get("replication"); final long fileId = m.containsKey("fileId") ? (Long) m.get("fileId") : INodeId.GRANDFATHER_INODE_ID; - final int childrenNum = (int) (long) (Long) m.get("childrenNum"); + Long childrenNumLong = (Long) m.get("childrenNum"); + final int childrenNum = (childrenNumLong == null) ? 0 + : childrenNumLong.intValue(); return new HdfsFileStatus(len, type == PathType.DIRECTORY, replication, blockSize, mTime, aTime, permission, owner, group, symlink, DFSUtil.string2Bytes(localName), fileId, childrenNum);