commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r1586170 - in /commons/proper/net/trunk/src: changes/changes.xml main/java/org/apache/commons/net/imap/IMAP.java
Date Wed, 09 Apr 2014 23:20:03 GMT
Author: sebb
Date: Wed Apr  9 23:20:03 2014
New Revision: 1586170

URL: http://svn.apache.org/r1586170
Log:
NET-534 Unnecesssary call to getReplyString() if no listeners configured

Modified:
    commons/proper/net/trunk/src/changes/changes.xml
    commons/proper/net/trunk/src/main/java/org/apache/commons/net/imap/IMAP.java

Modified: commons/proper/net/trunk/src/changes/changes.xml
URL: http://svn.apache.org/viewvc/commons/proper/net/trunk/src/changes/changes.xml?rev=1586170&r1=1586169&r2=1586170&view=diff
==============================================================================
--- commons/proper/net/trunk/src/changes/changes.xml [utf-8] (original)
+++ commons/proper/net/trunk/src/changes/changes.xml [utf-8] Wed Apr  9 23:20:03 2014
@@ -65,6 +65,9 @@ The <action> type attribute can be add,u
         <release version="3.4" date="2014-01-??" description="
 This is mainly a bug-fix release. See further details below.
         ">
+            <action issue="NET-534" type="update" dev="sebb">
+            Unnecesssary call to getReplyString() if no listeners configured
+            </action>
             <action issue="NET-530" type="fix" dev="sebb" due-to="fish ship">
             input parameter of org.apache.commons.net.ftp.FTP.__getReply(boolean) is not
used
             </action>

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=1586170&r1=1586169&r2=1586170&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 Wed Apr 
9 23:20:03 2014
@@ -119,7 +119,7 @@ public class IMAP extends SocketClient
                     _replyLines.add(line);
                     literalCount -= (line.length() + 2); // Allow for CRLF
                 }
-                line = _reader.readLine();
+                line = _reader.readLine(); // get next chunk or final tag
                 if (line == null) {
                     throw new EOFException("Connection closed without indication.");
                 }
@@ -135,6 +135,21 @@ public class IMAP extends SocketClient
     }
 
     /**
+     * Overrides {@link SocketClient#fireReplyReceived(int, String)} so as to
+     * avoid creating the reply string if there are no listeners to invoke.
+     *
+     * @param replyCode passed to the listeners
+     * @param ignored the string is only created if there are listeners defined.
+     * @see #getReplyString()
+     */
+    @Override
+    protected void fireReplyReceived(int replyCode, String ignored) {
+        if (getCommandSupport().getListenerCount() > 0) {
+            getCommandSupport().fireReplyReceived(replyCode, getReplyString());
+        }
+    }
+
+    /**
      * Performs connection initialization and sets state to
      * {@link IMAPState#NOT_AUTH_STATE}.
      */



Mime
View raw message