Cloned component shares same policy provider list as original component causing 
duplicated policy providers
-----------------------------------------------------------------------------------------------------------

                 Key: TUSCANY-3988
                 URL: https://issues.apache.org/jira/browse/TUSCANY-3988
             Project: Tuscany
          Issue Type: Bug
    Affects Versions: Java-SCA-2.0
            Reporter: Greg Dritschler
            Priority: Minor


Scenario:  A composite "X" has multiple implementation.composite components 
that point to the same composite Y.

Problem:  Components in Y have duplicated implementation policy providers.

Detailed explanation:  CompositeCloneBuilderImpl clones each occurrence of Y 
which clones the components under it.  However RuntimeComponentImpl does not 
have a clone method, so its policy provider list is simply copied to the clone. 
  When CompositeActivatorImpl creates implementation policy providers for each 
component in Y, it is not updating a unique list, but rather a list that is 
shared with the other clones, causing the duplication.

Proposed solution:  Add a clone method to RuntimeComponentImpl that initializes 
a new policy provider list.

    @Override
    public Object clone() throws CloneNotSupportedException {
        RuntimeComponentImpl clone = (RuntimeComponentImpl)super.clone();
        clone.policyProviders = new ArrayList<PolicyProvider>();
        return clone;
    }

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to