[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[equinox-dev] Bug when defining AdminPermissions for signed bundles using PermissionAdmin?!

While writing some example code that uses AdminPermission to setup certain permissions for bundles that have been signed by a specific certificate, I think I've run into a bug in Equinox, so I've filed it as https://bugs.eclipse.org/bugs/show_bug.cgi?id=217818

I'm creating a bundle after an example found in the OSGi core R4.1 specification on page 101-278 (4.8.1 Admin Permission). The example shows how to restrict AdminPermission to bundles of a signer that has a subject name of ACME.

After defining this permission, I then run code from a bundle that needs this permission, and I get a ClassCastException at the point where this permission is (probably) being checked. The partial stack trace is printed below:

java.lang.ClassCastException: [Ljava.lang.String;
    at org.eclipse.osgi.framework.internal.core.FilterImpl.compare_Unknown(FilterImpl.java:1251)
    at org.eclipse.osgi.framework.internal.core.FilterImpl.compare(FilterImpl.java:578)
    at org.eclipse.osgi.framework.internal.core.FilterImpl.match0(FilterImpl.java:455)
    at org.eclipse.osgi.framework.internal.core.FilterImpl.match(FilterImpl.java:178)
    at org.osgi.framework.AdminPermission.implies(AdminPermission.java:443)
    at equinox_bug_adminpermission.Activator.start(Activator.java:32)

this occurs when the security check is invoked when calling getHeaders() on a bundle. This is line 32:

    Dictionary headers = b.getHeaders();

To be honest, I'm kind of puzzled by this because this seems to be quite a basic example, so I might be overlooking something simple here?

Greetings, Marcel