HDFS-5512. CacheAdmin -listPools fails with NPE when user lacks permissions to view all pools (awang via cmccabe)
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1543293 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
4f15d0af4f
commit
70234e2213
|
@ -378,6 +378,9 @@ Trunk (Unreleased)
|
|||
HDFS-5520. loading cache path directives from edit log doesn't update
|
||||
nextEntryId (cmccabe)
|
||||
|
||||
HDFS-5512. CacheAdmin -listPools fails with NPE when user lacks permissions
|
||||
to view all pools (awang via cmccabe)
|
||||
|
||||
Release 2.3.0 - UNRELEASED
|
||||
|
||||
INCOMPATIBLE CHANGES
|
||||
|
|
|
@ -741,14 +741,15 @@ public class CacheAdmin extends Configured implements Tool {
|
|||
RemoteIterator<CachePoolInfo> iter = dfs.listCachePools();
|
||||
while (iter.hasNext()) {
|
||||
CachePoolInfo info = iter.next();
|
||||
String[] row = new String[5];
|
||||
if (name == null || info.getPoolName().equals(name)) {
|
||||
listing.addRow(new String[] {
|
||||
info.getPoolName(),
|
||||
info.getOwnerName(),
|
||||
info.getGroupName(),
|
||||
info.getMode().toString(),
|
||||
info.getWeight().toString(),
|
||||
});
|
||||
row[0] = info.getPoolName();
|
||||
row[1] = info.getOwnerName();
|
||||
row[2] = info.getGroupName();
|
||||
row[3] = info.getMode() != null ? info.getMode().toString() : null;
|
||||
row[4] =
|
||||
info.getWeight() != null ? info.getWeight().toString() : null;
|
||||
listing.addRow(row);
|
||||
++numResults;
|
||||
if (name != null) {
|
||||
break;
|
||||
|
|
|
@ -59,6 +59,9 @@ public class TableListing {
|
|||
}
|
||||
|
||||
private void addRow(String val) {
|
||||
if (val == null) {
|
||||
val = "";
|
||||
}
|
||||
if ((val.length() + 1) > maxWidth) {
|
||||
maxWidth = val.length() + 1;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue