[
https://issues.apache.org/jira/browse/ARIES-41?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12769245#action_12769245
]
Valentin Mahrwald commented on ARIES-41:
----------------------------------------
Sorry, I meant to write more there :)
It looks like we might want to choose to traverse the class hierarchy until we
find a BundleReference class loader or end up at the top. Alternatively, we
could not look at any parents. Anything in between seems a bit arbitrary?
> In JNDI ServiceHelper we should also check for the current thread's context
> classloader's parent
> ------------------------------------------------------------------------------------------------
>
> Key: ARIES-41
> URL: https://issues.apache.org/jira/browse/ARIES-41
> Project: Aries
> Issue Type: Bug
> Components: JNDI
> Reporter: Lin Sun
> Priority: Minor
>
> Hi,
> In the ServiceHelper.getBundleContext(), if the current thread's context
> classloader is not an instance of BundleReference, we should also try to
> check its parent to see if it is an instance of BundleReference. If it is,
> then grab the bundle context accordingly. What do people think?
> Proposed change:
> ClassLoader cl = Thread.currentThread().getContextClassLoader();
> if (cl instanceof BundleReference) {
> result = ((BundleReference)cl).getBundle().getBundleContext();
> + } else if (cl.getParent() instanceof BundleReference) {
> + result =
> ((BundleReference)cl.getParent()).getBundle().getBundleContext();
> }
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.