You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@felix.apache.org by "Pierre De Rop (JIRA)" <ji...@apache.org> on 2015/11/22 19:39:11 UTC

[jira] [Created] (FELIX-5113) Remove useless wrong test in ConfigurationDependencyImpl

Pierre De Rop created FELIX-5113:
------------------------------------

             Summary: Remove useless wrong test in ConfigurationDependencyImpl
                 Key: FELIX-5113
                 URL: https://issues.apache.org/jira/browse/FELIX-5113
             Project: Felix
          Issue Type: Improvement
          Components: Dependency Manager
    Affects Versions:  	org.apache.felix.dependencymanager-r5
            Reporter: Pierre De Rop
            Assignee: Pierre De Rop
            Priority: Trivial
             Fix For: org.apache.felix.dependencymanager-r6


There is a useless and wrong test in the ConfigurationDependencyImpl.updated() method:

{code}
        // If this is initial settings, or a configuration update, we handle it synchronously.
        // We'll conclude that the dependency is available only if invoking updated did not cause
        // any ConfigurationException.
        Object[] instances = m_component.getInstances();
        if (instances != null) {
            try {
                invokeUpdated(settings);
            } catch (ConfigurationException e) {
                logConfigurationException(e);
                throw e;
            }
        }
{code}

the "if (instances != null)" test is useless, and also wrong, but fortunately, it does not causes any problems.

Indeed, the m_component.getInstances() never returns null, and return an empty array when the component instance is not yet instantiated. This may happen when an instance callback is specified (like a Factory that needs the configuration before the Factory.create method is called).

Anyway, this test should be removed.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)