Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

magic模式下,获取缓存key存在NPE #97

Open
DR-YangLong opened this issue Sep 11, 2020 · 1 comment
Open

magic模式下,获取缓存key存在NPE #97

DR-YangLong opened this issue Sep 11, 2020 · 1 comment

Comments

@DR-YangLong
Copy link
Contributor

场景描述: 使用magic模式进行返回列表分割缓存存储,当返回值中含有NULL时,引发NPE
使用代码:
@LocalCache(expire = 500) @Cache(expire = 600, expireExpression = "null == #retVal ? 30: 600", key = "", magic = @Magic(key = "'user-magic-'+ #retVal.userId"), autoload = true) @Override public List<UserInfo> loadAllUsers() { return LongStream.rangeClosed(1, 105).mapToObj(this::createUser).collect(Collectors.toList()); }
发生错误源代码:
AbstractScriptParser#getDefinedCacheKey
SpringELParser#getElValue
原因:未对返回值做null判断,返回值列表中有有NULL,出现错误

@qiujiayu
Copy link
Owner

欢迎提PR。

Repository owner deleted a comment Feb 2, 2024
Repository owner deleted a comment from mkproject-admin Feb 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants