From a989b675b521281a6d2837dac8f619aaf6587e8a Mon Sep 17 00:00:00 2001 From: Tim Brooks Date: Mon, 19 Nov 2018 20:38:49 -0700 Subject: [PATCH] Remove NPE from IndexFollowingIT (#35717) Currently there is a common NPE in the IndexFollowingIT that does not indicate the test failing. This is when a cluster state listener is called and certain index metadata is not yet available. This commit checks that the metadata is not null before performing the logic that depends on the metadata. --- .../test/java/org/elasticsearch/xpack/ccr/IndexFollowingIT.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x-pack/plugin/ccr/src/test/java/org/elasticsearch/xpack/ccr/IndexFollowingIT.java b/x-pack/plugin/ccr/src/test/java/org/elasticsearch/xpack/ccr/IndexFollowingIT.java index 39975d5c291..84062962e37 100644 --- a/x-pack/plugin/ccr/src/test/java/org/elasticsearch/xpack/ccr/IndexFollowingIT.java +++ b/x-pack/plugin/ccr/src/test/java/org/elasticsearch/xpack/ccr/IndexFollowingIT.java @@ -807,7 +807,7 @@ public class IndexFollowingIT extends CcrIntegTestCase { AtomicBoolean closed = new AtomicBoolean(false); clusterService.addListener(event -> { IndexMetaData indexMetaData = event.state().metaData().index(indexName); - if (indexMetaData.getState() == IndexMetaData.State.CLOSE) { + if (indexMetaData != null && indexMetaData.getState() == IndexMetaData.State.CLOSE) { closed.set(true); } });