You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ro...@apache.org on 2020/09/22 14:56:14 UTC

[sling-org-apache-sling-jcr-base] 01/03: SLING-9722 - AbstractSlingRepositoryManager.stop throws NullPointerExceptions if invoked multiple times

This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag org.apache.sling.jcr.base-3.1.6
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-jcr-base.git

commit 26eaf8e9d1a37e050479d3f2256dd85dfe644ba1
Author: Robert Munteanu <ro...@apache.org>
AuthorDate: Tue Sep 22 16:25:42 2020 +0200

    SLING-9722 - AbstractSlingRepositoryManager.stop throws NullPointerExceptions if invoked multiple times
    
    Add null check. There may still be a check-then-act condition here. However, the waitForStartupThreadToComplete method is probably heavyweight enough to ensure that we don't see the race condition fulfilled.
---
 .../java/org/apache/sling/jcr/base/AbstractSlingRepositoryManager.java  | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/main/java/org/apache/sling/jcr/base/AbstractSlingRepositoryManager.java b/src/main/java/org/apache/sling/jcr/base/AbstractSlingRepositoryManager.java
index 65ab01b..f5d22b8 100644
--- a/src/main/java/org/apache/sling/jcr/base/AbstractSlingRepositoryManager.java
+++ b/src/main/java/org/apache/sling/jcr/base/AbstractSlingRepositoryManager.java
@@ -616,7 +616,7 @@ public abstract class AbstractSlingRepositoryManager {
      */
     protected final void stop() {
         log.info("Stop requested");
-        if ( startupThread != Thread.currentThread() ) {
+        if ( startupThread != null && startupThread != Thread.currentThread() ) {
             waitForStartupThreadToComplete();
             startupThread = null;
         }