diff --git a/CHANGELOG.md b/CHANGELOG.md index cf9b97651..2a547b4a9 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ ### 🐣新特性 ### 🐞Bug修复 +* 【crypto】 修复NoSuchMethodError未捕获问题(issue#2966@Github) ------------------------------------------------------------------------------------------------------------- # 5.8.15 (2023-03-09) diff --git a/hutool-crypto/src/main/java/cn/hutool/crypto/GlobalBouncyCastleProvider.java b/hutool-crypto/src/main/java/cn/hutool/crypto/GlobalBouncyCastleProvider.java index d657ea917..f69d3e96b 100644 --- a/hutool-crypto/src/main/java/cn/hutool/crypto/GlobalBouncyCastleProvider.java +++ b/hutool-crypto/src/main/java/cn/hutool/crypto/GlobalBouncyCastleProvider.java @@ -8,6 +8,9 @@ import java.security.Provider; * @author looly */ public enum GlobalBouncyCastleProvider { + /** + * 单例 + */ INSTANCE; private Provider provider; @@ -16,7 +19,7 @@ public enum GlobalBouncyCastleProvider { GlobalBouncyCastleProvider() { try { this.provider = ProviderFactory.createBouncyCastleProvider(); - } catch (NoClassDefFoundError e) { + } catch (NoClassDefFoundError | NoSuchMethodError e) { // ignore } }