commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r1086094 - in /commons/proper/net/trunk/src/main/java/org/apache/commons/net: imap/IMAP.java nntp/NNTP.java pop3/POP3.java smtp/SMTP.java
Date Mon, 28 Mar 2011 01:43:57 GMT
Author: sebb
Date: Mon Mar 28 01:43:56 2011
New Revision: 1086094

URL: http://svn.apache.org/viewvc?rev=1086094&view=rev
Log:
Replace __commandBuffer instance variable with local variable as only used in one method
Also change to StringBuilder (was StringBuffer)

Modified:
    commons/proper/net/trunk/src/main/java/org/apache/commons/net/imap/IMAP.java
    commons/proper/net/trunk/src/main/java/org/apache/commons/net/nntp/NNTP.java
    commons/proper/net/trunk/src/main/java/org/apache/commons/net/pop3/POP3.java
    commons/proper/net/trunk/src/main/java/org/apache/commons/net/smtp/SMTP.java

Modified: commons/proper/net/trunk/src/main/java/org/apache/commons/net/imap/IMAP.java
URL: http://svn.apache.org/viewvc/commons/proper/net/trunk/src/main/java/org/apache/commons/net/imap/IMAP.java?rev=1086094&r1=1086093&r2=1086094&view=diff
==============================================================================
--- commons/proper/net/trunk/src/main/java/org/apache/commons/net/imap/IMAP.java (original)
+++ commons/proper/net/trunk/src/main/java/org/apache/commons/net/imap/IMAP.java Mon Mar 28
01:43:56 2011
@@ -61,7 +61,6 @@ public class IMAP extends SocketClient
 
     private IMAPState __state;
     protected BufferedWriter __writer;
-    private StringBuffer __commandBuffer;
 
     protected BufferedReader _reader;
     private int _replyCode;
@@ -82,7 +81,6 @@ public class IMAP extends SocketClient
     public IMAP()
     {
         setDefaultPort(DEFAULT_PORT);
-        __commandBuffer = new StringBuffer();
         __state = IMAPState.DISCONNECTED_STATE;
         _reader = null;
         __writer = null;
@@ -234,9 +232,7 @@ public class IMAP extends SocketClient
      */
     private int sendCommandWithID(String commandID, String command, String args) throws IOException
     {
-        String message;
-
-        __commandBuffer.setLength(0);
+        StringBuilder __commandBuffer = new StringBuilder();
         if (commandID != null)
         {
             __commandBuffer.append(commandID);
@@ -251,6 +247,7 @@ public class IMAP extends SocketClient
         }
         __commandBuffer.append(SocketClient.NETASCII_EOL);
 
+        String message;
         __writer.write(message = __commandBuffer.toString());
         __writer.flush();
 

Modified: commons/proper/net/trunk/src/main/java/org/apache/commons/net/nntp/NNTP.java
URL: http://svn.apache.org/viewvc/commons/proper/net/trunk/src/main/java/org/apache/commons/net/nntp/NNTP.java?rev=1086094&r1=1086093&r2=1086094&view=diff
==============================================================================
--- commons/proper/net/trunk/src/main/java/org/apache/commons/net/nntp/NNTP.java (original)
+++ commons/proper/net/trunk/src/main/java/org/apache/commons/net/nntp/NNTP.java Mon Mar 28
01:43:56 2011
@@ -91,8 +91,6 @@ public class NNTP extends SocketClient
     // the wire.
     private static final String __DEFAULT_ENCODING = "ISO-8859-1";
 
-    private StringBuffer __commandBuffer;
-
     boolean _isAllowedToPost;
     int _replyCode;
     String _replyString;
@@ -125,7 +123,6 @@ public class NNTP extends SocketClient
     public NNTP()
     {
         setDefaultPort(DEFAULT_PORT);
-        __commandBuffer = new StringBuffer();
         _replyString = null;
         _reader_ = null;
         _writer_ = null;
@@ -261,9 +258,7 @@ public class NNTP extends SocketClient
      ***/
     public int sendCommand(String command, String args) throws IOException
     {
-        String message;
-
-        __commandBuffer.setLength(0);
+        StringBuilder __commandBuffer = new StringBuilder();
         __commandBuffer.append(command);
 
         if (args != null)
@@ -273,6 +268,7 @@ public class NNTP extends SocketClient
         }
         __commandBuffer.append(SocketClient.NETASCII_EOL);
 
+        String message;
         _writer_.write(message = __commandBuffer.toString());
         _writer_.flush();
 

Modified: commons/proper/net/trunk/src/main/java/org/apache/commons/net/pop3/POP3.java
URL: http://svn.apache.org/viewvc/commons/proper/net/trunk/src/main/java/org/apache/commons/net/pop3/POP3.java?rev=1086094&r1=1086093&r2=1086094&view=diff
==============================================================================
--- commons/proper/net/trunk/src/main/java/org/apache/commons/net/pop3/POP3.java (original)
+++ commons/proper/net/trunk/src/main/java/org/apache/commons/net/pop3/POP3.java Mon Mar 28
01:43:56 2011
@@ -81,7 +81,6 @@ public class POP3 extends SocketClient
 
     private int __popState;
     private BufferedWriter __writer;
-    private StringBuffer __commandBuffer;
 
     BufferedReader _reader;
     int _replyCode;
@@ -101,7 +100,6 @@ public class POP3 extends SocketClient
     public POP3()
     {
         setDefaultPort(DEFAULT_PORT);
-        __commandBuffer = new StringBuffer();
         __popState = DISCONNECTED_STATE;
         _reader = null;
         __writer = null;
@@ -250,9 +248,7 @@ public class POP3 extends SocketClient
      ***/
     public int sendCommand(String command, String args) throws IOException
     {
-        String message;
-
-        __commandBuffer.setLength(0);
+        StringBuilder __commandBuffer = new StringBuilder();
         __commandBuffer.append(command);
 
         if (args != null)
@@ -262,6 +258,7 @@ public class POP3 extends SocketClient
         }
         __commandBuffer.append(SocketClient.NETASCII_EOL);
 
+        String message;
         __writer.write(message = __commandBuffer.toString());
         __writer.flush();
 

Modified: commons/proper/net/trunk/src/main/java/org/apache/commons/net/smtp/SMTP.java
URL: http://svn.apache.org/viewvc/commons/proper/net/trunk/src/main/java/org/apache/commons/net/smtp/SMTP.java?rev=1086094&r1=1086093&r2=1086094&view=diff
==============================================================================
--- commons/proper/net/trunk/src/main/java/org/apache/commons/net/smtp/SMTP.java (original)
+++ commons/proper/net/trunk/src/main/java/org/apache/commons/net/smtp/SMTP.java Mon Mar 28
01:43:56 2011
@@ -96,8 +96,6 @@ public class SMTP extends SocketClient
     /** The encoding to use (user-settable) */
     private String encoding = __DEFAULT_ENCODING;
 
-    private StringBuffer __commandBuffer;
-
     BufferedReader _reader;
     BufferedWriter _writer;
     int _replyCode;
@@ -119,7 +117,6 @@ public class SMTP extends SocketClient
     public SMTP()
     {
         setDefaultPort(DEFAULT_PORT);
-        __commandBuffer = new StringBuffer();
         _replyLines = new ArrayList<String>();
         _newReplyString = false;
         _replyString = null;
@@ -139,9 +136,7 @@ public class SMTP extends SocketClient
     private int __sendCommand(String command, String args, boolean includeSpace)
     throws IOException
     {
-        String message;
-
-        __commandBuffer.setLength(0);
+        StringBuilder __commandBuffer = new StringBuilder();
         __commandBuffer.append(command);
 
         if (args != null)
@@ -153,6 +148,7 @@ public class SMTP extends SocketClient
 
         __commandBuffer.append(SocketClient.NETASCII_EOL);
 
+        String message;
         _writer.write(message = __commandBuffer.toString());
         _writer.flush();
 



Mime
View raw message