Skip to content

Commit 1bb1124

Browse files
authored
Fix unhandeld SQLiteException (#214)
1 parent 5433a09 commit 1bb1124

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ All notable changes to this project will be documented in this file.
88
### Fixed
99
* ui: subject dialog for external billing now works in dark mode
1010
* ui: external billing icon works with dark mode now
11+
* core: prevent SQLiteLockedException and recover from it on product database update
1112

1213
## [0.75.7]
1314
### Added

core/src/main/java/io/snabble/sdk/ProductDatabase.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
import android.content.pm.PackageInfo;
77
import android.content.pm.PackageManager;
88
import android.database.Cursor;
9-
import android.database.sqlite.SQLiteCantOpenDatabaseException;
109
import android.database.sqlite.SQLiteDatabase;
1110
import android.database.sqlite.SQLiteException;
1211
import android.os.CancellationSignal;
@@ -336,9 +335,12 @@ synchronized void applyDeltaUpdate(InputStream inputStream) throws IOException {
336335
}
337336
final SQLiteDatabase tempDb;
338337

338+
if (!tempDbFile.canRead() || !tempDbFile.canWrite())
339+
throw new IOException("TempDbFile cannot be read and/or written.");
340+
339341
try {
340342
tempDb = SQLiteDatabase.openOrCreateDatabase(tempDbFile, null);
341-
} catch (SQLiteCantOpenDatabaseException e) {
343+
} catch (SQLiteException e) {
342344
project.logErrorEvent("Could not open or create db: %s", e.getMessage());
343345
throw new IOException("Could not open or create db", e);
344346
}

0 commit comments

Comments
 (0)