You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-issues@hadoop.apache.org by "Uma Maheswara Rao G (JIRA)" <ji...@apache.org> on 2014/04/27 08:29:15 UTC

[jira] [Comment Edited] (HADOOP-10521) FsShell commands for extended attributes.

    [ https://issues.apache.org/jira/browse/HADOOP-10521?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13982201#comment-13982201 ] 

Uma Maheswara Rao G edited comment on HADOOP-10521 at 4/27/14 6:27 AM:
-----------------------------------------------------------------------

Regarding to Enum#valueOf, how does below code piece look?
Of course guava library does that Illegalargumentexception handling and return null to us, if there is no enum value exist.
{code}
private final static Function<String, ENCODE> encodeValueOfFunc = Enums
      .valueOfFunction(ENCODE.class);
.........
.........
.........
if (en != null) {
  encode = encodeValueOfFunc.apply(en);
}
Preconditions.checkArgument(encode != null,
          "Invalid/unsupported econding option specified: en=" + en);

Test:
 runCommand(new String[] { "-getfattr", "-e", "invalid","-n", "xattrname", "/file1"  });
result:
-getfattr: Invalid/unsupported encoding option specified: en=invalid
{code}

tiny nit: 
"Can not specify both '-n name' and '-x name' *option.*" --> "Can not specify both '-n name' and '-x name' *options.*" ?


was (Author: umamaheswararao):
Regarding to Enum#valueOf, how does below code piece look?
Of course guava library does that Illegalargumentexception handling and return null to us, if there is no enum value exist.
{code}
private final static Function<String, ENCODE> encodeValueOfFunc = Enums
      .valueOfFunction(ENCODE.class);
.........
.........
.........
if (en != null) {
  encode = encodeValueOfFunc.apply(en);
}
Preconditions.checkArgument(encode != null,
          "Invalid/unsupported econding option specified: en=" + en);

Test:
 runCommand(new String[] { "-getfattr", "-e", "invalid","-n", "xattrname", "/file1"  });
result:
-getfattr: Invalid/unsupported encoding option specified: en=invalid
{code}

> FsShell commands for extended attributes.
> -----------------------------------------
>
>                 Key: HADOOP-10521
>                 URL: https://issues.apache.org/jira/browse/HADOOP-10521
>             Project: Hadoop Common
>          Issue Type: Sub-task
>          Components: fs
>    Affects Versions: HDFS XAttrs (HDFS-2006)
>            Reporter: Yi Liu
>            Assignee: Yi Liu
>         Attachments: HADOOP-10521.1.patch, HADOOP-10521.2.patch, HADOOP-10521.3.patch, HADOOP-10521.patch
>
>
> “setfattr” and “getfattr” commands are added to FsShell for XAttr, and these are the same as in Linux.



--
This message was sent by Atlassian JIRA
(v6.2#6252)