commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rwins...@apache.org
Subject svn commit: r629276 - in /commons/proper/net/branches/NET_2_0: ./ src/main/java/org/apache/commons/net/ftp/parser/ src/test/java/org/apache/commons/net/ftp/ src/test/java/org/apache/commons/net/ftp/parser/
Date Tue, 19 Feb 2008 23:31:35 GMT
Author: rwinston
Date: Tue Feb 19 15:31:25 2008
New Revision: 629276

URL: http://svn.apache.org/viewvc?rev=629276&view=rev
Log:
Fix non-greedy quantifier on multi-word regex

Modified:
    commons/proper/net/branches/NET_2_0/pom.xml
    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/FTPClientConfigFunctionalTest.java
    commons/proper/net/branches/NET_2_0/src/test/java/org/apache/commons/net/ftp/parser/NTFTPEntryParserTest.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/pom.xml
URL: http://svn.apache.org/viewvc/commons/proper/net/branches/NET_2_0/pom.xml?rev=629276&r1=629275&r2=629276&view=diff
==============================================================================
--- commons/proper/net/branches/NET_2_0/pom.xml (original)
+++ commons/proper/net/branches/NET_2_0/pom.xml Tue Feb 19 15:31:25 2008
@@ -30,15 +30,7 @@
 		<artifactId>commons-parent</artifactId>
 		<version>7</version>
 	</parent>
-
-
-	<pluginRepositories>
-		<pluginRepository>
-			<id>snapshots</id>
-			<url>http://people.apache.org/maven-snapshot-repository/</url>
-		</pluginRepository>
-	</pluginRepositories>
-
+	
 	<url>http://jakarta.apache.org/commons/net/</url>
 
 	<issueManagement>
@@ -53,16 +45,6 @@
 		</site>
 	</distributionManagement>
 
-	<repositories>
-		<repository>
-			<id>commons</id>
-			<url>http://svn.apache.org/repos/asf/commons/proper/net/trunk</url>
-		</repository>
-		<repository>
-			<id>maven-snapshots</id>
-			<url>http://people.apache.org/maven-snapshot-repository/</url>
-		</repository>
-	</repositories>
 
 	<dependencies>
 		<dependency>

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=629276&r1=629275&r2=629276&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 15:31:25 2008
@@ -85,8 +85,8 @@
         "([bcdelfmpSs-])"
         +"(((r|-)(w|-)([xsStTL-]))((r|-)(w|-)([xsStTL-]))((r|-)(w|-)([xsStTL-])))\\+?\\s+"
         + "(\\d+)\\s+"
-        + "(?:(\\S+(?:\\s\\S+)*)\\s+)?"					// owner name (optional spaces)
-        + "(?:(\\S+(?:\\s\\S+)*)\\s+)?" // group name (optional spaces)
+        + "(?:(\\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/FTPClientConfigFunctionalTest.java
URL: http://svn.apache.org/viewvc/commons/proper/net/branches/NET_2_0/src/test/java/org/apache/commons/net/ftp/FTPClientConfigFunctionalTest.java?rev=629276&r1=629275&r2=629276&view=diff
==============================================================================
--- commons/proper/net/branches/NET_2_0/src/test/java/org/apache/commons/net/ftp/FTPClientConfigFunctionalTest.java
(original)
+++ commons/proper/net/branches/NET_2_0/src/test/java/org/apache/commons/net/ftp/FTPClientConfigFunctionalTest.java
Tue Feb 19 15:31:25 2008
@@ -96,7 +96,8 @@
     }
 
 	
-    private TreeSet<FTPFile> getSortedList(FTPFile[] files) {
+    @SuppressWarnings("unchecked")
+	private TreeSet<FTPFile> getSortedList(FTPFile[] files) {
         // create a TreeSet which will sort each element
         // as it is added.
         TreeSet<FTPFile> sorted = new TreeSet<FTPFile>(new Comparator() {
@@ -130,12 +131,11 @@
     public void testTimeZoneFunctionality() throws Exception {
         java.util.Date now = new java.util.Date();
         FTPFile[] files = FTP.listFiles();
-        TreeSet sorted = getSortedList(files);
+        TreeSet<FTPFile> sorted = getSortedList(files);
         //SimpleDateFormat sdf = new SimpleDateFormat("MM/dd/yyyy HH:mm z" );
         FTPFile lastfile = null;
         FTPFile firstfile = null;
-        for (Iterator it = sorted.iterator(); it.hasNext();) {
-            FTPFile thisfile = (FTPFile) it.next();
+        for (FTPFile thisfile : sorted) {
             if (firstfile == null) {
                 firstfile = thisfile;
             }

Modified: commons/proper/net/branches/NET_2_0/src/test/java/org/apache/commons/net/ftp/parser/NTFTPEntryParserTest.java
URL: http://svn.apache.org/viewvc/commons/proper/net/branches/NET_2_0/src/test/java/org/apache/commons/net/ftp/parser/NTFTPEntryParserTest.java?rev=629276&r1=629275&r2=629276&view=diff
==============================================================================
--- commons/proper/net/branches/NET_2_0/src/test/java/org/apache/commons/net/ftp/parser/NTFTPEntryParserTest.java
(original)
+++ commons/proper/net/branches/NET_2_0/src/test/java/org/apache/commons/net/ftp/parser/NTFTPEntryParserTest.java
Tue Feb 19 15:31:25 2008
@@ -222,7 +222,9 @@
      */
     public void testGroupNameWithSpaces() {
     	FTPFile f = getParser().parseFTPEntry("drwx------ 4 maxm Domain Users 512 Oct 2 10:59
.metadata");
-    	assertEquals(f.getGroup(), "Domain Users");	
+    	assertNotNull(f);
+    	assertEquals("maxm", f.getUser());
+    	assertEquals("Domain Users", f.getGroup());	
     }
     
 }

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=629276&r1=629275&r2=629276&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 15:31:25 2008
@@ -151,6 +151,13 @@
 		assertEquals("john smith", f.getUser());
 		assertEquals("test group", f.getGroup());
 	}
+	
+	public void testGroupNameWithSpaces() {
+		FTPFile f = getParser().parseFTPEntry("drwx------ 4 maxm Domain Users 512 Oct 2 10:59 .metadata");
+		assertNotNull(f);
+		assertEquals("maxm", f.getUser());
+		assertEquals("Domain Users", f.getGroup());
+	}
 
 	/**
 	 * @see org.apache.commons.net.ftp.parser.FTPParseTestFramework#testParseFieldsOnDirectory()



Mime
View raw message