Bug 43559 - NullPointerException in ftp task when using recentDateFormatConfig
Summary: NullPointerException in ftp task when using recentDateFormatConfig
Status: CLOSED INVALID
Alias: None
Product: Ant
Classification: Unclassified
Component: Optional Tasks (show other bugs)
Version: 1.7.0
Hardware: PC Windows XP
: P2 normal (vote)
Target Milestone: ---
Assignee: Ant Notifications List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-10-05 01:37 UTC by Franck Perrin
Modified: 2008-02-22 12:18 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Franck Perrin 2007-10-05 01:37:22 UTC
I try to use the ftp task accessing an AIX 5.3 FTP server.
The server is in french language.
When I use the recentDateFormatConfig attribute, a NullPointerException is 
raised.
If I dont use it, nothing happens.
Here is the task I execute :
	<target name="listp114p06e">
		<ftp action="list"
			server="yyyyyy"
			userid="xxxxxx"
			password="zzzzzz"
			remotedir="Websphere/Envts/prod2/LogApps/Today"
			defaultDateFormatConfig="dd MMM yyyy"
			recentDateFormatConfig="dd MMM HH:mm"
			serverLanguageCodeConfig="fr"		             
			listing="list.txt">
			<fileset>
				<include name="**/*"/>
			</fileset>
		</ftp>
	</target>
Here the output in debug mode :

Apache Ant version 1.7.0 compiled on December 13 2006
Buildfile: ..\ant\build.xml
Adding reference: ant.PropertyHelper
Detected Java version: 1.4 in: C:\j2sdk1.4.2_06\jre
Detected OS: Windows XP
Adding reference: ant.ComponentHelper
Setting ro project property: ant.file -> C:\apache-ant-1.7.0
\bin\..\ant\build.xml
Adding reference: ant.projectHelper
Adding reference: ant.parsing.context
Adding reference: ant.targets
parsing buildfile C:\apache-ant-1.7.0\ant\build.xml with URI = file:/C:/apache-
ant-1.7.0/ant/build.xml
Setting ro project property: ant.project.name -> TestAntFTP
Adding reference: TestAntFTP
Setting ro project property: ant.file.TestAntFTP -> C:\apache-ant-1.7.0
\ant\build.xml
Project base dir set to: C:\apache-ant-1.7.0\ant
 +Target:
 +Target: getp114p06e
 +Target: listp114p06e
Attempting to create object of type org.apache.tools.ant.helper.DefaultExecutor
Adding reference: ant.executor
Build sequence for target(s) `listp114p06e' is [listp114p06e]
Complete build sequence is [listp114p06e, getp114p06e, ]

listp114p06e:
[antlib:org.apache.tools.ant] Could not load definitions from resource 
org/apache/tools/ant/antlib.xml. It could not be found.
      [ftp] Opening FTP connection to yyyyyy
      [ftp] custom configuration
      [ftp] custom config: system key = default (UNIX)
      [ftp] custom config: default date format = dd MMM yyyy
      [ftp] custom config: recent date format = dd MMM HH:mm
      [ftp] custom config: server language code = fr
      [ftp] connected
      [ftp] logging in to FTP server
      [ftp] login succeeded
      [ftp] changing the remote directory
      [ftp] listing files
fileset: Setup scanner in dir null with patternSet{ includes: [**/*] excludes: 
[] }
will try to cd to IDS where a directory called ids exists
      [ftp] disconnecting

BUILD FAILED
C:\apache-ant-1.7.0\ant\build.xml:38: java.lang.NullPointerException
        at org.apache.tools.ant.dispatch.DispatchUtils.execute
(DispatchUtils.java:115)
        at org.apache.tools.ant.Task.perform(Task.java:348)
        at org.apache.tools.ant.Target.execute(Target.java:357)
        at org.apache.tools.ant.Target.performTasks(Target.java:385)
        at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1329)
        at org.apache.tools.ant.Project.executeTarget(Project.java:1298)
        at org.apache.tools.ant.helper.DefaultExecutor.executeTargets
(DefaultExecutor.java:41)
        at org.apache.tools.ant.Project.executeTargets(Project.java:1181)
        at org.apache.tools.ant.Main.runBuild(Main.java:698)
        at org.apache.tools.ant.Main.startAnt(Main.java:199)
        at org.apache.tools.ant.launch.Launcher.run(Launcher.java:257)
        at org.apache.tools.ant.launch.Launcher.main(Launcher.java:104)
Caused by: java.lang.NullPointerException
        at 
org.apache.tools.ant.taskdefs.optional.net.FTP$FTPDirectoryScanner.checkRemoteSe
nsitivity(FTP.java:583)
        at 
org.apache.tools.ant.taskdefs.optional.net.FTP$FTPDirectoryScanner.forceRemoteSe
nsitivityCheck(FTP.java:552)
        at 
org.apache.tools.ant.taskdefs.optional.net.FTP$FTPDirectoryScanner.scan
(FTP.java:231)
        at org.apache.tools.ant.taskdefs.optional.net.FTP.transferFiles
(FTP.java:1570)
        at org.apache.tools.ant.taskdefs.optional.net.FTP.transferFiles
(FTP.java:1683)
        at org.apache.tools.ant.taskdefs.optional.net.FTP.execute(FTP.java:2373)
        at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke
(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke
(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:324)
        at org.apache.tools.ant.dispatch.DispatchUtils.execute
(DispatchUtils.java:105)
        ... 11 more
--- Nested Exception ---
java.lang.NullPointerException
        at 
org.apache.tools.ant.taskdefs.optional.net.FTP$FTPDirectoryScanner.checkRemoteSe
nsitivity(FTP.java:583)
        at 
org.apache.tools.ant.taskdefs.optional.net.FTP$FTPDirectoryScanner.forceRemoteSe
nsitivityCheck(FTP.java:552)
        at 
org.apache.tools.ant.taskdefs.optional.net.FTP$FTPDirectoryScanner.scan
(FTP.java:231)
        at org.apache.tools.ant.taskdefs.optional.net.FTP.transferFiles
(FTP.java:1570)
        at org.apache.tools.ant.taskdefs.optional.net.FTP.transferFiles
(FTP.java:1683)
        at org.apache.tools.ant.taskdefs.optional.net.FTP.execute(FTP.java:2373)
        at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke
(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke
(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:324)
        at org.apache.tools.ant.dispatch.DispatchUtils.execute
(DispatchUtils.java:105)
        at org.apache.tools.ant.Task.perform(Task.java:348)
        at org.apache.tools.ant.Target.execute(Target.java:357)
        at org.apache.tools.ant.Target.performTasks(Target.java:385)
        at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1329)
        at org.apache.tools.ant.Project.executeTarget(Project.java:1298)
        at org.apache.tools.ant.helper.DefaultExecutor.executeTargets
(DefaultExecutor.java:41)
        at org.apache.tools.ant.Project.executeTargets(Project.java:1181)
        at org.apache.tools.ant.Main.runBuild(Main.java:698)
        at org.apache.tools.ant.Main.startAnt(Main.java:199)
        at org.apache.tools.ant.launch.Launcher.run(Launcher.java:257)
        at org.apache.tools.ant.launch.Launcher.main(Launcher.java:104)

Total time: 1 second

I installed the libraries commons-net-1.4.1.jar and jakarta-oro-2.0.8.jar in 
ANT_HOME/lib.

Here is what I get when I use the FTP commands :
ftp> cd Websphere/Envts/prod2/LogApps/Today
250 Commande CWD rÚussie.
ftp> pwd
257 "/appli2/was/Websphere/Envts/prod2/LogApps/Today" est un rÚpertoire en cours
.
ftp> ls -l
200 Commande PORT rÚussie.
150 Ouverture de la connexion de donnÚes pour /bin/ls.
8 total
drwxr-xr-x   2 wasadmin wasadmin       4096 05 oct 09:30 ids
drwxr-xr-x   2 wasadmin wasadmin        256 04 oct 10:35 isu
drwxr-xr-x   3 wasadmin wasadmin        256 26 sep 09:50 nci
drwxr-xr-x   3 wasadmin wasadmin        256 12 sep 15:50 nco
drwxr-xr-x   2 wasadmin wasadmin        256 01 oct 09:02 nhb
drwxr-xr-x   2 wasadmin wasadmin        256 26 jul 07:35 niw
drwxr-xr-x   3 wasadmin wasadmin        256 25 jun 20:58 nsp
226 Transfert terminÚ.
ftp : 443 octets reçus en 0,00 secondes à 443000,00 Ko/sec.

As you can see the date format is "dd MMM HH:mm".

Thanks.
Comment 1 Franck Perrin 2007-10-09 14:04:53 UTC
Actually, there is no bug.
The problem was the month abbreviations used on the server in file timestamp dates.
I resolved the problem, setting the shortMonthNamesConfig attribute to
"jan|f\u00e9v|mar|avr|mai|jun|jul|ao\u00fb|sep|oct|nov|d\u00e9c".