DM/ NPE on some dependency manager adapters, when "auto-configuration" mode is
disabled.
----------------------------------------------------------------------------------------
Key: FELIX-2964
URL: https://issues.apache.org/jira/browse/FELIX-2964
Project: Felix
Issue Type: Bug
Components: Dependency Manager
Reporter: Pierre De Rop
Assignee: Pierre De Rop
Priority: Minor
Components are by default in "auto-config" mode. That is: some special objects
(like DependencyManager, BundleContext, etc ..) are auto-injected in Components.
But when auto-configuration is disabled on some Dependency Manager adapters
component, then we get some Null Pointers in the adapters implementations.
For example:
Component adapter = m.createAdapterService(OriginalService.class, null)
.setInterface(AdaptedService.class.getName(), null)
.setImplementation(ServiceAdapter.class)
.setAutoConfig(DependencyManager.class, Boolean.FALSE);
is getting the following exception:
WARN Invocation of 'added' failed. - java.lang.NullPointerException
at
org.apache.felix.dm.impl.AdapterServiceImpl$AdapterImpl.createService(AdapterServiceImpl.java:97)
at
org.apache.felix.dm.impl.AbstractDecorator.added(AbstractDecorator.java:199)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
...
The following problems have been identified:
- in AbstractDecorator -> the "m_manager" field is supposed to be
auto-injected, but it is not the case when
the component "auto-configuration" mode is disabled for the "DependencyManager"
type.
- in FactoryConfigurationAdapterServiceImpl, we have the same problem as in the
AbstractDecorator: the "m_dm" field is supposed
to be auto-injected with the "DependencyManager" object, but it is not case if
auto-config mode is disabled for "DependencyManager" type.
- in BundleAdapterServiceImpl.java -> the BundleAdapterImpl.createService()
method does not invoke the
"configureAutoConfigState" method.
- in ResourceAdapterServiceImpl.java, we have the same problem as in the
FactoryConfigurationAdapterServiceImpl class.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira