Skip to content

Commit 70eaa9d

Browse files
author
Christopher J. Brody
committed
Ignore Android end transaction error when closing
for androidDatabaseProvider: 'system' setting, to avoid possible crash during app shutdown (cordova-sqlite-storage 2.5.2) Resolves #833
1 parent af805c9 commit 70eaa9d

File tree

4 files changed

+12
-3
lines changed

4 files changed

+12
-3
lines changed

CHANGES.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changes
22

3+
### cordova-sqlite-storage 2.5.2
4+
5+
- Ignore Android end transaction error when closing for androidDatabaseProvider: 'system' setting, to avoid possible crash during app shutdown (<https://github.com/litehelpers/Cordova-sqlite-storage/issues/833>)
6+
37
### cordova-sqlite-storage 2.5.1
48

59
- fix internal plugin cleanup error log on Android

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "cordova-sqlite-storage",
3-
"version": "2.5.1",
3+
"version": "2.5.2",
44
"description": "Native interface to SQLite for PhoneGap/Cordova",
55
"cordova": {
66
"id": "cordova-sqlite-storage",

plugin.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<plugin xmlns="http://www.phonegap.com/ns/plugins/1.0"
33
xmlns:android="http://schemas.android.com/apk/res/android"
44
id="cordova-sqlite-storage"
5-
version="2.5.1">
5+
version="2.5.2">
66

77
<name>Cordova sqlite storage plugin</name>
88

src/android/io/sqlc/SQLiteAndroidDatabase.java

+6-1
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,12 @@ void open(File dbfile) throws Exception {
8080
void closeDatabaseNow() {
8181
if (mydb != null) {
8282
if (isTransactionActive) {
83-
mydb.endTransaction();
83+
try {
84+
mydb.endTransaction();
85+
} catch (Exception ex) {
86+
Log.v("closeDatabaseNow", "INTERNAL PLUGIN ERROR IGNORED: Not able to end active transaction before closing database: " + ex.getMessage());
87+
ex.printStackTrace();
88+
}
8489
isTransactionActive = false;
8590
}
8691
mydb.close();

0 commit comments

Comments
 (0)