mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-05-09 23:51:34 +08:00
update version
This commit is contained in:
parent
1b90832f91
commit
e79369951d
@ -11,6 +11,7 @@
|
||||
* 【core 】 ListUtil.page第一页页码使用PageUtil(pr#198@Gitee)
|
||||
* 【http 】 增加微信、企业微信ua识别(pr#1179@Github)
|
||||
* 【core 】 ObjectUtil增加defaultIfXXX(pr#199@Gitee)
|
||||
* 【json 】 JSONObject构建时不支持的对象类型抛出异常
|
||||
|
||||
### Bug修复
|
||||
* 【core 】 修复ChineseDate没有忽略时分秒导致计算错误问题(issue#I1YW12@Gitee)
|
||||
@ -19,6 +20,7 @@
|
||||
* 【aop 】 修复SimpleAspect一个重载导致的问题,去掉重载的after方法(issue#I1YUG9@Gitee)
|
||||
* 【poi 】 修复03 sax读取日期问题(issue#I1Z83N@Gitee)
|
||||
* 【core 】 修复FileUtil.size软链导致的问题(pr#200@Gitee)
|
||||
* 【core 】 修复JSONObject构造时传入JSONArray结果出错问题(issue#I22FDS@Gitee)
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
@ -1,5 +1,11 @@
|
||||
package cn.hutool.core.util;
|
||||
|
||||
import cn.hutool.core.convert.BasicType;
|
||||
import cn.hutool.core.exceptions.UtilException;
|
||||
import cn.hutool.core.lang.Assert;
|
||||
import cn.hutool.core.lang.JarClassLoader;
|
||||
import cn.hutool.core.lang.SimpleCache;
|
||||
|
||||
import java.io.File;
|
||||
import java.lang.reflect.Array;
|
||||
import java.util.ArrayList;
|
||||
@ -7,12 +13,6 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import cn.hutool.core.convert.BasicType;
|
||||
import cn.hutool.core.exceptions.UtilException;
|
||||
import cn.hutool.core.lang.Assert;
|
||||
import cn.hutool.core.lang.JarClassLoader;
|
||||
import cn.hutool.core.lang.SimpleCache;
|
||||
|
||||
/**
|
||||
* {@link ClassLoader}工具类
|
||||
*
|
||||
@ -71,7 +71,7 @@ public class ClassLoaderUtil {
|
||||
*
|
||||
* <pre>
|
||||
* 1、获取当前线程的ContextClassLoader
|
||||
* 2、获取{@link ClassLoaderUtil}类对应的ClassLoader
|
||||
* 2、获取当前类对应的ClassLoader
|
||||
* 3、获取系统ClassLoader({@link ClassLoader#getSystemClassLoader()})
|
||||
* </pre>
|
||||
*
|
||||
|
@ -539,7 +539,7 @@ public class ClassUtil {
|
||||
*
|
||||
* <pre>
|
||||
* 1、获取当前线程的ContextClassLoader
|
||||
* 2、获取{@link ClassUtil}类对应的ClassLoader
|
||||
* 2、获取{@link ClassLoaderUtil}类对应的ClassLoader
|
||||
* 3、获取系统ClassLoader({@link ClassLoader#getSystemClassLoader()})
|
||||
* </pre>
|
||||
*
|
||||
|
@ -21,7 +21,7 @@
|
||||
<c3p0.version>0.9.5.5</c3p0.version>
|
||||
<dbcp2.version>2.8.0</dbcp2.version>
|
||||
<tomcat-jdbc.version>9.0.30</tomcat-jdbc.version>
|
||||
<druid.version>1.1.24</druid.version>
|
||||
<druid.version>1.2.1</druid.version>
|
||||
<hikariCP.version>2.4.13</hikariCP.version>
|
||||
<mongo.version>3.12.7</mongo.version>
|
||||
<sqlite.version>3.32.3.2</sqlite.version>
|
||||
@ -120,13 +120,13 @@
|
||||
<dependency>
|
||||
<groupId>mysql</groupId>
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
<version>8.0.21</version>
|
||||
<version>8.0.22</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.postgresql</groupId>
|
||||
<artifactId>postgresql</artifactId>
|
||||
<version>42.2.16.jre7</version>
|
||||
<version>42.2.18.jre7</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
@ -19,15 +19,15 @@
|
||||
<properties>
|
||||
<!-- versions -->
|
||||
<velocity.version>2.2</velocity.version>
|
||||
<beetl.version>3.2.1.RELEASE</beetl.version>
|
||||
<beetl.version>3.2.2.RELEASE</beetl.version>
|
||||
<rythm.version>1.3.0</rythm.version>
|
||||
<freemarker.version>2.3.30</freemarker.version>
|
||||
<enjoy.version>4.9.01</enjoy.version>
|
||||
<enjoy.version>4.9.02</enjoy.version>
|
||||
<thymeleaf.version>3.0.11.RELEASE</thymeleaf.version>
|
||||
<mail.version>1.6.2</mail.version>
|
||||
<jsch.version>0.1.55</jsch.version>
|
||||
<zxing.version>3.4.1</zxing.version>
|
||||
<net.version>3.7</net.version>
|
||||
<net.version>3.7.2</net.version>
|
||||
<emoji-java.version>5.1.1</emoji-java.version>
|
||||
<servlet-api.version>4.0.1</servlet-api.version>
|
||||
<spring-boot.version>2.3.4.RELEASE</spring-boot.version>
|
||||
@ -193,7 +193,7 @@
|
||||
<dependency>
|
||||
<groupId>org.apache.lucene</groupId>
|
||||
<artifactId>lucene-analyzers-smartcn</artifactId>
|
||||
<version>8.6.2</version>
|
||||
<version>8.6.3</version>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
@ -65,7 +65,7 @@ public interface JSONGetter<K> extends OptNullBasicTypeFromObjectGetter<K> {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (object instanceof JSONArray) {
|
||||
if (object instanceof JSON) {
|
||||
return (JSONArray) object;
|
||||
}
|
||||
return new JSONArray(object, getConfig());
|
||||
@ -84,7 +84,7 @@ public interface JSONGetter<K> extends OptNullBasicTypeFromObjectGetter<K> {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (object instanceof JSONObject) {
|
||||
if (object instanceof JSON) {
|
||||
return (JSONObject) object;
|
||||
}
|
||||
return new JSONObject(object, getConfig());
|
||||
|
@ -24,6 +24,7 @@ import java.math.BigDecimal;
|
||||
import java.math.BigInteger;
|
||||
import java.util.Collection;
|
||||
import java.util.Enumeration;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
import java.util.ResourceBundle;
|
||||
@ -644,11 +645,19 @@ public class JSONObject implements JSON, JSONGetter<String>, Map<String, Object>
|
||||
return;
|
||||
}
|
||||
|
||||
// 自定义序列化
|
||||
final JSONSerializer serializer = GlobalSerializeMapping.getSerializer(source.getClass());
|
||||
if (serializer instanceof JSONObjectSerializer) {
|
||||
// 自定义序列化
|
||||
serializer.serialize(this, source);
|
||||
} else if (source instanceof Map) {
|
||||
return;
|
||||
}
|
||||
|
||||
if(ArrayUtil.isArray(source) || source instanceof Iterable || source instanceof Iterator){
|
||||
// 不支持集合类型转换为JSONObject
|
||||
throw new JSONException("Unsupported type [{}] to JSONObject!", source.getClass());
|
||||
}
|
||||
|
||||
if (source instanceof Map) {
|
||||
// Map
|
||||
for (final Entry<?, ?> e : ((Map<?, ?>) source).entrySet()) {
|
||||
this.set(Convert.toStr(e.getKey()), e.getValue());
|
||||
@ -668,7 +677,11 @@ public class JSONObject implements JSON, JSONGetter<String>, Map<String, Object>
|
||||
} else if (BeanUtil.isReadableBean(source.getClass())) {
|
||||
// 普通Bean
|
||||
this.populateMap(source);
|
||||
} else {
|
||||
// 不支持对象类型转换为JSONObject
|
||||
throw new JSONException("Unsupported type [{}] to JSONObject!", source.getClass());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -25,6 +25,12 @@ import java.util.Map;
|
||||
*/
|
||||
public class JSONArrayTest {
|
||||
|
||||
@Test(expected = JSONException.class)
|
||||
public void createJSONArrayTest(){
|
||||
// 集合类不支持转为JSONObject
|
||||
new JSONArray(new JSONObject(), JSONConfig.create());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void addTest() {
|
||||
// 方法1
|
||||
|
@ -520,4 +520,10 @@ public class JSONObjectTest {
|
||||
final JSONObject jsonObject = JSONUtil.parseObj(next);
|
||||
Console.log(jsonObject);
|
||||
}
|
||||
|
||||
@Test(expected = JSONException.class)
|
||||
public void createJSONObjectTest(){
|
||||
// 集合类不支持转为JSONObject
|
||||
new JSONObject(new JSONArray(), JSONConfig.create());
|
||||
}
|
||||
}
|
||||
|
@ -26,7 +26,7 @@
|
||||
<dependency>
|
||||
<groupId>com.github.oshi</groupId>
|
||||
<artifactId>oshi-core</artifactId>
|
||||
<version>5.2.5</version>
|
||||
<version>5.3.1</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
Loading…
x
Reference in New Issue
Block a user