commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alexander (JIRA)" <j...@apache.org>
Subject [jira] Created: (NET-224) NullPointerException if in ftp-directory are files with creation date Feb 29 current year (Problem of leap year)
Date Thu, 26 Jun 2008 09:48:45 GMT
NullPointerException if in ftp-directory are files with creation date Feb 29 current year (Problem
of leap year)
----------------------------------------------------------------------------------------------------------------

                 Key: NET-224
                 URL: https://issues.apache.org/jira/browse/NET-224
             Project: Commons Net
          Issue Type: Bug
    Affects Versions: 1.4
         Environment: Java 1.5/1.6
            Reporter: Alexander


1) Ant code:

        <ftp action="get"
            server="${ftp.server}"
            userid="${ftp.user}"
            password="${ftp.password}"
            remotedir="${ftp.dir}"
            verbose="yes"
            depends="yes">
            <fileset dir="${lib}">
                <include name="*.jar"/>
            </fileset>
        </ftp>

NullPointerException if in ${ftp.dir} are files with creation date Feb 29 current year

2) Caused:
   Incorrect parse creation date Feb 29 current year

For java 1.5/1.6:
   Example 1:
        SimpleDateFormat sdf = new SimpleDateFormat("MMM d yy");
        sdf.setLenient(false);
        System.out.println("date=" + sdf.parse("Feb 29 12:14"));
  
      Result:
         date=null;

  If doesn't use command sdf.setLenient(false) then result: date = Sun Mar 01 12:14:00 EET
1970

For java 1.4:
    Result  always  "date=Sun Mar 01 12:14:00 EET 1970", because for java 1.4 doesn't throw
error NullPointerException


3) Sources:

File: commons-net-1.4.1\src\java\org\apache\commons\net\ftp\parser\FTPTimestampParserImpl.java


Caused  in function (line 225: this.recentDateFormat.setLenient(false);  ): 

	public void configure(FTPClientConfig config) {
                   ....

		String recentFormatString = config.getRecentDateFormatStr();
		if (recentFormatString == null) {
		    this.recentDateFormat = null;
		} else {
			this.recentDateFormat = new SimpleDateFormat(recentFormatString, dfs);
			this.recentDateFormat.setLenient(false); 
		}
               ....
           }



4) StackTrace:

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.checkRemoteSensitivity(FTP.java:583)
        at org.apache.tools.ant.taskdefs.optional.net.FTP$FTPDirectoryScanner.forceRemoteSensitivityCheck(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:585)
        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.checkRemoteSensitivity(FTP.java:583)
        at org.apache.tools.ant.taskdefs.optional.net.FTP$FTPDirectoryScanner.forceRemoteSensitivityCheck(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:585)
        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)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message