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

[net] Solution for ant ftp fails with Nullpointerexception when a symlink is evaluated in method checkRemoteSensitivity in FTP.java for a z/OS ftp server

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.4
    • 2.0
    • None
    • None
    • Operating System: Windows 2000
      Platform: PC

    • 36258

    Description

      The following code is trying to download a file from a z/OS FTP server:
      <ftp action="get" server="${server}" userid="${userid}" password="${password}"
      remotedir="/usr/lpp/ims/imsjava91">
      <fileset dir="C:\temp">
      <include name="imsjava.jar"/>
      </fileset>
      </ftp>

      The directory in my case also contains symlinks to non Unix File Systems. For
      those symlinks somehow the FTP classes are not able to obtain file information,
      e.g. the following listing prints String target and array[pcounter] from method
      checkRemoteSensitivity in org/apache/tools/ant/taskdefs/optional/net/FTP.java:

      [ftp] getting files
      [ftp] ibm drwxr-xr-x 2 OMVSKERN SYS1 8192 Feb 14 2005 IBM
      [ftp] ibm rw-rr- 2 OMVSKERN SYS1 1963 Feb 14 2005 README
      [ftp] ibm drwxr-xr-x 3 OMVSKERN SYS1 8192 Feb 14 2005 cics
      [ftp] ibm drwxr-xr-x 4 OMVSKERN SYS1 8192 Jun 16 13:50 dlimodel
      [ftp] ibm rw-rr- 2 OMVSKERN SYS1 267217 Jun 16 13:50 imsjava.ja
      r
      [ftp] ibm rw-rr- 2 OMVSKERN SYS1 5545 Jun 16 13:50 imsjava91.
      rar
      [ftp] ibm drwxr-xr-x 3 OMVSKERN SYS1 8192 Feb 14 2005 lib
      [ftp] ibm null

      In FTP.java at line 536 it is not checked if array[pcounter] is null.

      Commons-net is at 1.4.0. Apache Ant version is 1.6.2 compiled on July 16 2004. I
      did not try to research the cause in the code, why the file information is null.
      For me I added an if clause around lines 536-538 to check if array[pcounter] is
      null and this worked great.

      So I replaced lines:
      if (array[pcounter].getName().equals(target) &&
      pcounter != icounter)

      { candidateFound = false; }

      with:
      if (array[pcounter] != null) {
      if (array[pcounter].getName().equals(target) &&
      pcounter != icounter) { candidateFound = false; }

      }

      I would highly appreciate to add that code to Ant, otherwise my customers will
      not be able to use any Ant version for some z/OS directories.
      Thank you in advance.

      Attachments

        1. ASF.LICENSE.NOT.GRANTED--UnixFTPEntryParser.diffs
          0.9 kB
          Denis Gaebler
        2. ASF.LICENSE.NOT.GRANTED--FTP.diffs
          0.9 kB
          Denis Gaebler

        Activity

          People

            Unassigned Unassigned
            denisgaebler@netscape.net Denis Gaebler
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: