You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Diego Souto (JIRA)" <ji...@apache.org> on 2008/02/29 14:10:52 UTC

[jira] Created: (NET-190) [FTP Client] Not listing files with 'invalid' date

[FTP Client] Not listing files with 'invalid' date
--------------------------------------------------

                 Key: NET-190
                 URL: https://issues.apache.org/jira/browse/NET-190
             Project: Commons Net
          Issue Type: Bug
    Affects Versions: 1.4
         Environment: FTP Gateway: Response:	331-httpiproxy2 FTP server (Version 1.9.2.4 - 2005/01/11 13:03:28) ready.
FTP Server: Response:	215 UNIX Type: L8
FTP Client: Jakarta Commons VFS over Jakarta Commons NET
            Reporter: Diego Souto


When trying to list files in a FTP directory with two files returns 0 FileObjects.

With another FTP client.... response is:
ftp> ls
227 Entering Passive Mode (212,163,35,155,160,40)
150 Conexión de datos aceptada
-rw-r--r--    1 0        0             222 Feb 29 09:47 AYC01R
-rw-r--r--    1 0        0             688 Feb 29 03:04 AYC02R
226-Options: -l 
226 2 ocurrencias en total

... so there are two files with date "FEBRUARY 29" (2008 is a leap year)

When listing files with Jakarta Commons VFS over Jakarta Commons NET it returns 0 files.

I revised Commons Net source and I found in 'org.apache.commons.net.ftp.parser.UnixFTPEntryParser' the following code:
            try
            {
                file.setTimestamp(super.parseTimestamp(datestr));
            }
            catch (ParseException e)
            {
            	return null;  // this is a parsing failure too.
            }

So I guess maybe the timestamp parser is throwing a ParseException (perhaps it's guessing a incorrect year) and in this case is returning NULL so the calling class is ignoring these files with 'Feb 29' date.

I think this behaviour is incorrect and must be fixed. If date is considered invalid it would throw an exception,... not simply ignore the file.

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


[jira] Commented: (NET-190) [FTP Client] Not listing files with 'invalid' date

Posted by "Sebb (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/NET-190?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12574118#action_12574118 ] 

Sebb commented on NET-190:
--------------------------

Duplicate of NET-188

> [FTP Client] Not listing files with 'invalid' date
> --------------------------------------------------
>
>                 Key: NET-190
>                 URL: https://issues.apache.org/jira/browse/NET-190
>             Project: Commons Net
>          Issue Type: Bug
>    Affects Versions: 1.4
>         Environment: FTP Gateway: Response:	331-httpiproxy2 FTP server (Version 1.9.2.4 - 2005/01/11 13:03:28) ready.
> FTP Server: Response:	215 UNIX Type: L8
> FTP Client: Jakarta Commons VFS over Jakarta Commons NET
>            Reporter: Diego Souto
>   Original Estimate: 3h
>  Remaining Estimate: 3h
>
> When trying to list files in a FTP directory with two files returns 0 FileObjects.
> With another FTP client.... response is:
> ftp> ls
> 227 Entering Passive Mode (212,163,35,155,160,40)
> 150 Conexión de datos aceptada
> -rw-r--r--    1 0        0             222 Feb 29 09:47 AYC01R
> -rw-r--r--    1 0        0             688 Feb 29 03:04 AYC02R
> 226-Options: -l 
> 226 2 ocurrencias en total
> ... so there are two files with date "FEBRUARY 29" (2008 is a leap year)
> When listing files with Jakarta Commons VFS over Jakarta Commons NET it returns 0 files.
> I revised Commons Net source and I found in 'org.apache.commons.net.ftp.parser.UnixFTPEntryParser' the following code:
>             try
>             {
>                 file.setTimestamp(super.parseTimestamp(datestr));
>             }
>             catch (ParseException e)
>             {
>             	return null;  // this is a parsing failure too.
>             }
> So I guess maybe the timestamp parser is throwing a ParseException (perhaps it's guessing a incorrect year) and in this case is returning NULL so the calling class is ignoring these files with 'Feb 29' date.
> I think this behaviour is incorrect and must be fixed. If date is considered invalid it would throw an exception,... not simply ignore the file.

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


[jira] Commented: (NET-190) [FTP Client] Not listing files with 'invalid' date

Posted by "Tim Fooy (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/NET-190?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12573749#action_12573749 ] 

Tim Fooy commented on NET-190:
------------------------------

Seems highly related to NET-188.

> [FTP Client] Not listing files with 'invalid' date
> --------------------------------------------------
>
>                 Key: NET-190
>                 URL: https://issues.apache.org/jira/browse/NET-190
>             Project: Commons Net
>          Issue Type: Bug
>    Affects Versions: 1.4
>         Environment: FTP Gateway: Response:	331-httpiproxy2 FTP server (Version 1.9.2.4 - 2005/01/11 13:03:28) ready.
> FTP Server: Response:	215 UNIX Type: L8
> FTP Client: Jakarta Commons VFS over Jakarta Commons NET
>            Reporter: Diego Souto
>   Original Estimate: 3h
>  Remaining Estimate: 3h
>
> When trying to list files in a FTP directory with two files returns 0 FileObjects.
> With another FTP client.... response is:
> ftp> ls
> 227 Entering Passive Mode (212,163,35,155,160,40)
> 150 Conexión de datos aceptada
> -rw-r--r--    1 0        0             222 Feb 29 09:47 AYC01R
> -rw-r--r--    1 0        0             688 Feb 29 03:04 AYC02R
> 226-Options: -l 
> 226 2 ocurrencias en total
> ... so there are two files with date "FEBRUARY 29" (2008 is a leap year)
> When listing files with Jakarta Commons VFS over Jakarta Commons NET it returns 0 files.
> I revised Commons Net source and I found in 'org.apache.commons.net.ftp.parser.UnixFTPEntryParser' the following code:
>             try
>             {
>                 file.setTimestamp(super.parseTimestamp(datestr));
>             }
>             catch (ParseException e)
>             {
>             	return null;  // this is a parsing failure too.
>             }
> So I guess maybe the timestamp parser is throwing a ParseException (perhaps it's guessing a incorrect year) and in this case is returning NULL so the calling class is ignoring these files with 'Feb 29' date.
> I think this behaviour is incorrect and must be fixed. If date is considered invalid it would throw an exception,... not simply ignore the file.

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


[jira] Commented: (NET-190) [FTP Client] Not listing files with 'invalid' date

Posted by "Wade Poziombka (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/NET-190?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12573935#action_12573935 ] 

Wade Poziombka commented on NET-190:
------------------------------------

I've drilled in and the problem is that the timestamp parsing code depends on SimpleDateFormat with leniency disabled.  That does not parse the date e.g., "Feb 29 17:46".

			ParsePosition pp = new ParsePosition(0);
			SimpleDateFormat format = new SimpleDateFormat("MMM d HH:mm");
			format.setLenient(false);
			Date date = format.parse("Feb 29 17:46", pp);

Yields null.  This should probably be a little smarter about how it parsed timestamps.  One should append the year to the recent date before parsing with SimpleDateFormat.  For instance, 

			Calendar c = Calendar.getInstance();			
			ParsePosition pp = new ParsePosition(0);
			SimpleDateFormat recentWithYear = new SimpleDateFormat("MMM d HH:mmyyyy");
			format.setLenient(false);
			Date date = recentWithYear.parse("Feb 29 17:46" + c.get(Calendar.YEAR), pp);

produces the correct date.  

> [FTP Client] Not listing files with 'invalid' date
> --------------------------------------------------
>
>                 Key: NET-190
>                 URL: https://issues.apache.org/jira/browse/NET-190
>             Project: Commons Net
>          Issue Type: Bug
>    Affects Versions: 1.4
>         Environment: FTP Gateway: Response:	331-httpiproxy2 FTP server (Version 1.9.2.4 - 2005/01/11 13:03:28) ready.
> FTP Server: Response:	215 UNIX Type: L8
> FTP Client: Jakarta Commons VFS over Jakarta Commons NET
>            Reporter: Diego Souto
>   Original Estimate: 3h
>  Remaining Estimate: 3h
>
> When trying to list files in a FTP directory with two files returns 0 FileObjects.
> With another FTP client.... response is:
> ftp> ls
> 227 Entering Passive Mode (212,163,35,155,160,40)
> 150 Conexión de datos aceptada
> -rw-r--r--    1 0        0             222 Feb 29 09:47 AYC01R
> -rw-r--r--    1 0        0             688 Feb 29 03:04 AYC02R
> 226-Options: -l 
> 226 2 ocurrencias en total
> ... so there are two files with date "FEBRUARY 29" (2008 is a leap year)
> When listing files with Jakarta Commons VFS over Jakarta Commons NET it returns 0 files.
> I revised Commons Net source and I found in 'org.apache.commons.net.ftp.parser.UnixFTPEntryParser' the following code:
>             try
>             {
>                 file.setTimestamp(super.parseTimestamp(datestr));
>             }
>             catch (ParseException e)
>             {
>             	return null;  // this is a parsing failure too.
>             }
> So I guess maybe the timestamp parser is throwing a ParseException (perhaps it's guessing a incorrect year) and in this case is returning NULL so the calling class is ignoring these files with 'Feb 29' date.
> I think this behaviour is incorrect and must be fixed. If date is considered invalid it would throw an exception,... not simply ignore the file.

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


[jira] Commented: (NET-190) [FTP Client] Not listing files with 'invalid' date

Posted by "Wolfgang Pasche (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/NET-190?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12573903#action_12573903 ] 

Wolfgang Pasche commented on NET-190:
-------------------------------------

I just entered to submit the same issue. In my opinion, the solution must be to add the year field before the first parse, instead of doing this after successful parsing (which is done now). The reason for this problem is the stupid behaviour of all unix systems, to omit the year, when displaying dates in the "nearest" past (I don't know the limit). Unfortunately even the ftp servers do the same.

It would be very nice, if someone could fix this issue shortly, because we programmed a JobScheduler on base of commons.net, and so at the moment this program is not able to get any file from a directory containing a file from Feb 29 because of the null elements in the FtpFile array (okay, this could be fixed by skipping the nulls, but of course we need also to get the files from this date).

Thanks in advance

W. Pasche, Sabre Travel Networks

> [FTP Client] Not listing files with 'invalid' date
> --------------------------------------------------
>
>                 Key: NET-190
>                 URL: https://issues.apache.org/jira/browse/NET-190
>             Project: Commons Net
>          Issue Type: Bug
>    Affects Versions: 1.4
>         Environment: FTP Gateway: Response:	331-httpiproxy2 FTP server (Version 1.9.2.4 - 2005/01/11 13:03:28) ready.
> FTP Server: Response:	215 UNIX Type: L8
> FTP Client: Jakarta Commons VFS over Jakarta Commons NET
>            Reporter: Diego Souto
>   Original Estimate: 3h
>  Remaining Estimate: 3h
>
> When trying to list files in a FTP directory with two files returns 0 FileObjects.
> With another FTP client.... response is:
> ftp> ls
> 227 Entering Passive Mode (212,163,35,155,160,40)
> 150 Conexión de datos aceptada
> -rw-r--r--    1 0        0             222 Feb 29 09:47 AYC01R
> -rw-r--r--    1 0        0             688 Feb 29 03:04 AYC02R
> 226-Options: -l 
> 226 2 ocurrencias en total
> ... so there are two files with date "FEBRUARY 29" (2008 is a leap year)
> When listing files with Jakarta Commons VFS over Jakarta Commons NET it returns 0 files.
> I revised Commons Net source and I found in 'org.apache.commons.net.ftp.parser.UnixFTPEntryParser' the following code:
>             try
>             {
>                 file.setTimestamp(super.parseTimestamp(datestr));
>             }
>             catch (ParseException e)
>             {
>             	return null;  // this is a parsing failure too.
>             }
> So I guess maybe the timestamp parser is throwing a ParseException (perhaps it's guessing a incorrect year) and in this case is returning NULL so the calling class is ignoring these files with 'Feb 29' date.
> I think this behaviour is incorrect and must be fixed. If date is considered invalid it would throw an exception,... not simply ignore the file.

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


[jira] Closed: (NET-190) [FTP Client] Not listing files with 'invalid' date

Posted by "Rory Winston (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/NET-190?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Rory Winston closed NET-190.
----------------------------

    Resolution: Duplicate

> [FTP Client] Not listing files with 'invalid' date
> --------------------------------------------------
>
>                 Key: NET-190
>                 URL: https://issues.apache.org/jira/browse/NET-190
>             Project: Commons Net
>          Issue Type: Bug
>    Affects Versions: 1.4
>         Environment: FTP Gateway: Response:	331-httpiproxy2 FTP server (Version 1.9.2.4 - 2005/01/11 13:03:28) ready.
> FTP Server: Response:	215 UNIX Type: L8
> FTP Client: Jakarta Commons VFS over Jakarta Commons NET
>            Reporter: Diego Souto
>   Original Estimate: 3h
>  Remaining Estimate: 3h
>
> When trying to list files in a FTP directory with two files returns 0 FileObjects.
> With another FTP client.... response is:
> ftp> ls
> 227 Entering Passive Mode (212,163,35,155,160,40)
> 150 Conexión de datos aceptada
> -rw-r--r--    1 0        0             222 Feb 29 09:47 AYC01R
> -rw-r--r--    1 0        0             688 Feb 29 03:04 AYC02R
> 226-Options: -l 
> 226 2 ocurrencias en total
> ... so there are two files with date "FEBRUARY 29" (2008 is a leap year)
> When listing files with Jakarta Commons VFS over Jakarta Commons NET it returns 0 files.
> I revised Commons Net source and I found in 'org.apache.commons.net.ftp.parser.UnixFTPEntryParser' the following code:
>             try
>             {
>                 file.setTimestamp(super.parseTimestamp(datestr));
>             }
>             catch (ParseException e)
>             {
>             	return null;  // this is a parsing failure too.
>             }
> So I guess maybe the timestamp parser is throwing a ParseException (perhaps it's guessing a incorrect year) and in this case is returning NULL so the calling class is ignoring these files with 'Feb 29' date.
> I think this behaviour is incorrect and must be fixed. If date is considered invalid it would throw an exception,... not simply ignore the file.

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


[jira] Updated: (NET-190) [FTP Client] Not listing files with 'invalid' date

Posted by "Sebb (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/NET-190?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sebb updated NET-190:
---------------------

    Comment: was deleted

> [FTP Client] Not listing files with 'invalid' date
> --------------------------------------------------
>
>                 Key: NET-190
>                 URL: https://issues.apache.org/jira/browse/NET-190
>             Project: Commons Net
>          Issue Type: Bug
>    Affects Versions: 1.4
>         Environment: FTP Gateway: Response:	331-httpiproxy2 FTP server (Version 1.9.2.4 - 2005/01/11 13:03:28) ready.
> FTP Server: Response:	215 UNIX Type: L8
> FTP Client: Jakarta Commons VFS over Jakarta Commons NET
>            Reporter: Diego Souto
>   Original Estimate: 3h
>  Remaining Estimate: 3h
>
> When trying to list files in a FTP directory with two files returns 0 FileObjects.
> With another FTP client.... response is:
> ftp> ls
> 227 Entering Passive Mode (212,163,35,155,160,40)
> 150 Conexión de datos aceptada
> -rw-r--r--    1 0        0             222 Feb 29 09:47 AYC01R
> -rw-r--r--    1 0        0             688 Feb 29 03:04 AYC02R
> 226-Options: -l 
> 226 2 ocurrencias en total
> ... so there are two files with date "FEBRUARY 29" (2008 is a leap year)
> When listing files with Jakarta Commons VFS over Jakarta Commons NET it returns 0 files.
> I revised Commons Net source and I found in 'org.apache.commons.net.ftp.parser.UnixFTPEntryParser' the following code:
>             try
>             {
>                 file.setTimestamp(super.parseTimestamp(datestr));
>             }
>             catch (ParseException e)
>             {
>             	return null;  // this is a parsing failure too.
>             }
> So I guess maybe the timestamp parser is throwing a ParseException (perhaps it's guessing a incorrect year) and in this case is returning NULL so the calling class is ignoring these files with 'Feb 29' date.
> I think this behaviour is incorrect and must be fixed. If date is considered invalid it would throw an exception,... not simply ignore the file.

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