Skip to content

Commit

Permalink
v6.5.8
Browse files Browse the repository at this point in the history
v6.5.8
  • Loading branch information
839128 committed Aug 31, 2022
2 parents 9e31c62 + 32ae351 commit f4f598a
Show file tree
Hide file tree
Showing 339 changed files with 2,939 additions and 2,544 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
</p>
<p align="center">
<a target="_blank" href="https://search.maven.org/search?q=org.aoju">
<img src="https://img.shields.io/badge/maven--central-v6.5.6-blue.svg?label=Maven%20Central" />
<img src="https://img.shields.io/badge/maven--central-v6.5.8-blue.svg?label=Maven%20Central" />
</a>
<a target="_blank" href="https://travis-ci.org/aoju/bus">
<img src="https://travis-ci.com/aoju/bus.svg?branch=main">
Expand Down Expand Up @@ -97,7 +97,7 @@ Bus (应用/服务总线) 是一个基础框架、服务套件,它基于Java17
<dependency>
<groupId>org.aoju</groupId>
<artifactId>bus-all</artifactId>
<version>6.5.6</version>
<version>6.5.8</version>
</dependency>
```

Expand Down
2 changes: 1 addition & 1 deletion bus-all/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>org.aoju</groupId>
<artifactId>bus-all</artifactId>
<version>6.5.6</version>
<version>6.5.8</version>
<packaging>jar</packaging>

<name>${project.artifactId}</name>
Expand Down
4 changes: 2 additions & 2 deletions bus-base/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>org.aoju</groupId>
<artifactId>bus-base</artifactId>
<version>6.5.6</version>
<version>6.5.8</version>
<packaging>jar</packaging>

<name>${project.artifactId}</name>
Expand Down Expand Up @@ -42,7 +42,7 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<project.compiler.version>17</project.compiler.version>
<spring.boot.version>2.7.2</spring.boot.version>
<spring.boot.version>2.7.3</spring.boot.version>
<lombok.version>1.18.24</lombok.version>
<persistence.version>2.2</persistence.version>
</properties>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down
31 changes: 16 additions & 15 deletions bus-base/src/main/java/org/aoju/bus/base/advice/ErrorAdvice.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/**
* 异常信息处理
Expand All @@ -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<ErrorService> 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;
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}
Expand Down
17 changes: 12 additions & 5 deletions bus-base/src/main/java/org/aoju/bus/base/service/ErrorService.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,26 +25,33 @@
********************************************************************************/
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
* <code>
* org.aoju.bus.xxx.ErrorService
* </code>
*
* @author Kimi Liu
* @since Java 17+
*/
public interface ErrorService {
@NoArgsConstructor
public class ErrorService {

/**
* 完成请求处理前调用
*
* @param ex 对象参数
* @return 如果执行链应该继续执行, 则为:true 否则:false
*/
default boolean before(Exception ex) {
public boolean before(Exception ex) {
Logger.error(RuntimeKit.getStackTrace(ex));
return true;
}
Expand All @@ -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;
}

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
org.aoju.bus.base.service.ErrorService
2 changes: 1 addition & 1 deletion bus-bom/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>org.aoju</groupId>
<artifactId>bus-bom</artifactId>
<version>6.5.6</version>
<version>6.5.8</version>
<packaging>pom</packaging>

<name>${project.artifactId}</name>
Expand Down
4 changes: 2 additions & 2 deletions bus-cache/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>org.aoju</groupId>
<artifactId>bus-cache</artifactId>
<version>6.5.6</version>
<version>6.5.8</version>
<packaging>jar</packaging>

<name>${project.artifactId}</name>
Expand Down Expand Up @@ -42,7 +42,7 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<project.compiler.version>17</project.compiler.version>
<spring.boot.version>2.7.2</spring.boot.version>
<spring.boot.version>2.7.3</spring.boot.version>
<lombok.version>1.18.24</lombok.version>
<guice.version>5.1.0</guice.version>
<jedis.version>4.2.3</jedis.version>
Expand Down
4 changes: 2 additions & 2 deletions bus-cache/src/main/java/org/aoju/bus/cache/Manage.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -163,7 +163,7 @@ private CachePair<String, CacheX> 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));
});
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -71,7 +71,7 @@ protected Supplier<JdbcOperations> jdbcOperationsSupplier(Map<String, Object> co

return template;
} catch (Exception e) {
throw new InstrumentException(e);
throw new InternalException(e);
}
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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) {
Expand All @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion bus-core/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<dependency>
<groupId>org.aoju</groupId>
<artifactId>bus-core</artifactId>
<version>6.5.6</version>
<version>6.5.8</version>
</dependency>
```

Expand Down
2 changes: 1 addition & 1 deletion bus-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>org.aoju</groupId>
<artifactId>bus-core</artifactId>
<version>6.5.6</version>
<version>6.5.8</version>
<packaging>jar</packaging>

<name>${project.artifactId}</name>
Expand Down
4 changes: 2 additions & 2 deletions bus-core/src/main/java/org/aoju/bus/core/Binder.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -159,7 +159,7 @@ public <T> T bind(Class<T> clazz, String prefix) {
try {
object = clazz.getConstructor().newInstance();
} catch (Exception e) {
throw new InstrumentException(e);
throw new InternalException(e);
}

Class<?> actualClass = ClassKit.getCglibActualClass(clazz);
Expand Down
2 changes: 1 addition & 1 deletion bus-core/src/main/java/org/aoju/bus/core/Version.java
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public class Version {
* @return 项目的版本号
*/
public static String get() {
return "6.5.6.RELEASE";
return "6.5.8.RELEASE";
}

/**
Expand Down
14 changes: 7 additions & 7 deletions bus-core/src/main/java/org/aoju/bus/core/beans/DynamicBean.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -130,15 +130,15 @@ public Object invoke(String methodName, Object... params) {
* @param <T> 属性值类型
* @param fieldName 字段名
* @return 字段值
* @throws InstrumentException 反射获取属性值或字段值导致的异常
* @throws InternalException 反射获取属性值或字段值导致的异常
*/
public <T> T get(String fieldName) throws InstrumentException {
public <T> 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);
}
Expand All @@ -149,15 +149,15 @@ public <T> 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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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());
}
}

Expand Down Expand Up @@ -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());
}
// 忽略注入失败
}
Expand Down
Loading

0 comments on commit f4f598a

Please sign in to comment.