You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Martin Oberhuber (JIRA)" <ji...@apache.org> on 2008/04/22 21:13:21 UTC
[jira] Created: (NET-215) UNIXFTPEntryParser doesn't preserve
trailing whitespace in files
UNIXFTPEntryParser doesn't preserve trailing whitespace in files
----------------------------------------------------------------
Key: NET-215
URL: https://issues.apache.org/jira/browse/NET-215
Project: Commons Net
Issue Type: Bug
Affects Versions: 1.4
Reporter: Martin Oberhuber
Priority: Minor
Fix For: 2.0
>From https://bugs.eclipse.org/bugs/show_bug.cgi?id=204740 :
The Commons Net FTP Entry Parsers do not preserve trailing whitespace on file names. On systems like UNIX that support trailing whitespace, this results in some invalid entries being parsed.
The bug seems to be in Jakarta Commons Net UnixFTPEntryParser -- in its REGEX,
the last field ("endtoken") is declared
(\\s*.*)
which means any whitespace followed by at least one non-whitespace character.
Which is not the case in case of trailing whitespace.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (NET-215) UNIXFTPEntryParser doesn't preserve
trailing whitespace in files
Posted by "Sebb (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/NET-215?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Sebb updated NET-215:
---------------------
Fix Version/s: (was: 2.0)
> UNIXFTPEntryParser doesn't preserve trailing whitespace in files
> ----------------------------------------------------------------
>
> Key: NET-215
> URL: https://issues.apache.org/jira/browse/NET-215
> Project: Commons Net
> Issue Type: Bug
> Affects Versions: 1.4
> Reporter: Martin Oberhuber
> Priority: Minor
>
> From https://bugs.eclipse.org/bugs/show_bug.cgi?id=204740 :
> The Commons Net FTP Entry Parsers do not preserve trailing whitespace on file names. On systems like UNIX that support trailing whitespace, this results in some invalid entries being parsed.
> The bug seems to be in Jakarta Commons Net UnixFTPEntryParser -- in its REGEX,
> the last field ("endtoken") is declared
> (\\s*.*)
> which means any whitespace followed by at least one non-whitespace character.
> Which is not the case in case of trailing whitespace.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (NET-215) UNIXFTPEntryParser doesn't preserve
trailing whitespace in files
Posted by "Sebb (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/NET-215?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12695786#action_12695786 ]
Sebb commented on NET-215:
--------------------------
Note that the regex
(\s*.*)
means 0 or more whitespace, followed by 0 or more other characters, so it does match trailing spaces - as shown by the example.
However, having two "*" quantifiers next to each other tends to make the parsing slower, as it increases the backtracking that may be required.
> UNIXFTPEntryParser doesn't preserve trailing whitespace in files
> ----------------------------------------------------------------
>
> Key: NET-215
> URL: https://issues.apache.org/jira/browse/NET-215
> Project: Commons Net
> Issue Type: Bug
> Affects Versions: 1.4
> Reporter: Martin Oberhuber
> Priority: Minor
> Fix For: 2.1
>
>
> From https://bugs.eclipse.org/bugs/show_bug.cgi?id=204740 :
> The Commons Net FTP Entry Parsers do not preserve trailing whitespace on file names. On systems like UNIX that support trailing whitespace, this results in some invalid entries being parsed.
> The bug seems to be in Jakarta Commons Net UnixFTPEntryParser -- in its REGEX,
> the last field ("endtoken") is declared
> (\\s*.*)
> which means any whitespace followed by at least one non-whitespace character.
> Which is not the case in case of trailing whitespace.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (NET-215) UNIXFTPEntryParser doesn't preserve
trailing whitespace in files
Posted by "Martin Oberhuber (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/NET-215?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12591413#action_12591413 ]
Martin Oberhuber commented on NET-215:
--------------------------------------
It might actually help to make the "name" token more greedy and have it match until the line terminator that would be \\r?\\n but that would require some unit tests to secure the solution...
> UNIXFTPEntryParser doesn't preserve trailing whitespace in files
> ----------------------------------------------------------------
>
> Key: NET-215
> URL: https://issues.apache.org/jira/browse/NET-215
> Project: Commons Net
> Issue Type: Bug
> Affects Versions: 1.4
> Reporter: Martin Oberhuber
> Priority: Minor
> Fix For: 2.0
>
>
> From https://bugs.eclipse.org/bugs/show_bug.cgi?id=204740 :
> The Commons Net FTP Entry Parsers do not preserve trailing whitespace on file names. On systems like UNIX that support trailing whitespace, this results in some invalid entries being parsed.
> The bug seems to be in Jakarta Commons Net UnixFTPEntryParser -- in its REGEX,
> the last field ("endtoken") is declared
> (\\s*.*)
> which means any whitespace followed by at least one non-whitespace character.
> Which is not the case in case of trailing whitespace.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Closed: (NET-215) UNIXFTPEntryParser doesn't preserve
trailing whitespace in files
Posted by "Rory Winston (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/NET-215?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Rory Winston closed NET-215.
----------------------------
Resolution: Fixed
Fix Version/s: 2.1
This works for me in 2.1.
{code:java}
public void testTrailingSpaces() {
FTPFile f = getParser().parseFTPEntry("drwxr-xr-x 2 john smith group 4096 Mar 2 15:13 zxbox ");
assertNotNull(f);
assertEquals(f.getName(), "zxbox ");
}
{code}
works as expected.
> UNIXFTPEntryParser doesn't preserve trailing whitespace in files
> ----------------------------------------------------------------
>
> Key: NET-215
> URL: https://issues.apache.org/jira/browse/NET-215
> Project: Commons Net
> Issue Type: Bug
> Affects Versions: 1.4
> Reporter: Martin Oberhuber
> Priority: Minor
> Fix For: 2.1
>
>
> From https://bugs.eclipse.org/bugs/show_bug.cgi?id=204740 :
> The Commons Net FTP Entry Parsers do not preserve trailing whitespace on file names. On systems like UNIX that support trailing whitespace, this results in some invalid entries being parsed.
> The bug seems to be in Jakarta Commons Net UnixFTPEntryParser -- in its REGEX,
> the last field ("endtoken") is declared
> (\\s*.*)
> which means any whitespace followed by at least one non-whitespace character.
> Which is not the case in case of trailing whitespace.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.