diff --git a/CHANGELOG.md b/CHANGELOG.md index d63d17cad..0a5619315 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ # 🚀Changelog ------------------------------------------------------------------------------------------------------------- -# 5.8.0 (2022-03-21) +# 5.8.0 (2022-03-22) ### ❌不兼容特性 * 【db 】 【不向下兼容 】增加MongoDB4.x支持返回MongoClient变更(pr#568@Gitee) @@ -37,6 +37,7 @@ * 【poi 】 优化ExcelBase,将alias放入 * 【core 】 改进StrUtil#startWith、endWith性能 * 【cron 】 增加CronPatternParser、MatcherTable +* 【http 】 GlobalHeaders增加系统属性allowUnsafeServerCertChange、allowUnsafeRenegotiation ### 🐞Bug修复 * 【core 】 修复ObjectUtil.hasNull传入null返回true的问题(pr#555@Gitee) diff --git a/hutool-core/src/main/java/cn/hutool/core/lang/loader/LazyFunLoader.java b/hutool-core/src/main/java/cn/hutool/core/lang/loader/LazyFunLoader.java index 3cc626a6f..df112f2f0 100644 --- a/hutool-core/src/main/java/cn/hutool/core/lang/loader/LazyFunLoader.java +++ b/hutool-core/src/main/java/cn/hutool/core/lang/loader/LazyFunLoader.java @@ -29,9 +29,10 @@ public class LazyFunLoader extends LazyLoader { * @param supplier 用于生成对象的函数 * @param 对象类型 * @return 函数式懒加载加载器对象 + * @since 5.8.0 */ - public static LazyFunLoader onLoad(final Supplier supplier) { - Assert.notNull(supplier, "supplier"); + public static LazyFunLoader on(final Supplier supplier) { + Assert.notNull(supplier, "supplier must be not null!"); return new LazyFunLoader<>(supplier); } diff --git a/hutool-core/src/test/java/cn/hutool/core/lang/loader/LazyFunLoaderTest.java b/hutool-core/src/test/java/cn/hutool/core/lang/loader/LazyFunLoaderTest.java index 0e35bf717..f8d9888cb 100644 --- a/hutool-core/src/test/java/cn/hutool/core/lang/loader/LazyFunLoaderTest.java +++ b/hutool-core/src/test/java/cn/hutool/core/lang/loader/LazyFunLoaderTest.java @@ -46,7 +46,7 @@ public class LazyFunLoaderTest { @Test public void testOnLoadStaticFactoryMethod1() { - LazyFunLoader loader = LazyFunLoader.onLoad(BigObject::new); + LazyFunLoader loader = LazyFunLoader.on(BigObject::new); Assert.assertNotNull(loader.get()); Assert.assertTrue(loader.isInitialize()); @@ -60,7 +60,7 @@ public class LazyFunLoaderTest { @Test public void testOnLoadStaticFactoryMethod2() { - LazyFunLoader loader = LazyFunLoader.onLoad(BigObject::new); + LazyFunLoader loader = LazyFunLoader.on(BigObject::new); // 若从未使用,则可以避免不必要的初始化 loader.ifInitialized(it -> { diff --git a/hutool-http/src/main/java/cn/hutool/http/GlobalHeaders.java b/hutool-http/src/main/java/cn/hutool/http/GlobalHeaders.java index 44c12c40a..3dabe6288 100644 --- a/hutool-http/src/main/java/cn/hutool/http/GlobalHeaders.java +++ b/hutool-http/src/main/java/cn/hutool/http/GlobalHeaders.java @@ -23,7 +23,7 @@ public enum GlobalHeaders { /** * 存储头信息 */ - Map> headers = new HashMap<>(); + final Map> headers = new HashMap<>(); /** * 构造 @@ -43,6 +43,10 @@ public enum GlobalHeaders { // https://stackoverflow.com/questions/9096987/how-to-overwrite-http-header-host-in-a-httpurlconnection/9098440 System.setProperty("sun.net.http.allowRestrictedHeaders", "true"); + //解决server certificate change is restricted during renegotiation问题 + System.setProperty("jdk.tls.allowUnsafeServerCertChange", "true"); + System.setProperty("sun.security.ssl.allowUnsafeRenegotiation", "true"); + if (isReset) { this.headers.clear(); }