1
0
mirror of https://gitee.com/dromara/hutool.git synced 2025-04-05 17:37:59 +08:00

修复StrJoin当append内容后调用length()会出现空指针问题

This commit is contained in:
Looly 2023-12-26 00:41:06 +08:00
parent 99303ef7e0
commit ab1b2c5e48
4 changed files with 18 additions and 4 deletions
CHANGELOG.md
bin
hutool-core/src
main/java/cn/hutool/core/text
test/java/cn/hutool/core/text

View File

@ -2,10 +2,11 @@
# 🚀Changelog
-------------------------------------------------------------------------------------------------------------
# 5.8.25(2023-12-24)
# 5.8.25(2023-12-26)
### 🐣新特性
### 🐞Bug修复
* 【core 】 修复StrJoin当append内容后调用length()会出现空指针问题issue#3444@Github
-------------------------------------------------------------------------------------------------------------
# 5.8.24(2023-12-23)
@ -23,7 +24,7 @@
* 【http 】 HTMLFilter保留p标签issue#3433@Gitee
### 🐞Bug修复
* 【core 】 修复LocalDateTime#parseDate未判断空问题问题issue#I8FN7F@Gitee
* 【core 】 修复LocalDateTime#parseDate未判断空问题issue#I8FN7F@Gitee
* 【http 】 修复RootAction send404 抛异常问题pr#1107@Gitee
* 【extra 】 修复Archiver 最后一个 Entry 为空文件夹时未关闭 Entry问题pr#1123@Gitee
* 【core 】 修复ImgUtil.convert png转jpg在jdk9+中失败问题issue#I8L8UA@Gitee
@ -33,7 +34,7 @@
* 【http 】 修复graalvm编译后未读取Content-Length可能导致的读取时间过长问题issue#I6Q30X@Gitee
* 【core 】 修复JavaSourceCompiler.addSource目录处理错误问题issue#3425@Github
* 【core 】 修复时间戳转Bean时异常问题issue#I8NMP7@Gitee
* 【core 】 修复PostgreSQL使用upsert字段大小写问题问题issue#I8PB4X@Gitee
* 【core 】 修复PostgreSQL使用upsert字段大小写问题issue#I8PB4X@Gitee
* 【extra 】 修复TinyPinyinEngine可能的空指针问题issue#3437@Github
* 【core 】 修复graalvm原生打包使用http工具被转为file协议问题issue#I8PY3Y@Gitee
* 【poi 】 修复cloneSheet参数错误导致非XSSFWorkbook错误命名问题issue#I8QIBB@Gitee

4
bin/sync.sh Normal file
View File

@ -0,0 +1,4 @@
#!/bin/bash
git checkout v5-dev
git pull osc v5-dev

View File

@ -357,7 +357,7 @@ public class StrJoiner implements Appendable, Serializable {
* @since 5.7.22
*/
public int length() {
return (this.appendable != null ? this.appendable.toString().length() + suffix.length() :
return (this.appendable != null ? this.appendable.toString().length() + StrUtil.length(suffix) :
null == this.emptyResult ? -1 : emptyResult.length());
}

View File

@ -99,4 +99,13 @@ public class StrJoinerTest {
final StrJoiner merge = joiner1.merge(joiner2);
Assert.assertEquals("[123,456,789]", merge.toString());
}
@Test
public void issue3444Test() {
final StrJoiner strJoinerEmpty = StrJoiner.of(",");
Assert.assertEquals(0, strJoinerEmpty.length());
final StrJoiner strJoinerWithContent = StrJoiner.of(",").append("haha");
Assert.assertEquals(4, strJoinerWithContent.length());
}
}