ArrayIndexOutOfBoundsException in RecipientEntry.constructFakeEntry
Bug 8423230
Fix a monkey bug that is showing up a lot in MR2. Use the original address
when tokenizing an address fails to return anything.
Cherry-pick of: I4ac42f81aa6e4cbdad058f73bb3a1fd62ab2e138
Change-Id: I0f41f3e169086dcd89e51cdf211985e9bf1a3ade
diff --git a/chips/src/com/android/ex/chips/RecipientEntry.java b/chips/src/com/android/ex/chips/RecipientEntry.java
index 14b11e1..f7155b0 100644
--- a/chips/src/com/android/ex/chips/RecipientEntry.java
+++ b/chips/src/com/android/ex/chips/RecipientEntry.java
@@ -110,7 +110,7 @@
*/
public static RecipientEntry constructFakeEntry(final String address, final boolean isValid) {
final Rfc822Token[] tokens = Rfc822Tokenizer.tokenize(address);
- final String tokenizedAddress = tokens[0].getAddress();
+ final String tokenizedAddress = tokens.length > 0 ? tokens[0].getAddress() : address;
return new RecipientEntry(ENTRY_TYPE_PERSON, tokenizedAddress, tokenizedAddress,
INVALID_DESTINATION_TYPE, null,