hadoop-common-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Yuhao Bi (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (HADOOP-13765) Return HomeDirectory if possible in SFTPFileSystem
Date Thu, 27 Oct 2016 08:19:58 GMT

     [ https://issues.apache.org/jira/browse/HADOOP-13765?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Yuhao Bi updated HADOOP-13765:
------------------------------
    Description: 
In SFTPFileSystem#getHomeDirectory(), we disconnect the ChannelSftp in finally block.
If we get the homeDir Path successfully but got an IOE in the finally block we will return
the null result.
Maybe we can simply ignore this IOE and just return the result we have got.
Related codes are shown below.
{code:title=SFTPFileSystem.java|borderStyle=solid}
  public Path getHomeDirectory() {
    ChannelSftp channel = null;
    try {
      channel = connect();
      Path homeDir = new Path(channel.pwd());
      return homeDir;
    } catch (Exception ioe) {
      return null;
    } finally {
      try {
        disconnect(channel);
      } catch (IOException ioe) {
        //May be we can just ignore this IOE and do not return null here.
        return null;
      }
    }
  }
{code}

  was:
In SFTPFileSystem#getHomeDirectory(), we disconnect the ChannelSftp in finally block.
If we get the homeDir Path successfully but got an IOE in the finally block we will return
the null result.
Maybe we can simply ignore this IOE and just return the result we have got.Related codes are
shown below.
{code:title=SFTPFileSystem.java|borderStyle=solid}
  public Path getHomeDirectory() {
    ChannelSftp channel = null;
    try {
      channel = connect();
      Path homeDir = new Path(channel.pwd());
      return homeDir;
    } catch (Exception ioe) {
      return null;
    } finally {
      try {
        disconnect(channel);
      } catch (IOException ioe) {
        //May be we can just ignore this IOE
        return null;
      }
    }
  }
{code}


> Return HomeDirectory if possible in SFTPFileSystem
> --------------------------------------------------
>
>                 Key: HADOOP-13765
>                 URL: https://issues.apache.org/jira/browse/HADOOP-13765
>             Project: Hadoop Common
>          Issue Type: Bug
>          Components: fs
>            Reporter: Yuhao Bi
>
> In SFTPFileSystem#getHomeDirectory(), we disconnect the ChannelSftp in finally block.
> If we get the homeDir Path successfully but got an IOE in the finally block we will return
the null result.
> Maybe we can simply ignore this IOE and just return the result we have got.
> Related codes are shown below.
> {code:title=SFTPFileSystem.java|borderStyle=solid}
>   public Path getHomeDirectory() {
>     ChannelSftp channel = null;
>     try {
>       channel = connect();
>       Path homeDir = new Path(channel.pwd());
>       return homeDir;
>     } catch (Exception ioe) {
>       return null;
>     } finally {
>       try {
>         disconnect(channel);
>       } catch (IOException ioe) {
>         //May be we can just ignore this IOE and do not return null here.
>         return null;
>       }
>     }
>   }
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
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