mirror of
https://gitee.com/dromara/hutool.git
synced 2025-12-27 06:35:53 +08:00
fix pr#4149@Github
This commit is contained in:
@@ -24,6 +24,9 @@
|
||||
* 【core 】 修复`Validator.isBetween`在高精度Number类型下存在精度丢失问题(pr#4136@Github)
|
||||
* 【core 】 修复`FileNameUtil.extName`在特殊后缀判断逻辑过于宽松导致误判问题(pr#4142@Github)
|
||||
* 【core 】 修复`TypeUtil.getClass`无法识别`GenericArrayType`问题(pr#4138@Github)
|
||||
* 【core 】 修复`CreditCodeUtil.randomCreditCode`部分字母未使用问题(pr#4149@Github)
|
||||
* 【core 】 修复`CacheableAnnotationAttribute`可能并发问题(pr#4149@Github)
|
||||
* 【core 】 修复`URLUtil.url`未断开连接问题(pr#4149@Github)
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
# 5.8.41(2025-10-12)
|
||||
|
||||
@@ -15,7 +15,7 @@ import java.lang.reflect.Method;
|
||||
public class CacheableAnnotationAttribute implements AnnotationAttribute {
|
||||
|
||||
private volatile boolean valueInvoked;
|
||||
private Object value;
|
||||
private volatile Object value;
|
||||
|
||||
private boolean defaultValueInvoked;
|
||||
private Object defaultValue;
|
||||
|
||||
@@ -100,7 +100,7 @@ public class CreditCodeUtil {
|
||||
|
||||
//
|
||||
for (int i = 0; i < 2; i++) {
|
||||
int num = RandomUtil.randomInt(BASE_CODE_ARRAY.length - 1);
|
||||
int num = RandomUtil.randomInt(BASE_CODE_ARRAY.length);
|
||||
buf.append(Character.toUpperCase(BASE_CODE_ARRAY[num]));
|
||||
}
|
||||
for (int i = 2; i < 8; i++) {
|
||||
@@ -108,7 +108,7 @@ public class CreditCodeUtil {
|
||||
buf.append(BASE_CODE_ARRAY[num]);
|
||||
}
|
||||
for (int i = 8; i < 17; i++) {
|
||||
int num = RandomUtil.randomInt(BASE_CODE_ARRAY.length - 1);
|
||||
int num = RandomUtil.randomInt(BASE_CODE_ARRAY.length);
|
||||
buf.append(BASE_CODE_ARRAY[num]);
|
||||
}
|
||||
|
||||
|
||||
@@ -807,8 +807,9 @@ public class URLUtil extends URLEncodeUtil {
|
||||
} else {
|
||||
// 如果资源打在jar包中或来自网络,使用网络请求长度
|
||||
// issue#3226, 来自Spring的AbstractFileResolvingResource
|
||||
URLConnection con = null;
|
||||
try {
|
||||
final URLConnection con = url.openConnection();
|
||||
con = url.openConnection();
|
||||
useCachesIfNecessary(con);
|
||||
if (con instanceof HttpURLConnection) {
|
||||
final HttpURLConnection httpCon = (HttpURLConnection) con;
|
||||
@@ -817,6 +818,10 @@ public class URLUtil extends URLEncodeUtil {
|
||||
return con.getContentLengthLong();
|
||||
} catch (final IOException e) {
|
||||
throw new IORuntimeException(e);
|
||||
} finally {
|
||||
if (con instanceof HttpURLConnection) {
|
||||
((HttpURLConnection) con).disconnect();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user