[PDI-12893] - Exception in thread "main" java.util.ConcurrentModificationException

@mattyb149, @brosander would you mind to review/merge

there are two commits:
    the first one is the JUnit test for reprodusing.
    the second one provides the fix.

Thanks, Yury.