Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Watson2011-02-16 20:45:18 +0000
committerThomas Watson2011-02-16 20:45:18 +0000
commitd54505947697088c05bad24a79cf084ec8d18891 (patch)
tree657a7a762b719326233cbce0a503c1ce6ca718d9 /bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse
parent8ce99ab0bf9af45931ce0c1ea04680570d11c3c3 (diff)
downloadrt.equinox.framework-d54505947697088c05bad24a79cf084ec8d18891.tar.gz
rt.equinox.framework-d54505947697088c05bad24a79cf084ec8d18891.tar.xz
rt.equinox.framework-d54505947697088c05bad24a79cf084ec8d18891.zip
Merge wiring branch, fixes for the following bugs:
Bug 334582 - OSGi changes to the wiring API Bug 334574 - OSGi renamed synthetic wiring capabilities to start with osgi.wiring. Bug 334591 - OSGi added AdaptPermission Bug 335673 - No FrameworkEvent generated for exceptions in a WeavingHook
Diffstat (limited to 'bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse')
-rw-r--r--bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/internal/baseadaptor/weaving/WeavingHookConfigurator.java9
-rw-r--r--bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/internal/baseadaptor/weaving/WovenClassImpl.java9
2 files changed, 13 insertions, 5 deletions
diff --git a/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/internal/baseadaptor/weaving/WeavingHookConfigurator.java b/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/internal/baseadaptor/weaving/WeavingHookConfigurator.java
index 5f4b42bbe..78b8f44dc 100644
--- a/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/internal/baseadaptor/weaving/WeavingHookConfigurator.java
+++ b/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/internal/baseadaptor/weaving/WeavingHookConfigurator.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010 IBM Corporation and others.
+ * Copyright (c) 2010, 2011 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -23,8 +23,7 @@ import org.eclipse.osgi.framework.adaptor.ClassLoaderDelegate;
import org.eclipse.osgi.framework.internal.core.Framework;
import org.eclipse.osgi.internal.loader.BundleLoader;
import org.eclipse.osgi.internal.serviceregistry.ServiceRegistry;
-import org.osgi.framework.FrameworkEvent;
-import org.osgi.framework.ServiceRegistration;
+import org.osgi.framework.*;
public class WeavingHookConfigurator implements HookConfigurator, ClassLoadingHook, ClassLoadingStatsHook {
private BaseAdaptor adaptor;
@@ -68,7 +67,9 @@ public class WeavingHookConfigurator implements HookConfigurator, ClassLoadingHo
try {
return wovenClass.callHooks();
} catch (Throwable t) {
- adaptor.getEventPublisher().publishFrameworkEvent(FrameworkEvent.ERROR, manager.getBaseData().getBundle(), t);
+ ServiceRegistration<?> errorHook = wovenClass.getErrorHook();
+ Bundle errorBundle = errorHook != null ? errorHook.getReference().getBundle() : manager.getBaseData().getBundle();
+ adaptor.getEventPublisher().publishFrameworkEvent(FrameworkEvent.ERROR, errorBundle, t);
// fail hard with a class loading error
ClassFormatError error = new ClassFormatError("Unexpected error from weaving hook."); //$NON-NLS-1$
error.initCause(t);
diff --git a/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/internal/baseadaptor/weaving/WovenClassImpl.java b/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/internal/baseadaptor/weaving/WovenClassImpl.java
index 9198e8f29..12f2a4b26 100644
--- a/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/internal/baseadaptor/weaving/WovenClassImpl.java
+++ b/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/internal/baseadaptor/weaving/WovenClassImpl.java
@@ -34,6 +34,7 @@ public final class WovenClassImpl implements WovenClass, HookContext {
private byte[] bytes;
private byte hookFlags = 0;
private Throwable error;
+ private ServiceRegistration<?> errorHook;
private Class<?> clazz;
public WovenClassImpl(String className, byte[] bytes, ProtectionDomain domain, BundleLoader loader, ServiceRegistry registry, Map<ServiceRegistration<?>, Boolean> blacklist) {
@@ -114,7 +115,7 @@ public final class WovenClassImpl implements WovenClass, HookContext {
}
public BundleWiring getBundleWiring() {
- return loader.getLoaderProxy().getBundleDescription().getBundleWiring();
+ return loader.getLoaderProxy().getBundleDescription().getWiring();
}
public void call(final Object hook, ServiceRegistration<?> hookRegistration) throws Exception {
@@ -128,9 +129,11 @@ public final class WovenClassImpl implements WovenClass, HookContext {
((WeavingHook) hook).weave(this);
} catch (WeavingException e) {
error = e;
+ errorHook = hookRegistration;
// do not blacklist on weaving exceptions
} catch (Throwable t) {
error = t; // save the error to fail later
+ errorHook = hookRegistration;
// put the registration on the black list
blackList.put(hookRegistration, Boolean.TRUE);
}
@@ -188,4 +191,8 @@ public final class WovenClassImpl implements WovenClass, HookContext {
public String toString() {
return className;
}
+
+ public ServiceRegistration<?> getErrorHook() {
+ return errorHook;
+ }
}

Back to the top