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

[query-cache] DefaultQueryCache::getAll doesnt check for null values #11665

Closed
vertex-github opened this issue Oct 25, 2017 · 0 comments
Closed

[query-cache] DefaultQueryCache::getAll doesnt check for null values #11665

vertex-github opened this issue Oct 25, 2017 · 0 comments

Comments

@vertex-github
Copy link

@vertex-github vertex-github commented Oct 25, 2017

DefaultQueryCache::getAll does not check for null values, and if queried with keys that dont exist in the cache, then a NullPointerException is the result. Note that the get method does check for nulls.

    @Override
    public Map<K, V> getAll(Set<K> keys) {
        checkNotNull(keys, "keys cannot be null");
        if (keys.isEmpty()) {
            return Collections.emptyMap();
        }

        if (!includeValue) {
            return getDelegate().getAll(keys);
        }

        Map<K, V> map = MapUtil.createHashMap(keys.size());
        for (K key : keys) {
            Data keyData = toData(key);
            QueryCacheRecord record = recordStore.get(keyData);
            Object valueInRecord = record.getValue(); // <<------ NPE here
            V value = toObject(valueInRecord);
            map.put(key, value);
        }
        return map;
    }
@mmedenjak mmedenjak added this to the 3.10 milestone Oct 26, 2017
@mmedenjak mmedenjak modified the milestones: 3.10, 3.9.1 Oct 26, 2017
@mmedenjak mmedenjak changed the title DefaultQueryCache::getAll doesnt check for null values [query-cache] DefaultQueryCache::getAll doesnt check for null values Oct 26, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

2 participants
You can’t perform that action at this time.