Skip to content
This repository was archived by the owner on Mar 11, 2022. It is now read-only.

Commit 3f1a426

Browse files
authored
Merge pull request #532 from cloudant/530-make-android-jar-dependency-compile-only
Make android jar dependency compileOnly
2 parents 66bec47 + 4f664e5 commit 3f1a426

File tree

3 files changed

+14
-10
lines changed

3 files changed

+14
-10
lines changed

CHANGES.md

+6
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
# 2.0.2 (Unreleased)
2+
- [FIXED] Removed cloudant-sync-datastore-android project's dependency
3+
on com.google.android:android. This dependency was inadvertently
4+
made a run-time dependency where it should have been a build-time
5+
dependency.
6+
17
# 2.0.1 (2017-04-26)
28
- [IMPROVED] Increased the resilience of replication to network failures.
39
- [FIXED] NPE when accessing indexes created in earlier versions that were

cloudant-sync-datastore-android/build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
dependencies {
22
compile project(':cloudant-sync-datastore-core')
33

4-
compile group: 'com.google.android', name: 'android', version:'4.0.1.2'
4+
compileOnly group: 'com.google.android', name: 'android', version:'4.0.1.2'
55

66
// for unit tests
77
testCompile 'org.hamcrest:hamcrest-all:1.3'

cloudant-sync-datastore-core/src/test/java/com/cloudant/sync/internal/mazha/ClientTestUtils.java

+7-9
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,13 @@
2626
import com.cloudant.sync.internal.common.CouchUtils;
2727
import com.cloudant.http.Http;
2828
import com.cloudant.http.HttpConnection;
29+
import com.cloudant.sync.internal.util.JSONUtils;
2930

3031
import org.apache.commons.io.IOUtils;
31-
import org.json.JSONArray;
32-
import org.json.JSONObject;
33-
import org.json.JSONTokener;
3432
import org.junit.Assert;
3533

3634
import java.io.InputStream;
35+
import java.io.InputStreamReader;
3736
import java.net.URI;
3837
import java.util.ArrayList;
3938
import java.util.HashMap;
@@ -225,13 +224,12 @@ public static List<String> getRemoteRevisionIDs(URI uri, CouchConfig config) thr
225224
connection.responseInterceptors.addAll(config.getResponseInterceptors());
226225
InputStream in = connection.execute().responseAsInputStream();
227226

228-
JSONObject jsonObject = new JSONObject(new JSONTokener(IOUtils.toString(in)));
229-
JSONArray revsInfo = jsonObject.getJSONArray("_revs_info");
227+
Map<String, Object> m = JSONUtils.fromJson(new InputStreamReader(in));
228+
List<Object> revsInfo = (List<Object>)m.get("_revs_info");
229+
List<String> revisions = new ArrayList<String>(revsInfo.size());
230230

231-
List<String> revisions = new ArrayList<String>(revsInfo.length());
232-
233-
for(int i=0; i<revsInfo.length(); i++){
234-
revisions.add(revsInfo.getJSONObject(i).getString("rev"));
231+
for(Object rev : revsInfo){
232+
revisions.add(((Map<String, String>)rev).get("rev"));
235233
}
236234

237235
return revisions;

0 commit comments

Comments
 (0)