[ 
https://issues.apache.org/jira/browse/FELIX-3914?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14184984#comment-14184984
 ] 

Pierre De Rop commented on FELIX-3914:
--------------------------------------

Hello Tuomas;

I have committed in revision 1634480 a patch for the logging of unsuccessful 
field injections. Additionally, non existing dependency callbacks are also 
logged.

Here is an example for an unsuccessful field injection:

2014.10.27 08:33:13 WARNING - Bundle: 
org.apache.felix.dependencymanager.samples.device.api - Could not inject 
dependency org.osgi.service.log.LogService to field "log" at any of the 
following component instances: 
[org.apache.felix.dependencymanager.samples.device.api.DeviceAccessImpl@142c28a]

And here is an example for a non existing dependency callback:

2014.10.27 08:26:29 WARNING - Bundle: 
org.apache.felix.dependencymanager.samples.device.api - Dependency "setLog" 
callback not found on componnent instances 
[org.apache.felix.dependencymanager.samples.device.api.DeviceAccessImpl@fe1a8d]

Care has been taken to not log warnings on AbstractDecorator component 
instances, which are special internal DM components and are not interested in 
user dependency callbacks (and user autoconfigured dependencies).

Also, when a composition of object instances are used (when many objects are 
used to implement a given service, using Component.setComposition method), then 
the warn message is logged only if *all* object instances can't be injected 
using a given field (or dependency callback), because usually, when using 
objects composition, not all objects in the composition are necessarily needing 
to be injected with all declared dependencies.

If you have a chance to test the DM4 from the sandbox [1] and if you are 
satisfied, then please change the state of this issue to "Resolved" (I will 
then close it later, after the DM 4.0.0 is released). thanks !

[1] 
http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager-prototype
(see also the README in 
http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager-prototype/README
 in order to import DM4 in bndtools).


> Log unsuccessful field injections
> ---------------------------------
>
>                 Key: FELIX-3914
>                 URL: https://issues.apache.org/jira/browse/FELIX-3914
>             Project: Felix
>          Issue Type: Improvement
>          Components: Dependency Manager
>            Reporter: Tuomas Kiviaho
>            Assignee: Pierre De Rop
>             Fix For: dependencymanager-4.0.0
>
>         Attachments: ComponentImpl.patch
>
>
> I had an NPE scenario where service dependency's tracked class was not 
> assignable from a field which auto config instance name pointed to. It took 
> me a while to figure out this trivial error because dependency manager only 
> reports if field setting fails but the case where it is not even performed.



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

Reply via email to