Skip to content

Commit

Permalink
MID-4574 backport
Browse files Browse the repository at this point in the history
  • Loading branch information
PetrGasparik committed Sep 12, 2018
1 parent 0d0e120 commit d6bad11
Showing 1 changed file with 12 additions and 1 deletion.
Expand Up @@ -19,6 +19,8 @@
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import com.evolveum.midpoint.util.logging.Trace;
import com.evolveum.midpoint.util.logging.TraceManager;
import org.springframework.stereotype.Component;

import com.evolveum.midpoint.prism.PrismContext;
Expand All @@ -36,6 +38,8 @@
@Component
public class ResourceCache {

private static final Trace LOGGER = TraceManager.getTrace(ResourceCache.class);

private Map<String,PrismObject<ResourceType>> cache;

ResourceCache() {
Expand Down Expand Up @@ -94,7 +98,14 @@ public synchronized PrismObject<ResourceType> get(String oid, String version, Ge
}

if (GetOperationOptions.isReadOnly(options)) {
cachedResource.checkImmutability();
try { // MID-4574
cachedResource.checkImmutability();
} catch (IllegalStateException ex) {
LOGGER.error("Failed immutability test", ex);
cache.remove(oid);

return null;
}
return cachedResource;
} else {
return cachedResource.clone();
Expand Down

0 comments on commit d6bad11

Please sign in to comment.