Skip to content

Commit

Permalink
🤤release 5.8.33
Browse files Browse the repository at this point in the history
  • Loading branch information
looly committed Nov 27, 2024
1 parent d57de39 commit 226d4bd
Show file tree
Hide file tree
Showing 70 changed files with 533 additions and 251 deletions.
19 changes: 19 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,25 @@

# 🚀Changelog

-------------------------------------------------------------------------------------------------------------
# 5.8.34(2024-11-25)

### 🐣新特性
* 【http 】 增加Windows微信浏览器识别(issue#IB3SJF@Gitee)
* 【core 】 ZipUtil.unzip增加编码容错(issue#I3UZ28@Gitee)
* 【core 】 Calculator兼容`x`字符作为乘号(issue#3787@Github)
* 【poi 】 Excel07SaxReader中,对于小数类型,增加精度判断(issue#IB0EJ9@Gitee)
* 【extra 】 SpringUtil增加getBean重载(issue#3779@Github)
* 【core 】 DataSizeUtil 新增format方法(issue#IB6UUX@Gitee)

### 🐞Bug修复
* 【core 】 修复DateUtil.rangeToList中step小于等于0时无限循环问题(issue#3783@Github)
* 【cron 】 修复cron模块依赖log模块问题
* 【extra 】 修复MailUtil发送html格式邮件无法正常展示图片问题(pr#1279@Gitee)
* 【core 】 【可能的向下兼容问题】修复双引号转义符转义错误问题,修改规则后,对非闭合双引号字段的策略变更,如"aa,则被识别为aa(issue#IB5UQ8@Gitee)
* 【extra 】 修复Sftp中传入Session重连时逻辑错误问题(issue#IB69U8@Gitee)
* 【json 】 修复JSONUtil.toBean()中将JSON数组字符串转Map对象返回错误问题(issue#3795@Github)

-------------------------------------------------------------------------------------------------------------
# 5.8.33(2024-11-05)

Expand Down
8 changes: 4 additions & 4 deletions README-EN.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@

<br/>
<p align="center">
<a href="https://qm.qq.com/cgi-bin/qm/qr?k=QtsqXLkHpLjE99tkre19j6pjPMhSay1a&jump_from=webapi">
<a href="https://qm.qq.com/q/I7pPlTzCa4">
<img src="https://img.shields.io/badge/QQ%E7%BE%A4%E2%91%A6-715292493-orange"/></a>
</p>

Expand Down Expand Up @@ -150,18 +150,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.33</version>
<version>5.8.34</version>
</dependency>
```

### 🍐Gradle
```
implementation 'cn.hutool:hutool-all:5.8.33'
implementation 'cn.hutool:hutool-all:5.8.34'
```

## 📥Download

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

> 🔔️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
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@

<br/>
<p align="center">
<a href="https://qm.qq.com/cgi-bin/qm/qr?k=QtsqXLkHpLjE99tkre19j6pjPMhSay1a&jump_from=webapi">
<a href="https://qm.qq.com/q/I7pPlTzCa4">
<img src="https://img.shields.io/badge/QQ%E7%BE%A4%E2%91%A6-715292493-orange"/></a>
</p>

Expand Down Expand Up @@ -143,20 +143,20 @@ Hutool = Hu + tool,是原公司项目底层代码剥离后的开源库,“Hu
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
<version>5.8.33</version>
<version>5.8.34</version>
</dependency>
```

### 🍐Gradle
```
implementation 'cn.hutool:hutool-all:5.8.33'
implementation 'cn.hutool:hutool-all:5.8.34'
```

### 📥下载jar

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

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

> 🔔️注意
> Hutool 5.x支持JDK8+,对Android平台没有测试,不能保证所有工具类或工具方法可用。
Expand Down
2 changes: 1 addition & 1 deletion bin/version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
5.8.33
5.8.34
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.33'
var version = '5.8.34'
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.33</version>
<version>5.8.34-SNAPSHOT</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.33</version>
<version>5.8.34-SNAPSHOT</version>
</parent>

<artifactId>hutool-aop</artifactId>
Expand Down
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.33</version>
<version>5.8.34-SNAPSHOT</version>
</parent>

<artifactId>hutool-bloomFilter</artifactId>
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.33</version>
<version>5.8.34-SNAPSHOT</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.33</version>
<version>5.8.34-SNAPSHOT</version>
</parent>

<artifactId>hutool-cache</artifactId>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package cn.hutool.cache.impl;

import cn.hutool.core.collection.CopiedIter;
import cn.hutool.core.thread.ThreadUtil;

import java.util.Iterator;
import java.util.concurrent.locks.StampedLock;
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.33</version>
<version>5.8.34-SNAPSHOT</version>
</parent>

<artifactId>hutool-captcha</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import cn.hutool.captcha.generator.RandomGenerator;
import cn.hutool.core.img.GraphicsUtil;
import cn.hutool.core.img.ImgUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.RandomUtil;

import java.awt.*;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import cn.hutool.captcha.generator.RandomGenerator;
import cn.hutool.core.img.ImgUtil;
import cn.hutool.core.img.gif.AnimatedGifEncoder;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.RandomUtil;

import java.awt.AlphaComposite;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import cn.hutool.captcha.generator.RandomGenerator;
import cn.hutool.core.img.GraphicsUtil;
import cn.hutool.core.img.ImgUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.RandomUtil;

import java.awt.*;
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.33</version>
<version>5.8.34-SNAPSHOT</version>
</parent>

<artifactId>hutool-core</artifactId>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
package cn.hutool.core.comparator;

import cn.hutool.core.convert.Convert;
import cn.hutool.core.lang.Version;
import cn.hutool.core.util.*;

import java.io.Serializable;
import java.util.Comparator;
import java.util.List;
import java.util.regex.Pattern;

/**
* 版本比较器<br>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package cn.hutool.core.convert;

import cn.hutool.core.lang.Console;
import cn.hutool.core.util.NumberUtil;
import cn.hutool.core.util.StrUtil;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,11 @@ public MapConverter(Type mapType, Type keyType, Type valueType) {
}
convertMapToMap((Map) value, map);
} else if (BeanUtil.isBean(value.getClass())) {
if(value.getClass().getName().equals("cn.hutool.json.JSONArray")){
// issue#3795 增加JSONArray转Map错误检查
throw new UnsupportedOperationException(StrUtil.format("Unsupported {} to Map.", value.getClass().getName()));
}

map = BeanUtil.beanToMap(value);
// 二次转换,转换键值类型
map = convertInternal(map);
Expand Down
4 changes: 4 additions & 0 deletions hutool-core/src/main/java/cn/hutool/core/date/DateRange.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ public DateRange(Date start, Date end, DateField unit, int step) {
*/
public DateRange(Date start, Date end, DateField unit, int step, boolean isIncludeStart, boolean isIncludeEnd) {
super(DateUtil.date(start), DateUtil.date(end), (current, end1, index) -> {
if(step <= 0){
// issue#3783
return null;
}
final DateTime dt = DateUtil.date(start).offsetNew(unit, (index + 1) * step);
if (dt.isAfter(end1)) {
return null;
Expand Down
18 changes: 18 additions & 0 deletions hutool-core/src/main/java/cn/hutool/core/io/unit/DataSizeUtil.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package cn.hutool.core.io.unit;

import cn.hutool.core.util.ArrayUtil;

import java.text.DecimalFormat;

/**
Expand Down Expand Up @@ -35,4 +37,20 @@ public static String format(long size) {
return new DecimalFormat("#,##0.##")
.format(size / Math.pow(1024, digitGroups)) + " " + DataUnit.UNIT_NAMES[digitGroups];
}

/**
* 根据单位,将文件大小转换为对应单位的大小
*
* @param size 文件大小
* @param fileDataUnit 单位
* @return 大小
* @since 5.8.34
*/
public static String format(Long size, DataUnit fileDataUnit){
if (size <= 0) {
return "0";
}
int digitGroups = ArrayUtil.indexOf(DataUnit.UNIT_NAMES,fileDataUnit.getSuffix());
return new DecimalFormat("##0.##").format(size / Math.pow(1024, digitGroups)) + " " + DataUnit.UNIT_NAMES[digitGroups];
}
}
15 changes: 13 additions & 2 deletions hutool-core/src/main/java/cn/hutool/core/io/unit/DataUnit.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,12 @@ public enum DataUnit {
*/
TERABYTES("TB", DataSize.ofTerabytes(1));

/**
* 单位后缀
*/
public static final String[] UNIT_NAMES = new String[]{"B", "KB", "MB", "GB", "TB", "PB", "EB"};

private final String suffix;

private final DataSize size;


Expand All @@ -56,6 +58,16 @@ public enum DataUnit {
this.size = size;
}

/**
* 单位后缀
*
* @return 单位后缀
* @since 5.8.34
*/
public String getSuffix() {
return this.suffix;
}

DataSize size() {
return this.size;
}
Expand All @@ -76,5 +88,4 @@ public static DataUnit fromSuffix(String suffix) {
}
throw new IllegalArgumentException("Unknown data unit suffix '" + suffix + "'");
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import cn.hutool.core.date.SystemClock;
import cn.hutool.core.lang.id.IdConstants;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.RandomUtil;
import cn.hutool.core.util.StrUtil;

Expand Down
4 changes: 4 additions & 0 deletions hutool-core/src/main/java/cn/hutool/core/math/Calculator.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package cn.hutool.core.math;

import cn.hutool.core.util.CharUtil;
import cn.hutool.core.util.NumberUtil;
import cn.hutool.core.util.StrUtil;

Expand Down Expand Up @@ -192,6 +193,9 @@ private static String transform(String expression) {
arr[i] = '~';
}
}
} else if(CharUtil.equals(arr[i], 'x', true)){
// issue#3787 x转换为*
arr[i] = '*';
}
}
if (arr[0] == '~' && (arr.length > 1 && arr[1] == '(')) {
Expand Down
Loading

0 comments on commit 226d4bd

Please sign in to comment.