svn commit: r925727 - /commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/ftp/FTPHTTPClient.java
Author: rwinston Date: Sun Mar 21 04:13:09 2010 New Revision: 925727 URL: http://svn.apache.org/viewvc?rev=925727view=rev Log: No nested IOException ctors in 1.5 Modified: commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/ftp/FTPHTTPClient.java Modified: commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/ftp/FTPHTTPClient.java URL: http://svn.apache.org/viewvc/commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/ftp/FTPHTTPClient.java?rev=925727r1=925726r2=925727view=diff == --- commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/ftp/FTPHTTPClient.java (original) +++ commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/ftp/FTPHTTPClient.java Sun Mar 21 04:13:09 2010 @@ -89,7 +89,7 @@ public class FTPHTTPClient extends FTPCl tunnelHandshake(host, port, _input_, _output_); } catch (Exception e) { -throw new IOException(e); +throw new IOException(Could not connect to + host, e); } }
svn commit: r925728 - /commons/proper/net/tags/NET_2_1_RC_6/
Author: rwinston Date: Sun Mar 21 04:14:16 2010 New Revision: 925728 URL: http://svn.apache.org/viewvc?rev=925728view=rev Log: Tag for RC release Added: commons/proper/net/tags/NET_2_1_RC_6/ - copied from r925727, commons/proper/net/branches/NET_2_0/
svn commit: r925541 - /commons/proper/net/branches/NET_2_0/src/main/java/examples/ftp/FTPExample.java
Author: rwinston Date: Sat Mar 20 04:17:00 2010 New Revision: 925541 URL: http://svn.apache.org/viewvc?rev=925541view=rev Log: Revert Modified: commons/proper/net/branches/NET_2_0/src/main/java/examples/ftp/FTPExample.java Modified: commons/proper/net/branches/NET_2_0/src/main/java/examples/ftp/FTPExample.java URL: http://svn.apache.org/viewvc/commons/proper/net/branches/NET_2_0/src/main/java/examples/ftp/FTPExample.java?rev=925541r1=925540r2=925541view=diff == --- commons/proper/net/branches/NET_2_0/src/main/java/examples/ftp/FTPExample.java (original) +++ commons/proper/net/branches/NET_2_0/src/main/java/examples/ftp/FTPExample.java Sat Mar 20 04:17:00 2010 @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - + package examples.ftp; import java.io.FileInputStream; @@ -22,14 +22,12 @@ import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; -import java.io.PrintStream; import java.io.PrintWriter; import org.apache.commons.net.PrintCommandListener; import org.apache.commons.net.ftp.FTP; import org.apache.commons.net.ftp.FTPClient; import org.apache.commons.net.ftp.FTPConnectionClosedException; -import org.apache.commons.net.ftp.FTPFile; import org.apache.commons.net.ftp.FTPReply; /*** @@ -42,22 +40,152 @@ import org.apache.commons.net.ftp.FTPRep * Usage: ftp [-s] [-b] hostname username password remote file local file * p ***/ -public final class FTPExample { +public final class FTPExample +{ + +public static final String USAGE = +Usage: ftp [-s] [-b] hostname username password remote file local file\n + +\nDefault behavior is to download a file and use ASCII transfer mode.\n + +\t-s store file on server (upload)\n + +\t-b use binary transfer mode\n; -public static final void main(String[] args) throws IOException +public static final void main(String[] args) { - FTPClient client = new FTPClient(); - client.setControlEncoding(utf-8); - client.addProtocolCommandListener(new PrintCommandListener(new PrintWriter(System.out))); - client.connect(localhost); - client.login(rory, yi6bovak); - - PrintStream out = new PrintStream(System.out, true, utf-8); - - for (FTPFile file : client.listFiles()) - out.println(file.getName()); - - out.println(ä½ å¥½å); +int base = 0; +boolean storeFile = false, binaryTransfer = false, error = false; +String server, username, password, remote, local; +FTPClient ftp; + +for (base = 0; base args.length; base++) +{ +if (args[base].startsWith(-s)) +storeFile = true; +else if (args[base].startsWith(-b)) +binaryTransfer = true; +else +break; +} + +if ((args.length - base) != 5) +{ +System.err.println(USAGE); +System.exit(1); +} + +server = args[base++]; +username = args[base++]; +password = args[base++]; +remote = args[base++]; +local = args[base]; + +ftp = new FTPClient(); +ftp.addProtocolCommandListener(new PrintCommandListener( + new PrintWriter(System.out))); + +try +{ +int reply; +ftp.connect(server); +System.out.println(Connected to + server + .); + +// After connection attempt, you should check the reply code to verify +// success. +reply = ftp.getReplyCode(); + +if (!FTPReply.isPositiveCompletion(reply)) +{ +ftp.disconnect(); +System.err.println(FTP server refused connection.); +System.exit(1); +} +} +catch (IOException e) +{ +if (ftp.isConnected()) +{ +try +{ +ftp.disconnect(); +} +catch (IOException f) +{ +// do nothing +} +} +System.err.println(Could not connect to server.); +e.printStackTrace(); +System.exit(1); +} + +__main: +try +{ +if (!ftp.login(username, password)) +{ +ftp.logout(); +error = true; +break __main; +} + +System.out.println(Remote system is + ftp.getSystemName()); + +if (binaryTransfer) +ftp.setFileType(FTP.BINARY_FILE_TYPE); + +// Use passive mode as default because most of us are +// behind firewalls these days
svn commit: r925542 - in /commons/proper/net/branches/NET_2_0/src/main/java/examples/ftp: FTPClientExample.java FTPExample.java
Author: rwinston Date: Sat Mar 20 04:22:12 2010 New Revision: 925542 URL: http://svn.apache.org/viewvc?rev=925542view=rev Log: Rename Added: commons/proper/net/branches/NET_2_0/src/main/java/examples/ftp/FTPClientExample.java Removed: commons/proper/net/branches/NET_2_0/src/main/java/examples/ftp/FTPExample.java Added: commons/proper/net/branches/NET_2_0/src/main/java/examples/ftp/FTPClientExample.java URL: http://svn.apache.org/viewvc/commons/proper/net/branches/NET_2_0/src/main/java/examples/ftp/FTPClientExample.java?rev=925542view=auto == --- commons/proper/net/branches/NET_2_0/src/main/java/examples/ftp/FTPClientExample.java (added) +++ commons/proper/net/branches/NET_2_0/src/main/java/examples/ftp/FTPClientExample.java Sat Mar 20 04:22:12 2010 @@ -0,0 +1,192 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the License); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package examples.ftp; + +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.io.PrintWriter; + +import org.apache.commons.net.PrintCommandListener; +import org.apache.commons.net.ftp.FTP; +import org.apache.commons.net.ftp.FTPClient; +import org.apache.commons.net.ftp.FTPConnectionClosedException; +import org.apache.commons.net.ftp.FTPReply; + +/*** + * This is an example program demonstrating how to use the FTPClient class. + * This program connects to an FTP server and retrieves the specified + * file. If the -s flag is used, it stores the local file at the FTP server. + * Just so you can see what's happening, all reply strings are printed. + * If the -b flag is used, a binary transfer is assumed (default is ASCII). + * p + * Usage: ftp [-s] [-b] hostname username password remote file local file + * p + ***/ +public final class FTPClientExample +{ + +public static final String USAGE = +Usage: ftp [-s] [-b] hostname username password remote file local file\n + +\nDefault behavior is to download a file and use ASCII transfer mode.\n + +\t-s store file on server (upload)\n + +\t-b use binary transfer mode\n; + +public static final void main(String[] args) +{ +int base = 0; +boolean storeFile = false, binaryTransfer = false, error = false; +String server, username, password, remote, local; +FTPClient ftp; + +for (base = 0; base args.length; base++) +{ +if (args[base].startsWith(-s)) +storeFile = true; +else if (args[base].startsWith(-b)) +binaryTransfer = true; +else +break; +} + +if ((args.length - base) != 5) +{ +System.err.println(USAGE); +System.exit(1); +} + +server = args[base++]; +username = args[base++]; +password = args[base++]; +remote = args[base++]; +local = args[base]; + +ftp = new FTPClient(); +ftp.addProtocolCommandListener(new PrintCommandListener( + new PrintWriter(System.out))); + +try +{ +int reply; +ftp.connect(server); +System.out.println(Connected to + server + .); + +// After connection attempt, you should check the reply code to verify +// success. +reply = ftp.getReplyCode(); + +if (!FTPReply.isPositiveCompletion(reply)) +{ +ftp.disconnect(); +System.err.println(FTP server refused connection.); +System.exit(1); +} +} +catch (IOException e) +{ +if (ftp.isConnected()) +{ +try +{ +ftp.disconnect(); +} +catch (IOException f) +{ +// do nothing +} +} +System.err.println(Could not connect to server.); +e.printStackTrace(); +System.exit(1); +} + +__main: +try
svn commit: r925545 - /commons/proper/net/branches/NET_2_1_RC_5/
Author: rwinston Date: Sat Mar 20 05:05:28 2010 New Revision: 925545 URL: http://svn.apache.org/viewvc?rev=925545view=rev Log: Tag for RC release Added: commons/proper/net/branches/NET_2_1_RC_5/ - copied from r925544, commons/proper/net/branches/NET_2_0/
svn commit: r925546 - /commons/proper/net/branches/NET_2_0/pom.xml
Author: rwinston Date: Sat Mar 20 05:06:17 2010 New Revision: 925546 URL: http://svn.apache.org/viewvc?rev=925546view=rev Log: Update Modified: commons/proper/net/branches/NET_2_0/pom.xml 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=925546r1=925545r2=925546view=diff == --- commons/proper/net/branches/NET_2_0/pom.xml (original) +++ commons/proper/net/branches/NET_2_0/pom.xml Sat Mar 20 05:06:17 2010 @@ -25,7 +25,7 @@ limitations under the License. modelVersion4.0.0/modelVersion groupIdcommons-net/groupId artifactIdcommons-net/artifactId - version2.1-SNAPSHOT/version + version2.1/version nameCommons Net/name description A collection of network utilities and protocol implementations.
svn commit: r925547 - /commons/proper/net/branches/NET_2_1_RC_6/
Author: rwinston Date: Sat Mar 20 05:07:02 2010 New Revision: 925547 URL: http://svn.apache.org/viewvc?rev=925547view=rev Log: Tag for release (w/updated pom) Added: commons/proper/net/branches/NET_2_1_RC_6/ - copied from r925546, commons/proper/net/branches/NET_2_0/
svn commit: r925549 - /commons/proper/net/tags/NET_2_1_RC_5/
Author: rwinston Date: Sat Mar 20 05:07:59 2010 New Revision: 925549 URL: http://svn.apache.org/viewvc?rev=925549view=rev Log: Tag for release Added: commons/proper/net/tags/NET_2_1_RC_5/ - copied from r925547, commons/proper/net/branches/NET_2_0/
svn commit: r925550 - /commons/proper/net/branches/NET_2_1_RC_5/
Author: rwinston Date: Sat Mar 20 05:08:56 2010 New Revision: 925550 URL: http://svn.apache.org/viewvc?rev=925550view=rev Log: Remove Removed: commons/proper/net/branches/NET_2_1_RC_5/
svn commit: r925551 - /commons/proper/net/branches/NET_2_1_RC_6/
Author: rwinston Date: Sat Mar 20 05:09:13 2010 New Revision: 925551 URL: http://svn.apache.org/viewvc?rev=925551view=rev Log: Remove Removed: commons/proper/net/branches/NET_2_1_RC_6/
svn commit: r924691 - /commons/proper/net/branches/NET_2_0/pom.xml
Author: rwinston Date: Thu Mar 18 10:38:13 2010 New Revision: 924691 URL: http://svn.apache.org/viewvc?rev=924691view=rev Log: [maven-release-plugin] prepare release commons-net-2.1 Modified: commons/proper/net/branches/NET_2_0/pom.xml 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=924691r1=924690r2=924691view=diff == --- commons/proper/net/branches/NET_2_0/pom.xml (original) +++ commons/proper/net/branches/NET_2_0/pom.xml Thu Mar 18 10:38:13 2010 @@ -25,7 +25,7 @@ limitations under the License. modelVersion4.0.0/modelVersion groupIdcommons-net/groupId artifactIdcommons-net/artifactId - version2.1-SNAPSHOT/version + version2.1/version nameCommons Net/name description A collection of network utilities and protocol implementations.
svn commit: r924695 - /commons/proper/net/branches/NET_2_0/pom.xml
Author: rwinston Date: Thu Mar 18 10:46:52 2010 New Revision: 924695 URL: http://svn.apache.org/viewvc?rev=924695view=rev Log: svn problems: Modified: commons/proper/net/branches/NET_2_0/pom.xml 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=924695r1=924694r2=924695view=diff == --- commons/proper/net/branches/NET_2_0/pom.xml (original) +++ commons/proper/net/branches/NET_2_0/pom.xml Thu Mar 18 10:46:52 2010 @@ -25,7 +25,7 @@ limitations under the License. modelVersion4.0.0/modelVersion groupIdcommons-net/groupId artifactIdcommons-net/artifactId - version2.1/version + version2.1-SNAPSHOT/version nameCommons Net/name description A collection of network utilities and protocol implementations.
svn commit: r924696 - in /commons/proper/net/tags/commons-net-2.1-rc4: ./ pom.xml
Author: rwinston Date: Thu Mar 18 10:49:43 2010 New Revision: 924696 URL: http://svn.apache.org/viewvc?rev=924696view=rev Log: Tag Added: commons/proper/net/tags/commons-net-2.1-rc4/ - copied from r924694, commons/proper/net/branches/NET_2_0/ commons/proper/net/tags/commons-net-2.1-rc4/pom.xml - copied unchanged from r924695, commons/proper/net/branches/NET_2_0/pom.xml
svn commit: r924698 - /commons/proper/net/branches/NET_2_0/pom.xml
Author: rwinston Date: Thu Mar 18 10:55:39 2010 New Revision: 924698 URL: http://svn.apache.org/viewvc?rev=924698view=rev Log: [maven-release-plugin] prepare release commons-net-2.1-rc4 Modified: commons/proper/net/branches/NET_2_0/pom.xml 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=924698r1=924697r2=924698view=diff == --- commons/proper/net/branches/NET_2_0/pom.xml (original) +++ commons/proper/net/branches/NET_2_0/pom.xml Thu Mar 18 10:55:39 2010 @@ -25,7 +25,7 @@ limitations under the License. modelVersion4.0.0/modelVersion groupIdcommons-net/groupId artifactIdcommons-net/artifactId - version2.1-SNAPSHOT/version + version2.1/version nameCommons Net/name description A collection of network utilities and protocol implementations. @@ -37,9 +37,9 @@ limitations under the License. /issueManagement inceptionYear2001/inceptionYear scm - connectionscm:svn:http://svn.apache.org/repos/asf/commons/proper/net/tags/commons-net-2.1/connection - developerConnectionscm:svn:https://svn.apache.org/repos/asf/commons/proper/net/tags/commons-net-2.1/developerConnection - urlhttp://svn.apache.org/viewvc/commons/proper/net/tags/commons-net-2.1/url + connectionscm:svn:http://svn.apache.org/repos/asf/commons/proper/net/tags/commons-net-2.1-rc4/connection + developerConnectionscm:svn:https://svn.apache.org/repos/asf/commons/proper/net/tags/commons-net-2.1-rc4/developerConnection + urlhttp://svn.apache.org/viewvc/commons/proper/net/tags/commons-net-2.1-rc4/url /scm developers
svn commit: r924699 - /commons/proper/net/tags/commons-net-2.1-rc4/
Author: rwinston Date: Thu Mar 18 10:56:44 2010 New Revision: 924699 URL: http://svn.apache.org/viewvc?rev=924699view=rev Log: Remove Removed: commons/proper/net/tags/commons-net-2.1-rc4/
svn commit: r924700 - /commons/proper/net/branches/NET_2_0/pom.xml
Author: rwinston Date: Thu Mar 18 10:57:22 2010 New Revision: 924700 URL: http://svn.apache.org/viewvc?rev=924700view=rev Log: Revert Modified: commons/proper/net/branches/NET_2_0/pom.xml 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=924700r1=924699r2=924700view=diff == --- commons/proper/net/branches/NET_2_0/pom.xml (original) +++ commons/proper/net/branches/NET_2_0/pom.xml Thu Mar 18 10:57:22 2010 @@ -25,7 +25,7 @@ limitations under the License. modelVersion4.0.0/modelVersion groupIdcommons-net/groupId artifactIdcommons-net/artifactId - version2.1/version + version2.1-SNAPSHOT/version nameCommons Net/name description A collection of network utilities and protocol implementations.
svn commit: r924702 - /commons/proper/net/tags/commons-net-2.1/
Author: rwinston Date: Thu Mar 18 10:58:53 2010 New Revision: 924702 URL: http://svn.apache.org/viewvc?rev=924702view=rev Log: Tag Added: commons/proper/net/tags/commons-net-2.1/ - copied from r924700, commons/proper/net/branches/NET_2_0/
svn commit: r924704 - /commons/proper/net/branches/NET_2_0/pom.xml
Author: rwinston Date: Thu Mar 18 11:03:25 2010 New Revision: 924704 URL: http://svn.apache.org/viewvc?rev=924704view=rev Log: [maven-release-plugin] prepare release commons-net-2.1-rc4 Modified: commons/proper/net/branches/NET_2_0/pom.xml 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=924704r1=924703r2=924704view=diff == --- commons/proper/net/branches/NET_2_0/pom.xml (original) +++ commons/proper/net/branches/NET_2_0/pom.xml Thu Mar 18 11:03:25 2010 @@ -25,7 +25,7 @@ limitations under the License. modelVersion4.0.0/modelVersion groupIdcommons-net/groupId artifactIdcommons-net/artifactId - version2.1-SNAPSHOT/version + version2.1/version nameCommons Net/name description A collection of network utilities and protocol implementations.
svn commit: r924706 - /commons/proper/net/branches/NET_2_0/pom.xml
Author: rwinston Date: Thu Mar 18 11:04:58 2010 New Revision: 924706 URL: http://svn.apache.org/viewvc?rev=924706view=rev Log: Revert Modified: commons/proper/net/branches/NET_2_0/pom.xml 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=924706r1=924705r2=924706view=diff == --- commons/proper/net/branches/NET_2_0/pom.xml (original) +++ commons/proper/net/branches/NET_2_0/pom.xml Thu Mar 18 11:04:58 2010 @@ -25,7 +25,7 @@ limitations under the License. modelVersion4.0.0/modelVersion groupIdcommons-net/groupId artifactIdcommons-net/artifactId - version2.1/version + version2.1-SNAPSHOT/version nameCommons Net/name description A collection of network utilities and protocol implementations.
svn commit: r924708 - /commons/proper/net/branches/NET_2_0/pom.xml
Author: rwinston Date: Thu Mar 18 11:07:59 2010 New Revision: 924708 URL: http://svn.apache.org/viewvc?rev=924708view=rev Log: [maven-release-plugin] prepare release commons-net-2.1 Modified: commons/proper/net/branches/NET_2_0/pom.xml 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=924708r1=924707r2=924708view=diff == --- commons/proper/net/branches/NET_2_0/pom.xml (original) +++ commons/proper/net/branches/NET_2_0/pom.xml Thu Mar 18 11:07:59 2010 @@ -25,7 +25,7 @@ limitations under the License. modelVersion4.0.0/modelVersion groupIdcommons-net/groupId artifactIdcommons-net/artifactId - version2.1-SNAPSHOT/version + version2.1/version nameCommons Net/name description A collection of network utilities and protocol implementations. @@ -37,9 +37,9 @@ limitations under the License. /issueManagement inceptionYear2001/inceptionYear scm - connectionscm:svn:http://svn.apache.org/repos/asf/commons/proper/net/tags/commons-net-2.1-rc4/connection - developerConnectionscm:svn:https://svn.apache.org/repos/asf/commons/proper/net/tags/commons-net-2.1-rc4/developerConnection - urlhttp://svn.apache.org/viewvc/commons/proper/net/tags/commons-net-2.1-rc4/url + connectionscm:svn:http://svn.apache.org/repos/asf/commons/proper/net/tags/commons-net-2.1/connection + developerConnectionscm:svn:https://svn.apache.org/repos/asf/commons/proper/net/tags/commons-net-2.1/developerConnection + urlhttp://svn.apache.org/viewvc/commons/proper/net/tags/commons-net-2.1/url /scm developers
svn commit: r924716 - /commons/proper/net/branches/NET_2_0/pom.xml
Author: rwinston Date: Thu Mar 18 11:24:10 2010 New Revision: 924716 URL: http://svn.apache.org/viewvc?rev=924716view=rev Log: Take 5 Modified: commons/proper/net/branches/NET_2_0/pom.xml 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=924716r1=924715r2=924716view=diff == --- commons/proper/net/branches/NET_2_0/pom.xml (original) +++ commons/proper/net/branches/NET_2_0/pom.xml Thu Mar 18 11:24:10 2010 @@ -25,7 +25,7 @@ limitations under the License. modelVersion4.0.0/modelVersion groupIdcommons-net/groupId artifactIdcommons-net/artifactId - version2.1/version + version2.1-SNAPSHOT/version nameCommons Net/name description A collection of network utilities and protocol implementations.
svn commit: r924717 - /commons/proper/net/branches/NET_2_0/pom.xml
Author: rwinston Date: Thu Mar 18 11:28:05 2010 New Revision: 924717 URL: http://svn.apache.org/viewvc?rev=924717view=rev Log: [maven-release-plugin] prepare release commons-net-2.1 Modified: commons/proper/net/branches/NET_2_0/pom.xml 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=924717r1=924716r2=924717view=diff == --- commons/proper/net/branches/NET_2_0/pom.xml (original) +++ commons/proper/net/branches/NET_2_0/pom.xml Thu Mar 18 11:28:05 2010 @@ -25,7 +25,7 @@ limitations under the License. modelVersion4.0.0/modelVersion groupIdcommons-net/groupId artifactIdcommons-net/artifactId - version2.1-SNAPSHOT/version + version2.1/version nameCommons Net/name description A collection of network utilities and protocol implementations.
svn commit: r924719 - /commons/proper/net/branches/NET_2_0/pom.xml
Author: rwinston Date: Thu Mar 18 11:28:32 2010 New Revision: 924719 URL: http://svn.apache.org/viewvc?rev=924719view=rev Log: [maven-release-plugin] prepare for next development iteration Modified: commons/proper/net/branches/NET_2_0/pom.xml 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=924719r1=924718r2=924719view=diff == --- commons/proper/net/branches/NET_2_0/pom.xml (original) +++ commons/proper/net/branches/NET_2_0/pom.xml Thu Mar 18 11:28:32 2010 @@ -25,7 +25,7 @@ limitations under the License. modelVersion4.0.0/modelVersion groupIdcommons-net/groupId artifactIdcommons-net/artifactId - version2.1/version + version2.2-SNAPSHOT/version nameCommons Net/name description A collection of network utilities and protocol implementations.
svn commit: r924727 - /commons/proper/net/branches/NET_2_0/pom.xml
Author: rwinston Date: Thu Mar 18 11:39:39 2010 New Revision: 924727 URL: http://svn.apache.org/viewvc?rev=924727view=rev Log: Take 6 Modified: commons/proper/net/branches/NET_2_0/pom.xml 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=924727r1=924726r2=924727view=diff == --- commons/proper/net/branches/NET_2_0/pom.xml (original) +++ commons/proper/net/branches/NET_2_0/pom.xml Thu Mar 18 11:39:39 2010 @@ -25,7 +25,7 @@ limitations under the License. modelVersion4.0.0/modelVersion groupIdcommons-net/groupId artifactIdcommons-net/artifactId - version2.2-SNAPSHOT/version + version2.1-SNAPSHOT/version nameCommons Net/name description A collection of network utilities and protocol implementations.
svn commit: r924728 - /commons/proper/net/branches/NET_2_0/pom.xml
Author: rwinston Date: Thu Mar 18 11:43:53 2010 New Revision: 924728 URL: http://svn.apache.org/viewvc?rev=924728view=rev Log: [maven-release-plugin] prepare release commons-net-2.1 Modified: commons/proper/net/branches/NET_2_0/pom.xml 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=924728r1=924727r2=924728view=diff == --- commons/proper/net/branches/NET_2_0/pom.xml (original) +++ commons/proper/net/branches/NET_2_0/pom.xml Thu Mar 18 11:43:53 2010 @@ -25,7 +25,7 @@ limitations under the License. modelVersion4.0.0/modelVersion groupIdcommons-net/groupId artifactIdcommons-net/artifactId - version2.1-SNAPSHOT/version + version2.1/version nameCommons Net/name description A collection of network utilities and protocol implementations.
svn commit: r924729 - /commons/proper/net/tags/commons-net-2.1/
Author: rwinston Date: Thu Mar 18 11:44:41 2010 New Revision: 924729 URL: http://svn.apache.org/viewvc?rev=924729view=rev Log: Remove Removed: commons/proper/net/tags/commons-net-2.1/
svn commit: r924730 - in /commons/proper/net/tags/commons-net-2.1: ./ pom.xml
Author: rwinston Date: Thu Mar 18 11:48:03 2010 New Revision: 924730 URL: http://svn.apache.org/viewvc?rev=924730view=rev Log: Try again Added: commons/proper/net/tags/commons-net-2.1/ - copied from r924706, commons/proper/net/branches/NET_2_0/ commons/proper/net/tags/commons-net-2.1/pom.xml - copied unchanged from r924728, commons/proper/net/branches/NET_2_0/pom.xml
svn commit: r924745 - /commons/proper/net/tags/commons-net-2.1/commons-net-2.1/
Author: rwinston Date: Thu Mar 18 12:27:10 2010 New Revision: 924745 URL: http://svn.apache.org/viewvc?rev=924745view=rev Log: Delete Removed: commons/proper/net/tags/commons-net-2.1/commons-net-2.1/
svn commit: r923716 - /commons/proper/net/tags/commons-net-2.1/
Author: rwinston Date: Tue Mar 16 12:54:21 2010 New Revision: 923716 URL: http://svn.apache.org/viewvc?rev=923716view=rev Log: Remove Removed: commons/proper/net/tags/commons-net-2.1/
svn commit: r923717 - /commons/proper/net/branches/NET_2_0/pom.xml
Author: rwinston Date: Tue Mar 16 12:54:43 2010 New Revision: 923717 URL: http://svn.apache.org/viewvc?rev=923717view=rev Log: Restore POM Modified: commons/proper/net/branches/NET_2_0/pom.xml 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=923717r1=923716r2=923717view=diff == --- commons/proper/net/branches/NET_2_0/pom.xml (original) +++ commons/proper/net/branches/NET_2_0/pom.xml Tue Mar 16 12:54:43 2010 @@ -25,7 +25,7 @@ limitations under the License. modelVersion4.0.0/modelVersion groupIdcommons-net/groupId artifactIdcommons-net/artifactId - version2.2-SNAPSHOT/version + version2.1-SNAPSHOT/version nameCommons Net/name description A collection of network utilities and protocol implementations.
svn commit: r923119 - /commons/proper/net/branches/NET_2_0/pom.xml
Author: rwinston Date: Mon Mar 15 09:15:33 2010 New Revision: 923119 URL: http://svn.apache.org/viewvc?rev=923119view=rev Log: Revert Modified: commons/proper/net/branches/NET_2_0/pom.xml 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=923119r1=923118r2=923119view=diff == --- commons/proper/net/branches/NET_2_0/pom.xml (original) +++ commons/proper/net/branches/NET_2_0/pom.xml Mon Mar 15 09:15:33 2010 @@ -25,7 +25,7 @@ limitations under the License. modelVersion4.0.0/modelVersion groupIdcommons-net/groupId artifactIdcommons-net/artifactId - version2.2-SNAPSHOT/version + version2.1-SNAPSHOT/version nameCommons Net/name description A collection of network utilities and protocol implementations.
svn commit: r923135 - /commons/proper/net/branches/NET_2_0/pom.xml
Author: rwinston Date: Mon Mar 15 09:46:59 2010 New Revision: 923135 URL: http://svn.apache.org/viewvc?rev=923135view=rev Log: [maven-release-plugin] prepare release commons-net-2.1 Modified: commons/proper/net/branches/NET_2_0/pom.xml 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=923135r1=923134r2=923135view=diff == --- commons/proper/net/branches/NET_2_0/pom.xml (original) +++ commons/proper/net/branches/NET_2_0/pom.xml Mon Mar 15 09:46:59 2010 @@ -25,7 +25,7 @@ limitations under the License. modelVersion4.0.0/modelVersion groupIdcommons-net/groupId artifactIdcommons-net/artifactId - version2.1-SNAPSHOT/version + version2.1/version nameCommons Net/name description A collection of network utilities and protocol implementations.
svn commit: r923139 - /commons/proper/net/tags/commons-net-2.1/
Author: rwinston Date: Mon Mar 15 09:51:03 2010 New Revision: 923139 URL: http://svn.apache.org/viewvc?rev=923139view=rev Log: Remove (again) Removed: commons/proper/net/tags/commons-net-2.1/
svn commit: r923148 - /commons/proper/net/tags/commons-net-2.1/
Author: rwinston Date: Mon Mar 15 10:12:21 2010 New Revision: 923148 URL: http://svn.apache.org/viewvc?rev=923148view=rev Log: Copy Added: commons/proper/net/tags/commons-net-2.1/ - copied from r923147, commons/proper/net/branches/NET_2_0/
svn commit: r923150 - /commons/proper/net/tags/commons-net-2.1/commons-net-2.1/
Author: rwinston Date: Mon Mar 15 10:13:00 2010 New Revision: 923150 URL: http://svn.apache.org/viewvc?rev=923150view=rev Log: [maven-release-plugin] copy for tag commons-net-2.1 Added: commons/proper/net/tags/commons-net-2.1/commons-net-2.1/ - copied from r923149, commons/proper/net/tags/commons-net-2.1/
svn commit: r923151 - /commons/proper/net/branches/NET_2_0/pom.xml
Author: rwinston Date: Mon Mar 15 10:13:05 2010 New Revision: 923151 URL: http://svn.apache.org/viewvc?rev=923151view=rev Log: [maven-release-plugin] prepare for next development iteration Modified: commons/proper/net/branches/NET_2_0/pom.xml 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=923151r1=923150r2=923151view=diff == --- commons/proper/net/branches/NET_2_0/pom.xml (original) +++ commons/proper/net/branches/NET_2_0/pom.xml Mon Mar 15 10:13:05 2010 @@ -25,7 +25,7 @@ limitations under the License. modelVersion4.0.0/modelVersion groupIdcommons-net/groupId artifactIdcommons-net/artifactId - version2.1/version + version2.2-SNAPSHOT/version nameCommons Net/name description A collection of network utilities and protocol implementations.
svn commit: r923443 - /commons/proper/net/tags/commons-net-2.1/commons-net-2.1/
Author: rwinston Date: Mon Mar 15 21:13:40 2010 New Revision: 923443 URL: http://svn.apache.org/viewvc?rev=923443view=rev Log: Remove duplicated tag Removed: commons/proper/net/tags/commons-net-2.1/commons-net-2.1/
svn commit: r922782 - /commons/proper/net/branches/NET_2_0/src/test/java/org/apache/commons/net/telnet/TelnetClientTest.java
Author: rwinston Date: Sun Mar 14 08:05:16 2010 New Revision: 922782 URL: http://svn.apache.org/viewvc?rev=922782view=rev Log: Solved elusive read() problem Modified: commons/proper/net/branches/NET_2_0/src/test/java/org/apache/commons/net/telnet/TelnetClientTest.java Modified: commons/proper/net/branches/NET_2_0/src/test/java/org/apache/commons/net/telnet/TelnetClientTest.java URL: http://svn.apache.org/viewvc/commons/proper/net/branches/NET_2_0/src/test/java/org/apache/commons/net/telnet/TelnetClientTest.java?rev=922782r1=922781r2=922782view=diff == --- commons/proper/net/branches/NET_2_0/src/test/java/org/apache/commons/net/telnet/TelnetClientTest.java (original) +++ commons/proper/net/branches/NET_2_0/src/test/java/org/apache/commons/net/telnet/TelnetClientTest.java Sun Mar 14 08:05:16 2010 @@ -22,6 +22,7 @@ import java.io.InputStream; import java.io.OutputStream; import java.io.PipedInputStream; import java.io.PipedOutputStream; +import java.util.Arrays; /*** * JUnit test class for TelnetClient.s @@ -792,8 +793,16 @@ extends TestCase implements TelnetNotifi // if(is1.available() == 6) //{ -is1.read(buffread1); - +int read = 0; +int pos = 0; + +byte[] tmp = new byte[16]; +while ( pos 5 ) { + read = is1.read(tmp); + System.arraycopy(tmp, 0, buffread1, pos, read); + pos+=read; +} + if(equalBytes(buffread1, expected1)) negotiation1_ok = true; //} @@ -806,6 +815,13 @@ extends TestCase implements TelnetNotifi os2.write(send1); os2.flush(); Thread.sleep(1000); + +tmp = new byte[16]; +while ( pos 5 ) { + read = is2.read(tmp); + System.arraycopy(tmp, 0, buffread1, pos, read); + pos+=read; +} //if(is2.available() == 6) //{ is2.read(buffread1);
svn commit: r922785 - /commons/proper/net/tags/NET_2_1_RC_4/
Author: rwinston Date: Sun Mar 14 08:21:05 2010 New Revision: 922785 URL: http://svn.apache.org/viewvc?rev=922785view=rev Log: Copy for release Added: commons/proper/net/tags/NET_2_1_RC_4/ - copied from r922784, commons/proper/net/branches/NET_2_0/
svn commit: r922794 - /commons/proper/net/branches/NET_2_0/pom.xml
Author: rwinston Date: Sun Mar 14 09:00:19 2010 New Revision: 922794 URL: http://svn.apache.org/viewvc?rev=922794view=rev Log: Update for RC Modified: commons/proper/net/branches/NET_2_0/pom.xml 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=922794r1=922793r2=922794view=diff == --- commons/proper/net/branches/NET_2_0/pom.xml (original) +++ commons/proper/net/branches/NET_2_0/pom.xml Sun Mar 14 09:00:19 2010 @@ -49,8 +49,7 @@ limitations under the License. urlscp://people.apache.org/~rwinston/release/net//url /site /distributionManagement - - + developers developer nameJeffrey D. Brekke/name @@ -124,6 +123,7 @@ limitations under the License. maven.compile.target1.5/maven.compile.target commons.componentidnet/commons.componentid commons.release.version2.0/commons.release.version + commons.rc.versionRC4/commons.rc.version commons.binary.suffix / commons.release.2.version1.4.1/commons.release.2.version commons.release.2.binary.suffix / @@ -275,4 +275,18 @@ limitations under the License. /plugins /reporting +profiles + profile +idrc/id +distributionManagement + !-- Cannot define in parent ATM, see COMMONSSITE-26 -- + site +idapache.website/id +nameApache Commons Release Candidate Staging Site/name + url${commons.deployment.protocol}://people.apache.org/www/people.apache.org/builds/commons/${commons.componentid}/${commons.release.version}/${commons.rc.version}/site/url + /site +/distributionManagement + /profile +/profiles + /project
svn commit: r922795 - /commons/proper/net/branches/NET_2_0/pom.xml
Author: rwinston Date: Sun Mar 14 09:01:23 2010 New Revision: 922795 URL: http://svn.apache.org/viewvc?rev=922795view=rev Log: Update for RC Modified: commons/proper/net/branches/NET_2_0/pom.xml 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=922795r1=922794r2=922795view=diff == --- commons/proper/net/branches/NET_2_0/pom.xml (original) +++ commons/proper/net/branches/NET_2_0/pom.xml Sun Mar 14 09:01:23 2010 @@ -25,7 +25,7 @@ limitations under the License. modelVersion4.0.0/modelVersion groupIdcommons-net/groupId artifactIdcommons-net/artifactId - version2.1/version + version2.1-SNAPSHOT/version nameCommons Net/name description A collection of network utilities and protocol implementations.
svn commit: r922814 - /commons/proper/net/tags/commons-net-2.1/
Author: rwinston Date: Sun Mar 14 11:34:08 2010 New Revision: 922814 URL: http://svn.apache.org/viewvc?rev=922814view=rev Log: Copy for release Added: commons/proper/net/tags/commons-net-2.1/ - copied from r922813, commons/proper/net/branches/NET_2_0/
svn commit: r922819 - /commons/proper/net/branches/NET_2_0/pom.xml
Author: rwinston Date: Sun Mar 14 11:55:29 2010 New Revision: 922819 URL: http://svn.apache.org/viewvc?rev=922819view=rev Log: [maven-release-plugin] prepare release commons-net-2.1 Modified: commons/proper/net/branches/NET_2_0/pom.xml 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=922819r1=922818r2=922819view=diff == --- commons/proper/net/branches/NET_2_0/pom.xml (original) +++ commons/proper/net/branches/NET_2_0/pom.xml Sun Mar 14 11:55:29 2010 @@ -25,7 +25,7 @@ limitations under the License. modelVersion4.0.0/modelVersion groupIdcommons-net/groupId artifactIdcommons-net/artifactId - version2.1-SNAPSHOT/version + version2.1/version nameCommons Net/name description A collection of network utilities and protocol implementations.
svn commit: r922820 - /commons/proper/net/tags/commons-net-2.1/commons-net-2.1/
Author: rwinston Date: Sun Mar 14 11:55:47 2010 New Revision: 922820 URL: http://svn.apache.org/viewvc?rev=922820view=rev Log: [maven-release-plugin] copy for tag commons-net-2.1 Added: commons/proper/net/tags/commons-net-2.1/commons-net-2.1/ - copied from r922819, commons/proper/net/tags/commons-net-2.1/
svn commit: r922821 - /commons/proper/net/branches/NET_2_0/pom.xml
Author: rwinston Date: Sun Mar 14 11:55:52 2010 New Revision: 922821 URL: http://svn.apache.org/viewvc?rev=922821view=rev Log: [maven-release-plugin] prepare for next development iteration Modified: commons/proper/net/branches/NET_2_0/pom.xml 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=922821r1=922820r2=922821view=diff == --- commons/proper/net/branches/NET_2_0/pom.xml (original) +++ commons/proper/net/branches/NET_2_0/pom.xml Sun Mar 14 11:55:52 2010 @@ -25,7 +25,7 @@ limitations under the License. modelVersion4.0.0/modelVersion groupIdcommons-net/groupId artifactIdcommons-net/artifactId - version2.1/version + version2.2-SNAPSHOT/version nameCommons Net/name description A collection of network utilities and protocol implementations.
svn commit: r922943 - /commons/proper/net/tags/commons-net-2.1/
Author: rwinston Date: Sun Mar 14 20:21:06 2010 New Revision: 922943 URL: http://svn.apache.org/viewvc?rev=922943view=rev Log: Removing Removed: commons/proper/net/tags/commons-net-2.1/
svn commit: r922947 - /commons/proper/net/branches/NET_2_0/pom.xml
Author: rwinston Date: Sun Mar 14 20:24:40 2010 New Revision: 922947 URL: http://svn.apache.org/viewvc?rev=922947view=rev Log: Experimenting with scp options Modified: commons/proper/net/branches/NET_2_0/pom.xml 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=922947r1=922946r2=922947view=diff == --- commons/proper/net/branches/NET_2_0/pom.xml (original) +++ commons/proper/net/branches/NET_2_0/pom.xml Sun Mar 14 20:24:40 2010 @@ -226,6 +226,13 @@ limitations under the License. /includes /testResource /testResources +extensions +extension + groupIdorg.apache.maven.wagon/groupId + artifactIdwagon-ssh-external/artifactId + version1.0-alpha-6/version +/extension + /extensions /build
svn commit: r922952 - /commons/proper/net/branches/NET_2_0/pom.xml
Author: rwinston Date: Sun Mar 14 20:45:05 2010 New Revision: 922952 URL: http://svn.apache.org/viewvc?rev=922952view=rev Log: [maven-release-plugin] prepare release commons-net-2.1 Modified: commons/proper/net/branches/NET_2_0/pom.xml 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=922952r1=922951r2=922952view=diff == --- commons/proper/net/branches/NET_2_0/pom.xml (original) +++ commons/proper/net/branches/NET_2_0/pom.xml Sun Mar 14 20:45:05 2010 @@ -25,7 +25,7 @@ limitations under the License. modelVersion4.0.0/modelVersion groupIdcommons-net/groupId artifactIdcommons-net/artifactId - version2.1-SNAPSHOT/version + version2.1/version nameCommons Net/name description A collection of network utilities and protocol implementations.
svn commit: r922956 - /commons/proper/net/branches/NET_2_0/pom.xml
Author: rwinston Date: Sun Mar 14 20:50:58 2010 New Revision: 922956 URL: http://svn.apache.org/viewvc?rev=922956view=rev Log: Release plugin problems Modified: commons/proper/net/branches/NET_2_0/pom.xml 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=922956r1=922955r2=922956view=diff == --- commons/proper/net/branches/NET_2_0/pom.xml (original) +++ commons/proper/net/branches/NET_2_0/pom.xml Sun Mar 14 20:50:58 2010 @@ -25,7 +25,7 @@ limitations under the License. modelVersion4.0.0/modelVersion groupIdcommons-net/groupId artifactIdcommons-net/artifactId - version2.1/version + version2.1-SNAPSHOT/version nameCommons Net/name description A collection of network utilities and protocol implementations.
svn commit: r922959 - /commons/proper/net/branches/NET_2_0/pom.xml
Author: rwinston Date: Sun Mar 14 21:04:45 2010 New Revision: 922959 URL: http://svn.apache.org/viewvc?rev=922959view=rev Log: [maven-release-plugin] prepare release commons-net-2.1 Modified: commons/proper/net/branches/NET_2_0/pom.xml 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=922959r1=922958r2=922959view=diff == --- commons/proper/net/branches/NET_2_0/pom.xml (original) +++ commons/proper/net/branches/NET_2_0/pom.xml Sun Mar 14 21:04:45 2010 @@ -25,7 +25,7 @@ limitations under the License. modelVersion4.0.0/modelVersion groupIdcommons-net/groupId artifactIdcommons-net/artifactId - version2.1-SNAPSHOT/version + version2.1/version nameCommons Net/name description A collection of network utilities and protocol implementations.
svn commit: r922960 - /commons/proper/net/tags/commons-net-2.1/
Author: rwinston Date: Sun Mar 14 21:07:53 2010 New Revision: 922960 URL: http://svn.apache.org/viewvc?rev=922960view=rev Log: Copy Added: commons/proper/net/tags/commons-net-2.1/ - copied from r922959, commons/proper/net/branches/NET_2_0/
svn commit: r922961 - /commons/proper/net/tags/commons-net-2.1/commons-net-2.1/
Author: rwinston Date: Sun Mar 14 21:08:21 2010 New Revision: 922961 URL: http://svn.apache.org/viewvc?rev=922961view=rev Log: [maven-release-plugin] copy for tag commons-net-2.1 Added: commons/proper/net/tags/commons-net-2.1/commons-net-2.1/ - copied from r922960, commons/proper/net/tags/commons-net-2.1/
svn commit: r922962 - /commons/proper/net/branches/NET_2_0/pom.xml
Author: rwinston Date: Sun Mar 14 21:08:26 2010 New Revision: 922962 URL: http://svn.apache.org/viewvc?rev=922962view=rev Log: [maven-release-plugin] prepare for next development iteration Modified: commons/proper/net/branches/NET_2_0/pom.xml 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=922962r1=922961r2=922962view=diff == --- commons/proper/net/branches/NET_2_0/pom.xml (original) +++ commons/proper/net/branches/NET_2_0/pom.xml Sun Mar 14 21:08:26 2010 @@ -25,7 +25,7 @@ limitations under the License. modelVersion4.0.0/modelVersion groupIdcommons-net/groupId artifactIdcommons-net/artifactId - version2.1/version + version2.2-SNAPSHOT/version nameCommons Net/name description A collection of network utilities and protocol implementations.
svn commit: r922776 - in /commons/proper/net/branches/NET_2_0/src/main/java: examples/ftp/FTPExample.java org/apache/commons/net/ftp/FTPHTTPClient.java org/apache/commons/net/util/Base64.java
Author: rwinston Date: Sun Mar 14 06:36:13 2010 New Revision: 922776 URL: http://svn.apache.org/viewvc?rev=922776view=rev Log: Add initial (experimental) support for FTP over HTTP tunneling Added: commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/ftp/FTPHTTPClient.java commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/util/Base64.java Modified: commons/proper/net/branches/NET_2_0/src/main/java/examples/ftp/FTPExample.java Modified: commons/proper/net/branches/NET_2_0/src/main/java/examples/ftp/FTPExample.java URL: http://svn.apache.org/viewvc/commons/proper/net/branches/NET_2_0/src/main/java/examples/ftp/FTPExample.java?rev=922776r1=922775r2=922776view=diff == --- commons/proper/net/branches/NET_2_0/src/main/java/examples/ftp/FTPExample.java (original) +++ commons/proper/net/branches/NET_2_0/src/main/java/examples/ftp/FTPExample.java Sun Mar 14 06:36:13 2010 @@ -22,12 +22,14 @@ import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; +import java.io.PrintStream; import java.io.PrintWriter; import org.apache.commons.net.PrintCommandListener; import org.apache.commons.net.ftp.FTP; import org.apache.commons.net.ftp.FTPClient; import org.apache.commons.net.ftp.FTPConnectionClosedException; +import org.apache.commons.net.ftp.FTPFile; import org.apache.commons.net.ftp.FTPReply; /*** @@ -40,152 +42,22 @@ import org.apache.commons.net.ftp.FTPRep * Usage: ftp [-s] [-b] hostname username password remote file local file * p ***/ -public final class FTPExample -{ +public final class FTPExample { -public static final String USAGE = -Usage: ftp [-s] [-b] hostname username password remote file local file\n + -\nDefault behavior is to download a file and use ASCII transfer mode.\n + -\t-s store file on server (upload)\n + -\t-b use binary transfer mode\n; - -public static final void main(String[] args) +public static final void main(String[] args) throws IOException { -int base = 0; -boolean storeFile = false, binaryTransfer = false, error = false; -String server, username, password, remote, local; -FTPClient ftp; - -for (base = 0; base args.length; base++) -{ -if (args[base].startsWith(-s)) -storeFile = true; -else if (args[base].startsWith(-b)) -binaryTransfer = true; -else -break; -} - -if ((args.length - base) != 5) -{ -System.err.println(USAGE); -System.exit(1); -} - -server = args[base++]; -username = args[base++]; -password = args[base++]; -remote = args[base++]; -local = args[base]; - -ftp = new FTPClient(); -ftp.addProtocolCommandListener(new PrintCommandListener( - new PrintWriter(System.out))); - -try -{ -int reply; -ftp.connect(server); -System.out.println(Connected to + server + .); - -// After connection attempt, you should check the reply code to verify -// success. -reply = ftp.getReplyCode(); - -if (!FTPReply.isPositiveCompletion(reply)) -{ -ftp.disconnect(); -System.err.println(FTP server refused connection.); -System.exit(1); -} -} -catch (IOException e) -{ -if (ftp.isConnected()) -{ -try -{ -ftp.disconnect(); -} -catch (IOException f) -{ -// do nothing -} -} -System.err.println(Could not connect to server.); -e.printStackTrace(); -System.exit(1); -} - -__main: -try -{ -if (!ftp.login(username, password)) -{ -ftp.logout(); -error = true; -break __main; -} - -System.out.println(Remote system is + ftp.getSystemName()); - -if (binaryTransfer) -ftp.setFileType(FTP.BINARY_FILE_TYPE); - -// Use passive mode as default because most of us are -// behind firewalls these days. -ftp.enterLocalPassiveMode(); - -if (storeFile) -{ -InputStream input; - -input = new FileInputStream(local); - -ftp.storeFile(remote, input); - -input.close(); -} -else -{ -OutputStream output; - -output = new FileOutputStream(local
svn commit: r922250 - /commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/ftp/FTPClient.java
Author: rwinston Date: Fri Mar 12 13:37:31 2010 New Revision: 922250 URL: http://svn.apache.org/viewvc?rev=922250view=rev Log: Clean up Modified: commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/ftp/FTPClient.java Modified: commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/ftp/FTPClient.java URL: http://svn.apache.org/viewvc/commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/ftp/FTPClient.java?rev=922250r1=922249r2=922250view=diff == --- commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/ftp/FTPClient.java (original) +++ commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/ftp/FTPClient.java Fri Mar 12 13:37:31 2010 @@ -14,7 +14,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package org.apache.commons.net.ftp; import java.io.BufferedInputStream; import java.io.BufferedOutputStream; @@ -501,14 +500,10 @@ implements Configurable if (__dataConnectionMode == ACTIVE_LOCAL_DATA_CONNECTION_MODE) { - ServerSocket server; - server = _serverSocketFactory_.createServerSocket(0, 1, getLocalAddress()); - - server = _serverSocketFactory_.createServerSocket(getActivePort(), 1, getHostAddress()); + ServerSocket server = _serverSocketFactory_.createServerSocket(getActivePort(), 1, getHostAddress()); // try EPRT first. If that fails, and the connection is over IPv4 // fallback to PORT - if (!FTPReply.isPositiveCompletion(eprt(getHostAddress(), getActivePort( {
svn commit: r922276 - /commons/proper/net/branches/NET_2_0/src/test/java/org/apache/commons/net/io/DotTerminatedMessageReaderTest.java
Author: rwinston Date: Fri Mar 12 14:32:47 2010 New Revision: 922276 URL: http://svn.apache.org/viewvc?rev=922276view=rev Log: More tweaks Modified: commons/proper/net/branches/NET_2_0/src/test/java/org/apache/commons/net/io/DotTerminatedMessageReaderTest.java Modified: commons/proper/net/branches/NET_2_0/src/test/java/org/apache/commons/net/io/DotTerminatedMessageReaderTest.java URL: http://svn.apache.org/viewvc/commons/proper/net/branches/NET_2_0/src/test/java/org/apache/commons/net/io/DotTerminatedMessageReaderTest.java?rev=922276r1=922275r2=922276view=diff == --- commons/proper/net/branches/NET_2_0/src/test/java/org/apache/commons/net/io/DotTerminatedMessageReaderTest.java (original) +++ commons/proper/net/branches/NET_2_0/src/test/java/org/apache/commons/net/io/DotTerminatedMessageReaderTest.java Fri Mar 12 14:32:47 2010 @@ -64,7 +64,7 @@ public class DotTerminatedMessageReaderT str.append(buf, 0, read); } - assertEquals(str.toString(), Hello\r\nWorld\nA\rB + SEP); + assertEquals(str.toString(), Hello + SEP +World\nA\rB + SEP); } public void testDoubleCrBeforeDot() throws IOException {
svn commit: r921285 [1/2] - /commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/ftp/FTPClient.java
Author: rwinston Date: Wed Mar 10 10:19:17 2010 New Revision: 921285 URL: http://svn.apache.org/viewvc?rev=921285view=rev Log: NET-285: Support optionally setting external ip/port Modified: commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/ftp/FTPClient.java
svn commit: r921292 - /commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/ftp/FTPClient.java
Author: rwinston Date: Wed Mar 10 10:31:49 2010 New Revision: 921292 URL: http://svn.apache.org/viewvc?rev=921292view=rev Log: Oops - using wrong argument for bound port Modified: commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/ftp/FTPClient.java Modified: commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/ftp/FTPClient.java URL: http://svn.apache.org/viewvc/commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/ftp/FTPClient.java?rev=921292r1=921291r2=921292view=diff == --- commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/ftp/FTPClient.java (original) +++ commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/ftp/FTPClient.java Wed Mar 10 10:31:49 2010 @@ -519,7 +519,7 @@ implements Configurable } if (!FTPReply.isPositiveCompletion(port(getHostAddress(), - getActivePort( + server.getLocalPort( { server.close(); return null;
svn commit: r921330 - in /commons/proper/net/branches/NET_2_0/src: main/java/org/apache/commons/net/io/DotTerminatedMessageReader.java test/java/org/apache/commons/net/io/DotTerminatedMessageReaderTes
Author: rwinston Date: Wed Mar 10 12:50:57 2010 New Revision: 921330 URL: http://svn.apache.org/viewvc?rev=921330view=rev Log: Make allowances for platform-specific line endings in unit tests Modified: commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/io/DotTerminatedMessageReader.java commons/proper/net/branches/NET_2_0/src/test/java/org/apache/commons/net/io/DotTerminatedMessageReaderTest.java Modified: commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/io/DotTerminatedMessageReader.java URL: http://svn.apache.org/viewvc/commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/io/DotTerminatedMessageReader.java?rev=921330r1=921329r2=921330view=diff == --- commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/io/DotTerminatedMessageReader.java (original) +++ commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/io/DotTerminatedMessageReader.java Wed Mar 10 12:50:57 2010 @@ -38,14 +38,8 @@ import java.io.Reader; */ public final class DotTerminatedMessageReader extends Reader { -private static final String LS; -private static final char[] LS_CHARS; - -static -{ -LS = System.getProperty(line.separator); -LS_CHARS = LS.toCharArray(); -} +private static final String LS = System.getProperty(line.separator); +char[] LS_CHARS; private boolean atBeginning; private boolean eof; @@ -61,6 +55,7 @@ public final class DotTerminatedMessageR public DotTerminatedMessageReader(Reader reader) { super(reader); +LS_CHARS = LS.toCharArray(); internalBuffer = new char[LS_CHARS.length + 3]; pos = internalBuffer.length; // Assumes input is at start of message Modified: commons/proper/net/branches/NET_2_0/src/test/java/org/apache/commons/net/io/DotTerminatedMessageReaderTest.java URL: http://svn.apache.org/viewvc/commons/proper/net/branches/NET_2_0/src/test/java/org/apache/commons/net/io/DotTerminatedMessageReaderTest.java?rev=921330r1=921329r2=921330view=diff == --- commons/proper/net/branches/NET_2_0/src/test/java/org/apache/commons/net/io/DotTerminatedMessageReaderTest.java (original) +++ commons/proper/net/branches/NET_2_0/src/test/java/org/apache/commons/net/io/DotTerminatedMessageReaderTest.java Wed Mar 10 12:50:57 2010 @@ -27,17 +27,32 @@ public class DotTerminatedMessageReaderT private DotTerminatedMessageReader reader; private StringBuilder str = new StringBuilder(); private char[] buf = new char[64]; + final static String SEP = System.getProperty(line.separator); - public void testReadSimpleString() throws IOException { + public void testReadSimpleStringCrLfLineEnding() throws IOException { final String test = Hello World!\r\n.\r\n; reader = new DotTerminatedMessageReader(new StringReader(test)); + reader.LS_CHARS = new char[]{'\r','\n'}; int read = 0; while ((read = reader.read(buf)) != -1) { - str.append(buf, 0, read-1); + str.append(buf, 0, read); } - assertEquals(str.toString(), Hello World!); + assertEquals(Hello World! + String.valueOf(reader.LS_CHARS), str.toString()); + } + + public void testReadSimpleStringLfLineEnding() throws IOException { + final String test = Hello World!\r\n.\r\n; + reader = new DotTerminatedMessageReader(new StringReader(test)); + reader.LS_CHARS = new char[]{'\n'}; + + int read = 0; + while ((read = reader.read(buf)) != -1) { + str.append(buf, 0, read); + } + + assertEquals(Hello World! + String.valueOf(reader.LS_CHARS), str.toString()); } public void testEmbeddedNewlines() throws IOException { @@ -46,10 +61,10 @@ public class DotTerminatedMessageReaderT int read = 0; while ((read = reader.read(buf)) != -1) { - str.append(buf, 0, read-1); + str.append(buf, 0, read); } - assertEquals(str.toString(), Hello\nWorld\nA\rB); + assertEquals(str.toString(), Hello\nWorld\nA\rB + SEP); } public void testDoubleCrBeforeDot() throws IOException { @@ -58,10 +73,10 @@ public class DotTerminatedMessageReaderT int read = 0; while ((read = reader.read(buf)) != -1) { - str.append(buf, 0, read-1); + str.append(buf, 0
svn commit: r921645 - /commons/proper/net/branches/NET_2_0/src/test/java/org/apache/commons/net/io/DotTerminatedMessageReaderTest.java
Author: rwinston Date: Thu Mar 11 00:24:41 2010 New Revision: 921645 URL: http://svn.apache.org/viewvc?rev=921645view=rev Log: Make embedded newlines test work on Windows Modified: commons/proper/net/branches/NET_2_0/src/test/java/org/apache/commons/net/io/DotTerminatedMessageReaderTest.java Modified: commons/proper/net/branches/NET_2_0/src/test/java/org/apache/commons/net/io/DotTerminatedMessageReaderTest.java URL: http://svn.apache.org/viewvc/commons/proper/net/branches/NET_2_0/src/test/java/org/apache/commons/net/io/DotTerminatedMessageReaderTest.java?rev=921645r1=921644r2=921645view=diff == --- commons/proper/net/branches/NET_2_0/src/test/java/org/apache/commons/net/io/DotTerminatedMessageReaderTest.java (original) +++ commons/proper/net/branches/NET_2_0/src/test/java/org/apache/commons/net/io/DotTerminatedMessageReaderTest.java Thu Mar 11 00:24:41 2010 @@ -64,7 +64,7 @@ public class DotTerminatedMessageReaderT str.append(buf, 0, read); } - assertEquals(str.toString(), Hello\nWorld\nA\rB + SEP); + assertEquals(str.toString(), Hello\r\nWorld\nA\rB + SEP); } public void testDoubleCrBeforeDot() throws IOException {
svn commit: r920235 - in /commons/proper/net/branches/NET_2_0/src: main/java/org/apache/commons/net/util/SubnetUtils.java test/java/org/apache/commons/net/SubnetUtilsTest.java
Author: rwinston Date: Mon Mar 8 08:53:34 2010 New Revision: 920235 URL: http://svn.apache.org/viewvc?rev=920235view=rev Log: NET-305 fix Modified: commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/util/SubnetUtils.java commons/proper/net/branches/NET_2_0/src/test/java/org/apache/commons/net/SubnetUtilsTest.java Modified: commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/util/SubnetUtils.java URL: http://svn.apache.org/viewvc/commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/util/SubnetUtils.java?rev=920235r1=920234r2=920235view=diff == --- commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/util/SubnetUtils.java (original) +++ commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/util/SubnetUtils.java Mon Mar 8 08:53:34 2010 @@ -38,6 +38,10 @@ private int network = 0; private int broadcast = 0; +/** Whether the broadcast/network address are included in host count */ +private boolean inclusiveHostCount = false; + + /** * Constructor that takes a CIDR-notation string, e.g. 192.168.0.1/16 * @param cidrNotation A CIDR-notation string, e.g. 192.168.0.1/16 @@ -54,8 +58,29 @@ public SubnetUtils(String address, String mask) { calculate(toCidrNotation(address, mask)); } + + +/** + * Returns codetrue/code if the return value of {...@link SubnetInfo#getAddressCount()} + * includes the network address and broadcast addresses. + * @return + */ +public boolean isInclusiveHostCount() { + return inclusiveHostCount; + } /** + * Set to codetrue/code if you want the return value of {...@link SubnetInfo#getAddressCount()} + * to include the network and broadcast addresses. + * @param inclusiveHostCount + */ + public void setInclusiveHostCount(boolean inclusiveHostCount) { + this.inclusiveHostCount = inclusiveHostCount; + } + + + + /** * Convenience container for subnet summary information. * */ @@ -66,8 +91,8 @@ private int network() { return network; } private int address() { return address; } private int broadcast() { return broadcast; } -private int low() { return network() + 1; } -private int high() { return broadcast() - 1; } +private int low() { return network() + (isInclusiveHostCount() ? 0 : 1); } +private int high() { return broadcast() - (isInclusiveHostCount() ? 0 : 1); } /** * Returns true if the parameter codeaddress/code is in the @@ -89,7 +114,7 @@ public String getAddress() { return format(toArray(address())); } public String getLowAddress() { return format(toArray(low())); } public String getHighAddress() { return format(toArray(high())); } -public int getAddressCount(){ return (broadcast() - low()); } +public int getAddressCount(){ return (broadcast() - low() + (isInclusiveHostCount() ? 1 : 0)); } public int asInteger(String address){ return toInteger(address); } @@ -138,7 +163,7 @@ address = matchAddress(matcher); /* Create a binary netmask from the number of bits specification /x */ -int cidrPart = rangeCheck(Integer.parseInt(matcher.group(5)), -1, NBITS-1); +int cidrPart = rangeCheck(Integer.parseInt(matcher.group(5)), -1, NBITS); for (int j = 0; j cidrPart; ++j) { netmask |= (1 31-j); } Modified: commons/proper/net/branches/NET_2_0/src/test/java/org/apache/commons/net/SubnetUtilsTest.java URL: http://svn.apache.org/viewvc/commons/proper/net/branches/NET_2_0/src/test/java/org/apache/commons/net/SubnetUtilsTest.java?rev=920235r1=920234r2=920235view=diff == --- commons/proper/net/branches/NET_2_0/src/test/java/org/apache/commons/net/SubnetUtilsTest.java (original) +++ commons/proper/net/branches/NET_2_0/src/test/java/org/apache/commons/net/SubnetUtilsTest.java Mon Mar 8 08:53:34 2010 @@ -68,4 +68,158 @@ catch (IllegalArgumentException expected) { } } + +public void testCidrAddresses() { + SubnetUtils utils = new SubnetUtils(192.168.0.1/8); + utils.setInclusiveHostCount(true); + SubnetInfo info = utils.getInfo(); + assertEquals(255.0.0.0,info.getNetmask()); + assertEquals(16777216, info.getAddressCount()); + + utils = new SubnetUtils(192.168.0.1/9); + utils.setInclusiveHostCount(true); + info = utils.getInfo(); + assertEquals(255.128.0.0,info.getNetmask
svn commit: r920236 - in /commons/proper/net/branches/NET_2_0/src/test/java/org/apache/commons/net: SubnetUtilsTest.java ftp/parser/UnixFTPEntryParserTest.java
Author: rwinston Date: Mon Mar 8 09:00:18 2010 New Revision: 920236 URL: http://svn.apache.org/viewvc?rev=920236view=rev Log: Fix failing test case Modified: commons/proper/net/branches/NET_2_0/src/test/java/org/apache/commons/net/SubnetUtilsTest.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/test/java/org/apache/commons/net/SubnetUtilsTest.java URL: http://svn.apache.org/viewvc/commons/proper/net/branches/NET_2_0/src/test/java/org/apache/commons/net/SubnetUtilsTest.java?rev=920236r1=920235r2=920236view=diff == --- commons/proper/net/branches/NET_2_0/src/test/java/org/apache/commons/net/SubnetUtilsTest.java (original) +++ commons/proper/net/branches/NET_2_0/src/test/java/org/apache/commons/net/SubnetUtilsTest.java Mon Mar 8 09:00:18 2010 @@ -69,6 +69,10 @@ } } +/** + * Test using the inclusiveHostCount flag, which includes + * the network and broadcast addresses in host counts + */ public void testCidrAddresses() { SubnetUtils utils = new SubnetUtils(192.168.0.1/8); utils.setInclusiveHostCount(true); @@ -219,7 +223,5 @@ info = utils.getInfo(); assertEquals(255.255.255.255,info.getNetmask()); assertEquals(1, info.getAddressCount()); - - } } 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=920236r1=920235r2=920236view=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 Mon Mar 8 09:00:18 2010 @@ -216,7 +216,12 @@ cal.set(Calendar.MINUTE, 7); cal.set(Calendar.SECOND, 0); cal.set(Calendar.MILLISECOND, 0); - assertEquals(cal.getTime(), f.getTimestamp().getTime()); + + assertEquals(f.getTimestamp().get(Calendar.MONTH), cal.get(Calendar.MONTH)); + assertEquals(f.getTimestamp().get(Calendar.DAY_OF_MONTH), cal.get(Calendar.DAY_OF_MONTH)); + assertEquals(f.getTimestamp().get(Calendar.HOUR_OF_DAY), cal.get(Calendar.HOUR_OF_DAY)); + assertEquals(f.getTimestamp().get(Calendar.MINUTE), cal.get(Calendar.MINUTE)); + assertEquals(f.getTimestamp().get(Calendar.SECOND), cal.get(Calendar.SECOND)); } public void testFilenamesWithEmbeddedNumbers() {
svn commit: r920251 - in /commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/ftp: FTP.java FTPClient.java FTPCommand.java FTPReply.java
Author: rwinston Date: Mon Mar 8 09:52:43 2010 New Revision: 920251 URL: http://svn.apache.org/viewvc?rev=920251view=rev Log: NET-288: IPv6 EPRT/EPSV support Modified: commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/ftp/FTP.java commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/ftp/FTPClient.java commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/ftp/FTPCommand.java commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/ftp/FTPReply.java Modified: commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/ftp/FTP.java URL: http://svn.apache.org/viewvc/commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/ftp/FTP.java?rev=920251r1=920250r2=920251view=diff == --- commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/ftp/FTP.java (original) +++ commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/ftp/FTP.java Mon Mar 8 09:52:43 2010 @@ -21,6 +21,8 @@ import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; +import java.net.Inet4Address; +import java.net.Inet6Address; import java.net.InetAddress; import java.net.Socket; import java.net.SocketException; @@ -857,6 +859,58 @@ } /*** + * A convenience method to send the FTP EPRT command to the server, + * receive the reply, and return the reply code. + * + * @see http://www.faqs.org/rfcs/rfc2428.html + * + * Examples: + * code + * ul + * liEPRT |1|132.235.1.2|6275|/li + * liEPRT |2|1080::8:800:200C:417A|5282|/li + * /ul + * /code + * p + * @param host The host owning the port. + * @param port The new port. + * @return The reply code received from the server. + * @exception FTPConnectionClosedException + * If the FTP server prematurely closes the connection as a result + * of the client being idle or some other reason causing the server + * to send FTP reply code 421. This exception may be caught either + * as an IOException or independently as itself. + * @exception IOException If an I/O error occurs while either sending the + * command or receiving the server reply. + ***/ +public int eprt(InetAddress host, int port) throws IOException +{ +int num; +StringBuffer info = new StringBuffer(); +String h; + +// If IPv6, trim the zone index +h = host.getHostAddress(); +num = h.indexOf(%); +if (num 0) +h = h.substring(0, num); + +info.append(|); + +if (host instanceof Inet4Address) +info.append(1); +else if (host instanceof Inet6Address) +info.append(2); +info.append(|); +info.append(h); +info.append(|); +info.append(port); +info.append(|); + +return sendCommand(FTPCommand.EPRT, info.toString()); +} + +/*** * A convenience method to send the FTP PASV command to the server, * receive the reply, and return the reply code. Remember, it's up * to you to interpret the reply string containing the host/port @@ -876,6 +930,26 @@ return sendCommand(FTPCommand.PASV); } + /*** + * A convenience method to send the FTP EPSV command to the server, + * receive the reply, and return the reply code. Remember, it's up + * to you to interpret the reply string containing the host/port + * information. + * p + * @return The reply code received from the server. + * @exception FTPConnectionClosedException + * If the FTP server prematurely closes the connection as a result + * of the client being idle or some other reason causing the server + * to send FTP reply code 421. This exception may be caught either + * as an IOException or independently as itself. + * @exception IOException If an I/O error occurs while either sending the + * command or receiving the server reply. + ***/ +public int epsv() throws IOException +{ +return sendCommand(FTPCommand.EPSV); +} + /** * A convenience method to send the FTP TYPE command for text files * to the server, receive the reply, and return the reply code. Modified: commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/ftp/FTPClient.java URL: http://svn.apache.org/viewvc/commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/ftp/FTPClient.java?rev=920251r1=920250r2=920251view=diff == --- commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/ftp/FTPClient.java (original) +++ commons/proper/net/branches/NET_2_0/src/main/java/org/apache
svn commit: r920258 - /commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/io/DotTerminatedMessageReader.java
Author: rwinston Date: Mon Mar 8 10:17:43 2010 New Revision: 920258 URL: http://svn.apache.org/viewvc?rev=920258view=rev Log: Fix and test case for NET-290 Modified: commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/io/DotTerminatedMessageReader.java Modified: commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/io/DotTerminatedMessageReader.java URL: http://svn.apache.org/viewvc/commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/io/DotTerminatedMessageReader.java?rev=920258r1=920257r2=920258view=diff == --- commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/io/DotTerminatedMessageReader.java (original) +++ commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/io/DotTerminatedMessageReader.java Mon Mar 8 10:17:43 2010 @@ -158,6 +158,9 @@ LS_CHARS.length); ch = internalBuffer[pos++]; } +else if (ch == '\r') { + internalReader.unread(ch); +} else { internalBuffer[--pos] = (char) ch;
svn commit: r920259 - in /commons/proper/net/branches/NET_2_0/src/test/java/org/apache/commons/net/io: ./ DotTerminatedMessageReaderTest.java
Author: rwinston Date: Mon Mar 8 10:18:47 2010 New Revision: 920259 URL: http://svn.apache.org/viewvc?rev=920259view=rev Log: Fix and test case for NET-290 (incl test case this time) Added: commons/proper/net/branches/NET_2_0/src/test/java/org/apache/commons/net/io/ commons/proper/net/branches/NET_2_0/src/test/java/org/apache/commons/net/io/DotTerminatedMessageReaderTest.java Added: commons/proper/net/branches/NET_2_0/src/test/java/org/apache/commons/net/io/DotTerminatedMessageReaderTest.java URL: http://svn.apache.org/viewvc/commons/proper/net/branches/NET_2_0/src/test/java/org/apache/commons/net/io/DotTerminatedMessageReaderTest.java?rev=920259view=auto == --- commons/proper/net/branches/NET_2_0/src/test/java/org/apache/commons/net/io/DotTerminatedMessageReaderTest.java (added) +++ commons/proper/net/branches/NET_2_0/src/test/java/org/apache/commons/net/io/DotTerminatedMessageReaderTest.java Mon Mar 8 10:18:47 2010 @@ -0,0 +1,67 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the License); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.commons.net.io; + +import java.io.IOException; +import java.io.StringReader; + +import junit.framework.TestCase; + +public class DotTerminatedMessageReaderTest extends TestCase { + + private DotTerminatedMessageReader reader; + private StringBuilder str = new StringBuilder(); + private char[] buf = new char[64]; + + public void testReadSimpleString() throws IOException { + final String test = Hello World!\r\n.\r\n; + reader = new DotTerminatedMessageReader(new StringReader(test)); + + int read = 0; + while ((read = reader.read(buf)) != -1) { + str.append(buf, 0, read-1); + } + + assertEquals(str.toString(), Hello World!); + } + + public void testEmbeddedNewlines() throws IOException { + final String test = Hello\r\nWorld\nA\rB\r\n.\r\n; + reader = new DotTerminatedMessageReader(new StringReader(test)); + + int read = 0; + while ((read = reader.read(buf)) != -1) { + str.append(buf, 0, read-1); + } + + assertEquals(str.toString(), Hello\nWorld\nA\rB); + } + + public void testDoubleCrBeforeDot() throws IOException { + final String test = Hello World!\r\r\n.\r\n; + reader = new DotTerminatedMessageReader(new StringReader(test)); + + int read = 0; + while ((read = reader.read(buf)) != -1) { + str.append(buf, 0, read-1); + } + + assertEquals(Hello World!\r,str.toString()); + } + +}
svn commit: r920203 - /commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/ftp/FTPClient.java
Author: rwinston Date: Mon Mar 8 06:14:46 2010 New Revision: 920203 URL: http://svn.apache.org/viewvc?rev=920203view=rev Log: Fixed NET-300 Modified: commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/ftp/FTPClient.java Modified: commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/ftp/FTPClient.java URL: http://svn.apache.org/viewvc/commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/ftp/FTPClient.java?rev=920203r1=920202r2=920203view=diff == --- commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/ftp/FTPClient.java (original) +++ commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/ftp/FTPClient.java Mon Mar 8 06:14:46 2010 @@ -2335,10 +2335,17 @@ protected String getListArguments(String pathname) { if (getListHiddenFiles()) { -StringBuffer sb = new StringBuffer(pathname.length() + 3); -sb.append(-a ); -sb.append(pathname); -return sb.toString(); +if (pathname != null) +{ +StringBuffer sb = new StringBuffer(pathname.length() + 3); +sb.append(-a ); +sb.append(pathname); +return sb.toString(); +} +else +{ +return -a; +} } return pathname;
svn commit: r833939 - /commons/proper/net/branches/NET_2_1_RC_2/
Author: rwinston Date: Sun Nov 8 23:11:35 2009 New Revision: 833939 URL: http://svn.apache.org/viewvc?rev=833939view=rev Log: Tag Added: commons/proper/net/branches/NET_2_1_RC_2/ - copied from r833938, commons/proper/net/branches/NET_2_0/
svn commit: r833940 - /commons/proper/net/branches/NET_2_1_RC_2/
Author: rwinston Date: Sun Nov 8 23:12:19 2009 New Revision: 833940 URL: http://svn.apache.org/viewvc?rev=833940view=rev Log: Remove Removed: commons/proper/net/branches/NET_2_1_RC_2/
svn commit: r833941 - /commons/proper/net/tags/NET_2_1_RC_2/
Author: rwinston Date: Sun Nov 8 23:12:55 2009 New Revision: 833941 URL: http://svn.apache.org/viewvc?rev=833941view=rev Log: Tag Added: commons/proper/net/tags/NET_2_1_RC_2/ - copied from r833940, commons/proper/net/branches/NET_2_0/
svn commit: r833942 - in /commons/proper/net/branches/NET_2_0: NOTICE.txt pom.xml src/main/java/org/apache/commons/net/nntp/ThreadContainer.java
Author: rwinston Date: Sun Nov 8 23:17:55 2009 New Revision: 833942 URL: http://svn.apache.org/viewvc?rev=833942view=rev Log: Update for rel vote Modified: commons/proper/net/branches/NET_2_0/NOTICE.txt commons/proper/net/branches/NET_2_0/pom.xml commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/nntp/ThreadContainer.java Modified: commons/proper/net/branches/NET_2_0/NOTICE.txt URL: http://svn.apache.org/viewvc/commons/proper/net/branches/NET_2_0/NOTICE.txt?rev=833942r1=833941r2=833942view=diff == --- commons/proper/net/branches/NET_2_0/NOTICE.txt (original) +++ commons/proper/net/branches/NET_2_0/NOTICE.txt Sun Nov 8 23:17:55 2009 @@ -1,5 +1,5 @@ Apache Commons Net -Copyright 2001-2008 The Apache Software Foundation +Copyright 2001-2009 The Apache Software Foundation This product includes software developed by The Apache Software Foundation (http://www.apache.org/). 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=833942r1=833941r2=833942view=diff == --- commons/proper/net/branches/NET_2_0/pom.xml (original) +++ commons/proper/net/branches/NET_2_0/pom.xml Sun Nov 8 23:17:55 2009 @@ -16,18 +16,16 @@ limitations under the License. -- -project xmlns=http://maven.apache.org/POM/4.0.0; - xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; - xsi:schemaLocation=http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd; +project xmlns=http://maven.apache.org/POM/4.0.0; xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; xsi:schemaLocation=http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd; parent groupIdorg.apache.commons/groupId artifactIdcommons-parent/artifactId - version11/version + version12/version /parent modelVersion4.0.0/modelVersion groupIdcommons-net/groupId artifactIdcommons-net/artifactId - version2.1-SNAPSHOT/version + version2.1/version nameCommons Net/name description A collection of network utilities and protocol implementations. @@ -37,11 +35,11 @@ systemjira/system urlhttp://issues.apache.org/jira/browse/NET/url /issueManagement - inceptionYear1997/inceptionYear + inceptionYear2001/inceptionYear scm - connectionscm:svn:http://svn.apache.org/repos/asf/commons/proper/net/branches/NET_2_0/connection - developerConnectionscm:svn:https://svn.apache.org/repos/asf/commons/proper/net/branches/NET_2_0/developerConnection - urlhttp://svn.apache.org/viewvc/commons/proper/net/branches/NET_2_0/url + connectionscm:svn:http://svn.apache.org/repos/asf/commons/proper/net/tags/commons-net-2.1/connection + developerConnectionscm:svn:https://svn.apache.org/repos/asf/commons/proper/net/tags/commons-net-2.1/developerConnection + urlhttp://svn.apache.org/viewvc/commons/proper/net/tags/commons-net-2.1/url /scm distributionManagement @@ -84,7 +82,7 @@ nameRory Winston/name idrwinston/id emailrwins...@apache.org/email - organization/organization + organization / /developer /developers @@ -126,7 +124,7 @@ maven.compile.target1.5/maven.compile.target commons.componentidnet/commons.componentid commons.release.version2.0/commons.release.version - commons.binary.suffix/commons.binary.suffix + commons.binary.suffix / commons.jira.idNET/commons.jira.id commons.jira.pid12310487/commons.jira.pid /properties @@ -175,19 +173,18 @@ configuration tasks jar destfile=target/commons-net-ftp-${version}.jar - fileset dir=target/classes - includes=org/apache/commons/net/ftp/**,org/apache/commons/net/*,org/apache/commons/net/io/*,org/apache/commons/net/util/*/ + fileset dir=target/classes includes=org/apache/commons/net/ftp/**,org/apache/commons/net/*,org/apache/commons/net/io/*,org/apache/commons/net/util/* / - metainf dir=${basedir} includes=NOTICE.txt,LICENSE.txt
svn commit: r833943 - /commons/proper/net/tags/NET_2_1_RC_2/NET_2_0/
Author: rwinston Date: Sun Nov 8 23:18:17 2009 New Revision: 833943 URL: http://svn.apache.org/viewvc?rev=833943view=rev Log: Retag Added: commons/proper/net/tags/NET_2_1_RC_2/NET_2_0/ - copied from r833942, commons/proper/net/branches/NET_2_0/
svn commit: r833944 - /commons/proper/net/tags/NET_2_1_RC_3/
Author: rwinston Date: Sun Nov 8 23:20:14 2009 New Revision: 833944 URL: http://svn.apache.org/viewvc?rev=833944view=rev Log: Just create a new copy Added: commons/proper/net/tags/NET_2_1_RC_3/ - copied from r833943, commons/proper/net/branches/NET_2_0/
svn commit: r796159 - /commons/proper/net/tags/NET_1_5_0_RC4/
Author: rwinston Date: Tue Jul 21 06:36:10 2009 New Revision: 796159 URL: http://svn.apache.org/viewvc?rev=796159view=rev Log: Make a copy Added: commons/proper/net/tags/NET_1_5_0_RC4/ - copied from r796046, commons/proper/net/trunk/
svn commit: r796047 - /commons/proper/net/tags/NET_2_1_RC1/
Author: rwinston Date: Mon Jul 20 22:52:59 2009 New Revision: 796047 URL: http://svn.apache.org/viewvc?rev=796047view=rev Log: Make a copy Added: commons/proper/net/tags/NET_2_1_RC1/ - copied from r796046, commons/proper/net/trunk/
svn commit: r784156 - /commons/proper/net/branches/NET_2_0/src/site/xdoc/index.xml
Author: rwinston Date: Fri Jun 12 15:22:41 2009 New Revision: 784156 URL: http://svn.apache.org/viewvc?rev=784156view=rev Log: Update index Modified: commons/proper/net/branches/NET_2_0/src/site/xdoc/index.xml Modified: commons/proper/net/branches/NET_2_0/src/site/xdoc/index.xml URL: http://svn.apache.org/viewvc/commons/proper/net/branches/NET_2_0/src/site/xdoc/index.xml?rev=784156r1=784155r2=784156view=diff == --- commons/proper/net/branches/NET_2_0/src/site/xdoc/index.xml (original) +++ commons/proper/net/branches/NET_2_0/src/site/xdoc/index.xml Fri Jun 12 15:22:41 2009 @@ -70,8 +70,8 @@ to the continued development of Jakarta Commons Net. The current version numbering scheme bears no relation to the old. In other words, Jakarta Commons Net 1.0 succeeded and supplanted -NetComponents 1.3.8. The 2.0 branch of Commons Net will only run on -JDK 5.0 or higher. +NetComponents 1.3.8. The latest releases of Commons Net (2.0+) require +a JDK 5+ installation. /p /section section name=Further Information
svn commit: r784164 - /commons/proper/net/branches/NET_2_0/src/site/xdoc/tasks.xml
Author: rwinston Date: Fri Jun 12 15:51:31 2009 New Revision: 784164 URL: http://svn.apache.org/viewvc?rev=784164view=rev Log: Update docs Modified: commons/proper/net/branches/NET_2_0/src/site/xdoc/tasks.xml Modified: commons/proper/net/branches/NET_2_0/src/site/xdoc/tasks.xml URL: http://svn.apache.org/viewvc/commons/proper/net/branches/NET_2_0/src/site/xdoc/tasks.xml?rev=784164r1=784163r2=784164view=diff == --- commons/proper/net/branches/NET_2_0/src/site/xdoc/tasks.xml (original) +++ commons/proper/net/branches/NET_2_0/src/site/xdoc/tasks.xml Fri Jun 12 15:51:31 2009 @@ -24,14 +24,6 @@ /properties body -section name=Pre-1.4 Tasks - p -ul - liImplement Extensible date format handling for FTPClient (DONE)/li - liScan the bug list/li -/ul - /p -/section section name=Wishlist p ul @@ -44,11 +36,6 @@ org.apache.commons.net.util and org.apache.commons.net.io could be moved to their corresponding commons projects. /li li -Divorce FTPClient from TelnetClient, getting rid of the -TelnetClient threads which cause problems on some platforms -(e.g., MacOS). - /li - li Parse the client/server interactions without creating so many strings. Many operations are slow because of this. /li @@ -59,9 +46,7 @@ Make NNTPClient.listNewsgroups() and NNTPClient.listNewNews() more efficient. Don't preparse into lots of little objects. /li - li -TLS for FTP - /li + liFTP proxy support/li /ul /p /section
svn commit: r784165 - /commons/proper/net/branches/NET_2_1_RC1/
Author: rwinston Date: Fri Jun 12 15:52:22 2009 New Revision: 784165 URL: http://svn.apache.org/viewvc?rev=784165view=rev Log: Make a copy for RC1 Added: commons/proper/net/branches/NET_2_1_RC1/ - copied from r784164, commons/proper/net/branches/NET_2_0/
svn commit: r783862 - /commons/proper/net/branches/NET_2_0/src/site/xdoc/changes.xml
Author: rwinston Date: Thu Jun 11 17:41:47 2009 New Revision: 783862 URL: http://svn.apache.org/viewvc?rev=783862view=rev Log: Update xdoc Modified: commons/proper/net/branches/NET_2_0/src/site/xdoc/changes.xml Modified: commons/proper/net/branches/NET_2_0/src/site/xdoc/changes.xml URL: http://svn.apache.org/viewvc/commons/proper/net/branches/NET_2_0/src/site/xdoc/changes.xml?rev=783862r1=783861r2=783862view=diff == --- commons/proper/net/branches/NET_2_0/src/site/xdoc/changes.xml (original) +++ commons/proper/net/branches/NET_2_0/src/site/xdoc/changes.xml Thu Jun 11 17:41:47 2009 @@ -81,6 +81,24 @@ action dev=sebb type=add Javadoc fixes, improvements, and refactoring. /action + action dev=rwinston type=fix issue=NET-245 + Apply MFMT patch + /action + action dev=rwinston type=fix issue=NET-279 + Fix copying of reply lines collection + /action + action dev=rwinston type=fix issue=NET-277 + Fix incorrect NNTP constant + /action + action dev=rwinston type=fix issue=NET-276 + Use long instead of int for newsgroup counts + /action + action dev=rwinston type=fix issue=NET-274 + Restore socket state after CCC command + /action + action dev=rwinston type=fix + Fix inconsistent handling of socket read/write buffer size + /action /release release version=2.0 date=October 20, 2008 description=Java 5.0 release
svn commit: r783563 - /commons/proper/net/branches/NET_2_0/pom.xml
Author: rwinston Date: Wed Jun 10 22:53:37 2009 New Revision: 783563 URL: http://svn.apache.org/viewvc?rev=783563view=rev Log: Added FindBugs report Modified: commons/proper/net/branches/NET_2_0/pom.xml 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=783563r1=783562r2=783563view=diff == --- commons/proper/net/branches/NET_2_0/pom.xml (original) +++ commons/proper/net/branches/NET_2_0/pom.xml Wed Jun 10 22:53:37 2009 @@ -259,6 +259,12 @@ /reportSet /reportSets /plugin + + plugin + groupIdorg.codehaus.mojo/groupId + artifactIdfindbugs-maven-plugin/artifactId + /plugin + plugin groupIdorg.codehaus.mojo/groupId artifactIdclirr-maven-plugin/artifactId
svn commit: r781174 - /commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/smtp/SMTP.java
Author: rwinston Date: Tue Jun 2 21:17:05 2009 New Revision: 781174 URL: http://svn.apache.org/viewvc?rev=781174view=rev Log: NET-279: Fix replyLines copying Modified: commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/smtp/SMTP.java Modified: commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/smtp/SMTP.java URL: http://svn.apache.org/viewvc/commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/smtp/SMTP.java?rev=781174r1=781173r2=781174view=diff == --- commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/smtp/SMTP.java (original) +++ commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/smtp/SMTP.java Tue Jun 2 21:17:05 2009 @@ -442,10 +442,7 @@ ***/ public String[] getReplyStrings() { -String[] lines; -lines = new String[_replyLines.size()]; -_replyLines.addAll(Arrays.asList(lines)); -return lines; + return _replyLines.toArray(new String[_replyLines.size()]); } /***
svn commit: r771678 - /commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/ftp/FTPClient.java
Author: rwinston Date: Tue May 5 11:54:05 2009 New Revision: 771678 URL: http://svn.apache.org/viewvc?rev=771678view=rev Log: Fix typo Modified: commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/ftp/FTPClient.java Modified: commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/ftp/FTPClient.java URL: http://svn.apache.org/viewvc/commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/ftp/FTPClient.java?rev=771678r1=771677r2=771678view=diff == --- commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/ftp/FTPClient.java (original) +++ commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/ftp/FTPClient.java Tue May 5 11:54:05 2009 @@ -2421,8 +2421,7 @@ * @see a href=http://tools.ietf.org/html/draft-somers-ftp-mfxx-04;http://tools.ietf.org/html/draft-somers-ftp-mfxx-04/a */ public boolean setModificationTime(String pathname, String timeval) throws IOException { -return (FTPReply.isPositiveCompletion(mfmt(pathname, timeval)); - +return (FTPReply.isPositiveCompletion(mfmt(pathname, timeval))); }
svn commit: r771683 - in /commons/proper/net/branches/NET_2_0/src/main/java: examples/nntp/ org/apache/commons/net/nntp/
Author: rwinston Date: Tue May 5 12:02:04 2009 New Revision: 771683 URL: http://svn.apache.org/viewvc?rev=771683view=rev Log: NET-276: Use long instead of int for newsgroup article counts Modified: commons/proper/net/branches/NET_2_0/src/main/java/examples/nntp/ExtendedNNTPOps.java commons/proper/net/branches/NET_2_0/src/main/java/examples/nntp/MessageThreading.java commons/proper/net/branches/NET_2_0/src/main/java/examples/nntp/NNTPUtils.java commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/nntp/ArticlePointer.java commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/nntp/NNTPClient.java commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/nntp/NewsgroupInfo.java Modified: commons/proper/net/branches/NET_2_0/src/main/java/examples/nntp/ExtendedNNTPOps.java URL: http://svn.apache.org/viewvc/commons/proper/net/branches/NET_2_0/src/main/java/examples/nntp/ExtendedNNTPOps.java?rev=771683r1=771682r2=771683view=diff == --- commons/proper/net/branches/NET_2_0/src/main/java/examples/nntp/ExtendedNNTPOps.java (original) +++ commons/proper/net/branches/NET_2_0/src/main/java/examples/nntp/ExtendedNNTPOps.java Tue May 5 12:02:04 2009 @@ -58,8 +58,8 @@ // XOVER NewsgroupInfo testGroup = new NewsgroupInfo(); client.selectNewsgroup(alt.test, testGroup); -int lowArticleNumber = testGroup.getFirstArticle(); -int highArticleNumber = lowArticleNumber + 100; +long lowArticleNumber = testGroup.getFirstArticle(); +long highArticleNumber = lowArticleNumber + 100; ListArticle articles = NNTPUtils.getArticleInfo(client, lowArticleNumber, highArticleNumber); for (Article article : articles) { Modified: commons/proper/net/branches/NET_2_0/src/main/java/examples/nntp/MessageThreading.java URL: http://svn.apache.org/viewvc/commons/proper/net/branches/NET_2_0/src/main/java/examples/nntp/MessageThreading.java?rev=771683r1=771682r2=771683view=diff == --- commons/proper/net/branches/NET_2_0/src/main/java/examples/nntp/MessageThreading.java (original) +++ commons/proper/net/branches/NET_2_0/src/main/java/examples/nntp/MessageThreading.java Tue May 5 12:02:04 2009 @@ -56,8 +56,8 @@ NewsgroupInfo group = new NewsgroupInfo(); client.selectNewsgroup(alt.test, group); -int lowArticleNumber = group.getFirstArticle(); -int highArticleNumber = lowArticleNumber + 5000; +long lowArticleNumber = group.getFirstArticle(); +long highArticleNumber = lowArticleNumber + 5000; System.out.println(Retrieving articles between [ + lowArticleNumber + ] and [ + highArticleNumber + ]); ListArticle articles = NNTPUtils.getArticleInfo(client, lowArticleNumber, highArticleNumber); Modified: commons/proper/net/branches/NET_2_0/src/main/java/examples/nntp/NNTPUtils.java URL: http://svn.apache.org/viewvc/commons/proper/net/branches/NET_2_0/src/main/java/examples/nntp/NNTPUtils.java?rev=771683r1=771682r2=771683view=diff == --- commons/proper/net/branches/NET_2_0/src/main/java/examples/nntp/NNTPUtils.java (original) +++ commons/proper/net/branches/NET_2_0/src/main/java/examples/nntp/NNTPUtils.java Tue May 5 12:02:04 2009 @@ -45,7 +45,7 @@ * @return Article[] An array of Article * @throws IOException */ - public static ListArticle getArticleInfo(NNTPClient client, int lowArticleNumber, int highArticleNumber) + public static ListArticle getArticleInfo(NNTPClient client, long lowArticleNumber, long highArticleNumber) throws IOException { Reader reader = null; ListArticle articles = new ArrayListArticle(); Modified: commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/nntp/ArticlePointer.java URL: http://svn.apache.org/viewvc/commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/nntp/ArticlePointer.java?rev=771683r1=771682r2=771683view=diff == --- commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/nntp/ArticlePointer.java (original) +++ commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/nntp/ArticlePointer.java Tue May 5 12:02:04 2009 @@ -28,7 +28,7 @@ public final class ArticlePointer { /** The number of the referenced article. */ -public int articleNumber; +public long articleNumber; /** * The unique id of the referenced article, including the enclosing * lt and gt symbols which are technically not part of the Modified: commons/proper/net/branches
svn commit: r771691 - /commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/nntp/NNTPReply.java
Author: rwinston Date: Tue May 5 12:20:48 2009 New Revision: 771691 URL: http://svn.apache.org/viewvc?rev=771691view=rev Log: NET-277: Fix incorrect NNTP constant value Modified: commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/nntp/NNTPReply.java Modified: commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/nntp/NNTPReply.java URL: http://svn.apache.org/viewvc/commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/nntp/NNTPReply.java?rev=771691r1=771690r2=771691view=diff == --- commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/nntp/NNTPReply.java (original) +++ commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/nntp/NNTPReply.java Tue May 5 12:20:48 2009 @@ -53,7 +53,6 @@ public static final int CODE_340 = 340; public static final int CODE_381 = 381; public static final int CODE_400 = 400; -public static final int CODE_408 = 408; public static final int CODE_411 = 411; public static final int CODE_412 = 412; public static final int CODE_420 = 420; @@ -66,6 +65,7 @@ public static final int CODE_437 = 437; public static final int CODE_440 = 440; public static final int CODE_441 = 441; +public static final int CODE_480 = 480; public static final int CODE_482 = 482; public static final int CODE_500 = 500; public static final int CODE_501 = 501; @@ -94,7 +94,6 @@ public static final int MORE_AUTH_INFO_REQUIRED= CODE_381; public static final int SERVICE_DISCONTINUED = CODE_400; public static final int NO_SUCH_NEWSGROUP = CODE_411; -public static final int AUTHENTICATION_REQUIRED= CODE_408; public static final int NO_NEWSGROUP_SELECTED = CODE_412; public static final int NO_CURRENT_ARTICLE_SELECTED= CODE_420; public static final int NO_NEXT_ARTICLE= CODE_421; @@ -106,6 +105,7 @@ public static final int ARTICLE_REJECTED = CODE_437; public static final int POSTING_NOT_ALLOWED= CODE_440; public static final int POSTING_FAILED = CODE_441; +public static final int AUTHENTICATION_REQUIRED= CODE_480; public static final int AUTHENTICATION_REJECTED= CODE_482; public static final int COMMAND_NOT_RECOGNIZED = CODE_500; public static final int COMMAND_SYNTAX_ERROR = CODE_501;
svn commit: r768603 - /commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/ftp/FTPClient.java
Author: rwinston Date: Sat Apr 25 21:25:26 2009 New Revision: 768603 URL: http://svn.apache.org/viewvc?rev=768603view=rev Log: NET-275: Fix examples Modified: commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/ftp/FTPClient.java Modified: commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/ftp/FTPClient.java URL: http://svn.apache.org/viewvc/commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/ftp/FTPClient.java?rev=768603r1=768602r2=768603view=diff == --- commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/ftp/FTPClient.java (original) +++ commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/ftp/FTPClient.java Sat Apr 25 21:25:26 2009 @@ -175,7 +175,7 @@ * p * Unpaged (whole list) access, using a parser accessible by auto-detect: * pre - *FTPClient f=FTPClient(); + *FTPClient f = new FTPClient(); *f.connect(server); *f.login(username, password); *FTPFile[] files = listFiles(directory); @@ -185,7 +185,7 @@ * defined in the first parameter of initateListParsing should be derived * from org.apache.commons.net.FTPFileEntryParser: * pre - *FTPClient f=FTPClient(); + *FTPClient f = new FTPClient(); *f.connect(server); *f.login(username, password); *FTPListParseEngine engine = @@ -200,7 +200,7 @@ * p * Paged access, using a parser accessible by auto-detect: * pre - *FTPClient f=FTPClient(); + *FTPClient f = new FTPClient(); *f.connect(server); *f.login(username, password); *FTPListParseEngine engine = f.initiateListParsing(directory);
svn commit: r767772 - /commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/ftp/FTPSClient.java
Author: rwinston Date: Thu Apr 23 03:23:57 2009 New Revision: 767772 URL: http://svn.apache.org/viewvc?rev=767772view=rev Log: NET-274: Restore socket i/o streams after CCC command Modified: commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/ftp/FTPSClient.java Modified: commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/ftp/FTPSClient.java URL: http://svn.apache.org/viewvc/commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/ftp/FTPSClient.java?rev=767772r1=767771r2=767772view=diff == --- commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/ftp/FTPSClient.java (original) +++ commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/ftp/FTPSClient.java Thu Apr 23 03:23:57 2009 @@ -475,9 +475,16 @@ @Override public int sendCommand(String command, String args) throws IOException { int repCode = super.sendCommand(command, args); +/* If CCC is issued, restore socket i/o streams to unsecured versions */ if (FTPSCommand._commands[FTPSCommand.CCC].equals(command)) { if (FTPReply.COMMAND_OK == repCode) { _socket_ = plainSocket; + _controlInput_ = new BufferedReader( + new InputStreamReader( + _socket_ .getInputStream(), getControlEncoding())); + _controlOutput_ = new BufferedWriter( + new OutputStreamWriter( + _socket_.getOutputStream(), getControlEncoding())); setSocketFactory(null); } else { throw new SSLException(getReplyString());
svn commit: r764660 - in /commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/ftp: FTP.java FTPClient.java FTPCommand.java
Author: rwinston Date: Tue Apr 14 01:42:02 2009 New Revision: 764660 URL: http://svn.apache.org/viewvc?rev=764660view=rev Log: NET-245: Apply MFMT patch submitted by Shikhar Modified: commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/ftp/FTP.java commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/ftp/FTPClient.java commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/ftp/FTPCommand.java Modified: commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/ftp/FTP.java URL: http://svn.apache.org/viewvc/commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/ftp/FTP.java?rev=764660r1=764659r2=764660view=diff == --- commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/ftp/FTP.java (original) +++ commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/ftp/FTP.java Tue Apr 14 01:42:02 2009 @@ -1162,7 +1162,30 @@ { return sendCommand(FTPCommand.MDTM, file); } - + + +/** + * A convenience method to send the FTP MFMT command to the server, + * receive the reply, and return the reply code. + * p + * @param pathname The pathname for which mtime is to be changed + * @param timeval Timestamp in codeMMDDhhmmss/code format + * @return The reply code received from the server. + * @exception FTPConnectionClosedException + * If the FTP server prematurely closes the connection as a result + * of the client being idle or some other reason causing the server + * to send FTP reply code 421. This exception may be caught either + * as an IOException or independently as itself. + * @exception IOException If an I/O error occurs while either sending the + * command or receiving the server reply. + * @see a href=http://tools.ietf.org/html/draft-somers-ftp-mfxx-04;http://tools.ietf.org/html/draft-somers-ftp-mfxx-04/a + **/ +public int mfmt(String pathname, String timeval) throws IOException +{ + return sendCommand(FTPCommand.MFMT, timeval + + pathname); +} + + /*** * A convenience method to send the FTP RNFR command to the server, * receive the reply, and return the reply code. Modified: commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/ftp/FTPClient.java URL: http://svn.apache.org/viewvc/commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/ftp/FTPClient.java?rev=764660r1=764659r2=764660view=diff == --- commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/ftp/FTPClient.java (original) +++ commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/ftp/FTPClient.java Tue Apr 14 01:42:02 2009 @@ -625,6 +625,7 @@ ***/ public boolean login(String username, String password) throws IOException { + user(username); if (FTPReply.isPositiveCompletion(_replyCode)) @@ -2402,7 +2403,29 @@ return null; } - + +/** + * Issue the FTP MFMT command (not supported by all servers) which sets the last + * modified time of a file. + * + * The timestamp should be in the form codeMMDDhhmmss/code. It should also + * be in GMT, but not all servers honour this. + * + * An FTP server would indicate its support of this feature by including MFMT + * in its response to the FEAT command, which may be retrieved by FTPClient.features() + * + * @param pathname The file path for which last modified time is to be changed. + * @param timeval The timestamp to set to, in codeMMDDhhmmss/code format. + * @return true if successfully set, false if not + * @throws IOException if an I/O error occurs. + * @see a href=http://tools.ietf.org/html/draft-somers-ftp-mfxx-04;http://tools.ietf.org/html/draft-somers-ftp-mfxx-04/a + */ +public boolean setModificationTime(String pathname, String timeval) throws IOException { +return (FTPReply.isPositiveCompletion(mfmt(pathname, timeval)); + +} + + /** * Set the internal buffer size. * Modified: commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/ftp/FTPCommand.java URL: http://svn.apache.org/viewvc/commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/ftp/FTPCommand.java?rev=764660r1=764659r2=764660view=diff == --- commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/ftp/FTPCommand.java (original) +++ commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/ftp/FTPCommand.java Tue Apr 14 01:42:02 2009 @@ -32,7 +32,6
svn commit: r761980 - in /commons/proper/net/branches/NET_2_0/src/main/java: examples/SubnetUtilsExample.java org/apache/commons/net/util/SubnetUtils.java
Author: rwinston Date: Sat Apr 4 18:29:29 2009 New Revision: 761980 URL: http://svn.apache.org/viewvc?rev=761980view=rev Log: NET-262: Throw an exception if netmask bits are not in (0,x] Modified: commons/proper/net/branches/NET_2_0/src/main/java/examples/SubnetUtilsExample.java commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/util/SubnetUtils.java Modified: commons/proper/net/branches/NET_2_0/src/main/java/examples/SubnetUtilsExample.java URL: http://svn.apache.org/viewvc/commons/proper/net/branches/NET_2_0/src/main/java/examples/SubnetUtilsExample.java?rev=761980r1=761979r2=761980view=diff == --- commons/proper/net/branches/NET_2_0/src/main/java/examples/SubnetUtilsExample.java (original) +++ commons/proper/net/branches/NET_2_0/src/main/java/examples/SubnetUtilsExample.java Sat Apr 4 18:29:29 2009 @@ -30,7 +30,7 @@ public class SubnetUtilsExample { public static void main(String[] args) { -String subnet = 192.168.0.1/29; +String subnet = 192.168.0.3/31; SubnetUtils utils = new SubnetUtils(subnet); SubnetInfo info = utils.getInfo(); @@ -48,9 +48,9 @@ Integer.toBinaryString(info.asInteger(info.getNetworkAddress(; System.out.printf(Broadcast Address:\t\t%s\t[%s]\n, info.getBroadcastAddress(), Integer.toBinaryString(info.asInteger(info.getBroadcastAddress(; -System.out.printf(First Usable Address:\t\t%s\t[%s]\n, info.getLowAddress(), +System.out.printf(Low Address:\t\t\t%s\t[%s]\n, info.getLowAddress(), Integer.toBinaryString(info.asInteger(info.getLowAddress(; -System.out.printf(Last Usable Address:\t\t%s\t[%s]\n, info.getHighAddress(), +System.out.printf(High Address:\t\t\t%s\t[%s]\n, info.getHighAddress(), Integer.toBinaryString(info.asInteger(info.getHighAddress(; System.out.printf(Total usable addresses: \t%d\n, info.getAddressCount()); Modified: commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/util/SubnetUtils.java URL: http://svn.apache.org/viewvc/commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/util/SubnetUtils.java?rev=761980r1=761979r2=761980view=diff == --- commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/util/SubnetUtils.java (original) +++ commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/util/SubnetUtils.java Sat Apr 4 18:29:29 2009 @@ -199,7 +199,7 @@ * Convenience function to check integer boundaries */ private int rangeCheck(int value, int begin, int end) { -if (value = begin value = end) +if (value begin value = end) // (0,nbits] return value; throw new IllegalArgumentException(Value out of range: [ + value + ]);
svn commit: r761983 - /commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/util/SubnetUtils.java
Author: rwinston Date: Sat Apr 4 18:46:23 2009 New Revision: 761983 URL: http://svn.apache.org/viewvc?rev=761983view=rev Log: NET-261 NET-262: Clarify range assumptions and fix range checks Modified: commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/util/SubnetUtils.java Modified: commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/util/SubnetUtils.java URL: http://svn.apache.org/viewvc/commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/util/SubnetUtils.java?rev=761983r1=761982r2=761983view=diff == --- commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/util/SubnetUtils.java (original) +++ commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/util/SubnetUtils.java Sat Apr 4 18:46:23 2009 @@ -69,6 +69,13 @@ private int low() { return network() + 1; } private int high() { return broadcast() - 1; } +/** + * Returns true if the parameter codeaddress/code is in the + * range of usable endpoint addresses for this subnet. This excludes the + * network and broadcast adresses. + * @param address A dot-delimited IPv4 address, e.g. 192.168.0.1 + * @return True if in range, false otherwise + */ public boolean isInRange(String address){ return isInRange(toInteger(address)); } private boolean isInRange(int address) { @@ -131,10 +138,12 @@ address = matchAddress(matcher); /* Create a binary netmask from the number of bits specification /x */ -int cidrPart = rangeCheck(Integer.parseInt(matcher.group(5)), 0, NBITS-1); +int cidrPart = rangeCheck(Integer.parseInt(matcher.group(5)), -1, NBITS-1); for (int j = 0; j cidrPart; ++j) { netmask |= (1 31-j); } + +rangeCheck(pop(netmask),0, NBITS); /* Calculate base network address */ network = (address netmask); @@ -165,7 +174,7 @@ private int matchAddress(Matcher matcher) { int addr = 0; for (int i = 1; i = 4; ++i) { -int n = (rangeCheck(Integer.parseInt(matcher.group(i)), 0, 255)); +int n = (rangeCheck(Integer.parseInt(matcher.group(i)), -1, 255)); addr |= ((n 0xff) 8*(4-i)); } return addr; @@ -196,10 +205,12 @@ } /* - * Convenience function to check integer boundaries + * Convenience function to check integer boundaries. + * Checks if a value x is in the range (begin,end]. + * Returns x if it is in range, throws an exception otherwise. */ private int rangeCheck(int value, int begin, int end) { -if (value begin value = end) // (0,nbits] +if (value begin value = end) // (begin,end] return value; throw new IllegalArgumentException(Value out of range: [ + value + ]);
svn commit: r761985 - /commons/proper/net/branches/NET_2_0/src/test/java/org/apache/commons/net/SubnetUtilsTest.java
Author: rwinston Date: Sat Apr 4 18:58:52 2009 New Revision: 761985 URL: http://svn.apache.org/viewvc?rev=761985view=rev Log: Add /0 netmask check Modified: commons/proper/net/branches/NET_2_0/src/test/java/org/apache/commons/net/SubnetUtilsTest.java Modified: commons/proper/net/branches/NET_2_0/src/test/java/org/apache/commons/net/SubnetUtilsTest.java URL: http://svn.apache.org/viewvc/commons/proper/net/branches/NET_2_0/src/test/java/org/apache/commons/net/SubnetUtilsTest.java?rev=761985r1=761984r2=761985view=diff == --- commons/proper/net/branches/NET_2_0/src/test/java/org/apache/commons/net/SubnetUtilsTest.java (original) +++ commons/proper/net/branches/NET_2_0/src/test/java/org/apache/commons/net/SubnetUtilsTest.java Sat Apr 4 18:58:52 2009 @@ -58,4 +58,14 @@ assertFalse(info.isInRange(192.168.1.1)); assertFalse(info.isInRange(192.168.0.255)); } + +public void testZeroNetmaskBits() { + try { + SubnetUtils utils = new SubnetUtils(192.168.0.1/0); + assertTrue(/0 should be an invalid mask, false); + } + catch (Exception e) { + ; + } +} }
svn commit: r761987 - in /commons/proper/net/branches/NET_2_0/src/main/java/examples/nntp: ListNewsgroups.java newsgroups.java
Author: rwinston Date: Sat Apr 4 19:02:50 2009 New Revision: 761987 URL: http://svn.apache.org/viewvc?rev=761987view=rev Log: Rename Added: commons/proper/net/branches/NET_2_0/src/main/java/examples/nntp/ListNewsgroups.java (with props) Removed: commons/proper/net/branches/NET_2_0/src/main/java/examples/nntp/newsgroups.java Added: commons/proper/net/branches/NET_2_0/src/main/java/examples/nntp/ListNewsgroups.java URL: http://svn.apache.org/viewvc/commons/proper/net/branches/NET_2_0/src/main/java/examples/nntp/ListNewsgroups.java?rev=761987view=auto == --- commons/proper/net/branches/NET_2_0/src/main/java/examples/nntp/ListNewsgroups.java (added) +++ commons/proper/net/branches/NET_2_0/src/main/java/examples/nntp/ListNewsgroups.java Sat Apr 4 19:02:50 2009 @@ -0,0 +1,89 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the License); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package examples.nntp; + +import java.io.IOException; +import org.apache.commons.net.nntp.NNTPClient; +import org.apache.commons.net.nntp.NewsgroupInfo; + +/*** + * This is a trivial example using the NNTP package to approximate the + * Unix newsgroups command. It merely connects to the specified news + * server and issues fetches the list of newsgroups stored by the server. + * On servers that store a lot of newsgroups, this command can take a very + * long time (listing upwards of 30,000 groups). + * p + ***/ + +public final class ListNewsgroups +{ + +public final static void main(String[] args) +{ +NNTPClient client; +NewsgroupInfo[] list; + +if (args.length 1) +{ +System.err.println(Usage: newsgroups newsserver); +System.exit(1); +} + +client = new NNTPClient(); + +try +{ +client.connect(args[0]); + +list = client.listNewsgroups(); + +if (list != null) +{ +for (int i = 0; i list.length; i++) +System.out.println(list[i].getNewsgroup()); +} +else +{ +System.err.println(LIST command failed.); +System.err.println(Server reply: + client.getReplyString()); +} +} +catch (IOException e) +{ +e.printStackTrace(); +} +finally +{ +try +{ +if (client.isConnected()) +client.disconnect(); +} +catch (IOException e) +{ +System.err.println(Error disconnecting from server.); +e.printStackTrace(); +System.exit(1); +} +} + +} + +} + + Propchange: commons/proper/net/branches/NET_2_0/src/main/java/examples/nntp/ListNewsgroups.java -- svn:eol-style = native
svn commit: r761988 - in /commons/proper/net/branches/NET_2_0/src/main/java/examples/nntp: PostMessage.java post.java
Author: rwinston Date: Sat Apr 4 19:05:38 2009 New Revision: 761988 URL: http://svn.apache.org/viewvc?rev=761988view=rev Log: Rename Added: commons/proper/net/branches/NET_2_0/src/main/java/examples/nntp/PostMessage.java (with props) Removed: commons/proper/net/branches/NET_2_0/src/main/java/examples/nntp/post.java Added: commons/proper/net/branches/NET_2_0/src/main/java/examples/nntp/PostMessage.java URL: http://svn.apache.org/viewvc/commons/proper/net/branches/NET_2_0/src/main/java/examples/nntp/PostMessage.java?rev=761988view=auto == --- commons/proper/net/branches/NET_2_0/src/main/java/examples/nntp/PostMessage.java (added) +++ commons/proper/net/branches/NET_2_0/src/main/java/examples/nntp/PostMessage.java Sat Apr 4 19:05:38 2009 @@ -0,0 +1,171 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the License); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package examples.nntp; + +import java.io.BufferedReader; +import java.io.FileNotFoundException; +import java.io.FileReader; +import java.io.IOException; +import java.io.InputStreamReader; +import java.io.PrintWriter; +import java.io.Writer; + +import org.apache.commons.net.PrintCommandListener; +import org.apache.commons.net.io.Util; +import org.apache.commons.net.nntp.NNTPClient; +import org.apache.commons.net.nntp.NNTPReply; +import org.apache.commons.net.nntp.SimpleNNTPHeader; + + +/*** + * This is an example program using the NNTP package to post an article + * to the specified newsgroup(s). It prompts you for header information and + * a filename to post. + * p + ***/ + +public final class PostMessage +{ + +public final static void main(String[] args) +{ +String from, subject, newsgroup, filename, server, organization; +String references; +BufferedReader stdin; +FileReader fileReader = null; +SimpleNNTPHeader header; +NNTPClient client; + +if (args.length 1) +{ +System.err.println(Usage: post newsserver); +System.exit(1); +} + +server = args[0]; + +stdin = new BufferedReader(new InputStreamReader(System.in)); + +try +{ +System.out.print(From: ); +System.out.flush(); + +from = stdin.readLine(); + +System.out.print(Subject: ); +System.out.flush(); + +subject = stdin.readLine(); + +header = new SimpleNNTPHeader(from, subject); + +System.out.print(Newsgroup: ); +System.out.flush(); + +newsgroup = stdin.readLine(); +header.addNewsgroup(newsgroup); + +while (true) +{ +System.out.print(Additional Newsgroup Hit enter to end: ); +System.out.flush(); + +// Of course you don't want to do this because readLine() may be null +newsgroup = stdin.readLine().trim(); + +if (newsgroup.length() == 0) +break; + +header.addNewsgroup(newsgroup); +} + +System.out.print(Organization: ); +System.out.flush(); + +organization = stdin.readLine(); + +System.out.print(References: ); +System.out.flush(); + +references = stdin.readLine(); + +if (organization != null organization.length() 0) +header.addHeaderField(Organization, organization); + +if (references != null organization.length() 0) +header.addHeaderField(References, references); + +header.addHeaderField(X-Newsreader, NetComponents); + +System.out.print(Filename: ); +System.out.flush(); + +filename = stdin.readLine(); + +try +{ +fileReader = new FileReader(filename); +} +catch (FileNotFoundException e) +{ +System.err.println(File not found. + e.getMessage()); +System.exit(1); +} + +client = new NNTPClient(); +client.addProtocolCommandListener(new PrintCommandListener
svn commit: r761990 - in /commons/proper/net/branches/NET_2_0/src/main/java/examples: FTPExample.java FTPSExample.java ftp/ ftp/FTPExample.java ftp/FTPSExample.java ftp/ServerToServerFTP.java ftp/TFTP
Author: rwinston Date: Sat Apr 4 19:08:57 2009 New Revision: 761990 URL: http://svn.apache.org/viewvc?rev=761990view=rev Log: Rename and move Added: commons/proper/net/branches/NET_2_0/src/main/java/examples/ftp/ commons/proper/net/branches/NET_2_0/src/main/java/examples/ftp/FTPExample.java (with props) commons/proper/net/branches/NET_2_0/src/main/java/examples/ftp/FTPSExample.java (with props) commons/proper/net/branches/NET_2_0/src/main/java/examples/ftp/ServerToServerFTP.java (with props) commons/proper/net/branches/NET_2_0/src/main/java/examples/ftp/TFTPExample.java (with props) Removed: commons/proper/net/branches/NET_2_0/src/main/java/examples/FTPExample.java commons/proper/net/branches/NET_2_0/src/main/java/examples/FTPSExample.java commons/proper/net/branches/NET_2_0/src/main/java/examples/server2serverFTP.java commons/proper/net/branches/NET_2_0/src/main/java/examples/tftp.java Added: commons/proper/net/branches/NET_2_0/src/main/java/examples/ftp/FTPExample.java URL: http://svn.apache.org/viewvc/commons/proper/net/branches/NET_2_0/src/main/java/examples/ftp/FTPExample.java?rev=761990view=auto == --- commons/proper/net/branches/NET_2_0/src/main/java/examples/ftp/FTPExample.java (added) +++ commons/proper/net/branches/NET_2_0/src/main/java/examples/ftp/FTPExample.java Sat Apr 4 19:08:57 2009 @@ -0,0 +1,192 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the License); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package examples.ftp; + +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.io.PrintWriter; + +import org.apache.commons.net.PrintCommandListener; +import org.apache.commons.net.ftp.FTP; +import org.apache.commons.net.ftp.FTPClient; +import org.apache.commons.net.ftp.FTPConnectionClosedException; +import org.apache.commons.net.ftp.FTPReply; + +/*** + * This is an example program demonstrating how to use the FTPClient class. + * This program connects to an FTP server and retrieves the specified + * file. If the -s flag is used, it stores the local file at the FTP server. + * Just so you can see what's happening, all reply strings are printed. + * If the -b flag is used, a binary transfer is assumed (default is ASCII). + * p + * Usage: ftp [-s] [-b] hostname username password remote file local file + * p + ***/ +public final class FTPExample +{ + +public static final String USAGE = +Usage: ftp [-s] [-b] hostname username password remote file local file\n + +\nDefault behavior is to download a file and use ASCII transfer mode.\n + +\t-s store file on server (upload)\n + +\t-b use binary transfer mode\n; + +public static final void main(String[] args) +{ +int base = 0; +boolean storeFile = false, binaryTransfer = false, error = false; +String server, username, password, remote, local; +FTPClient ftp; + +for (base = 0; base args.length; base++) +{ +if (args[base].startsWith(-s)) +storeFile = true; +else if (args[base].startsWith(-b)) +binaryTransfer = true; +else +break; +} + +if ((args.length - base) != 5) +{ +System.err.println(USAGE); +System.exit(1); +} + +server = args[base++]; +username = args[base++]; +password = args[base++]; +remote = args[base++]; +local = args[base]; + +ftp = new FTPClient(); +ftp.addProtocolCommandListener(new PrintCommandListener( + new PrintWriter(System.out))); + +try +{ +int reply; +ftp.connect(server); +System.out.println(Connected to + server + .); + +// After connection attempt, you should check the reply code to verify +// success. +reply = ftp.getReplyCode(); + +if (!FTPReply.isPositiveCompletion(reply)) +{ +ftp.disconnect
svn commit: r761991 - in /commons/proper/net/branches/NET_2_0/src: main/java/examples/ main/java/examples/util/ main/java/org/apache/commons/net/ftp/ main/java/org/apache/commons/net/ftp/parser/ test/
Author: rwinston Date: Sat Apr 4 19:25:29 2009 New Revision: 761991 URL: http://svn.apache.org/viewvc?rev=761991view=rev Log: * NET-252 Remove deprecated API * Move IOUtil.java to utils/ package Added: commons/proper/net/branches/NET_2_0/src/main/java/examples/util/ commons/proper/net/branches/NET_2_0/src/main/java/examples/util/IOUtil.java (with props) Removed: commons/proper/net/branches/NET_2_0/src/main/java/examples/IOUtil.java Modified: commons/proper/net/branches/NET_2_0/src/main/java/examples/rexec.java commons/proper/net/branches/NET_2_0/src/main/java/examples/rlogin.java commons/proper/net/branches/NET_2_0/src/main/java/examples/rshell.java commons/proper/net/branches/NET_2_0/src/main/java/examples/weatherTelnet.java commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/ftp/FTPListParseEngine.java commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/ftp/parser/VMSFTPEntryParser.java commons/proper/net/branches/NET_2_0/src/test/java/org/apache/commons/net/ftp/parser/VMSFTPEntryParserTest.java Modified: commons/proper/net/branches/NET_2_0/src/main/java/examples/rexec.java URL: http://svn.apache.org/viewvc/commons/proper/net/branches/NET_2_0/src/main/java/examples/rexec.java?rev=761991r1=761990r2=761991view=diff == --- commons/proper/net/branches/NET_2_0/src/main/java/examples/rexec.java (original) +++ commons/proper/net/branches/NET_2_0/src/main/java/examples/rexec.java Sat Apr 4 19:25:29 2009 @@ -20,6 +20,8 @@ import java.io.IOException; import org.apache.commons.net.bsd.RExecClient; +import examples.util.IOUtil; + /*** * This is an example program demonstrating how to use the RExecClient class. * This program connects to an rexec server and requests that the Modified: commons/proper/net/branches/NET_2_0/src/main/java/examples/rlogin.java URL: http://svn.apache.org/viewvc/commons/proper/net/branches/NET_2_0/src/main/java/examples/rlogin.java?rev=761991r1=761990r2=761991view=diff == --- commons/proper/net/branches/NET_2_0/src/main/java/examples/rlogin.java (original) +++ commons/proper/net/branches/NET_2_0/src/main/java/examples/rlogin.java Sat Apr 4 19:25:29 2009 @@ -20,6 +20,8 @@ import java.io.IOException; import org.apache.commons.net.bsd.RLoginClient; +import examples.util.IOUtil; + /*** * This is an example program demonstrating how to use the RLoginClient * class. This program connects to an rlogin daemon and begins to Modified: commons/proper/net/branches/NET_2_0/src/main/java/examples/rshell.java URL: http://svn.apache.org/viewvc/commons/proper/net/branches/NET_2_0/src/main/java/examples/rshell.java?rev=761991r1=761990r2=761991view=diff == --- commons/proper/net/branches/NET_2_0/src/main/java/examples/rshell.java (original) +++ commons/proper/net/branches/NET_2_0/src/main/java/examples/rshell.java Sat Apr 4 19:25:29 2009 @@ -20,6 +20,8 @@ import java.io.IOException; import org.apache.commons.net.bsd.RCommandClient; +import examples.util.IOUtil; + /*** * This is an example program demonstrating how to use the RCommandClient * class. This program connects to an rshell daemon and requests that the Added: commons/proper/net/branches/NET_2_0/src/main/java/examples/util/IOUtil.java URL: http://svn.apache.org/viewvc/commons/proper/net/branches/NET_2_0/src/main/java/examples/util/IOUtil.java?rev=761991view=auto == --- commons/proper/net/branches/NET_2_0/src/main/java/examples/util/IOUtil.java (added) +++ commons/proper/net/branches/NET_2_0/src/main/java/examples/util/IOUtil.java Sat Apr 4 19:25:29 2009 @@ -0,0 +1,104 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the License); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package examples.util; + +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import org.apache.commons.net.io.Util; + +/*** + * This is a utility class providing a reader/writer capability required
svn commit: r762014 - /commons/proper/net/branches/NET_2_0/src/site/xdoc/changes.xml
Author: rwinston Date: Sat Apr 4 21:32:27 2009 New Revision: 762014 URL: http://svn.apache.org/viewvc?rev=762014view=rev Log: Update changes xdoc for 2.1 Modified: commons/proper/net/branches/NET_2_0/src/site/xdoc/changes.xml Modified: commons/proper/net/branches/NET_2_0/src/site/xdoc/changes.xml URL: http://svn.apache.org/viewvc/commons/proper/net/branches/NET_2_0/src/site/xdoc/changes.xml?rev=762014r1=762013r2=762014view=diff == --- commons/proper/net/branches/NET_2_0/src/site/xdoc/changes.xml (original) +++ commons/proper/net/branches/NET_2_0/src/site/xdoc/changes.xml Sat Apr 4 21:32:27 2009 @@ -20,10 +20,67 @@ titleChanges/title author email=rwins...@apache.orgRory Winston/author /properties - + body release version=2.1 description=Fix release + action dev=rwinston type=fix issue=NET-215 + UNIXFTPEntryParser didn't preserve trailing whitespace in files + /action + action dev=rwinston type=fix issue=NET-236 + method SubnetUtils.SubnetInfo.isInRange(addr) returns incorrect result + /action + action dev=rwinston type=fix issue=NET-242 + Method createServerSocket of FTPSSocketFactory never called and thus UseClientMode is incorrect in a secured ftp transfer using active mode. + /action + action dev=rwinston type=fix issue=NET-248 + Fix inconsistent command list in FTPCommand + /action + action dev=rwinston type=fix issue=NET-250 + DefaultFTPFileEntryParserFactory did not work with Netware FTP server returning NETWARE TYPE: L8 + /action + action dev=rwinston type=fix issue=NET-257 + FTP.getReplyStrings() returned array of null Strings + /action + action dev=rwinston type=fix issue=NET-259 + UnixFTPEntryParser regex did not match some directory entries + /action + action dev=rwinston type=fix issue=NET-260 + SubnetUtils.SubnetInfo.isInRange(...) returned incorrect values + /action + action dev=rwinston type=update issue=NET-261 + SubnetUtils.SubnetInfo.isInRange(...) behaviour not documented + /action + action dev=rwinston type=fix issue=NET-262 + SubnetUtils did not handle /31 and /32 CIDRs well + /action + action dev=rwinston type=fix issue=NET-265 + UnixFTPEntryParser failed to parse entry in certain conditions + /action + action dev=rwinston type=fix issue=NET-266 + FTPClient.listFiles() corrupted file name in certain circumstances + /action + action dev=rwinston type=update issue=NET-251 + Moved class ThreadContainer from Threader.java into its own source file + /action + action dev=rwinston type=update issue=NET-252 + Get rid of using deprecated API in VMSFTPEntryParser + /action + action dev=rwinston type=fix issue=NET-256 + FTPSClient should accept a pre-configured SSLContext + /action + action dev=rwinston type=add issue=NET-263 + SubnetUtils / SubNetInfo toString() implementations + /action + action dev=rwinston type=fix + Improve NNTPClient handling of invalid articles + /action + action dev=rwinston type=update + Refactor examples package. + /action + action dev=sebb type=add + Javadoc fixes, improvements, and refactoring. + /action /release release version=2.0 date=October 20, 2008 description=Java 5.0 release @@ -159,99 +216,99 @@ action dev=rwinston type=fix issue=NET-198 Allow FTPTimestampParserImpl to take a predefined Calendar instance representing current time. /action -action dev=sebb type=fix issue=NET-194
svn commit: r762023 - /commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/SocketClient.java
Author: rwinston Date: Sat Apr 4 22:14:58 2009 New Revision: 762023 URL: http://svn.apache.org/viewvc?rev=762023view=rev Log: * Clean up SocketClient.java slightly * Fix bug where SO_RCVBUF and SO_SNDBUF calls had no effect Modified: commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/SocketClient.java Modified: commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/SocketClient.java URL: http://svn.apache.org/viewvc/commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/SocketClient.java?rev=762023r1=762022r2=762023view=diff == --- commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/SocketClient.java (original) +++ commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/SocketClient.java Sat Apr 4 22:14:58 2009 @@ -91,7 +91,13 @@ /** The socket's connect timeout (0 = infinite timeout) */ private static final int DEFAULT_CONNECT_TIMEOUT = 0; protected int connectTimeout = DEFAULT_CONNECT_TIMEOUT; - + +/** Hint for SO_RCVBUF size */ +int receiveBufferSize = -1; + +/** Hint for SO_SNDBUF size */ +int sendBufferSize = -1; + /** * Default constructor for SocketClient. Initializes * _socket_ to null, _timeout_ to 0, _defaultPort to 0, @@ -151,8 +157,9 @@ throws SocketException, IOException { _socket_ = _socketFactory_.createSocket(); +if (receiveBufferSize != -1) _socket_.setReceiveBufferSize(receiveBufferSize); +if (sendBufferSize != -1) _socket_.setSendBufferSize(sendBufferSize); _socket_.connect(new InetSocketAddress(host, port), connectTimeout); - _connectAction_(); } @@ -173,10 +180,7 @@ public void connect(String hostname, int port) throws SocketException, IOException { -_socket_= _socketFactory_.createSocket(); -_socket_.connect(new InetSocketAddress(hostname, port), connectTimeout); - -_connectAction_(); +connect(InetAddress.getByName(hostname), port); } @@ -199,10 +203,11 @@ InetAddress localAddr, int localPort) throws SocketException, IOException { -_socket_ = _socketFactory_.createSocket(); +_socket_ = _socketFactory_.createSocket(); +if (receiveBufferSize != -1) _socket_.setReceiveBufferSize(receiveBufferSize); +if (sendBufferSize != -1) _socket_.setSendBufferSize(sendBufferSize); _socket_.bind(new InetSocketAddress(localAddr, localPort)); _socket_.connect(new InetSocketAddress(host, port), connectTimeout); - _connectAction_(); } @@ -227,9 +232,7 @@ InetAddress localAddr, int localPort) throws SocketException, IOException { -_socket_ = -_socketFactory_.createSocket(hostname, port, localAddr, localPort); -_connectAction_(); + connect(InetAddress.getByName(hostname), port, localAddr, localPort); } @@ -384,7 +387,7 @@ * @since 2.0 */ public void setSendBufferSize(int size) throws SocketException { -_socket_.setSendBufferSize(size); +sendBufferSize = size; } @@ -396,7 +399,7 @@ * @since 2.0 */ public void setReceiveBufferSize(int size) throws SocketException { -_socket_.setReceiveBufferSize(size); +receiveBufferSize = size; }
svn commit: r757226 - /commons/proper/net/branches/NET_2_0/src/test/java/org/apache/commons/net/ftp/parser/UnixFTPEntryParserTest.java
Author: rwinston Date: Sun Mar 22 18:01:22 2009 New Revision: 757226 URL: http://svn.apache.org/viewvc?rev=757226view=rev Log: Modify test as per NET-266 Modified: 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/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=757226r1=757225r2=757226view=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 Sun Mar 22 18:01:22 2009 @@ -196,7 +196,6 @@ assertEquals(f.getSize(), 12414535); assertEquals(f.getName(), test 1999 abc.pdf); - Calendar cal = Calendar.getInstance(); cal.set(Calendar.MONTH, Calendar.MARCH); cal.set(Calendar.DAY_OF_MONTH, 17); @@ -208,8 +207,11 @@ } public void testFilenamesWithEmbeddedNumbers() { - FTPFile f = getParser().parseFTPEntry(-rw-r--r-- 1 root root 111325 Feb 25 12:00 123 456 abc.csv); + FTPFile f = getParser().parseFTPEntry(-rw-rw-rw- 1 user group 5840 Mar 19 09:34 123 456 abc.csv); assertEquals(f.getName(), 123 456 abc.csv); + assertEquals(f.getSize(), 5840); + assertEquals(f.getUser(), user); + assertEquals(f.getGroup(), group); } /**
svn commit: r757233 - 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/OS400FTPEntryParserTe
Author: rwinston Date: Sun Mar 22 18:46:16 2009 New Revision: 757233 URL: http://svn.apache.org/viewvc?rev=757233view=rev Log: * Update UnixFTPEntryParser parser regex to enable parsing of timestamps with the day preceding the month. Currently the parser can be configured to use this style of timestamp, but the low-level matcher doesn't recognize it. * Updare OS400FTPEntryParserTest: due to enhancements in UnixFTPEntryParser, some tests that were previously marked as bad now pass. 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/OS400FTPEntryParserTest.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=757233r1=757232r2=757233view=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 Sun Mar 22 18:46:16 2009 @@ -91,7 +91,7 @@ /* numeric or standard format date */ -+ ((?:\\d+[-/]\\d+[-/]\\d+)|(?:[a-zA-Z]+\\s+\\S+))\\s+ ++ ((?:\\d+[-/]\\d+[-/]\\d+)|(?:[a-zA-Z0-9]+\\s+\\S+))\\s+ /* year (for non-recent standard format) or time (for numeric or recent standard format Modified: commons/proper/net/branches/NET_2_0/src/test/java/org/apache/commons/net/ftp/parser/OS400FTPEntryParserTest.java URL: http://svn.apache.org/viewvc/commons/proper/net/branches/NET_2_0/src/test/java/org/apache/commons/net/ftp/parser/OS400FTPEntryParserTest.java?rev=757233r1=757232r2=757233view=diff == --- commons/proper/net/branches/NET_2_0/src/test/java/org/apache/commons/net/ftp/parser/OS400FTPEntryParserTest.java (original) +++ commons/proper/net/branches/NET_2_0/src/test/java/org/apache/commons/net/ftp/parser/OS400FTPEntryParserTest.java Sun Mar 22 18:46:16 2009 @@ -42,7 +42,6 @@ rwxr-x 1PEP 0 4019 Mar 18 18:58 einladung.zip, rwxr-x 1 PEP 0 xx422 Mar 24 14:06 readme, rwxr-x 1 PEP 0 8492 Apr 07 30:13 build.xml, -d---rwxr-x 2 PEP USR 0 45056 Mar 24 14:06 dir1, d---rwxr-x 2 PEP 0 45056Mar 24 14:06 zdir2 } };
svn commit: r757234 - /commons/proper/net/branches/NET_2_0/pom.xml
Author: rwinston Date: Sun Mar 22 18:49:03 2009 New Revision: 757234 URL: http://svn.apache.org/viewvc?rev=757234view=rev Log: Update pom version Modified: commons/proper/net/branches/NET_2_0/pom.xml 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=757234r1=757233r2=757234view=diff == --- commons/proper/net/branches/NET_2_0/pom.xml (original) +++ commons/proper/net/branches/NET_2_0/pom.xml Sun Mar 22 18:49:03 2009 @@ -27,7 +27,7 @@ modelVersion4.0.0/modelVersion groupIdcommons-net/groupId artifactIdcommons-net/artifactId - version2.0.1-SNAPSHOT/version + version2.1-SNAPSHOT/version nameCommons Net/name description A collection of network utilities and protocol implementations.
svn commit: r757259 - in /commons/proper/net/branches/NET_2_0/src: site/xdoc/changes.xml test/java/org/apache/commons/net/ftp/parser/UnixFTPEntryParserTest.java
Author: rwinston Date: Sun Mar 22 21:26:01 2009 New Revision: 757259 URL: http://svn.apache.org/viewvc?rev=757259view=rev Log: * Add changes container * Fix typo Modified: commons/proper/net/branches/NET_2_0/src/site/xdoc/changes.xml 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/site/xdoc/changes.xml URL: http://svn.apache.org/viewvc/commons/proper/net/branches/NET_2_0/src/site/xdoc/changes.xml?rev=757259r1=757258r2=757259view=diff == --- commons/proper/net/branches/NET_2_0/src/site/xdoc/changes.xml (original) +++ commons/proper/net/branches/NET_2_0/src/site/xdoc/changes.xml Sun Mar 22 21:26:01 2009 @@ -23,6 +23,9 @@ body + release version=2.1 description=Fix release + /release + release version=2.0 date=October 20, 2008 description=Java 5.0 release action dev=rwinston type=update Add null check in TelnetClient::disconnect(). 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=757259r1=757258r2=757259view=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 Sun Mar 22 21:26:01 2009 @@ -151,7 +151,7 @@ assertEquals(john smith, f.getUser()); } -public void testOwnerANdGroupNameWithSpaces() { +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());
svn commit: r756232 - 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/UnixFTPEntryParserTes
Author: rwinston Date: Thu Mar 19 22:00:45 2009 New Revision: 756232 URL: http://svn.apache.org/viewvc?rev=756232view=rev Log: NET-265: Fix edge case in group name parsing 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=756232r1=756231r2=756232view=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 Thu Mar 19 22:00:45 2009 @@ -88,12 +88,10 @@ + (?:(\\S+(?:\\s\\S+)*?)\\s+)?// owner name (optional spaces) + (?:(\\S+(?:\\s\\S+)*)\\s+)? // group name (optional spaces) + (\\d+(?:,\\s*\\d+)?)\\s+ - /* numeric or standard format date */ -+ ((?:\\d+[-/]\\d+[-/]\\d+)|(?:\\S+\\s+\\S+))\\s+ - ++ ((?:\\d+[-/]\\d+[-/]\\d+)|(?:[a-zA-Z]+\\s+\\S+))\\s+ /* year (for non-recent standard format) or time (for numeric or recent standard format 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=756232r1=756231r2=756232view=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 Thu Mar 19 22:00:45 2009 @@ -186,6 +186,26 @@ assertEquals(f.getGroup(), chrism); assertEquals(f.getHardLinkCount(), 1464); } + + public void testCorrectGroupNameParsing() { + FTPFile f = getParser().parseFTPEntry(-rw-r--r-- 1 ftpuser ftpusers 12414535 Mar 17 11:07 test 1999 abc.pdf); + assertNotNull(f); + assertEquals(f.getHardLinkCount(), 1); + assertEquals(f.getUser(), ftpuser); + assertEquals(f.getGroup(), ftpusers); + assertEquals(f.getSize(), 12414535); + assertEquals(f.getName(), test 1999 abc.pdf); + + + Calendar cal = Calendar.getInstance(); + cal.set(Calendar.MONTH, Calendar.MARCH); + cal.set(Calendar.DAY_OF_MONTH, 17); + cal.set(Calendar.HOUR_OF_DAY, 11); + cal.set(Calendar.MINUTE, 7); + cal.set(Calendar.SECOND, 0); + cal.set(Calendar.MILLISECOND, 0); + assertEquals(cal.getTime(), f.getTimestamp().getTime()); + } /** * @see org.apache.commons.net.ftp.parser.FTPParseTestFramework#testParseFieldsOnDirectory()