Tom Rutchik created FELIX-5914:
----------------------------------
Summary: issue with SecurityManagerEx
Key: FELIX-5914
URL: https://issues.apache.org/jira/browse/FELIX-5914
Project: Felix
Issue Type: Bug
Components: Framework
Affects Versions: framework-6.0.1
Reporter: Tom Rutchik
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:
{color:#000080}public {color}Class[] getClassContext()
{return {color:#000080}super{color}.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:
{color:#000080}public {color}Object getSecurityContext() {
{color:#000080}return null{color};
}
SecurityManager.getClassContent() is called in the class BundleWiringImpl in
the method
{color:#000080}private {color}Object
tryImplicitBootDelegation({color:#000080}final {color}String name,
{color:#000080}final boolean {color}isClass)
it passes the result of {color:#333333}SecurityManager.getClassContent() (which
is null - parameter name classes) to the method doImplicitBootDelegation.
Here's what that code looks like:{color}
{color:#000080}private {color}Object doImplicitBootDelegation(Class[] classes,
String name, {color:#000080}boolean {color}isClass)
{color:#000080}throws {color}ClassNotFoundException, ResourceNotFoundException
{
{color:#808080}// Start from 1 to skip security manager class.
{color} {color:#000080}for {color}({color:#000080}int {color}i =
{color:#0000ff}1{color}; i < classes.{color:#660e7a}length{color}; 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:
{color:#000080}public {color}Class[] getClassContext()
{
Class[] classes = {color:#000080}super{color}.getClassContext();
{color:#000080}if {color}(classes == {color:#000080}null{color}) classes =
{color:#000080}new {color}Class[{color:#0000ff}0{color}];
{color:#000080}return {color}classes;
}
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)