You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by cz...@apache.org on 2014/10/24 15:48:24 UTC

svn commit: r1634056 - /sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/JobSchedulerImpl.java

Author: cziegeler
Date: Fri Oct 24 13:48:23 2014
New Revision: 1634056

URL: http://svn.apache.org/r1634056
Log:
SLING-4103 : Potential NPE when services get restarted

Modified:
    sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/JobSchedulerImpl.java

Modified: sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/JobSchedulerImpl.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/JobSchedulerImpl.java?rev=1634056&r1=1634055&r2=1634056&view=diff
==============================================================================
--- sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/JobSchedulerImpl.java (original)
+++ sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/JobSchedulerImpl.java Fri Oct 24 13:48:23 2014
@@ -601,12 +601,15 @@ public class JobSchedulerImpl
             this.stopScheduling();
         } else {
             final boolean previouslyActive = this.active;
-            this.active = this.configuration.getTopologyCapabilities().isLeader();
-            if ( this.active && !previouslyActive ) {
-                this.startScheduling();
-            }
-            if ( !this.active && previouslyActive ) {
-                this.stopScheduling();
+            final JobManagerConfiguration config = this.configuration;
+            if ( config != null ) {
+                this.active = config.getTopologyCapabilities().isLeader();
+                if ( this.active && !previouslyActive ) {
+                    this.startScheduling();
+                }
+                if ( !this.active && previouslyActive ) {
+                    this.stopScheduling();
+                }
             }
         }
     }