Merge branch 'chinabugotech:v5-dev' into v5-dev

This commit is contained in:
xxxtea
2025-09-29 13:43:04 +08:00
committed by GitHub
7 changed files with 31 additions and 7 deletions

View File

@@ -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)

View File

@@ -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}

View File

@@ -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;

View File

@@ -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);
}
/**

View File

@@ -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会话池keyhostvalueSession对象
*/
private final SimpleCache<String, Session> cache = new SimpleCache<>(new ConcurrentHashMap<>());
private final SimpleCache<String, Session> cache = new SimpleCache<>();
/**
* 获取Session不存在返回null

View File

@@ -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);
}
}
}

View File

@@ -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);
}
}