aries-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Guillaume Nodet (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (ARIES-971) ServiceHelper.CacheClearoutListener.add(BundleContext, ServiceKey) causes NPE if system bundle is hidden
Date Wed, 15 Oct 2014 16:10:35 GMT

     [ https://issues.apache.org/jira/browse/ARIES-971?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Guillaume Nodet updated ARIES-971:
----------------------------------
    Fix Version/s:     (was: 1.0)
                   jndi-url-1.1.0

> ServiceHelper.CacheClearoutListener.add(BundleContext, ServiceKey) causes NPE if system
bundle is hidden
> --------------------------------------------------------------------------------------------------------
>
>                 Key: ARIES-971
>                 URL: https://issues.apache.org/jira/browse/ARIES-971
>             Project: Aries
>          Issue Type: Bug
>          Components: JNDI
>         Environment: All
>            Reporter: Thomas Watson
>            Assignee: Mark Nuttall
>             Fix For: jndi-url-1.1.0
>
>
> In org.apache.aries.jndi.services.ServiceHelper.CacheClearoutListener.add(BundleContext,
ServiceKey) the following code will cause an NPE:
>  // try to use the system bundle for our listener, 
>  // if that fails we fall back to the calling context
>  BundleContext systemBundle = 
>    AccessController.doPrivileged(new PrivilegedAction<BundleContext>() {
>    public BundleContext run()
>    {
>      return ctx.getBundle(0).getBundleContext(); <<< NPE here
>    }
>  });
> This can happen if a bundle FindHook hides the bundle 0 from the ctx bundle.  A check
for null should be done here:
>  BundleContext systemBundle = 
>    AccessController.doPrivileged(new PrivilegedAction<BundleContext>() {
>    public BundleContext run()
>    {
>      Bundle system = ctx.getBundle(0);
>      return system == null ? null : system.getBundleContext();
>    }
>  });
> This would allow jndi to work in such environments where bundle, service, and resolver
hooks are used for isolation (e.g. subsystems).



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message