Details
Description
In an environment with multiple apps, it's possible to hit a ConcurrentModificationException during startup:
Caused by: java.util.ConcurrentModificationException
at java.util.HashMap$HashIterator.nextNode(HashMap.java:1456)
at java.util.HashMap$KeyIterator.next(HashMap.java:1480)
at org.apache.myfaces.config.DefaultFacesConfigurationProvider.getMetaInfServicesFacesConfig(DefaultFacesConfigurationProvider.java:218)
This occurs because Set<String> FACTORY_NAMES is static, but the initialization block following it is not. So it's possible for that initialization block to get run - if a new DefaultFacesConfigurationProvider is initialized at the right time - while another instance is iterating over the set. The fix is to make the initialization block static, which we just need to backport from the master branch.