fix(cache): catch Throwable in CacheManage static init (#1724)#1890
fix(cache): catch Throwable in CacheManage static init (#1724)#1890HandSonic wants to merge 1 commit into
Conversation
307a5d2 to
73f0beb
Compare
|
The |
…ss poisoning (OtterMind#1724) The static initializer only caught Exception, missing Errors like NoClassDefFoundError. Once the init failed with an Error, the class was permanently poisoned and cache was silently disabled. Also add init guard to fuzzyDelete() to prevent NPE when cache init failed and fuzzyDelete is called externally.
73f0beb to
c3bdc93
Compare
|
Fixed. Changed to , and added an guard at the beginning of to prevent accessing when cache is not initialized. |
|
Fixed. Changed |
Problem
静态初始化器仅捕获了 Exception,而遗漏了诸如
NoClassDefFoundError 之类的 Errors。一旦初始化因 Error 失败,该类
就会被永久“污染”,且缓存会被静默禁用。
此外,还需在 fuzzyDelete() 中添加初始化保护机制,以防止在缓存初始化
失败且从外部调用 fuzzyDelete 时发生 NPE。
Fix
在 开头添加 守卫
Related
Fixes #1724