fix style and throw exception instead of print
This commit is contained in:
parent
a2dbe5df80
commit
597aeb1fba
|
@ -210,9 +210,9 @@ public class DFSAdmin extends FsShell {
|
|||
"\" is not a valid value for a quota.");
|
||||
}
|
||||
if (HdfsConstants.QUOTA_DONT_SET == this.quota) {
|
||||
System.err.print("WARN: \"" + this.quota +
|
||||
"\" means QUOTA_DONT_SET, quota will not be set, "
|
||||
+ "it keep the old values. \n");
|
||||
throw new IllegalArgumentException("WARN: \"" + this.quota +
|
||||
"\" means QUOTA_DONT_SET, quota will not be set, " +
|
||||
"it keep the old values.");
|
||||
}
|
||||
this.args = parameters.toArray(new String[parameters.size()]);
|
||||
}
|
||||
|
@ -335,9 +335,9 @@ public class DFSAdmin extends FsShell {
|
|||
throw new IllegalArgumentException("\"" + str + "\" is not a valid value for a quota.");
|
||||
}
|
||||
if (HdfsConstants.QUOTA_DONT_SET == quota) {
|
||||
System.err.print("WARN: \"" + this.quota +
|
||||
"\" means QUOTA_DONT_SET, quota will not be set, "
|
||||
+ "it keep the old values. \n");
|
||||
throw new IllegalArgumentException("WARN: \"" + this.quota +
|
||||
"\" means QUOTA_DONT_SET, quota will not be set, " +
|
||||
"it keep the old values.");
|
||||
}
|
||||
String storageTypeString =
|
||||
StringUtils.popOptionWithArgument("-storageType", parameters);
|
||||
|
|
|
@ -1236,14 +1236,15 @@ public class TestQuota {
|
|||
final int ret = ToolRunner.run(
|
||||
dfsAdmin,
|
||||
new String[] {"-setQuota",
|
||||
String.valueOf(HdfsConstants.QUOTA_DONT_SET), dir.toString()});
|
||||
assertEquals(0, ret);
|
||||
String.valueOf(HdfsConstants.QUOTA_DONT_SET),
|
||||
dir.toString()});
|
||||
assertEquals(-1, ret);
|
||||
scanIntoList(ERR_STREAM, outs);
|
||||
assertEquals(1, outs.size());
|
||||
assertEquals(2, outs.size());
|
||||
assertThat(outs.get(0),
|
||||
is(allOf(containsString("WARN:"),
|
||||
containsString("means QUOTA_DONT_SET, quota will not be set, " +
|
||||
"it keep the old values."))));
|
||||
containsString("means QUOTA_DONT_SET, quota will " +
|
||||
"not be set, it keep the old values."))));
|
||||
|
||||
final List<String> outs1 = Lists.newArrayList();
|
||||
/* set quota 0 */
|
||||
|
@ -1280,14 +1281,15 @@ public class TestQuota {
|
|||
final int ret = ToolRunner.run(
|
||||
dfsAdmin,
|
||||
new String[] {"-setSpaceQuota",
|
||||
String.valueOf(HdfsConstants.QUOTA_DONT_SET), dir.toString()});
|
||||
assertEquals(0, ret);
|
||||
String.valueOf(HdfsConstants.QUOTA_DONT_SET),
|
||||
dir.toString()});
|
||||
assertEquals(-1, ret);
|
||||
scanIntoList(ERR_STREAM, outs);
|
||||
assertEquals(1, outs.size());
|
||||
assertEquals(2, outs.size());
|
||||
assertThat(outs.get(0),
|
||||
is(allOf(containsString("WARN:"),
|
||||
containsString("means QUOTA_DONT_SET, quota will not be set, " +
|
||||
"it keep the old values."))));
|
||||
containsString("means QUOTA_DONT_SET, quota will " +
|
||||
"not be set, it keep the old values."))));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue