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

Work around OSGi Framework TCK that expects IllegalStateException #710

Merged
merged 1 commit into from
Dec 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
1 change: 1 addition & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@
osgi.ee; osgi.ee="II-1.0/JJ-2.0",
osgi.ee; osgi.ee="div/tb7a"
</org.osgi.framework.system.capabilities.extra>
<org.eclipse.osgi.internal.throw.ise.unregister>true</org.eclipse.osgi.internal.throw.ise.unregister>
</properties>
</configuration>
</execution>
Expand Down
Loading