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
|
HDFS-5520. loading cache path directives from edit log doesn't update
|
||||||
nextEntryId (cmccabe)
|
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
|
Release 2.3.0 - UNRELEASED
|
||||||
|
|
||||||
INCOMPATIBLE CHANGES
|
INCOMPATIBLE CHANGES
|
||||||
|
@ -741,14 +741,15 @@ public int run(Configuration conf, List<String> args) throws IOException {
|
|||||||
RemoteIterator<CachePoolInfo> iter = dfs.listCachePools();
|
RemoteIterator<CachePoolInfo> iter = dfs.listCachePools();
|
||||||
while (iter.hasNext()) {
|
while (iter.hasNext()) {
|
||||||
CachePoolInfo info = iter.next();
|
CachePoolInfo info = iter.next();
|
||||||
|
String[] row = new String[5];
|
||||||
if (name == null || info.getPoolName().equals(name)) {
|
if (name == null || info.getPoolName().equals(name)) {
|
||||||
listing.addRow(new String[] {
|
row[0] = info.getPoolName();
|
||||||
info.getPoolName(),
|
row[1] = info.getOwnerName();
|
||||||
info.getOwnerName(),
|
row[2] = info.getGroupName();
|
||||||
info.getGroupName(),
|
row[3] = info.getMode() != null ? info.getMode().toString() : null;
|
||||||
info.getMode().toString(),
|
row[4] =
|
||||||
info.getWeight().toString(),
|
info.getWeight() != null ? info.getWeight().toString() : null;
|
||||||
});
|
listing.addRow(row);
|
||||||
++numResults;
|
++numResults;
|
||||||
if (name != null) {
|
if (name != null) {
|
||||||
break;
|
break;
|
||||||
|
@ -59,6 +59,9 @@ private static class Column {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void addRow(String val) {
|
private void addRow(String val) {
|
||||||
|
if (val == null) {
|
||||||
|
val = "";
|
||||||
|
}
|
||||||
if ((val.length() + 1) > maxWidth) {
|
if ((val.length() + 1) > maxWidth) {
|
||||||
maxWidth = val.length() + 1;
|
maxWidth = val.length() + 1;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user