[Android] Try/Catch exception around drop tables creation
Jean-Baptiste Kempf
git at videolan.org
Sat Mar 14 16:05:42 CET 2015
vlc-ports/android | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Sat Mar 14 15:34:18 2015 +0100| [cad2c1896680da6e589821c5647dd5851d9eafd0] | committer: Jean-Baptiste Kempf
Try/Catch exception around drop tables creation
They might not have been correctly created. Crashing is not OK for that.
> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=cad2c1896680da6e589821c5647dd5851d9eafd0
---
.../src/org/videolan/vlc/MediaDatabase.java | 30 ++++++++++++++------
1 file changed, 22 insertions(+), 8 deletions(-)
diff --git a/vlc-android/src/org/videolan/vlc/MediaDatabase.java b/vlc-android/src/org/videolan/vlc/MediaDatabase.java
index 62a774e..d171d53 100644
--- a/vlc-android/src/org/videolan/vlc/MediaDatabase.java
+++ b/vlc-android/src/org/videolan/vlc/MediaDatabase.java
@@ -161,10 +161,15 @@ public class MediaDatabase {
}
public void dropMediaTableQuery(SQLiteDatabase db) {
- String query = "DROP TABLE " + MEDIA_TABLE_NAME + ";";
- db.execSQL(query);
- query = "DROP TABLE " + MEDIA_VIRTUAL_TABLE_NAME + ";";
- db.execSQL(query);
+ try {
+ String query = "DROP TABLE " + MEDIA_TABLE_NAME + ";";
+ db.execSQL(query);
+ query = "DROP TABLE " + MEDIA_VIRTUAL_TABLE_NAME + ";";
+ db.execSQL(query);
+ } catch(SQLiteException e)
+ {
+ Log.w(TAG, "SQLite tables could not be dropped! Maybe they were missing...");
+ }
}
public void createMediaTableQuery(SQLiteDatabase db) {
@@ -247,8 +252,13 @@ public class MediaDatabase {
}
public void dropMRLTableQuery(SQLiteDatabase db) {
- String query = "DROP TABLE " + MRL_TABLE_NAME + ";";
- db.execSQL(query);
+ try {
+ String query = "DROP TABLE " + MRL_TABLE_NAME + ";";
+ db.execSQL(query);
+ } catch(SQLiteException e)
+ {
+ Log.w(TAG, "SQLite tables could not be dropped! Maybe they were missing...");
+ }
}
private void createNetworkFavTableQuery(SQLiteDatabase db) {
@@ -261,8 +271,12 @@ public class MediaDatabase {
}
public void dropNetworkFavTableQuery(SQLiteDatabase db) {
- String query = "DROP TABLE " + NETWORK_FAV_TABLE_NAME + ";";
- db.execSQL(query);
+ try {
+ String query = "DROP TABLE " + NETWORK_FAV_TABLE_NAME + ";";
+ db.execSQL(query);
+ } catch(SQLiteException e) {
+ Log.w(TAG, "SQLite tables could not be dropped! Maybe they were missing...");
+ }
}
@Override
More information about the Android
mailing list