mirror of
https://gitee.com/dromara/hutool.git
synced 2025-04-05 17:37:59 +08:00
修复NoSuchMethodError未捕获问题
This commit is contained in:
parent
50c07dd4d8
commit
dc5992b139
hutool-db/src/main/java/cn/hutool/db/ds
hutool-poi/src/main/java/cn/hutool/poi
@ -154,34 +154,34 @@ public abstract class DSFactory implements Closeable, Serializable{
|
||||
private static DSFactory doCreate(Setting setting) {
|
||||
try {
|
||||
return new HikariDSFactory(setting);
|
||||
} catch (NoClassDefFoundError e) {
|
||||
} catch (NoClassDefFoundError | NoSuchMethodError e) {
|
||||
// ignore
|
||||
}
|
||||
try {
|
||||
return new DruidDSFactory(setting);
|
||||
} catch (NoClassDefFoundError e) {
|
||||
} catch (NoClassDefFoundError | NoSuchMethodError e) {
|
||||
// ignore
|
||||
}
|
||||
try {
|
||||
return new TomcatDSFactory(setting);
|
||||
} catch (NoClassDefFoundError e) {
|
||||
} catch (NoClassDefFoundError | NoSuchMethodError e) {
|
||||
//如果未引入包,此处会报org.apache.tomcat.jdbc.pool.PoolConfiguration未找到错误
|
||||
//因为org.apache.tomcat.jdbc.pool.DataSource实现了此接口,会首先检查接口的存在与否
|
||||
// ignore
|
||||
}
|
||||
try {
|
||||
return new BeeDSFactory(setting);
|
||||
} catch (NoClassDefFoundError e) {
|
||||
} catch (NoClassDefFoundError | NoSuchMethodError e) {
|
||||
// ignore
|
||||
}
|
||||
try {
|
||||
return new DbcpDSFactory(setting);
|
||||
} catch (NoClassDefFoundError e) {
|
||||
} catch (NoClassDefFoundError | NoSuchMethodError e) {
|
||||
// ignore
|
||||
}
|
||||
try {
|
||||
return new C3p0DSFactory(setting);
|
||||
} catch (NoClassDefFoundError e) {
|
||||
} catch (NoClassDefFoundError | NoSuchMethodError e) {
|
||||
// ignore
|
||||
}
|
||||
return new PooledDSFactory(setting);
|
||||
|
@ -5,7 +5,7 @@ import cn.hutool.core.util.ClassLoaderUtil;
|
||||
|
||||
/**
|
||||
* POI引入检查器
|
||||
*
|
||||
*
|
||||
* @author looly
|
||||
* @since 4.0.10
|
||||
*/
|
||||
@ -20,7 +20,7 @@ public class PoiChecker {
|
||||
public static void checkPoiImport() {
|
||||
try {
|
||||
Class.forName("org.apache.poi.ss.usermodel.Workbook", false, ClassLoaderUtil.getClassLoader());
|
||||
} catch (ClassNotFoundException | NoClassDefFoundError e) {
|
||||
} catch (ClassNotFoundException | NoClassDefFoundError | NoSuchMethodError e) {
|
||||
throw new DependencyException(e, NO_POI_ERROR_MSG);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user