Skip to content

Commit 6c556c8

Browse files
author
Stephane Landelle
committed
Fix charset computation when it's not specified in contentType
1 parent b514542 commit 6c556c8

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

api/src/main/java/com/ning/http/client/providers/ResponseBase.java

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -109,16 +109,12 @@ public List<Cookie> getCookies() {
109109

110110
protected String calculateCharset(String charset) {
111111

112-
if (charset == null) {
113-
String contentType = getContentType();
114-
if (contentType != null) {
115-
charset = AsyncHttpProviderUtils.parseCharset(contentType);
116-
} else {
117-
charset = DEFAULT_CHARSET;
118-
}
119-
}
120-
121-
return charset;
112+
if (charset == null) {
113+
String contentType = getContentType();
114+
if (contentType != null)
115+
charset = AsyncHttpProviderUtils.parseCharset(contentType); // parseCharset can return null
116+
}
117+
return charset != null? charset: DEFAULT_CHARSET;
122118
}
123119

124120
public boolean hasResponseStatus() {

0 commit comments

Comments
 (0)