mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-05-09 23:51:34 +08:00
fix code
This commit is contained in:
parent
738f67549a
commit
052c45537b
@ -136,6 +136,13 @@ public class DateConverter extends AbstractConverter {
|
||||
return DateUtil.date(mills);
|
||||
}
|
||||
|
||||
return SqlDateUtil.wrap(targetClass, mills);
|
||||
final String dateClassName = targetClass.getName();
|
||||
if(dateClassName.startsWith("java.sql.")){
|
||||
// 为了解决在JDK9+模块化项目中用户没有引入java.sql模块导致的问题,此处增加判断
|
||||
// 如果targetClass是java.sql的类,说明引入了此模块
|
||||
return SqlDateUtil.wrap(targetClass, mills);
|
||||
}
|
||||
|
||||
throw new ConvertException("Unsupported target Date type: {}", targetClass.getName());
|
||||
}
|
||||
}
|
||||
|
@ -16,7 +16,6 @@ import org.dromara.hutool.core.lang.Assert;
|
||||
import org.dromara.hutool.core.text.StrUtil;
|
||||
|
||||
import java.sql.Timestamp;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* {@code java.sql.*}日期时间相关封装<br>
|
||||
@ -80,12 +79,6 @@ public class SqlDateUtil {
|
||||
@SuppressWarnings("unchecked")
|
||||
public static <T extends java.util.Date> T wrap(final Class<?> targetClass, final long mills) {
|
||||
// 返回指定类型
|
||||
if (java.util.Date.class == targetClass) {
|
||||
return (T) new Date(mills);
|
||||
}
|
||||
if (DateTime.class == targetClass) {
|
||||
return (T) DateUtil.date(mills);
|
||||
}
|
||||
if (java.sql.Date.class == targetClass) {
|
||||
return (T) new java.sql.Date(mills);
|
||||
}
|
||||
|
@ -12,7 +12,6 @@
|
||||
|
||||
package org.dromara.hutool.core.cache;
|
||||
|
||||
import org.dromara.hutool.core.cache.SimpleCache;
|
||||
import org.dromara.hutool.core.thread.ConcurrencyTester;
|
||||
import org.dromara.hutool.core.thread.ThreadUtil;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
|
13
pom.xml
13
pom.xml
@ -53,7 +53,7 @@
|
||||
<compile.version>8</compile.version>
|
||||
<junit.version>5.10.3</junit.version>
|
||||
<lombok.version>1.18.34</lombok.version>
|
||||
<kotlin-version>1.9.23</kotlin-version>
|
||||
<kotlin-version>1.9.24</kotlin-version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
@ -167,7 +167,7 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.11.0</version>
|
||||
<version>3.13.0</version>
|
||||
<configuration>
|
||||
<source>${compile.version}</source>
|
||||
<target>${compile.version}</target>
|
||||
@ -178,12 +178,12 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<version>3.1.2</version>
|
||||
<version>3.3.1</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<version>3.3.0</version>
|
||||
<version>3.4.2</version>
|
||||
<configuration>
|
||||
<archive>
|
||||
<index>true</index>
|
||||
@ -192,10 +192,11 @@
|
||||
</manifest>
|
||||
<manifestEntries>
|
||||
<Build-OS>${os.name}</Build-OS>
|
||||
<Built-By>${user.name}</Built-By>
|
||||
<Built-By>Looly</Built-By>
|
||||
<Build-Jdk>${java.version}</Build-Jdk>
|
||||
<Build-Timestamp>${maven.build.timestamp}</Build-Timestamp>
|
||||
<Automatic-Module-Name>${Automatic-Module-Name}</Automatic-Module-Name>
|
||||
<Multi-Release>true</Multi-Release>
|
||||
</manifestEntries>
|
||||
</archive>
|
||||
</configuration>
|
||||
@ -204,7 +205,7 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-javadoc-plugin</artifactId>
|
||||
<version>3.6.3</version>
|
||||
<version>3.7.0</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
|
Loading…
x
Reference in New Issue
Block a user