Issue Details (XML | Word | Printable)

Key: NET-39
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Unassigned
Reporter: Denis Gaebler
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Commons Net

[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

Created: 19/Aug/05 04:22 AM   Updated: 20/Sep/07 05:31 AM
Return to search
Component/s: None
Affects Version/s: 1.4
Fix Version/s: 2.0

Time Tracking:
Not Specified

File Attachments:
  Size
Text File FTP.diffs 2005-08-19 04:40 AM Denis Gaebler 0.9 kB
Text File UnixFTPEntryParser.diffs 2005-08-20 05:20 AM Denis Gaebler 0.9 kB
Environment:
Operating System: Windows 2000
Platform: PC

Bugzilla Id: 36258
Resolution Date: 27/Aug/06 05:05 PM


 Description  « Hide
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.



 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Henri Yandell made changes - 16/May/06 09:59 AM
Field Original Value New Value
issue.field.bugzillaimportkey 36258 12342493
Henri Yandell made changes - 16/May/06 11:48 AM
Key COM-2341 NET-39
Assignee Steve Cohen [ scohen@apache.org ]
Component/s Net [ 12311127 ]
Project Commons [ 12310458 ] Commons Net [ 12310487 ]
Affects Version/s 1.4 Final [ 12311663 ]
Henri Yandell made changes - 16/May/06 12:10 PM
Affects Version/s 1.4 Final [ 12311703 ]
Rory Winston made changes - 27/Aug/06 05:05 PM
Status Open [ 1 ] Resolved [ 5 ]
Resolution Fixed [ 1 ]
Fix Version/s 2.0 [ 12312040 ]
Henri Yandell made changes - 20/Sep/07 05:31 AM
Status Resolved [ 5 ] Closed [ 6 ]