kwin commented on a change in pull request #34:
URL: 
https://github.com/apache/sling-org-apache-sling-models-impl/pull/34#discussion_r803367825



##########
File path: 
src/main/java/org/apache/sling/models/impl/injectors/OSGiServiceInjector.java
##########
@@ -204,7 +204,11 @@ public Callback(ServiceReference<?>[] refs, BundleContext 
context) {
         public void onDisposed() {
             if (refs != null) {
                 for (ServiceReference<?> ref : refs) {
-                    context.ungetService(ref);
+                    try {
+                        context.ungetService(ref);
+                    } catch (IllegalStateException | IllegalArgumentException 
| NullPointerException exception) {

Review comment:
       NPE should never been caught. That hints at a mistake in the code. Same 
for IAE according to 
https://docs.osgi.org/javadoc/osgi.core/7.0.0/org/osgi/framework/BundleContext.html#ungetService-org.osgi.framework.ServiceReference-.
 Only catching ISE might make sense here, although it is not really clear to me 
how this can happen....




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@sling.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to