Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix unhandeld SQLiteException #214

Merged
merged 6 commits into from
Sep 17, 2024
Merged
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions core/src/main/java/io/snabble/sdk/ProductDatabase.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.database.Cursor;
import android.database.sqlite.SQLiteCantOpenDatabaseException;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteException;
import android.os.CancellationSignal;
Expand Down Expand Up @@ -336,9 +335,12 @@ synchronized void applyDeltaUpdate(InputStream inputStream) throws IOException {
}
final SQLiteDatabase tempDb;

if (!tempDbFile.canRead() || !tempDbFile.canWrite())
throw new IOException("TempDbFile cannot be read and/or written.");

try {
tempDb = SQLiteDatabase.openOrCreateDatabase(tempDbFile, null);
} catch (SQLiteCantOpenDatabaseException e) {
} catch (SQLiteException e) {
project.logErrorEvent("Could not open or create db: %s", e.getMessage());
throw new IOException("Could not open or create db", e);
}
Expand Down
Loading