Felix.setActiveStartLevel(int) throws error when it encounters an UNINSTALLED 
bundle
------------------------------------------------------------------------------------

                 Key: FELIX-2064
                 URL: https://issues.apache.org/jira/browse/FELIX-2064
             Project: Felix
          Issue Type: Bug
          Components: Framework
    Affects Versions: felix-2.0.2
            Reporter: Alexander Berger
            Priority: Minor


The implementation of Felix.setActiveStartLevel(int) iterates over all bundles 
an tries to aquire the lock for each bundle. But it does not check if a bundle 
is (already) UNINSTALLED. If it encounters an UNINSTALLED bundle 
Felix.acquireBundleLock(...) will throw an IllegalStateException which will be 
logged and published as event.

So I guess the following code from Felix.setActiveStartLevel(int):
                // Lock the current bundle.
                try
                {
                    acquireBundleLock(impl,
                        Bundle.INSTALLED | Bundle.RESOLVED | Bundle.ACTIVE
                        | Bundle.STARTING | Bundle.STOPPING);
                }
                catch (IllegalStateException ex)
                {
                    fireFrameworkEvent(FrameworkEvent.ERROR, impl, ex);
                    m_logger.log(
                        Logger.LOG_ERROR,
                        "Error locking " + impl._getLocation(), ex);
                    continue;
                }

Should be changed to this in order to prevent unnecessary error message (log 
and events)

                // Lock the current bundle.
                try
                {
                    acquireBundleLock(impl,
                        Bundle.INSTALLED | Bundle.RESOLVED | Bundle.ACTIVE
                        | Bundle.STARTING | Bundle.STOPPING);
                }
                catch (IllegalStateException ex)
                {
                    if ( impl.getState() != Bundle.UNINSTALLED ) {
                            fireFrameworkEvent(FrameworkEvent.ERROR, impl, ex);
                            m_logger.log(
                                Logger.LOG_ERROR,
                                "Error locking " + impl._getLocation(), ex);
                    }
                    continue;
                }



-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to