You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@aries.apache.org by "Thomas Watson (JIRA)" <ji...@apache.org> on 2012/11/26 16:14:57 UTC

[jira] [Created] (ARIES-971) ServiceHelper.CacheClearoutListener.add(BundleContext, ServiceKey) causes NPE if system bundle is hidden

Thomas Watson created ARIES-971:
-----------------------------------

             Summary: 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


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 is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Assigned] (ARIES-971) ServiceHelper.CacheClearoutListener.add(BundleContext, ServiceKey) causes NPE if system bundle is hidden

Posted by "Mark Nuttall (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/ARIES-971?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Mark Nuttall reassigned ARIES-971:
----------------------------------

    Assignee: Mark Nuttall
    
> 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
>
> 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 is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Resolved] (ARIES-971) ServiceHelper.CacheClearoutListener.add(BundleContext, ServiceKey) causes NPE if system bundle is hidden

Posted by "Mark Nuttall (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/ARIES-971?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Mark Nuttall resolved ARIES-971.
--------------------------------

       Resolution: Fixed
    Fix Version/s: 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: 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 is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira