Support Framework Extension Bundle Activators and make the security part of the OSGi 6 CT tests pass (FELIX-4579,FELIX-4583).
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1650249 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/framework/src/main/java/org/apache/felix/framework/BundleContextImpl.java b/framework/src/main/java/org/apache/felix/framework/BundleContextImpl.java
index ed0f52b..c5a1011 100644
--- a/framework/src/main/java/org/apache/felix/framework/BundleContextImpl.java
+++ b/framework/src/main/java/org/apache/felix/framework/BundleContextImpl.java
@@ -529,6 +529,14 @@
public <S> ServiceObjects<S> getServiceObjects(final ServiceReference<S> ref)
{
checkValidity();
+
+ Object sm = System.getSecurityManager();
+
+ if (sm != null)
+ {
+ ((SecurityManager) sm).checkPermission(new ServicePermission(ref, ServicePermission.GET));
+ }
+
ServiceRegistrationImpl reg =
((ServiceRegistrationImpl.ServiceReferenceImpl) ref).getRegistration();
if ( reg.isValid() )
@@ -546,7 +554,7 @@
private final ServiceReference<S> m_ref;
private final List<S> srvObjects = new ArrayList<S>();
-
+
public ServiceObjectsImpl(final ServiceReference<S> ref)
{
this.m_ref = ref;
@@ -572,21 +580,21 @@
}
srvObj = m_felix.getService(m_bundle, m_ref, true);
- }
- else
+ }
+ else
{
// getService handles singleton and bundle scope
srvObj = BundleContextImpl.this.getService(m_ref);
}
-
+
if ( srvObj != null )
{
synchronized ( srvObjects )
{
srvObjects.add(srvObj);
}
- }
-
+ }
+
return srvObj;
}
@@ -595,22 +603,22 @@
if ( srvObj != null )
{
// check if this object was returned by this service objects
- synchronized ( srvObjects )
+ synchronized ( srvObjects )
{
boolean found = false;
int i = 0;
- while ( !found && i < srvObjects.size() )
+ while ( !found && i < srvObjects.size() )
{
found = srvObjects.get(i) == srvObj;
i++;
}
- if ( !found )
+ if ( !found )
{
- throw new IllegalArgumentException();
+ throw new IllegalArgumentException();
}
srvObjects.remove(i-1);
}
-
+
}
// special handling for prototype scope
if ( m_ref.getProperty(Constants.SERVICE_SCOPE) == Constants.SCOPE_PROTOTYPE )
@@ -618,7 +626,7 @@
checkValidity();
// Unget the specified service.
- if ( !m_felix.ungetService(m_bundle, m_ref, srvObj) )
+ if ( !m_felix.ungetService(m_bundle, m_ref, srvObj) )
{
throw new IllegalArgumentException();
}
diff --git a/framework/src/main/java/org/apache/felix/framework/BundleProtectionDomain.java b/framework/src/main/java/org/apache/felix/framework/BundleProtectionDomain.java
index 5247ab2..9c3befc 100644
--- a/framework/src/main/java/org/apache/felix/framework/BundleProtectionDomain.java
+++ b/framework/src/main/java/org/apache/felix/framework/BundleProtectionDomain.java
@@ -33,6 +33,8 @@
import java.net.URLStreamHandler;
import java.security.CodeSource;
import java.security.Permission;
+import java.security.PermissionCollection;
+import java.security.Permissions;
import java.security.ProtectionDomain;
import java.security.cert.Certificate;
import java.util.ArrayList;
@@ -44,6 +46,7 @@
import java.util.jar.JarOutputStream;
import org.apache.felix.framework.cache.Content;
import org.apache.felix.framework.cache.JarContent;
+import org.osgi.framework.PackagePermission;
import org.osgi.framework.wiring.BundleRevision;
@@ -372,6 +375,7 @@
private final int m_hashCode;
private final String m_toString;
private final WeakReference m_revision;
+ private volatile PermissionCollection m_woven;
BundleProtectionDomain(Felix felix, BundleImpl bundle, Object certificates)
throws MalformedURLException
@@ -412,6 +416,20 @@
felix.impliesBundlePermission(this, permission, true) : false;
}
+ boolean impliesWoven(Permission permission)
+ {
+ return m_woven != null && m_woven.implies(permission);
+ }
+
+ synchronized void addWoven(String s)
+ {
+ if (m_woven == null)
+ {
+ m_woven = new Permissions();
+ }
+ m_woven.add(new PackagePermission(s, PackagePermission.IMPORT));
+ }
+
BundleImpl getBundle()
{
return (BundleImpl) m_bundle.get();
diff --git a/framework/src/main/java/org/apache/felix/framework/BundleWiringImpl.java b/framework/src/main/java/org/apache/felix/framework/BundleWiringImpl.java
index cd345cc..8e984cd 100644
--- a/framework/src/main/java/org/apache/felix/framework/BundleWiringImpl.java
+++ b/framework/src/main/java/org/apache/felix/framework/BundleWiringImpl.java
@@ -2075,23 +2075,23 @@
// as a race condition, doing any necessary clean up in
// the error handling.
Felix felix = ((BundleImpl) m_wiring.m_revision.getBundle()).getFramework();
-
+
Set<ServiceReference<WeavingHook>> hooks =
felix.getHooks(WeavingHook.class);
-
- Set<ServiceReference<WovenClassListener>> wovenClassListeners =
+
+ Set<ServiceReference<WovenClassListener>> wovenClassListeners =
felix.getHooks(WovenClassListener.class);
-
+
WovenClassImpl wci = null;
if (!hooks.isEmpty())
{
// Create woven class to be used for hooks.
wci = new WovenClassImpl(name, m_wiring, bytes);
- try
+ try
{
transformClass(felix, wci, hooks, wovenClassListeners,
name, bytes);
- }
+ }
catch (Error e)
{
// Mark the woven class as incomplete.
@@ -2129,12 +2129,12 @@
}
}
- try
+ try
{
clazz = defineClass(felix, wovenClassListeners, wci, name,
clazz, bytes, content, pkgName, lock);
- }
- catch (ClassFormatError e)
+ }
+ catch (ClassFormatError e)
{
if(wci != null)
{
@@ -2182,7 +2182,7 @@
Set<ServiceReference<WovenClassListener>> wovenClassListeners,
WovenClassImpl wci, String name, Class clazz, byte[] bytes,
Content content, String pkgName, Object lock)
- throws ClassFormatError
+ throws ClassFormatError
{
try
@@ -2385,7 +2385,7 @@
Set<ServiceReference<WeavingHook>> hooks,
Set<ServiceReference<WovenClassListener>> wovenClassListeners,
String name, byte[] bytes) throws Error {
-
+
// Loop through hooks in service ranking order.
for (ServiceReference<WeavingHook> sr : hooks)
{
@@ -2430,7 +2430,7 @@
wci.setState(WovenClass.TRANSFORMED);
callWovenClassListeners(felix, wovenClassListeners, wci);
}
-
+
protected void callWovenClassListeners(Felix felix, Set<ServiceReference<WovenClassListener>> wovenClassListeners, WovenClass wovenClass)
{
if(wovenClassListeners != null)
@@ -2438,15 +2438,15 @@
for(ServiceReference<WovenClassListener> currentWovenClassListenerRef : wovenClassListeners)
{
WovenClassListener currentWovenClassListner = felix.getService(felix, currentWovenClassListenerRef, false);
- try
+ try
{
BundleRevisionImpl.getSecureAction().invokeWovenClassListener(currentWovenClassListner, wovenClass);
- }
- catch (Exception e)
+ }
+ catch (Exception e)
{
m_logger.log(Logger.LOG_ERROR, "Woven Class Listner failed.", e);
- }
- finally
+ }
+ finally
{
felix.ungetService(felix, currentWovenClassListenerRef, null);
}
diff --git a/framework/src/main/java/org/apache/felix/framework/ExtensionManager.java b/framework/src/main/java/org/apache/felix/framework/ExtensionManager.java
index f146e7a..541365b 100644
--- a/framework/src/main/java/org/apache/felix/framework/ExtensionManager.java
+++ b/framework/src/main/java/org/apache/felix/framework/ExtensionManager.java
@@ -54,6 +54,7 @@
import org.osgi.framework.BundleContext;
import org.osgi.framework.BundleException;
import org.osgi.framework.Constants;
+import org.osgi.framework.FrameworkEvent;
import org.osgi.framework.Version;
import org.osgi.framework.namespace.NativeNamespace;
import org.osgi.framework.wiring.BundleCapability;
@@ -141,6 +142,22 @@
private volatile Bundle[] m_extensionsCache;
private final Set m_names;
private final Map m_sourceToExtensions;
+ private final List<ExtensionTuple> m_extensionTuples = Collections.synchronizedList(new ArrayList<ExtensionTuple>());
+
+ private static class ExtensionTuple
+ {
+ private final BundleActivator m_activator;
+ private final Bundle m_bundle;
+ private volatile boolean m_failed;
+ private volatile boolean m_started;
+
+ public ExtensionTuple(BundleActivator activator, Bundle bundle)
+ {
+ m_activator = activator;
+ m_bundle = bundle;
+ }
+
+ }
// This constructor is only used for the private instance added to the parent
// classloader.
@@ -406,7 +423,7 @@
{
exports = ManifestParser.parseExportHeader(
m_logger, m_systemBundleRevision,
- (String) ((BundleRevisionImpl) bundle.adapt(BundleRevision.class))
+ (String) ((BundleRevisionImpl) bundle.adapt(BundleRevisionImpl.class))
.getHeaders().get(Constants.EXPORT_PACKAGE),
m_systemBundleRevision.getSymbolicName(), m_systemBundleRevision.getVersion());
exports = aliasSymbolicName(exports);
@@ -417,7 +434,7 @@
bundle,
Logger.LOG_ERROR,
"Error parsing extension bundle export statement: "
- + ((BundleRevisionImpl) bundle.adapt(BundleRevision.class))
+ + ((BundleRevisionImpl) bundle.adapt(BundleRevisionImpl.class))
.getHeaders().get(Constants.EXPORT_PACKAGE), ex);
return;
}
@@ -443,7 +460,7 @@
throw ex;
}
- BundleRevisionImpl bri = (BundleRevisionImpl) bundle.adapt(BundleRevision.class);
+ BundleRevisionImpl bri = (BundleRevisionImpl) bundle.adapt(BundleRevisionImpl.class);
List<BundleRequirement> reqs = bri.getDeclaredRequirements(BundleRevision.HOST_NAMESPACE);
List<BundleCapability> caps = getCapabilities(BundleRevision.HOST_NAMESPACE);
BundleWire bw = new BundleWireImpl(bri, reqs.get(0), m_systemBundleRevision, caps.get(0));
@@ -470,13 +487,18 @@
*/
void startExtensionBundle(Felix felix, BundleImpl bundle)
{
- Dictionary<?,?> headers = bundle.getHeaders();
+ Map<?,?> headers = bundle.adapt(BundleRevisionImpl.class).getHeaders();
String activatorClass = (String) headers.get(Constants.EXTENSION_BUNDLE_ACTIVATOR);
+ boolean felixExtension = false;
if (activatorClass == null)
+ {
+ felixExtension = true;
activatorClass = (String) headers.get(FelixConstants.FELIX_EXTENSION_ACTIVATOR);
+ }
if (activatorClass != null)
{
+ ExtensionTuple tuple = null;
try
{
// TODO: SECURITY - Should this consider security?
@@ -484,26 +506,93 @@
felix.getClass().getClassLoader().loadClass(
activatorClass.trim()).newInstance();
-// TODO: EXTENSIONMANAGER - This is kind of hacky, can we improve it?
- felix.m_activatorList.add(activator);
-
BundleContext context = felix._getBundleContext();
bundle.setBundleContext(context);
+// TODO: EXTENSIONMANAGER - This is kind of hacky, can we improve it?
+ if (!felixExtension)
+ {
+ tuple = new ExtensionTuple(activator, bundle);
+ m_extensionTuples.add(tuple);
+ }
+ else
+ {
+ felix.m_activatorList.add(activator);
+ }
+
if ((felix.getState() == Bundle.ACTIVE) || (felix.getState() == Bundle.STARTING))
{
+ if (tuple != null)
+ {
+ tuple.m_started = true;
+ }
Felix.m_secureAction.startActivator(activator, context);
}
}
catch (Throwable ex)
{
+ if (tuple != null)
+ {
+ tuple.m_failed = true;
+ }
+ felix.fireFrameworkEvent(FrameworkEvent.ERROR, bundle,
+ new BundleException("Unable to start Bundle", ex));
+
m_logger.log(bundle, Logger.LOG_WARNING,
"Unable to start Extension Activator", ex);
}
}
}
+ void startPendingExtensionBundles(Felix felix)
+ {
+ for (int i = 0;i < m_extensionTuples.size();i++)
+ {
+ if (!m_extensionTuples.get(i).m_started)
+ {
+ m_extensionTuples.get(i).m_started = true;
+ try
+ {
+ Felix.m_secureAction.startActivator(m_extensionTuples.get(i).m_activator, felix._getBundleContext());
+ }
+ catch (Throwable ex)
+ {
+ m_extensionTuples.get(i).m_failed = true;
+
+ felix.fireFrameworkEvent(FrameworkEvent.ERROR, m_extensionTuples.get(i).m_bundle,
+ new BundleException("Unable to start Bundle", BundleException.ACTIVATOR_ERROR, ex));
+
+ m_logger.log(m_extensionTuples.get(i).m_bundle, Logger.LOG_WARNING,
+ "Unable to start Extension Activator", ex);
+ }
+ }
+ }
+ }
+
+ void stopExtensionBundles(Felix felix)
+ {
+ for (int i = m_extensionTuples.size() - 1; i >= 0;i--)
+ {
+ if (m_extensionTuples.get(i).m_started && !m_extensionTuples.get(i).m_failed)
+ {
+ try
+ {
+ Felix.m_secureAction.stopActivator(m_extensionTuples.get(i).m_activator, felix._getBundleContext());
+ }
+ catch (Throwable ex)
+ {
+ felix.fireFrameworkEvent(FrameworkEvent.ERROR, m_extensionTuples.get(i).m_bundle,
+ new BundleException("Unable to stop Bundle", BundleException.ACTIVATOR_ERROR, ex));
+
+ m_logger.log(m_extensionTuples.get(i).m_bundle, Logger.LOG_WARNING,
+ "Unable to stop Extension Activator", ex);
+ }
+ }
+ }
+ m_extensionTuples.clear();
+ }
+
/**
* Remove all extension registered by the given framework instance. Note, it
* is not possible to unregister allready loaded classes form those extensions.
diff --git a/framework/src/main/java/org/apache/felix/framework/Felix.java b/framework/src/main/java/org/apache/felix/framework/Felix.java
index e533fde..2a409f5 100644
--- a/framework/src/main/java/org/apache/felix/framework/Felix.java
+++ b/framework/src/main/java/org/apache/felix/framework/Felix.java
@@ -83,6 +83,7 @@
import org.osgi.framework.FrameworkListener;
import org.osgi.framework.FrameworkUtil;
import org.osgi.framework.InvalidSyntaxException;
+import org.osgi.framework.PackagePermission;
import org.osgi.framework.ServiceEvent;
import org.osgi.framework.ServiceException;
import org.osgi.framework.ServiceFactory;
@@ -617,19 +618,16 @@
return true;
}
- /**
- * This method initializes the framework, which is comprised of resolving
- * the system bundle, reloading any cached bundles, and activating the system
- * bundle. The framework is left in the <tt>Bundle.STARTING</tt> state and
- * reloaded bundles are in the <tt>Bundle.INSTALLED</tt> state. After
- * successfully invoking this method, <tt>getBundleContext()</tt> will
- * return a valid <tt>BundleContext</tt> for the system bundle. To finish
- * starting the framework, invoke the <tt>start()</tt> method.
- *
- * @throws org.osgi.framework.BundleException if any error occurs.
- **/
+
public void init() throws BundleException
{
+ init((FrameworkListener[]) null);
+ }
+ /**
+ * @see org.osgi.framework.launch.Framework#init(org.osgi.framework.FrameworkListener[])
+ */
+ public void init(final FrameworkListener... listeners) throws BundleException
+ {
// The system bundle can only be initialized if it currently isn't started.
acquireBundleLock(this,
Bundle.INSTALLED | Bundle.RESOLVED | Bundle.STARTING | Bundle.ACTIVE);
@@ -825,6 +823,15 @@
// so create a gate for that purpose.
m_shutdownGate = new ThreadGate();
+ // add framework listeners
+ if ( listeners != null )
+ {
+ for(final FrameworkListener fl : listeners)
+ {
+ addFrameworkListener(this, fl);
+ }
+ }
+
// Start services
m_fwkWiring.start();
m_fwkStartLevel.start();
@@ -892,6 +899,9 @@
}
}
+ m_extensionManager.startPendingExtensionBundles(Felix.this);
+ m_fwkWiring.refreshBundles(null);
+
// Clear the cache of classes coming from the system bundle.
// This is only used for Felix.getBundle(Class clazz) to speed
// up class lookup for the system bundle.
@@ -904,6 +914,14 @@
finally
{
releaseBundleLock(this);
+
+ if ( listeners != null )
+ {
+ for(final FrameworkListener fl : listeners)
+ {
+ removeFrameworkListener(this, fl);
+ }
+ }
}
}
@@ -4398,6 +4416,13 @@
boolean impliesBundlePermission(BundleProtectionDomain bundleProtectionDomain, Permission permission, boolean direct)
{
+ if (direct && permission instanceof PackagePermission)
+ {
+ if (bundleProtectionDomain.impliesWoven(permission))
+ {
+ return true;
+ }
+ }
if (m_securityProvider != null)
{
return m_securityProvider.hasBundlePermission(bundleProtectionDomain, permission, direct);
@@ -4782,10 +4807,23 @@
m_activatorList.add(0, new URLHandlersActivator(m_configMap, Felix.this));
// Start all activators.
- for (int i = 0; i < m_activatorList.size(); i++)
+ for (Iterator<BundleActivator> iter = m_activatorList.iterator(); iter.hasNext(); )
{
- Felix.m_secureAction.startActivator(
- (BundleActivator) m_activatorList.get(i), context);
+ try
+ {
+ Felix.m_secureAction.startActivator(
+ iter.next(), context);
+ }
+ catch (Throwable throwable)
+ {
+ iter.remove();
+ fireFrameworkEvent(FrameworkEvent.ERROR, context.getBundle(),
+ new BundleException("Unable to start Bundle", throwable));
+ m_logger.log(
+ Logger.LOG_WARNING,
+ "Exception starting a system bundle activator.",
+ throwable);
+ }
}
}
@@ -4860,6 +4898,7 @@
((BundleImpl) bundles[i]).close();
}
+ m_extensionManager.stopExtensionBundles(Felix.this);
// Stop all system bundle activators.
for (int i = 0; i < m_activatorList.size(); i++)
{
@@ -4870,13 +4909,14 @@
}
catch (Throwable throwable)
{
+ fireFrameworkEvent(FrameworkEvent.ERROR, context.getBundle(),
+ new BundleException("Unable to stop Bundle", throwable));
m_logger.log(
Logger.LOG_WARNING,
"Exception stopping a system bundle activator.",
throwable);
}
}
-
if (m_securityManager != null)
{
System.setSecurityManager(null);
@@ -5336,39 +5376,6 @@
return m_urlHandlersActivator.getContentHandlerService(mimeType);
}
- /**
- * @see org.osgi.framework.launch.Framework#init(org.osgi.framework.FrameworkListener[])
- */
- public void init(final FrameworkListener... listeners) throws BundleException
- {
- // add framework listeners
- if ( listeners != null )
- {
- for(final FrameworkListener fl : listeners)
- {
- addFrameworkListener(this, fl);
- }
- }
-
- // call init
- try
- {
- this.init();
- }
-
- // remove framework listeners
- finally
- {
- if ( listeners != null )
- {
- for(final FrameworkListener fl : listeners)
- {
- removeFrameworkListener(this, fl);
- }
- }
- }
- }
-
Collection<BundleCapability> findProviders(final Requirement requirement)
{
return m_resolver.findProvidersInternal(null, requirement, true, false);
diff --git a/framework/src/main/java/org/apache/felix/framework/FrameworkStartLevelImpl.java b/framework/src/main/java/org/apache/felix/framework/FrameworkStartLevelImpl.java
index 715158f..995faad 100644
--- a/framework/src/main/java/org/apache/felix/framework/FrameworkStartLevelImpl.java
+++ b/framework/src/main/java/org/apache/felix/framework/FrameworkStartLevelImpl.java
@@ -126,8 +126,10 @@
synchronized (m_requests)
{
- // Start thread if necessary.
- startThread();
+ if (m_thread == null)
+ {
+ throw new IllegalStateException("No inital startlevel yet");
+ }
// Queue request.
m_requestListeners.add(listeners);
m_requests.add(new Integer(startlevel));
diff --git a/framework/src/main/java/org/apache/felix/framework/FrameworkWiringImpl.java b/framework/src/main/java/org/apache/felix/framework/FrameworkWiringImpl.java
index 0ab4c5e..a0173ed 100644
--- a/framework/src/main/java/org/apache/felix/framework/FrameworkWiringImpl.java
+++ b/framework/src/main/java/org/apache/felix/framework/FrameworkWiringImpl.java
@@ -125,6 +125,11 @@
new AdminPermission(m_felix, AdminPermission.RESOLVE));
}
+ if (m_thread == null)
+ {
+ return false;
+ }
+
return m_felix.resolveBundles(bundles);
}
diff --git a/framework/src/main/java/org/apache/felix/framework/WovenClassImpl.java b/framework/src/main/java/org/apache/felix/framework/WovenClassImpl.java
index 07b7bb7..9ae77a3 100644
--- a/framework/src/main/java/org/apache/felix/framework/WovenClassImpl.java
+++ b/framework/src/main/java/org/apache/felix/framework/WovenClassImpl.java
@@ -28,8 +28,10 @@
import org.apache.felix.framework.util.ImmutableList;
import org.apache.felix.framework.util.manifestparser.ManifestParser;
import org.osgi.framework.AdminPermission;
+import org.osgi.framework.PackagePermission;
import org.osgi.framework.hooks.weaving.WovenClass;
import org.osgi.framework.wiring.BundleRequirement;
+import org.osgi.framework.wiring.BundleRevision;
import org.osgi.framework.wiring.BundleWiring;
class WovenClassImpl implements WovenClass, List<String>
@@ -58,13 +60,13 @@
m_bytes = (bytes == null) ? m_bytes : bytes;
completeImports(imports);
}
-
+
synchronized void completeImports(List<String> imports)
{
m_imports = (imports == null) ? ImmutableList.newInstance(m_imports)
: ImmutableList.newInstance(imports);
}
-
+
synchronized void completeDefine(Class definedClass)
{
m_definedClass = definedClass;
@@ -199,11 +201,22 @@
re.initCause(ex);
throw re;
}
+ checkImport(s);
return m_imports.add(s);
}
return false;
}
+ private void checkImport(String s)
+ {
+ SecurityManager sm = System.getSecurityManager();
+
+ if (sm != null)
+ {
+ sm.checkPermission(new PackagePermission(s, PackagePermission.IMPORT));
+ }
+ }
+
public synchronized boolean remove(Object o)
{
SecurityManager sm = System.getSecurityManager();
@@ -241,6 +254,7 @@
re.initCause(ex);
throw re;
}
+ checkImport(s);
}
return m_imports.addAll(collection);
}
@@ -267,6 +281,7 @@
re.initCause(ex);
throw re;
}
+ checkImport(s);
}
return m_imports.addAll(i, collection);
}
@@ -295,6 +310,12 @@
public synchronized void clear()
{
+ SecurityManager sm = System.getSecurityManager();
+ if (sm != null)
+ {
+ sm.checkPermission(new AdminPermission(m_wiring.getBundle(),
+ AdminPermission.WEAVE));
+ }
m_imports.clear();
}
@@ -322,6 +343,7 @@
re.initCause(ex);
throw re;
}
+ checkImport(s);
return m_imports.set(i, s);
}
@@ -344,6 +366,7 @@
re.initCause(ex);
throw re;
}
+ checkImport(s);
m_imports.add(i, s);
}
@@ -396,7 +419,7 @@
/*
* (non-Javadoc)
- *
+ *
* @see org.osgi.framework.hooks.weaving.WovenClass#getState()
*/
public synchronized int getState()
@@ -412,6 +435,15 @@
&& (state == DEFINED || state == DEFINE_FAILED || state == TRANSFORMING_FAILED))
{
m_isComplete = true;
+ if (state == DEFINED || state == DEFINE_FAILED)
+ {
+ BundleProtectionDomain pd = (BundleProtectionDomain)
+ ((BundleRevisionImpl) m_wiring.getRevision()).getProtectionDomain();
+ for (String s : m_imports)
+ {
+ pd.addWoven(s);
+ }
+ }
}
if(state == TRANSFORMED)
{
diff --git a/framework/src/main/java/org/apache/felix/framework/util/EventDispatcher.java b/framework/src/main/java/org/apache/felix/framework/util/EventDispatcher.java
index 6ea08a5..0435464 100644
--- a/framework/src/main/java/org/apache/felix/framework/util/EventDispatcher.java
+++ b/framework/src/main/java/org/apache/felix/framework/util/EventDispatcher.java
@@ -197,6 +197,7 @@
catch (IllegalStateException ex)
{
// Bundle context is no longer valid, so just return.
+ return null;
}
Map<BundleContext, List<ListenerInfo>> listeners = null;
diff --git a/framework/src/main/java/org/apache/felix/framework/util/SecureAction.java b/framework/src/main/java/org/apache/felix/framework/util/SecureAction.java
index 711a62c..f7cf9b3 100644
--- a/framework/src/main/java/org/apache/felix/framework/util/SecureAction.java
+++ b/framework/src/main/java/org/apache/felix/framework/util/SecureAction.java
@@ -1448,7 +1448,7 @@
rh.end();
}
}
-
+
public void invokeWovenClassListener(
org.osgi.framework.hooks.weaving.WovenClassListener wcl,
org.osgi.framework.hooks.weaving.WovenClass wc)
@@ -1786,6 +1786,10 @@
case DELETE_FILEONEXIT_ACTION:
((File) arg1).deleteOnExit();
return null;
+ case INVOKE_WOVEN_CLASS_LISTENER:
+ ((org.osgi.framework.hooks.weaving.WovenClassListener) arg1).modified(
+ (org.osgi.framework.hooks.weaving.WovenClass) arg2);
+ return null;
}
return null;