Skip to content

Commit

Permalink
Prepare release
Browse files Browse the repository at this point in the history
  • Loading branch information
looly committed Feb 18, 2025
2 parents ced8bf8 + b8048c1 commit 21d3dad
Show file tree
Hide file tree
Showing 55 changed files with 1,012 additions and 94 deletions.
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,22 @@

# 🚀Changelog

-------------------------------------------------------------------------------------------------------------
# 5.8.36(2025-02-18)

### 🐣新特性
* 【crypto 】 增加BCUtil.decodeECPrivateKey方法(issue#3829@Github)
* 【core 】 增加HtmlUtil.cleanEmptyTag方法(pr#3838@Github)
* 【db 】 GlobalDbSetting优化默认配置读取规则,优先读取文件而非jar中的文件(issue#900@Github)
* 【dfa 】 删除StopChar类中存在重复字符(pr#3841@Github)
* 【http 】 支持鸿蒙设备 UA 解析(pr#1301@Gitee)

### 🐞Bug修复
* 【aop 】 修复ProxyUtil可能的空指针问题(issue#IBF20Z@Gitee)
* 【core 】 修复XmlUtil转义调用方法错误问题,修复XmlEscape未转义单引号问题(pr#3837@Github)
* 【core 】 修复FileUtil.isAbsolutePath没有判断smb路径问题(pr#1299@Gitee)
* 【core 】 修复AbstractFilter没有检查参数长度问题(issue#3854@Github)

-------------------------------------------------------------------------------------------------------------
# 5.8.35(2024-12-25)

Expand Down
6 changes: 3 additions & 3 deletions README-EN.md
Original file line number Diff line number Diff line change
Expand Up @@ -153,18 +153,18 @@ We provide the T-Shirt and Sweater with Hutool Logo, please visit the shop:
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
<version>5.8.35</version>
<version>5.8.36</version>
</dependency>
```

### 🍐Gradle
```
implementation 'cn.hutool:hutool-all:5.8.35'
implementation 'cn.hutool:hutool-all:5.8.36'
```

## 📥Download

- [Maven Repo](https://repo1.maven.org/maven2/cn/hutool/hutool-all/5.8.35/)
- [Maven Repo](https://repo1.maven.org/maven2/cn/hutool/hutool-all/5.8.36/)

> 🔔️note:
> Hutool 5.x supports JDK8+ and is not tested on Android platforms, and cannot guarantee that all tool classes or tool methods are available.
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -146,20 +146,20 @@ Hutool = Hu + tool,是原公司项目底层代码剥离后的开源库,“Hu
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
<version>5.8.35</version>
<version>5.8.36</version>
</dependency>
```

### 🍐Gradle
```
implementation 'cn.hutool:hutool-all:5.8.35'
implementation 'cn.hutool:hutool-all:5.8.36'
```

### 📥下载jar

点击以下链接,下载`hutool-all-X.X.X.jar`即可:

- [Maven中央库](https://repo1.maven.org/maven2/cn/hutool/hutool-all/5.8.35/)
- [Maven中央库](https://repo1.maven.org/maven2/cn/hutool/hutool-all/5.8.36/)

> 🔔️注意
> Hutool 5.x支持JDK8+,对Android平台没有测试,不能保证所有工具类或工具方法可用。
Expand Down
5 changes: 5 additions & 0 deletions bin/javadoc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,8 @@

# 多模块聚合文档,生成在target/site/apidocs
exec mvn javadoc:aggregate

bin_home="$(dirname ${BASH_SOURCE[0]})"

# 拷贝自定义的index.html到聚合文档目录
cp -vf $bin_home/../docs/apidocs/index.html $bin_home/../target/reports/apidocs/
2 changes: 1 addition & 1 deletion bin/version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
5.8.35
5.8.36
2 changes: 1 addition & 1 deletion docs/js/version.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
var version = '5.8.35'
var version = '5.8.36'
2 changes: 1 addition & 1 deletion hutool-all/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<parent>
<groupId>cn.hutool</groupId>
<artifactId>hutool-parent</artifactId>
<version>5.8.35</version>
<version>5.8.36</version>
</parent>

<artifactId>hutool-all</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion hutool-aop/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<parent>
<groupId>cn.hutool</groupId>
<artifactId>hutool-parent</artifactId>
<version>5.8.35</version>
<version>5.8.36</version>
</parent>

<artifactId>hutool-aop</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@
public class JdkProxyFactory extends ProxyFactory {
private static final long serialVersionUID = 1L;

/**
* 获取单例
*/
public static JdkProxyFactory INSTANCE = new JdkProxyFactory();

@Override
public <T> T proxy(T target, Aspect aspect) {
return ProxyUtil.newProxyInstance(//
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,13 @@ public static <T> T createProxy(T target, Class<? extends Aspect> aspectClass) {
* @return 代理对象
*/
public static <T> T createProxy(T target, Aspect aspect) {
return create().proxy(target, aspect);
ProxyFactory factory = create();
if(null == factory){
// issue#IBF20Z
// 可能的空指针问题
factory = JdkProxyFactory.INSTANCE;
}
return factory.proxy(target, aspect);
}

/**
Expand Down
49 changes: 49 additions & 0 deletions hutool-aop/src/test/java/cn/hutool/aop/test/IssueIBF20ZTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
package cn.hutool.aop.test;

import cn.hutool.aop.proxy.ProxyFactory;
import cn.hutool.core.lang.Console;
import cn.hutool.core.thread.ThreadUtil;
import org.junit.jupiter.api.Test;

import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.atomic.AtomicInteger;

import static org.junit.jupiter.api.Assertions.assertEquals;

public class IssueIBF20ZTest {

@Test
public void testLoadFirstAvailableConcurrent() throws InterruptedException {
// 创建一个固定大小的线程池
int threadCount = 1000;
ExecutorService executorService = ThreadUtil.newExecutor(threadCount);

// 创建一个 CountDownLatch,用于等待所有任务完成
CountDownLatch latch = new CountDownLatch(threadCount);

// 计数器用于统计成功加载服务提供者的次数
AtomicInteger successCount = new AtomicInteger(0);

// 提交多个任务到线程池
for (int i = 0; i < threadCount; i++) {
executorService.submit(() -> {
ProxyFactory factory = ProxyFactory.create();
if (factory != null) {
Console.log(factory.getClass());
successCount.incrementAndGet();
}
latch.countDown(); // 每个任务完成时,计数减一
});
}

// 等待所有任务完成
latch.await();

// 关闭线程池并等待所有任务完成
executorService.shutdown();

// 验证所有线程都成功加载了服务提供者
assertEquals(threadCount, successCount.get());
}
}
2 changes: 1 addition & 1 deletion hutool-bloomFilter/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<parent>
<groupId>cn.hutool</groupId>
<artifactId>hutool-parent</artifactId>
<version>5.8.35</version>
<version>5.8.36</version>
</parent>

<artifactId>hutool-bloomFilter</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import cn.hutool.bloomfilter.bitMap.BitMap;
import cn.hutool.bloomfilter.bitMap.IntMap;
import cn.hutool.bloomfilter.bitMap.LongMap;
import cn.hutool.core.lang.Assert;

/**
* 抽象Bloom过滤器
Expand Down Expand Up @@ -46,7 +47,7 @@ public AbstractFilter(long maxValue) {
* @param machineNum 机器位数
*/
public void init(long maxValue, int machineNum) {
this.size = maxValue;
this.size = Assert.checkBetween(maxValue, 1, Integer.MAX_VALUE);
switch (machineNum) {
case BitMap.MACHINE32:
bm = new IntMap((int) (size / machineNum));
Expand Down
2 changes: 1 addition & 1 deletion hutool-bom/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<parent>
<groupId>cn.hutool</groupId>
<artifactId>hutool-parent</artifactId>
<version>5.8.35</version>
<version>5.8.36</version>
</parent>

<artifactId>hutool-bom</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion hutool-cache/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<parent>
<groupId>cn.hutool</groupId>
<artifactId>hutool-parent</artifactId>
<version>5.8.35</version>
<version>5.8.36</version>
</parent>

<artifactId>hutool-cache</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion hutool-captcha/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<parent>
<groupId>cn.hutool</groupId>
<artifactId>hutool-parent</artifactId>
<version>5.8.35</version>
<version>5.8.36</version>
</parent>

<artifactId>hutool-captcha</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion hutool-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<parent>
<groupId>cn.hutool</groupId>
<artifactId>hutool-parent</artifactId>
<version>5.8.35</version>
<version>5.8.36</version>
</parent>

<artifactId>hutool-core</artifactId>
Expand Down
9 changes: 7 additions & 2 deletions hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ public class FileUtil extends PathUtil {
*/
private static final Pattern PATTERN_PATH_ABSOLUTE = Pattern.compile("^[a-zA-Z]:([/\\\\].*)?", Pattern.DOTALL);

/**
* windows的共享文件夹开头
*/
private static final String SMB_PATH_PREFIX = "\\\\";

/**
* 是否为Windows环境
Expand Down Expand Up @@ -1370,6 +1374,7 @@ public static String getAbsolutePath(File file) {
* <li>以/开头的路径</li>
* <li>满足类似于 c:/xxxxx,其中祖母随意,不区分大小写</li>
* <li>满足类似于 d:\xxxxx,其中祖母随意,不区分大小写</li>
* <li>满足windows SMB协议格式,如: \\192.168.254.1\Share</li>
* </ul>
*
* @param path 需要检查的Path
Expand All @@ -1381,7 +1386,7 @@ public static boolean isAbsolutePath(String path) {
}

// 给定的路径已经是绝对路径了
return StrUtil.C_SLASH == path.charAt(0) || ReUtil.isMatch(PATTERN_PATH_ABSOLUTE, path);
return StrUtil.C_SLASH == path.charAt(0) || path.startsWith(SMB_PATH_PREFIX) || ReUtil.isMatch(PATTERN_PATH_ABSOLUTE, path);
}

/**
Expand Down Expand Up @@ -1667,7 +1672,7 @@ public static String normalize(String path) {
}

//兼容Windows下的共享目录路径(原始路径如果以\\开头,则保留这种路径)
if (path.startsWith("\\\\")) {
if (path.startsWith(SMB_PATH_PREFIX)) {
return path;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@ public URL getUrl(){

@Override
public InputStream getStream() throws NoResourceException {
if (!this.file.exists()) {
throw new NoResourceException("File [{}] not exist!", this.file.getAbsolutePath());
}
return FileUtil.getInputStream(this.file);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package cn.hutool.core.text.escape;

import cn.hutool.core.text.replacer.LookupReplacer;
import cn.hutool.core.text.replacer.ReplacerChain;

/**
* HTML4的ESCAPE
Expand All @@ -9,9 +10,21 @@
* @author looly
*
*/
public class Html4Escape extends XmlEscape {
public class Html4Escape extends ReplacerChain {
private static final long serialVersionUID = 1L;

/**
* HTML转义字符<br>
* HTML转义相比XML,并不转义单引号<br>
* 见:https://stackoverflow.com/questions/1091945/what-characters-do-i-need-to-escape-in-xml-documents
*/
protected static final String[][] BASIC_ESCAPE = { //
{"\"", "&quot;"}, // " - double-quote
{"&", "&amp;"}, // & - ampersand
{"<", "&lt;"}, // < - less-than
{">", "&gt;"}, // > - greater-than
};

protected static final String[][] ISO8859_1_ESCAPE = { //
{ "\u00A0", "&nbsp;" }, // non-breaking space
{ "\u00A1", "&iexcl;" }, // inverted exclamation mark
Expand Down Expand Up @@ -310,6 +323,7 @@ public class Html4Escape extends XmlEscape {

public Html4Escape() {
super();
addChain(new LookupReplacer(BASIC_ESCAPE));
addChain(new LookupReplacer(ISO8859_1_ESCAPE));
addChain(new LookupReplacer(HTML40_EXTENDED_ESCAPE));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public class XmlEscape extends ReplacerChain {
private static final long serialVersionUID = 1L;

protected static final String[][] BASIC_ESCAPE = { //
// {"'", "&apos;"}, // " - single-quote
{"'", "&apos;"}, // " - single-quote
{"\"", "&quot;"}, // " - double-quote
{"&", "&amp;"}, // & - ampersand
{"<", "&lt;"}, // < - less-than
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,12 @@ public class XmlUnescape extends ReplacerChain {
private static final long serialVersionUID = 1L;

protected static final String[][] BASIC_UNESCAPE = InternalEscapeUtil.invert(XmlEscape.BASIC_ESCAPE);
// issue#1118
protected static final String[][] OTHER_UNESCAPE = new String[][]{new String[]{"&apos;", "'"}};

/**
* 构造
*/
public XmlUnescape() {
addChain(new LookupReplacer(BASIC_UNESCAPE));
addChain(new NumericEntityUnescaper());
addChain(new LookupReplacer(OTHER_UNESCAPE));
}
}
5 changes: 3 additions & 2 deletions hutool-core/src/main/java/cn/hutool/core/util/XmlUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -956,14 +956,15 @@ public static Object getByXPath(String expression, Object source, QName returnTy
* &lt; (小于) 替换为 &amp;lt;
* &gt; (大于) 替换为 &amp;gt;
* &quot; (双引号) 替换为 &amp;quot;
* ' (单引号) 替换为 &amp;apos;
* </pre>
*
* @param string 被替换的字符串
* @return 替换后的字符串
* @since 4.0.8
*/
public static String escape(String string) {
return EscapeUtil.escapeHtml4(string);
return EscapeUtil.escapeXml(string);
}

/**
Expand All @@ -975,7 +976,7 @@ public static String escape(String string) {
* @since 5.0.6
*/
public static String unescape(String string) {
return EscapeUtil.unescapeHtml4(string);
return EscapeUtil.unescapeXml(string);
}

/**
Expand Down
Loading

0 comments on commit 21d3dad

Please sign in to comment.