hadoop-common-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Yongjun Zhang (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HADOOP-14429) FTPFileSystem#getFsAction always returns FsAction.NONE
Date Mon, 19 Jun 2017 02:34:01 GMT

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

Yongjun Zhang commented on HADOOP-14429:
----------------------------------------

Hi [~Hongyuan Li],

Thanks for the updated patch. 

What about remove the map and do:
{code}
  @Test
  public void testGetFsAction() throws IOException {
    FTPFileSystem ftp = new FTPFileSystem();
    int[] accesses = new int[] {FTPFile.USER_ACCESS, FTPFile.GROUP_ACCESS,
        FTPFile.WORLD_ACCESS};
    FsAction[] actions = FsAction.values();
    for(int i = 0; i < accesses.length; i++){
      for(int j = 0; j < actions.length; j++){
        FTPFile ftpFile = getFTPFile(accesses[i], actions[j]);
        assertEquals(actions[j], ftp.getFsAction(accesses[i], ftpFile));
      }
    }
    ftp.close();
  }
{code}
?

Seems this makea the code more simplified.

Thanks.


> FTPFileSystem#getFsAction  always returns FsAction.NONE
> -------------------------------------------------------
>
>                 Key: HADOOP-14429
>                 URL: https://issues.apache.org/jira/browse/HADOOP-14429
>             Project: Hadoop Common
>          Issue Type: Bug
>          Components: fs
>    Affects Versions: 3.0.0-alpha2
>            Reporter: Hongyuan Li
>            Assignee: Hongyuan Li
>         Attachments: HADOOP-14429-001.patch, HADOOP-14429-002.patch, HADOOP-14429-003.patch,
HADOOP-14429-004.patch, HADOOP-14429-005.patch, HADOOP-14429-006.patch, HADOOP-14429-007.patch
>
>
>   
> {code}
> private FsAction getFsAction(int accessGroup, FTPFile ftpFile) {
>       FsAction action = FsAction.NONE;
>       if (ftpFile.hasPermission(accessGroup, FTPFile.READ_PERMISSION)) {
>       action.or(FsAction.READ);
>   }
>     if (ftpFile.hasPermission(accessGroup, FTPFile.WRITE_PERMISSION)) {
>       action.or(FsAction.WRITE);
>     }
>     if (ftpFile.hasPermission(accessGroup, FTPFile.EXECUTE_PERMISSION)) {
>       action.or(FsAction.EXECUTE);
>     }
>     return action;
>   }
> {code}
> from code above, we can see that the  getFsAction method doesnot modify the action generated
by FsAction action = FsAction.NONE,which means it return FsAction.NONE all the time;



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

---------------------------------------------------------------------
To unsubscribe, e-mail: common-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-issues-help@hadoop.apache.org


Mime
View raw message