Uploaded image for project: 'Hadoop HDFS'
  1. Hadoop HDFS
  2. HDFS-1820

FTPFileSystem attempts to close the outputstream even when it is not initialised

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 0.20.1
    • 3.3.1
    • hdfs-client
    • occurs on all platforms

    • FTPFileSystem FTPClient file permissions

    Description

      FTPFileSystem's create method attempts to close the outputstream even when it is not initialized causing a null pointer exception. In our case the apache commons FTPClient was not able to create the destination file due to permissions issue. The FtpClient promptly reported a 553 : Permissions issue but it was overlooked in FTPFileSystem create method.

      The following code fails

      if (!FTPReply.isPositivePreliminary(client.getReplyCode()))

      { // The ftpClient is an inconsistent state. Must close the stream // which in turn will logout and disconnect from FTP server fos.close(); throw new IOException("Unable to create file: " + file + ", Aborting"); }

      as 'fos' is null. As a result the proper error message "Unable to create file XXX" is not reported but rather a null pointer exception.

      Attachments

        1. HDFS-1820.002.patch
          11 kB
          Mikhail Pryakhin
        2. HDFS-1820.001.patch
          11 kB
          Mikhail Pryakhin

        Issue Links

          Activity

            People

              m.pryahin Mikhail Pryakhin
              sudhan65 Sudharsan Sampath
              Votes:
              1 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: