[
https://issues.apache.org/jira/browse/HDFS-4983?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13838559#comment-13838559
]
Fengdong Yu commented on HDFS-4983:
-----------------------------------
Hi [~yzhangal] ,
We often limit 80 characters one line. so please wrap lines such as :
{code}
public static final String USER_PATTERN_KEY =
"webhdfs.user.provider.user.pattern";
{code}
{code}
private static Domain DOMAIN = null;
{code}
don't use uppercase for a non-final variable here.
{code}
+
+ @Test
+ public void testUserNameOkAfterResettingPattern() {
+ String oldPattern = UserParam.getUserPattern();
+ String newPattern = "^[A-Za-z0-9_][A-Za-z0-9._-]*[$]?$";
+ UserParam.setUserPattern(newPattern);
+ UserParam userParam = new UserParam("1x");
+ assertNotNull(userParam.getValue());
+ userParam = new UserParam("123");
+ assertNotNull(userParam.getValue());
+ UserParam.setUserPattern(oldPattern);
+ }
{code}
please add some new lines to identify different groups, such as:
{code}
+
+ @Test
+ public void testUserNameOkAfterResettingPattern() {
+ String oldPattern = UserParam.getUserPattern();
+ String newPattern = "^[A-Za-z0-9_][A-Za-z0-9._-]*[$]?$";
+ UserParam.setUserPattern(newPattern);
+ UserParam userParam = new UserParam("1x");
+ assertNotNull(userParam.getValue());
+ userParam = new UserParam("123");
+ assertNotNull(userParam.getValue());
+ UserParam.setUserPattern(oldPattern);
+ }
{code}
> Numeric usernames do not work with WebHDFS FS
> ---------------------------------------------
>
> Key: HDFS-4983
> URL: https://issues.apache.org/jira/browse/HDFS-4983
> Project: Hadoop HDFS
> Issue Type: Improvement
> Components: webhdfs
> Affects Versions: 2.0.0-alpha
> Reporter: Harsh J
> Assignee: Yongjun Zhang
> Labels: patch
> Attachments: HDFS-4983.001.patch, HDFS-4983.002.patch
>
>
> Per the file
> hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/web/resources/UserParam.java,
> the DOMAIN pattern is set to: {{^[A-Za-z_][A-Za-z0-9._-]*[$]?$}}.
> Given this, using a username such as "123" seems to fail for some reason
> (tried on insecure setup):
> {code}
> [123@host-1 ~]$ whoami
> 123
> [123@host-1 ~]$ hadoop fs -fs webhdfs://host-2.domain.com -ls /
> -ls: Invalid value: "123" does not belong to the domain
> ^[A-Za-z_][A-Za-z0-9._-]*[$]?$
> Usage: hadoop fs [generic options] -ls [-d] [-h] [-R] [<path> ...]
> {code}
--
This message was sent by Atlassian JIRA
(v6.1#6144)