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

Potential NPE in Cache.get() #3

Closed
nostra13 opened this issue Dec 8, 2011 · 1 comment
Closed

Potential NPE in Cache.get() #3

nostra13 opened this issue Dec 8, 2011 · 1 comment

Comments

@nostra13
Copy link
Owner

nostra13 commented Dec 8, 2011

Потенциальный NPE в методе get(): не сихронизованы методы clear() и get(). Более подробно: cointaisKey() возвращает true, вызывается метод clear(), get() от Map возвращает null.

Решение без synchronized: внутри метода Cache#get() использовать сразу Map#get() и проверять результат на null. В таком случае нужно поле Map нужно делать private и запрещать любые доступы к нему извне

nostra13 added a commit that referenced this issue Dec 9, 2011
@nostra13
Copy link
Owner Author

nostra13 commented Dec 9, 2011

Commit a438495

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

1 participant