Skip to content

Commit 951b1d8

Browse files
committed
Fix an NPE wrt missing charset for netty
1 parent 4b2d2d5 commit 951b1d8

File tree

2 files changed

+3
-6
lines changed

2 files changed

+3
-6
lines changed

src/main/java/com/ning/http/client/providers/netty/NettyAsyncHttpProvider.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -856,12 +856,6 @@ public <T> ListenableFuture<T> execute(Request request, final AsyncHandler<T> as
856856
return doConnect(request, asyncHandler, null, true, executeConnectAsync, false);
857857
}
858858

859-
/*
860-
private <T> void execute(final Request request, final NettyResponseFuture<T> f, boolean useCache, boolean asyncConnect) throws IOException {
861-
doConnect(request, f.getAsyncHandler(), f, useCache, asyncConnect, false);
862-
}
863-
*/
864-
865859
private <T> void execute(final Request request, final NettyResponseFuture<T> f, boolean useCache, boolean asyncConnect, boolean reclaimCache) throws IOException {
866860
doConnect(request, f.getAsyncHandler(), f, useCache, asyncConnect, reclaimCache);
867861
}

src/main/java/com/ning/http/client/providers/netty/NettyResponse.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,9 @@ public String getResponseBodyExcerpt(int maxLength) throws IOException {
4848
public String getResponseBodyExcerpt(int maxLength, String charset) throws IOException {
4949
// should be fine; except that it may split multi-byte chars (last char may become '?')
5050
byte[] b = AsyncHttpProviderUtils.contentToBytes(bodyParts, maxLength);
51+
if (charset == null) {
52+
charset = DEFAULT_CHARSET;
53+
}
5154
return new String(b, charset);
5255
}
5356

0 commit comments

Comments
 (0)