diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/EquinoxConfiguration.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/EquinoxConfiguration.java index 14f398dcd3..21cd5b26da 100644 --- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/EquinoxConfiguration.java +++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/EquinoxConfiguration.java @@ -274,6 +274,10 @@ public class EquinoxConfiguration implements EnvironmentInfo { public final int supportSignedBundles; public final boolean runtimeVerifySignedBundles; + // TODO temp internal prop to pass the TCK + public final static String PROP_THROW_ISE_UNREGISTER = "org.eclipse.osgi.internal.throw.ise.unregister"; //$NON-NLS-1$ + public final boolean THROW_ISE_UNREGISTER; + public static final class ConfigValues { /** * Value of {@link #localConfig} properties that should be considered @@ -670,6 +674,8 @@ org.osgi.framework.Constants.FRAMEWORK_LIBRARY_EXTENSIONS, getOSLibraryExtDefaul CLASS_CERTIFICATE = (supportSignedBundles & SIGNED_CONTENT_VERIFY_CERTIFICATE) != 0 && // Boolean.valueOf(getConfiguration(PROP_CLASS_CERTIFICATE_SUPPORT, "true")).booleanValue(); //$NON-NLS-1$ runtimeVerifySignedBundles = (supportSignedBundles & SIGNED_CONTENT_VERIFY_RUNTIME) != 0; + + THROW_ISE_UNREGISTER = "true".equals(getConfiguration(PROP_THROW_ISE_UNREGISTER)); //$NON-NLS-1$ } private static int getSupportSignedBundles(EquinoxConfiguration config) { diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/serviceregistry/ServiceRegistrationImpl.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/serviceregistry/ServiceRegistrationImpl.java index 252f362c61..84cac8b8de 100644 --- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/serviceregistry/ServiceRegistrationImpl.java +++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/serviceregistry/ServiceRegistrationImpl.java @@ -225,6 +225,10 @@ public void unregister() { synchronized (registry) { synchronized (registrationLock) { if (state != REGISTERED) { /* in the process of unregisterING */ + if (context.getContainer().getConfiguration().THROW_ISE_UNREGISTER) { + // TODO temp behavior enabled to pass the OSGi TCK + throw new IllegalStateException(Msg.SERVICE_ALREADY_UNREGISTERED_EXCEPTION + ' ' + this); + } return; } diff --git a/pom.xml b/pom.xml index 222d666747..45163cb6bd 100644 --- a/pom.xml +++ b/pom.xml @@ -126,6 +126,7 @@ osgi.ee; osgi.ee="II-1.0/JJ-2.0", osgi.ee; osgi.ee="div/tb7a" + true