Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed use case when bundle start level will be set within an bundle activator, test case FrameworkStartLevelImplTest #190

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
19 changes: 13 additions & 6 deletions framework/src/main/java/org/apache/felix/framework/Felix.java
Original file line number Diff line number Diff line change
Expand Up @@ -2198,12 +2198,19 @@ void startBundle(BundleImpl bundle, int options) throws BundleException
int bundleLevel = bundle.getStartLevel(getInitialBundleStartLevel());
if (isTransient && (bundleLevel > m_activeStartLevel))
{
// Throw an exception for transient starts.
throw new BundleException(
"Cannot start bundle " + bundle + " because its start level is "
+ bundleLevel
+ ", which is greater than the framework's start level of "
+ m_activeStartLevel + ".", BundleException.START_TRANSIENT_ERROR);
// This can happen if a bundle's start level has been changed when framework is
// starting to framework start level.
// When framework start level has been reached, the start order will be recalculated
// and meanwhile changed start order will be updated.
// This is NOT an ERROR, we simply log an INFO messages as maybe the way start levels
// will be changed needs to be verified
m_logger.log(
Logger.LOG_INFO,
"Will not start bundle " + bundle + " because its start level is "
+ bundleLevel
+ ", which is greater than the framework's start level of "
+ m_activeStartLevel + ".");
return;
}
else if (bundleLevel > m_targetStartLevel)
{
Expand Down
Loading