[
https://issues.apache.org/jira/browse/FELIX-6281?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Raymond Augé reassigned FELIX-6281:
-----------------------------------
Assignee: Raymond Augé
> Potential class space issues for getLogger(Bundle ...)
> ------------------------------------------------------
>
> Key: FELIX-6281
> URL: https://issues.apache.org/jira/browse/FELIX-6281
> Project: Felix
> Issue Type: Improvement
> Components: Log Service
> Affects Versions: log-1.2.2
> Reporter: Tom Watson
> Assignee: Raymond Augé
> Priority: Major
>
> The method org.osgi.service.log.LoggerFactory.getLogger(Bundle, String,
> Class<L>) can get a cast exception on the return from
> org.apache.felix.log.LogServiceImpl.getLogService(Bundle) if the specified
> bundle is wired to another version of the org.osgi.service.log package and
> there is another LogService registered using that version of the package.
>
> There are a few other issues with the approach of using the specified
> bundle's context.
> * The bundle may not have a valid BundleContext if it is not
> STARTING/STOPPING/ACTIVE
> * If there is no LogService registered with the other package then there
> will be no available ServiceReference
> * The state check for RESOLVED || ACTIVE is problematic because it omits
> STARTING/STOPPING but it also lets it try to get a context for a RESOLVED
> bundle which will cause an NPE
>
> Instead the method should allow you to get a logger as long as the bundle is
> not UNINSTALLED in my opinion.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)