Details
-
Improvement
-
Status: Closed
-
Major
-
Resolution: Fixed
-
framework-6.0.1
-
None
-
Important
Description
The class SecurityManagerEx is a wrapper class around java.lang.SecurityManager so that it can expose access to the protected method getClassContext which returns a Class[].
The code as it currently is coded looks like this:
public Class[] getClassContext()
{return super.getClassContext(); }
It looks fine, however, super.getClassContext() at least in the Android implementation returns null. Here's the Android's implementation code for java.lanaguage.SecurityManager:
public Object getSecurityContext() {
return null;
}
SecurityManager.getClassContent() is called in the class BundleWiringImpl in the method
private Object tryImplicitBootDelegation(final String name, final boolean isClass)
it passes the result of SecurityManager.getClassContent() (which is null - parameter name classes) to the method doImplicitBootDelegation. Here's what that code looks like:
private Object doImplicitBootDelegation(Class[] classes, String name, boolean isClass)
throws ClassNotFoundException, ResourceNotFoundException
{
// Start from 1 to skip security manager class. for (int i = 1; i < classes.length; i++)
Since classes is null, classes.length throws an exception. This problem has in my case caused a bundleActivator not to be found.
The best solution to the problem is to modify the SecurityManagerEx.getClassContext routine to the following:
public Class[] getClassContext()
{
Class[] classes = super.getClassContext();
if (classes == null) classes = new Class[0];
return classes;
}