diff --git a/README.md b/README.md
index 4f0d63e754..67b3e4a938 100755
--- a/README.md
+++ b/README.md
@@ -6,7 +6,7 @@
-
+
@@ -97,7 +97,7 @@ Bus (应用/服务总线) 是一个基础框架、服务套件,它基于Java17
org.aoju
bus-all
- 6.5.6
+ 6.5.8
```
diff --git a/bus-all/pom.xml b/bus-all/pom.xml
index 5de15a52d5..830739d681 100755
--- a/bus-all/pom.xml
+++ b/bus-all/pom.xml
@@ -6,7 +6,7 @@
org.aoju
bus-all
- 6.5.6
+ 6.5.8
jar
${project.artifactId}
diff --git a/bus-base/pom.xml b/bus-base/pom.xml
index 7e47157de1..0fbfa9c201 100755
--- a/bus-base/pom.xml
+++ b/bus-base/pom.xml
@@ -6,7 +6,7 @@
org.aoju
bus-base
- 6.5.6
+ 6.5.8
jar
${project.artifactId}
@@ -42,7 +42,7 @@
UTF-8
UTF-8
17
- 2.7.2
+ 2.7.3
1.18.24
2.2
diff --git a/bus-base/src/main/java/org/aoju/bus/base/advice/BaseAdvice.java b/bus-base/src/main/java/org/aoju/bus/base/advice/BaseAdvice.java
index 9c4b5f79e5..7c79630585 100755
--- a/bus-base/src/main/java/org/aoju/bus/base/advice/BaseAdvice.java
+++ b/bus-base/src/main/java/org/aoju/bus/base/advice/BaseAdvice.java
@@ -29,7 +29,7 @@
import org.aoju.bus.base.spring.Controller;
import org.aoju.bus.core.exception.BusinessException;
import org.aoju.bus.core.exception.CrontabException;
-import org.aoju.bus.core.exception.InstrumentException;
+import org.aoju.bus.core.exception.InternalException;
import org.aoju.bus.core.exception.ValidateException;
import org.aoju.bus.core.instance.Instances;
import org.aoju.bus.core.toolkit.StringKit;
@@ -97,8 +97,8 @@ public Object defaultException(Exception e) {
* @return 异常提示
*/
@ResponseBody
- @ExceptionHandler(value = InstrumentException.class)
- public Object instrumentException(InstrumentException e) {
+ @ExceptionHandler(value = InternalException.class)
+ public Object InternalException(InternalException e) {
this.defaultExceptionHandler(e);
if (StringKit.isBlank(e.getErrcode())) {
return write(ErrorCode.EM_100510);
diff --git a/bus-base/src/main/java/org/aoju/bus/base/advice/ErrorAdvice.java b/bus-base/src/main/java/org/aoju/bus/base/advice/ErrorAdvice.java
index 77f82b6cf8..b8d88eed28 100755
--- a/bus-base/src/main/java/org/aoju/bus/base/advice/ErrorAdvice.java
+++ b/bus-base/src/main/java/org/aoju/bus/base/advice/ErrorAdvice.java
@@ -26,9 +26,8 @@
package org.aoju.bus.base.advice;
import org.aoju.bus.base.service.ErrorService;
-import org.aoju.bus.core.toolkit.RuntimeKit;
-import org.aoju.bus.logger.Logger;
-import org.aoju.bus.spring.SpringBuilder;
+
+import java.util.ServiceLoader;
/**
* 异常信息处理
@@ -47,19 +46,21 @@ public class ErrorAdvice {
* @return 如果执行链应该继续执行, 则为:true 否则:false
*/
public boolean handler(Exception ex) {
- ErrorService errorService = null;
- try {
- errorService = SpringBuilder.getBean(ErrorService.class);
- } catch (RuntimeException ignore) {
-
- }
- if (null != errorService) {
- errorService.before(ex);
- errorService.after(ex);
- } else {
- Logger.error(RuntimeKit.getStackTrace(ex));
+ final ServiceLoader loader = ServiceLoader.load(ErrorService.class);
+ for (ErrorService service : loader) {
+ if (service instanceof ErrorService) {
+ if (loader.stream().count() > 1) {
+ if (!service.getClass().getName().equals(ErrorService.class.getName())) {
+ service.before(ex);
+ service.after(ex);
+ }
+ } else {
+ service.before(ex);
+ service.after(ex);
+ }
+ }
}
return true;
}
-}
+}
\ No newline at end of file
diff --git a/bus-base/src/main/java/org/aoju/bus/base/consts/ErrorCode.java b/bus-base/src/main/java/org/aoju/bus/base/consts/ErrorCode.java
index bbf6a73a76..4c12c1bf3d 100755
--- a/bus-base/src/main/java/org/aoju/bus/base/consts/ErrorCode.java
+++ b/bus-base/src/main/java/org/aoju/bus/base/consts/ErrorCode.java
@@ -25,7 +25,7 @@
********************************************************************************/
package org.aoju.bus.base.consts;
-import org.aoju.bus.core.exception.InstrumentException;
+import org.aoju.bus.core.exception.InternalException;
import org.aoju.bus.core.lang.Symbol;
import java.util.Map;
@@ -301,7 +301,7 @@ public class ErrorCode {
*/
public static void register(String key, String value) {
if (ERRORCODE_CACHE.containsKey(key)) {
- throw new InstrumentException("重复注册同名称的错误码:" + key);
+ throw new InternalException("重复注册同名称的错误码:" + key);
}
ERRORCODE_CACHE.putIfAbsent(key, value);
}
diff --git a/bus-base/src/main/java/org/aoju/bus/base/service/ErrorService.java b/bus-base/src/main/java/org/aoju/bus/base/service/ErrorService.java
index d002271cf4..b1d237a21e 100644
--- a/bus-base/src/main/java/org/aoju/bus/base/service/ErrorService.java
+++ b/bus-base/src/main/java/org/aoju/bus/base/service/ErrorService.java
@@ -25,18 +25,25 @@
********************************************************************************/
package org.aoju.bus.base.service;
+import lombok.NoArgsConstructor;
import org.aoju.bus.core.toolkit.RuntimeKit;
import org.aoju.bus.logger.Logger;
/**
* 异常信息处理
* 此类未找到实现的情况下,采用默认实现
- * 可以根据不同业务需求,实现对应逻辑即可
+ * 可以根据不同业务需求,继承此类实现对应业务逻辑即可
+ * 项目中可通过SPI自定义接入
+ * 例:META-INF/services/org.aoju.bus.base.service.ErrorService
+ *
+ * org.aoju.bus.xxx.ErrorService
+ *
*
* @author Kimi Liu
* @since Java 17+
*/
-public interface ErrorService {
+@NoArgsConstructor
+public class ErrorService {
/**
* 完成请求处理前调用
@@ -44,7 +51,7 @@ public interface ErrorService {
* @param ex 对象参数
* @return 如果执行链应该继续执行, 则为:true 否则:false
*/
- default boolean before(Exception ex) {
+ public boolean before(Exception ex) {
Logger.error(RuntimeKit.getStackTrace(ex));
return true;
}
@@ -55,8 +62,8 @@ default boolean before(Exception ex) {
* @param ex 对象参数
* @return 如果执行链应该继续执行, 则为:true 否则:false
*/
- default boolean after(Exception ex) {
+ public boolean after(Exception ex) {
return true;
}
-}
+}
\ No newline at end of file
diff --git a/bus-base/src/main/resources/META-INF/services/org.aoju.bus.base.service.ErrorService b/bus-base/src/main/resources/META-INF/services/org.aoju.bus.base.service.ErrorService
new file mode 100644
index 0000000000..f283f9d40c
--- /dev/null
+++ b/bus-base/src/main/resources/META-INF/services/org.aoju.bus.base.service.ErrorService
@@ -0,0 +1 @@
+org.aoju.bus.base.service.ErrorService
\ No newline at end of file
diff --git a/bus-bom/pom.xml b/bus-bom/pom.xml
index 85c39e0c13..14815ce8f5 100755
--- a/bus-bom/pom.xml
+++ b/bus-bom/pom.xml
@@ -6,7 +6,7 @@
org.aoju
bus-bom
- 6.5.6
+ 6.5.8
pom
${project.artifactId}
diff --git a/bus-cache/pom.xml b/bus-cache/pom.xml
index 698c41835e..b3b40d8e32 100755
--- a/bus-cache/pom.xml
+++ b/bus-cache/pom.xml
@@ -6,7 +6,7 @@
org.aoju
bus-cache
- 6.5.6
+ 6.5.8
jar
${project.artifactId}
@@ -42,7 +42,7 @@
UTF-8
UTF-8
17
- 2.7.2
+ 2.7.3
1.18.24
5.1.0
4.2.3
diff --git a/bus-cache/src/main/java/org/aoju/bus/cache/Manage.java b/bus-cache/src/main/java/org/aoju/bus/cache/Manage.java
index b696026f26..273893c29d 100755
--- a/bus-cache/src/main/java/org/aoju/bus/cache/Manage.java
+++ b/bus-cache/src/main/java/org/aoju/bus/cache/Manage.java
@@ -29,7 +29,7 @@
import org.aoju.bus.cache.magic.CachePair;
import org.aoju.bus.core.annotation.Inject;
import org.aoju.bus.core.annotation.Singleton;
-import org.aoju.bus.core.exception.InstrumentException;
+import org.aoju.bus.core.exception.InternalException;
import org.aoju.bus.core.toolkit.StringKit;
import org.aoju.bus.logger.Logger;
@@ -163,7 +163,7 @@ private CachePair getCacheImpl(String cacheName) {
return defaultCache;
} else {
return cachePool.computeIfAbsent(cacheName, (key) -> {
- throw new InstrumentException(StringKit.format("no cache implementation named [%s].", key));
+ throw new InternalException(StringKit.format("no cache implementation named [%s].", key));
});
}
}
diff --git a/bus-cache/src/main/java/org/aoju/bus/cache/provider/MySQLHitting.java b/bus-cache/src/main/java/org/aoju/bus/cache/provider/MySQLHitting.java
index bea715228f..af012de764 100755
--- a/bus-cache/src/main/java/org/aoju/bus/cache/provider/MySQLHitting.java
+++ b/bus-cache/src/main/java/org/aoju/bus/cache/provider/MySQLHitting.java
@@ -27,7 +27,7 @@
import com.zaxxer.hikari.HikariConfig;
import com.zaxxer.hikari.HikariDataSource;
-import org.aoju.bus.core.exception.InstrumentException;
+import org.aoju.bus.core.exception.InternalException;
import org.springframework.jdbc.core.JdbcOperations;
import org.springframework.jdbc.core.JdbcTemplate;
@@ -71,7 +71,7 @@ protected Supplier jdbcOperationsSupplier(Map co
return template;
} catch (Exception e) {
- throw new InstrumentException(e);
+ throw new InternalException(e);
}
};
}
diff --git a/bus-cache/src/main/java/org/aoju/bus/cache/serialize/JdkSerializer.java b/bus-cache/src/main/java/org/aoju/bus/cache/serialize/JdkSerializer.java
index bae0ba6dbf..a75b2127fa 100755
--- a/bus-cache/src/main/java/org/aoju/bus/cache/serialize/JdkSerializer.java
+++ b/bus-cache/src/main/java/org/aoju/bus/cache/serialize/JdkSerializer.java
@@ -25,7 +25,7 @@
********************************************************************************/
package org.aoju.bus.cache.serialize;
-import org.aoju.bus.core.exception.InstrumentException;
+import org.aoju.bus.core.exception.InternalException;
import org.aoju.bus.core.lang.Normal;
import org.aoju.bus.logger.Logger;
@@ -47,7 +47,7 @@ private static void serialize(Serializable object, OutputStream outputStream) {
out = new ObjectOutputStream(outputStream);
out.writeObject(object);
} catch (IOException e) {
- throw new InstrumentException(e);
+ throw new InternalException(e);
} finally {
try {
if (null != out) {
@@ -71,7 +71,7 @@ private static Object deserialize(InputStream inputStream) {
in = new ObjectInputStream(inputStream);
result = in.readObject();
} catch (ClassCastException | IOException | ClassNotFoundException ce) {
- throw new InstrumentException(ce);
+ throw new InternalException(ce);
} finally {
try {
if (null != in) {
diff --git a/bus-core/README.md b/bus-core/README.md
index 9eb41dca3d..8a5ea5044b 100755
--- a/bus-core/README.md
+++ b/bus-core/README.md
@@ -14,7 +14,7 @@
org.aoju
bus-core
- 6.5.6
+ 6.5.8
```
diff --git a/bus-core/pom.xml b/bus-core/pom.xml
index 86b7e333ee..94c126dab9 100755
--- a/bus-core/pom.xml
+++ b/bus-core/pom.xml
@@ -6,7 +6,7 @@
org.aoju
bus-core
- 6.5.6
+ 6.5.8
jar
${project.artifactId}
diff --git a/bus-core/src/main/java/org/aoju/bus/core/Binder.java b/bus-core/src/main/java/org/aoju/bus/core/Binder.java
index c5bc5dc23b..aef6522016 100644
--- a/bus-core/src/main/java/org/aoju/bus/core/Binder.java
+++ b/bus-core/src/main/java/org/aoju/bus/core/Binder.java
@@ -29,7 +29,7 @@
import org.aoju.bus.core.annotation.Ignore;
import org.aoju.bus.core.annotation.Values;
import org.aoju.bus.core.convert.Convert;
-import org.aoju.bus.core.exception.InstrumentException;
+import org.aoju.bus.core.exception.InternalException;
import org.aoju.bus.core.io.resource.PropertySource;
import org.aoju.bus.core.lang.Assert;
import org.aoju.bus.core.lang.Symbol;
@@ -159,7 +159,7 @@ public T bind(Class clazz, String prefix) {
try {
object = clazz.getConstructor().newInstance();
} catch (Exception e) {
- throw new InstrumentException(e);
+ throw new InternalException(e);
}
Class> actualClass = ClassKit.getCglibActualClass(clazz);
diff --git a/bus-core/src/main/java/org/aoju/bus/core/Version.java b/bus-core/src/main/java/org/aoju/bus/core/Version.java
index 73010b4c56..625993bbc2 100644
--- a/bus-core/src/main/java/org/aoju/bus/core/Version.java
+++ b/bus-core/src/main/java/org/aoju/bus/core/Version.java
@@ -60,7 +60,7 @@ public class Version {
* @return 项目的版本号
*/
public static String get() {
- return "6.5.6.RELEASE";
+ return "6.5.8.RELEASE";
}
/**
diff --git a/bus-core/src/main/java/org/aoju/bus/core/beans/DynamicBean.java b/bus-core/src/main/java/org/aoju/bus/core/beans/DynamicBean.java
index 3f1a182b90..9ecce0406e 100755
--- a/bus-core/src/main/java/org/aoju/bus/core/beans/DynamicBean.java
+++ b/bus-core/src/main/java/org/aoju/bus/core/beans/DynamicBean.java
@@ -26,7 +26,7 @@
package org.aoju.bus.core.beans;
import org.aoju.bus.core.clone.Cloning;
-import org.aoju.bus.core.exception.InstrumentException;
+import org.aoju.bus.core.exception.InternalException;
import org.aoju.bus.core.lang.Assert;
import org.aoju.bus.core.toolkit.BeanKit;
import org.aoju.bus.core.toolkit.ClassKit;
@@ -130,15 +130,15 @@ public Object invoke(String methodName, Object... params) {
* @param 属性值类型
* @param fieldName 字段名
* @return 字段值
- * @throws InstrumentException 反射获取属性值或字段值导致的异常
+ * @throws InternalException 反射获取属性值或字段值导致的异常
*/
- public T get(String fieldName) throws InstrumentException {
+ public T get(String fieldName) throws InternalException {
if (Map.class.isAssignableFrom(beanClass)) {
return (T) ((Map, ?>) bean).get(fieldName);
} else {
final PropertyDesc prop = BeanKit.getBeanDesc(beanClass).getProp(fieldName);
if (null == prop) {
- throw new InstrumentException("No public field or get method for {}", fieldName);
+ throw new InternalException("No public field or get method for {}", fieldName);
}
return (T) prop.getValue(bean);
}
@@ -149,15 +149,15 @@ public T get(String fieldName) throws InstrumentException {
*
* @param fieldName 字段名
* @param value 字段值
- * @throws InstrumentException 反射获取属性值或字段值导致的异常
+ * @throws InternalException 反射获取属性值或字段值导致的异常
*/
- public void set(String fieldName, Object value) throws InstrumentException {
+ public void set(String fieldName, Object value) throws InternalException {
if (Map.class.isAssignableFrom(beanClass)) {
((Map) bean).put(fieldName, value);
} else {
final PropertyDesc prop = BeanKit.getBeanDesc(beanClass).getProp(fieldName);
if (null == prop) {
- throw new InstrumentException("No public field or set method for {}", fieldName);
+ throw new InternalException("No public field or set method for {}", fieldName);
}
prop.setValue(bean, value);
}
diff --git a/bus-core/src/main/java/org/aoju/bus/core/beans/PropertyDesc.java b/bus-core/src/main/java/org/aoju/bus/core/beans/PropertyDesc.java
index c00541371a..688e5ee8e4 100644
--- a/bus-core/src/main/java/org/aoju/bus/core/beans/PropertyDesc.java
+++ b/bus-core/src/main/java/org/aoju/bus/core/beans/PropertyDesc.java
@@ -28,7 +28,7 @@
import org.aoju.bus.core.annotation.Alias;
import org.aoju.bus.core.annotation.Ignore;
import org.aoju.bus.core.convert.Convert;
-import org.aoju.bus.core.exception.InstrumentException;
+import org.aoju.bus.core.exception.InternalException;
import org.aoju.bus.core.toolkit.*;
import java.beans.Transient;
@@ -195,7 +195,7 @@ public Object getValue(Object bean, Type targetType, boolean ignoreError) {
result = getValue(bean);
} catch (Exception e) {
if (false == ignoreError) {
- throw new InstrumentException("Get value of [{}] error!", getFieldName());
+ throw new InternalException("Get value of [{}] error!", getFieldName());
}
}
@@ -294,7 +294,7 @@ public PropertyDesc setValue(Object bean, Object value, boolean ignoreNull, bool
this.setValue(bean, value);
} catch (Exception e) {
if (false == ignoreError) {
- throw new InstrumentException("Set value of [{}] error!", getFieldName());
+ throw new InternalException("Set value of [{}] error!", getFieldName());
}
// 忽略注入失败
}
diff --git a/bus-core/src/main/java/org/aoju/bus/core/clone/Cloning.java b/bus-core/src/main/java/org/aoju/bus/core/clone/Cloning.java
index 89a5d6c4d6..1d115b2178 100755
--- a/bus-core/src/main/java/org/aoju/bus/core/clone/Cloning.java
+++ b/bus-core/src/main/java/org/aoju/bus/core/clone/Cloning.java
@@ -25,7 +25,7 @@
********************************************************************************/
package org.aoju.bus.core.clone;
-import org.aoju.bus.core.exception.InstrumentException;
+import org.aoju.bus.core.exception.InternalException;
/**
* 克隆支持类,提供默认的克隆方法
@@ -41,7 +41,7 @@ public T clone() {
try {
return (T) super.clone();
} catch (CloneNotSupportedException e) {
- throw new InstrumentException(e);
+ throw new InternalException(e);
}
}
diff --git a/bus-core/src/main/java/org/aoju/bus/core/codec/Base58.java b/bus-core/src/main/java/org/aoju/bus/core/codec/Base58.java
index 5ebb00cd4f..de2cb3a86a 100644
--- a/bus-core/src/main/java/org/aoju/bus/core/codec/Base58.java
+++ b/bus-core/src/main/java/org/aoju/bus/core/codec/Base58.java
@@ -26,7 +26,7 @@
package org.aoju.bus.core.codec;
import org.aoju.bus.core.codec.provider.Base58Provider;
-import org.aoju.bus.core.exception.InstrumentException;
+import org.aoju.bus.core.exception.InternalException;
import org.aoju.bus.core.exception.ValidateException;
import org.aoju.bus.core.lang.Algorithm;
@@ -169,7 +169,7 @@ private static byte[] hash256(byte[] data) {
try {
return MessageDigest.getInstance(Algorithm.SHA256.getValue()).digest(data);
} catch (NoSuchAlgorithmException e) {
- throw new InstrumentException(e);
+ throw new InternalException(e);
}
}
diff --git a/bus-core/src/main/java/org/aoju/bus/core/codec/Base64.java b/bus-core/src/main/java/org/aoju/bus/core/codec/Base64.java
index db5b3043a8..ee2f3346f3 100644
--- a/bus-core/src/main/java/org/aoju/bus/core/codec/Base64.java
+++ b/bus-core/src/main/java/org/aoju/bus/core/codec/Base64.java
@@ -25,7 +25,7 @@
********************************************************************************/
package org.aoju.bus.core.codec;
-import org.aoju.bus.core.exception.InstrumentException;
+import org.aoju.bus.core.exception.InternalException;
import org.aoju.bus.core.lang.Charset;
import org.aoju.bus.core.lang.Normal;
import org.aoju.bus.core.lang.Symbol;
@@ -474,7 +474,7 @@ public static void decode(char[] ch, int off, int len, OutputStream out) {
out.write((byte) ((b3 << 6) | Normal.DECODE_64_TABLE[ch[off++]]));
}
} catch (IOException e) {
- throw new InstrumentException(e);
+ throw new InternalException(e);
}
}
diff --git a/bus-core/src/main/java/org/aoju/bus/core/codec/PunyCode.java b/bus-core/src/main/java/org/aoju/bus/core/codec/PunyCode.java
index f259d8b275..4f26b4f7ab 100644
--- a/bus-core/src/main/java/org/aoju/bus/core/codec/PunyCode.java
+++ b/bus-core/src/main/java/org/aoju/bus/core/codec/PunyCode.java
@@ -25,7 +25,7 @@
********************************************************************************/
package org.aoju.bus.core.codec;
-import org.aoju.bus.core.exception.InstrumentException;
+import org.aoju.bus.core.exception.InternalException;
import org.aoju.bus.core.lang.Assert;
import org.aoju.bus.core.lang.Symbol;
import org.aoju.bus.core.toolkit.StringKit;
@@ -55,9 +55,9 @@ public class PunyCode {
*
* @param input 字符串
* @return PunyCode字符串
- * @throws InstrumentException 计算异常
+ * @throws InternalException 计算异常
*/
- public static String encode(CharSequence input) throws InstrumentException {
+ public static String encode(CharSequence input) throws InternalException {
return encode(input, false);
}
@@ -67,9 +67,9 @@ public static String encode(CharSequence input) throws InstrumentException {
* @param input 字符串
* @param withPrefix 是否包含 "xn--"前缀
* @return PunyCode字符串
- * @throws InstrumentException 计算异常
+ * @throws InternalException 计算异常
*/
- public static String encode(CharSequence input, boolean withPrefix) throws InstrumentException {
+ public static String encode(CharSequence input, boolean withPrefix) throws InternalException {
Assert.notNull(input, "input must not be null!");
int n = INITIAL_N;
int delta = 0;
@@ -100,7 +100,7 @@ public static String encode(CharSequence input, boolean withPrefix) throws Instr
}
}
if (m - n > (Integer.MAX_VALUE - delta) / (h + 1)) {
- throw new InstrumentException("OVERFLOW");
+ throw new InternalException("OVERFLOW");
}
delta = delta + (m - n) * (h + 1);
n = m;
@@ -109,7 +109,7 @@ public static String encode(CharSequence input, boolean withPrefix) throws Instr
if (c < n) {
delta++;
if (0 == delta) {
- throw new InstrumentException("OVERFLOW");
+ throw new InternalException("OVERFLOW");
}
}
if (c == n) {
@@ -150,9 +150,9 @@ public static String encode(CharSequence input, boolean withPrefix) throws Instr
*
* @param input PunyCode
* @return 字符串
- * @throws InstrumentException 计算异常
+ * @throws InternalException 计算异常
*/
- public static String decode(String input) throws InstrumentException {
+ public static String decode(String input) throws InternalException {
Assert.notNull(input, "input must not be null!");
input = StringKit.removePrefixIgnoreCase(input, PUNY_CODE_PREFIX);
@@ -178,12 +178,12 @@ public static String decode(String input) throws InstrumentException {
int w = 1;
for (int k = BASE; ; k += BASE) {
if (d == length) {
- throw new InstrumentException("BAD_INPUT");
+ throw new InternalException("BAD_INPUT");
}
int c = input.charAt(d++);
int digit = codepoint2digit(c);
if (digit > (Integer.MAX_VALUE - i) / w) {
- throw new InstrumentException("OVERFLOW");
+ throw new InternalException("OVERFLOW");
}
i = i + digit * w;
int t;
@@ -201,7 +201,7 @@ public static String decode(String input) throws InstrumentException {
}
bias = adapt(i - oldi, output.length() + 1, oldi == 0);
if (i / (output.length() + 1) > Integer.MAX_VALUE - n) {
- throw new InstrumentException("OVERFLOW");
+ throw new InternalException("OVERFLOW");
}
n = n + i / (output.length() + 1);
i = i % (output.length() + 1);
@@ -245,9 +245,9 @@ private static boolean isBasic(char c) {
*
* @param d 输入字符
* @return 转换后的字符
- * @throws InstrumentException 无效字符
+ * @throws InternalException 无效字符
*/
- private static int digit2codepoint(int d) throws InstrumentException {
+ private static int digit2codepoint(int d) throws InternalException {
Assert.checkBetween(d, 0, 35);
if (d < 26) {
// 0..25 : 'a'..'z'
@@ -256,7 +256,7 @@ private static int digit2codepoint(int d) throws InstrumentException {
// 26..35 : '0'..'9';
return d - 26 + '0';
} else {
- throw new InstrumentException("BAD_INPUT");
+ throw new InternalException("BAD_INPUT");
}
}
@@ -274,9 +274,9 @@ private static int digit2codepoint(int d) throws InstrumentException {
*
* @param c 输入字符
* @return 转换后的字符
- * @throws InstrumentException 无效字符
+ * @throws InternalException 无效字符
*/
- private static int codepoint2digit(int c) throws InstrumentException {
+ private static int codepoint2digit(int c) throws InternalException {
if (c - '0' < 10) {
// '0'..'9' : 26..35
return c - '0' + 26;
@@ -284,7 +284,7 @@ private static int codepoint2digit(int c) throws InstrumentException {
// 'a'..'z' : 0..25
return c - 'a';
} else {
- throw new InstrumentException("BAD_INPUT");
+ throw new InternalException("BAD_INPUT");
}
}
diff --git a/bus-core/src/main/java/org/aoju/bus/core/codec/provider/Base16Provider.java b/bus-core/src/main/java/org/aoju/bus/core/codec/provider/Base16Provider.java
index c77169a630..fdd0ab92a7 100644
--- a/bus-core/src/main/java/org/aoju/bus/core/codec/provider/Base16Provider.java
+++ b/bus-core/src/main/java/org/aoju/bus/core/codec/provider/Base16Provider.java
@@ -27,7 +27,7 @@
import org.aoju.bus.core.codec.Decoder;
import org.aoju.bus.core.codec.Encoder;
-import org.aoju.bus.core.exception.InstrumentException;
+import org.aoju.bus.core.exception.InternalException;
import org.aoju.bus.core.toolkit.StringKit;
/**
@@ -60,12 +60,12 @@ public Base16Provider(boolean lowerCase) {
* @param ch 十六进制char
* @param index 十六进制字符在字符数组中的位置
* @return 一个整数
- * @throws InstrumentException 当ch不是一个合法的十六进制字符时,抛出运行时异常
+ * @throws InternalException 当ch不是一个合法的十六进制字符时,抛出运行时异常
*/
private static int toDigit(char ch, int index) {
int digit = Character.digit(ch, 16);
if (digit < 0) {
- throw new InstrumentException("Illegal hexadecimal character {} at index {}", ch, index);
+ throw new InternalException("Illegal hexadecimal character {} at index {}", ch, index);
}
return digit;
}
diff --git a/bus-core/src/main/java/org/aoju/bus/core/collection/FilterIterator.java b/bus-core/src/main/java/org/aoju/bus/core/collection/FilterIterator.java
index d615e0dde6..537374224b 100644
--- a/bus-core/src/main/java/org/aoju/bus/core/collection/FilterIterator.java
+++ b/bus-core/src/main/java/org/aoju/bus/core/collection/FilterIterator.java
@@ -26,6 +26,7 @@
package org.aoju.bus.core.collection;
import org.aoju.bus.core.lang.Assert;
+import org.aoju.bus.core.lang.Filter;
import java.util.Iterator;
import java.util.NoSuchElementException;
@@ -41,7 +42,7 @@
public class FilterIterator implements Iterator {
private final Iterator extends E> iterator;
- private final Predicate super E> filter;
+ private final Filter super E> filter;
/**
* 下一个元素
@@ -58,7 +59,7 @@ public class FilterIterator implements Iterator {
* @param iterator 被包装的{@link Iterator}
* @param filter 过滤函数,{@code null}表示不过滤
*/
- public FilterIterator(final Iterator extends E> iterator, final Predicate super E> filter) {
+ public FilterIterator(final Iterator extends E> iterator, final Filter super E> filter) {
this.iterator = Assert.notNull(iterator);
this.filter = filter;
}
@@ -99,7 +100,7 @@ public Iterator extends E> getIterator() {
*
* @return 过滤函数,可能为{@code null}
*/
- public Predicate super E> getFilter() {
+ public Filter super E> getFilter() {
return filter;
}
@@ -109,7 +110,7 @@ public Predicate super E> getFilter() {
private boolean setNextObject() {
while (iterator.hasNext()) {
final E object = iterator.next();
- if (null != filter && filter.test(object)) {
+ if (null == filter || filter.accept(object)) {
nextObject = object;
nextObjectSet = true;
return true;
diff --git a/bus-core/src/main/java/org/aoju/bus/core/collection/LineIterator.java b/bus-core/src/main/java/org/aoju/bus/core/collection/LineIterator.java
index ed27cffa04..01336f27f5 100755
--- a/bus-core/src/main/java/org/aoju/bus/core/collection/LineIterator.java
+++ b/bus-core/src/main/java/org/aoju/bus/core/collection/LineIterator.java
@@ -25,7 +25,7 @@
********************************************************************************/
package org.aoju.bus.core.collection;
-import org.aoju.bus.core.exception.InstrumentException;
+import org.aoju.bus.core.exception.InternalException;
import org.aoju.bus.core.lang.Assert;
import org.aoju.bus.core.toolkit.IoKit;
@@ -81,7 +81,7 @@ protected String computeNext() {
}
} catch (IOException ioe) {
close();
- throw new InstrumentException(ioe);
+ throw new InternalException(ioe);
}
}
diff --git a/bus-core/src/main/java/org/aoju/bus/core/compare/FuncCompare.java b/bus-core/src/main/java/org/aoju/bus/core/compare/FuncCompare.java
index e8ad1191d6..c5d0d62506 100644
--- a/bus-core/src/main/java/org/aoju/bus/core/compare/FuncCompare.java
+++ b/bus-core/src/main/java/org/aoju/bus/core/compare/FuncCompare.java
@@ -25,7 +25,7 @@
********************************************************************************/
package org.aoju.bus.core.compare;
-import org.aoju.bus.core.exception.InstrumentException;
+import org.aoju.bus.core.exception.InternalException;
import org.aoju.bus.core.toolkit.ObjectKit;
import java.util.function.Function;
@@ -62,7 +62,7 @@ protected int doCompare(T a, T b) {
v1 = func.apply(a);
v2 = func.apply(b);
} catch (Exception e) {
- throw new InstrumentException(e);
+ throw new InternalException(e);
}
return compare(a, b, v1, v2);
diff --git a/bus-core/src/main/java/org/aoju/bus/core/compiler/JavaSourceCompiler.java b/bus-core/src/main/java/org/aoju/bus/core/compiler/JavaSourceCompiler.java
index 189f7b7017..a04f38e077 100644
--- a/bus-core/src/main/java/org/aoju/bus/core/compiler/JavaSourceCompiler.java
+++ b/bus-core/src/main/java/org/aoju/bus/core/compiler/JavaSourceCompiler.java
@@ -1,6 +1,6 @@
package org.aoju.bus.core.compiler;
-import org.aoju.bus.core.exception.InstrumentException;
+import org.aoju.bus.core.exception.InternalException;
import org.aoju.bus.core.io.resource.FileResource;
import org.aoju.bus.core.io.resource.Resource;
import org.aoju.bus.core.io.resource.StringResource;
@@ -189,7 +189,7 @@ public ClassLoader compile() {
IoKit.close(javaFileManager);
}
//编译失败,收集错误信息
- throw new InstrumentException(DiagnosticCollectors.getMessages(diagnosticCollector));
+ throw new InternalException(DiagnosticCollectors.getMessages(diagnosticCollector));
}
/**
diff --git a/bus-core/src/main/java/org/aoju/bus/core/compress/Deflate.java b/bus-core/src/main/java/org/aoju/bus/core/compress/Deflate.java
index ffac6a5e31..c3d4313aa4 100755
--- a/bus-core/src/main/java/org/aoju/bus/core/compress/Deflate.java
+++ b/bus-core/src/main/java/org/aoju/bus/core/compress/Deflate.java
@@ -25,7 +25,7 @@
********************************************************************************/
package org.aoju.bus.core.compress;
-import org.aoju.bus.core.exception.InstrumentException;
+import org.aoju.bus.core.exception.InternalException;
import org.aoju.bus.core.toolkit.IoKit;
import java.io.Closeable;
@@ -103,7 +103,7 @@ public Deflate deflater(int level) {
try {
((DeflaterOutputStream) target).finish();
} catch (IOException e) {
- throw new InstrumentException(e);
+ throw new InternalException(e);
}
return this;
}
@@ -120,7 +120,7 @@ public Deflate inflater() {
try {
((InflaterOutputStream) target).finish();
} catch (IOException e) {
- throw new InstrumentException(e);
+ throw new InternalException(e);
}
return this;
}
diff --git a/bus-core/src/main/java/org/aoju/bus/core/compress/Gzip.java b/bus-core/src/main/java/org/aoju/bus/core/compress/Gzip.java
index 4631e68e71..3380e6e954 100755
--- a/bus-core/src/main/java/org/aoju/bus/core/compress/Gzip.java
+++ b/bus-core/src/main/java/org/aoju/bus/core/compress/Gzip.java
@@ -25,7 +25,7 @@
********************************************************************************/
package org.aoju.bus.core.compress;
-import org.aoju.bus.core.exception.InstrumentException;
+import org.aoju.bus.core.exception.InternalException;
import org.aoju.bus.core.toolkit.IoKit;
import java.io.Closeable;
@@ -90,7 +90,7 @@ public Gzip gzip() {
IoKit.copy(source, target);
((GZIPOutputStream) target).finish();
} catch (IOException e) {
- throw new InstrumentException(e);
+ throw new InternalException(e);
}
return this;
}
@@ -106,7 +106,7 @@ public Gzip unGzip() {
(GZIPInputStream) source : new GZIPInputStream(source);
IoKit.copy(source, target);
} catch (IOException e) {
- throw new InstrumentException(e);
+ throw new InternalException(e);
}
return this;
}
diff --git a/bus-core/src/main/java/org/aoju/bus/core/compress/ZipReader.java b/bus-core/src/main/java/org/aoju/bus/core/compress/ZipReader.java
index 796f5192be..e1ea6a52b4 100755
--- a/bus-core/src/main/java/org/aoju/bus/core/compress/ZipReader.java
+++ b/bus-core/src/main/java/org/aoju/bus/core/compress/ZipReader.java
@@ -25,7 +25,7 @@
********************************************************************************/
package org.aoju.bus.core.compress;
-import org.aoju.bus.core.exception.InstrumentException;
+import org.aoju.bus.core.exception.InternalException;
import org.aoju.bus.core.lang.Filter;
import org.aoju.bus.core.toolkit.FileKit;
import org.aoju.bus.core.toolkit.IoKit;
@@ -138,7 +138,7 @@ public InputStream get(String path) {
}
}
} catch (IOException e) {
- throw new InstrumentException(e);
+ throw new InternalException(e);
}
}
@@ -150,9 +150,9 @@ public InputStream get(String path) {
*
* @param outFile 解压到的目录
* @return 解压的目录
- * @throws InstrumentException IO异常
+ * @throws InternalException IO异常
*/
- public File readTo(File outFile) throws InstrumentException {
+ public File readTo(File outFile) throws InternalException {
return readTo(outFile, null);
}
@@ -162,9 +162,9 @@ public File readTo(File outFile) throws InstrumentException {
* @param outFile 解压到的目录
* @param entryFilter 过滤器,排除不需要的文件
* @return 解压的目录
- * @throws InstrumentException IO异常
+ * @throws InternalException IO异常
*/
- public File readTo(File outFile, Filter entryFilter) throws InstrumentException {
+ public File readTo(File outFile, Filter entryFilter) throws InternalException {
read((zipEntry) -> {
if (null == entryFilter || entryFilter.accept(zipEntry)) {
String path = zipEntry.getName();
@@ -194,9 +194,9 @@ public File readTo(File outFile, Filter entryFilter) throws Instrument
*
* @param consumer {@link ZipEntry}处理器
* @return this
- * @throws InstrumentException IO异常
+ * @throws InternalException IO异常
*/
- public ZipReader read(Consumer consumer) throws InstrumentException {
+ public ZipReader read(Consumer consumer) throws InternalException {
if (null != this.zipFile) {
readFromZipFile(consumer);
} else {
@@ -206,7 +206,7 @@ public ZipReader read(Consumer consumer) throws InstrumentException {
}
@Override
- public void close() throws InstrumentException {
+ public void close() throws InternalException {
if (null != this.zipFile) {
IoKit.close(this.zipFile);
} else {
@@ -230,16 +230,16 @@ private void readFromZipFile(Consumer consumer) {
* 读取并处理Zip流中的每一个{@link ZipEntry}
*
* @param consumer {@link ZipEntry}处理器
- * @throws InstrumentException IO异常
+ * @throws InternalException IO异常
*/
- private void readFromStream(Consumer consumer) throws InstrumentException {
+ private void readFromStream(Consumer consumer) throws InternalException {
try {
ZipEntry zipEntry;
while (null != (zipEntry = in.getNextEntry())) {
consumer.accept(zipEntry);
}
} catch (IOException e) {
- throw new InstrumentException(e);
+ throw new InternalException(e);
}
}
diff --git a/bus-core/src/main/java/org/aoju/bus/core/compress/ZipWriter.java b/bus-core/src/main/java/org/aoju/bus/core/compress/ZipWriter.java
index ca1a186ef8..343383a2f9 100755
--- a/bus-core/src/main/java/org/aoju/bus/core/compress/ZipWriter.java
+++ b/bus-core/src/main/java/org/aoju/bus/core/compress/ZipWriter.java
@@ -25,7 +25,7 @@
********************************************************************************/
package org.aoju.bus.core.compress;
-import org.aoju.bus.core.exception.InstrumentException;
+import org.aoju.bus.core.exception.InternalException;
import org.aoju.bus.core.io.resource.Resource;
import org.aoju.bus.core.lang.Symbol;
import org.aoju.bus.core.toolkit.ArrayKit;
@@ -160,9 +160,9 @@ public ZipOutputStream getOut() {
*
* @param resources 需要压缩的资源,资源的路径为{@link Resource#getName()}
* @return this
- * @throws InstrumentException IO异常
+ * @throws InternalException IO异常
*/
- public ZipWriter add(Resource... resources) throws InstrumentException {
+ public ZipWriter add(Resource... resources) throws InternalException {
for (Resource resource : resources) {
if (null != resource) {
add(resource.getName(), resource.getStream());
@@ -178,9 +178,9 @@ public ZipWriter add(Resource... resources) throws InstrumentException {
* @param path 压缩的路径, {@code null}和""表示根目录下
* @param in 需要压缩的输入流,使用完后自动关闭,{@code null}表示加入空目录
* @return this
- * @throws InstrumentException IO异常
+ * @throws InternalException IO异常
*/
- public ZipWriter add(String path, InputStream in) throws InstrumentException {
+ public ZipWriter add(String path, InputStream in) throws InternalException {
path = StringKit.nullToEmpty(path);
if (null == in) {
// 空目录需要检查路径规范性,目录以"/"结尾
@@ -200,9 +200,9 @@ public ZipWriter add(String path, InputStream in) throws InstrumentException {
* @param paths 流数据在压缩文件中的路径或文件名
* @param ins 要压缩的源,添加完成后自动关闭流
* @return 压缩文件
- * @throws InstrumentException IO异常
+ * @throws InternalException IO异常
*/
- public ZipWriter add(String[] paths, InputStream[] ins) throws InstrumentException {
+ public ZipWriter add(String[] paths, InputStream[] ins) throws InternalException {
if (ArrayKit.isEmpty(paths) || ArrayKit.isEmpty(ins)) {
throw new IllegalArgumentException("Paths or ins is empty !");
}
@@ -224,9 +224,9 @@ public ZipWriter add(String[] paths, InputStream[] ins) throws InstrumentExcepti
* @param filter 文件过滤器,通过实现此接口,自定义要过滤的文件(过滤掉哪些文件或文件夹不加入压缩),{@code null}表示不过滤
* @param files 要压缩的源文件或目录。如果压缩一个文件,则为该文件的全路径;如果压缩一个目录,则为该目录的顶层目录路径
* @return this
- * @throws InstrumentException IO异常
+ * @throws InternalException IO异常
*/
- public ZipWriter add(boolean withSrcDir, FileFilter filter, File... files) throws InstrumentException {
+ public ZipWriter add(boolean withSrcDir, FileFilter filter, File... files) throws InternalException {
for (File file : files) {
// 如果只是压缩一个文件,则需要截取该文件的父目录
String srcRootDir;
@@ -237,7 +237,7 @@ public ZipWriter add(boolean withSrcDir, FileFilter filter, File... files) throw
srcRootDir = file.getCanonicalFile().getParentFile().getCanonicalPath();
}
} catch (IOException e) {
- throw new InstrumentException(e);
+ throw new InternalException(e);
}
_add(file, srcRootDir, filter);
@@ -246,11 +246,11 @@ public ZipWriter add(boolean withSrcDir, FileFilter filter, File... files) throw
}
@Override
- public void close() throws InstrumentException {
+ public void close() throws InternalException {
try {
out.finish();
} catch (IOException e) {
- throw new InstrumentException(e);
+ throw new InternalException(e);
} finally {
IoKit.close(this.out);
}
@@ -264,9 +264,9 @@ public void close() throws InstrumentException {
* @param srcRootDir 被压缩的文件夹根目录
* @param file 当前递归压缩的文件或目录对象
* @param filter 文件过滤器,通过实现此接口,自定义要过滤的文件(过滤掉哪些文件或文件夹不加入压缩),{@code null}表示不过滤
- * @throws InstrumentException IO异常
+ * @throws InternalException IO异常
*/
- private ZipWriter _add(File file, String srcRootDir, FileFilter filter) throws InstrumentException {
+ private ZipWriter _add(File file, String srcRootDir, FileFilter filter) throws InternalException {
if (null == file || (null != filter && false == filter.accept(file))) {
return this;
}
@@ -298,9 +298,9 @@ private ZipWriter _add(File file, String srcRootDir, FileFilter filter) throws I
*
* @param path 压缩的路径, {@code null}和""表示根目录下
* @param in 需要压缩的输入流,使用完后自动关闭,{@code null}表示加入空目录
- * @throws InstrumentException IO异常
+ * @throws InternalException IO异常
*/
- private ZipWriter putEntry(String path, InputStream in) throws InstrumentException {
+ private ZipWriter putEntry(String path, InputStream in) throws InternalException {
try {
out.putNextEntry(new ZipEntry(path));
if (null != in) {
@@ -308,7 +308,7 @@ private ZipWriter putEntry(String path, InputStream in) throws InstrumentExcepti
}
out.closeEntry();
} catch (IOException e) {
- throw new InstrumentException(e);
+ throw new InternalException(e);
} finally {
IoKit.close(in);
}
diff --git a/bus-core/src/main/java/org/aoju/bus/core/convert/ConverterRegistry.java b/bus-core/src/main/java/org/aoju/bus/core/convert/ConverterRegistry.java
index 3f52f1eab8..43d637f7c8 100755
--- a/bus-core/src/main/java/org/aoju/bus/core/convert/ConverterRegistry.java
+++ b/bus-core/src/main/java/org/aoju/bus/core/convert/ConverterRegistry.java
@@ -61,11 +61,11 @@ public class ConverterRegistry {
/**
* 默认类型转换器
*/
- private Map> defaultConverterMap;
+ private Map> defaultMap;
/**
* 用户自定义类型转换器
*/
- private volatile Map> customConverterMap;
+ private volatile Map> customMap;
public ConverterRegistry() {
defaultConverter();
@@ -100,14 +100,14 @@ public ConverterRegistry putCustom(Type type, Class extends Converter>> conv
* @return {@link ConverterRegistry}
*/
public ConverterRegistry putCustom(Type type, Converter> converter) {
- if (null == customConverterMap) {
+ if (null == customMap) {
synchronized (this) {
- if (null == customConverterMap) {
- customConverterMap = new ConcurrentHashMap<>();
+ if (null == customMap) {
+ customMap = new ConcurrentHashMap<>();
}
}
}
- customConverterMap.put(type, converter);
+ customMap.put(type, converter);
return this;
}
@@ -143,7 +143,7 @@ public Converter getConverter(Type type, boolean isCustomFirst) {
* @return 转换器
*/
public Converter getDefaultConverter(Type type) {
- return (null == defaultConverterMap) ? null : (Converter) defaultConverterMap.get(type);
+ return (null == defaultMap) ? null : (Converter) defaultMap.get(type);
}
/**
@@ -154,7 +154,7 @@ public Converter getDefaultConverter(Type type) {
* @return 转换器
*/
public Converter getCustomConverter(Type type) {
- return (null == customConverterMap) ? null : (Converter) customConverterMap.get(type);
+ return (null == customMap) ? null : (Converter) customMap.get(type);
}
/**
@@ -307,81 +307,84 @@ private T convertSpecial(Type type, Class rowType, Object value, T defaul
* @return 转换器
*/
private ConverterRegistry defaultConverter() {
- defaultConverterMap = new ConcurrentHashMap<>();
+ defaultMap = new ConcurrentHashMap<>();
// 原始类型转换器
- defaultConverterMap.put(int.class, new PrimitiveConverter(int.class));
- defaultConverterMap.put(long.class, new PrimitiveConverter(long.class));
- defaultConverterMap.put(byte.class, new PrimitiveConverter(byte.class));
- defaultConverterMap.put(short.class, new PrimitiveConverter(short.class));
- defaultConverterMap.put(float.class, new PrimitiveConverter(float.class));
- defaultConverterMap.put(double.class, new PrimitiveConverter(double.class));
- defaultConverterMap.put(char.class, new PrimitiveConverter(char.class));
- defaultConverterMap.put(boolean.class, new PrimitiveConverter(boolean.class));
+ defaultMap.put(int.class, new PrimitiveConverter(int.class));
+ defaultMap.put(long.class, new PrimitiveConverter(long.class));
+ defaultMap.put(byte.class, new PrimitiveConverter(byte.class));
+ defaultMap.put(short.class, new PrimitiveConverter(short.class));
+ defaultMap.put(float.class, new PrimitiveConverter(float.class));
+ defaultMap.put(double.class, new PrimitiveConverter(double.class));
+ defaultMap.put(char.class, new PrimitiveConverter(char.class));
+ defaultMap.put(boolean.class, new PrimitiveConverter(boolean.class));
// 包装类转换器
- defaultConverterMap.put(Number.class, new NumberConverter());
- defaultConverterMap.put(Integer.class, new NumberConverter(Integer.class));
- defaultConverterMap.put(AtomicInteger.class, new NumberConverter(AtomicInteger.class));
- defaultConverterMap.put(Long.class, new NumberConverter(Long.class));
- defaultConverterMap.put(LongAdder.class, new NumberConverter(LongAdder.class));
- defaultConverterMap.put(AtomicLong.class, new NumberConverter(AtomicLong.class));
- defaultConverterMap.put(Byte.class, new NumberConverter(Byte.class));
- defaultConverterMap.put(Short.class, new NumberConverter(Short.class));
- defaultConverterMap.put(Float.class, new NumberConverter(Float.class));
- defaultConverterMap.put(Double.class, new NumberConverter(Double.class));
- defaultConverterMap.put(DoubleAdder.class, new NumberConverter(DoubleAdder.class));
- defaultConverterMap.put(Character.class, new CharacterConverter());
- defaultConverterMap.put(Boolean.class, new BooleanConverter());
- defaultConverterMap.put(AtomicBoolean.class, new AtomicBooleanConverter());
- defaultConverterMap.put(BigDecimal.class, new NumberConverter(BigDecimal.class));
- defaultConverterMap.put(BigInteger.class, new NumberConverter(BigInteger.class));
- defaultConverterMap.put(CharSequence.class, new StringConverter());
- defaultConverterMap.put(String.class, new StringConverter());
+ defaultMap.put(Number.class, new NumberConverter());
+ defaultMap.put(Integer.class, new NumberConverter(Integer.class));
+ defaultMap.put(AtomicInteger.class, new NumberConverter(AtomicInteger.class));
+ defaultMap.put(Long.class, new NumberConverter(Long.class));
+ defaultMap.put(LongAdder.class, new NumberConverter(LongAdder.class));
+ defaultMap.put(AtomicLong.class, new NumberConverter(AtomicLong.class));
+ defaultMap.put(Byte.class, new NumberConverter(Byte.class));
+ defaultMap.put(Short.class, new NumberConverter(Short.class));
+ defaultMap.put(Float.class, new NumberConverter(Float.class));
+ defaultMap.put(Double.class, new NumberConverter(Double.class));
+ defaultMap.put(DoubleAdder.class, new NumberConverter(DoubleAdder.class));
+ defaultMap.put(Character.class, new CharacterConverter());
+ defaultMap.put(Boolean.class, new BooleanConverter());
+ defaultMap.put(AtomicBoolean.class, new AtomicBooleanConverter());
+ defaultMap.put(BigDecimal.class, new NumberConverter(BigDecimal.class));
+ defaultMap.put(BigInteger.class, new NumberConverter(BigInteger.class));
+ defaultMap.put(CharSequence.class, new StringConverter());
+ defaultMap.put(String.class, new StringConverter());
// URI and URL
- defaultConverterMap.put(URI.class, new URIConverter());
- defaultConverterMap.put(URL.class, new URLConverter());
+ defaultMap.put(URI.class, new URIConverter());
+ defaultMap.put(URL.class, new URLConverter());
// 日期时间
- defaultConverterMap.put(Calendar.class, new CalendarConverter());
- defaultConverterMap.put(java.util.Date.class, new DateConverter(java.util.Date.class));
- defaultConverterMap.put(DateTime.class, new DateConverter(DateTime.class));
- defaultConverterMap.put(java.sql.Date.class, new DateConverter(java.sql.Date.class));
- defaultConverterMap.put(java.sql.Time.class, new DateConverter(java.sql.Time.class));
- defaultConverterMap.put(java.sql.Timestamp.class, new DateConverter(java.sql.Timestamp.class));
+ defaultMap.put(Calendar.class, new CalendarConverter());
+ defaultMap.put(java.util.Date.class, new DateConverter(java.util.Date.class));
+ defaultMap.put(DateTime.class, new DateConverter(DateTime.class));
+ defaultMap.put(java.sql.Date.class, new DateConverter(java.sql.Date.class));
+ defaultMap.put(java.sql.Time.class, new DateConverter(java.sql.Time.class));
+ defaultMap.put(java.sql.Timestamp.class, new DateConverter(java.sql.Timestamp.class));
// 日期时间 JDK8+(since 5.0.0)
- defaultConverterMap.put(TemporalAccessor.class, new TemporalConverter(Instant.class));
- defaultConverterMap.put(Instant.class, new TemporalConverter(Instant.class));
- defaultConverterMap.put(LocalDateTime.class, new TemporalConverter(LocalDateTime.class));
- defaultConverterMap.put(LocalDate.class, new TemporalConverter(LocalDate.class));
- defaultConverterMap.put(LocalTime.class, new TemporalConverter(LocalTime.class));
- defaultConverterMap.put(ZonedDateTime.class, new TemporalConverter(ZonedDateTime.class));
- defaultConverterMap.put(OffsetDateTime.class, new TemporalConverter(OffsetDateTime.class));
- defaultConverterMap.put(OffsetTime.class, new TemporalConverter(OffsetTime.class));
- defaultConverterMap.put(Period.class, new PeriodConverter());
- defaultConverterMap.put(Duration.class, new DurationConverter());
+ defaultMap.put(TemporalAccessor.class, new TemporalConverter(Instant.class));
+ defaultMap.put(Instant.class, new TemporalConverter(Instant.class));
+ defaultMap.put(LocalDateTime.class, new TemporalConverter(LocalDateTime.class));
+ defaultMap.put(LocalDate.class, new TemporalConverter(LocalDate.class));
+ defaultMap.put(LocalTime.class, new TemporalConverter(LocalTime.class));
+ defaultMap.put(ZonedDateTime.class, new TemporalConverter(ZonedDateTime.class));
+ defaultMap.put(OffsetDateTime.class, new TemporalConverter(OffsetDateTime.class));
+ defaultMap.put(OffsetTime.class, new TemporalConverter(OffsetTime.class));
+ defaultMap.put(DayOfWeek.class, new TemporalConverter(DayOfWeek.class));
+ defaultMap.put(Month.class, new TemporalConverter(Month.class));
+ defaultMap.put(MonthDay.class, new TemporalConverter(MonthDay.class));
+ defaultMap.put(Period.class, new PeriodConverter());
+ defaultMap.put(Duration.class, new DurationConverter());
// Reference
- defaultConverterMap.put(WeakReference.class, new ReferenceConverter(WeakReference.class));
- defaultConverterMap.put(SoftReference.class, new ReferenceConverter(SoftReference.class));
- defaultConverterMap.put(AtomicReference.class, new AtomicReferenceConverter());
+ defaultMap.put(WeakReference.class, new ReferenceConverter(WeakReference.class));
+ defaultMap.put(SoftReference.class, new ReferenceConverter(SoftReference.class));
+ defaultMap.put(AtomicReference.class, new AtomicReferenceConverter());
- defaultConverterMap.put(AtomicIntegerArray.class, new AtomicIntegerArrayConverter());
- defaultConverterMap.put(AtomicLongArray.class, new AtomicLongArrayConverter());
+ defaultMap.put(AtomicIntegerArray.class, new AtomicIntegerArrayConverter());
+ defaultMap.put(AtomicLongArray.class, new AtomicLongArrayConverter());
// 其它类型
- defaultConverterMap.put(Class.class, new ClassConverter());
- defaultConverterMap.put(TimeZone.class, new TimeZoneConverter());
- defaultConverterMap.put(Locale.class, new LocaleConverter());
- defaultConverterMap.put(Charset.class, new CharsetConverter());
- defaultConverterMap.put(Path.class, new PathConverter());
- defaultConverterMap.put(Currency.class, new CurrencyConverter());
- defaultConverterMap.put(UUID.class, new UUIDConverter());
- defaultConverterMap.put(StackTraceElement.class, new StackTraceConverter());
- defaultConverterMap.put(Optional.class, new OptionalConverter());
- defaultConverterMap.put(Optional.class, new OptionalConverter());
+ defaultMap.put(Class.class, new ClassConverter());
+ defaultMap.put(TimeZone.class, new TimeZoneConverter());
+ defaultMap.put(Locale.class, new LocaleConverter());
+ defaultMap.put(Charset.class, new CharsetConverter());
+ defaultMap.put(Path.class, new PathConverter());
+ defaultMap.put(Currency.class, new CurrencyConverter());
+ defaultMap.put(UUID.class, new UUIDConverter());
+ defaultMap.put(StackTraceElement.class, new StackTraceConverter());
+ defaultMap.put(Optional.class, new OptionalConverter());
+ defaultMap.put(Optional.class, new OptionalConverter());
return this;
}
diff --git a/bus-core/src/main/java/org/aoju/bus/core/convert/DateConverter.java b/bus-core/src/main/java/org/aoju/bus/core/convert/DateConverter.java
index 0a9d479e6b..d5a4a7d1d1 100755
--- a/bus-core/src/main/java/org/aoju/bus/core/convert/DateConverter.java
+++ b/bus-core/src/main/java/org/aoju/bus/core/convert/DateConverter.java
@@ -26,7 +26,7 @@
package org.aoju.bus.core.convert;
import org.aoju.bus.core.date.DateTime;
-import org.aoju.bus.core.exception.InstrumentException;
+import org.aoju.bus.core.exception.InternalException;
import org.aoju.bus.core.toolkit.DateKit;
import org.aoju.bus.core.toolkit.StringKit;
@@ -110,7 +110,7 @@ protected Date convertInternal(Object value) {
return wrap(dateTime);
}
}
- throw new InstrumentException("Can not convert {}:[{}] to {}", value.getClass().getName(), value, this.targetType.getName());
+ throw new InternalException("Can not convert {}:[{}] to {}", value.getClass().getName(), value, this.targetType.getName());
}
@Override
diff --git a/bus-core/src/main/java/org/aoju/bus/core/convert/TemporalConverter.java b/bus-core/src/main/java/org/aoju/bus/core/convert/TemporalConverter.java
index 98a489b39a..f9f825c21c 100644
--- a/bus-core/src/main/java/org/aoju/bus/core/convert/TemporalConverter.java
+++ b/bus-core/src/main/java/org/aoju/bus/core/convert/TemporalConverter.java
@@ -31,6 +31,8 @@
import org.aoju.bus.core.toolkit.StringKit;
import java.time.*;
+import java.time.chrono.Era;
+import java.time.chrono.IsoEra;
import java.time.format.DateTimeFormatter;
import java.time.temporal.TemporalAccessor;
import java.util.Calendar;
@@ -139,6 +141,17 @@ private TemporalAccessor parseFromCharSequence(CharSequence value) {
if (StringKit.isBlank(value)) {
return null;
}
+
+ if (DayOfWeek.class.equals(this.targetType)) {
+ return DayOfWeek.valueOf(StringKit.toString(value));
+ } else if (Month.class.equals(this.targetType)) {
+ return Month.valueOf(StringKit.toString(value));
+ } else if (Era.class.equals(this.targetType)) {
+ return IsoEra.valueOf(StringKit.toString(value));
+ } else if (MonthDay.class.equals(this.targetType)) {
+ return MonthDay.parse(value);
+ }
+
final Instant instant;
ZoneId zoneId;
if (null != this.format) {
@@ -160,6 +173,13 @@ private TemporalAccessor parseFromCharSequence(CharSequence value) {
* @return java.time中的对象
*/
private TemporalAccessor parseFromLong(Long time) {
+ if (DayOfWeek.class.equals(this.targetType)) {
+ return DayOfWeek.of(Math.toIntExact(time));
+ } else if (Month.class.equals(this.targetType)) {
+ return Month.of(Math.toIntExact(time));
+ } else if (Era.class.equals(this.targetType)) {
+ return IsoEra.of(Math.toIntExact(time));
+ }
return parseFromInstant(Instant.ofEpochMilli(time), null);
}
@@ -170,6 +190,14 @@ private TemporalAccessor parseFromLong(Long time) {
* @return java.time中的对象
*/
private TemporalAccessor parseFromTemporalAccessor(TemporalAccessor temporalAccessor) {
+ if (DayOfWeek.class.equals(this.targetType)) {
+ return DayOfWeek.from(temporalAccessor);
+ } else if (Month.class.equals(this.targetType)) {
+ return Month.from(temporalAccessor);
+ } else if (MonthDay.class.equals(this.targetType)) {
+ return MonthDay.from(temporalAccessor);
+ }
+
TemporalAccessor result = null;
if (temporalAccessor instanceof LocalDateTime) {
result = parseFromLocalDateTime((LocalDateTime) temporalAccessor);
diff --git a/bus-core/src/main/java/org/aoju/bus/core/date/Almanac.java b/bus-core/src/main/java/org/aoju/bus/core/date/Almanac.java
index 75722c5099..e716234a27 100644
--- a/bus-core/src/main/java/org/aoju/bus/core/date/Almanac.java
+++ b/bus-core/src/main/java/org/aoju/bus/core/date/Almanac.java
@@ -25,7 +25,7 @@
********************************************************************************/
package org.aoju.bus.core.date;
-import org.aoju.bus.core.exception.InstrumentException;
+import org.aoju.bus.core.exception.InternalException;
import org.aoju.bus.core.lang.Fields;
import org.aoju.bus.core.lang.Normal;
import org.aoju.bus.core.lang.RegEx;
@@ -121,7 +121,7 @@ public static List getYear(String startDate, String endDate) {
list.add(text);
}
} catch (ParseException e) {
- throw new InstrumentException(e);
+ throw new InternalException(e);
}
return list;
}
@@ -236,7 +236,7 @@ public static Map getQuarter(int type,
+ Symbol.MINUS
+ getMonthOfQuarter(1, Integer.parseInt(map.get(endWkey))));
} catch (ParseException e) {
- throw new InstrumentException(e);
+ throw new InternalException(e);
}
return map;
}
@@ -281,7 +281,7 @@ public static List getQuarter(String StartDate,
} while (true);
} catch (ParseException e) {
- throw new InstrumentException(e);
+ throw new InternalException(e);
}
}
@@ -364,7 +364,7 @@ public static List getMonth(String startDate, String endDate) {
list.add(text);
}
} catch (ParseException e) {
- throw new InstrumentException(e);
+ throw new InternalException(e);
}
return list;
}
@@ -416,7 +416,7 @@ public static Map getMonth(int type,
map.put(beginkey, sdf.format(calBegin.getTime()));
map.put(endkey, sdf.format(calEnd.getTime()));
} catch (ParseException e) {
- throw new InstrumentException(e);
+ throw new InternalException(e);
}
return map;
}
@@ -741,7 +741,7 @@ public static List getWeek(String begin, String end, String startw, Stri
beginww++;
} while (beginY <= endY);
} catch (ParseException e) {
- throw new InstrumentException(e);
+ throw new InternalException(e);
}
return lDate;
}
@@ -757,7 +757,7 @@ public static int getWeek(String year) {
try {
calendar.setTime(Fields.PURE_DATETIME_FORMAT.parse(year + "-12-31"));
} catch (ParseException e) {
- throw new InstrumentException(e);
+ throw new InternalException(e);
}
calendar.setFirstDayOfWeek(Calendar.MONDAY);
int week = calendar.get(Calendar.WEEK_OF_YEAR);
@@ -1455,7 +1455,7 @@ public static Map getLast(int type,
map.put(beginkey, Fields.PURE_DATETIME_FORMAT.format(calBegin.getTime()));
map.put(endkey, Fields.PURE_DATETIME_FORMAT.format(calEnd.getTime()));
} catch (ParseException e) {
- throw new InstrumentException(e);
+ throw new InternalException(e);
}
return map;
}
@@ -1485,7 +1485,7 @@ public static List getLast(String begin, String end) {
lDate.add(Fields.PURE_DATETIME_FORMAT.format(calBegin.getTime()));
}
} catch (ParseException e) {
- throw new InstrumentException(e);
+ throw new InternalException(e);
}
return lDate;
}
@@ -1558,7 +1558,7 @@ public static Map getLast(int type, String beginkey,
map.put(beginkey, Fields.PURE_DATETIME_FORMAT.format(calBegin.getTime()));
map.put(endkey, Fields.PURE_DATETIME_FORMAT.format(calEnd.getTime()));
} catch (ParseException e) {
- throw new InstrumentException(e);
+ throw new InternalException(e);
}
return map;
}
@@ -1591,7 +1591,7 @@ public static Map getLast(String beginkey,
map.put(beginkey, Fields.NORM_YEAR_FORMAT.format(calBegin.getTime()));
map.put(endkey, Fields.NORM_YEAR_FORMAT.format(calEnd.getTime()));
} catch (ParseException e) {
- throw new InstrumentException(e);
+ throw new InternalException(e);
}
return map;
}
diff --git a/bus-core/src/main/java/org/aoju/bus/core/date/DateTime.java b/bus-core/src/main/java/org/aoju/bus/core/date/DateTime.java
index 81a65a8c0c..fa0d9caa97 100755
--- a/bus-core/src/main/java/org/aoju/bus/core/date/DateTime.java
+++ b/bus-core/src/main/java/org/aoju/bus/core/date/DateTime.java
@@ -28,7 +28,7 @@
import org.aoju.bus.core.date.formatter.DateParser;
import org.aoju.bus.core.date.formatter.DatePrinter;
import org.aoju.bus.core.date.formatter.FormatBuilder;
-import org.aoju.bus.core.exception.InstrumentException;
+import org.aoju.bus.core.exception.InternalException;
import org.aoju.bus.core.lang.Assert;
import org.aoju.bus.core.lang.Fields;
import org.aoju.bus.core.lang.System;
@@ -303,7 +303,7 @@ private static Date parse(CharSequence dateStr, DateFormat dateFormat) {
} else {
pattern = dateFormat.toString();
}
- throw new InstrumentException(StringKit.format("Parse [{}] with format [{}] error!", dateStr, pattern), e);
+ throw new InternalException(StringKit.format("Parse [{}] with format [{}] error!", dateStr, pattern), e);
}
}
@@ -320,7 +320,7 @@ private static Calendar parse(CharSequence dateStr, DateParser parser, boolean l
final Calendar calendar = Formatter.parse(dateStr, lenient, parser);
if (null == calendar) {
- throw new InstrumentException("Parse [{}] with format [{}] error!", dateStr, parser.getPattern());
+ throw new InternalException("Parse [{}] with format [{}] error!", dateStr, parser.getPattern());
}
calendar.setFirstDayOfWeek(Fields.Week.Mon.getKey());
return calendar;
@@ -465,7 +465,7 @@ public void setTime(long time) {
if (mutable) {
super.setTime(time);
} else {
- throw new InstrumentException("This is not a mutable object !");
+ throw new InternalException("This is not a mutable object !");
}
}
diff --git a/bus-core/src/main/java/org/aoju/bus/core/date/Formatter.java b/bus-core/src/main/java/org/aoju/bus/core/date/Formatter.java
index 917b3b38c7..40791ddcd1 100644
--- a/bus-core/src/main/java/org/aoju/bus/core/date/Formatter.java
+++ b/bus-core/src/main/java/org/aoju/bus/core/date/Formatter.java
@@ -27,7 +27,7 @@
import org.aoju.bus.core.convert.NumberFormatter;
import org.aoju.bus.core.date.formatter.*;
-import org.aoju.bus.core.exception.InstrumentException;
+import org.aoju.bus.core.exception.InternalException;
import org.aoju.bus.core.lang.Fields;
import org.aoju.bus.core.lang.Normal;
import org.aoju.bus.core.lang.RegEx;
@@ -39,6 +39,7 @@
import java.text.ParsePosition;
import java.text.SimpleDateFormat;
import java.time.*;
+import java.time.chrono.Era;
import java.time.format.DateTimeFormatter;
import java.time.format.DateTimeParseException;
import java.time.temporal.TemporalAccessor;
@@ -186,7 +187,7 @@ public static long format(String date) {
try {
return Fields.NORM_DATETIME_FORMAT.parse(date).getTime();
} catch (ParseException e) {
- throw new InstrumentException(e);
+ throw new InternalException(e);
}
}
@@ -223,7 +224,7 @@ public static long format(String date, String format) {
try {
return new SimpleDateFormat(format).parse(date).getTime();
} catch (ParseException e) {
- throw new InstrumentException(e);
+ throw new InternalException(e);
}
}
@@ -308,6 +309,13 @@ public static String format(TemporalAccessor time, String format) {
return time.toString();
}
+ if (time instanceof DayOfWeek
+ || time instanceof Month
+ || time instanceof Era
+ || time instanceof MonthDay) {
+ return time.toString();
+ }
+
final DateTimeFormatter formatter = StringKit.isBlank(format)
? null : DateTimeFormatter.ofPattern(format);
@@ -571,7 +579,7 @@ public static DateTime parse(CharSequence text) {
}
// 没有更多匹配的时间格式
- throw new InstrumentException("No format fit for date String [{}] !", dateStr);
+ throw new InternalException("No format fit for date String [{}] !", dateStr);
}
/**
@@ -696,7 +704,7 @@ public static Calendar parse(String text, Locale locale, boolean lenient, String
}
pos.setIndex(0);
}
- throw new InstrumentException("Unable to parse the date: {}", text);
+ throw new InternalException("Unable to parse the date: {}", text);
}
/**
@@ -828,7 +836,7 @@ public static DateTime parseUTC(String text) {
text = text.replace(Symbol.SPACE + Symbol.PLUS, Symbol.PLUS);
final String zoneOffset = StringKit.subAfter(text, Symbol.C_PLUS, true);
if (StringKit.isBlank(zoneOffset)) {
- throw new InstrumentException("Invalid format: [{}]", text);
+ throw new InternalException("Invalid format: [{}]", text);
}
if (false == StringKit.contains(zoneOffset, Symbol.C_COLON)) {
// +0800转换为+08:00
@@ -854,7 +862,7 @@ public static DateTime parseUTC(String text) {
}
// 没有更多匹配的时间格式
- throw new InstrumentException("No format fit for date String [{}] !", text);
+ throw new InternalException("No format fit for date String [{}] !", text);
}
/**
@@ -916,7 +924,7 @@ public static Calendar parseByPatterns(String text, Locale locale, boolean lenie
}
pos.setIndex(0);
}
- throw new InstrumentException("Unable to parse the date: {}", text);
+ throw new InternalException("Unable to parse the date: {}", text);
}
/**
diff --git a/bus-core/src/main/java/org/aoju/bus/core/date/formatter/FastDatePrinter.java b/bus-core/src/main/java/org/aoju/bus/core/date/formatter/FastDatePrinter.java
index bd66582101..11349a9ac4 100755
--- a/bus-core/src/main/java/org/aoju/bus/core/date/formatter/FastDatePrinter.java
+++ b/bus-core/src/main/java/org/aoju/bus/core/date/formatter/FastDatePrinter.java
@@ -25,7 +25,7 @@
********************************************************************************/
package org.aoju.bus.core.date.formatter;
-import org.aoju.bus.core.exception.InstrumentException;
+import org.aoju.bus.core.exception.InternalException;
import org.aoju.bus.core.lang.Symbol;
import java.io.IOException;
@@ -484,7 +484,7 @@ private B applyRules(final Calendar calendar, final B buf
rule.appendTo(buf, calendar);
}
} catch (final IOException e) {
- throw new InstrumentException(e);
+ throw new InternalException(e);
}
return buf;
}
diff --git a/bus-core/src/main/java/org/aoju/bus/core/exception/InstrumentException.java b/bus-core/src/main/java/org/aoju/bus/core/exception/InternalException.java
similarity index 84%
rename from bus-core/src/main/java/org/aoju/bus/core/exception/InstrumentException.java
rename to bus-core/src/main/java/org/aoju/bus/core/exception/InternalException.java
index c6ae8d310a..197e448576 100755
--- a/bus-core/src/main/java/org/aoju/bus/core/exception/InstrumentException.java
+++ b/bus-core/src/main/java/org/aoju/bus/core/exception/InternalException.java
@@ -31,35 +31,35 @@
* @author Kimi Liu
* @since Java 17+
*/
-public class InstrumentException extends UncheckedException {
+public class InternalException extends UncheckedException {
private static final long serialVersionUID = 1L;
- public InstrumentException() {
+ public InternalException() {
super();
}
- public InstrumentException(Throwable cause) {
+ public InternalException(Throwable cause) {
super(cause);
}
- public InstrumentException(String format, Object... args) {
+ public InternalException(String format, Object... args) {
super(format, args);
}
- public InstrumentException(String message) {
+ public InternalException(String message) {
super(message);
}
- public InstrumentException(String message, Throwable cause) {
+ public InternalException(String message, Throwable cause) {
super(message, cause);
}
- public InstrumentException(String errcode, String errmsg) {
+ public InternalException(String errcode, String errmsg) {
super(errcode, errmsg);
}
- public InstrumentException(Throwable cause, String format, Object... args) {
+ public InternalException(Throwable cause, String format, Object... args) {
super(String.format(format, args), cause);
}
diff --git a/bus-core/src/main/java/org/aoju/bus/core/exception/TokenExpiredException.java b/bus-core/src/main/java/org/aoju/bus/core/exception/TokenException.java
similarity index 84%
rename from bus-core/src/main/java/org/aoju/bus/core/exception/TokenExpiredException.java
rename to bus-core/src/main/java/org/aoju/bus/core/exception/TokenException.java
index d9ef7aef39..a3d421a44a 100644
--- a/bus-core/src/main/java/org/aoju/bus/core/exception/TokenExpiredException.java
+++ b/bus-core/src/main/java/org/aoju/bus/core/exception/TokenException.java
@@ -26,36 +26,36 @@
package org.aoju.bus.core.exception;
/**
- * 自定义异常: 令牌过期
+ * 自定义异常: 令牌过期/其他
*
* @author Kimi Liu
* @since Java 17+
*/
-public class TokenExpiredException extends UncheckedException {
+public class TokenException extends UncheckedException {
private static final long serialVersionUID = 1L;
- public TokenExpiredException() {
+ public TokenException() {
super();
}
- public TokenExpiredException(Throwable cause) {
+ public TokenException(Throwable cause) {
super(cause);
}
- public TokenExpiredException(String format, Object... args) {
+ public TokenException(String format, Object... args) {
super(format, args);
}
- public TokenExpiredException(String message) {
+ public TokenException(String message) {
super(message);
}
- public TokenExpiredException(String message, Throwable cause) {
+ public TokenException(String message, Throwable cause) {
super(message, cause);
}
- public TokenExpiredException(String errcode, String errmsg) {
+ public TokenException(String errcode, String errmsg) {
super(errcode, errmsg);
}
diff --git a/bus-core/src/main/java/org/aoju/bus/core/image/Images.java b/bus-core/src/main/java/org/aoju/bus/core/image/Images.java
index 4b02cde219..3674e9f727 100755
--- a/bus-core/src/main/java/org/aoju/bus/core/image/Images.java
+++ b/bus-core/src/main/java/org/aoju/bus/core/image/Images.java
@@ -25,7 +25,7 @@
********************************************************************************/
package org.aoju.bus.core.image;
-import org.aoju.bus.core.exception.InstrumentException;
+import org.aoju.bus.core.exception.InternalException;
import org.aoju.bus.core.image.element.AbstractElement;
import org.aoju.bus.core.image.element.ImageElement;
import org.aoju.bus.core.image.element.RectangleElement;
@@ -190,7 +190,7 @@ public Images(BufferedImage srcImage, String imageUrl, String fileType) {
this.canvasWidth = imageElement.getImage().getWidth();
this.canvasHeight = imageElement.getImage().getHeight();
} catch (Exception e) {
- throw new InstrumentException(e.getMessage());
+ throw new InternalException(e.getMessage());
}
} else {
imageElement = new ImageElement(srcImage, 0, 0);
@@ -1063,9 +1063,9 @@ public java.awt.Image getImg() {
*
* @param out 写出到的目标流
* @return 是否成功写出, 如果返回false表示未找到合适的Writer
- * @throws InstrumentException IO异常
+ * @throws InternalException IO异常
*/
- public boolean write(OutputStream out) throws InstrumentException {
+ public boolean write(OutputStream out) throws InternalException {
return write(ImageKit.getImageOutputStream(out));
}
@@ -1075,9 +1075,9 @@ public boolean write(OutputStream out) throws InstrumentException {
*
* @param targetImageStream 写出到的目标流
* @return 是否成功写出, 如果返回false表示未找到合适的Writer
- * @throws InstrumentException IO异常
+ * @throws InternalException IO异常
*/
- public boolean write(ImageOutputStream targetImageStream) throws InstrumentException {
+ public boolean write(ImageOutputStream targetImageStream) throws InternalException {
Assert.notBlank(this.fileType, "Target image type is blank !");
Assert.notNull(targetImageStream, "Target output stream is null !");
@@ -1092,9 +1092,9 @@ public boolean write(ImageOutputStream targetImageStream) throws InstrumentExcep
*
* @param targetFile 目标文件
* @return 是否成功写出, 如果返回false表示未找到合适的Writer
- * @throws InstrumentException IO异常
+ * @throws InternalException IO异常
*/
- public boolean write(File targetFile) throws InstrumentException {
+ public boolean write(File targetFile) throws InternalException {
final String formatName = FileKit.getSuffix(targetFile);
if (StringKit.isNotBlank(formatName)) {
this.fileType = formatName;
diff --git a/bus-core/src/main/java/org/aoju/bus/core/instance/InstanceFactory.java b/bus-core/src/main/java/org/aoju/bus/core/instance/InstanceFactory.java
index 00efa1872d..735578ca8a 100755
--- a/bus-core/src/main/java/org/aoju/bus/core/instance/InstanceFactory.java
+++ b/bus-core/src/main/java/org/aoju/bus/core/instance/InstanceFactory.java
@@ -26,7 +26,7 @@
package org.aoju.bus.core.instance;
import org.aoju.bus.core.annotation.ThreadSafe;
-import org.aoju.bus.core.exception.InstrumentException;
+import org.aoju.bus.core.exception.InternalException;
import org.aoju.bus.core.lang.Assert;
import org.aoju.bus.core.lang.Symbol;
import org.aoju.bus.core.toolkit.ObjectKit;
@@ -125,7 +125,7 @@ public T multiple(Class clazz) {
try {
return clazz.newInstance();
} catch (InstantiationException | IllegalAccessException e) {
- throw new InstrumentException(e);
+ throw new InternalException(e);
}
}
diff --git a/bus-core/src/main/java/org/aoju/bus/core/io/copier/ChannelCopier.java b/bus-core/src/main/java/org/aoju/bus/core/io/copier/ChannelCopier.java
index 9e6a9206e0..83f22d8a09 100755
--- a/bus-core/src/main/java/org/aoju/bus/core/io/copier/ChannelCopier.java
+++ b/bus-core/src/main/java/org/aoju/bus/core/io/copier/ChannelCopier.java
@@ -25,7 +25,7 @@
********************************************************************************/
package org.aoju.bus.core.io.copier;
-import org.aoju.bus.core.exception.InstrumentException;
+import org.aoju.bus.core.exception.InternalException;
import org.aoju.bus.core.io.Progress;
import org.aoju.bus.core.lang.Assert;
import org.aoju.bus.core.toolkit.IoKit;
@@ -95,7 +95,7 @@ public long copy(ReadableByteChannel source, WritableByteChannel target) {
try {
size = doCopy(source, target, ByteBuffer.allocate(bufferSize(this.count)), progress);
} catch (IOException e) {
- throw new InstrumentException(e);
+ throw new InternalException(e);
}
if (null != progress) {
diff --git a/bus-core/src/main/java/org/aoju/bus/core/io/copier/ReaderWriterCopier.java b/bus-core/src/main/java/org/aoju/bus/core/io/copier/ReaderWriterCopier.java
index f0a33341a6..d73e03168e 100755
--- a/bus-core/src/main/java/org/aoju/bus/core/io/copier/ReaderWriterCopier.java
+++ b/bus-core/src/main/java/org/aoju/bus/core/io/copier/ReaderWriterCopier.java
@@ -25,7 +25,7 @@
********************************************************************************/
package org.aoju.bus.core.io.copier;
-import org.aoju.bus.core.exception.InstrumentException;
+import org.aoju.bus.core.exception.InternalException;
import org.aoju.bus.core.io.Progress;
import org.aoju.bus.core.lang.Assert;
import org.aoju.bus.core.toolkit.IoKit;
@@ -91,7 +91,7 @@ public long copy(Reader source, Writer target) {
size = doCopy(source, target, new char[bufferSize(this.count)], progress);
target.flush();
} catch (IOException e) {
- throw new InstrumentException(e);
+ throw new InternalException(e);
}
if (null != progress) {
diff --git a/bus-core/src/main/java/org/aoju/bus/core/io/copier/StreamCopier.java b/bus-core/src/main/java/org/aoju/bus/core/io/copier/StreamCopier.java
index 1283033850..b9f67b0fad 100755
--- a/bus-core/src/main/java/org/aoju/bus/core/io/copier/StreamCopier.java
+++ b/bus-core/src/main/java/org/aoju/bus/core/io/copier/StreamCopier.java
@@ -25,7 +25,7 @@
********************************************************************************/
package org.aoju.bus.core.io.copier;
-import org.aoju.bus.core.exception.InstrumentException;
+import org.aoju.bus.core.exception.InternalException;
import org.aoju.bus.core.io.Progress;
import org.aoju.bus.core.lang.Assert;
import org.aoju.bus.core.toolkit.IoKit;
@@ -93,7 +93,7 @@ public long copy(InputStream source, OutputStream target) {
size = doCopy(source, target, new byte[bufferSize(this.count)], progress);
target.flush();
} catch (IOException e) {
- throw new InstrumentException(e);
+ throw new InternalException(e);
}
if (null != progress) {
diff --git a/bus-core/src/main/java/org/aoju/bus/core/io/file/FileCopier.java b/bus-core/src/main/java/org/aoju/bus/core/io/file/FileCopier.java
index fd24d8ad4f..fad69fb95a 100755
--- a/bus-core/src/main/java/org/aoju/bus/core/io/file/FileCopier.java
+++ b/bus-core/src/main/java/org/aoju/bus/core/io/file/FileCopier.java
@@ -25,7 +25,7 @@
********************************************************************************/
package org.aoju.bus.core.io.file;
-import org.aoju.bus.core.exception.InstrumentException;
+import org.aoju.bus.core.exception.InternalException;
import org.aoju.bus.core.lang.Assert;
import org.aoju.bus.core.lang.copier.Duplicate;
import org.aoju.bus.core.toolkit.ArrayKit;
@@ -197,26 +197,26 @@ public FileCopier setOnlyCopyFile(boolean isOnlyCopyFile) {
*
*
* @return 拷贝后目标的文件或目录
- * @throws InstrumentException IO异常
+ * @throws InternalException IO异常
*/
@Override
- public File copy() throws InstrumentException {
+ public File copy() throws InternalException {
final File src = this.src;
final File dest = this.dest;
// check
Assert.notNull(src, "Source File is null !");
if (false == src.exists()) {
- throw new InstrumentException("File not exist: " + src);
+ throw new InternalException("File not exist: " + src);
}
Assert.notNull(dest, "Destination File or directory is null !");
if (FileKit.equals(src, dest)) {
- throw new InstrumentException("Files '{" + src + "}' and '{" + dest + "}' are equal");
+ throw new InternalException("Files '{" + src + "}' and '{" + dest + "}' are equal");
}
if (src.isDirectory()) {// 复制目录
if (dest.exists() && false == dest.isDirectory()) {
//源为目录,目标为文件,抛出IO异常
- throw new InstrumentException("Src is a directory but dest is a file!");
+ throw new InternalException("Src is a directory but dest is a file!");
}
final File subTarget = isCopyContentIfDir ? dest : FileKit.mkdir(FileKit.file(dest, src.getName()));
internalCopyDirContent(src, subTarget);
@@ -232,9 +232,9 @@ public File copy() throws InstrumentException {
*
* @param src 源目录
* @param dest 目标目录
- * @throws InstrumentException IO异常
+ * @throws InternalException IO异常
*/
- private void internalCopyDirContent(File src, File dest) throws InstrumentException {
+ private void internalCopyDirContent(File src, File dest) throws InternalException {
if (null != predicate && false == predicate.test(src)) {
//被过滤的目录跳过
return;
@@ -244,7 +244,7 @@ private void internalCopyDirContent(File src, File dest) throws InstrumentExcept
//目标为不存在路径,创建为目录
dest.mkdirs();
} else if (false == dest.isDirectory()) {
- throw new InstrumentException(StringKit.format("Src [{}] is a directory but dest [{}] is a file!", src.getPath(), dest.getPath()));
+ throw new InternalException(StringKit.format("Src [{}] is a directory but dest [{}] is a file!", src.getPath(), dest.getPath()));
}
final String[] files = src.list();
@@ -274,9 +274,9 @@ private void internalCopyDirContent(File src, File dest) throws InstrumentExcept
*
* @param src 源文件,必须为文件
* @param dest 目标文件,如果非覆盖模式必须为目录
- * @throws InstrumentException IO异常
+ * @throws InternalException IO异常
*/
- private void internalCopyFile(File src, File dest) throws InstrumentException {
+ private void internalCopyFile(File src, File dest) throws InternalException {
if (null != predicate && false == predicate.test(src)) {
// 被过滤的文件跳过
return;
@@ -309,7 +309,7 @@ private void internalCopyFile(File src, File dest) throws InstrumentException {
try {
Files.copy(src.toPath(), dest.toPath(), optionList.toArray(new CopyOption[0]));
} catch (IOException e) {
- throw new InstrumentException(e);
+ throw new InternalException(e);
}
}
diff --git a/bus-core/src/main/java/org/aoju/bus/core/io/file/FileReader.java b/bus-core/src/main/java/org/aoju/bus/core/io/file/FileReader.java
index 9ed178812e..dd00437063 100755
--- a/bus-core/src/main/java/org/aoju/bus/core/io/file/FileReader.java
+++ b/bus-core/src/main/java/org/aoju/bus/core/io/file/FileReader.java
@@ -25,7 +25,7 @@
********************************************************************************/
package org.aoju.bus.core.io.file;
-import org.aoju.bus.core.exception.InstrumentException;
+import org.aoju.bus.core.exception.InternalException;
import org.aoju.bus.core.io.LineHandler;
import org.aoju.bus.core.lang.Charset;
import org.aoju.bus.core.toolkit.FileKit;
@@ -132,12 +132,12 @@ public static FileReader create(File file) {
* 文件的长度不能超过 {@link Integer#MAX_VALUE}
*
* @return 字节码
- * @throws InstrumentException 异常
+ * @throws InternalException 异常
*/
- public byte[] readBytes() throws InstrumentException {
+ public byte[] readBytes() throws InternalException {
long len = file.length();
if (len >= Integer.MAX_VALUE) {
- throw new InstrumentException("File is larger then max array size");
+ throw new InternalException("File is larger then max array size");
}
byte[] bytes = new byte[(int) len];
@@ -150,7 +150,7 @@ public byte[] readBytes() throws InstrumentException {
throw new IOException(StringKit.format("File length is [{}] but read [{}]!", len, readLength));
}
} catch (Exception e) {
- throw new InstrumentException(e);
+ throw new InternalException(e);
} finally {
IoKit.close(in);
}
@@ -162,9 +162,9 @@ public byte[] readBytes() throws InstrumentException {
* 读取文件内容
*
* @return 内容
- * @throws InstrumentException 异常
+ * @throws InternalException 异常
*/
- public String readString() throws InstrumentException {
+ public String readString() throws InternalException {
return new String(readBytes(), this.charset);
}
@@ -174,9 +174,9 @@ public String readString() throws InstrumentException {
* @param 集合类型
* @param collection 集合
* @return 文件中的每行内容的集合
- * @throws InstrumentException 异常
+ * @throws InternalException 异常
*/
- public > T readLines(T collection) throws InstrumentException {
+ public > T readLines(T collection) throws InternalException {
BufferedReader reader = null;
try {
reader = FileKit.getReader(file, charset);
@@ -190,7 +190,7 @@ public > T readLines(T collection) throws Instrumen
}
return collection;
} catch (IOException e) {
- throw new InstrumentException(e);
+ throw new InternalException(e);
} finally {
IoKit.close(reader);
}
@@ -200,9 +200,9 @@ public > T readLines(T collection) throws Instrumen
* 按照行处理文件内容
*
* @param lineHandler 行处理器
- * @throws InstrumentException 异常
+ * @throws InternalException 异常
*/
- public void readLines(LineHandler lineHandler) throws InstrumentException {
+ public void readLines(LineHandler lineHandler) throws InternalException {
BufferedReader reader = null;
try {
reader = FileKit.getReader(file, charset);
@@ -216,9 +216,9 @@ public void readLines(LineHandler lineHandler) throws InstrumentException {
* 从文件中读取每一行数据
*
* @return 文件中的每行内容的集合
- * @throws InstrumentException 异常
+ * @throws InternalException 异常
*/
- public List readLines() throws InstrumentException {
+ public List readLines() throws InternalException {
return readLines(new ArrayList<>());
}
@@ -228,16 +228,16 @@ public List readLines() throws InstrumentException {
* @param 读取的结果对象类型
* @param readerHandler Reader处理类
* @return 从文件中read出的数据
- * @throws InstrumentException 异常
+ * @throws InternalException 异常
*/
- public T read(ReaderHandler readerHandler) throws InstrumentException {
+ public T read(ReaderHandler readerHandler) throws InternalException {
BufferedReader reader = null;
T result;
try {
reader = FileKit.getReader(this.file, charset);
result = readerHandler.handle(reader);
} catch (IOException e) {
- throw new InstrumentException(e);
+ throw new InternalException(e);
} finally {
IoKit.close(reader);
}
@@ -248,9 +248,9 @@ public T read(ReaderHandler readerHandler) throws InstrumentException {
* 获得一个文件读取器
*
* @return BufferedReader对象
- * @throws InstrumentException 异常
+ * @throws InternalException 异常
*/
- public BufferedReader getReader() throws InstrumentException {
+ public BufferedReader getReader() throws InternalException {
return IoKit.getReader(getInputStream(), this.charset);
}
@@ -258,13 +258,13 @@ public BufferedReader getReader() throws InstrumentException {
* 获得输入流
*
* @return 输入流
- * @throws InstrumentException 异常
+ * @throws InternalException 异常
*/
- public BufferedInputStream getInputStream() throws InstrumentException {
+ public BufferedInputStream getInputStream() throws InternalException {
try {
return new BufferedInputStream(new FileInputStream(this.file));
} catch (IOException e) {
- throw new InstrumentException(e);
+ throw new InternalException(e);
}
}
@@ -273,9 +273,9 @@ public BufferedInputStream getInputStream() throws InstrumentException {
*
* @param out 流
* @return 写出的流byte数
- * @throws InstrumentException IO异常
+ * @throws InternalException IO异常
*/
- public long writeToStream(OutputStream out) throws InstrumentException {
+ public long writeToStream(OutputStream out) throws InternalException {
return writeToStream(out, false);
}
@@ -285,13 +285,13 @@ public long writeToStream(OutputStream out) throws InstrumentException {
* @param out 流
* @param isClose 是否关闭输出流
* @return 写出的流byte数
- * @throws InstrumentException IO异常
+ * @throws InternalException IO异常
*/
- public long writeToStream(OutputStream out, boolean isClose) throws InstrumentException {
+ public long writeToStream(OutputStream out, boolean isClose) throws InternalException {
try (FileInputStream in = new FileInputStream(this.file)) {
return IoKit.copy(in, out);
} catch (IOException e) {
- throw new InstrumentException(e);
+ throw new InternalException(e);
} finally {
if (isClose) {
IoKit.close(out);
@@ -302,14 +302,14 @@ public long writeToStream(OutputStream out, boolean isClose) throws InstrumentEx
/**
* 检查文件
*
- * @throws InstrumentException 异常
+ * @throws InternalException 异常
*/
- private void checkFile() throws InstrumentException {
+ private void checkFile() throws InternalException {
if (false == file.exists()) {
- throw new InstrumentException("File not exist : " + file);
+ throw new InternalException("File not exist : " + file);
}
if (false == file.isFile()) {
- throw new InstrumentException("Not a file :" + file);
+ throw new InternalException("Not a file :" + file);
}
}
diff --git a/bus-core/src/main/java/org/aoju/bus/core/io/file/FileWriter.java b/bus-core/src/main/java/org/aoju/bus/core/io/file/FileWriter.java
index c4cd7dd20d..d1aa252aa5 100755
--- a/bus-core/src/main/java/org/aoju/bus/core/io/file/FileWriter.java
+++ b/bus-core/src/main/java/org/aoju/bus/core/io/file/FileWriter.java
@@ -25,7 +25,7 @@
********************************************************************************/
package org.aoju.bus.core.io.file;
-import org.aoju.bus.core.exception.InstrumentException;
+import org.aoju.bus.core.exception.InternalException;
import org.aoju.bus.core.lang.Assert;
import org.aoju.bus.core.lang.Charset;
import org.aoju.bus.core.toolkit.FileKit;
@@ -132,16 +132,16 @@ public static FileWriter create(File file) {
* @param content 写入的内容
* @param isAppend 是否追加
* @return 目标文件
- * @throws InstrumentException IO异常
+ * @throws InternalException IO异常
*/
- public File write(String content, boolean isAppend) throws InstrumentException {
+ public File write(String content, boolean isAppend) throws InternalException {
BufferedWriter writer = null;
try {
writer = getWriter(isAppend);
writer.write(content);
writer.flush();
} catch (IOException e) {
- throw new InstrumentException(e);
+ throw new InternalException(e);
} finally {
IoKit.close(writer);
}
@@ -153,9 +153,9 @@ public File write(String content, boolean isAppend) throws InstrumentException {
*
* @param content 写入的内容
* @return 目标文件
- * @throws InstrumentException IO异常
+ * @throws InternalException IO异常
*/
- public File write(String content) throws InstrumentException {
+ public File write(String content) throws InternalException {
return write(content, false);
}
@@ -164,9 +164,9 @@ public File write(String content) throws InstrumentException {
*
* @param content 写入的内容
* @return 写入的文件
- * @throws InstrumentException IO异常
+ * @throws InternalException IO异常
*/
- public File append(String content) throws InstrumentException {
+ public File append(String content) throws InternalException {
return write(content, true);
}
@@ -176,9 +176,9 @@ public File append(String content) throws InstrumentException {
* @param 集合元素类型
* @param list 列表
* @return 目标文件
- * @throws InstrumentException IO异常
+ * @throws InternalException IO异常
*/
- public File writeLines(Iterable list) throws InstrumentException {
+ public File writeLines(Iterable list) throws InternalException {
return writeLines(list, false);
}
@@ -188,9 +188,9 @@ public File writeLines(Iterable list) throws InstrumentException {
* @param 集合元素类型
* @param list 列表
* @return 目标文件
- * @throws InstrumentException IO异常
+ * @throws InternalException IO异常
*/
- public File appendLines(Iterable list) throws InstrumentException {
+ public File appendLines(Iterable list) throws InternalException {
return writeLines(list, true);
}
@@ -201,9 +201,9 @@ public File appendLines(Iterable list) throws InstrumentException {
* @param list 列表
* @param isAppend 是否追加
* @return 目标文件
- * @throws InstrumentException IO异常
+ * @throws InternalException IO异常
*/
- public File writeLines(Iterable list, boolean isAppend) throws InstrumentException {
+ public File writeLines(Iterable list, boolean isAppend) throws InternalException {
return writeLines(list, null, isAppend);
}
@@ -215,9 +215,9 @@ public File writeLines(Iterable list, boolean isAppend) throws Instrument
* @param lineSeparator 换行符枚举(Windows、Mac或Linux换行符)
* @param isAppend 是否追加
* @return 目标文件
- * @throws InstrumentException IO异常
+ * @throws InternalException IO异常
*/
- public File writeLines(Iterable list, LineSeparator lineSeparator, boolean isAppend) throws InstrumentException {
+ public File writeLines(Iterable list, LineSeparator lineSeparator, boolean isAppend) throws InternalException {
try (PrintWriter writer = getPrintWriter(isAppend)) {
boolean isFirst = true;
for (T t : list) {
@@ -247,9 +247,9 @@ public File writeLines(Iterable list, LineSeparator lineSeparator, boolea
* @param kvSeparator 键和值之间的分隔符,如果传入null使用默认分隔符" = "
* @param isAppend 是否追加
* @return 目标文件
- * @throws InstrumentException IO异常
+ * @throws InternalException IO异常
*/
- public File writeMap(Map, ?> map, String kvSeparator, boolean isAppend) throws InstrumentException {
+ public File writeMap(Map, ?> map, String kvSeparator, boolean isAppend) throws InternalException {
return writeMap(map, null, kvSeparator, isAppend);
}
@@ -261,9 +261,9 @@ public File writeMap(Map, ?> map, String kvSeparator, boolean isAppend) throws
* @param kvSeparator 键和值之间的分隔符,如果传入null使用默认分隔符" = "
* @param isAppend 是否追加
* @return 目标文件
- * @throws InstrumentException IO异常
+ * @throws InternalException IO异常
*/
- public File writeMap(Map, ?> map, LineSeparator lineSeparator, String kvSeparator, boolean isAppend) throws InstrumentException {
+ public File writeMap(Map, ?> map, LineSeparator lineSeparator, String kvSeparator, boolean isAppend) throws InternalException {
if (null == kvSeparator) {
kvSeparator = " = ";
}
@@ -286,9 +286,9 @@ public File writeMap(Map, ?> map, LineSeparator lineSeparator, String kvSepara
* @param off 数据开始位置
* @param len 数据长度
* @return 目标文件
- * @throws InstrumentException IO异常
+ * @throws InternalException IO异常
*/
- public File write(byte[] data, int off, int len) throws InstrumentException {
+ public File write(byte[] data, int off, int len) throws InternalException {
return write(data, off, len, false);
}
@@ -299,9 +299,9 @@ public File write(byte[] data, int off, int len) throws InstrumentException {
* @param off 数据开始位置
* @param len 数据长度
* @return 目标文件
- * @throws InstrumentException IO异常
+ * @throws InternalException IO异常
*/
- public File append(byte[] data, int off, int len) throws InstrumentException {
+ public File append(byte[] data, int off, int len) throws InternalException {
return write(data, off, len, true);
}
@@ -313,16 +313,16 @@ public File append(byte[] data, int off, int len) throws InstrumentException {
* @param len 数据长度
* @param isAppend 是否追加模式
* @return 目标文件
- * @throws InstrumentException IO异常
+ * @throws InternalException IO异常
*/
- public File write(byte[] data, int off, int len, boolean isAppend) throws InstrumentException {
+ public File write(byte[] data, int off, int len, boolean isAppend) throws InternalException {
FileOutputStream out = null;
try {
out = new FileOutputStream(FileKit.touch(file), isAppend);
out.write(data, off, len);
out.flush();
} catch (IOException e) {
- throw new InstrumentException(e);
+ throw new InternalException(e);
} finally {
IoKit.close(out);
}
@@ -335,9 +335,9 @@ public File write(byte[] data, int off, int len, boolean isAppend) throws Instru
*
* @param in 输入流,不关闭
* @return dest
- * @throws InstrumentException IO异常
+ * @throws InternalException IO异常
*/
- public File writeFromStream(InputStream in) throws InstrumentException {
+ public File writeFromStream(InputStream in) throws InternalException {
return writeFromStream(in, true);
}
@@ -347,15 +347,15 @@ public File writeFromStream(InputStream in) throws InstrumentException {
* @param in 输入流,不关闭
* @param isClose 是否关闭输入流
* @return dest
- * @throws InstrumentException IO异常
+ * @throws InternalException IO异常
*/
- public File writeFromStream(InputStream in, boolean isClose) throws InstrumentException {
+ public File writeFromStream(InputStream in, boolean isClose) throws InternalException {
FileOutputStream out = null;
try {
out = new FileOutputStream(FileKit.touch(file));
IoKit.copy(in, out);
} catch (IOException e) {
- throw new InstrumentException(e);
+ throw new InternalException(e);
} finally {
IoKit.close(out);
if (isClose) {
@@ -369,13 +369,13 @@ public File writeFromStream(InputStream in, boolean isClose) throws InstrumentEx
* 获得一个输出流对象
*
* @return 输出流对象
- * @throws InstrumentException IO异常
+ * @throws InternalException IO异常
*/
- public BufferedOutputStream getOutputStream() throws InstrumentException {
+ public BufferedOutputStream getOutputStream() throws InternalException {
try {
return new BufferedOutputStream(new FileOutputStream(FileKit.touch(file)));
} catch (IOException e) {
- throw new InstrumentException(e);
+ throw new InternalException(e);
}
}
@@ -384,13 +384,13 @@ public BufferedOutputStream getOutputStream() throws InstrumentException {
*
* @param isAppend 是否追加
* @return BufferedReader对象
- * @throws InstrumentException IO异常
+ * @throws InternalException IO异常
*/
- public BufferedWriter getWriter(boolean isAppend) throws InstrumentException {
+ public BufferedWriter getWriter(boolean isAppend) throws InternalException {
try {
return new BufferedWriter(new OutputStreamWriter(new FileOutputStream(FileKit.touch(file), isAppend), charset));
} catch (Exception e) {
- throw new InstrumentException(e);
+ throw new InternalException(e);
}
}
@@ -399,21 +399,21 @@ public BufferedWriter getWriter(boolean isAppend) throws InstrumentException {
*
* @param isAppend 是否追加
* @return 打印对象
- * @throws InstrumentException IO异常
+ * @throws InternalException IO异常
*/
- public PrintWriter getPrintWriter(boolean isAppend) throws InstrumentException {
+ public PrintWriter getPrintWriter(boolean isAppend) throws InternalException {
return new PrintWriter(getWriter(isAppend));
}
/**
* 检查文件
*
- * @throws InstrumentException IO异常
+ * @throws InternalException IO异常
*/
- private void checkFile() throws InstrumentException {
+ private void checkFile() throws InternalException {
Assert.notNull(file, "File to write content is null !");
if (this.file.exists() && false == file.isFile()) {
- throw new InstrumentException("File [{}] is not a file !", this.file.getAbsoluteFile());
+ throw new InternalException("File [{}] is not a file !", this.file.getAbsoluteFile());
}
}
diff --git a/bus-core/src/main/java/org/aoju/bus/core/io/file/LineReadWatcher.java b/bus-core/src/main/java/org/aoju/bus/core/io/file/LineReadWatcher.java
index b2041c9a47..136f38576b 100755
--- a/bus-core/src/main/java/org/aoju/bus/core/io/file/LineReadWatcher.java
+++ b/bus-core/src/main/java/org/aoju/bus/core/io/file/LineReadWatcher.java
@@ -25,7 +25,7 @@
********************************************************************************/
package org.aoju.bus.core.io.file;
-import org.aoju.bus.core.exception.InstrumentException;
+import org.aoju.bus.core.exception.InternalException;
import org.aoju.bus.core.io.LineHandler;
import org.aoju.bus.core.io.watcher.SimpleWatcher;
import org.aoju.bus.core.toolkit.FileKit;
@@ -90,7 +90,7 @@ public void onModify(WatchEvent> event, Path currentPath) {
// 记录当前读到的位置
randomAccessFile.seek(currentLength);
} catch (IOException e) {
- throw new InstrumentException(e);
+ throw new InternalException(e);
}
}
diff --git a/bus-core/src/main/java/org/aoju/bus/core/io/file/Tailer.java b/bus-core/src/main/java/org/aoju/bus/core/io/file/Tailer.java
index 95ebed1f33..066a8f4044 100644
--- a/bus-core/src/main/java/org/aoju/bus/core/io/file/Tailer.java
+++ b/bus-core/src/main/java/org/aoju/bus/core/io/file/Tailer.java
@@ -25,7 +25,7 @@
********************************************************************************/
package org.aoju.bus.core.io.file;
-import org.aoju.bus.core.exception.InstrumentException;
+import org.aoju.bus.core.exception.InternalException;
import org.aoju.bus.core.io.LineHandler;
import org.aoju.bus.core.lang.Charset;
import org.aoju.bus.core.lang.Console;
@@ -128,10 +128,10 @@ public Tailer(File file, java.nio.charset.Charset charset, LineHandler lineHandl
*/
private static void checkFile(File file) {
if (false == file.exists()) {
- throw new InstrumentException("File [{}] not exist !", file.getAbsolutePath());
+ throw new InternalException("File [{}] not exist !", file.getAbsolutePath());
}
if (false == file.isFile()) {
- throw new InstrumentException("Path [{}] is not a file !", file.getAbsolutePath());
+ throw new InternalException("Path [{}] is not a file !", file.getAbsolutePath());
}
}
@@ -152,7 +152,7 @@ public void start(boolean async) {
try {
this.readTail();
} catch (IOException e) {
- throw new InstrumentException(e);
+ throw new InternalException(e);
}
final LineReadWatcher lineReadWatcher = new LineReadWatcher(this.randomAccessFile, this.charset, this.lineHandler);
@@ -166,7 +166,7 @@ public void start(boolean async) {
try {
scheduledFuture.get();
} catch (ExecutionException | InterruptedException e) {
- throw new InstrumentException(e);
+ throw new InternalException(e);
}
}
}
@@ -231,7 +231,7 @@ private void readTail() throws IOException {
try {
this.randomAccessFile.seek(len);
} catch (IOException e) {
- throw new InstrumentException(e);
+ throw new InternalException(e);
}
}
diff --git a/bus-core/src/main/java/org/aoju/bus/core/io/resource/BytesResource.java b/bus-core/src/main/java/org/aoju/bus/core/io/resource/BytesResource.java
index e0f382dabb..884425d4da 100755
--- a/bus-core/src/main/java/org/aoju/bus/core/io/resource/BytesResource.java
+++ b/bus-core/src/main/java/org/aoju/bus/core/io/resource/BytesResource.java
@@ -25,7 +25,7 @@
********************************************************************************/
package org.aoju.bus.core.io.resource;
-import org.aoju.bus.core.exception.InstrumentException;
+import org.aoju.bus.core.exception.InternalException;
import org.aoju.bus.core.toolkit.StringKit;
import java.io.ByteArrayInputStream;
@@ -81,12 +81,12 @@ public InputStream getStream() {
}
@Override
- public String readString(Charset charset) throws InstrumentException {
+ public String readString(Charset charset) throws InternalException {
return StringKit.toString(this.bytes, charset);
}
@Override
- public byte[] readBytes() throws InstrumentException {
+ public byte[] readBytes() throws InternalException {
return this.bytes;
}
diff --git a/bus-core/src/main/java/org/aoju/bus/core/io/resource/CharSequenceResource.java b/bus-core/src/main/java/org/aoju/bus/core/io/resource/CharSequenceResource.java
index 1dc7778fbd..3bb481d579 100644
--- a/bus-core/src/main/java/org/aoju/bus/core/io/resource/CharSequenceResource.java
+++ b/bus-core/src/main/java/org/aoju/bus/core/io/resource/CharSequenceResource.java
@@ -25,7 +25,7 @@
********************************************************************************/
package org.aoju.bus.core.io.resource;
-import org.aoju.bus.core.exception.InstrumentException;
+import org.aoju.bus.core.exception.InternalException;
import org.aoju.bus.core.toolkit.IoKit;
import org.aoju.bus.core.toolkit.StringKit;
@@ -101,12 +101,12 @@ public BufferedReader getReader(Charset charset) {
}
@Override
- public String readString(Charset charset) throws InstrumentException {
+ public String readString(Charset charset) throws InternalException {
return this.data.toString();
}
@Override
- public byte[] readBytes() throws InstrumentException {
+ public byte[] readBytes() throws InternalException {
return this.data.toString().getBytes(this.charset);
}
diff --git a/bus-core/src/main/java/org/aoju/bus/core/io/resource/ClassPathResource.java b/bus-core/src/main/java/org/aoju/bus/core/io/resource/ClassPathResource.java
index c8901228fa..c082d8dd7c 100755
--- a/bus-core/src/main/java/org/aoju/bus/core/io/resource/ClassPathResource.java
+++ b/bus-core/src/main/java/org/aoju/bus/core/io/resource/ClassPathResource.java
@@ -25,7 +25,7 @@
********************************************************************************/
package org.aoju.bus.core.io.resource;
-import org.aoju.bus.core.exception.InstrumentException;
+import org.aoju.bus.core.exception.InternalException;
import org.aoju.bus.core.lang.Assert;
import org.aoju.bus.core.lang.Symbol;
import org.aoju.bus.core.toolkit.*;
@@ -137,7 +137,7 @@ private void initUrl() {
super.url = ClassLoader.getSystemResource(this.path);
}
if (null == super.url) {
- throw new InstrumentException("Resource of path [{}] not exist!", this.path);
+ throw new InternalException("Resource of path [{}] not exist!", this.path);
}
}
diff --git a/bus-core/src/main/java/org/aoju/bus/core/io/resource/FileObjectResource.java b/bus-core/src/main/java/org/aoju/bus/core/io/resource/FileObjectResource.java
index 63401215c6..1ee734d22d 100644
--- a/bus-core/src/main/java/org/aoju/bus/core/io/resource/FileObjectResource.java
+++ b/bus-core/src/main/java/org/aoju/bus/core/io/resource/FileObjectResource.java
@@ -25,7 +25,7 @@
********************************************************************************/
package org.aoju.bus.core.io.resource;
-import org.aoju.bus.core.exception.InstrumentException;
+import org.aoju.bus.core.exception.InternalException;
import org.aoju.bus.core.toolkit.IoKit;
import javax.tools.FileObject;
@@ -83,7 +83,7 @@ public InputStream getStream() {
try {
return this.fileObject.openInputStream();
} catch (IOException e) {
- throw new InstrumentException(e);
+ throw new InternalException(e);
}
}
@@ -92,7 +92,7 @@ public BufferedReader getReader(Charset charset) {
try {
return IoKit.getReader(this.fileObject.openReader(false));
} catch (IOException e) {
- throw new InstrumentException(e);
+ throw new InternalException(e);
}
}
diff --git a/bus-core/src/main/java/org/aoju/bus/core/io/resource/MultiResource.java b/bus-core/src/main/java/org/aoju/bus/core/io/resource/MultiResource.java
index bd9956f681..2ea5619db1 100755
--- a/bus-core/src/main/java/org/aoju/bus/core/io/resource/MultiResource.java
+++ b/bus-core/src/main/java/org/aoju/bus/core/io/resource/MultiResource.java
@@ -25,7 +25,7 @@
********************************************************************************/
package org.aoju.bus.core.io.resource;
-import org.aoju.bus.core.exception.InstrumentException;
+import org.aoju.bus.core.exception.InternalException;
import org.aoju.bus.core.toolkit.CollKit;
import java.io.BufferedReader;
@@ -97,12 +97,12 @@ public BufferedReader getReader(Charset charset) {
}
@Override
- public String readString(Charset charset) throws InstrumentException {
+ public String readString(Charset charset) throws InternalException {
return resources.get(cursor).readString(charset);
}
@Override
- public byte[] readBytes() throws InstrumentException {
+ public byte[] readBytes() throws InternalException {
return resources.get(cursor).readBytes();
}
diff --git a/bus-core/src/main/java/org/aoju/bus/core/io/resource/Resource.java b/bus-core/src/main/java/org/aoju/bus/core/io/resource/Resource.java
index 250da37325..1f11d7b04e 100755
--- a/bus-core/src/main/java/org/aoju/bus/core/io/resource/Resource.java
+++ b/bus-core/src/main/java/org/aoju/bus/core/io/resource/Resource.java
@@ -25,7 +25,7 @@
********************************************************************************/
package org.aoju.bus.core.io.resource;
-import org.aoju.bus.core.exception.InstrumentException;
+import org.aoju.bus.core.exception.InternalException;
import org.aoju.bus.core.toolkit.IoKit;
import java.io.BufferedReader;
@@ -91,9 +91,9 @@ default BufferedReader getReader(Charset charset) {
*
* @param charset 编码
* @return 读取资源内容
- * @throws InstrumentException 包装{@link IOException}
+ * @throws InternalException 包装{@link IOException}
*/
- default String readString(Charset charset) throws InstrumentException {
+ default String readString(Charset charset) throws InternalException {
return IoKit.read(getReader(charset));
}
@@ -102,9 +102,9 @@ default String readString(Charset charset) throws InstrumentException {
* 关闭流并不影响下一次读取
*
* @return 读取资源内容
- * @throws InstrumentException 包装IOException
+ * @throws InternalException 包装IOException
*/
- default byte[] readBytes() throws InstrumentException {
+ default byte[] readBytes() throws InternalException {
return IoKit.readBytes(getStream());
}
@@ -112,13 +112,13 @@ default byte[] readBytes() throws InstrumentException {
* 将资源内容写出到流,不关闭输出流,但是关闭资源流
*
* @param out 输出流
- * @throws InstrumentException IO异常
+ * @throws InternalException IO异常
*/
- default void writeTo(OutputStream out) throws InstrumentException {
+ default void writeTo(OutputStream out) throws InternalException {
try (InputStream in = getStream()) {
IoKit.copy(in, out);
} catch (IOException e) {
- throw new InstrumentException(e);
+ throw new InternalException(e);
}
}
diff --git a/bus-core/src/main/java/org/aoju/bus/core/io/resource/UriResource.java b/bus-core/src/main/java/org/aoju/bus/core/io/resource/UriResource.java
index 5dbf22254a..579af9ffde 100755
--- a/bus-core/src/main/java/org/aoju/bus/core/io/resource/UriResource.java
+++ b/bus-core/src/main/java/org/aoju/bus/core/io/resource/UriResource.java
@@ -25,7 +25,7 @@
********************************************************************************/
package org.aoju.bus.core.io.resource;
-import org.aoju.bus.core.exception.InstrumentException;
+import org.aoju.bus.core.exception.InternalException;
import org.aoju.bus.core.lang.Normal;
import org.aoju.bus.core.toolkit.FileKit;
import org.aoju.bus.core.toolkit.ObjectKit;
@@ -100,7 +100,7 @@ public URL getUrl() {
@Override
public InputStream getStream() {
if (null == this.url) {
- throw new InstrumentException("Resource URL is null!");
+ throw new InternalException("Resource URL is null!");
}
return UriKit.getStream(url);
}
diff --git a/bus-core/src/main/java/org/aoju/bus/core/io/stream/BOMInputStream.java b/bus-core/src/main/java/org/aoju/bus/core/io/stream/BOMInputStream.java
index 82aa7300db..752e601402 100755
--- a/bus-core/src/main/java/org/aoju/bus/core/io/stream/BOMInputStream.java
+++ b/bus-core/src/main/java/org/aoju/bus/core/io/stream/BOMInputStream.java
@@ -25,7 +25,7 @@
********************************************************************************/
package org.aoju.bus.core.io.stream;
-import org.aoju.bus.core.exception.InstrumentException;
+import org.aoju.bus.core.exception.InternalException;
import org.aoju.bus.core.lang.Charset;
import java.io.IOException;
@@ -99,7 +99,7 @@ public String getCharset() {
try {
init();
} catch (IOException ex) {
- throw new InstrumentException(ex);
+ throw new InternalException(ex);
}
}
return charset;
diff --git a/bus-core/src/main/java/org/aoju/bus/core/io/stream/FastByteOutputStream.java b/bus-core/src/main/java/org/aoju/bus/core/io/stream/FastByteOutputStream.java
index 93d2f9ee80..1fadcb53ea 100755
--- a/bus-core/src/main/java/org/aoju/bus/core/io/stream/FastByteOutputStream.java
+++ b/bus-core/src/main/java/org/aoju/bus/core/io/stream/FastByteOutputStream.java
@@ -25,7 +25,7 @@
********************************************************************************/
package org.aoju.bus.core.io.stream;
-import org.aoju.bus.core.exception.InstrumentException;
+import org.aoju.bus.core.exception.InternalException;
import org.aoju.bus.core.io.buffer.FastByteBuffer;
import org.aoju.bus.core.lang.Charset;
import org.aoju.bus.core.lang.Normal;
@@ -89,9 +89,9 @@ public void reset() {
* 写出
*
* @param out 输出流
- * @throws InstrumentException IO异常
+ * @throws InternalException IO异常
*/
- public void writeTo(OutputStream out) throws InstrumentException {
+ public void writeTo(OutputStream out) throws InternalException {
final int index = buffer.index();
if (index < 0) {
return;
@@ -104,7 +104,7 @@ public void writeTo(OutputStream out) throws InstrumentException {
}
out.write(buffer.array(index), 0, buffer.offset());
} catch (IOException e) {
- throw new InstrumentException(e);
+ throw new InternalException(e);
}
}
diff --git a/bus-core/src/main/java/org/aoju/bus/core/io/stream/StreamBuffer.java b/bus-core/src/main/java/org/aoju/bus/core/io/stream/StreamBuffer.java
index 17a5d0e803..f771710489 100644
--- a/bus-core/src/main/java/org/aoju/bus/core/io/stream/StreamBuffer.java
+++ b/bus-core/src/main/java/org/aoju/bus/core/io/stream/StreamBuffer.java
@@ -25,7 +25,7 @@
********************************************************************************/
package org.aoju.bus.core.io.stream;
-import org.aoju.bus.core.exception.InstrumentException;
+import org.aoju.bus.core.exception.InternalException;
import org.aoju.bus.core.lang.Charset;
import org.aoju.bus.core.lang.Normal;
import org.aoju.bus.core.toolkit.IoKit;
@@ -86,7 +86,7 @@ public String toString() {
try {
return toString(Charset.DEFAULT_CHARSET);
} catch (IOException e) {
- throw new InstrumentException(e);
+ throw new InternalException(e);
}
}
diff --git a/bus-core/src/main/java/org/aoju/bus/core/io/stream/StringInputStream.java b/bus-core/src/main/java/org/aoju/bus/core/io/stream/StringInputStream.java
index 92d876aa29..f88bd5f433 100644
--- a/bus-core/src/main/java/org/aoju/bus/core/io/stream/StringInputStream.java
+++ b/bus-core/src/main/java/org/aoju/bus/core/io/stream/StringInputStream.java
@@ -25,7 +25,7 @@
********************************************************************************/
package org.aoju.bus.core.io.stream;
-import org.aoju.bus.core.exception.InstrumentException;
+import org.aoju.bus.core.exception.InternalException;
import org.aoju.bus.core.lang.Charset;
import java.io.ByteArrayInputStream;
@@ -54,7 +54,7 @@ protected static byte[] toBytes(CharSequence text, java.nio.charset.Charset char
try {
return text.toString().getBytes(charset.name());
} catch (UnsupportedEncodingException e) {
- throw new InstrumentException(e);
+ throw new InternalException(e);
}
}
diff --git a/bus-core/src/main/java/org/aoju/bus/core/io/watcher/WatchMonitor.java b/bus-core/src/main/java/org/aoju/bus/core/io/watcher/WatchMonitor.java
index 73bd564046..0f3feefd29 100755
--- a/bus-core/src/main/java/org/aoju/bus/core/io/watcher/WatchMonitor.java
+++ b/bus-core/src/main/java/org/aoju/bus/core/io/watcher/WatchMonitor.java
@@ -25,7 +25,7 @@
********************************************************************************/
package org.aoju.bus.core.io.watcher;
-import org.aoju.bus.core.exception.InstrumentException;
+import org.aoju.bus.core.exception.InternalException;
import org.aoju.bus.core.lang.Symbol;
import org.aoju.bus.core.toolkit.FileKit;
import org.aoju.bus.core.toolkit.StringKit;
@@ -280,7 +280,7 @@ public static WatchMonitor createAll(URL url, Watcher watcher) {
try {
return createAll(Paths.get(url.toURI()), watcher);
} catch (URISyntaxException e) {
- throw new InstrumentException(e);
+ throw new InternalException(e);
}
}
@@ -327,10 +327,10 @@ public static WatchMonitor createAll(Path path, Watcher watcher) {
* 2、创建{@link WatchService} 对象
*
*
- * @throws InstrumentException 监听异常,IO异常时抛出此异常
+ * @throws InternalException 监听异常,IO异常时抛出此异常
*/
@Override
- public void init() throws InstrumentException {
+ public void init() throws InternalException {
//获取目录或文件路径
if (false == Files.exists(this.path, LinkOption.NOFOLLOW_LINKS)) {
// 不存在的路径
@@ -348,7 +348,7 @@ public void init() throws InstrumentException {
try {
Files.createDirectories(this.path);
} catch (IOException e) {
- throw new InstrumentException(e);
+ throw new InternalException(e);
}
} else if (Files.isRegularFile(this.path, LinkOption.NOFOLLOW_LINKS)) {
// 文件路径
@@ -387,11 +387,11 @@ public void watch() {
* 开始监听事件,阻塞当前进程
*
* @param watcher 监听
- * @throws InstrumentException 监听异常,如果监听关闭抛出此异常
+ * @throws InternalException 监听异常,如果监听关闭抛出此异常
*/
- public void watch(Watcher watcher) throws InstrumentException {
+ public void watch(Watcher watcher) throws InternalException {
if (isClosed) {
- throw new InstrumentException("Watch Monitor is closed !");
+ throw new InternalException("Watch Monitor is closed !");
}
// 按照层级注册路径及其子路径
diff --git a/bus-core/src/main/java/org/aoju/bus/core/io/watcher/WatchServer.java b/bus-core/src/main/java/org/aoju/bus/core/io/watcher/WatchServer.java
index 43d7fa71ba..9c3de67e50 100644
--- a/bus-core/src/main/java/org/aoju/bus/core/io/watcher/WatchServer.java
+++ b/bus-core/src/main/java/org/aoju/bus/core/io/watcher/WatchServer.java
@@ -25,7 +25,7 @@
********************************************************************************/
package org.aoju.bus.core.io.watcher;
-import org.aoju.bus.core.exception.InstrumentException;
+import org.aoju.bus.core.exception.InternalException;
import org.aoju.bus.core.lang.Filter;
import org.aoju.bus.core.toolkit.ArrayKit;
import org.aoju.bus.core.toolkit.IoKit;
@@ -76,14 +76,14 @@ public class WatchServer extends Thread implements Closeable, Serializable {
* 2、创建{@link WatchService} 对象
*
*
- * @throws InstrumentException 监听异常,IO异常时抛出此异常
+ * @throws InternalException 监听异常,IO异常时抛出此异常
*/
- public void init() throws InstrumentException {
+ public void init() throws InternalException {
//初始化监听
try {
watchService = FileSystems.getDefault().newWatchService();
} catch (IOException e) {
- throw new InstrumentException(e);
+ throw new InternalException(e);
}
isClosed = false;
@@ -132,7 +132,7 @@ public FileVisitResult postVisitDirectory(Path dir, IOException exc) throws IOEx
}
} catch (IOException e) {
if (false == (e instanceof AccessDeniedException)) {
- throw new InstrumentException(e);
+ throw new InternalException(e);
}
//对于禁止访问的目录,跳过监听
diff --git a/bus-core/src/main/java/org/aoju/bus/core/key/ID.java b/bus-core/src/main/java/org/aoju/bus/core/key/ID.java
index 229f6efffb..adbbf19312 100644
--- a/bus-core/src/main/java/org/aoju/bus/core/key/ID.java
+++ b/bus-core/src/main/java/org/aoju/bus/core/key/ID.java
@@ -25,7 +25,7 @@
********************************************************************************/
package org.aoju.bus.core.key;
-import org.aoju.bus.core.exception.InstrumentException;
+import org.aoju.bus.core.exception.InternalException;
import org.aoju.bus.core.instance.Instances;
import org.aoju.bus.core.lang.Assert;
import org.aoju.bus.core.toolkit.NetKit;
@@ -181,7 +181,7 @@ public static long getDataCenterId(long maxDatacenterId) {
byte[] mac = null;
try {
mac = NetKit.getLocalHardwareAddress();
- } catch (InstrumentException ignore) {
+ } catch (InternalException ignore) {
// ignore
}
if (null != mac) {
@@ -210,7 +210,7 @@ public static long getWorkerId(long datacenterId, long maxWorkerId) {
mpid.append(datacenterId);
try {
mpid.append(RuntimeKit.getPid());
- } catch (InstrumentException igonre) {
+ } catch (InternalException igonre) {
// ignore
}
// MAC + PID 的 hashcode 获取16个低位
diff --git a/bus-core/src/main/java/org/aoju/bus/core/lang/FileType.java b/bus-core/src/main/java/org/aoju/bus/core/lang/FileType.java
index 6cd1a01b5c..7b8e8a9b3e 100755
--- a/bus-core/src/main/java/org/aoju/bus/core/lang/FileType.java
+++ b/bus-core/src/main/java/org/aoju/bus/core/lang/FileType.java
@@ -25,7 +25,7 @@
********************************************************************************/
package org.aoju.bus.core.lang;
-import org.aoju.bus.core.exception.InstrumentException;
+import org.aoju.bus.core.exception.InternalException;
import org.aoju.bus.core.toolkit.FileKit;
import org.aoju.bus.core.toolkit.IoKit;
import org.aoju.bus.core.toolkit.StringKit;
@@ -75,49 +75,59 @@ public class FileType {
public static final String TYPE_PPS = ".pps";
public static final String TYPE_PPSX = ".ppsx";
/**
- * Photoshop的专用格式Photoshop
+ * psd格式,Photoshop的专用格式Photoshop
*/
public static final String TYPE_PSD = "psd";
/**
- * 图形交换格式
+ * gif格式
*/
public static final String TYPE_GIF = "gif";
/**
- * 联合照片
+ * jpg格式
*/
public static final String TYPE_JPG = "jpg";
/**
- * 联合照片
+ * jpeg格式
*/
public static final String TYPE_JPEG = "jpeg";
/**
- * 英文Bitmap(位图)的简写,它是Windows操作系统中的标准图像文件格式
+ * bmp格式
*/
public static final String TYPE_BMP = "bmp";
/**
- * 可移植网络图形
+ * png格式
*/
public static final String TYPE_PNG = "png";
/**
- * 纯文本文件
+ * csv格式
*/
public static final String TYPE_CSV = "csv";
/**
- * PDF文件
+ * pdf格式
*/
public static final String TYPE_PDF = "pdf";
/**
- * 影像文件
+ * dcm格式
*/
public static final String TYPE_DCM = "dcm";
/**
- * 图片
+ * svg格式
*/
- public static final Map PICS = new HashMap() {
+ public static final String TYPE_SVG = "svg";
+
+ /**
+ * txt格式
+ */
+ public static final String TYPE_TXT = "txt";
+
+ /**
+ * 图片格式
+ */
+ public static final Map PICS = new HashMap<>() {
{
put(".jpe", "image/jpeg");
put(".jpeg", "image/jpeg");
@@ -161,7 +171,7 @@ public class FileType {
/**
* 文档
*/
- public static final Map DOCS = new HashMap() {
+ public static final Map DOCS = new HashMap<>() {
{
// txt
put(".txt", "text/plain");
@@ -388,7 +398,7 @@ public class FileType {
/**
* 压缩文档
*/
- public static final Map ZIPDOCS = new HashMap() {
+ public static final Map ZIPDOCS = new HashMap<>() {
{
put(".7z", "application/x-7z-compressed");
put(".z", "application/x-compress");
@@ -404,7 +414,7 @@ public class FileType {
/**
* 视频
*/
- public static final Map VIDEOS = new HashMap() {
+ public static final Map VIDEOS = new HashMap<>() {
{
put(".flv", "video/x-flv");
put(".3gp", "video/3gpp");
@@ -455,7 +465,7 @@ public class FileType {
/**
* 音频
*/
- public static final Map AUDIOS = new HashMap() {
+ public static final Map AUDIOS = new HashMap<>() {
{
put(".mp3", "audio/mpeg");
put(".wma", "audio/x-ms-wma");
@@ -499,7 +509,7 @@ public class FileType {
/**
* 其他
*/
- public static final Map OTHER = new HashMap() {
+ public static final Map OTHER = new HashMap<>() {
{
// xml类型文件
put(".asa", "application/xml");
@@ -747,7 +757,7 @@ public class FileType {
/**
* 文件信息头
*/
- public static final Map IHDR = new HashMap() {
+ public static final Map IHDR = new HashMap<>() {
{
// JPEG (jpg)
put("ffd8ffe", "jpg");
@@ -896,9 +906,9 @@ public static String getType(String fileStreamHexHead) {
*
* @param in {@link InputStream}
* @return 类型, 文件的扩展名, 未找到为null
- * @throws InstrumentException 读取流引起的异常
+ * @throws InternalException 读取流引起的异常
*/
- public static String getType(InputStream in) throws InstrumentException {
+ public static String getType(InputStream in) throws InternalException {
return getType(IoKit.readHex28Upper(in));
}
@@ -907,9 +917,9 @@ public static String getType(InputStream in) throws InstrumentException {
*
* @param file 文件 {@link File}
* @return 类型, 文件的扩展名, 未找到为null
- * @throws InstrumentException 读取文件引起的异常
+ * @throws InternalException 读取文件引起的异常
*/
- public static String getType(File file) throws InstrumentException {
+ public static String getType(File file) throws InternalException {
FileInputStream in = null;
try {
in = IoKit.toStream(file);
@@ -961,6 +971,8 @@ public static String getType(InputStream in, String filename) {
typeName = "war";
} else if ("ofd".equalsIgnoreCase(extName)) {
typeName = "ofd";
+ } else if ("apk".equalsIgnoreCase(extName)) {
+ typeName = "apk";
}
} else if ("jar".equals(typeName)) {
// wps编辑过的.xlsx文件与.jar的开头相同,通过扩展名判断
@@ -971,6 +983,10 @@ public static String getType(InputStream in, String filename) {
typeName = "docx";
} else if ("pptx".equalsIgnoreCase(extName)) {
typeName = "pptx";
+ } else if ("zip".equalsIgnoreCase(extName)) {
+ typeName = "zip";
+ } else if ("apk".equalsIgnoreCase(extName)) {
+ typeName = "apk";
}
}
return typeName;
@@ -981,9 +997,9 @@ public static String getType(InputStream in, String filename) {
*
* @param path 路径,绝对路径或相对ClassPath的路径
* @return 类型
- * @throws InstrumentException 读取文件引起的异常
+ * @throws InternalException 读取文件引起的异常
*/
- public static String getTypeByPath(String path) throws InstrumentException {
+ public static String getTypeByPath(String path) throws InternalException {
return getType(FileKit.file(path));
}
diff --git a/bus-core/src/main/java/org/aoju/bus/core/lang/Fonts.java b/bus-core/src/main/java/org/aoju/bus/core/lang/Fonts.java
index 9be76f68d2..0558dfc16e 100644
--- a/bus-core/src/main/java/org/aoju/bus/core/lang/Fonts.java
+++ b/bus-core/src/main/java/org/aoju/bus/core/lang/Fonts.java
@@ -1,6 +1,6 @@
package org.aoju.bus.core.lang;
-import org.aoju.bus.core.exception.InstrumentException;
+import org.aoju.bus.core.exception.InternalException;
import java.awt.*;
import java.io.File;
@@ -60,7 +60,7 @@ public static Font createFont(File fontFile) {
try {
return Font.createFont(Font.TYPE1_FONT, fontFile);
} catch (Exception e1) {
- throw new InstrumentException(e);
+ throw new InternalException(e);
}
}
}
@@ -80,10 +80,10 @@ public static Font createFont(InputStream fontStream) {
try {
return Font.createFont(Font.TYPE1_FONT, fontStream);
} catch (Exception e1) {
- throw new InstrumentException(e1);
+ throw new InternalException(e1);
}
} catch (IOException e) {
- throw new InstrumentException(e);
+ throw new InternalException(e);
}
}
diff --git a/bus-core/src/main/java/org/aoju/bus/core/lang/Pid.java b/bus-core/src/main/java/org/aoju/bus/core/lang/Pid.java
index 56bd97935e..58fcf8e677 100755
--- a/bus-core/src/main/java/org/aoju/bus/core/lang/Pid.java
+++ b/bus-core/src/main/java/org/aoju/bus/core/lang/Pid.java
@@ -25,7 +25,7 @@
********************************************************************************/
package org.aoju.bus.core.lang;
-import org.aoju.bus.core.exception.InstrumentException;
+import org.aoju.bus.core.exception.InternalException;
import org.aoju.bus.core.toolkit.StringKit;
import java.lang.management.ManagementFactory;
@@ -51,12 +51,12 @@ public enum Pid {
* 获取当前进程ID,首先获取进程名称,读取@前的ID值,如果不存在,则读取进程名的hash值
*
* @return 进程ID
- * @throws InstrumentException 进程名称为空
+ * @throws InternalException 进程名称为空
*/
- private static int getPid() throws InstrumentException {
+ private static int getPid() throws InternalException {
final String processName = ManagementFactory.getRuntimeMXBean().getName();
if (StringKit.isBlank(processName)) {
- throw new InstrumentException("Process name is blank!");
+ throw new InternalException("Process name is blank!");
}
final int atIndex = processName.indexOf('@');
if (atIndex > 0) {
diff --git a/bus-core/src/main/java/org/aoju/bus/core/lang/caller/StackTraceCaller.java b/bus-core/src/main/java/org/aoju/bus/core/lang/caller/StackTraceCaller.java
index 2368842eb1..453d7e54c9 100755
--- a/bus-core/src/main/java/org/aoju/bus/core/lang/caller/StackTraceCaller.java
+++ b/bus-core/src/main/java/org/aoju/bus/core/lang/caller/StackTraceCaller.java
@@ -25,7 +25,7 @@
********************************************************************************/
package org.aoju.bus.core.lang.caller;
-import org.aoju.bus.core.exception.InstrumentException;
+import org.aoju.bus.core.exception.InternalException;
/**
* 通过StackTrace方式获取调用者 此方式效率最低,不推荐使用
@@ -47,7 +47,7 @@ public Class> getCaller() {
try {
return Class.forName(className);
} catch (ClassNotFoundException e) {
- throw new InstrumentException("[{}] not found!", className);
+ throw new InternalException("[{}] not found!", className);
}
}
@@ -61,7 +61,7 @@ public Class> getCallers() {
try {
return Class.forName(className);
} catch (ClassNotFoundException e) {
- throw new InstrumentException("[{}] not found!", className);
+ throw new InternalException("[{}] not found!", className);
}
}
@@ -75,7 +75,7 @@ public Class> getCaller(int depth) {
try {
return Class.forName(className);
} catch (ClassNotFoundException e) {
- throw new InstrumentException("[{}] not found!", className);
+ throw new InternalException("[{}] not found!", className);
}
}
diff --git a/bus-core/src/main/java/org/aoju/bus/core/lang/reflect/LookupFactory.java b/bus-core/src/main/java/org/aoju/bus/core/lang/reflect/LookupFactory.java
index 090581a1e5..5ba0ca756c 100755
--- a/bus-core/src/main/java/org/aoju/bus/core/lang/reflect/LookupFactory.java
+++ b/bus-core/src/main/java/org/aoju/bus/core/lang/reflect/LookupFactory.java
@@ -25,7 +25,7 @@
********************************************************************************/
package org.aoju.bus.core.lang.reflect;
-import org.aoju.bus.core.exception.InstrumentException;
+import org.aoju.bus.core.exception.InternalException;
import java.lang.invoke.MethodHandles;
import java.lang.reflect.Constructor;
@@ -84,7 +84,7 @@ public static MethodHandles.Lookup lookup(Class> callerClass) {
try {
return (MethodHandles.Lookup) privateLookupInMethod.invoke(MethodHandles.class, callerClass, MethodHandles.lookup());
} catch (IllegalAccessException | InvocationTargetException e) {
- throw new InstrumentException(e);
+ throw new InternalException(e);
}
}
// jdk 8
diff --git a/bus-core/src/main/java/org/aoju/bus/core/lang/reflect/MethodHandle.java b/bus-core/src/main/java/org/aoju/bus/core/lang/reflect/MethodHandle.java
index 077bba52df..14ca611dd0 100755
--- a/bus-core/src/main/java/org/aoju/bus/core/lang/reflect/MethodHandle.java
+++ b/bus-core/src/main/java/org/aoju/bus/core/lang/reflect/MethodHandle.java
@@ -25,7 +25,7 @@
********************************************************************************/
package org.aoju.bus.core.lang.reflect;
-import org.aoju.bus.core.exception.InstrumentException;
+import org.aoju.bus.core.exception.InternalException;
import org.aoju.bus.core.lang.Assert;
import org.aoju.bus.core.toolkit.ReflectKit;
import org.aoju.bus.core.toolkit.StringKit;
@@ -96,7 +96,7 @@ public static java.lang.invoke.MethodHandle findMethod(Class> callerClass, Str
} catch (NoSuchMethodException ignore) {
//ignore
} catch (IllegalAccessException e) {
- throw new InstrumentException(e);
+ throw new InternalException(e);
}
}
@@ -128,7 +128,7 @@ public static java.lang.invoke.MethodHandle findConstructor(Class> callerClass
} catch (NoSuchMethodException e) {
return null;
} catch (IllegalAccessException e) {
- throw new InstrumentException(e);
+ throw new InternalException(e);
}
}
@@ -160,7 +160,7 @@ public static T invokeSpecial(Object object, String methodName, Object... ar
final Method method = ReflectKit.getMethodOfObject(object, methodName, args);
if (null == method) {
- throw new InstrumentException("No such method: [{}] from [{}]", methodName, object.getClass());
+ throw new InternalException("No such method: [{}] from [{}]", methodName, object.getClass());
}
return invokeSpecial(object, method, args);
}
@@ -239,7 +239,7 @@ public static T invoke(boolean isSpecial, Object object, Method method, Obje
}
return (T) handle.invokeWithArguments(args);
} catch (Throwable e) {
- throw new InstrumentException(e);
+ throw new InternalException(e);
}
}
diff --git a/bus-core/src/main/java/org/aoju/bus/core/lang/tree/TreeBuilder.java b/bus-core/src/main/java/org/aoju/bus/core/lang/tree/TreeBuilder.java
index 9c57312d16..2df953c9cf 100644
--- a/bus-core/src/main/java/org/aoju/bus/core/lang/tree/TreeBuilder.java
+++ b/bus-core/src/main/java/org/aoju/bus/core/lang/tree/TreeBuilder.java
@@ -181,6 +181,18 @@ public TreeBuilder append(Iterable> trees) {
* @return this
*/
public TreeBuilder append(List list, NodeParser nodeParser) {
+ return append(list, null, nodeParser);
+ }
+
+ /**
+ * 增加节点列表,增加的节点是不带子节点的
+ *
+ * @param list Bean列表
+ * @param Bean类型
+ * @param nodeParser 节点转换器,用于定义一个Bean如何转换为Tree节点
+ * @return this
+ */
+ public TreeBuilder append(List list, E rootId, NodeParser nodeParser) {
checkBuilt();
final NodeConfig config = this.root.getConfig();
@@ -189,6 +201,9 @@ public TreeBuilder append(List list, NodeParser nodeParser) {
for (T t : list) {
node = new Tree<>(config);
nodeParser.parse(t, node);
+ if (null != rootId && false == rootId.getClass().equals(node.getId().getClass())) {
+ throw new IllegalArgumentException("rootId type is node.getId().getClass()!");
+ }
map.put(node.getId(), node);
}
return append(map);
diff --git a/bus-core/src/main/java/org/aoju/bus/core/loader/JarLoaders.java b/bus-core/src/main/java/org/aoju/bus/core/loader/JarLoaders.java
index 2a0b271c9b..2eef054598 100755
--- a/bus-core/src/main/java/org/aoju/bus/core/loader/JarLoaders.java
+++ b/bus-core/src/main/java/org/aoju/bus/core/loader/JarLoaders.java
@@ -25,7 +25,7 @@
********************************************************************************/
package org.aoju.bus.core.loader;
-import org.aoju.bus.core.exception.InstrumentException;
+import org.aoju.bus.core.exception.InternalException;
import org.aoju.bus.core.toolkit.*;
import java.io.File;
@@ -104,9 +104,9 @@ public static JarLoaders loadJar(File jarFile) {
*
* @param loader {@link URLClassLoader}
* @param jarFile 被加载的jar
- * @throws InstrumentException IO异常包装和执行异常
+ * @throws InternalException IO异常包装和执行异常
*/
- public static void loadJar(URLClassLoader loader, File jarFile) throws InstrumentException {
+ public static void loadJar(URLClassLoader loader, File jarFile) throws InternalException {
try {
final Method method = ClassKit.getDeclaredMethod(URLClassLoader.class, "addURL", URL.class);
if (null != method) {
@@ -117,7 +117,7 @@ public static void loadJar(URLClassLoader loader, File jarFile) throws Instrumen
}
}
} catch (IOException e) {
- throw new InstrumentException(e);
+ throw new InternalException(e);
}
}
@@ -172,7 +172,7 @@ public JarLoaders addJar(File jarFile) {
super.addURL(jar.toURI().toURL());
}
} catch (MalformedURLException e) {
- throw new InstrumentException(e);
+ throw new InternalException(e);
}
return this;
}
diff --git a/bus-core/src/main/java/org/aoju/bus/core/scanner/ClassScaner.java b/bus-core/src/main/java/org/aoju/bus/core/scanner/ClassScaner.java
index 5e2fca2bda..0db75e2e67 100755
--- a/bus-core/src/main/java/org/aoju/bus/core/scanner/ClassScaner.java
+++ b/bus-core/src/main/java/org/aoju/bus/core/scanner/ClassScaner.java
@@ -26,7 +26,7 @@
package org.aoju.bus.core.scanner;
import org.aoju.bus.core.collection.EnumerationIterator;
-import org.aoju.bus.core.exception.InstrumentException;
+import org.aoju.bus.core.exception.InternalException;
import org.aoju.bus.core.lang.Charset;
import org.aoju.bus.core.lang.FileType;
import org.aoju.bus.core.lang.Normal;
@@ -294,7 +294,7 @@ private void scanFile(File file, String rootDir) {
try {
scanJar(new JarFile(file));
} catch (IOException e) {
- throw new InstrumentException(e);
+ throw new InternalException(e);
}
}
} else if (file.isDirectory()) {
diff --git a/bus-core/src/main/java/org/aoju/bus/core/text/Lookups.java b/bus-core/src/main/java/org/aoju/bus/core/text/Lookups.java
index fa9b937808..6db602ab70 100755
--- a/bus-core/src/main/java/org/aoju/bus/core/text/Lookups.java
+++ b/bus-core/src/main/java/org/aoju/bus/core/text/Lookups.java
@@ -25,7 +25,7 @@
********************************************************************************/
package org.aoju.bus.core.text;
-import org.aoju.bus.core.exception.InstrumentException;
+import org.aoju.bus.core.exception.InternalException;
import java.util.Map;
@@ -129,7 +129,7 @@ public String lookup(String key) {
try {
return System.getProperty(key);
} catch (SecurityException e) {
- throw new InstrumentException(e);
+ throw new InternalException(e);
}
}
return null;
diff --git a/bus-core/src/main/java/org/aoju/bus/core/text/TextJoiner.java b/bus-core/src/main/java/org/aoju/bus/core/text/TextJoiner.java
index b52d3abde0..f5cb04fa7f 100644
--- a/bus-core/src/main/java/org/aoju/bus/core/text/TextJoiner.java
+++ b/bus-core/src/main/java/org/aoju/bus/core/text/TextJoiner.java
@@ -1,7 +1,7 @@
package org.aoju.bus.core.text;
import org.aoju.bus.core.collection.ArrayIterator;
-import org.aoju.bus.core.exception.InstrumentException;
+import org.aoju.bus.core.exception.InternalException;
import org.aoju.bus.core.lang.Normal;
import org.aoju.bus.core.toolkit.ArrayKit;
import org.aoju.bus.core.toolkit.IterKit;
@@ -329,7 +329,7 @@ public TextJoiner append(CharSequence text, int startInclude, int endExclude) {
appendable.append(suffix);
}
} catch (IOException e) {
- throw new InstrumentException(e);
+ throw new InternalException(e);
}
return this;
}
diff --git a/bus-core/src/main/java/org/aoju/bus/core/text/csv/CsvParser.java b/bus-core/src/main/java/org/aoju/bus/core/text/csv/CsvParser.java
index 862abcffbc..a9106104b7 100755
--- a/bus-core/src/main/java/org/aoju/bus/core/text/csv/CsvParser.java
+++ b/bus-core/src/main/java/org/aoju/bus/core/text/csv/CsvParser.java
@@ -26,7 +26,7 @@
package org.aoju.bus.core.text.csv;
import org.aoju.bus.core.collection.ComputeIterator;
-import org.aoju.bus.core.exception.InstrumentException;
+import org.aoju.bus.core.exception.InternalException;
import org.aoju.bus.core.lang.Normal;
import org.aoju.bus.core.lang.Symbol;
import org.aoju.bus.core.text.TextBuilder;
@@ -128,9 +128,9 @@ public List getHeader() {
* 读取下一行数据
*
* @return CsvRow
- * @throws InstrumentException IO读取异常
+ * @throws InternalException IO读取异常
*/
- public CsvRow nextRow() throws InstrumentException {
+ public CsvRow nextRow() throws InternalException {
long startingLineNo;
List currentFields;
int fieldCount;
@@ -152,7 +152,7 @@ public CsvRow nextRow() throws InstrumentException {
if (firstLineFieldCount == -1) {
firstLineFieldCount = fieldCount;
} else if (fieldCount != firstLineFieldCount) {
- throw new InstrumentException(String.format("Line %d has %d fields, but first line has %d fields", lineNo, fieldCount, firstLineFieldCount));
+ throw new InternalException(String.format("Line %d has %d fields, but first line has %d fields", lineNo, fieldCount, firstLineFieldCount));
}
}
@@ -201,9 +201,9 @@ private void initHeader(final List currentFields) {
* 行号要考虑注释行和引号包装的内容中的换行
*
* @return 一行数据
- * @throws InstrumentException IO异常
+ * @throws InternalException IO异常
*/
- private List readLine() throws InstrumentException {
+ private List readLine() throws InternalException {
// 矫正行号
// 当一行内容包含多行数据时,记录首行行号,但是读取下一行时,需要把多行内容的行数加上
if (inQuotesLineCount > 0) {
@@ -406,7 +406,7 @@ int read(Reader reader) {
try {
length = reader.read(this.buf);
} catch (IOException e) {
- throw new InstrumentException(e);
+ throw new InternalException(e);
}
this.mark = 0;
this.position = 0;
diff --git a/bus-core/src/main/java/org/aoju/bus/core/text/csv/CsvReader.java b/bus-core/src/main/java/org/aoju/bus/core/text/csv/CsvReader.java
index 63fdd0740e..5ab0422d62 100755
--- a/bus-core/src/main/java/org/aoju/bus/core/text/csv/CsvReader.java
+++ b/bus-core/src/main/java/org/aoju/bus/core/text/csv/CsvReader.java
@@ -25,7 +25,7 @@
********************************************************************************/
package org.aoju.bus.core.text.csv;
-import org.aoju.bus.core.exception.InstrumentException;
+import org.aoju.bus.core.exception.InternalException;
import org.aoju.bus.core.lang.Assert;
import org.aoju.bus.core.lang.Charset;
import org.aoju.bus.core.toolkit.FileKit;
@@ -169,9 +169,9 @@ public void setErrorOnDifferentFieldCount(boolean errorOnDifferentFieldCount) {
*
* @param file CSV文件
* @return {@link CsvData},包含数据列表和行信息
- * @throws InstrumentException IO异常
+ * @throws InternalException IO异常
*/
- public CsvData read(File file) throws InstrumentException {
+ public CsvData read(File file) throws InternalException {
return read(file, Charset.UTF_8);
}
@@ -201,9 +201,9 @@ public void read(String csvStr, CsvHandler rowHandler) {
* @param file CSV文件
* @param charset 文件编码,默认系统编码
* @return {@link CsvData},包含数据列表和行信息
- * @throws InstrumentException IO异常
+ * @throws InternalException IO异常
*/
- public CsvData read(File file, java.nio.charset.Charset charset) throws InstrumentException {
+ public CsvData read(File file, java.nio.charset.Charset charset) throws InternalException {
return read(Objects.requireNonNull(file.toPath(), "file must not be null"), charset);
}
@@ -212,9 +212,9 @@ public CsvData read(File file, java.nio.charset.Charset charset) throws Instrume
*
* @param path CSV文件
* @return {@link CsvData},包含数据列表和行信息
- * @throws InstrumentException IO异常
+ * @throws InternalException IO异常
*/
- public CsvData read(Path path) throws InstrumentException {
+ public CsvData read(Path path) throws InternalException {
return read(path, Charset.UTF_8);
}
@@ -224,14 +224,14 @@ public CsvData read(Path path) throws InstrumentException {
* @param path CSV文件
* @param charset 文件编码,默认系统编码
* @return {@link CsvData},包含数据列表和行信息
- * @throws InstrumentException IO异常
+ * @throws InternalException IO异常
*/
- public CsvData read(Path path, java.nio.charset.Charset charset) throws InstrumentException {
+ public CsvData read(Path path, java.nio.charset.Charset charset) throws InternalException {
Assert.notNull(path, "path must not be null");
try (Reader reader = FileKit.getReader(path, charset)) {
return read(reader);
} catch (IOException e) {
- throw new InstrumentException(e);
+ throw new InternalException(e);
}
}
@@ -240,9 +240,9 @@ public CsvData read(Path path, java.nio.charset.Charset charset) throws Instrume
*
* @param reader Reader
* @return {@link CsvData},包含数据列表和行信息
- * @throws InstrumentException IO异常
+ * @throws InternalException IO异常
*/
- public CsvData read(Reader reader) throws InstrumentException {
+ public CsvData read(Reader reader) throws InternalException {
final CsvParser csvParser = parse(reader);
final List rows = new ArrayList<>();
read(csvParser, rows::add);
@@ -301,9 +301,9 @@ public List read(String csvStr, Class clazz) {
*
* @param reader Reader
* @return {@link CsvData},包含数据列表和行信息
- * @throws InstrumentException IO异常
+ * @throws InternalException IO异常
*/
- public List