Loop over new list to avoid ConcurrentModificationException in case a new hook is added while looping (#3233)

Co-authored-by: juan.marchionatto <juan.marchionatto@smilecdr.com>
This commit is contained in:
jmarchionatto 2021-12-13 08:14:28 -05:00 committed by GitHub
parent 4075c003f7
commit d6e543a478
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 1 deletions

View File

@ -291,7 +291,8 @@ public abstract class BaseInterceptorService<POINTCUT extends IPointcut> impleme
}
private Object doCallHooks(POINTCUT thePointcut, HookParams theParams, Object theRetVal) {
List<BaseInvoker> invokers = getInvokersForPointcut(thePointcut);
// use new list for loop to avoid ConcurrentModificationException in case invoker gets added while looping
List<BaseInvoker> invokers = new ArrayList<>(getInvokersForPointcut(thePointcut));
/*
* Call each hook in order