From 3a0fb3b14eda8216cb80e520ab48ea84a67b43ab Mon Sep 17 00:00:00 2001 From: Marc Blank Date: Fri, 11 Sep 2009 13:48:51 -0700 Subject: [PATCH] Allow download of contact w/ no name; don't accept empty note Change-Id: I90058ee6c92853a3765138ca433abd7f62b60c0a --- .../exchange/adapter/ContactsSyncAdapter.java | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/src/com/android/exchange/adapter/ContactsSyncAdapter.java b/src/com/android/exchange/adapter/ContactsSyncAdapter.java index db28a102f..763dbd9ba 100644 --- a/src/com/android/exchange/adapter/ContactsSyncAdapter.java +++ b/src/com/android/exchange/adapter/ContactsSyncAdapter.java @@ -540,7 +540,7 @@ public class ContactsSyncAdapter extends AbstractSyncAdapter { } // We must have first name, last name, or company name - String name; + String name = null; if (firstName != null || lastName != null) { if (firstName == null) { name = lastName; @@ -551,8 +551,6 @@ public class ContactsSyncAdapter extends AbstractSyncAdapter { } } else if (companyName != null) { name = companyName; - } else { - return; } ops.addName(entity, prefix, firstName, lastName, middleName, suffix, name, @@ -1342,6 +1340,19 @@ public class ContactsSyncAdapter extends AbstractSyncAdapter { if (cv != null && cvCompareString(cv, Note.NOTE, note)) { return; } + + // Reject notes with nothing in them. Often, we get something from Outlook when + // nothing was ever entered. Sigh. + int len = note.length(); + int i = 0; + for (; i < len; i++) { + char c = note.charAt(i); + if (!Character.isWhitespace(c)) { + break; + } + } + if (i == len) return; + builder.withValue(Note.NOTE, note); add(builder.build()); }