catch cursor window allocation exception
This commit is contained in:
parent
09f9baeeef
commit
6d67854086
|
@ -647,18 +647,24 @@ public class DatabaseBackend extends SQLiteOpenHelper {
|
||||||
db.insert(RESOLVER_RESULTS_TABLENAME, null, contentValues);
|
db.insert(RESOLVER_RESULTS_TABLENAME, null, contentValues);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Resolver.Result findResolverResult(String domain) {
|
public synchronized Resolver.Result findResolverResult(String domain) {
|
||||||
SQLiteDatabase db = this.getReadableDatabase();
|
SQLiteDatabase db = this.getReadableDatabase();
|
||||||
String where = Resolver.Result.DOMAIN + "=?";
|
String where = Resolver.Result.DOMAIN + "=?";
|
||||||
String[] whereArgs = {domain};
|
String[] whereArgs = {domain};
|
||||||
final Cursor cursor = db.query(RESOLVER_RESULTS_TABLENAME, null, where, whereArgs, null, null, null);
|
final Cursor cursor = db.query(RESOLVER_RESULTS_TABLENAME, null, where, whereArgs, null, null, null);
|
||||||
Resolver.Result result = null;
|
Resolver.Result result = null;
|
||||||
if (cursor != null) {
|
if (cursor != null) {
|
||||||
|
try {
|
||||||
if (cursor.moveToFirst()) {
|
if (cursor.moveToFirst()) {
|
||||||
result = Resolver.Result.fromCursor(cursor);
|
result = Resolver.Result.fromCursor(cursor);
|
||||||
}
|
}
|
||||||
|
} catch (Exception e ) {
|
||||||
|
Log.d(Config.LOGTAG,"unable to find cached resolver result in database "+e.getMessage());
|
||||||
|
return null;
|
||||||
|
} finally {
|
||||||
cursor.close();
|
cursor.close();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue