diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/interceptor/executor/BaseInterceptorService.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/interceptor/executor/BaseInterceptorService.java index e2b3adacb3c..57dc1a79da5 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/interceptor/executor/BaseInterceptorService.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/interceptor/executor/BaseInterceptorService.java @@ -291,7 +291,8 @@ public abstract class BaseInterceptorService impleme } private Object doCallHooks(POINTCUT thePointcut, HookParams theParams, Object theRetVal) { - List invokers = getInvokersForPointcut(thePointcut); + // use new list for loop to avoid ConcurrentModificationException in case invoker gets added while looping + List invokers = new ArrayList<>(getInvokersForPointcut(thePointcut)); /* * Call each hook in order