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

Stefan Seifert commented on SLING-8781:
---------------------------------------

getting the bundlecontext via FrameworkUtil looks to be much cleaner and seems 
to eleminate nearly all the not-so-elegant pass-through code from the PR? looks 
like it's worth a try.

bq. Also i wonder if i should not remove previous change  [0], warned by [1], 
even though i see it "working" so far.

i was also a bit alerted when seeing the PR [0] if this is really the best 
solution and if it may have side-effects with cleaning up the service 
references after usage, where the current sling model implementation in which 
i've never looked in detail so far. not sure if it does any caching as the 
commit comment implies. if the only reason was to avoid the CNFE it may be 
better to revert it. i'm also unsure how good the unit and integration tests 
are around the  osgi service injection to cover al ledge cases.

> use model's bundle context to lookup services
> ---------------------------------------------
>
>                 Key: SLING-8781
>                 URL: https://issues.apache.org/jira/browse/SLING-8781
>             Project: Sling
>          Issue Type: Improvement
>          Components: Sling Models
>    Affects Versions: Sling Models Impl 1.4.10
>            Reporter: Nicolas Peltier
>            Assignee: Nicolas Peltier
>            Priority: Major
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> Searching for all the silent ClassNotFoundExceptions generated, as discussed 
> offline with [~kpauls]
> {quote}It seems like the sling models service injector is using its own 
> bundle context for the lookup. That makes this case reasonable problematic. 
> Typically, an extender uses the bundle context of the bundle it extends - 
> which would in this case make the lookup likely not run into any CNFE for the 
> assignable check. If anything, you could try there and see if you could make 
> it use the bundle context of the extended bundle.
> {quote}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to