commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r1086101 - /commons/proper/net/trunk/src/main/java/org/apache/commons/net/imap/IMAP.java
Date Mon, 28 Mar 2011 02:40:23 GMT
Author: sebb
Date: Mon Mar 28 02:40:22 2011
New Revision: 1086101

URL: http://svn.apache.org/viewvc?rev=1086101&view=rev
Log:
Fix bug in generator - was wrapping YYYZ to AAAA

Modified:
    commons/proper/net/trunk/src/main/java/org/apache/commons/net/imap/IMAP.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=1086101&r1=1086100&r2=1086101&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
02:40:22 2011
@@ -247,8 +247,8 @@ public class IMAP extends SocketClient
         }
         __commandBuffer.append(SocketClient.NETASCII_EOL);
 
-        String message;
-        __writer.write(message = __commandBuffer.toString());
+        String message = __commandBuffer.toString();
+        __writer.write(message);
         __writer.flush();
 
         if (_commandSupport_.getListenerCount() > 0)
@@ -381,22 +381,17 @@ public class IMAP extends SocketClient
     {
         String res = new String (_initialID);
         // "increase" the ID for the next call
-        boolean wasIncr = false;
-        for (int i = _initialID.length-1; i>=0; i--)
+        boolean carry = true; // want to increment initially
+        for (int i = _initialID.length-1; carry && i>=0; i--)
         {
-            if (_initialID[i] >= 'Z')
+            if (_initialID[i] == 'Z')
             {
                 _initialID[i] = 'A';
-                if ( i > 0 )
-                {
-                    _initialID[i-1]++;
-                    wasIncr = true;
-                }
             }
             else
             {
-                if (! wasIncr) _initialID[i]++;
-                break;
+                _initialID[i]++;
+                carry = false; // did not wrap round
             }
         }
         return res;



Mime
View raw message