From 689efab2b1beed7185ba75db6f0ef389adc222ae Mon Sep 17 00:00:00 2001 From: Emmanuel Berthier Date: Thu, 11 Oct 2012 16:33:25 +0200 Subject: [PATCH] email: "Exchange Services has stopped" - Rain of Exchange Javacrashes Cleanup some nasty records containing NULL fields. Change-Id: Iec5e7e1bebc4beee8fa010c3f9c9ee723fd2cd83 Author: Emmanuel Berthier Signed-off-by: Shuo Gao Signed-off-by: Bruce Beare Signed-off-by: Jack Ren Author-tracking-BZ: 60461 cherry-pick of https://android-review.googlesource.com/#/c/47571/1 --- src/com/android/email/provider/DBHelper.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/com/android/email/provider/DBHelper.java b/src/com/android/email/provider/DBHelper.java index bda0a9eb7..d864988f4 100644 --- a/src/com/android/email/provider/DBHelper.java +++ b/src/com/android/email/provider/DBHelper.java @@ -552,6 +552,16 @@ public final class DBHelper { @Override public void onOpen(SQLiteDatabase db) { + try { + // Cleanup some nasty records + db.execSQL("DELETE FROM " + Account.TABLE_NAME + + " WHERE " + AccountColumns.DISPLAY_NAME + " ISNULL;"); + db.execSQL("DELETE FROM " + HostAuth.TABLE_NAME + + " WHERE " + HostAuthColumns.PROTOCOL + " ISNULL;"); + } catch (SQLException e) { + // Shouldn't be needed unless we're debugging and interrupt the process + LogUtils.e(TAG, e, "Exception cleaning EmailProvider.db"); + } } }