diff --git a/ContentGrabbingJi-common/src/main/java/net/lamgc/cgj/bot/cache/CacheStoreBuilder.java b/ContentGrabbingJi-common/src/main/java/net/lamgc/cgj/bot/cache/CacheStoreBuilder.java index a19aa9f..b081995 100644 --- a/ContentGrabbingJi-common/src/main/java/net/lamgc/cgj/bot/cache/CacheStoreBuilder.java +++ b/ContentGrabbingJi-common/src/main/java/net/lamgc/cgj/bot/cache/CacheStoreBuilder.java @@ -97,7 +97,8 @@ public class CacheStoreBuilder { * 获取一个当前可用的高优先级 Factory 对象. * @return 返回可用的高优先级 Factory 对象. */ - private static > R getFactory(CacheStoreSource storeSource, Function function) + private static > R getFactory(CacheStoreSource storeSource, + Function function) throws NoSuchFactoryException { if (FACTORY_LIST.size() == 0) { loadFactory(); @@ -130,8 +131,9 @@ public class CacheStoreBuilder { return result; } catch (Exception e) { if (!iterator.hasNext()) { - throw new NoSuchFactoryException(new GetCacheStoreException("CacheStoreFactory " + info.getFactoryName() + - " (" + factory.getClass().getName() + ") 创建 CacheStore 时发生异常.", e)); + throw new NoSuchFactoryException(new GetCacheStoreException("CacheStoreFactory " + + info.getFactoryName() + " (" + factory.getClass().getName() + + ") 创建 CacheStore 时发生异常.", e)); } else { if (e instanceof GetCacheStoreException) { log.warn("CacheStoreFactory '{} ({})' 无法提供相应 CacheStore. 原因: {}", @@ -167,7 +169,8 @@ public class CacheStoreBuilder { * @return 返回新的存储容器, 与其他容器互不干扰. * @throws GetCacheStoreException 当无法获取可用的 CacheStore 时抛出. */ - public static SingleCacheStore newSingleCacheStore(CacheStoreSource storeSource, String identify, StringConverter converter) { + public static SingleCacheStore newSingleCacheStore(CacheStoreSource storeSource, String identify, + StringConverter converter) { try { return getFactory(storeSource, factory -> { SingleCacheStore singleCacheStoreInstance = factory.newSingleCacheStore(identify, converter); @@ -202,7 +205,8 @@ public class CacheStoreBuilder { * @return 返回新的存储容器, 与其他容器互不干扰. * @throws GetCacheStoreException 当无法获取可用的 CacheStore 时抛出. */ - public static ListCacheStore newListCacheStore(CacheStoreSource storeSource, String identify, StringConverter converter) { + public static ListCacheStore newListCacheStore(CacheStoreSource storeSource, String identify, + StringConverter converter) { try { return getFactory(storeSource, factory -> { ListCacheStore listCacheStoreInstance = factory.newListCacheStore(identify, converter); @@ -236,7 +240,8 @@ public class CacheStoreBuilder { * @return 返回新的存储容器, 与其他容器互不干扰. * @throws GetCacheStoreException 当无法获取可用的 CacheStore 时抛出. */ - public static SetCacheStore newSetCacheStore(CacheStoreSource storeSource, String identify, StringConverter converter) { + public static SetCacheStore newSetCacheStore(CacheStoreSource storeSource, String identify, + StringConverter converter) { try { return getFactory(storeSource, factory -> { SetCacheStore setCacheStoreInstance = factory.newSetCacheStore(identify, converter); @@ -271,7 +276,8 @@ public class CacheStoreBuilder { * @return 返回新的存储容器, 与其他容器互不干扰. * @throws GetCacheStoreException 当无法获取可用的 CacheStore 时抛出. */ - public static MapCacheStore newMapCacheStore(CacheStoreSource storeSource, String identify, StringConverter converter) { + public static MapCacheStore newMapCacheStore(CacheStoreSource storeSource, String identify, + StringConverter converter) { try { return getFactory(storeSource, factory -> { MapCacheStore mapCacheStoreInstance = factory.newMapCacheStore(identify, converter);