mirror of
https://gitee.com/dromara/hutool.git
synced 2025-10-07 23:24:43 +08:00
Merge branch 'chinabugotech:v5-dev' into v5-dev
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
# 🚀Changelog
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
# 5.8.41(2025-09-16)
|
||||
# 5.8.41(2025-09-28)
|
||||
|
||||
### 🐣新特性
|
||||
* 【core 】 增加`WeakKeyValueConcurrentMap`及其关联类,同时废弃`WeakConcurrentMap`并替换(issue#4039@Github)
|
||||
@@ -18,6 +18,9 @@
|
||||
* 【extra 】 `Mail.buildContent`改进,正文部分总在最前(issue#4072@Github)
|
||||
* 【core 】 `DataSizeUtil`改进,兼容`GiB`等单位名称(issue#ICXXVF@Github)
|
||||
* 【ai 】 `Message`增加setter和构造方法(issue#ICXTP2@Gitee)
|
||||
* 【extra 】 `PinyinUtil`增加判空(pr#4081@Github)
|
||||
* 【core 】 `LocalDateTimeUtil.parseDate`注释修正(pr#4085@Github)
|
||||
* 【core 】 `StrUtil`增加null检查处理(pr#4086@Github)
|
||||
|
||||
### 🐞Bug修复
|
||||
* 【core 】 修复`ReflectUtil`中因class和Method关联导致的缓存无法回收问题(issue#4039@Github)
|
||||
@@ -27,6 +30,8 @@
|
||||
* 【cron 】 修复`CronPatternUtil.nextDateAfter`当日为L时计算错误问题。(issue#4056@Github)
|
||||
* 【db 】 修复`NamedSql.replaceVar`关键字处理问题(issue#4062@Github)
|
||||
* 【db 】 修复`DialectRunner.count`方法中,去除包含多字段order by子句的SQL语句时错误问题(issue#4066@Github)
|
||||
* 【extra 】 修复`JschSessionPool`并发问题(pr#4079@Github)
|
||||
* 【extra 】 修复`Sftp`递归删除目录时使用相对路径可能导致死循环的问题(pr#1380@Gitee)
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
# 5.8.40(2025-08-26)
|
||||
|
@@ -298,7 +298,7 @@ public class LocalDateTimeUtil {
|
||||
}
|
||||
|
||||
/**
|
||||
* 解析日期时间字符串为{@link LocalDate},仅支持yyyy-MM-dd'T'HH:mm:ss格式,例如:2007-12-03T10:15:30
|
||||
* 解析日期时间字符串为{@link LocalDate},仅支持yyyy-MM-dd格式,例如:2007-12-03
|
||||
*
|
||||
* @param text 日期时间字符串
|
||||
* @return {@link LocalDate}
|
||||
|
@@ -370,6 +370,9 @@ public class StrUtil extends CharSequenceUtil implements StrPool {
|
||||
* @since 3.0.9
|
||||
*/
|
||||
public static String reverse(String str) {
|
||||
if (null == str) {
|
||||
return null;
|
||||
}
|
||||
return new String(ArrayUtil.reverse(str.toCharArray()));
|
||||
}
|
||||
|
||||
@@ -414,6 +417,9 @@ public class StrUtil extends CharSequenceUtil implements StrPool {
|
||||
* @since 3.1.2
|
||||
*/
|
||||
public static String fill(String str, char filledChar, int len, boolean isPre) {
|
||||
if (null == str) {
|
||||
str = "";
|
||||
}
|
||||
final int strLen = str.length();
|
||||
if (strLen > len) {
|
||||
return str;
|
||||
|
@@ -104,7 +104,7 @@ public class PinyinUtil {
|
||||
* @return 汉字返回拼音,非汉字原样返回
|
||||
*/
|
||||
public static String getFirstLetter(String str, String separator) {
|
||||
return getEngine().getFirstLetter(str, separator);
|
||||
return (str == null) ? null : getEngine().getFirstLetter(str, separator);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -6,7 +6,6 @@ import com.jcraft.jsch.Session;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
/**
|
||||
* Jsch会话池
|
||||
@@ -14,12 +13,16 @@ import java.util.concurrent.ConcurrentHashMap;
|
||||
* @author looly
|
||||
*/
|
||||
public enum JschSessionPool {
|
||||
|
||||
/**
|
||||
* 单例对象
|
||||
*/
|
||||
INSTANCE;
|
||||
|
||||
/**
|
||||
* SSH会话池,key:host,value:Session对象
|
||||
*/
|
||||
private final SimpleCache<String, Session> cache = new SimpleCache<>(new ConcurrentHashMap<>());
|
||||
private final SimpleCache<String, Session> cache = new SimpleCache<>();
|
||||
|
||||
/**
|
||||
* 获取Session,不存在返回null
|
||||
|
@@ -462,9 +462,13 @@ public class Sftp extends AbstractFtp {
|
||||
fileName = entry.getFilename();
|
||||
if (false == ".".equals(fileName) && false == "..".equals(fileName)) {
|
||||
if (entry.getAttrs().isDir()) {
|
||||
delDir(fileName);
|
||||
// pr#1380Gitee 当目录名包含特殊字符(如 \u000b)时,会导致不断进入同一目录循环
|
||||
// 此处强制使用绝对路径
|
||||
delDir(dirPath + "/" + fileName);
|
||||
} else {
|
||||
delFile(fileName);
|
||||
// pr#1380Gitee 当目录名包含特殊字符(如 \u000b)时,会导致不断进入同一目录循环
|
||||
// 此处强制使用绝对路径
|
||||
delFile(dirPath + "/" + fileName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -22,4 +22,10 @@ public class PinyinUtilTest {
|
||||
final String result = PinyinUtil.getFirstLetter("崞阳", ", ");
|
||||
assertEquals("g, y", result);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getFirstLetterTest3(){
|
||||
final String result = PinyinUtil.getFirstLetter(null, ", ");
|
||||
assertNull(result);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user