Merge "Minor fixes in Account"
diff --git a/src/com/android/mail/providers/Account.java b/src/com/android/mail/providers/Account.java
index 3d6b2a1..469fccf 100644
--- a/src/com/android/mail/providers/Account.java
+++ b/src/com/android/mail/providers/Account.java
@@ -181,7 +181,7 @@
             return new Account(name, type, serializedAccount);
         } catch (JSONException e) {
             LogUtils.wtf(LOG_TAG, e, "Could not create an account from this input: \""
-                    + serializedAccount);
+                    + serializedAccount + "\"");
             return null;
         }
     }
@@ -294,8 +294,8 @@
     }
 
     /**
-     * Returns an array of all Accounts located at this cursor.
-     * This method does not close the cursor.
+     * Returns an array of all Accounts located at this cursor. This method returns a zero length
+     * array if no account was found.  This method does not close the cursor.
      * @param cursor cursor pointing to the list of accounts
      * @return the array of all accounts stored at this cursor.
      */
@@ -307,13 +307,12 @@
         }
 
         Account[] allAccounts = new Account[initialLength];
-        for (int i = 0; i < initialLength; i++) {
-            allAccounts[i] = new Account(cursor);
-            if (!cursor.moveToNext()) {
-                LogUtils.d(LOG_TAG, "Expecting " + initialLength + " accounts. Got: " + i);
-                break;
-            }
-        }
+        int i = 0;
+        do {
+            allAccounts[i++] = new Account(cursor);
+        } while (cursor.moveToNext());
+        // Ensure that the length of the array is accurate
+        assert (i == initialLength);
         return allAccounts;
     }