[JIRA] Commented: (JOST-174) ChainingMetadataProvider calls clear() on unmodifiable list

philvarner@idp.protectnetwork.org (JIRA) noreply at shibboleth.net
Sun Oct 23 21:33:25 BST 2011


    [ https://issues.shibboleth.net/jira/browse/JOST-174?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13670#comment-13670 ] 

philvarner at idp.protectnetwork.org commented on JOST-174:
--------------------------------------------------------

After looking at this a bit more, a better fix is to get rid of the special case and early return for empty list entirely, and make the method:

    public void setProviders(List<MetadataProvider> newProviders) throws MetadataProviderException {
        Lock writeLock = providerLock.writeLock();
        writeLock.lock();

        try {
            ArrayList<MetadataProvider> checkedProviders = new ArrayList<MetadataProvider>();
            if (newProviders != null) {
                for (MetadataProvider provider : newProviders) {
                    doAddMetadataProvider(provider, checkedProviders);
                }
            }
            providers = Collections.unmodifiableList(checkedProviders);
        } finally {
            writeLock.unlock();
        }
    }

> ChainingMetadataProvider calls clear() on unmodifiable list
> -----------------------------------------------------------
>
>                 Key: JOST-174
>                 URL: https://issues.shibboleth.net/jira/browse/JOST-174
>             Project: OpenSAML 2 - Java
>          Issue Type: Bug
>            Reporter: philvarner at idp.protectnetwork.org
>            Assignee: Chad La Joie
>
> in method setProviders, code is:
>     if (newProviders == null || newProviders.isEmpty()) {
>                 providers.clear();
>                 return;
>             }
> but the default object for providers is:
>         providers = Collections.EMPTY_LIST;
> This was changed between 2.3.1 and 2.5.1. In 2.3.1, providers was an empty array list.  
> I believe the fix to this is to replace providers.clear() with providers = Collections.EMPTY_LIST.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira


More information about the commits mailing list