Skip to content

Commit 2bfe14f

Browse files
committed
fix NPE in Apache HTTP client in case of empty body in HTTP response (e.g. with 204 response code) (thanks to https://github.com/SainagNeelamPatnaik)
1 parent 85f93a2 commit 2bfe14f

File tree

4 files changed

+7
-4
lines changed

4 files changed

+7
-4
lines changed

changelog

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
[SNAPSHOT]
22
* support TLS 1.3 in JDK 11 for Salesforce
3+
* fix NPE in Apache HTTP client in case of empty body in HTTP response (e.g. with 204 response code) (thanks to https://github.com/SainagNeelamPatnaik)
34

45
[6.3.0]
56
* fix Muplipart request model and implement it for a jdk HTTP client (thanks to https://github.com/NTPape)

pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@
107107
<dependency>
108108
<groupId>com.puppycrawl.tools</groupId>
109109
<artifactId>checkstyle</artifactId>
110-
<version>8.17</version>
110+
<version>8.18</version>
111111
</dependency>
112112
</dependencies>
113113
</plugin>
@@ -188,7 +188,7 @@
188188
<plugin>
189189
<groupId>org.apache.maven.plugins</groupId>
190190
<artifactId>maven-javadoc-plugin</artifactId>
191-
<version>3.0.1</version>
191+
<version>3.1.0</version>
192192
<configuration>
193193
<javadocExecutable>${java.home}/bin/javadoc</javadocExecutable>
194194
<encoding>UTF-8</encoding>

scribejava-httpclient-ahc/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
<dependency>
2424
<groupId>org.asynchttpclient</groupId>
2525
<artifactId>async-http-client</artifactId>
26-
<version>2.7.0</version>
26+
<version>2.8.1</version>
2727
</dependency>
2828
<dependency>
2929
<groupId>com.github.scribejava</groupId>

scribejava-httpclient-apache/src/main/java/com/github/scribejava/httpclient/apache/OAuthAsyncCompletionHandler.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
import com.github.scribejava.core.model.OAuthRequest.ResponseConverter;
1818
import com.github.scribejava.core.model.Response;
1919
import java.io.IOException;
20+
import org.apache.http.HttpEntity;
2021

2122
public class OAuthAsyncCompletionHandler<T> implements FutureCallback<HttpResponse> {
2223

@@ -42,8 +43,9 @@ public void completed(HttpResponse httpResponse) {
4243

4344
final StatusLine statusLine = httpResponse.getStatusLine();
4445

46+
final HttpEntity httpEntity = httpResponse.getEntity();
4547
final Response response = new Response(statusLine.getStatusCode(), statusLine.getReasonPhrase(), headersMap,
46-
httpResponse.getEntity().getContent());
48+
httpEntity == null ? null : httpEntity.getContent());
4749

4850
@SuppressWarnings("unchecked")
4951
final T t = converter == null ? (T) response : converter.convert(response);

0 commit comments

Comments
 (0)