Skip to content

Commit 1dd0737

Browse files
author
Christopher J. Brody
committed
Resolve Java 6/7/8 concurrent map compatibility & cleanup imports for Android
FIXES storesafe#726 (keySet error) THANKS to @NeoLSN (Jason Yang/楊朝傑) for pointer to the solution in storesafe#727
1 parent bed8560 commit 1dd0737

File tree

5 files changed

+23
-14
lines changed

5 files changed

+23
-14
lines changed

CHANGES.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# Changes
22

3-
###### cordova-sqlite-legacy-express-core 1.0.3-pre01
3+
###### cordova-sqlite-legacy-express-core 1.0.3
44

5-
TBD
5+
- Resolved Java 6/7/8 concurrent map compatibility issue reported in litehelpers/Cordova-sqlite-storage#726, THANKS to pointer by @NeoLSN (Jason Yang/楊朝傑) in litehelpers/Cordova-sqlite-storage#727.
66

77
###### cordova-sqlite-legacy-express-core 1.0.2
88

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ Use the `location` or `iosDatabaseLocation` option in `sqlitePlugin.openDatabase
7272

7373
## Announcements
7474

75+
- Resolved Java 6/7/8 concurrent map compatibility issue reported in [litehelpers/Cordova-sqlite-storage#726](https://github.com/litehelpers/Cordova-sqlite-storage/issues/726), THANKS to pointer by [@NeoLSN (Jason Yang/楊朝傑)](https://github.com/NeoLSN) in [litehelpers/Cordova-sqlite-storage#727](https://github.com/litehelpers/Cordova-sqlite-storage/issues/727).
7576
- Fixed iOS/macOS platform version to use [PSPDFThreadSafeMutableDictionary.m](https://gist.github.com/steipete/5928916) to avoid threading issue ref: [litehelpers/Cordova-sqlite-storage#716](https://github.com/litehelpers/Cordova-sqlite-storage/issues/716)
7677
- Resolved transaction problem after window.location (page) change with possible data loss ref: [litehelpers/Cordova-sqlite-storage#666](https://github.com/litehelpers/Cordova-sqlite-storage/issues/666)
7778
- [brodybits / cordova-sqlite-test-app](https://github.com/brodybits/cordova-sqlite-test-app) project is a CC0 (public domain) starting point (NOTE that this plugin must be added) and may also be used to reproduce issues with this plugin.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "cordova-sqlite-legacy-express-core",
3-
"version": "1.0.3-pre01",
3+
"version": "1.0.3",
44
"description": "Native interface to SQLite for PhoneGap/Cordova (legacy express core version)",
55
"cordova": {
66
"id": "cordova-sqlite-legacy-express-core",

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-legacy-express-core"
5-
version="1.0.3-pre01">
5+
version="1.0.3">
66

77
<name>Cordova sqlite storage plugin - legacy express core version</name>
88

src/android/io/sqlc/SQLitePlugin.java

+18-10
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,18 @@
88

99
import android.annotation.SuppressLint;
1010

11-
import android.util.Base64;
1211
import android.util.Log;
1312

1413
import java.io.File;
14+
1515
import java.lang.IllegalArgumentException;
1616
import java.lang.Number;
17-
import java.util.concurrent.ConcurrentHashMap;
17+
18+
import java.util.Map;
1819
import java.util.concurrent.BlockingQueue;
20+
import java.util.concurrent.ConcurrentHashMap;
1921
import java.util.concurrent.LinkedBlockingQueue;
22+
2023
import java.util.regex.Matcher;
2124
import java.util.regex.Pattern;
2225

@@ -27,19 +30,24 @@
2730
import org.json.JSONException;
2831
import org.json.JSONObject;
2932

30-
import java.io.FileOutputStream;
31-
import java.io.InputStream;
32-
import java.io.OutputStream;
33-
import java.io.IOException;
34-
3533
public class SQLitePlugin extends CordovaPlugin {
3634

3735
/**
3836
* Multiple database runner map (static).
39-
* NOTE: no public static accessor to db (runner) map since it would not work with db threading.
40-
* FUTURE put DBRunner into a public class that can provide external accessor.
37+
*
38+
* NOTE: no public static accessor to db (runner) map since it is not
39+
* expected to work properly with db threading.
40+
*
41+
* FUTURE TBD put DBRunner into a public class that can provide external accessor.
42+
*
43+
* ADDITIONAL NOTE: Storing as Map<String, DBRunner> to avoid portabiity issue
44+
* between Java 6/7/8 as discussed in:
45+
* https://gist.github.com/AlainODea/1375759b8720a3f9f094
46+
*
47+
* THANKS to @NeoLSN (Jason Yang/楊朝傑) for giving the pointer in:
48+
* https://github.com/litehelpers/Cordova-sqlite-storage/issues/727
4149
*/
42-
static ConcurrentHashMap<String, DBRunner> dbrmap = new ConcurrentHashMap<String, DBRunner>();
50+
static Map<String, DBRunner> dbrmap = new ConcurrentHashMap<String, DBRunner>();
4351

4452
/**
4553
* NOTE: Using default constructor, no explicit constructor.

0 commit comments

Comments
 (0)