Skip to content

Commit 596b483

Browse files
committed
chore[storage]: improve log output
1 parent a40b6b4 commit 596b483

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

storage/src/main/java/com/zfoo/storage/manager/StorageManager.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ public void initBefore() {
114114
for (var field : fieldList) {
115115
if (Modifier.isPublic(field.getModifiers())) {
116116
// 因为静态资源类是不能被修改的,资源类的属性不能被public修饰,用private修饰或者开启配置writeable属性
117-
throw new RunException("Static resource classes cannot be modified, [class:{}][filed:{}] cannot be modified by public, use private modified or enable writeable configuration", clazz, field.getName());
117+
throw new RunException("Static resource classes cannot be modified, class:[{}] filed:{}[] cannot be modified by public, use private modified or enable writeable configuration", clazz, field.getName());
118118
}
119119

120120
var setMethodName = StringUtils.EMPTY;
@@ -158,7 +158,7 @@ public void inject() {
158158
Type type = field.getGenericType();
159159

160160
if (!(type instanceof ParameterizedType)) {
161-
throw new RuntimeException(StringUtils.format("[bean:{}] type declaration is incorrect, not a generic class", targetBean.getClass().getSimpleName()));
161+
throw new RuntimeException(StringUtils.format("bean:[{}] type declaration is incorrect, not a generic class", targetBean.getClass().getSimpleName()));
162162
}
163163

164164
Type[] types = ((ParameterizedType) type).getActualTypeArguments();
@@ -172,17 +172,17 @@ public void inject() {
172172
IStorage<?, ?> storage = storageMap.get(resourceClazz);
173173

174174
if (storage == null) {
175-
throw new RuntimeException(StringUtils.format("Static class [resource:{}] does not exist", resourceClazz.getSimpleName()));
175+
throw new RuntimeException(StringUtils.format("Static class resource:[{}] does not exist", resourceClazz.getSimpleName()));
176176
}
177177

178178
Field[] idFields = ReflectionUtils.getFieldsByAnnoInPOJOClass(resourceClazz, Id.class);
179179
if (idFields.length != 1) {
180-
throw new RuntimeException(StringUtils.format("Static class [resource:{}] has no @Id annotation", resourceClazz.getSimpleName()));
180+
throw new RuntimeException(StringUtils.format("Static class resource:[{}] has no @Id annotation", resourceClazz.getSimpleName()));
181181
}
182182

183183
if (!keyClazz.getSimpleName().toLowerCase().contains(idFields[0].getType().getSimpleName().toLowerCase())) {
184184
// 注入静态类配置资源的类型和泛型类型不匹配
185-
throw new RuntimeException(StringUtils.format("Inject static class configuration [storage:{}][key:{}] type and generic type [type:{}] do not match", resourceClazz.getSimpleName(), idFields[0].getType().getSimpleName(), keyClazz.getSimpleName()));
185+
throw new RuntimeException(StringUtils.format("Inject static class configuration storage:[{}] key:[{}] type and generic type type:[{}] do not match", resourceClazz.getSimpleName(), idFields[0].getType().getSimpleName(), keyClazz.getSimpleName()));
186186
}
187187

188188
ReflectionUtils.makeAccessible(field);
@@ -328,7 +328,7 @@ private Resource scanResourceFile(Class<?> clazz) {
328328
}
329329
if (resourceSet.size() > 1) {
330330
var resourceNames = resourceSet.stream().map(it -> it.getFilename()).collect(Collectors.joining(StringUtils.COMMA));
331-
throw new RuntimeException(StringUtils.format("Resource [class:{}] has duplicate configuration [{}]", clazz.getSimpleName(), resourceNames));
331+
throw new RuntimeException(StringUtils.format("Resource class:[{}] has duplicate configuration [{}]", clazz.getSimpleName(), resourceNames));
332332
}
333333

334334
return resourceSet.stream().findFirst().get();

0 commit comments

Comments
 (0)