You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by Dmitri Priimak <pr...@gmail.com> on 2014/09/11 19:14:56 UTC

In (Default)SftpClient readDir(Handle handle) vs readDir(final String path)

Hi All.

I have one more question. In org.apache.sshd.client.sftp.DefaultSftpClient
there are two functions

    public DirEntry[] readDir(Handle handle)

and

    Iterable<DirEntry> readDir(final String path)

When the directory is empty the first one return null instead of empty
array
the second one does not. Wouldn't be better if readDir(Handle handle)
returned
empty array, which could be done by changing just one line ( line 520 ) in
the
DefaultSftpClient.java ?

Also, I noticed that there does not seem to be much of the javadoc
documentation
in both SftpClient and DefaultSftpClient classes. Thus it was not
completely clear if
readDir(...) could return null or not. Is that something that could
remedied? I would
offer you my help in writing javadoc but I do not think that I have much of
knowledge
of internals of you code.

--
Dmitri Priimak

Re: In (Default)SftpClient readDir(Handle handle) vs readDir(final String path)

Posted by Dmitri Priimak <pr...@gmail.com>.
Also, looking at the code for

    Iterable<DirEntry> readDir(final String path)

in DefaultSftpClient it does not look like the handle which is opened line
612 is
guaranteed to close in the load() function ( defined in lines 617-633 ).

--
Dmitri Priimak


On Thu, Sep 11, 2014 at 10:14 AM, Dmitri Priimak <pr...@gmail.com> wrote:

> Hi All.
>
> I have one more question. In org.apache.sshd.client.sftp.DefaultSftpClient
> there are two functions
>
>     public DirEntry[] readDir(Handle handle)
>
> and
>
>     Iterable<DirEntry> readDir(final String path)
>
> When the directory is empty the first one return null instead of empty
> array
> the second one does not. Wouldn't be better if readDir(Handle handle)
> returned
> empty array, which could be done by changing just one line ( line 520 ) in
> the
> DefaultSftpClient.java ?
>
> Also, I noticed that there does not seem to be much of the javadoc
> documentation
> in both SftpClient and DefaultSftpClient classes. Thus it was not
> completely clear if
> readDir(...) could return null or not. Is that something that could
> remedied? I would
> offer you my help in writing javadoc but I do not think that I have much
> of knowledge
> of internals of you code.
>
> --
> Dmitri Priimak
>
>