diff --git a/CHANGELOG.md b/CHANGELOG.md index d2286527c..2f6eabe02 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,14 +3,11 @@ ------------------------------------------------------------------------------------------------------------- -# 6.0.0-M17 (2024-10-09) - -### 计划实现 -* 【db 】 增加DDL封装 -* 【db 】 Entity数据量大时占用较多内存,考虑共享meta信息 +# 7.0.0-M1 (2025-05-07) ### ❌不兼容特性 ### 🐣新特性 -### 🐞Bug修复 \ No newline at end of file +### 🐞Bug修复 +* 【http】 修复`HttpClient5Response`无响应体导致的空指针问题(issue#3930@Github) \ No newline at end of file diff --git a/hutool-http/src/main/java/cn/hutool/v7/http/client/engine/httpclient5/HttpClient5Response.java b/hutool-http/src/main/java/cn/hutool/v7/http/client/engine/httpclient5/HttpClient5Response.java index c81979495..d56fa1e4a 100644 --- a/hutool-http/src/main/java/cn/hutool/v7/http/client/engine/httpclient5/HttpClient5Response.java +++ b/hutool-http/src/main/java/cn/hutool/v7/http/client/engine/httpclient5/HttpClient5Response.java @@ -96,7 +96,7 @@ public class HttpClient5Response extends SimpleWrapper impl @Override public long contentLength() { - return this.entity.getContentLength(); + return null == this.entity ? -1 : this.entity.getContentLength(); } @Override @@ -106,6 +106,9 @@ public class HttpClient5Response extends SimpleWrapper impl @Override public InputStream bodyStream() { + if(null == this.entity){ + return null; + } try { return this.entity.getContent(); } catch (final IOException e) { @@ -130,6 +133,9 @@ public class HttpClient5Response extends SimpleWrapper impl @Override public String bodyStr() throws HttpException { + if(null == this.entity){ + return null; + } try { return EntityUtils.toString(this.entity, charset()); } catch (final IOException e) {