You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@felix.apache.org by "Richard S. Hall (JIRA)" <ji...@apache.org> on 2010/10/22 00:53:15 UTC

[jira] Commented: (FELIX-2670) [Framework] Implicit boot delegation doesn't delegate for external code in all cases

    [ https://issues.apache.org/jira/browse/FELIX-2670?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12923680#action_12923680 ] 

Richard S. Hall commented on FELIX-2670:
----------------------------------------

After some investigation and test case creation, I think the test for implicit boot delegation wasn't completely correct. We were trying to walk the stack to determine the ultimate class that triggered the entire class load request. In reality, I think we only want to find the first external class that called into the framework's class loading infrastructure.

If the immediate trigger class was loaded by a bundle, then OSGi rules apply and there is no implicit boot delegation.

If the immediate trigger class was loaded by an external class loader, then OSGi rules apply if Bundle.loadClass() is being called, but implicit boot delegation should occur if it is delegating to a module class loader.

I am attaching a patch that implements this approach, it simplifies the implicit boot delegation logic quite a bit. Also, it passes all of the tests I've created, although I still need to create a test for proxies. I will shortly apply this to trunk and then we should also try some real-world tests. If everything looks ok, then we will go back to addressing exceptional scenarios as they arise.

I am particularly interested if Guillaume could test his scenario from FELIX-962 to make sure it still works with this patch, since this is where I think we started to make things too complicated.

> [Framework] Implicit boot delegation doesn't delegate for external code in all cases
> ------------------------------------------------------------------------------------
>
>                 Key: FELIX-2670
>                 URL: https://issues.apache.org/jira/browse/FELIX-2670
>             Project: Felix
>          Issue Type: Bug
>          Components: Framework
>    Affects Versions: framework-3.0.5
>            Reporter: Richard S. Hall
>            Priority: Minor
>             Fix For: framework-3.2.0
>
>         Attachments: FELIX-2670.txt
>
>
> When determining if a class is not from a bundle in ModuleImpl.isClassNotLoadedFromBundle() (terrible method name, by the way), it attempts to ignore all framework classes by checking if the target class' class loader is the same as the framework's class loader. This check is too broad since the framework's class loader is typically the app class loader, which means that any other code on the class path will not trigger implicit boot delegation.
> You could argue that implicit boot delegation was intended for JRE code and this is ok. However, just by changing the framework launcher to use a different class loader for the framework, you would get implicit boot delegation for code on the class path, so it seems odd that we trigger it under one situation but not another.
> Perhaps the simple solution is to not perform a class loader check, but to compare the package namespace (i.e., use org.apache.felix.framework to determine framework classes).

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.