summaryrefslogtreecommitdiffstats
path: root/src/com/android/providers/contacts/aggregation
diff options
context:
space:
mode:
authorMakoto Onuki <omakoto@google.com>2012-07-19 13:04:10 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2012-07-19 13:04:10 -0700
commitd109b23736e4171d23356642bd5dbe28743341da (patch)
treec9449910a08dd18b2eb4db68ff81c36fd8caf38d /src/com/android/providers/contacts/aggregation
parentddbfa584f5c1a2ee44806bbf123daba752811392 (diff)
parentff91ec356f1b17dea095a880f61b8bc4ff333b1e (diff)
downloadpackages_providers_ContactsProvider-d109b23736e4171d23356642bd5dbe28743341da.zip
packages_providers_ContactsProvider-d109b23736e4171d23356642bd5dbe28743341da.tar.gz
packages_providers_ContactsProvider-d109b23736e4171d23356642bd5dbe28743341da.tar.bz2
am ff91ec35: Tolerate crashes during re-aggregation.
* commit 'ff91ec356f1b17dea095a880f61b8bc4ff333b1e': Tolerate crashes during re-aggregation.
Diffstat (limited to 'src/com/android/providers/contacts/aggregation')
-rw-r--r--src/com/android/providers/contacts/aggregation/util/ContactMatcher.java15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/com/android/providers/contacts/aggregation/util/ContactMatcher.java b/src/com/android/providers/contacts/aggregation/util/ContactMatcher.java
index a29735d..2e552e9 100644
--- a/src/com/android/providers/contacts/aggregation/util/ContactMatcher.java
+++ b/src/com/android/providers/contacts/aggregation/util/ContactMatcher.java
@@ -18,6 +18,8 @@ package com.android.providers.contacts.aggregation.util;
import com.android.providers.contacts.ContactsDatabaseHelper.NameLookupType;
import com.android.providers.contacts.util.Hex;
+import android.util.Log;
+
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
@@ -27,6 +29,7 @@ import java.util.List;
* Logic for matching contacts' data and accumulating match scores.
*/
public class ContactMatcher {
+ private static final String TAG = "ContactMatcher";
// Best possible match score
public static final int MAX_SCORE = 100;
@@ -296,8 +299,16 @@ public class ContactMatcher {
return;
}
- byte[] decodedCandidateName = Hex.decodeHex(candidateName);
- byte[] decodedName = Hex.decodeHex(name);
+ final byte[] decodedCandidateName;
+ final byte[] decodedName;
+ try {
+ decodedCandidateName = Hex.decodeHex(candidateName);
+ decodedName = Hex.decodeHex(name);
+ } catch (RuntimeException e) {
+ // How could this happen?? See bug 6827136
+ Log.e(TAG, "Failed to decode normalized name. Skipping.", e);
+ return;
+ }
NameDistance nameDistance = algorithm == MATCHING_ALGORITHM_CONSERVATIVE ?
mNameDistanceConservative : mNameDistanceApproximate;