From 5137f44bd66bdd92b8e99310eefa6b3fd935cc9b Mon Sep 17 00:00:00 2001 From: Simon Willnauer Date: Sat, 15 Oct 2016 14:45:24 +0200 Subject: [PATCH] [TEST] return empty array if AbstractQueryTestCase#currentTypes is null This is important to allow any test to use RandomQueryBuilder#createQuery() since some of the query builders that are used in this test test the length of the types array and otherwise will thow NPE if the test is not a subclass of AbstractQueryTestCase. --- .../main/java/org/elasticsearch/test/AbstractQueryTestCase.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/framework/src/main/java/org/elasticsearch/test/AbstractQueryTestCase.java b/test/framework/src/main/java/org/elasticsearch/test/AbstractQueryTestCase.java index 9cb8af9f74b..0b152fcf341 100644 --- a/test/framework/src/main/java/org/elasticsearch/test/AbstractQueryTestCase.java +++ b/test/framework/src/main/java/org/elasticsearch/test/AbstractQueryTestCase.java @@ -159,7 +159,7 @@ public abstract class AbstractQueryTestCase> } protected static String[] getCurrentTypes() { - return currentTypes; + return currentTypes == null ? Strings.EMPTY_ARRAY : currentTypes; } protected Collection> getPlugins() {