mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-05-09 23:51:34 +08:00
修复HttpClient5Response
无响应体导致的空指针问题(issue#3930@Github)
This commit is contained in:
parent
3658d9f7ca
commit
4aea2ef471
@ -3,11 +3,7 @@
|
|||||||
|
|
||||||
-------------------------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
# 6.0.0-M17 (2024-10-09)
|
# 6.0.0-M22 (2025-05-07)
|
||||||
|
|
||||||
### 计划实现
|
|
||||||
* 【db 】 增加DDL封装
|
|
||||||
* 【db 】 Entity数据量大时占用较多内存,考虑共享meta信息
|
|
||||||
|
|
||||||
### ❌不兼容特性
|
### ❌不兼容特性
|
||||||
|
|
||||||
|
@ -96,7 +96,7 @@ public class HttpClient5Response extends SimpleWrapper<ClassicHttpResponse> impl
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public long contentLength() {
|
public long contentLength() {
|
||||||
return this.entity.getContentLength();
|
return null == this.entity ? -1 : this.entity.getContentLength();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -106,6 +106,9 @@ public class HttpClient5Response extends SimpleWrapper<ClassicHttpResponse> impl
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public InputStream bodyStream() {
|
public InputStream bodyStream() {
|
||||||
|
if(null == this.entity){
|
||||||
|
return null;
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
return this.entity.getContent();
|
return this.entity.getContent();
|
||||||
} catch (final IOException e) {
|
} catch (final IOException e) {
|
||||||
@ -130,6 +133,9 @@ public class HttpClient5Response extends SimpleWrapper<ClassicHttpResponse> impl
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String bodyStr() throws HttpException {
|
public String bodyStr() throws HttpException {
|
||||||
|
if(null == this.entity){
|
||||||
|
return null;
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
return EntityUtils.toString(this.entity, charset());
|
return EntityUtils.toString(this.entity, charset());
|
||||||
} catch (final IOException e) {
|
} catch (final IOException e) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user