Prevent crash from strange SQLite error

Full fix may require packaging and using our own SQLite via JNI. Needs
further investigation.

Fixes #2506
Closes #2843

// FREEBIE
This commit is contained in:
Jake McGinty 2015-03-31 15:49:30 -07:00 committed by Moxie Marlinspike
parent 0ff99258ac
commit 6c59eb052e

View file

@ -20,6 +20,7 @@ import android.content.Context;
import android.content.res.AssetManager;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteException;
import android.text.TextUtils;
import android.util.Log;
@ -89,9 +90,13 @@ public class ApnDatabase {
Util.copy(context.getAssets().open(ASSET_PATH, AssetManager.ACCESS_STREAMING),
new FileOutputStream(dbFile));
this.db = SQLiteDatabase.openDatabase(context.getDatabasePath(DATABASE_NAME).getPath(),
null,
SQLiteDatabase.OPEN_READONLY | SQLiteDatabase.NO_LOCALIZED_COLLATORS);
try {
this.db = SQLiteDatabase.openDatabase(context.getDatabasePath(DATABASE_NAME).getPath(),
null,
SQLiteDatabase.OPEN_READONLY | SQLiteDatabase.NO_LOCALIZED_COLLATORS);
} catch (SQLiteException e) {
throw new IOException(e);
}
}
private Apn getCustomApnParameters() {