Skip to content

Commit

Permalink
Resolve Java 6/7/8 concurrent map compatibility & cleanup imports for…
Browse files Browse the repository at this point in the history
… Android

FIXES #726 (keySet error)

THANKS to @NeoLSN (Jason Yang/楊朝傑) for pointer to the solution in
#727
  • Loading branch information
Christopher J. Brody committed Dec 10, 2017
1 parent b656b89 commit 4c7b59c
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 13 deletions.
3 changes: 2 additions & 1 deletion CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# Changes

###### cordova-sqlite-legacy-express-core 1.0.3-pre02
###### cordova-sqlite-legacy-express-core 1.0.3

- Resolve 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.
- selfTest database cleanup do not ignore close or delete error on any platforms

###### cordova-sqlite-legacy-express-core 1.0.2
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ Use the `location` or `iosDatabaseLocation` option in `sqlitePlugin.openDatabase

## Announcements

- 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).
- 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)
- 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)
- [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.
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cordova-sqlite-legacy-express-core",
"version": "1.0.3-pre02",
"version": "1.0.3",
"description": "Native interface to SQLite for PhoneGap/Cordova (legacy express core version)",
"cordova": {
"id": "cordova-sqlite-legacy-express-core",
Expand Down
2 changes: 1 addition & 1 deletion plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<plugin xmlns="http://www.phonegap.com/ns/plugins/1.0"
xmlns:android="http://schemas.android.com/apk/res/android"
id="cordova-sqlite-legacy-express-core"
version="1.0.3-pre02">
version="1.0.3">

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

Expand Down
28 changes: 18 additions & 10 deletions src/android/io/sqlc/SQLitePlugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,18 @@

import android.annotation.SuppressLint;

import android.util.Base64;
import android.util.Log;

import java.io.File;

import java.lang.IllegalArgumentException;
import java.lang.Number;
import java.util.concurrent.ConcurrentHashMap;

import java.util.Map;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.LinkedBlockingQueue;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

Expand All @@ -27,19 +30,24 @@
import org.json.JSONException;
import org.json.JSONObject;

import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.IOException;

public class SQLitePlugin extends CordovaPlugin {

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

/**
* NOTE: Using default constructor, no explicit constructor.
Expand Down

0 comments on commit 4c7b59c

Please sign in to comment.