fix 修复 加解密拦截器 对象属性为null问题

2.X
疯狂的狮子li 2 years ago
parent bce4f4ade1
commit 4d598dd3e2

@ -76,7 +76,12 @@ public class MybatisDecryptInterceptor implements Interceptor {
Set<Field> fields = encryptorManager.getFieldCache(sourceObject.getClass());
try {
for (Field field : fields) {
field.set(sourceObject, this.decryptField(String.valueOf(field.get(sourceObject)), field));
// 防止对象不是null 属性内容是null
Object obj = field.get(sourceObject);
if (ObjectUtil.isNull(obj)) {
continue;
}
field.set(sourceObject, this.decryptField(String.valueOf(field.get(obj)), field));
}
} catch (Exception e) {
log.error("处理解密字段时出错", e);

@ -86,7 +86,12 @@ public class MybatisEncryptInterceptor implements Interceptor {
Set<Field> fields = encryptorManager.getFieldCache(sourceObject.getClass());
try {
for (Field field : fields) {
field.set(sourceObject, this.encryptField(String.valueOf(field.get(sourceObject)), field));
// 防止对象不是null 属性内容是null
Object obj = field.get(sourceObject);
if (ObjectUtil.isNull(obj)) {
continue;
}
field.set(sourceObject, this.encryptField(String.valueOf(field.get(obj)), field));
}
} catch (Exception e) {
log.error("处理加密字段时出错", e);

Loading…
Cancel
Save