Skip to content

CAY-2748 Mutating the list returned from the local query cache changes the cache#510

Closed
johnthuss wants to merge 1 commit intoapache:masterfrom
johnthuss:master
Closed

CAY-2748 Mutating the list returned from the local query cache changes the cache#510
johnthuss wants to merge 1 commit intoapache:masterfrom
johnthuss:master

Conversation

@johnthuss
Copy link
Contributor

CAY-2748 Mutating the list returned from the local query cache changes the cache

https://issues.apache.org/jira/browse/CAY-2748

// there was a preexisting cache entry
if (response == null) {
response = new ListResponse(cachedResults);
response = new ListResponse(cachedResults != null ? Collections.unmodifiableList(cachedResults) : null); // make a defensive copy avoid leaking cache internal data
Copy link
Contributor

@andrus andrus Jul 9, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should store an immutable list in the cache, not wrap it every time we retrieve it.

@johnthuss johnthuss closed this Jul 11, 2022
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

Successfully merging this pull request may close these issues.

2 participants