You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by GitBox <gi...@apache.org> on 2021/11/24 13:22:03 UTC

[GitHub] [sling-org-apache-sling-testing-osgi-mock] kwin commented on a change in pull request #14: SLING-10930 add failing test with multiple deactivate() calls on the

kwin commented on a change in pull request #14:
URL: https://github.com/apache/sling-org-apache-sling-testing-osgi-mock/pull/14#discussion_r756068175



##########
File path: test-services/src/main/java/org/apache/sling/testing/mock/osgi/testsvc/osgiserviceutil/activatedeactivate/Service8.java
##########
@@ -40,7 +40,8 @@ private void activate(BundleContext bundleContext) {
     @Deactivate
     private void deactivate(BundleContext bundleContext) {
         serviceRegistration.unregister();
-        //serviceRegistration = null; // this may cause a NPE with subsequent deactivate() calls
+        // explicitly set to null to ensure deactivate is never called twice
+        serviceRegistration = null;

Review comment:
       This will lead to another exception (NPE instead of ISE)




-- 
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-unsubscribe@sling.apache.org

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