Uploaded image for project: 'Commons Net'
  1. Commons Net
  2. NET-59

[net] NullpointerException on FTPClient.disconnect() if an Exception occured while FTPClient.connect

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.2
    • 2.0
    • None
    • None
    • Operating System: All
      Platform: Other

    • 35185

    Description

      Hello,

      think this bug is the same (or at least similiar) to the following one:
      http://issues.apache.org/bugzilla/show_bug.cgi?id=26296
      but since I was not sure, I opened it as a seperate report.

      Versions affected: commons-net-1.2.2, think also commons-net-1.4.0

      Problem: If an exception occures while FTPClient.connect() is running, a call to
      FTPClient.disconnect() in a finally-block might throw a NullPointerException.
      I am pretty shure, that this might cause some Threads so keep alive, also they
      cannot be interrupted anymore.

      Reason: This happens since TelnetClient.disconnect() does not check whether the
      Streams (__input and __ouput) it tries to close are NULL or not.
      Normally it is sufficent to check FTPClient.isConnected(), but if a exceptions
      is thrown after SocketClient._connectAction has been excecuted, SocketClient.
      isConnected is set to true, so the check will indicate that the connection is
      alive.

      Christian

      Attachments

        Activity

          People

            Unassigned Unassigned
            christian.hufgard@gmx.de Christian Hufgard
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: