HDFS-4236. Merge change 1418356 from trunk

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2@1418363 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Suresh Srinivas 2012-12-07 15:40:24 +00:00
parent 6fe949979a
commit 448882534b
5 changed files with 7 additions and 30 deletions

View File

@ -53,10 +53,9 @@ public class UserProvider extends AbstractHttpContextInjectable<Principal> imple
public String parseParam(String str) { public String parseParam(String str) {
if (str != null) { if (str != null) {
int len = str.length(); int len = str.length();
if (len < 1 || len > 31) { if (len < 1) {
throw new IllegalArgumentException(MessageFormat.format( throw new IllegalArgumentException(MessageFormat.format(
"Parameter [{0}], invalid value [{1}], it's length must be between 1 and 31", "Parameter [{0}], it's length must be at least 1", getName()));
getName(), str));
} }
} }
return super.parseParam(str); return super.parseParam(str);

View File

@ -108,13 +108,6 @@ public class TestUserProvider {
userParam.parseParam(""); userParam.parseParam("");
} }
@Test
@TestException(exception = IllegalArgumentException.class)
public void userNameTooLong() {
UserProvider.UserParam userParam = new UserProvider.UserParam("username");
userParam.parseParam("a123456789012345678901234567890x");
}
@Test @Test
@TestException(exception = IllegalArgumentException.class) @TestException(exception = IllegalArgumentException.class)
public void userNameInvalidStart() { public void userNameInvalidStart() {
@ -135,12 +128,6 @@ public class TestUserProvider {
assertNotNull(userParam.parseParam("a")); assertNotNull(userParam.parseParam("a"));
} }
@Test
public void userNameMaxLength() {
UserProvider.UserParam userParam = new UserProvider.UserParam("username");
assertNotNull(userParam.parseParam("a123456789012345678901234567890"));
}
@Test @Test
public void userNameValidDollarSign() { public void userNameValidDollarSign() {
UserProvider.UserParam userParam = new UserProvider.UserParam("username"); UserProvider.UserParam userParam = new UserProvider.UserParam("username");

View File

@ -303,6 +303,9 @@ Release 2.0.3-alpha - Unreleased
HDFS-4282. TestEditLog.testFuzzSequences FAILED in all pre-commit test HDFS-4282. TestEditLog.testFuzzSequences FAILED in all pre-commit test
(todd) (todd)
HDFS-4236. Remove artificial limit on username length introduced in
HDFS-4171. (tucu via suresh)
BREAKDOWN OF HDFS-3077 SUBTASKS BREAKDOWN OF HDFS-3077 SUBTASKS
HDFS-3077. Quorum-based protocol for reading and writing edit logs. HDFS-3077. Quorum-based protocol for reading and writing edit logs.

View File

@ -38,10 +38,9 @@ public class UserParam extends StringParam {
MessageFormat.format("Parameter [{0}], cannot be NULL", NAME)); MessageFormat.format("Parameter [{0}], cannot be NULL", NAME));
} }
int len = str.length(); int len = str.length();
if (len < 1 || len > 31) { if (len < 1) {
throw new IllegalArgumentException(MessageFormat.format( throw new IllegalArgumentException(MessageFormat.format(
"Parameter [{0}], invalid value [{1}], it's length must be between 1 and 31", "Parameter [{0}], it's length must be at least 1", NAME));
NAME, str));
} }
return str; return str;
} }

View File

@ -244,11 +244,6 @@ public class TestParam {
assertNull(userParam.getValue()); assertNull(userParam.getValue());
} }
@Test(expected = IllegalArgumentException.class)
public void userNameTooLong() {
new UserParam("a123456789012345678901234567890x");
}
@Test(expected = IllegalArgumentException.class) @Test(expected = IllegalArgumentException.class)
public void userNameInvalidStart() { public void userNameInvalidStart() {
new UserParam("1x"); new UserParam("1x");
@ -265,12 +260,6 @@ public class TestParam {
assertNotNull(userParam.getValue()); assertNotNull(userParam.getValue());
} }
@Test
public void userNameMaxLength() {
UserParam userParam = new UserParam("a123456789012345678901234567890");
assertNotNull(userParam.getValue());
}
@Test @Test
public void userNameValidDollarSign() { public void userNameValidDollarSign() {
UserParam userParam = new UserParam("a$"); UserParam userParam = new UserParam("a$");