[jira] [Created] (NET-473) FTPClient setSoTimeout (int time) will result in NullPointerException

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

[jira] [Created] (NET-473) FTPClient setSoTimeout (int time) will result in NullPointerException

ASF GitHub Bot (Jira)
Yuliya Polyeno created NET-473:
----------------------------------

             Summary: FTPClient setSoTimeout (int time) will result in NullPointerException
                 Key: NET-473
                 URL: https://issues.apache.org/jira/browse/NET-473
             Project: Commons Net
          Issue Type: Bug
          Components: FTP
            Reporter: Yuliya Polyeno
            Priority: Minor


After creating FTPClient you are able to invoke org.apache.commons.net.SocketClient-> setSoTimeout () method which will result in NullPointerException.

It happens because in SocketClient class Socket object is initialized with null. Shouldn't it be more sensible to create new socket from the socketFactory and don't wait for socket creation till connect() method, because it will be imposiible to do any configuration to the socket until you're connected.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       
Reply | Threaded
Open this post in threaded view
|

[jira] [Commented] (NET-473) FTPClient setSoTimeout (int time) will result in NullPointerException

ASF GitHub Bot (Jira)

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

Sebb commented on NET-473:
--------------------------

The Javadoc says:

Only call this method after a connection has been opened
by {@link #connect connect()}.

It's not possible to initialise the socket when creating FTPClient.
Use SocketClient.setDefaultTimeout(int timeout) instead.
               

> FTPClient setSoTimeout (int time) will result in NullPointerException
> ---------------------------------------------------------------------
>
>                 Key: NET-473
>                 URL: https://issues.apache.org/jira/browse/NET-473
>             Project: Commons Net
>          Issue Type: Bug
>          Components: FTP
>            Reporter: Yuliya Polyeno
>            Priority: Minor
>
> After creating FTPClient you are able to invoke org.apache.commons.net.SocketClient-> setSoTimeout () method which will result in NullPointerException.
> It happens because in SocketClient class Socket object is initialized with null. Shouldn't it be more sensible to create new socket from the socketFactory and don't wait for socket creation till connect() method, because it will be imposiible to do any configuration to the socket until you're connected.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       
Reply | Threaded
Open this post in threaded view
|

[jira] [Resolved] (NET-473) FTPClient setSoTimeout (int time) will result in NullPointerException

ASF GitHub Bot (Jira)
In reply to this post by ASF GitHub Bot (Jira)

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

Sebb resolved NET-473.
----------------------

       Resolution: Fixed
    Fix Version/s: 3.2

Javadoc clarified.

URL: http://svn.apache.org/viewvc?rev=1361535&view=rev
Log:
NET-473 FTPClient setSoTimeout (int time) will result in NullPointerException. Clarify Javadoc.

Modified:
    commons/proper/net/trunk/src/changes/changes.xml
    commons/proper/net/trunk/src/main/java/org/apache/commons/net/SocketClient.java
               

> FTPClient setSoTimeout (int time) will result in NullPointerException
> ---------------------------------------------------------------------
>
>                 Key: NET-473
>                 URL: https://issues.apache.org/jira/browse/NET-473
>             Project: Commons Net
>          Issue Type: Bug
>          Components: FTP
>            Reporter: Yuliya Polyeno
>            Priority: Minor
>             Fix For: 3.2
>
>
> After creating FTPClient you are able to invoke org.apache.commons.net.SocketClient-> setSoTimeout () method which will result in NullPointerException.
> It happens because in SocketClient class Socket object is initialized with null. Shouldn't it be more sensible to create new socket from the socketFactory and don't wait for socket creation till connect() method, because it will be imposiible to do any configuration to the socket until you're connected.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira