You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@felix.apache.org by "Tom Watson (Jira)" <ji...@apache.org> on 2020/05/29 19:36:00 UTC
[jira] [Created] (FELIX-6281) Potential class space issues for
getLogger(Bundle ...)
Tom Watson created FELIX-6281:
---------------------------------
Summary: 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
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)