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

Carsten Ziegeler commented on FELIX-6429:
-----------------------------------------

Previous PR was wrong. I've now added a test case in [1] which demonstrates the 
problem.

I think we can't fix this - in the prototype case, the ungetService method 
can't distinguish between a service object where unget was called more than 
once and an object that was never get from ServiceObjects to beginn with.
Both cases end up at
https://github.com/apache/felix-dev/blob/master/framework/src/main/java/org/apache/felix/framework/ServiceRegistry.java#L479

The only solution I see is if the service registry (or ServiceObjects) keeps 
all prototype objects ever returned forever - which I think is not a good idea

[1] 
https://github.com/apache/felix-dev/commit/126959332207692c508f1733bcafc39c072a2c48

> IllegalArgumentException that should not happen
> -----------------------------------------------
>
>                 Key: FELIX-6429
>                 URL: https://issues.apache.org/jira/browse/FELIX-6429
>             Project: Felix
>          Issue Type: Bug
>          Components: Framework
>    Affects Versions: framework-7.0.0
>            Reporter: Jürgen Albert
>            Assignee: Karl Pauls
>            Priority: Major
>             Fix For: framework-7.0.2
>
>
> We recently stumbled a couple of times over an IllegalArgumentException when 
> calling ServiceObjects.ungetService. In our case we are always in an async 
> process and the service we are calling unget for ist already unregistered. 
> According to the org.osgi.framework.ServiceObjects Spec the Exception will be 
> thrown under the following circumstances:
> {code:java}
>  @throws IllegalArgumentException If the specified service object is
>        {@code null} or was not provided by a {@code ServiceObjects}
>        object for the associated service.
> {code}
> I can guarantee that both conditions are not meet in our case. It is simply 
> that the service is already unregistered.
> If I read the javadoc correctly it should simply do nothing in such a case. I 
> haven't checked with the Spec though.



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

Reply via email to