Repository: asterixdb Updated Branches: refs/heads/master f4e755e4b -> 18b8323ee
[ASTERIXDB-2007][CLUS] Ensure AppCtx created before stopping Active Handler - user model changes: no - storage format changes: no - interface changes: no details: - if application.start() fails before creation of the application context, then application.stop() will throw a null pointer exception. This change checks that appCtx is not null before dispatching calls on the object. Change-Id: I898b6192fd91054129ed11d20c7ffe21116408c2 Reviewed-on: https://asterix-gerrit.ics.uci.edu/1908 Sonar-Qube: Jenkins <[email protected]> Tested-by: Jenkins <[email protected]> Integration-Tests: Jenkins <[email protected]> BAD: Jenkins <[email protected]> Reviewed-by: Murtadha Hubail <[email protected]> Project: http://git-wip-us.apache.org/repos/asf/asterixdb/repo Commit: http://git-wip-us.apache.org/repos/asf/asterixdb/commit/18b8323e Tree: http://git-wip-us.apache.org/repos/asf/asterixdb/tree/18b8323e Diff: http://git-wip-us.apache.org/repos/asf/asterixdb/diff/18b8323e Branch: refs/heads/master Commit: 18b8323eef11544719af8119677f64fc0c234935 Parents: f4e755e Author: Abdullah Alamoudi <[email protected]> Authored: Sun Jul 30 09:52:16 2017 -0700 Committer: abdullah alamoudi <[email protected]> Committed: Sun Jul 30 11:24:31 2017 -0700 ---------------------------------------------------------------------- .../org/apache/asterix/hyracks/bootstrap/CCApplication.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/asterixdb/blob/18b8323e/asterixdb/asterix-app/src/main/java/org/apache/asterix/hyracks/bootstrap/CCApplication.java ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-app/src/main/java/org/apache/asterix/hyracks/bootstrap/CCApplication.java b/asterixdb/asterix-app/src/main/java/org/apache/asterix/hyracks/bootstrap/CCApplication.java index dc92f92..3627974 100644 --- a/asterixdb/asterix-app/src/main/java/org/apache/asterix/hyracks/bootstrap/CCApplication.java +++ b/asterixdb/asterix-app/src/main/java/org/apache/asterix/hyracks/bootstrap/CCApplication.java @@ -65,7 +65,6 @@ import org.apache.asterix.common.config.MetadataProperties; import org.apache.asterix.common.context.IStorageComponentProvider; import org.apache.asterix.common.dataflow.ICcApplicationContext; import org.apache.asterix.common.library.ILibraryManager; -import org.apache.asterix.metadata.lock.MetadataLockManager; import org.apache.asterix.common.replication.IFaultToleranceStrategy; import org.apache.asterix.common.replication.IReplicationStrategy; import org.apache.asterix.common.utils.Servlets; @@ -76,6 +75,7 @@ import org.apache.asterix.metadata.MetadataManager; import org.apache.asterix.metadata.api.IAsterixStateProxy; import org.apache.asterix.metadata.bootstrap.AsterixStateProxy; import org.apache.asterix.metadata.cluster.ClusterManagerProvider; +import org.apache.asterix.metadata.lock.MetadataLockManager; import org.apache.asterix.runtime.job.resource.JobCapacityController; import org.apache.asterix.runtime.utils.CcApplicationContext; import org.apache.asterix.runtime.utils.ClusterStateManager; @@ -183,7 +183,9 @@ public class CCApplication extends BaseCCApplication { @Override public void stop() throws Exception { - ((ActiveNotificationHandler) appCtx.getActiveNotificationHandler()).stop(); + if (appCtx != null) { + ((ActiveNotificationHandler) appCtx.getActiveNotificationHandler()).stop(); + } if (LOGGER.isLoggable(Level.INFO)) { LOGGER.info("Stopping Asterix cluster controller"); }
