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

Commit 179fed0

Browse files
committed
Upgrade optional OkHttp dependency to version 3.12.2.
- Fixed FindBugs error by removing conditional block that checks if route.proxy is null
1 parent ac6e7ec commit 179fed0

5 files changed

Lines changed: 13 additions & 15 deletions

File tree

CHANGES.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# Unreleased
2+
- [UPGRADED] Optional OkHttp dependency to version 3.12.2.
3+
14
# 2.17.0 (2019-05-23)
25
- [NEW] Added `com.cloudant.client.api.model.DbInfo#getDocDelCountLong()` to return
36
deleted document count as a `long` instead of a `String`.

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ Gradle with [optional `okhttp-urlconnection` dependency](#optional-okhttp-depend
3030
```groovy
3131
dependencies {
3232
compile group: 'com.cloudant', name: 'cloudant-client', version: '2.17.0'
33-
compile group: 'com.squareup.okhttp3', name: 'okhttp-urlconnection', version: '3.8.1'
33+
compile group: 'com.squareup.okhttp3', name: 'okhttp-urlconnection', version: '3.12.2'
3434
}
3535
```
3636

@@ -55,7 +55,7 @@ Maven with [optional `okhttp-urlconnection` dependency](#optional-okhttp-depende
5555
<dependency>
5656
<groupId>com.squareup.okhttp3</groupId>
5757
<artifactId>okhttp-urlconnection</artifactId>
58-
<version>3.8.1</version>
58+
<version>3.12.2</version>
5959
</dependency>
6060
~~~
6161

cloudant-client/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ dependencies {
2828
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.1.0'
2929
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.1.0'
3030
testCompile group: 'org.hamcrest', name: 'hamcrest-library', version: '1.3'
31-
testCompile group: 'com.squareup.okhttp3', name: 'mockwebserver', version: '3.8.1'
31+
testCompile group: 'com.squareup.okhttp3', name: 'mockwebserver', version: '3.12.2'
3232
testCompile group: 'org.jmockit', name: 'jmockit', version: '1.34'
3333
testCompile group: 'org.littleshoot', name: 'littleproxy', version: '1.1.0'
3434
}

cloudant-http/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
dependencies {
1616
compile group: 'commons-io', name: 'commons-io', version: '2.4'
1717
//needed to compile, but optional for consumers of java-cloudant
18-
compile(group: 'com.squareup.okhttp3', name: 'okhttp-urlconnection', version: '3.8.1') {
18+
compile(group: 'com.squareup.okhttp3', name: 'okhttp-urlconnection', version: '3.12.2') {
1919
ext.optional = true
2020
}
2121
}

cloudant-http/src/main/java/com/cloudant/http/internal/ok/ProxyAuthenticator.java

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright © 2016 IBM Corp. All rights reserved.
2+
* Copyright © 2016, 2019 IBM Corp. All rights reserved.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
55
* except in compliance with the License. You may obtain a copy of the License at
@@ -33,17 +33,12 @@ class ProxyAuthenticator implements Authenticator {
3333

3434
@Override
3535
public Request authenticate(Route route, Response response) throws IOException {
36-
if (route.proxy() != null) {
37-
if (creds.equals(response.request().header("Proxy-Authorization"))) {
38-
// If the proxy creds have already been tried then give up
39-
return null;
40-
} else {
41-
return response.request().newBuilder().addHeader(ProxyAuthInterceptor
42-
.PROXY_AUTH_HEADER, creds).build();
43-
}
44-
} else {
45-
// Don't interfere with normal Auth, this is just for proxies
36+
if (creds.equals(response.request().header("Proxy-Authorization"))) {
37+
// If the proxy creds have already been tried then give up
4638
return null;
39+
} else {
40+
return response.request().newBuilder().addHeader(ProxyAuthInterceptor
41+
.PROXY_AUTH_HEADER, creds).build();
4742
}
4843
}
4944
}

0 commit comments

Comments
 (0)