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

Justin Edelson commented on SLING-5035:
---------------------------------------

bq. no, not really a problem. then it's just the first injector in order that 
is called, but if it has nothing to inject the next in order is requested.

Again, this is not necessarily true. An injector registered with no specific 
ranking may or may not be called 'first'. There could be other injectors 
registered with a negative ranking in which case they would be called before an 
injector with a 0 ranking.

bq. we should clearly document that this behavior of injector ranking is 
currently not in line with OSGi default behavior

The documentation says "Injectors are invoked in order of their service 
ranking, from lowest to highest. See the table below for the rankings of the 
standard injectors." I can't imagine this being clearer :) IMHO adding "... and 
this behvior is different than 'OSGi default behavior' would actually make this 
more confusing.

> Sling Models Injectors should be queried in the reverse order of their 
> service ranking value
> --------------------------------------------------------------------------------------------
>
>                 Key: SLING-5035
>                 URL: https://issues.apache.org/jira/browse/SLING-5035
>             Project: Sling
>          Issue Type: Bug
>          Components: Extensions
>    Affects Versions: Sling Models Impl 1.2.2
>            Reporter: Radu Cotescu
>             Fix For: Sling Models Impl 1.2.4
>
>
> The current version of the {{ModelAdaptorFactory}} \[0\] queries the 
> Injectors in the ascending order of their service ranking value. However they 
> should be queried in the descending order of the service ranking, to use the 
> same logic as the {{BundleContext#getServiceReference(String)}} method \[1\].
> \[0\] - 
> https://github.com/apache/sling/blob/f56b444b765beb1c31eed01b4c09fbda4013a580/bundles/extensions/models/impl/src/main/java/org/apache/sling/models/impl/ModelAdapterFactory.java#L411
> \[1\] - 
> https://osgi.org/javadoc/r4v42/org/osgi/framework/BundleContext.html#getServiceReference(java.lang.String)



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

Reply via email to