andrus commented on code in PR #510:
URL: https://github.com/apache/cayenne/pull/510#discussion_r917244986


##########
cayenne-server/src/main/java/org/apache/cayenne/util/ObjectContextQueryAction.java:
##########
@@ -369,7 +370,21 @@ protected boolean interceptLocalCache() {
             // response may already be initialized by the factory above ... it 
is null if
             // 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

Review Comment:
   I think we should store an immutable list in the cache, not wrpa it when we 
retrieve it. 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to