Return-Path: Delivered-To: apmail-commons-commits-archive@locus.apache.org Received: (qmail 94377 invoked from network); 19 Feb 2008 22:30:31 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 19 Feb 2008 22:30:31 -0000 Received: (qmail 88875 invoked by uid 500); 19 Feb 2008 22:30:25 -0000 Delivered-To: apmail-commons-commits-archive@commons.apache.org Received: (qmail 88814 invoked by uid 500); 19 Feb 2008 22:30:25 -0000 Mailing-List: contact commits-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@commons.apache.org Delivered-To: mailing list commits@commons.apache.org Received: (qmail 88805 invoked by uid 99); 19 Feb 2008 22:30:25 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 19 Feb 2008 14:30:25 -0800 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 19 Feb 2008 22:30:00 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id A23C61A9832; Tue, 19 Feb 2008 14:30:09 -0800 (PST) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r629252 - in /commons/proper/net/branches/NET_2_0/src: main/java/org/apache/commons/net/ftp/parser/UnixFTPEntryParser.java test/java/org/apache/commons/net/ftp/parser/UnixFTPEntryParserTest.java Date: Tue, 19 Feb 2008 22:30:08 -0000 To: commits@commons.apache.org From: rwinston@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20080219223009.A23C61A9832@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: rwinston Date: Tue Feb 19 14:30:06 2008 New Revision: 629252 URL: http://svn.apache.org/viewvc?rev=629252&view=rev Log: Add fix for owner name containing spaces (NET-170) Modified: commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/ftp/parser/UnixFTPEntryParser.java commons/proper/net/branches/NET_2_0/src/test/java/org/apache/commons/net/ftp/parser/UnixFTPEntryParserTest.java Modified: commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/ftp/parser/UnixFTPEntryParser.java URL: http://svn.apache.org/viewvc/commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/ftp/parser/UnixFTPEntryParser.java?rev=629252&r1=629251&r2=629252&view=diff ============================================================================== --- commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/ftp/parser/UnixFTPEntryParser.java (original) +++ commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/ftp/parser/UnixFTPEntryParser.java Tue Feb 19 14:30:06 2008 @@ -33,12 +33,6 @@ */ public class UnixFTPEntryParser extends ConfigurableFTPFileEntryParserImpl { - /** - * months abbreviations looked for by this parser. Also used - * to determine which month is matched by the parser - */ - private static final String DEFAULT_MONTHS = - "(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)"; static final String DEFAULT_DATE_FORMAT = "MMM d yyyy"; //Nov 9 2001 @@ -91,8 +85,8 @@ "([bcdelfmpSs-])" +"(((r|-)(w|-)([xsStTL-]))((r|-)(w|-)([xsStTL-]))((r|-)(w|-)([xsStTL-])))\\+?\\s+" + "(\\d+)\\s+" - + "(\\S+)\\s+" - + "(?:(\\S+(?:\\s\\S+)*)\\s+)?" + + "(?:(\\S+(?:\\s\\S+)*)\\s+)?" // owner name (optional spaces) + + "(?:(\\S+(?:\\s\\S+)*)\\s+)?" // group name (optional spaces) + "(\\d+)\\s+" /* Modified: commons/proper/net/branches/NET_2_0/src/test/java/org/apache/commons/net/ftp/parser/UnixFTPEntryParserTest.java URL: http://svn.apache.org/viewvc/commons/proper/net/branches/NET_2_0/src/test/java/org/apache/commons/net/ftp/parser/UnixFTPEntryParserTest.java?rev=629252&r1=629251&r2=629252&view=diff ============================================================================== --- commons/proper/net/branches/NET_2_0/src/test/java/org/apache/commons/net/ftp/parser/UnixFTPEntryParserTest.java (original) +++ commons/proper/net/branches/NET_2_0/src/test/java/org/apache/commons/net/ftp/parser/UnixFTPEntryParserTest.java Tue Feb 19 14:30:06 2008 @@ -138,6 +138,19 @@ protected FTPFileEntryParser getParser() { return (new UnixFTPEntryParser()); } + + public void testOwnerNameWithSpaces() { + FTPFile f = getParser().parseFTPEntry("drwxr-xr-x 2 john smith group 4096 Mar 2 15:13 zxbox"); + assertNotNull(f); + assertEquals("john smith", f.getUser()); + } + + public void testOwnerANdGroupNameWithSpaces() { + FTPFile f = getParser().parseFTPEntry("drwxr-xr-x 2 john smith test group 4096 Mar 2 15:13 zxbox"); + assertNotNull(f); + assertEquals("john smith", f.getUser()); + assertEquals("test group", f.getGroup()); + } /** * @see org.apache.commons.net.ftp.parser.FTPParseTestFramework#testParseFieldsOnDirectory()