svn commit: r396292 - in /jakarta/commons/proper/net/trunk: project.xml src/java/org/apache/commons/net/telnet/TelnetInputStream.java xdocs/changes.xml
Author: dfs Date: Sun Apr 23 09:59:49 2006 New Revision: 396292 URL: http://svn.apache.org/viewcvs?rev=396292view=rev Log: Applied Rob Hasselbaum's (rhasselbaum at alumni.ithaca.edu) patch for PR 38688 fixing a TelnetInputStream hang. Modified: jakarta/commons/proper/net/trunk/project.xml jakarta/commons/proper/net/trunk/src/java/org/apache/commons/net/telnet/TelnetInputStream.java jakarta/commons/proper/net/trunk/xdocs/changes.xml Modified: jakarta/commons/proper/net/trunk/project.xml URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/net/trunk/project.xml?rev=396292r1=396291r2=396292view=diff == --- jakarta/commons/proper/net/trunk/project.xml (original) +++ jakarta/commons/proper/net/trunk/project.xml Sun Apr 23 09:59:49 2006 @@ -145,6 +145,10 @@ contributors contributor + nameRob Hasselbaum/name + emailrhasselbaum - alumni.ithaca.edu/email + /contributor + contributor nameMario Ivankovits/name email[EMAIL PROTECTED]/email /contributor Modified: jakarta/commons/proper/net/trunk/src/java/org/apache/commons/net/telnet/TelnetInputStream.java URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/net/trunk/src/java/org/apache/commons/net/telnet/TelnetInputStream.java?rev=396292r1=396291r2=396292view=diff == --- jakarta/commons/proper/net/trunk/src/java/org/apache/commons/net/telnet/TelnetInputStream.java (original) +++ jakarta/commons/proper/net/trunk/src/java/org/apache/commons/net/telnet/TelnetInputStream.java Sun Apr 23 09:59:49 2006 @@ -277,6 +277,8 @@ { while (__bytesAvailable = __queue.length - 1) { +// The queue is full. We need to wait before adding any more data to it. Hopefully the stream owner +// will consume some data soon! if(__threaded) { __queue.notify(); @@ -289,6 +291,12 @@ throw e; } } +else +{ +// We've been asked to add another character to the queue, but it is already full and there's +// no other thread to drain it. This should not have happened! +throw new IllegalStateException(Queue is full! Cannot process another character.); +} } // Need to do this in case we're not full, but block on a read @@ -389,8 +397,9 @@ return (-1); } } -while (super.available() 0); - +// Continue reading as long as there is data available and the queue is not full. +while (super.available() 0 __bytesAvailable __queue.length - 1); + __readIsWaiting = false; } continue; Modified: jakarta/commons/proper/net/trunk/xdocs/changes.xml URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/net/trunk/xdocs/changes.xml?rev=396292r1=396291r2=396292view=diff == --- jakarta/commons/proper/net/trunk/xdocs/changes.xml (original) +++ jakarta/commons/proper/net/trunk/xdocs/changes.xml Sun Apr 23 09:59:49 2006 @@ -23,6 +23,12 @@ body release version=1.4.x date= description= + action dev=dfs type=fix + Applied Rob Hasselbaum's + lt;rhasselbaum - alumni.ithaca.edugt; + patch for PR 38688 fixing a + TelnetInputStream hang. + /action action dev=dfs type=update Exposed control connection of FTP class via _controlInput_ and _controlOutput_ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r385170 - /jakarta/commons/proper/net/trunk/project.xml
Author: dfs Date: Sat Mar 11 13:13:32 2006 New Revision: 385170 URL: http://svn.apache.org/viewcvs?rev=385170view=rev Log: Updated affiliation. Modified: jakarta/commons/proper/net/trunk/project.xml Modified: jakarta/commons/proper/net/trunk/project.xml URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/net/trunk/project.xml?rev=385170r1=385169r2=385170view=diff == --- jakarta/commons/proper/net/trunk/project.xml (original) +++ jakarta/commons/proper/net/trunk/project.xml Sat Mar 11 13:13:32 2006 @@ -131,7 +131,9 @@ nameDaniel F. Savarese/name iddfs/id emaildfs - apache.org/email - organizationsavarese.org/organization + organization + lt;a href=http://www.savarese.com/gt;Savarese Software Researchlt;/agt; + /organization /developer developer nameRory Winston/name - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r373345 - /jakarta/commons/proper/net/trunk/src/java/org/apache/commons/net/ftp/FTPClient.java
Author: dfs Date: Sun Jan 29 12:12:22 2006 New Revision: 373345 URL: http://svn.apache.org/viewcvs?rev=373345view=rev Log: Simplified try/catch/rethrow to try/finally in _openDataConnection_ Modified: jakarta/commons/proper/net/trunk/src/java/org/apache/commons/net/ftp/FTPClient.java Modified: jakarta/commons/proper/net/trunk/src/java/org/apache/commons/net/ftp/FTPClient.java URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/net/trunk/src/java/org/apache/commons/net/ftp/FTPClient.java?rev=373345r1=373344r2=373345view=diff == --- jakarta/commons/proper/net/trunk/src/java/org/apache/commons/net/ftp/FTPClient.java (original) +++ jakarta/commons/proper/net/trunk/src/java/org/apache/commons/net/ftp/FTPClient.java Sun Jan 29 12:12:22 2006 @@ -500,12 +500,10 @@ if (__dataTimeout = 0) server.setSoTimeout(__dataTimeout); try { - socket = server.accept(); - } catch (IOException ioe) { - server.close(); - throw ioe; - } -server.close(); +socket = server.accept(); +} finally { +server.close(); +} } else { // We must be in PASSIVE_LOCAL_DATA_CONNECTION_MODE - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r370687 - /jakarta/commons/proper/net/trunk/src/java/org/apache/commons/net/ftp/FTP.java
Author: dfs Date: Thu Jan 19 17:22:14 2006 New Revision: 370687 URL: http://svn.apache.org/viewcvs?rev=370687view=rev Log: Made controlInput and controlOutput protected in response to issue #38309. Modified: jakarta/commons/proper/net/trunk/src/java/org/apache/commons/net/ftp/FTP.java Modified: jakarta/commons/proper/net/trunk/src/java/org/apache/commons/net/ftp/FTP.java URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/net/trunk/src/java/org/apache/commons/net/ftp/FTP.java?rev=370687r1=370686r2=370687view=diff == --- jakarta/commons/proper/net/trunk/src/java/org/apache/commons/net/ftp/FTP.java (original) +++ jakarta/commons/proper/net/trunk/src/java/org/apache/commons/net/ftp/FTP.java Thu Jan 19 17:22:14 2006 @@ -224,14 +224,30 @@ private StringBuffer __commandBuffer; -BufferedReader _controlInput; -BufferedWriter _controlOutput; int _replyCode; Vector _replyLines; boolean _newReplyString; String _replyString; String _controlEncoding; +/** + * Wraps SocketClient._input_ to facilitate the writing of text + * to the FTP control connection. Do not access the control + * connection via SocketClient._input_. This member starts + * with a null value, is initialized in [EMAIL PROTECTED] #_connectAction_}, + * and set to null in [EMAIL PROTECTED] #disconnect}. + */ +protected BufferedReader _controlInput_; + +/** + * Wraps SocketClient._output_ to facilitate the reading of text + * from the FTP control connection. Do not access the control + * connection via SocketClient._output_. This member starts + * with a null value, is initialized in [EMAIL PROTECTED] #_connectAction_}, + * and set to null in [EMAIL PROTECTED] #disconnect}. + */ +protected BufferedWriter _controlOutput_; + /*** * A ProtocolCommandSupport object used to manage the registering of * ProtocolCommandListeners and te firing of ProtocolCommandEvents. @@ -261,7 +277,7 @@ _newReplyString = true; _replyLines.setSize(0); -String line = _controlInput.readLine(); +String line = _controlInput_.readLine(); if (line == null) throw new FTPConnectionClosedException( @@ -292,7 +308,7 @@ { do { -line = _controlInput.readLine(); +line = _controlInput_.readLine(); if (line == null) throw new FTPConnectionClosedException( @@ -322,14 +338,17 @@ FTP response 421 received. Server closed connection.); } -// initiates control connections and gets initial reply +/** + * Initiates control connections and gets initial reply. + * Initializes [EMAIL PROTECTED] #_controlInput_} and [EMAIL PROTECTED] #_controlOutput_}. + */ protected void _connectAction_() throws IOException { super._connectAction_(); -_controlInput = +_controlInput_ = new BufferedReader(new InputStreamReader(getInputStream(), getControlEncoding())); -_controlOutput = +_controlOutput_ = new BufferedWriter(new OutputStreamWriter(getOutputStream(), getControlEncoding())); __getReply(); @@ -389,14 +408,15 @@ * some internal data so that the memory may be reclaimed by the * garbage collector. The reply text and code information from the * last command is voided so that the memory it used may be reclaimed. + * Also sets [EMAIL PROTECTED] #_controlInput_} and [EMAIL PROTECTED] #_controlOutput_} to null. * p * @exception IOException If an error occurs while disconnecting. ***/ public void disconnect() throws IOException { super.disconnect(); -_controlInput = null; -_controlOutput = null; +_controlInput_ = null; +_controlOutput_ = null; _replyLines.setSize(0); _newReplyString = false; _replyString = null; @@ -438,8 +458,8 @@ __commandBuffer.append(SocketClient.NETASCII_EOL); try{ - _controlOutput.write(message = __commandBuffer.toString()); -_controlOutput.flush(); + _controlOutput_.write(message = __commandBuffer.toString()); +_controlOutput_.flush(); } catch (SocketException e) { - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r370688 - /jakarta/commons/proper/net/trunk/xdocs/changes.xml
Author: dfs Date: Thu Jan 19 17:28:12 2006 New Revision: 370688 URL: http://svn.apache.org/viewcvs?rev=370688view=rev Log: Logged PR 38309 action. Modified: jakarta/commons/proper/net/trunk/xdocs/changes.xml Modified: jakarta/commons/proper/net/trunk/xdocs/changes.xml URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/net/trunk/xdocs/changes.xml?rev=370688r1=370687r2=370688view=diff == --- jakarta/commons/proper/net/trunk/xdocs/changes.xml (original) +++ jakarta/commons/proper/net/trunk/xdocs/changes.xml Thu Jan 19 17:28:12 2006 @@ -23,6 +23,13 @@ body release version=1.4.x date= description= + action dev=dfs type=update + Exposed control connection of FTP + class via _controlInput_ and _controlOutput_ + protected member variables in response + to PR 38309 reported by + lt;[EMAIL PROTECTED]gt;. + /action action dev=dfs type=fix Reverted PR 32859 patch to TFTPClient because it caused final packets to not - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r358867 - /jakarta/commons/proper/net/trunk/src/test/org/apache/commons/net/time/TimeTCPClientTest.java
Author: dfs Date: Fri Dec 23 13:22:50 2005 New Revision: 358867 URL: http://svn.apache.org/viewcvs?rev=358867view=rev Log: Test isConnected before disconnect. Modified: jakarta/commons/proper/net/trunk/src/test/org/apache/commons/net/time/TimeTCPClientTest.java Modified: jakarta/commons/proper/net/trunk/src/test/org/apache/commons/net/time/TimeTCPClientTest.java URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/net/trunk/src/test/org/apache/commons/net/time/TimeTCPClientTest.java?rev=358867r1=358866r2=358867view=diff == --- jakarta/commons/proper/net/trunk/src/test/org/apache/commons/net/time/TimeTCPClientTest.java (original) +++ jakarta/commons/proper/net/trunk/src/test/org/apache/commons/net/time/TimeTCPClientTest.java Fri Dec 23 13:22:50 2005 @@ -130,6 +130,7 @@ time = System.currentTimeMillis(); } finally { + if(client.isConnected()) client.disconnect(); } @@ -142,6 +143,7 @@ time2 = System.currentTimeMillis(); } finally { + if(client.isConnected()) client.disconnect(); } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r219461 - /jakarta/commons/proper/net/trunk/src/java/org/apache/commons/net/ftp/FTP.java
Author: dfs Date: Mon Jul 18 03:18:09 2005 New Revision: 219461 URL: http://svn.apache.org/viewcvs?rev=219461view=rev Log: TYPE B was being sent for EBCDIC_FILE_TYPE instead of TYPE E. Applied patch from Niklas Gustavsson niklas at protocol7.com correcting behavior. Modified: jakarta/commons/proper/net/trunk/src/java/org/apache/commons/net/ftp/FTP.java Modified: jakarta/commons/proper/net/trunk/src/java/org/apache/commons/net/ftp/FTP.java URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/net/trunk/src/java/org/apache/commons/net/ftp/FTP.java?rev=219461r1=219460r2=219461view=diff == --- jakarta/commons/proper/net/trunk/src/java/org/apache/commons/net/ftp/FTP.java (original) +++ jakarta/commons/proper/net/trunk/src/java/org/apache/commons/net/ftp/FTP.java Mon Jul 18 03:18:09 2005 @@ -220,7 +220,7 @@ * with [EMAIL PROTECTED] #setControlEncoding setControlEncoding}. */ public static final String DEFAULT_CONTROL_ENCODING = ISO-8859-1; -private static final String __modes = ABILNTCFRPSBC; +private static final String __modes = AEILNTCFRPSBC; private StringBuffer __commandBuffer; - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r202269 - /jakarta/commons/proper/net/trunk/xdocs/changes.xml
Author: dfs Date: Tue Jun 28 12:09:21 2005 New Revision: 202269 URL: http://svn.apache.org/viewcvs?rev=202269view=rev Log: Noted reversion of issue 32859 from 2005-05-27. Modified: jakarta/commons/proper/net/trunk/xdocs/changes.xml Modified: jakarta/commons/proper/net/trunk/xdocs/changes.xml URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/net/trunk/xdocs/changes.xml?rev=202269r1=202268r2=202269view=diff == --- jakarta/commons/proper/net/trunk/xdocs/changes.xml (original) +++ jakarta/commons/proper/net/trunk/xdocs/changes.xml Tue Jun 28 12:09:21 2005 @@ -22,6 +22,13 @@ body + release version=1.4.x date= description= + action dev=dfs type=fix + Reverted PR 32859 patch to TFTPClient + because it caused final packets to not + be sent. + /action + /release release version=1.4.0 date=May 7, 2005 description=Some additions and enhancements action dev=dfs type=fix Fixed typo in method name. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r178726 - /jakarta/commons/proper/net/trunk/src/java/org/apache/commons/net/tftp/TFTPClient.java
Author: dfs Date: Thu May 26 19:00:13 2005 New Revision: 178726 URL: http://svn.apache.org/viewcvs?rev=178726view=rev Log: Backed out change made in r161466 in response to issue #32859, effectively reverting to r155429. The patch from the issue reporter has no effect other than to break TFTPClient.sendFile by removing a final packet send. If a corrected patch and verifying test case are submitted the change can be reapplied. Modified: jakarta/commons/proper/net/trunk/src/java/org/apache/commons/net/tftp/TFTPClient.java Modified: jakarta/commons/proper/net/trunk/src/java/org/apache/commons/net/tftp/TFTPClient.java URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/net/trunk/src/java/org/apache/commons/net/tftp/TFTPClient.java?rev=178726r1=178725r2=178726view=diff == --- jakarta/commons/proper/net/trunk/src/java/org/apache/commons/net/tftp/TFTPClient.java (original) +++ jakarta/commons/proper/net/trunk/src/java/org/apache/commons/net/tftp/TFTPClient.java Thu May 26 19:00:13 2005 @@ -372,7 +372,6 @@ dataLength = lastBlock = hostPort = bytesRead = 0; block = 0; -boolean lastAckWait = false; if (mode == TFTP.ASCII_MODE) input = new ToNetASCIIInputStream(input); @@ -456,10 +455,7 @@ if (lastBlock == block) { ++block; -if (lastAckWait) - break _sendPacket; -else - break _receivePacket; +break _receivePacket; } else { @@ -505,8 +501,9 @@ data.setData(_sendBuffer, 4, offset - 4); sent = data; } -while (dataLength == 0 || lastAckWait); +while (dataLength == 0); +bufferedSend(sent); endBufferedOps(); } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r167953 - /jakarta/commons/proper/net/trunk/src/test/org/apache/commons/net/ftp/ListingFunctionalTest.java
Author: dfs Date: Tue May 3 11:29:42 2005 New Revision: 167953 URL: http://svn.apache.org/viewcvs?rev=167953view=rev Log: Made test use passive mode so it will work behind firewalls. Modified: jakarta/commons/proper/net/trunk/src/test/org/apache/commons/net/ftp/ListingFunctionalTest.java Modified: jakarta/commons/proper/net/trunk/src/test/org/apache/commons/net/ftp/ListingFunctionalTest.java URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/net/trunk/src/test/org/apache/commons/net/ftp/ListingFunctionalTest.java?rev=167953r1=167952r2=167953view=diff == --- jakarta/commons/proper/net/trunk/src/test/org/apache/commons/net/ftp/ListingFunctionalTest.java (original) +++ jakarta/commons/proper/net/trunk/src/test/org/apache/commons/net/ftp/ListingFunctionalTest.java Tue May 3 11:29:42 2005 @@ -151,6 +151,7 @@ client = new FTPClient(); client.connect(hostName); client.login(anonymous, anonymous); +client.enterLocalPassiveMode(); } /* - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r158647 - jakarta/commons/proper/net/trunk/src/java/org/apache/commons/net/pop3/POP3.java
Author: dfs Date: Tue Mar 22 11:42:24 2005 New Revision: 158647 URL: http://svn.apache.org/viewcvs?view=revrev=158647 Log: Fixed problem reported by Dave Cee sammy_c at lineone.net as bug id 34133. Notification to ProtocolCommandListener was being performed prior to storing reply, producing an empty reply string. Modified: jakarta/commons/proper/net/trunk/src/java/org/apache/commons/net/pop3/POP3.java Modified: jakarta/commons/proper/net/trunk/src/java/org/apache/commons/net/pop3/POP3.java URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/net/trunk/src/java/org/apache/commons/net/pop3/POP3.java?view=diffr1=158646r2=158647 == --- jakarta/commons/proper/net/trunk/src/java/org/apache/commons/net/pop3/POP3.java (original) +++ jakarta/commons/proper/net/trunk/src/java/org/apache/commons/net/pop3/POP3.java Tue Mar 22 11:42:24 2005 @@ -124,11 +124,11 @@ MalformedServerReplyException( Received invalid POP3 protocol response from server.); -if (_commandSupport_.getListenerCount() 0) -_commandSupport_.fireReplyReceived(_replyCode, getReplyString()); - _replyLines.addElement(line); _lastReplyLine = line; + +if (_commandSupport_.getListenerCount() 0) +_commandSupport_.fireReplyReceived(_replyCode, getReplyString()); } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r153114 - in jakarta/commons/proper/net/trunk: src/java/org/apache/commons/net/ftp/FTP.java xdocs/changes.xml
Author: dfs Date: Wed Feb 9 12:21:16 2005 New Revision: 153114 URL: http://svn.apache.org/viewcvs?view=revrev=153114 Log: Fixed typo in method name. FTP.removeCommandListener was missing the L. Problem reported by [EMAIL PROTECTED] Modified: jakarta/commons/proper/net/trunk/src/java/org/apache/commons/net/ftp/FTP.java jakarta/commons/proper/net/trunk/xdocs/changes.xml Modified: jakarta/commons/proper/net/trunk/src/java/org/apache/commons/net/ftp/FTP.java URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/net/trunk/src/java/org/apache/commons/net/ftp/FTP.java?view=diffr1=153113r2=153114 == --- jakarta/commons/proper/net/trunk/src/java/org/apache/commons/net/ftp/FTP.java (original) +++ jakarta/commons/proper/net/trunk/src/java/org/apache/commons/net/ftp/FTP.java Wed Feb 9 12:21:16 2005 @@ -374,7 +374,7 @@ * p * @param listener The ProtocolCommandListener to remove. ***/ -public void removeProtocolCommandistener(ProtocolCommandListener listener) +public void removeProtocolCommandListener(ProtocolCommandListener listener) { _commandSupport_.removeProtocolCommandListener(listener); } Modified: jakarta/commons/proper/net/trunk/xdocs/changes.xml URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/net/trunk/xdocs/changes.xml?view=diffr1=153113r2=153114 == --- jakarta/commons/proper/net/trunk/xdocs/changes.xml (original) +++ jakarta/commons/proper/net/trunk/xdocs/changes.xml Wed Feb 9 12:21:16 2005 @@ -21,6 +21,15 @@ /properties body + release version=1.3.x date=February 9, 2005 + description=fixes + action dev=dfs type=fix + Fixed typo in method name. + FTP.removeCommandListener was missing + the L. Problem reported by + [EMAIL PROTECTED] + /action +/release release version=1.3.0 date=December 15, 2004 description=many fixes and enhancements action dev=rwinston type=fix Applied patch for PR 31793. Thanks to lt;[EMAIL PROTECTED]gt; - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-commons/net/src/java/org/apache/commons/net/ftp FTPClient.java
dfs 2004/11/23 11:51:43 Modified:net/src/java/org/apache/commons/net/ftp FTPClient.java Log: Added a comment to compromise for http://issues.apache.org/bugzilla/show_bug.cgi?id=31918. Revision ChangesPath 1.44 +2 -2 jakarta-commons/net/src/java/org/apache/commons/net/ftp/FTPClient.java Index: FTPClient.java === RCS file: /home/cvs/jakarta-commons/net/src/java/org/apache/commons/net/ftp/FTPClient.java,v retrieving revision 1.43 retrieving revision 1.44 diff -u -r1.43 -r1.44 --- FTPClient.java23 Nov 2004 12:34:28 - 1.43 +++ FTPClient.java23 Nov 2004 19:51:43 - 1.44 @@ -62,7 +62,8 @@ *System.err.println(FTP server refused connection.); *System.exit(1); * } - * ftp.disconnect(); + * ... // transfer files + * ftp.disconnect(); *} catch(IOException e) { * if(ftp.isConnected()) { *try { @@ -71,7 +72,6 @@ * // do nothing *} * } - * System.err.println(Could not connect to server.); * e.printStackTrace(); * System.exit(1); *} - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-commons/net/src/java/org/apache/commons/net/ftp FTPClient.java
dfs 2004/11/23 11:57:12 Modified:net/src/java/org/apache/commons/net/ftp FTPClient.java Log: Updated connection example in javadoc to mirror more closely what is done in examples/ftp.java. Revision ChangesPath 1.45 +8 -5 jakarta-commons/net/src/java/org/apache/commons/net/ftp/FTPClient.java Index: FTPClient.java === RCS file: /home/cvs/jakarta-commons/net/src/java/org/apache/commons/net/ftp/FTPClient.java,v retrieving revision 1.44 retrieving revision 1.45 diff -u -r1.44 -r1.45 --- FTPClient.java23 Nov 2004 19:51:43 - 1.44 +++ FTPClient.java23 Nov 2004 19:57:12 - 1.45 @@ -47,6 +47,7 @@ * Then you need to check the FTP reply code to see if the connection * was successful. For example: * pre + *boolean error = false; *try { * int reply; * ftp.connect(ftp.foobar.com); @@ -62,18 +63,20 @@ *System.err.println(FTP server refused connection.); *System.exit(1); * } - * ... // transfer files - * ftp.disconnect(); + * ... // transfer files + * ftp.logout(); *} catch(IOException e) { + * error = true; + * e.printStackTrace(); + *} finally { * if(ftp.isConnected()) { *try { * ftp.disconnect(); - *} catch(IOException f) { + *} catch(IOException ioe) { * // do nothing *} * } - * e.printStackTrace(); - * System.exit(1); + * System.exit(error ? 1 : 0); *} * /pre * p - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-commons/net/src/java/org/apache/commons/net/smtp SMTP.java
dfs 2004/10/05 10:40:25 Modified:net/src/java/examples mail.java net/src/java/org/apache/commons/net ProtocolCommandSupport.java net/src/java/org/apache/commons/net/ftp FTP.java net/src/java/org/apache/commons/net/pop3 POP3.java POP3Client.java net/src/java/org/apache/commons/net/smtp SMTP.java Log: I changed all variables named 'enum' to 'en' to enable compilation under JDK 1.5, where enum is a reserved word. This issue was brought to light by http://issues.apache.org/bugzilla/show_bug.cgi?id=31516. After making the changes, I built the source from scratch using JDK 1.5 and it compiled without errors. Revision ChangesPath 1.9 +4 -4 jakarta-commons/net/src/java/examples/mail.java Index: mail.java === RCS file: /home/cvs/jakarta-commons/net/src/java/examples/mail.java,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- mail.java 29 Feb 2004 10:26:53 - 1.8 +++ mail.java 5 Oct 2004 17:40:24 - 1.9 @@ -48,7 +48,7 @@ Writer writer; SimpleSMTPHeader header; SMTPClient client; -Enumeration enum; +Enumeration en; if (args.length 1) { @@ -127,10 +127,10 @@ client.setSender(sender); client.addRecipient(recipient); -enum = ccList.elements(); +en = ccList.elements(); -while (enum.hasMoreElements()) -client.addRecipient((String)enum.nextElement()); +while (en.hasMoreElements()) +client.addRecipient((String)en.nextElement()); writer = client.sendMessageData(); 1.8 +8 -8 jakarta-commons/net/src/java/org/apache/commons/net/ProtocolCommandSupport.java Index: ProtocolCommandSupport.java === RCS file: /home/cvs/jakarta-commons/net/src/java/org/apache/commons/net/ProtocolCommandSupport.java,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- ProtocolCommandSupport.java 29 Jun 2004 04:54:30 - 1.7 +++ ProtocolCommandSupport.java 5 Oct 2004 17:40:24 - 1.8 @@ -62,17 +62,17 @@ ***/ public void fireCommandSent(String command, String message) { -Enumeration enum; +Enumeration en; ProtocolCommandEvent event; ProtocolCommandListener listener; -enum = __listeners.getListeners(); +en = __listeners.getListeners(); event = new ProtocolCommandEvent(__source, command, message); -while (enum.hasMoreElements()) +while (en.hasMoreElements()) { -listener = (ProtocolCommandListener)enum.nextElement(); +listener = (ProtocolCommandListener)en.nextElement(); listener.protocolCommandSent(event); } } @@ -92,17 +92,17 @@ ***/ public void fireReplyReceived(int replyCode, String message) { -Enumeration enum; +Enumeration en; ProtocolCommandEvent event; ProtocolCommandListener listener; -enum = __listeners.getListeners(); +en = __listeners.getListeners(); event = new ProtocolCommandEvent(__source, replyCode, message); -while (enum.hasMoreElements()) +while (en.hasMoreElements()) { -listener = (ProtocolCommandListener)enum.nextElement(); +listener = (ProtocolCommandListener)en.nextElement(); listener.protocolReplyReceived(event); } } 1.17 +4 -4 jakarta-commons/net/src/java/org/apache/commons/net/ftp/FTP.java Index: FTP.java === RCS file: /home/cvs/jakarta-commons/net/src/java/org/apache/commons/net/ftp/FTP.java,v retrieving revision 1.16 retrieving revision 1.17 diff -u -r1.16 -r1.17 --- FTP.java 8 Aug 2004 20:38:35 - 1.16 +++ FTP.java 5 Oct 2004 17:40:24 - 1.17 @@ -580,17 +580,17 @@ ***/ public String getReplyString() { -Enumeration enum; +Enumeration en; StringBuffer buffer; if (!_newReplyString) return _replyString; buffer = new StringBuffer(256); -enum = _replyLines.elements(); -while (enum.hasMoreElements()) +en = _replyLines.elements(); +while (en.hasMoreElements()) { -buffer.append((String)enum.nextElement()); +buffer.append((String)en.nextElement()); buffer.append
cvs commit: jakarta-commons/net/xdocs faq.xml
dfs 2004/10/03 13:36:03 Modified:net/xdocs faq.xml Log: Updated FAQ link to point to new Wiki. Revision ChangesPath 1.3 +1 -1 jakarta-commons/net/xdocs/faq.xml Index: faq.xml === RCS file: /home/cvs/jakarta-commons/net/xdocs/faq.xml,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- faq.xml 29 Feb 2004 10:27:29 - 1.2 +++ faq.xml 3 Oct 2004 20:36:03 - 1.3 @@ -33,7 +33,7 @@ before posting to the mailing lists. /p p -a href=http://nagoya.apache.org/wiki/apachewiki.cgi?CommonsNet/FrequentlyAskedQuestions;CommonsNet/FrequentlyAskedQuestions/a +a href=http://wiki.apache.org/jakarta-commons/Net/FrequentlyAskedQuestions;CommonsNet/FrequentlyAskedQuestions/a /p /section /body - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-commons/net/src/java/org/apache/commons/net/telnet TelnetClient.java TelnetInputStream.java
dfs 2004/09/23 22:03:01 Modified:net/src/java/org/apache/commons/net/telnet TelnetClient.java TelnetInputStream.java Log: Applied fix for issue http://issues.apache.org/bugzilla/show_bug.cgi?id=31272 reported by Mark Johnson [EMAIL PROTECTED]. The TelnetClient class has a setReaderThread that inhibits the starting of the TelnetInputStream instance. However TelnetInputStream creates a thread in its constructor, which caused a resource leak when readerThread was set to false. I applied the suggested changes which prevent the thread from being created unless explicitly requested. Revision ChangesPath 1.13 +1 -1 jakarta-commons/net/src/java/org/apache/commons/net/telnet/TelnetClient.java Index: TelnetClient.java === RCS file: /home/cvs/jakarta-commons/net/src/java/org/apache/commons/net/telnet/TelnetClient.java,v retrieving revision 1.12 retrieving revision 1.13 diff -u -r1.12 -r1.13 --- TelnetClient.java 29 Jun 2004 04:54:31 - 1.12 +++ TelnetClient.java 24 Sep 2004 05:03:01 - 1.13 @@ -98,7 +98,7 @@ input = _input_; -tmp = new TelnetInputStream(input, this); +tmp = new TelnetInputStream(input, this, readerThread); if(readerThread) { tmp._start(); 1.12 +16 -5 jakarta-commons/net/src/java/org/apache/commons/net/telnet/TelnetInputStream.java Index: TelnetInputStream.java === RCS file: /home/cvs/jakarta-commons/net/src/java/org/apache/commons/net/telnet/TelnetInputStream.java,v retrieving revision 1.11 retrieving revision 1.12 diff -u -r1.11 -r1.12 --- TelnetInputStream.java29 Feb 2004 10:26:55 - 1.11 +++ TelnetInputStream.java24 Sep 2004 05:03:01 - 1.12 @@ -50,10 +50,10 @@ private int __suboption_count = 0; /* TERMINAL-TYPE option (end)*/ -private boolean _ayt_flag = false; +private boolean __threaded; -private boolean __threaded = false; -TelnetInputStream(InputStream input, TelnetClient client) +TelnetInputStream(InputStream input, TelnetClient client, + boolean readerThread) { super(input); __client = client; @@ -69,11 +69,22 @@ __bytesAvailable = 0; __ioException = null; __readIsWaiting = false; -__thread = new Thread(this); +__threaded = false; +if(__threaded) +__thread = new Thread(this); +else +__thread = null; +} + +TelnetInputStream(InputStream input, TelnetClient client) { +this(input, client, true); } void _start() { +if(__thread == null) +return; + int priority; __isClosed = false; // Need to set a higher priority in case JVM does not use pre-emptive @@ -495,7 +506,7 @@ __hasReachedEOF = true; __isClosed = true; -if (__thread.isAlive()) +if (__thread != null __thread.isAlive()) { __thread.interrupt(); } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-commons/net/src/java/org/apache/commons/net/io Util.java
dfs 2004/09/20 16:24:46 Modified:net/src/java/org/apache/commons/net/io Util.java Log: Added missing if(flush) test. Revision ChangesPath 1.13 +2 -1 jakarta-commons/net/src/java/org/apache/commons/net/io/Util.java Index: Util.java === RCS file: /home/cvs/jakarta-commons/net/src/java/org/apache/commons/net/io/Util.java,v retrieving revision 1.12 retrieving revision 1.13 diff -u -r1.12 -r1.13 --- Util.java 8 Sep 2004 17:14:46 - 1.12 +++ Util.java 20 Sep 2004 23:24:46 - 1.13 @@ -115,7 +115,8 @@ } dest.write(buffer, 0, bytes); -dest.flush(); +if(flush) + dest.flush(); total += bytes; if (listener != null) listener.bytesTransferred(total, bytes, streamSize); - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-commons/net/src/java/org/apache/commons/net/io Util.java
dfs 2004/09/08 10:14:46 Modified:net/src/java/org/apache/commons/net/ftp FTPClient.java net/src/java/org/apache/commons/net/io Util.java Log: Added a version of io.Util.copyStream that lets you specify whether or not to flush the output stream. Changed FTPClient retrieveFile and __storeFile to not flush. Revision ChangesPath 1.39 +7 -2 jakarta-commons/net/src/java/org/apache/commons/net/ftp/FTPClient.java Index: FTPClient.java === RCS file: /home/cvs/jakarta-commons/net/src/java/org/apache/commons/net/ftp/FTPClient.java,v retrieving revision 1.38 retrieving revision 1.39 diff -u -r1.38 -r1.39 --- FTPClient.java29 Jun 2004 04:54:30 - 1.38 +++ FTPClient.java8 Sep 2004 17:14:46 - 1.39 @@ -25,6 +25,7 @@ import java.net.ServerSocket; import java.net.Socket; import java.util.Vector; +import org.apache.commons.net.io.CopyStreamEvent; import org.apache.commons.net.io.FromNetASCIIInputStream; import org.apache.commons.net.io.ToNetASCIIOutputStream; import org.apache.commons.net.io.Util; @@ -370,7 +371,9 @@ // Treat everything else as binary for now try { -Util.copyStream(local, output); +Util.copyStream(local, output, Util.DEFAULT_COPY_BUFFER_SIZE, +CopyStreamEvent.UNKNOWN_STREAM_SIZE, null, +false); } catch (IOException e) { @@ -1266,7 +1269,9 @@ // Treat everything else as binary for now try { -Util.copyStream(input, local); +Util.copyStream(input, local, Util.DEFAULT_COPY_BUFFER_SIZE, +CopyStreamEvent.UNKNOWN_STREAM_SIZE, null, +false); } catch (IOException e) { 1.12 +49 -2 jakarta-commons/net/src/java/org/apache/commons/net/io/Util.java Index: Util.java === RCS file: /home/cvs/jakarta-commons/net/src/java/org/apache/commons/net/io/Util.java,v retrieving revision 1.11 retrieving revision 1.12 diff -u -r1.11 -r1.12 --- Util.java 29 Jun 2004 04:54:31 - 1.11 +++ Util.java 8 Sep 2004 17:14:46 - 1.12 @@ -67,6 +67,10 @@ * Should be set to CopyStreamEvent.UNKNOWN_STREAM_SIZE if unknown. * @param listener The CopyStreamListener to notify of progress. If * this parameter is null, notification is not attempted. + * @param flush Whether to flush the output stream after every + *write. This is necessary for interactive sessions that rely on + *buffered streams. If you don't flush, the data will stay in + *the stream buffer. * @exception CopyStreamException If an error occurs while reading from the *source or writing to the destination. The CopyStreamException *will contain the number of bytes confirmed to have been @@ -78,7 +82,8 @@ ***/ public static final long copyStream(InputStream source, OutputStream dest, int bufferSize, long streamSize, -CopyStreamListener listener) +CopyStreamListener listener, +boolean flush) throws CopyStreamException { int bytes; @@ -101,7 +106,8 @@ if (bytes 0) break; dest.write(bytes); -dest.flush(); +if(flush) + dest.flush(); ++total; if (listener != null) listener.bytesTransferred(total, 1, streamSize); @@ -122,6 +128,47 @@ } return total; +} + + +/*** + * Copies the contents of an InputStream to an OutputStream using a + * copy buffer of a given size and notifies the provided + * CopyStreamListener of the progress of the copy operation by calling + * its bytesTransferred(long, int) method after each write to the + * destination. If you wish to notify more than one listener you should + * use a CopyStreamAdapter as the listener and register the additional + * listeners with the CopyStreamAdapter. + * p + * The contents of the InputStream are + * read until the end of the stream is reached, but neither the + * source nor the destination are closed. You must do this yourself + * outside of the method call. The number of bytes read/written is + * returned. + * p + * @param source
cvs commit: jakarta-commons/net/src/java/org/apache/commons/net/ftp FTP.java
dfs 2004/08/08 12:50:48 Modified:net/src/java/org/apache/commons/net/ftp FTP.java Log: Added a means to set the character encoding used by the control connection. As reported by Ash, Michael L Michael.Ash at ca.com, some FTP servers require other encodings. Renamed __DEFAULT_ENCODING to DEFAULT_CONTROL_ENCODING and made it public. Added a _controlEncoding member variable and public setter and getter methods. Initialized control connection in _connectAction_ with the value returned by getControlEncoding(). Revision ChangesPath 1.15 +42 -3 jakarta-commons/net/src/java/org/apache/commons/net/ftp/FTP.java Index: FTP.java === RCS file: /home/cvs/jakarta-commons/net/src/java/org/apache/commons/net/ftp/FTP.java,v retrieving revision 1.14 retrieving revision 1.15 diff -u -r1.14 -r1.15 --- FTP.java 29 Jun 2004 04:54:30 - 1.14 +++ FTP.java 8 Aug 2004 19:50:48 - 1.15 @@ -207,7 +207,14 @@ // We have to ensure that the protocol communication is in ASCII // but we use ISO-8859-1 just in case 8-bit characters cross // the wire. -private static final String __DEFAULT_ENCODING = ISO-8859-1; +/** + * The default character encoding used for communicating over an + * FTP control connection. The default encoding is an + * ASCII-compatible encoding. Some FTP servers expect other + * encodings. You can change the encoding used by an FTP instance + * with [EMAIL PROTECTED] setControlEncoding}. + */ +public static final String DEFAULT_CONTROL_ENCODING = ISO-8859-1; private static final String __modes = ABILNTCFRPSBC; private StringBuffer __commandBuffer; @@ -218,6 +225,7 @@ Vector _replyLines; boolean _newReplyString; String _replyString; +String _controlEncoding; /*** * A ProtocolCommandSupport object used to manage the registering of @@ -238,6 +246,7 @@ _newReplyString = false; _replyString = null; _commandSupport_ = new ProtocolCommandSupport(this); +_controlEncoding = DEFAULT_CONTROL_ENCODING; } private void __getReply() throws IOException @@ -314,10 +323,10 @@ super._connectAction_(); _controlInput = new BufferedReader(new InputStreamReader(getInputStream(), - __DEFAULT_ENCODING)); + getControlEncoding())); _controlOutput = new BufferedWriter(new OutputStreamWriter(getOutputStream(), - __DEFAULT_ENCODING)); + getControlEncoding())); __getReply(); // If we received code 120, we have to fetch completion reply. if (FTPReply.isPositivePreliminary(_replyCode)) @@ -325,6 +334,28 @@ } +/** + * Sets the character encoding used by the FTP control connection. + * Some FTP servers require that commands be issued in a non-ASCII + * encoding like UTF-8 so that filenames with multi-byte character + * representations (e.g, Big 8) can be specified. + * + * @param encoding The new character encoding for the control connection. + */ +public void setControlEncoding(String encoding) { +_controlEncoding = encoding; +} + + +/** + * @return The character encoding used to communicate over the + * control connection. + */ +public String getControlEncoding() { +return _controlEncoding; +} + + /*** * Adds a ProtocolCommandListener. Delegates this task to * [EMAIL PROTECTED] #_commandSupport_ _commandSupport_ }. @@ -1382,3 +1413,11 @@ } } + +/* Emacs configuration + * Local variables:** + * mode: java ** + * c-basic-offset: 4 ** + * indent-tabs-mode: nil ** + * End:** + */ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-commons/net/xdocs changes.xml
dfs 2004/07/27 22:01:47 Modified:net/src/java/org/apache/commons/net/ftp/parser EnterpriseUnixFTPEntryParser.java NTFTPEntryParser.java OS2FTPEntryParser.java OS400FTPEntryParser.java UnixFTPEntryParser.java VMSFTPEntryParser.java net/xdocs changes.xml Log: Fixed regression from migration to new parsers. Most of the new parsers parsed the file size as an integer instead of a long. Changed all of them to set the size to long. This problem was detected by the reporter of: http://issues.apache.org/bugzilla/show_bug.cgi?id=30345 Affected files: EnterpriseUnixFTPEntryParser.java NTFTPEntryParser.java OS2FTPEntryParser.java OS400FTPEntryParser.java UnixFTPEntryParser.java VMSFTPEntryParser.java PR: 30345 Submitted by: [EMAIL PROTECTED] (Kurt Kessel) Revision ChangesPath 1.12 +2 -2 jakarta-commons/net/src/java/org/apache/commons/net/ftp/parser/EnterpriseUnixFTPEntryParser.java Index: EnterpriseUnixFTPEntryParser.java === RCS file: /home/cvs/jakarta-commons/net/src/java/org/apache/commons/net/ftp/parser/EnterpriseUnixFTPEntryParser.java,v retrieving revision 1.11 retrieving revision 1.12 diff -u -r1.11 -r1.12 --- EnterpriseUnixFTPEntryParser.java 21 Apr 2004 23:30:33 - 1.11 +++ EnterpriseUnixFTPEntryParser.java 28 Jul 2004 05:01:47 - 1.12 @@ -101,7 +101,7 @@ file.setGroup(grp); try { -file.setSize(Integer.parseInt(filesize)); +file.setSize(Long.parseLong(filesize)); } catch (NumberFormatException e) { 1.17 +2 -2 jakarta-commons/net/src/java/org/apache/commons/net/ftp/parser/NTFTPEntryParser.java Index: NTFTPEntryParser.java === RCS file: /home/cvs/jakarta-commons/net/src/java/org/apache/commons/net/ftp/parser/NTFTPEntryParser.java,v retrieving revision 1.16 retrieving revision 1.17 diff -u -r1.16 -r1.17 --- NTFTPEntryParser.java 4 May 2004 22:44:05 - 1.16 +++ NTFTPEntryParser.java 28 Jul 2004 05:01:47 - 1.17 @@ -142,7 +142,7 @@ f.setType(FTPFile.FILE_TYPE); if (null != size) { -f.setSize(new Integer(size).intValue()); + f.setSize(Long.parseLong(size)); } } return (f); 1.12 +2 -4 jakarta-commons/net/src/java/org/apache/commons/net/ftp/parser/OS2FTPEntryParser.java Index: OS2FTPEntryParser.java === RCS file: /home/cvs/jakarta-commons/net/src/java/org/apache/commons/net/ftp/parser/OS2FTPEntryParser.java,v retrieving revision 1.11 retrieving revision 1.12 diff -u -r1.11 -r1.12 --- OS2FTPEntryParser.java21 Apr 2004 23:30:33 - 1.11 +++ OS2FTPEntryParser.java28 Jul 2004 05:01:47 - 1.12 @@ -123,9 +123,7 @@ f.setName(name.trim()); //set the size -Long theSize = new Long(size.trim()); -theSize = new Long(String.valueOf(theSize.intValue())); -f.setSize(theSize.longValue()); +f.setSize(Long.parseLong(size.trim())); return (f); } 1.4 +2 -2 jakarta-commons/net/src/java/org/apache/commons/net/ftp/parser/OS400FTPEntryParser.java Index: OS400FTPEntryParser.java === RCS file: /home/cvs/jakarta-commons/net/src/java/org/apache/commons/net/ftp/parser/OS400FTPEntryParser.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- OS400FTPEntryParser.java 22 Apr 2004 00:48:07 - 1.3 +++ OS400FTPEntryParser.java 28 Jul 2004 05:01:47 - 1.4 @@ -77,7 +77,7 @@ try { -file.setSize(Integer.parseInt(filesize)); +file.setSize(Long.parseLong(filesize)); } catch (NumberFormatException e) { 1.18 +2 -2 jakarta-commons/net/src/java/org/apache/commons/net/ftp/parser/UnixFTPEntryParser.java Index: UnixFTPEntryParser.java === RCS file: /home/cvs/jakarta-commons/net/src/java/org/apache/commons/net/ftp/parser/UnixFTPEntryParser.java,v retrieving revision 1.17 retrieving revision 1.18 diff -u -r1.17 -r1.18 --- UnixFTPEntryParser.java 22 Jun 2004 02:30:33 - 1.17 +++ UnixFTPEntryParser.java 28 Jul 2004 05:01:47 - 1.18
cvs commit: jakarta-commons/net/src/java/examples ftp.java
dfs 2004/07/01 10:44:54 Modified:net/src/java/examples ftp.java Log: Added missing closing of input and output streams. Don't know if at a previous point in time storeFile and retrieveFile closed the streams, but they certainly don't appear to now. Revision ChangesPath 1.11 +9 -3 jakarta-commons/net/src/java/examples/ftp.java Index: ftp.java === RCS file: /home/cvs/jakarta-commons/net/src/java/examples/ftp.java,v retrieving revision 1.10 retrieving revision 1.11 diff -u -r1.10 -r1.11 --- ftp.java 22 Apr 2004 00:48:07 - 1.10 +++ ftp.java 1 Jul 2004 17:44:54 - 1.11 @@ -128,23 +128,29 @@ if (binaryTransfer) ftp.setFileType(FTP.BINARY_FILE_TYPE); -// Use passive mode as default because most of us are -// behind firewalls these days. -ftp.enterLocalPassiveMode(); +// 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); + ftp.retrieveFile(remote, output); + +output.close(); } ftp.logout(); - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-commons/net/src/java/org/apache/commons/net/tftp TFTP.java TFTPAckPacket.java TFTPClient.java TFTPDataPacket.java TFTPErrorPacket.java TFTPPacket.java TFTPPacketException.java TFTPReadRequestPacket.java TFTPRequestPacket.java TFTPWriteRequestPacket.java
dfs 2004/06/28 19:16:34 Modified:net/proposal/ftp2/src/java/org/apache/commons/net/ftp/ftp2 FTPFileEntryParser.java net/src/java/org/apache/commons/net CharGenTCPClient.java CharGenUDPClient.java DatagramSocketClient.java DaytimeTCPClient.java DaytimeUDPClient.java DefaultSocketFactory.java DiscardTCPClient.java DiscardUDPClient.java EchoTCPClient.java EchoUDPClient.java ProtocolCommandListener.java SocketClient.java SocketFactory.java TimeTCPClient.java TimeUDPClient.java net/src/java/org/apache/commons/net/bsd RCommandClient.java RExecClient.java RLoginClient.java net/src/java/org/apache/commons/net/ftp DefaultFTPFileListParser.java FTP.java FTPClient.java FTPCommand.java FTPFileEntryParser.java FTPFileListParser.java net/src/java/org/apache/commons/net/io FromNetASCIIOutputStream.java Util.java net/src/java/org/apache/commons/net/nntp NNTP.java NNTPClient.java net/src/java/org/apache/commons/net/pop3 POP3.java POP3Client.java net/src/java/org/apache/commons/net/smtp SMTP.java SMTPClient.java SMTPCommand.java net/src/java/org/apache/commons/net/telnet TelnetClient.java net/src/java/org/apache/commons/net/tftp TFTP.java TFTPAckPacket.java TFTPClient.java TFTPDataPacket.java TFTPErrorPacket.java TFTPPacket.java TFTPPacketException.java TFTPReadRequestPacket.java TFTPRequestPacket.java TFTPWriteRequestPacket.java Log: What I tried to do was replace the references to straight up files with [EMAIL PROTECTED] classname} or [EMAIL PROTECTED] classname#member} and references to in file anchors with [EMAIL PROTECTED] #member}. But there were quite a number of classname.html#_top_ references and I replaced those with [EMAIL PROTECTED] classname}. So I ended up running the following: find -name *.java | xargs perl -pi -e 's/a\s+href=([^]+)\.html(?:#_top_)?[^]+\/a/[EMAIL PROTECTED] $1}/g; s/a\s+href=([^]+)\.html(#[^]+)([^]+)\/a/[EMAIL PROTECTED] $1$2 $3}/g; s/a\s+href=(#[^]+)([^]+)\/a/[EMAIL PROTECTED] $1 $2}/g' I doublechecked that everything still compiled fine and that 'maven javadoc' didn't choke. javadoc spouted warnings because there were typos in the some of the links (e.g., sendComand instead of sendCommand). So I fixed those with: find -name *.java | xargs perl -pi -e 's/Comand/Command/g' find -name *.java | xargs perl -pi -e 's/recieve/receive/g' There were some mistaken references to sendMessage which should have been sendMessageData in SMTPClient, so I fixed those similarly. Lastly, FTPClient had a reference to Package-packagename.html which were translated into @link Package-packagename, so I trimmed off the Package-, leaving [EMAIL PROTECTED] org.apache.commons.net.io}, which javadoc complained about with: warning - Tag @link: reference not found: org.apache.commons.net.io This is supposed to work, so I left it alone because the only damage done to the docs is that the package name is printed without a hyperlink. There are still a bunch of .html links that span across two javadoc lines and I'll fix those next, but wanted to report on the initial fixes and check them in. Revision ChangesPath 1.9 +2 -2 jakarta-commons/net/proposal/ftp2/src/java/org/apache/commons/net/ftp/ftp2/FTPFileEntryParser.java http://cvs.apache.org/viewcvs/jakarta-commons/net/proposal/ftp2/src/java/org/apache/commons/net/ftp/ftp2/FTPFileEntryParser.java.diff?r1=1.8r2=1.9 1.8 +4 -4 jakarta-commons/net/src/java/org/apache/commons/net/CharGenTCPClient.java http://cvs.apache.org/viewcvs/jakarta-commons/net/src/java/org/apache/commons/net/CharGenTCPClient.java.diff?r1=1.7r2=1.8 1.7 +4 -4 jakarta-commons/net/src/java/org/apache/commons/net/CharGenUDPClient.java http://cvs.apache.org/viewcvs/jakarta-commons/net/src/java/org/apache/commons/net/CharGenUDPClient.java.diff?r1=1.6r2=1.7 1.8 +9 -9 jakarta-commons/net/src/java/org/apache/commons/net/DatagramSocketClient.java http://cvs.apache.org/viewcvs/jakarta-commons/net/src/java/org/apache/commons/net/DatagramSocketClient.java.diff?r1=1.7r2=1.8 1.8 +5 -5 jakarta-commons/net/src/java/org/apache/commons/net/DaytimeTCPClient.java http://cvs.apache.org/viewcvs/jakarta-commons/net/src/java/org/apache/commons/net
cvs commit: jakarta-commons/net/src/test/org/apache/commons/net/telnet InvalidTelnetOptionExceptionTest.java TelnetClientFunctionalTest.java TelnetClientTest.java TelnetOptionHandlerTestAbstract.java TelnetOptionTest.java TelnetTestResponder.java TelnetTestSimpleServer.java
dfs 2004/06/28 21:54:32 Modified:net/proposal/ftp2/src/java/org/apache/commons/net/ftp/ftp2 FTPClient2.java FTPFileEntryParser.java FTPFileIterator.java FTPFileList.java net/proposal/ftp2/src/java/org/apache/commons/net/ftp/ftp2/parser AIXFTPEntryParser.java EnterpriseUnixFTPEntryParser.java MatchApparatus.java NTFTPEntryParser.java OS2FTPEntryParser.java UnixFTPEntryParser.java VMSFTPEntryParser.java net/proposal/ftp2/src/test/org/apache/commons/net/ftp/ftp2/parser EnterpriseUnixFTPEntryParserTest.java FTPParseTestFramework.java NTFTPEntryParserTest.java OS2FTPEntryParserTest.java UnixFTPEntryParserTest.java VMSFTPEntryParserTest.java net/src/java/org/apache/commons/net CharGenTCPClient.java CharGenUDPClient.java DatagramSocketClient.java DatagramSocketFactory.java DaytimeTCPClient.java DaytimeUDPClient.java DefaultDatagramSocketFactory.java DefaultSocketFactory.java DiscardTCPClient.java DiscardUDPClient.java EchoTCPClient.java EchoUDPClient.java FingerClient.java MalformedServerReplyException.java ProtocolCommandEvent.java ProtocolCommandListener.java ProtocolCommandSupport.java SocketClient.java SocketFactory.java TimeTCPClient.java TimeUDPClient.java WhoisClient.java net/src/java/org/apache/commons/net/bsd RCommandClient.java RExecClient.java RLoginClient.java net/src/java/org/apache/commons/net/ftp FTP.java FTPClient.java FTPConnectionClosedException.java FTPFile.java net/src/java/org/apache/commons/net/ftp/parser RegexFTPFileEntryParserImpl.java VMSVersioningFTPEntryParser.java net/src/java/org/apache/commons/net/io CopyStreamAdapter.java CopyStreamEvent.java CopyStreamException.java CopyStreamListener.java DotTerminatedMessageReader.java DotTerminatedMessageWriter.java FromNetASCIIInputStream.java FromNetASCIIOutputStream.java SocketInputStream.java SocketOutputStream.java ToNetASCIIInputStream.java ToNetASCIIOutputStream.java Util.java net/src/java/org/apache/commons/net/nntp NNTP.java NNTPClient.java NNTPConnectionClosedException.java NewGroupsOrNewsQuery.java NewsgroupInfo.java net/src/java/org/apache/commons/net/pop3 POP3.java POP3Client.java net/src/java/org/apache/commons/net/smtp RelayPath.java SMTP.java SMTPClient.java SMTPConnectionClosedException.java net/src/java/org/apache/commons/net/telnet Telnet.java TelnetClient.java TelnetOutputStream.java net/src/java/org/apache/commons/net/tftp TFTP.java TFTPAckPacket.java TFTPClient.java TFTPDataPacket.java TFTPErrorPacket.java TFTPPacket.java TFTPReadRequestPacket.java TFTPRequestPacket.java TFTPWriteRequestPacket.java net/src/java/org/apache/commons/net/util ListenerList.java net/src/test/org/apache/commons/net/ftp/parser EnterpriseUnixFTPEntryParserTest.java OS2FTPEntryParserTest.java UnixFTPEntryParserTest.java VMSFTPEntryParserTest.java net/src/test/org/apache/commons/net/telnet InvalidTelnetOptionExceptionTest.java TelnetClientFunctionalTest.java TelnetClientTest.java TelnetOptionHandlerTestAbstract.java TelnetOptionTest.java TelnetTestResponder.java TelnetTestSimpleServer.java Log: Corrected remaining bad javadoc links that pointed to JDK 1.1 javadoc html files. For posterity, the following kluge handled the multiline case: for i in $(find -name *.java); do perl -e '@foo = ; $foo = join(, @foo); $foo =~ s/a\s+href=([^]+)\.html(?:#_top_)?(\s*\*\s*)[^]+\/a/[EMAIL PROTECTED
cvs commit: jakarta-commons/net/src/java/org/apache/commons/net/bsd RCommandClient.java
dfs 2004/06/28 21:56:31 Modified:net/src/java/org/apache/commons/net/bsd RCommandClient.java Log: Fixed typo. Revision ChangesPath 1.13 +1 -1 jakarta-commons/net/src/java/org/apache/commons/net/bsd/RCommandClient.java Index: RCommandClient.java === RCS file: /home/cvs/jakarta-commons/net/src/java/org/apache/commons/net/bsd/RCommandClient.java,v retrieving revision 1.12 retrieving revision 1.13 diff -u -r1.12 -r1.13 --- RCommandClient.java 29 Jun 2004 04:54:30 - 1.12 +++ RCommandClient.java 29 Jun 2004 04:56:31 - 1.13 @@ -74,7 +74,7 @@ * parameter of [EMAIL PROTECTED] #rcommand rcommand() } to code true /code. * The standard input of the remote process can be written to through * the output stream returned by - * [EMAIL PROTECTED] org.apache.commons.net.bsd.RExecClient#getOutputStream getOutputSream() } + * [EMAIL PROTECTED] org.apache.commons.net.bsd.RExecClient#getOutputStream getOutputStream() } * . * p * p - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-commons/jelly/jelly-tags/swing/src/java/org/apache/commons/jelly/tags/swing SwingTagLibrary.java
dfs 2004/06/04 18:29:16 Modified:jellyproject.xml jelly/jelly-tags/swing/src/java/org/apache/commons/jelly/tags/swing SwingTagLibrary.java Log: The component/ tag was not registered in SwingTagLibrary but was listed in the documentation as being a JellySwing tag. I had a need to use the tag and took the liberty of adding the registration of the tag in the SwingTagLibrary constructor. After verifying it worked properly, I'm committing the change and adding myself to the project developers list in project.xml. The convention for unit testing JellySwing tags was non-obvious to me, so I did not add a test at this time. Revision ChangesPath 1.141 +5 -0 jakarta-commons/jelly/project.xml Index: project.xml === RCS file: /home/cvs/jakarta-commons/jelly/project.xml,v retrieving revision 1.140 retrieving revision 1.141 diff -u -r1.140 -r1.141 --- project.xml 24 May 2004 21:39:35 - 1.140 +++ project.xml 5 Jun 2004 01:29:15 - 1.141 @@ -158,6 +158,11 @@ idrdonkin/id email[EMAIL PROTECTED]/email /developer +developer + nameDaniel F. Savarese/name + iddfs/id + emaildfs - apache.org/email +/developer /developers contributors 1.23 +1 -0 jakarta-commons/jelly/jelly-tags/swing/src/java/org/apache/commons/jelly/tags/swing/SwingTagLibrary.java Index: SwingTagLibrary.java === RCS file: /home/cvs/jakarta-commons/jelly/jelly-tags/swing/src/java/org/apache/commons/jelly/tags/swing/SwingTagLibrary.java,v retrieving revision 1.22 retrieving revision 1.23 diff -u -r1.22 -r1.23 --- SwingTagLibrary.java 25 Feb 2004 01:31:56 - 1.22 +++ SwingTagLibrary.java 5 Jun 2004 01:29:16 - 1.23 @@ -66,6 +66,7 @@ public SwingTagLibrary() { registerTag( action, ActionTag.class ); +registerTag( component, ComponentTag.class ); registerTag( font, FontTag.class ); registerTag( windowListener, WindowListenerTag.class ); registerTag( focusListener, FocusListenerTag.class ); - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-commons/jelly/src/java/org/apache/commons/jelly/tags/core GetStaticTag.java CoreTagLibrary.java
dfs 2004/06/04 19:23:41 Modified:jelly/src/java/org/apache/commons/jelly/tags/core CoreTagLibrary.java Added: jelly/src/java/org/apache/commons/jelly/tags/core GetStaticTag.java Log: In the thread on commons-dev starting at: http://www.mail-archive.com/[EMAIL PROTECTED]/msg41386.html we discussed the addition to Jelly of the ability to retrieve the values of static fields. The participants of the discussion agreed that the functionality was desirable as a core feature. However, it was also pointed out that perhaps Jexl is the right place for this functionality to exist. Given the immediate utility of the functionality and the general agreement that it would be okay to add a new core tag to fulfill the need, I have added a GetStaticTag class that implements a getStatic/ tag to retrieve static fields in classes, modeled along the ines of invokeStatic/. Revision ChangesPath 1.30 +2 -1 jakarta-commons/jelly/src/java/org/apache/commons/jelly/tags/core/CoreTagLibrary.java Index: CoreTagLibrary.java === RCS file: /home/cvs/jakarta-commons/jelly/src/java/org/apache/commons/jelly/tags/core/CoreTagLibrary.java,v retrieving revision 1.29 retrieving revision 1.30 diff -u -r1.29 -r1.30 --- CoreTagLibrary.java 24 Feb 2004 14:10:38 - 1.29 +++ CoreTagLibrary.java 5 Jun 2004 02:23:41 - 1.30 @@ -53,6 +53,7 @@ registerTag(break, BreakTag.class); registerTag(expr, ExprTag.class); registerTag(file, FileTag.class); +registerTag(getStatic, GetStaticTag.class); registerTag(invoke, InvokeTag.class); registerTag(invokeStatic, InvokeStaticTag.class); registerTag(new, NewTag.class); 1.1 jakarta-commons/jelly/src/java/org/apache/commons/jelly/tags/core/GetStaticTag.java Index: GetStaticTag.java === /* * Copyright 2002,2004 The Apache Software Foundation. * * Licensed 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.jelly.tags.core; import org.apache.commons.jelly.JellyContext; import org.apache.commons.jelly.JellyTagException; import org.apache.commons.jelly.MissingAttributeException; import org.apache.commons.jelly.TagSupport; import org.apache.commons.jelly.XMLOutput; /** * A tag which can retrieve the value of a static field of a given class. * The following attributes are required:br / * ul * livar - The variable to which to assign the resulting value./li * lifield - The name of the static field to retrieve./li * liclassName - The name of the class containing the static field./li * /ul * * Example usage: * pre * lt;j:getStatic var=closeOperation className=javax.swing.JFrame * field=EXIT_ON_CLOSE/gt; * /pre * * @version $Revision: 1.1 $ */ public class GetStaticTag extends TagSupport { /** The variable to which to assign the resulting value. */ private String var; /** The name of the static field to retrieve. */ private String field; /** The name of the class containing the static field. */ private String className; /** * Sets the name of the variable exported by this tag. * * @param var The variable name. */ public void setVar(String var) { this.var = var; } /** * Sets the name of the field to retrieve. * * @param method The method name */ public void setField(String field) { this.field = field; } /** * Sets the fully qualified name of the class containing the static field. * * @param className The name of the class. */ public void setClassName(String className) { this.className = className; } // Tag interface // public void doTag(XMLOutput output) throws JellyTagException { String message = null; if(var == null) message = var; else if(field == null) message = field; else
cvs commit: jakarta-commons/jelly/src/test/org/apache/commons/jelly/core testGetStaticTag.jelly TestGetStaticTag.java
dfs 2004/06/04 20:23:37 Added: jelly/src/test/org/apache/commons/jelly/core testGetStaticTag.jelly TestGetStaticTag.java Log: Added a simple test for GetStaticTag, modeled after the tests for InvokeStaticTag. Revision ChangesPath 1.1 jakarta-commons/jelly/src/test/org/apache/commons/jelly/core/testGetStaticTag.jelly Index: testGetStaticTag.jelly === !-- Copyright 2002,2004 The Apache Software Foundation. Licensed 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. -- j:jelly xmlns:j=jelly:core j:if test=${test.Integer.MAX_VALUE} j:getStatic var=value className=java.lang.Integer field=MAX_VALUE/ /j:if j:if test=${test.InvalidGet} j:getStatic var=value className=java.lang.Integer field=FOOBAR/ /j:if /j:jelly 1.1 jakarta-commons/jelly/src/test/org/apache/commons/jelly/core/TestGetStaticTag.java Index: TestGetStaticTag.java === /* * Copyright 2002,2004 The Apache Software Foundation. * * Licensed 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.jelly.core; import junit.framework.TestSuite; import org.apache.commons.jelly.Script; import org.apache.commons.jelly.JellyTagException; /** * @version $Revision: 1.1 $ */ public class TestGetStaticTag extends BaseJellyTest { public TestGetStaticTag(String name) { super(name); } public static TestSuite suite() throws Exception { return new TestSuite(TestGetStaticTag.class); } /** * Retrieves Integer.MAX_VALUE using tag and verifies against direct * access. */ public void testGetIntegerMaxValue() throws Exception { setUpScript( testGetStaticTag.jelly ); Script script = getJelly().compileScript(); getJellyContext().setVariable( test.Integer.MAX_VALUE, Boolean.TRUE ); script.run( getJellyContext(), getXMLOutput() ); assertEquals( new Integer(java.lang.Integer.MAX_VALUE), getJellyContext().getVariable(value ) ); } /** * Retrieves a non-existent field and verifies exception is thrown. */ public void testInvalidGet() throws Exception { setUpScript( testGetStaticTag.jelly ); Script script = getJelly().compileScript(); getJellyContext().setVariable( test.InvalidGet, Boolean.TRUE ); try { script.run( getJellyContext(), getXMLOutput() ); } catch(JellyTagException jte) { return; } fail(JellyTagException not thrown.); } } /* Emacs configuration * Local variables:** * mode: java ** * c-basic-offset: 4 ** * indent-tabs-mode: nil ** * End:** */ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-commons/net/src/java/org/apache/commons/net/nntp NNTPClient.java
dfs 2004/04/11 17:46:26 Modified:net/src/java/org/apache/commons/net/nntp NNTPClient.java Log: Changed a 'new Integer(int).toString()' call to 'Integer.toString(int)', using a static method instead of creating a new object.. Revision ChangesPath 1.11 +3 -2 jakarta-commons/net/src/java/org/apache/commons/net/nntp/NNTPClient.java Index: NNTPClient.java === RCS file: /home/cvs/jakarta-commons/net/src/java/org/apache/commons/net/nntp/NNTPClient.java,v retrieving revision 1.10 retrieving revision 1.11 diff -u -r1.10 -r1.11 --- NNTPClient.java 10 Apr 2004 21:11:48 - 1.10 +++ NNTPClient.java 12 Apr 2004 00:46:26 - 1.11 @@ -1193,7 +1193,7 @@ */ public Reader retrieveArticleInfo(int articleNumber) throws IOException { -return __retrieveArticleInfo(new Integer(articleNumber).toString()); +return __retrieveArticleInfo(Integer.toString(articleNumber)); } /** @@ -1243,7 +1243,8 @@ * @return a DotTerminatedReader if successful, null otherwise * @throws IOException */ -public Reader retrieveHeader(String header, int articleNumber) throws IOException +public Reader retrieveHeader(String header, int articleNumber) +throws IOException { return __retrieveHeader(header, Integer.toString(articleNumber)); } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-commons/net/src/java/org/apache/commons/net/nntp NNTP.java NNTPClient.java NNTPCommand.java
dfs 2004/04/10 14:11:48 Modified:net/src/java/org/apache/commons/net/nntp NNTP.java NNTPClient.java NNTPCommand.java Log: Applied Ted Wise's patch from issue report 24078 which added XHDR support to NNTPClient. Revision ChangesPath 1.11 +37 -5 jakarta-commons/net/src/java/org/apache/commons/net/nntp/NNTP.java Index: NNTP.java === RCS file: /home/cvs/jakarta-commons/net/src/java/org/apache/commons/net/nntp/NNTP.java,v retrieving revision 1.10 retrieving revision 1.11 diff -u -r1.10 -r1.11 --- NNTP.java 29 Feb 2004 10:26:53 - 1.10 +++ NNTP.java 10 Apr 2004 21:11:48 - 1.11 @@ -13,7 +13,8 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.commons.net.nntp; +package org.apache.commons.net.nntp; + import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.IOException; @@ -70,6 +71,8 @@ * p * p * @author Daniel F. Savarese + * @author Rory Winston + * @author Ted Wise * @see NNTPClient * @see NNTPConnectionClosedException * @see org.apache.commons.net.MalformedServerReplyException @@ -922,7 +925,7 @@ * p * @param password a valid password. * @return The reply code received from the server. The server should - * return a 281 or 502 for this command. + * return a 281 or 502 for this command. * @exception NNTPConnectionClosedException * If the NNTP server prematurely closes the connection as a result * of the client being idle or some other reason causing the server @@ -935,7 +938,7 @@ String passParameter = PASS + password; return sendCommand(NNTPCommand.AUTHINFO, passParameter); } - + /*** * A convenience method to send the NNTP XOVER command to the server, * receive the reply, and return the reply code. @@ -959,7 +962,36 @@ public int xover(String selectedArticles) throws IOException { return sendCommand(NNTPCommand.XOVER, selectedArticles); } - + +/*** + * A convenience method to send the NNTP XHDR command to the server, + * receive the reply, and return the reply code. + * p + * @param header a String naming a header line (e.g., subject). See + * RFC-1036 for a list of valid header lines. + * @param selectedArticles a String representation of the range of + * article headers required. This may be an article number, or a + * range of article numbers in the form -, where + * and are valid article numbers in the current group. It + * also may be of the form XXX-, meaning return XXX and all + * following articles In this revision, the last format is not + * possible (yet). + * @return The reply code received from the server. + * @exception NNTPConnectionClosedException + * If the NNTP server prematurely closes the connection as a result + * of the client being idle or some other reason causing the server + * to send NNTP reply code 400. 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 xhdr(String header, String selectedArticles) throws IOException { +StringBuffer command = new StringBuffer(header); +command.append( ); +command.append(selectedArticles); +return sendCommand(NNTPCommand.XHDR, command.toString()); +} + /** * A convenience wrapper for the extended LIST command that takes * an argument, allowing us to selectively list multiple groups. @@ -973,7 +1005,7 @@ StringBuffer command = new StringBuffer(ACTIVE ); command.append(wildmat); return sendCommand(NNTPCommand.LIST, command.toString()); -} +} } /* Emacs configuration 1.10 +64 -7 jakarta-commons/net/src/java/org/apache/commons/net/nntp/NNTPClient.java Index: NNTPClient.java === RCS file: /home/cvs/jakarta-commons/net/src/java/org/apache/commons/net/nntp/NNTPClient.java,v retrieving revision 1.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- NNTPClient.java 29 Feb 2004 10:26:53 - 1.9 +++ NNTPClient.java 10 Apr 2004 21:11:48 - 1.10 @@ -13,7 +13,8 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package
cvs commit: jakarta-commons/net/xdocs changes.xml
dfs 2004/04/10 14:12:14 Modified:net/xdocs changes.xml Log: Applied Ted Wise's patch from issue report 24078 which added XHDR support to NNTPClient. Revision ChangesPath 1.21 +5 -0 jakarta-commons/net/xdocs/changes.xml Index: changes.xml === RCS file: /home/cvs/jakarta-commons/net/xdocs/changes.xml,v retrieving revision 1.20 retrieving revision 1.21 diff -u -r1.20 -r1.21 --- changes.xml 29 Feb 2004 10:27:29 - 1.20 +++ changes.xml 10 Apr 2004 21:12:14 - 1.21 @@ -22,6 +22,11 @@ body release version=1.2.0-dev date=In CVS + action dev=dfs type=add +Ted Wise lt;[EMAIL PROTECTED]gt; provided a +a href=http://issues.apache.org/bugzilla/show_bug.cgi?id=24078; +patche/a to add the XHDR extended NNTP command. + /action action dev=scohen,dfs type=update Deprecated FTPFileListParser interface, DefaultFTPFileListParser class, and the FTPClient.listFiles methods that accepted an - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-commons/net project.xml
dfs 2004/04/10 14:12:34 Modified:net project.xml Log: Added Rory Winston and Ted Wise to list of contributors. Revision ChangesPath 1.44 +8 -0 jakarta-commons/net/project.xml Index: project.xml === RCS file: /home/cvs/jakarta-commons/net/project.xml,v retrieving revision 1.43 retrieving revision 1.44 diff -u -r1.43 -r1.44 --- project.xml 9 Apr 2004 19:58:07 - 1.43 +++ project.xml 10 Apr 2004 21:12:34 - 1.44 @@ -119,6 +119,14 @@ email[EMAIL PROTECTED]/email organizationQuad/Graphics, Inc./organization /contributor + contributor + nameRory Winston/name + email[EMAIL PROTECTED]/email +/contributor + contributor + nameTed Wise/name + email[EMAIL PROTECTED]/email +/contributor /contributors dependencies - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-commons/net project.xml
dfs 2004/04/10 14:20:21 Modified:net project.xml Log: Added Mario Ivankovits to list of contributors since he appears to have been working with Steve and Jeff on FTP list parsing code/design. Revision ChangesPath 1.45 +4 -0 jakarta-commons/net/project.xml Index: project.xml === RCS file: /home/cvs/jakarta-commons/net/project.xml,v retrieving revision 1.44 retrieving revision 1.45 diff -u -r1.44 -r1.45 --- project.xml 10 Apr 2004 21:12:34 - 1.44 +++ project.xml 10 Apr 2004 21:20:21 - 1.45 @@ -110,6 +110,10 @@ /developers contributors + contributor + nameMario Ivankovits/name + email[EMAIL PROTECTED]/email +/contributor contributor nameTapan Karecha/name email[EMAIL PROTECTED]/email - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-commons/net/xdocs index.xml
dfs 2004/03/30 16:37:30 Modified:net/xdocs index.xml Log: Reordered protocol list with most popular protocols at top. Revision ChangesPath 1.4 +8 -7 jakarta-commons/net/xdocs/index.xml Index: index.xml === RCS file: /home/cvs/jakarta-commons/net/xdocs/index.xml,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- index.xml 30 Mar 2004 16:04:57 - 1.3 +++ index.xml 31 Mar 2004 00:37:30 - 1.4 @@ -43,17 +43,18 @@ p Supported protocols are: ul - liFinger/li - liWhois/li - liTFTP/li - liTelnet/li - liPOP3/li liFTP/li liNNTP/li liSMTP/li - liTime/li + liPOP3/li + liTelnet/li + liTFTP/li + liFinger/li + liWhois/li + lirlogin, BSD R commands/li + liTime (rdate) and Daytime/li liEcho/li - liBSD R command support/li + liDiscard/li /ul /p /section - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-commons/net/xdocs index.xml
dfs 2004/03/30 16:39:34 Modified:net/xdocs index.xml Log: Corrected last commit. Replaced BSD R command support with names of actual commands. Revision ChangesPath 1.5 +1 -1 jakarta-commons/net/xdocs/index.xml Index: index.xml === RCS file: /home/cvs/jakarta-commons/net/xdocs/index.xml,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- index.xml 31 Mar 2004 00:37:30 - 1.4 +++ index.xml 31 Mar 2004 00:39:34 - 1.5 @@ -51,7 +51,7 @@ liTFTP/li liFinger/li liWhois/li - lirlogin, BSD R commands/li + lirexec/rcmd/rlogin/li liTime (rdate) and Daytime/li liEcho/li liDiscard/li - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-commons/net/src/java/org/apache/commons/net/ftp/parser VMSFTPEntryParser.java
dfs 2004/01/09 01:07:03 Modified:net/src/java/org/apache/commons/net/ftp FTPClient.java FTPFileEntryParser.java FTPFileIterator.java FTPFileList.java FTPFileListParserImpl.java net/src/java/org/apache/commons/net/ftp/parser VMSFTPEntryParser.java Added: net/src/java/org/apache/commons/net/ftp DefaultFTPFileIterator.java DefaultFTPFileList.java Log: Made FTPFileList and FTPFileIterator abstract. Moved implementations into DefaultFTPFileList and DefaultFTPFileIterator. Added createFTPFileList method (the name is not fixed in stone and should probably change) in FTPFileEntryParser to take over role of FTPFilelist.create. These changes were made to allow customization of file list handling by entry parseres. Finally, changed VMSFTPEntryParser to return an FTPFileList that filters out duplicates. Revision ChangesPath 1.25 +1 -1 jakarta-commons/net/src/java/org/apache/commons/net/ftp/FTPClient.java Index: FTPClient.java === RCS file: /home/cvs/jakarta-commons/net/src/java/org/apache/commons/net/ftp/FTPClient.java,v retrieving revision 1.24 retrieving revision 1.25 diff -u -r1.24 -r1.25 --- FTPClient.java6 Jan 2004 19:02:02 - 1.24 +++ FTPClient.java9 Jan 2004 09:07:03 - 1.25 @@ -2334,7 +2334,7 @@ } FTPFileList list = -FTPFileList.create(socket.getInputStream(), parser); +parser.createFTPFileList(socket.getInputStream()); socket.close(); 1.12 +26 -1 jakarta-commons/net/src/java/org/apache/commons/net/ftp/FTPFileEntryParser.java Index: FTPFileEntryParser.java === RCS file: /home/cvs/jakarta-commons/net/src/java/org/apache/commons/net/ftp/FTPFileEntryParser.java,v retrieving revision 1.11 retrieving revision 1.12 diff -u -r1.11 -r1.12 --- FTPFileEntryParser.java 6 Jan 2004 22:24:24 - 1.11 +++ FTPFileEntryParser.java 9 Jan 2004 09:07:03 - 1.12 @@ -161,4 +161,29 @@ * @exception IOException thrown on any IO Error reading from the reader. */ String readNextEntry(BufferedReader reader) throws IOException; + +/** + * Creates an codeFTPFileList/code object from a stream containing + * a file listing. + * + * @param stream The input stream created by reading the socket on which + * the output of the LIST command was returned + * + * @return the codeFTPFileList/code created. + * Will be null if the listing cannot be read from the stream. + * @exception IOException + * Thrown on any failure to read from the stream. + */ +public FTPFileList createFTPFileList(InputStream stream) +throws IOException; + } + + +/* Emacs configuration + * Local variables:** + * mode: java ** + * c-basic-offset: 4 ** + * indent-tabs-mode: nil ** + * End:** + */ 1.7 +18 -225 jakarta-commons/net/src/java/org/apache/commons/net/ftp/FTPFileIterator.java Index: FTPFileIterator.java === RCS file: /home/cvs/jakarta-commons/net/src/java/org/apache/commons/net/ftp/FTPFileIterator.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- FTPFileIterator.java 2 Jan 2004 03:39:04 - 1.6 +++ FTPFileIterator.java 9 Jan 2004 09:07:03 - 1.7 @@ -68,134 +68,16 @@ * @see org.apache.commons.net.ftp.FTPFileList * @see org.apache.commons.net.ftp.FTPFileEntryParser */ -public class FTPFileIterator +public abstract class FTPFileIterator { /** - * a vector of strings, each representing a possibly valid ftp file - * entry - */ -private Vector rawlines; - -/** - * the parser to which this iterator delegates its parsing duties - */ -private FTPFileEntryParser parser; - -/** - * constant shorthand for the situation where the raw listing has not - * yet been scanned - */ -private static final int UNINIT = -1; - -/** - * constant shorthand for the situation where the raw listing has been - * scanned and found to have no valid entry. - */ -private static final int DIREMPTY = -2; - -/** - * this iterator's current position within coderawlines/code. - */ -private int itemptr = 0; - -/** - * number within coderawlines/code of the first valid file entry. - */ -private int firstGoodEntry = UNINIT; - -/** - * Package-private
cvs commit: jakarta-commons/net/xdocs changes.xml
dfs 2004/01/08 13:28:26 Modified:net/xdocs changes.xml Log: Added entries for recent changes (scohen removal of JDK 1.1 incompatibilities for v1.1.1, scohen's addition of FTPFileEntryParserFactory and entry parser autodetection, scohen/dfs deprecation of FTPFileListParser, DefaultFTPFileListParser and dependent methods). Revision ChangesPath 1.18 +25 -0 jakarta-commons/net/xdocs/changes.xml Index: changes.xml === RCS file: /home/cvs/jakarta-commons/net/xdocs/changes.xml,v retrieving revision 1.17 retrieving revision 1.18 diff -u -r1.17 -r1.18 --- changes.xml 23 Oct 2003 03:58:27 - 1.17 +++ changes.xml 8 Jan 2004 21:28:26 - 1.18 @@ -7,8 +7,33 @@ body release version=1.2.0-dev date=In CVS + action dev=scohen,dfs type=update +Deprecated FTPFileListParser interface, DefaultFTPFileListParser +class, and the FTPClient.listFiles methods that accepted an +FTPFileListParser parameter. These deprecated classes and methods +will be removed in version 2.0. + /action + action dev=scohen type=add +Added org.apache.commons.net.parser.FTPFileEntryParserFactory +interface and a default implementation: +DefaultFTPFileEntryParserFactory. This addition facilitates the +autodetection of which FTPFileEntryParser to use to generate +listings. FTPClient.listFiles methods were added that implement +autodetection. + /action +/release +release version=1.1.1 date=TBD + action dev=scohen type=fix +Removed all JDK 1.1 incompatibilities that had been introduced +unintentionally in previous versions. Release 1.1.1 is the last +JDK 1.1 compatible release. Any future 1.1.x maintenance releases +will remain JDK !.1 compatible, but version 1.2 may break +compatibility and will be guaranteed to work with only J2SE 1.2 +and later. + /action /release release version=1.1.0 date=October 23, 2003 + /action action dev=dfs type=add Rory Winston lt;[EMAIL PROTECTED]gt; provided patches to add the following extended NNTP commands to - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-commons/net/src/java/org/apache/commons/net/telnet TelnetInputStream.java
dfs 2004/01/08 22:19:23 Modified:net/src/java/org/apache/commons/net/telnet TelnetInputStream.java Log: Jeff Barrett [EMAIL PROTECTED] reports that: I'm using commons-net to ftp a bunch of files around every night as a batch process. It probably copies just under 1g. Over the course of that process I'll often get 2 or 3 thrown exceptions like so: [java] java.lang.NullPointerException [java]at java.io.BufferedInputStream.read(BufferedInputStream.java:279) [java]at java.io.BufferedInputStream.fill(BufferedInputStream.java:183) [java]at java.io.BufferedInputStream.read(BufferedInputStream.java:201) [java]at org.apache.commons.net.telnet.TelnetInputStream.__read(TelnetInputStream.java:140) [java]at org.apache.commons.net.telnet.TelnetInputStream.run(TelnetInputStream.java:464) [java]at java.lang.Thread.run(Thread.java:536) Since we didn't open a Bugzilla report, I'm recording my email explanation as a log message: That's all happening in BufferedInputStream. Looking at the code for BufferedInputStream in J2SE 1.4.2, it looks like the NullPointerException exception is happening at a call of in.available(). in is set to null in close(). So it seems there may be a situation whereby a read by TelnetInputStream.__read is being performed after a close. Looking at the code, I'm pretty sure there's a problem. TelnetInputStream calls super.close() BEFORE entering a synchronized block. There's a race condition that could allow the reader thread to start a read after BufferedInputStream.close() is called. The reason it hardly ever happns is that BufferedInputStream calls an ensureOpen() method at the beginning of read() that checks to make sure in is not null. However, between that call and the call to in.available(), the value may become null because BufferdInputStream.close() is not a synchronized method, unlike BufferedInputStream.read(). Now, there's a comment in the code before the close call that I'm guilty of that says: // Completely disregard the fact thread may still be running. // We can't afford to block on this close by waiting for // thread to terminate because few if any JVM's will actually // interrupt a system read() from the interrupt() method. This means the close() is being used to force the read() to return -1 or throw an exception. If we synchronize the call to close, we may get deadlock. Mind you, this is circa JDK 1.1.x. The good news is that the NullPointerException is probably harmless because it's happening when the stream is being closed and the thread is terminated. Also, it's the FTP control stream, not the data stream that's being affected, so there will be no loss of data. The bad news is that I'm not immediately sure how to fix it in light of the code comment. This is a great example of why I'd like to get rid of the threads and move to java.nio for version 2.0. I can't come up with any ideas that don't run the risk of deadlock on some JVM. I'm afraid the right fix may be to simply catch any RuntimeExceptions thrown by read and take the same action as a close(). We probably should have been doing that anyway to gracefully handle unexpected situations. As an interim fix, I applied that change. Revision ChangesPath 1.9 +20 -4 jakarta-commons/net/src/java/org/apache/commons/net/telnet/TelnetInputStream.java Index: TelnetInputStream.java === RCS file: /home/cvs/jakarta-commons/net/src/java/org/apache/commons/net/telnet/TelnetInputStream.java,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- TelnetInputStream.java2 Jan 2004 03:39:06 - 1.8 +++ TelnetInputStream.java9 Jan 2004 06:19:23 - 1.9 @@ -439,7 +439,7 @@ synchronized (__queue) { __hasReachedEOF = true; -__isClosed = true; +__isClosed = true; if (__thread.isAlive()) { @@ -481,6 +481,14 @@ } continue; } +} catch(RuntimeException re) { +// We treat any runtime exceptions as though the +// stream has been closed. We close the +// underlying stream just to be sure. +super.close(); +// Breaking the loop has the effect of setting +// the state to closed at the end of the method. +break _outerLoop; } // Critical section because we're altering __bytesAvailable, @@ -515,19 +523,27
cvs commit: jakarta-commons/net/src/java/org/apache/commons/net/ftp FTPClient.java
dfs 2004/01/06 10:52:56 Modified:net/src/java/org/apache/commons/net/ftp FTPClient.java Log: Added caching of system name so that calls to getSystemName() don't travel across the wire when autodetecting the FTPFileEntryParser to use every time listFiles is called. Revision ChangesPath 1.23 +26 -8 jakarta-commons/net/src/java/org/apache/commons/net/ftp/FTPClient.java Index: FTPClient.java === RCS file: /home/cvs/jakarta-commons/net/src/java/org/apache/commons/net/ftp/FTPClient.java,v retrieving revision 1.22 retrieving revision 1.23 diff -u -r1.22 -r1.23 --- FTPClient.java5 Jan 2004 23:56:49 - 1.22 +++ FTPClient.java6 Jan 2004 18:52:56 - 1.23 @@ -251,7 +251,11 @@ private int __fileType, __fileFormat, __fileStructure, __fileTransferMode; private boolean __remoteVerificationEnabled; private long __restartOffset; -private FTPFileEntryParserFactory parserFactory; +private FTPFileEntryParserFactory __parserFactory; + +// __systemName is a cached values that should not be referenced directly +// except when assigned in getSystemName and __initDefaults. +private String __systemName; /*** * Default FTPClient constructor. Creates a new FTPClient instance @@ -267,7 +271,7 @@ __initDefaults(); __dataTimeout = -1; __remoteVerificationEnabled = true; -parserFactory = new DefaultFTPFileEntryParserFactory(); +__parserFactory = new DefaultFTPFileEntryParserFactory(); } @@ -281,6 +285,7 @@ __fileFormat = FTP.NON_PRINT_TEXT_FORMAT; __fileTransferMode = FTP.STREAM_TRANSFER_MODE; __restartOffset = 0; +__systemName = null; } private String __parsePathname(String reply) @@ -530,14 +535,14 @@ /** * set the factory used for parser creation to the supplied factory object. * - * @param parserFactory + * @param __parserFactory * factory object used to create FTPFileEntryParsers * * @see org.apache.commons.net.ftp.parser.FTPFileEntryParserFactory * @see org.apache.commons.net.ftp.parser.DefaultFTPFileEntryParserFactory */ public void setParserFactory(FTPFileEntryParserFactory parserFactory) { -this.parserFactory = parserFactory; +__parserFactory = parserFactory; } @@ -1795,6 +1800,11 @@ /*** * Fetches the system type name from the server and returns the string. + * This value is cached for the duration of the connection after the + * first call to this method. In other words, only the first time + * that you invoke this method will it issue a SYST command to the + * FTP server. FTPClient will remember the value and return the + * cached value until a call to disconnect. * p * @return The system type name obtained from the server. null if the * information could not be obtained. @@ -1812,10 +1822,10 @@ // Technically, we should expect a NAME_SYSTEM_TYPE response, but // in practice FTP servers deviate, so we soften the condition to // a positive completion. -if (FTPReply.isPositiveCompletion(syst())) -return ((String)_replyLines.elementAt(0)).substring(4); +if (__systemName == null FTPReply.isPositiveCompletion(syst())) +__systemName = ((String)_replyLines.elementAt(0)).substring(4); -return null; +return __systemName; } @@ -2045,7 +2055,7 @@ } FTPFileEntryParser parser = -this.parserFactory.createFileEntryParser(parserKey); + __parserFactory.createFileEntryParser(parserKey); FTPFileList list = createFileList(pathname, parser); return list.getFiles(); } @@ -2366,3 +2376,11 @@ return null; } } + +/* Emacs configuration + * Local variables:** + * mode: java ** + * c-basic-offset: 4 ** + * indent-tabs-mode: nil ** + * End:** + */ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-commons/net/src/java/org/apache/commons/net/ftp FTPClient.java
dfs 2004/01/06 11:02:03 Modified:net/src/java/org/apache/commons/net/ftp FTPClient.java Log: Added caching of the FTPFileEntryParser created in listFiles(String, String) to avoid creating a new object every tyime the method is called. This may be regarded as premature optimization, given the alleged efficiency of the latest JVMs in creating heap objects and collecting garbage. It is just that file listing is such a common operation that it makes sense to avoid repeatedly creating small objects when creating one will do.. Revision ChangesPath 1.24 +11 -4 jakarta-commons/net/src/java/org/apache/commons/net/ftp/FTPClient.java Index: FTPClient.java === RCS file: /home/cvs/jakarta-commons/net/src/java/org/apache/commons/net/ftp/FTPClient.java,v retrieving revision 1.23 retrieving revision 1.24 diff -u -r1.23 -r1.24 --- FTPClient.java6 Jan 2004 18:52:56 - 1.23 +++ FTPClient.java6 Jan 2004 19:02:02 - 1.24 @@ -253,10 +253,14 @@ private long __restartOffset; private FTPFileEntryParserFactory __parserFactory; -// __systemName is a cached values that should not be referenced directly +// __systemName is a cached value that should not be referenced directly // except when assigned in getSystemName and __initDefaults. private String __systemName; +// __entryParser is a cached value that should not be referenced directly +// except when assigned in listFiles(String, String) and __initDefaults. +private FTPFileEntryParser __entryParser; + /*** * Default FTPClient constructor. Creates a new FTPClient instance * with the data connection mode set to @@ -286,6 +290,7 @@ __fileTransferMode = FTP.STREAM_TRANSFER_MODE; __restartOffset = 0; __systemName = null; +__entryParser= null; } private String __parsePathname(String reply) @@ -2054,9 +2059,11 @@ parserKey = getSystemName(); } -FTPFileEntryParser parser = - __parserFactory.createFileEntryParser(parserKey); -FTPFileList list = createFileList(pathname, parser); +// We cache the value to avoid creation of a new object every +// time a file listing is generated. +if(__entryParser == null) +__entryParser = __parserFactory.createFileEntryParser(parserKey); +FTPFileList list = createFileList(pathname, __entryParser); return list.getFiles(); } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-commons/net/src/java/org/apache/commons/net/ftp DefaultFTPFileListParser.java FTPFileEntryParser.java FTPFileListParser.java
dfs 2004/01/06 11:53:58 Modified:net/src/java/org/apache/commons/net/ftp DefaultFTPFileListParser.java FTPFileEntryParser.java FTPFileListParser.java Log: Deprecated FTPFileListParser and copied its parserFileList method to the FTPFileEntryParser interface. This is not an irreversible change, but is consistent with what we've been discussing on the mailing list. We can always back it out if need be. I also deleted all of the code for DefaultFTPFileListParser and changed the class to extend UnixFTPEntryParser. This change is in accordance with Jeffrey Brekke's suggestion that we not maintain multiple implementations of the same thing. DefaultFTPFileListParser is deprecated and will be phased out by version 2.0. Revision ChangesPath 1.9 +5 -362 jakarta-commons/net/src/java/org/apache/commons/net/ftp/DefaultFTPFileListParser.java Index: DefaultFTPFileListParser.java === RCS file: /home/cvs/jakarta-commons/net/src/java/org/apache/commons/net/ftp/DefaultFTPFileListParser.java,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- DefaultFTPFileListParser.java 5 Jan 2004 22:11:12 - 1.8 +++ DefaultFTPFileListParser.java 6 Jan 2004 19:53:58 - 1.9 @@ -61,6 +61,8 @@ import java.util.Calendar; import java.util.Vector; +import org.apache.commons.net.ftp.parser.UnixFTPEntryParser; + /** * DefaultFTPFileListParser is the default implementation of * a href=org.apache.commons.net.ftp.FTPFileListParser.html FTPFileListParser /a @@ -70,6 +72,8 @@ * case you would create your own implementation of FTPFileListParser and * if necessary, subclass FTPFile. * p + * As of version 1.2, this class merely extends UnixFTPEntryParser. + * It will be removed in version 2.0. * p * @author Daniel F. Savarese * @see FTPFileListParser @@ -78,370 +82,9 @@ * @see org.apache.commons.net.ftp.parser.DefaultFTPFileEntryParserFactory * @deprecated use autodetect mechanism in DefaultFTPFileEntryParserFactory instead */ -public final class DefaultFTPFileListParser implements FTPFileListParser +public final class DefaultFTPFileListParser extends UnixFTPEntryParser { -// end is one beyond end -private int __charArrayToInt(char[] arr, int start, int end) -{ -int value = 0, decimal; -decimal = 1; -while (end-- start) -{ -value += (decimal * (arr[end] - '0')); -decimal *= 10; -} -return value; -} - -private long __charArrayToLong(char[] arr, int start, int end) -{ -long value = 0, decimal; -decimal = 1; -while (end-- start) -{ -value += (decimal * (arr[end] - '0')); -decimal *= 10; -} -return value; -} - -private int __skipWhitespace(char[] cToken, int start) -{ -while (start cToken.length Character.isWhitespace(cToken[start])) -++start; -return start; -} - -private int __skipDigits(char[] cToken, int start) -{ -while (start cToken.length Character.isDigit(cToken[start])) -++start; -return start; -} - -private int __skipNonWhitespace(char[] cToken, int start) -{ -while (start cToken.length !Character.isWhitespace(cToken[start])) -++start; -return start; -} - -private int __skipNonWhitespaceToLower(char[] cToken, int start) -{ -while (start cToken.length !Character.isWhitespace(cToken[start])) -{ -cToken[start] = Character.toLowerCase(cToken[start]); -++start; -} -return start; -} - - -/*** - * Parses an FTP server listing entry (a single line) and returns an - * FTPFile instance with the resulting information. If the entry could - * not be parsed, returns null. - * p - * @param entry A single line of an FTP server listing with the - * end of line truncated. - * @return An FTPFile instance representing the file information. If - * the entry could not be parsed, returns null. - ***/ -public FTPFile parseFTPEntry(String entry) -{ -int access, start, end, type, month, year, hour, minutes; -boolean isDevice; -Calendar date; -String sToken; -char cToken[]; -FTPFile file; - -try -{ -cToken = entry.toCharArray(); - -file = new FTPFile(); -file.setRawListing(entry); - -isDevice = (cToken[0] == 'b' || cToken[0] == 'c
cvs commit: jakarta-commons/net build.xml project.xml
dfs 2004/01/05 08:17:27 Modified:net build.xml project.xml Log: Changed dependency from oro 2.0.7 to 2.0.8 since the newer version contains bug fixes. Revision ChangesPath 1.19 +1 -1 jakarta-commons/net/build.xml Index: build.xml === RCS file: /home/cvs/jakarta-commons/net/build.xml,v retrieving revision 1.18 retrieving revision 1.19 diff -u -r1.18 -r1.19 --- build.xml 29 Dec 2003 20:25:12 - 1.18 +++ build.xml 5 Jan 2004 16:17:27 - 1.19 @@ -139,7 +139,7 @@ /javadoc /target target name=get-deps unless=noget depends=init -get dest=${libdir}/oro-2.0.7.jar usetimestamp=true ignoreerrors=true src=http://www.ibiblio.org/maven/oro/jars/oro-2.0.7.jar; +get dest=${libdir}/oro-2.0.8.jar usetimestamp=true ignoreerrors=true src=http://www.ibiblio.org/maven/oro/jars/oro-2.0.8.jar; /get get dest=${libdir}/junit-3.8.1.jar usetimestamp=true ignoreerrors=true src=http://www.ibiblio.org/maven/junit/jars/junit-3.8.1.jar; /get 1.37 +1 -1 jakarta-commons/net/project.xml Index: project.xml === RCS file: /home/cvs/jakarta-commons/net/project.xml,v retrieving revision 1.36 retrieving revision 1.37 diff -u -r1.36 -r1.37 --- project.xml 1 Jan 2004 17:33:03 - 1.36 +++ project.xml 5 Jan 2004 16:17:27 - 1.37 @@ -119,7 +119,7 @@ dependencies dependency idoro/id -version2.0.7/version +version2.0.8/version /dependency /dependencies - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-commons/net/src/java/org/apache/commons/net/ftp FTPClient.java
dfs 2003/12/22 14:11:28 Modified:net/src/java/org/apache/commons/net/ftp FTPClient.java Log: Explicitly initialized __restartOffset to zero in __initDefaults(). Bugzilla report 25620 by [EMAIL PROTECTED] pointed out that this variable was not explicitly initialized. Even though in Java the default value is zero, beyond code understanding/maintenance, it is a problem because __restsartOffset is not reset the various times __initDefaults() is called (e.g., reinitialize(), connect()), so values will persist between connectionsand in other situations where it should be reset. Revision ChangesPath 1.14 +7 -6 jakarta-commons/net/src/java/org/apache/commons/net/ftp/FTPClient.java Index: FTPClient.java === RCS file: /home/cvs/jakarta-commons/net/src/java/org/apache/commons/net/ftp/FTPClient.java,v retrieving revision 1.13 retrieving revision 1.14 diff -u -r1.13 -r1.14 --- FTPClient.java29 Jul 2003 02:46:20 - 1.13 +++ FTPClient.java22 Dec 2003 22:11:26 - 1.14 @@ -269,12 +269,13 @@ private void __initDefaults() { __dataConnectionMode = ACTIVE_LOCAL_DATA_CONNECTION_MODE; -__passiveHost = null; -__passivePort = -1; -__fileType = FTP.ASCII_FILE_TYPE; -__fileStructure = FTP.FILE_STRUCTURE; -__fileFormat = FTP.NON_PRINT_TEXT_FORMAT; -__fileTransferMode = FTP.STREAM_TRANSFER_MODE; +__passiveHost= null; +__passivePort= -1; +__fileType = FTP.ASCII_FILE_TYPE; +__fileStructure = FTP.FILE_STRUCTURE; +__fileFormat = FTP.NON_PRINT_TEXT_FORMAT; +__fileTransferMode = FTP.STREAM_TRANSFER_MODE; +__restartOffset = 0; } private String __parsePathname(String reply) - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[net] Re: SocketClient.setDefaultTimeout has no effect (Bug#: 23746 ) (maybe I got it :)
In message [EMAIL PROTECTED], cthulhu writes: So the purpose of setDefaultTimeout is to set SoTimeout when the socket has not yet been opened, and the purpose of setSoTimeout is to set SoTimeout when socket has been opened, right? Yes. If so, I found the API description of setDefaultTimeout a little bit misleading.. I agree and that's why I don't want to close the report. I just haven't thought of how to reword it. and another tought; why is necessary to have 2 different methods doing the same thing? I mean, why not having only setSoTimeout and making it able to set SoTimout before and after socket is opened? The reason is that it is very common to create a SocketClient instance (say FTPClient for example) and reuse the object to establish connections. setDefaultTimeout is just a convenience method so you can set the timeout once and have it set every time you establish a connection. I then browsed a little the Socket API and Sun forum and it seems there's no way(at least I found none) to set how long it takes for a There's a connect method in J2SE 1.4 that takes a timeout argument. The problem is that we haven't decided to break compatibility with earlier Java versions, so we haven't added a comparable method to SocketClient. But you're free to change the source to SocketClient and add a setDefaultConnectTimeout method or a connect method that takes a timeout argument to suit your purposes. daniel - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-commons/net/xdocs changes.xml
dfs 2003/09/04 13:32:43 Modified:net/src/java/org/apache/commons/net/nntp NNTP.java NNTPClient.java NNTPCommand.java NNTPReply.java net/xdocs changes.xml Added: net/src/java/examples ExtendedNNTPOps.java Log: Applied patch (albeit slightly altered) from Rory Winston [EMAIL PROTECTED] that adds extended NNTP XOVER, LIST ACTIVE, and AUTHINFO commands. Revision ChangesPath 1.1 jakarta-commons/net/src/java/examples/ExtendedNNTPOps.java Index: ExtendedNNTPOps.java === /* * The Apache Software License, Version 1.1 * * Copyright (c) 2001 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright *notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright *notice, this list of conditions and the following disclaimer in *the documentation and/or other materials provided with the *distribution. * * 3. The end-user documentation included with the redistribution, *if any, must include the following acknowledgment: * This product includes software developed by the *Apache Software Foundation (http://www.apache.org/). *Alternately, this acknowledgment may appear in the software itself, *if and wherever such third-party acknowledgments normally appear. * * 4. The names Apache and Apache Software Foundation and *Apache Commons must not be used to endorse or promote products *derived from this software without prior written permission. For *written permission, please contact [EMAIL PROTECTED] * * 5. Products derived from this software may not be called Apache, *nor may Apache appear in their name, without *prior written permission of the Apache Software Foundation. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * * This software consists of voluntary contributions made by many * individuals on behalf of the Apache Software Foundation. For more * information on the Apache Software Foundation, please see * http://www.apache.org/. */ package examples; import java.io.BufferedReader; import java.io.IOException; import java.io.Reader; import java.io.PrintWriter; import java.util.ArrayList; import java.util.StringTokenizer; import org.apache.commons.net.io.DotTerminatedMessageReader; import org.apache.commons.net.nntp.NNTPClient; import org.apache.commons.net.nntp.NewsgroupInfo; public class ExtendedNNTPOps { // simple class that encapsulates some basic info about an NNTP article class Article { private int articleNumber; private String subject; private String date; private String articleId; private String from; private StringBuffer header; public Article() { header = new StringBuffer(); } public void addHeaderField(String name, String val) { header.append(name); header.append(: ); header.append(val); header.append('\n'); } public String getArticleId() { return articleId; } public int getArticleNumber() { return articleNumber; } public String getDate() { return date; } public String getFrom() { return from; } public String getSubject() { return subject; } public void setArticleId
cvs commit: jakarta-commons/net/xdocs changes.xml
dfs 2003/08/25 15:29:49 Modified:net/src/java/org/apache/commons/net/ftp/parser UnixFTPEntryParser.java net/src/test/org/apache/commons/net/ftp/parser EnterpriseUnixFTPEntryParserTest.java UnixFTPEntryParserTest.java net/xdocs changes.xml Log: Changed listing pattern in UnixFTPEntryParser to account for missing space between user and group fields. Matthieu Recouly [EMAIL PROTECTED] reported that some FTP servers will list files in this format (referencing http://www.javaworld.com/javaworld/jw-04-2003/jw-0404-ftp-p2.html) I added test cases for this listing format to UnixFTPEntryParserTest.java and EnterpriseUnixFTPEntryParserTest.java. EnterpriseUnixFTPEntryParser already handles the format, but didn't have a test for it. Reported change in changes.xml. Revision ChangesPath 1.3 +2 -2 jakarta-commons/net/src/java/org/apache/commons/net/ftp/parser/UnixFTPEntryParser.java Index: UnixFTPEntryParser.java === RCS file: /home/cvs/jakarta-commons/net/src/java/org/apache/commons/net/ftp/parser/UnixFTPEntryParser.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- UnixFTPEntryParser.java 6 Mar 2003 03:28:36 - 1.2 +++ UnixFTPEntryParser.java 25 Aug 2003 22:29:49 - 1.3 @@ -82,7 +82,7 @@ + (((r|-)(w|-)(x|-))((r|-)(w|-)(x|-))((r|-)(w|-)(x|-)))\\s+ + (\\d+)\\s+ + (\\S+)\\s+ -+ (\\S+)\\s+ ++ (?:(\\S+)\\s+)? + (\\d+)\\s+ + MONTHS + \\s+ + ((?:[0-9])|(?:[0-2][0-9])|(?:3[0-1]))\\s+ 1.4 +2 -1 jakarta-commons/net/src/test/org/apache/commons/net/ftp/parser/EnterpriseUnixFTPEntryParserTest.java Index: EnterpriseUnixFTPEntryParserTest.java === RCS file: /home/cvs/jakarta-commons/net/src/test/org/apache/commons/net/ftp/parser/EnterpriseUnixFTPEntryParserTest.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- EnterpriseUnixFTPEntryParserTest.java 5 Aug 2003 20:06:38 - 1.3 +++ EnterpriseUnixFTPEntryParserTest.java 25 Aug 2003 22:29:49 - 1.4 @@ -83,6 +83,7 @@ -rw-r--r-- 1ftp nogroup126552 Jan 22 2001 zxJDBC-1.2.4.zip, -rw-r--r-- 1 root root 111325 Apr -7 18:79 zxJDBC-2.0.1b1.tar.gz, drwxr-xr-x 2 root root 4096 Mar 2 15:13 zxbox, +drwxr-xr-x 1 usernameftp 512 Jan 29 23:32 prog, drwxr-xr-x 2 root root 4096 Aug 24 2001 zxjdbc, drwxr-xr-x 2 root root 4096 Jan 4 00:03 zziplib, drwxr-xr-x 2 root 99 4096 Feb 23 2001 zzplayer, 1.5 +2 -1 jakarta-commons/net/src/test/org/apache/commons/net/ftp/parser/UnixFTPEntryParserTest.java Index: UnixFTPEntryParserTest.java === RCS file: /home/cvs/jakarta-commons/net/src/test/org/apache/commons/net/ftp/parser/UnixFTPEntryParserTest.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- UnixFTPEntryParserTest.java 3 Mar 2003 15:25:56 - 1.4 +++ UnixFTPEntryParserTest.java 25 Aug 2003 22:29:49 - 1.5 @@ -90,6 +90,7 @@ drwxr-xr-x 2 root root 4096 Jan 4 00:03 zziplib, drwxr-xr-x 2 root 99 4096 Feb 23 2001 zzplayer, drwxr-xr-x 2 root root 4096 Aug 6 2001 zztpp, +drwxr-xr-x 1 usernameftp 512 Jan 29 23:32 prog, lrw-r--r-- 1 14 14 80284 Aug 22 2000 zxJDBC-1.2.3.tar.gz, frw-r--r-- 1 14 staff 119926 Aug 22 2000 zxJDBC-1.2.3.zip, crw-r--r-- 1 ftp nogroup 83853 Jan 22 2001 zxJDBC-1.2.4.tar.gz, 1.11 +22 -0 jakarta-commons/net/xdocs/changes.xml Index: changes.xml === RCS file: /home/cvs/jakarta-commons/net/xdocs/changes.xml,v retrieving revision 1.10 retrieving revision 1.11 diff -u -r1.10 -r1.11 --- changes.xml 23 Jun 2003 12:47:39 - 1.10 +++ changes.xml 25 Aug 2003 22:29:49 - 1.11 @@ -7,6 +7,28 @@ body release version=1.0.1 date=In CVS +!-- Pending resubmission of patch. + action dev=dfs type=add +Rory Winston lt;[EMAIL PROTECTED]gt; provided +patches to add the following extended NNTP commands to +NNTPClient: XOVER, AUTHINFO USER, AUTHINFO PASS, and +LIST ACTIVE. + /action +-- + action dev=dfs type=fix +Applied variation of fix suggested by Matthieu Recouly
cvs commit: jakarta-commons/net/xdocs changes.xml
dfs 2003/08/25 22:43:56 Modified:net/src/java/org/apache/commons/net/ftp FTP.java net/src/java/org/apache/commons/net/nntp NNTP.java net/src/java/org/apache/commons/net/pop3 POP3.java net/src/java/org/apache/commons/net/smtp SMTP.java net/xdocs changes.xml Log: [EMAIL PROTECTED] reported failure of SMTP on OS/390 which has EBCDIC as the native character set. I changed the connection hooks (_connectAction_()) for the FTP, SMTP, POP3, and NNTP classes to force use of an 8-bit US-ASCII superset (ISO-8859-1) for protocol communication. This was necessary because InputStreamReader and OutputStreamWriter use the default client-side character set encoding. I don't know if this should be user-configurable or if the encodings should be fixed. Regardless, all JVMs are required to support US-ASCII and ISO-8859-1, so there shouldn't be a problem with using a fixed encoding. PR: 22656 Revision ChangesPath 1.5 +8 -2 jakarta-commons/net/src/java/org/apache/commons/net/ftp/FTP.java Index: FTP.java === RCS file: /home/cvs/jakarta-commons/net/src/java/org/apache/commons/net/ftp/FTP.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- FTP.java 18 May 2003 04:03:16 - 1.4 +++ FTP.java 26 Aug 2003 05:43:55 - 1.5 @@ -244,6 +244,10 @@ ***/ public static final int COMPRESSED_TRANSFER_MODE = 12; +// We have to ensure that the protocol communication is in ASCII +// but we use ISO-8859-1 just in case 8-bit characters cross +// the wire. +private static final String __DEFAULT_ENCODING = ISO-8859-1; private static final String __modes = ABILNTCFRPSBC; private StringBuffer __commandBuffer; @@ -349,9 +353,11 @@ { super._connectAction_(); _controlInput = -new BufferedReader(new InputStreamReader(getInputStream())); +new BufferedReader(new InputStreamReader(getInputStream(), + __DEFAULT_ENCODING)); _controlOutput = -new BufferedWriter(new OutputStreamWriter(getOutputStream())); +new BufferedWriter(new OutputStreamWriter(getOutputStream(), + __DEFAULT_ENCODING)); __getReply(); // If we received code 120, we have to fetch completion reply. if (FTPReply.isPositivePreliminary(_replyCode)) 1.6 +9 -2 jakarta-commons/net/src/java/org/apache/commons/net/nntp/NNTP.java Index: NNTP.java === RCS file: /home/cvs/jakarta-commons/net/src/java/org/apache/commons/net/nntp/NNTP.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- NNTP.java 19 Apr 2003 20:49:13 - 1.5 +++ NNTP.java 26 Aug 2003 05:43:55 - 1.6 @@ -120,6 +120,11 @@ /*** The default NNTP port. Its value is 119 according to RFC 977. ***/ public static final int DEFAULT_PORT = 119; +// We have to ensure that the protocol communication is in ASCII +// but we use ISO-8859-1 just in case 8-bit characters cross +// the wire. +private static final String __DEFAULT_ENCODING = ISO-8859-1; + private StringBuffer __commandBuffer; boolean _isAllowedToPost; @@ -204,9 +209,11 @@ { super._connectAction_(); _reader_ = -new BufferedReader(new InputStreamReader(_input_)); +new BufferedReader(new InputStreamReader(_input_, + __DEFAULT_ENCODING)); _writer_ = -new BufferedWriter(new OutputStreamWriter(_output_)); +new BufferedWriter(new OutputStreamWriter(_output_, + __DEFAULT_ENCODING)); __getReply(); _isAllowedToPost = (_replyCode == NNTPReply.SERVER_READY_POSTING_ALLOWED); 1.4 +11 -2 jakarta-commons/net/src/java/org/apache/commons/net/pop3/POP3.java Index: POP3.java === RCS file: /home/cvs/jakarta-commons/net/src/java/org/apache/commons/net/pop3/POP3.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- POP3.java 26 Jan 2003 00:21:44 - 1.3 +++ POP3.java 26 Aug 2003 05:43:55 - 1.4 @@ -109,6 +109,11 @@ static final String _OK = +OK; static final String _ERROR = -ERR; +// We have to ensure that the protocol communication is in ASCII +// but we use ISO-8859-1 just in case 8-bit characters cross +// the wire. +private static final String
cvs commit: jakarta-commons/net/src/test/org/apache/commons/net/ftp/parser EnterpriseUnixFTPEntryParserTest.java
dfs 2003/08/05 13:06:38 Modified:net/src/test/org/apache/commons/net/ftp/parser EnterpriseUnixFTPEntryParserTest.java Log: Fixed testParseFieldsOnFile() so that year is properly accounted for. The way the test was originally written (revision 1.1) it would only work August 2002 - July 2003 which rev 1.2 fixed by not checking the year component. Revision ChangesPath 1.3 +19 -2 jakarta-commons/net/src/test/org/apache/commons/net/ftp/parser/EnterpriseUnixFTPEntryParserTest.java Index: EnterpriseUnixFTPEntryParserTest.java === RCS file: /home/cvs/jakarta-commons/net/src/test/org/apache/commons/net/ftp/parser/EnterpriseUnixFTPEntryParserTest.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- EnterpriseUnixFTPEntryParserTest.java 5 Aug 2003 18:13:06 - 1.2 +++ EnterpriseUnixFTPEntryParserTest.java 5 Aug 2003 20:06:38 - 1.3 @@ -54,7 +54,6 @@ * http://www.apache.org/. */ - import java.util.Calendar; import junit.framework.TestSuite; @@ -136,6 +135,9 @@ public void testParseFieldsOnFile() throws Exception { FTPFile file = getParser().parseFTPEntry(-C--E-FTP B QUA1I1 18128 41 Aug 12 13:56 QUADTEST); +Calendar today = Calendar.getInstance(); +int year= today.get(Calendar.YEAR); + assertTrue(Should be a file., file.isFile()); assertEquals(QUADTEST, @@ -146,11 +148,18 @@ file.getUser()); assertEquals(18128, file.getGroup()); + +if(today.get(Calendar.MONTH) Calendar.AUGUST) +--year; + Calendar timestamp = file.getTimestamp(); +assertEquals(year, timestamp.get(Calendar.YEAR)); assertEquals(Calendar.AUGUST, timestamp.get(Calendar.MONTH)); assertEquals(12, timestamp.get(Calendar.DAY_OF_MONTH)); assertEquals(13, timestamp.get(Calendar.HOUR_OF_DAY)); -assertEquals(56, timestamp.get(Calendar.MINUTE)); +assertEquals(56, timestamp.get(Calendar.MINUTE)); +assertEquals(0, timestamp.get(Calendar.SECOND)); + checkPermisions(file); } @@ -218,3 +227,11 @@ FTPFile.EXECUTE_PERMISSION)); } } + +/* Emacs configuration + * Local variables:** + * mode: java ** + * c-basic-offset: 4 ** + * indent-tabs-mode: nil ** + * End:** + */ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-commons/net/src/java/org/apache/commons/net FingerClient.java
dfs 2003/07/29 11:59:08 Modified:net/src/java/org/apache/commons/net FingerClient.java Log: Mark Himsley mark at mdsh dot com reported a problem where the underlying socket, library classes, or native code was fragmenting a finger/whois query. Some whois servers don't wait for the second fragment to arrive. After consulting with Mark, I've added a BufferedOutputStream to prevent the fragmentation as long as the query is smaller than the buffer size. We may want to make the buffer size configurable. Revision ChangesPath 1.5 +3 -1 jakarta-commons/net/src/java/org/apache/commons/net/FingerClient.java Index: FingerClient.java === RCS file: /home/cvs/jakarta-commons/net/src/java/org/apache/commons/net/FingerClient.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- FingerClient.java 18 May 2003 04:03:16 - 1.4 +++ FingerClient.java 29 Jul 2003 18:59:08 - 1.5 @@ -58,6 +58,7 @@ import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; +import java.io.BufferedOutputStream; import java.io.DataOutputStream; /*** @@ -181,7 +182,8 @@ __query.append(username); __query.append(SocketClient.NETASCII_EOL); -output = new DataOutputStream(_output_); +output = + new DataOutputStream(new BufferedOutputStream(_output_, 1024)); output.writeBytes(__query.toString()); output.flush(); - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-commons/net/src/test/org/apache/commons/net/ftp/parser VMSFTPEntryParserTest.java
dfs 2003/07/28 19:35:35 Modified:net/src/java/org/apache/commons/net/ftp/parser VMSFTPEntryParser.java net/src/test/org/apache/commons/net/ftp/parser VMSFTPEntryParserTest.java Log: Applied patch from Stephane Este-Gracias that fixes the parsing of VMS listings. I verified that it would compile and pass its tests. I also visually inspected the code, but did not perform a deep examination. On the surface, everything looks okay. PR: 20796 Submitted by: [EMAIL PROTECTED] (Stephane ESTE-GRACIAS) Reviewed by: dfs Revision ChangesPath 1.6 +95 -10 jakarta-commons/net/src/java/org/apache/commons/net/ftp/parser/VMSFTPEntryParser.java Index: VMSFTPEntryParser.java === RCS file: /home/cvs/jakarta-commons/net/src/java/org/apache/commons/net/ftp/parser/VMSFTPEntryParser.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- VMSFTPEntryParser.java18 May 2003 04:03:17 - 1.5 +++ VMSFTPEntryParser.java29 Jul 2003 02:35:34 - 1.6 @@ -55,8 +55,13 @@ */ import java.util.Calendar; +import java.util.HashMap; import java.io.BufferedReader; +import java.io.ByteArrayInputStream; import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; + import org.apache.commons.net.ftp.FTPFile; import org.apache.commons.net.ftp.FTPFileListParserImpl; @@ -112,6 +117,7 @@ * * @author a href=[EMAIL PROTECTED]Winston Ojeda/a * @author a href=mailto:[EMAIL PROTECTED]Steve Cohen/a + * @author a href=[EMAIL PROTECTED]Stephane ESTE-GRACIAS/a * @version $Id$ */ public class VMSFTPEntryParser extends FTPFileListParserImpl @@ -139,8 +145,8 @@ + MONTHS + -([0-9]{4})\\s* + ((?:[01]\\d)|(?:2[0-3])):([012345]\\d):([012345]\\d)\\s* -+ \\[([0-9$A-Za-z_]+),([0-9$a-zA-Z_]+)\\]\\s* -+ (\\([a-zA-Z]*,[a-zA-Z]*,[a-zA-Z]*,[a-zA-Z]*\\)); ++ \\[(([0-9$A-Za-z_]+)|([0-9$A-Za-z_]+),([0-9$a-zA-Z_]+))\\]\\s* ++ \\([a-zA-Z]*,[a-zA-Z]*,[a-zA-Z]*,[a-zA-Z]*\\); /** @@ -156,7 +162,8 @@ { this(false); } - + + /** * Constructor for a VMSFTPEntryParser object. Sets the versioning member * to the supplied value. @@ -174,6 +181,68 @@ this.versioning = versioning; } + +/*** + * Parses an FTP server file listing and converts it into a usable format + * in the form of an array of code FTPFile /code instances. If the + * file list contains no files, code null /code should be + * returned, otherwise an array of code FTPFile /code instances + * representing the files in the directory is returned. + * p + * @param listStream The InputStream from which the file list should be + *read. + * @return The list of file information contained in the given path. null + * if the list could not be obtained or if there are no files in + * the directory. + * @exception IOException If an I/O error occurs reading the listStream. + ***/ +public FTPFile[] parseFileList(InputStream listStream) throws IOException { +BufferedReader reader = new BufferedReader(new InputStreamReader(listStream)); +String listing = null; +FTPFile[] files; + +String line = reader.readLine(); +while (line != null) { +if ((line.trim().equals()) || +(line.startsWith(Directory)) || +(line.startsWith(Total)) + ) { +line = reader.readLine(); +continue; +} +if (listing == null) { +listing = line; +} else { +listing += \r\n + line; +} +line = reader.readLine(); +} +reader.close(); + +byte[] bytes = listing.getBytes(); +ByteArrayInputStream listingStream = new ByteArrayInputStream(bytes); + +if (versioning) { +files = super.parseFileList(listingStream); +} else { +FTPFile[] tempFiles = super.parseFileList(listingStream); +HashMap filesHash = new HashMap(); +String fileName; + +for (int index = 0; index tempFiles.length; index++) { +fileName = tempFiles[index].getName(); +if (!filesHash.containsKey(fileName)) { +filesHash.put(fileName, (FTPFile) tempFiles[index]); +} +} + +files = (FTPFile[]) filesHash.values().toArray(new FTPFile[0]); +} + +return files
cvs commit: jakarta-commons/net/src/java/org/apache/commons/net/ftp FTPClient.java
dfs 2003/07/28 19:43:40 Modified:net/src/java/org/apache/commons/net/ftp FTPClient.java Log: PR:21937 [EMAIL PROTECTED] (Stephane ESTE-GRACIAS) reported that a VMS FTP server he is using replied to the SYST command with a 200 response code instead of a 215 response code. Therefore, I softened the success condition for getSystemName() to merely be a positive completion. Revision ChangesPath 1.12 +5 -1 jakarta-commons/net/src/java/org/apache/commons/net/ftp/FTPClient.java Index: FTPClient.java === RCS file: /home/cvs/jakarta-commons/net/src/java/org/apache/commons/net/ftp/FTPClient.java,v retrieving revision 1.11 retrieving revision 1.12 diff -u -r1.11 -r1.12 --- FTPClient.java23 Jul 2003 13:40:41 - 1.11 +++ FTPClient.java29 Jul 2003 02:43:40 - 1.12 @@ -1792,7 +1792,11 @@ ***/ public String getSystemName() throws IOException { -if (syst() == FTPReply.NAME_SYSTEM_TYPE) + //if (syst() == FTPReply.NAME_SYSTEM_TYPE) + // Technically, we should expect a NAME_SYSTE_TYPE response, but + // in practice FTP servers deviate, so we soften the condition to + // a positive completion. +if (FTPReply.isPositiveCompletion(syst())) return ((String)_replyLines.elementAt(0)).substring(4); return null; - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-commons/net/src/java/org/apache/commons/net/ftp FTPClient.java
dfs 2003/07/28 19:46:20 Modified:net/src/java/org/apache/commons/net/ftp FTPClient.java Log: Fixed typo in comment. Revision ChangesPath 1.13 +1 -1 jakarta-commons/net/src/java/org/apache/commons/net/ftp/FTPClient.java Index: FTPClient.java === RCS file: /home/cvs/jakarta-commons/net/src/java/org/apache/commons/net/ftp/FTPClient.java,v retrieving revision 1.12 retrieving revision 1.13 diff -u -r1.12 -r1.13 --- FTPClient.java29 Jul 2003 02:43:40 - 1.12 +++ FTPClient.java29 Jul 2003 02:46:20 - 1.13 @@ -1793,7 +1793,7 @@ public String getSystemName() throws IOException { //if (syst() == FTPReply.NAME_SYSTEM_TYPE) - // Technically, we should expect a NAME_SYSTE_TYPE response, but + // Technically, we should expect a NAME_SYSTEM_TYPE response, but // in practice FTP servers deviate, so we soften the condition to // a positive completion. if (FTPReply.isPositiveCompletion(syst())) - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-commons/net/src/java/org/apache/commons/net/ftp FTPClient.java
dfs 2003/07/23 06:40:41 Modified:net/src/java/org/apache/commons/net/ftp FTPClient.java Log: Applied patch correcting oversight that prevented restart from working in passive mode. Revision ChangesPath 1.11 +5 -0 jakarta-commons/net/src/java/org/apache/commons/net/ftp/FTPClient.java Index: FTPClient.java === RCS file: /home/cvs/jakarta-commons/net/src/java/org/apache/commons/net/ftp/FTPClient.java,v retrieving revision 1.10 retrieving revision 1.11 diff -u -r1.10 -r1.11 --- FTPClient.java18 May 2003 04:03:16 - 1.10 +++ FTPClient.java23 Jul 2003 13:40:41 - 1.11 @@ -467,6 +467,11 @@ __parsePassiveModeReply((String)_replyLines.elementAt(0)); socket = _socketFactory_.createSocket(__passiveHost, __passivePort); +if ((__restartOffset 0) !restart(__restartOffset)) +{ +socket.close(); +return null; +} if (!FTPReply.isPositivePreliminary(sendCommand(command, arg))) { - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-commons/net/src/java/org/apache/commons/net/ftp FTPClient.java
dfs 2003/03/15 13:45:06 Modified:net/src/java/org/apache/commons/net/ftp FTPClient.java Log: Added buffering of ASCII transfers in __storeFileStream(). Also added an explicit buffer size for copying streams in __storeFile() and retrieveFile() and added buffering of ASCII transfers in retrieveFileStream(). Revision ChangesPath 1.8 +34 -7 jakarta-commons/net/src/java/org/apache/commons/net/ftp/FTPClient.java Index: FTPClient.java === RCS file: /home/cvs/jakarta-commons/net/src/java/org/apache/commons/net/ftp/FTPClient.java,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- FTPClient.java6 Mar 2003 12:38:41 - 1.7 +++ FTPClient.java15 Mar 2003 21:45:06 - 1.8 @@ -427,7 +427,10 @@ if ((socket = __openDataConnection(command, remote)) == null) return false; -output = new BufferedOutputStream(socket.getOutputStream()); +// TODO: Buffer size may have to be adjustable in future to tune +// performance. +output = new BufferedOutputStream(socket.getOutputStream(), + Util.DEFAULT_COPY_BUFFER_SIZE); if (__fileType == ASCII_FILE_TYPE) output = new ToNetASCIIOutputStream(output); // Treat everything else as binary for now @@ -460,8 +463,19 @@ return null; output = socket.getOutputStream(); -if (__fileType == ASCII_FILE_TYPE) -output = new ToNetASCIIOutputStream(output); +if (__fileType == ASCII_FILE_TYPE) { + // We buffer ascii transfers because the buffering has to + // be interposed between ToNetASCIIOutputSream and the underlying + // socket output stream. We don't buffer binary transfers + // because we don't want to impose a buffering policy on the + // programmer if possible. Programmers can decide on their + // own if they want to wrap the SocketOutputStream we return + // for file types other than ASCII. + output = new BufferedOutputStream(output, +Util.DEFAULT_COPY_BUFFER_SIZE); + output = new ToNetASCIIOutputStream(output); + +} return new org.apache.commons.net.io.SocketOutputStream(socket, output); } @@ -1193,9 +1207,12 @@ if ((socket = __openDataConnection(FTPCommand.RETR, remote)) == null) return false; -input = new BufferedInputStream(socket.getInputStream()); +// TODO: Buffer size may have to be adjustable in future to tune +// performance. +input = new BufferedInputStream(socket.getInputStream(), +Util.DEFAULT_COPY_BUFFER_SIZE); if (__fileType == ASCII_FILE_TYPE) -input = new FromNetASCIIInputStream(input); + input = new FromNetASCIIInputStream(input); // Treat everything else as binary for now try { @@ -1248,8 +1265,18 @@ return null; input = socket.getInputStream(); -if (__fileType == ASCII_FILE_TYPE) -input = new FromNetASCIIInputStream(input); +if (__fileType == ASCII_FILE_TYPE) { + // We buffer ascii transfers because the buffering has to + // be interposed between FromNetASCIIOutputSream and the underlying + // socket input stream. We don't buffer binary transfers + // because we don't want to impose a buffering policy on the + // programmer if possible. Programmers can decide on their + // own if they want to wrap the SocketInputStream we return + // for file types other than ASCII. + input = new BufferedInputStream(input, + Util.DEFAULT_COPY_BUFFER_SIZE); + input = new FromNetASCIIInputStream(input); +} return new org.apache.commons.net.io.SocketInputStream(socket, input); } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-commons/net/src/java/org/apache/commons/net/ftp DefaultFTPFileListParser.java
dfs 2003/02/23 15:00:03 Modified:net/src/java/org/apache/commons/net/ftp DefaultFTPFileListParser.java Log: Fixed javadoc typo. Revision ChangesPath 1.4 +2 -2 jakarta-commons/net/src/java/org/apache/commons/net/ftp/DefaultFTPFileListParser.java Index: DefaultFTPFileListParser.java === RCS file: /home/cvs/jakarta-commons/net/src/java/org/apache/commons/net/ftp/DefaultFTPFileListParser.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- DefaultFTPFileListParser.java 26 Jan 2003 00:21:43 - 1.3 +++ DefaultFTPFileListParser.java 23 Feb 2003 23:00:02 - 1.4 @@ -146,8 +146,8 @@ * p * @param entry A single line of an FTP server listing with the * end of line truncated. - * @return An FTPFile instance representing the file information. null if - * the entry could be parsed, returns null. + * @return An FTPFile instance representing the file information. If + * the entry could not be parsed, returns null. ***/ public FTPFile parseFTPEntry(String entry) { - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-commons-sandbox/net/src/java/org/apache/commons/net/util - New directory
dfs 2003/01/25 15:59:42 jakarta-commons-sandbox/net/src/java/org/apache/commons/net/util - New directory -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
cvs commit: jakarta-commons-sandbox/net/src/java/org/apache/commons/net/io - New directory
dfs 2003/01/25 15:59:42 jakarta-commons-sandbox/net/src/java/org/apache/commons/net/io - New directory -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
cvs commit: jakarta-commons-sandbox/net/xdocs changes.xml
dfs 2002/11/21 11:02:03 Modified:net/xdocs changes.xml Log: Recorded NNTP.removeProtocolCommandListener typo fix. Revision ChangesPath 1.2 +16 -7 jakarta-commons-sandbox/net/xdocs/changes.xml Index: changes.xml === RCS file: /home/cvs/jakarta-commons-sandbox/net/xdocs/changes.xml,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- changes.xml 1 Oct 2002 13:10:08 - 1.1 +++ changes.xml 21 Nov 2002 19:02:03 - 1.2 @@ -7,17 +7,26 @@ body release version=1.0 date=in CVS + action dev=dfs type=fix due-to-email=[EMAIL PROTECTED] + Fixed typo in NNTP.removeProtocolCommandListener() method name. It + was missing an L. + /action action dev=brekke type=add -Various site updates including this changes doc and publish date information. +Various site updates including this changes doc and publish +date information. /action - action dev=dfs type=fix due-to=Tapan Karecha due-to-email=[EMAIL PROTECTED] -Patch for restarting FTP file transfers. The offset was not being sent immediately -before the data transfer command on account. The bug was apparently introduced in -NetComponents when it was decided to always send a PORT command before each data + action dev=dfs type=fix due-to=Tapan Karecha + due-to-email=[EMAIL PROTECTED] +Patch for restarting FTP file transfers. The offset was not +being sent immediately before the data transfer command on +account. The bug was apparently introduced in NetComponents +when it was decided to always send a PORT command before each data transfer to avoid socket reuse problems on Windows. /action - action dev=dfs type=fix due-to=Tapan Karecha due-to-email=[EMAIL PROTECTED] -Applied a fix for potential deadlock in TelnetInputStream by changing a wait() to a wait(100). + action dev=dfs type=fix due-to=Tapan Karecha + due-to-email=[EMAIL PROTECTED] +Applied a fix for potential deadlock in TelnetInputStream by +changing a wait() to a wait(100). /action action dev=dfs type=update FTP examples now use passive ftp connections. -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
cvs commit: jakarta-commons-sandbox/net/src/java/org/apache/commons/net/ftp FTPClient.java
dfs 2002/09/20 07:36:42 Modified:net/src/java/org/apache/commons/net/ftp FTPClient.java Log: Submitted by: Tapan Karecha [EMAIL PROTECTED] Reviewed by: dfs Applied patch for restarting FTP file transfers. The offset was not being sent immediately before the data transfer command on account. The bug was apparently introduced in NetComponents when it was decided to always send a PORT command before each data transfer to avoid socket reuse problems on Windows. Tapan Karecha detected the error and supplied this fix. Revision ChangesPath 1.4 +36 -1 jakarta-commons-sandbox/net/src/java/org/apache/commons/net/ftp/FTPClient.java Index: FTPClient.java === RCS file: /home/cvs/jakarta-commons-sandbox/net/src/java/org/apache/commons/net/ftp/FTPClient.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- FTPClient.java29 Apr 2002 03:55:31 - 1.3 +++ FTPClient.java20 Sep 2002 14:36:42 - 1.4 @@ -246,6 +246,7 @@ private int __fileType, __fileFormat, __fileStructure, __fileTransferMode; private boolean __remoteVerificationEnabled; private FTPFileListParser __fileListParser; +private long __restartOffset; /*** * Default FTPClient constructor. Creates a new FTPClient instance @@ -358,6 +359,12 @@ return null; } +if ((__restartOffset 0) !restart(__restartOffset)) +{ +server.close(); +return null; +} + if (!FTPReply.isPositivePreliminary(sendCommand(command, arg))) { server.close(); @@ -1548,10 +1555,38 @@ * @exception IOException If an I/O error occurs while either sending a * command to the server or receiving a reply from the server. ***/ -public boolean restart(long offset) throws IOException +private boolean restart(long offset) throws IOException { +__restartOffset = 0; return FTPReply.isPositiveIntermediate(rest(Long.toString(offset))); } + +/*** + * Sets the restart offset. The restart command is sent to the server + * only before sending the file transfer command. When this is done, + * the restart marker is reset to zero. + * p + * @param offset The offset into the remote file at which to start the + * next file transfer. This must be a value greater than or + * equal to zero. + ***/ +public void setRestartOffset(long offset) +{ +if (offset = 0) +__restartOffset = offset; +} + +/*** + * Fetches the restart offset. + * p + * @return offset The offset into the remote file at which to start the + * next file transfer. + ***/ +public long getRestartOffset() +{ +return __restartOffset; +} + /*** -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
cvs commit: jakarta-commons-sandbox/net/src/java/examples ftp.java
dfs 2002/09/19 09:23:55 Modified:net/src/java/examples ftp.java Log: Made FTP example use passive mode for transfers so people behind firewalls won't wonder why the example isn't working. Really should add a command line option, but this is an example, not a complete program. Revision ChangesPath 1.5 +4 -0 jakarta-commons-sandbox/net/src/java/examples/ftp.java Index: ftp.java === RCS file: /home/cvs/jakarta-commons-sandbox/net/src/java/examples/ftp.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- ftp.java 12 Apr 2002 04:42:44 - 1.4 +++ ftp.java 19 Sep 2002 16:23:55 - 1.5 @@ -167,6 +167,10 @@ 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; -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
cvs commit: jakarta-commons-sandbox/net/src/java/org/apache/commons/net/telnet TelnetInputStream.java
dfs 2002/09/19 09:54:58 Modified:net/src/java/org/apache/commons/net/telnet TelnetInputStream.java Log: Applied a fix for potential deadlock by changing a wait() to a wait(100). Revision ChangesPath 1.3 +5 -20 jakarta-commons-sandbox/net/src/java/org/apache/commons/net/telnet/TelnetInputStream.java Index: TelnetInputStream.java === RCS file: /home/cvs/jakarta-commons-sandbox/net/src/java/org/apache/commons/net/telnet/TelnetInputStream.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- TelnetInputStream.java12 Apr 2002 04:42:47 - 1.2 +++ TelnetInputStream.java19 Sep 2002 16:54:58 - 1.3 @@ -265,11 +265,9 @@ __queue.notify(); try { -//System.out.println(READ WAIT); __readIsWaiting = true; __queue.wait(); __readIsWaiting = false; -//System.out.println(READ END WAIT); } catch (InterruptedException e) { @@ -384,23 +382,15 @@ synchronized (__queue) { __hasReachedEOF = true; +__isClosed = true; + if (__thread.isAlive()) { -__isClosed = true; __thread.interrupt(); } + __queue.notifyAll(); } -/* -while(__thread.isAlive()) { - __thread.interrupt(); - try { -__thread.join(); - } catch(InterruptedException e) { -// If this happens, we just continue to loop - } -} -*/ } public void run() @@ -422,12 +412,10 @@ synchronized (__queue) { __ioException = e; -__queue.notify(); +__queue.notifyAll(); try { -//System.out.println(THREAD WAIT B); -__queue.wait(); -//System.out.println(THREAD END WAIT B); +__queue.wait(100); } catch (InterruptedException interrupted) { @@ -448,9 +436,7 @@ __queue.notify(); try { -//System.out.println(THREAD WAIT); __queue.wait(); -//System.out.println(THREAD END WAIT); } catch (InterruptedException e) { @@ -462,7 +448,6 @@ // Need to do this in case we're not full, but block on a read if (__readIsWaiting) { -//System.out.println(NOTIFY); __queue.notify(); } -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
cvs commit: jakarta-commons-sandbox/net/src/java/org/apache/commons/net/telnet TelnetInputStream.java
dfs 2002/09/19 11:09:25 Modified:net/src/java/org/apache/commons/net/telnet TelnetInputStream.java Log: Reformatted the constants so they fit within 80 columns. Revision ChangesPath 1.4 +2 -2 jakarta-commons-sandbox/net/src/java/org/apache/commons/net/telnet/TelnetInputStream.java Index: TelnetInputStream.java === RCS file: /home/cvs/jakarta-commons-sandbox/net/src/java/org/apache/commons/net/telnet/TelnetInputStream.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- TelnetInputStream.java19 Sep 2002 16:54:58 - 1.3 +++ TelnetInputStream.java19 Sep 2002 18:09:25 - 1.4 @@ -72,8 +72,8 @@ final class TelnetInputStream extends BufferedInputStream implements Runnable { static final int _STATE_DATA = 0, _STATE_IAC = 1, _STATE_WILL = 2, - _STATE_WONT = 3, _STATE_DO = 4, _STATE_DONT = 5, _STATE_SB = 6, -_STATE_SE = 7, _STATE_CR = 8; + _STATE_WONT = 3, _STATE_DO = 4, _STATE_DONT = 5, + _STATE_SB = 6, _STATE_SE = 7, _STATE_CR = 8; private boolean __hasReachedEOF, __isClosed; private boolean __readIsWaiting; -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
cvs commit: jakarta-commons-sandbox/net/src/java/org/apache/commons/net/tftp TFTPClient.java
dfs 2002/09/17 14:48:07 Modified:net/src/java/org/apache/commons/net/tftp TFTPClient.java Log: Applied my patch from May 2002 which addresses the situation whereby the IP address that answers a TFTP file transfer request is different from the one it was sent to. We handle this by using the address in the first response packet as the host address. Revision ChangesPath 1.4 +6 -0 jakarta-commons-sandbox/net/src/java/org/apache/commons/net/tftp/TFTPClient.java Index: TFTPClient.java === RCS file: /home/cvs/jakarta-commons-sandbox/net/src/java/org/apache/commons/net/tftp/TFTPClient.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- TFTPClient.java 6 Aug 2002 15:23:37 - 1.3 +++ TFTPClient.java 17 Sep 2002 21:48:07 - 1.4 @@ -228,6 +228,12 @@ { hostPort = received.getPort(); ack.setPort(hostPort); +if(!host.equals(received.getAddress())) +{ +host = received.getAddress(); +ack.setAddress(host); +sent.setAddress(host); +} } // Comply with RFC 783 indication that an error acknowledgement -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]