mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-12-07 01:28:34 +08:00
修复ServiceLoaderUtil.loadFirstAvailable在JDK24+后未捕获异常导致的报错问题(issue#ID0952@Gitee)
This commit is contained in:
parent
cea2aaa271
commit
31fa4588b4
@ -2,7 +2,7 @@
|
||||
# 🚀Changelog
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
# 5.8.41(2025-10-10)
|
||||
# 5.8.41(2025-10-11)
|
||||
|
||||
### 🐣新特性
|
||||
* 【core 】 增加`WeakKeyValueConcurrentMap`及其关联类,同时废弃`WeakConcurrentMap`并替换(issue#4039@Github)
|
||||
@ -38,6 +38,7 @@
|
||||
* 【ai 】 修复`AIConfigBuilder`中方法名拼写错误(pr#1382@Gitee)
|
||||
* 【core 】 修复`StrBuilder`charAt越界判断错误(pr#4094@Github)
|
||||
* 【dfa 】 修复`WordTree.addWord`末尾为特殊字符导致的无法匹配问题(pr#4092@Github)
|
||||
* 【core 】 修复`ServiceLoaderUtil.loadFirstAvailable`在JDK24+后未捕获异常导致的报错问题(issue#ID0952@Gitee)
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
# 5.8.40(2025-08-26)
|
||||
|
||||
@ -4,7 +4,6 @@ import cn.hutool.core.collection.ListUtil;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.ServiceConfigurationError;
|
||||
import java.util.ServiceLoader;
|
||||
|
||||
/**
|
||||
@ -34,8 +33,9 @@ public class ServiceLoaderUtil {
|
||||
while (iterator.hasNext()) {
|
||||
try {
|
||||
return iterator.next();
|
||||
} catch (ServiceConfigurationError ignore) {
|
||||
// ignore
|
||||
} catch (Throwable ignore) {
|
||||
// issue#ID0952 JDK 25+ 会直接抛出 NoClassDefFoundError https://bugs.openjdk.org/browse/JDK-8350481
|
||||
// 这里安全忽略,并尝试下一个实现
|
||||
}
|
||||
}
|
||||
return null;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user