Retry MoveItems if response does not contain a status.

Not sure if Retry is the best way to handle this, but it's
better than crashing and is how we handle other incomplete
responses.

Bug: 11438832
Change-Id: I11601ea2e4a65062f538d0416caa44bbb8c830c5
diff --git a/src/com/android/exchange/adapter/MoveItemsParser.java b/src/com/android/exchange/adapter/MoveItemsParser.java
index aa5d787..cf478d9 100644
--- a/src/com/android/exchange/adapter/MoveItemsParser.java
+++ b/src/com/android/exchange/adapter/MoveItemsParser.java
@@ -49,6 +49,12 @@
     }
 
     public int getStatusCode() {
+        if (mStatusCode == 0) {
+            LogUtils.e(TAG, "Trying to get status for MoveItems, but no status was set");
+            // TODO: We currently treat empty responses as retry, so for now we'll do the same for
+            // partially empty responses.
+            return STATUS_CODE_RETRY;
+        }
         return mStatusCode;
     }
 
diff --git a/src/com/android/exchange/eas/EasMoveItems.java b/src/com/android/exchange/eas/EasMoveItems.java
index c1a7d2f..97ce18c 100644
--- a/src/com/android/exchange/eas/EasMoveItems.java
+++ b/src/com/android/exchange/eas/EasMoveItems.java
@@ -75,7 +75,13 @@
                 // response state really means.
                 status = MoveItemsParser.STATUS_CODE_RETRY;
             }
-            final int index = status - 1;
+            final int index;
+            if (status <= 0) {
+                LogUtils.e(LOG_TAG, "MoveItems gave us an invalid status %d", status);
+                index = MoveItemsParser.STATUS_CODE_RETRY - 1;
+            } else {
+                index = status - 1;
+            }
             messageIds[index][counts[index]] = mMove.getMessageId();
             ++counts[index];
         }