From e45bc61624e9d834640765a4736ababc65fe3b78 Mon Sep 17 00:00:00 2001 From: Moxie Marlinspike Date: Sun, 5 Aug 2012 13:12:51 -0700 Subject: [PATCH] Update import/export process for ICS+ --- .../securesms/ConversationListActivity.java | 2 -- .../database/ApplicationExporter.java | 22 ++++++++++--------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/org/thoughtcrime/securesms/ConversationListActivity.java b/src/org/thoughtcrime/securesms/ConversationListActivity.java index 50a545fc32..0011106137 100644 --- a/src/org/thoughtcrime/securesms/ConversationListActivity.java +++ b/src/org/thoughtcrime/securesms/ConversationListActivity.java @@ -185,8 +185,6 @@ public class ConversationListActivity extends SherlockFragmentActivity Intent clearKeyIntent = new Intent(KeyCachingService.CLEAR_KEY_ACTION, null, ConversationListActivity.this, KeyCachingService.class); startService(clearKeyIntent); - - DatabaseFactory.getInstance(ConversationListActivity.this).close(); } }; diff --git a/src/org/thoughtcrime/securesms/database/ApplicationExporter.java b/src/org/thoughtcrime/securesms/database/ApplicationExporter.java index 7daf9f9fee..5bf461468e 100644 --- a/src/org/thoughtcrime/securesms/database/ApplicationExporter.java +++ b/src/org/thoughtcrime/securesms/database/ApplicationExporter.java @@ -60,14 +60,18 @@ public class ApplicationExporter { throw new NoExternalStorageException(); } - private static void migrateFile(File from, File to) throws IOException { - if (from.exists()) { - FileChannel source = new FileInputStream(from).getChannel(); - FileChannel destination = new FileOutputStream(to).getChannel(); + private static void migrateFile(File from, File to) { + try { + if (from.exists()) { + FileChannel source = new FileInputStream(from).getChannel(); + FileChannel destination = new FileOutputStream(to).getChannel(); - destination.transferFrom(source, 0, source.size()); - source.close(); - destination.close(); + destination.transferFrom(source, 0, source.size()); + source.close(); + destination.close(); + } + } catch (IOException ioe) { + Log.w("ApplicationExporter", ioe); } } @@ -104,9 +108,7 @@ public class ApplicationExporter { File[] contents = directory.listFiles(); - for (int i=0;i