Commons Net
  1. Commons Net
  2. NET-473

FTPClient setSoTimeout (int time) will result in NullPointerException

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 3.2
    • Component/s: FTP
    • Labels:
      None

      Description

      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.

        Activity

        Sebb made changes -
        Status Resolved [ 5 ] Closed [ 6 ]
        Sebb made changes -
        Field Original Value New Value
        Status Open [ 1 ] Resolved [ 5 ]
        Fix Version/s 3.2 [ 12320140 ]
        Resolution Fixed [ 1 ]
        Hide
        Sebb added a comment -

        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

        Show
        Sebb added a comment - 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
        Hide
        Sebb added a comment -

        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.

        Show
        Sebb added a comment - 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.
        Yuliya Polyeno created issue -

          People

          • Assignee:
            Unassigned
            Reporter:
            Yuliya Polyeno
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development