From 1393972509a8b18c93645f526372275b3173f123 Mon Sep 17 00:00:00 2001 From: Marco Miller Date: Thu, 23 May 2019 16:10:29 -0400 Subject: [PATCH] IndexModule: Use lowercase IndexType values consistently Before this change, the init would fail as reported in the merged Ia129d3eb's trailing comments. Change-Id: I55af38995166c2b9f4dbb9fbc6196df083411a89 --- java/com/google/gerrit/server/index/IndexModule.java | 10 +++++----- .../google/gerrit/elasticsearch/ElasticTestUtils.java | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/java/com/google/gerrit/server/index/IndexModule.java b/java/com/google/gerrit/server/index/IndexModule.java index 686219cd20..899e0612b3 100644 --- a/java/com/google/gerrit/server/index/IndexModule.java +++ b/java/com/google/gerrit/server/index/IndexModule.java @@ -74,13 +74,13 @@ import org.eclipse.jgit.lib.Config; */ public class IndexModule extends LifecycleModule { public static class IndexType { - private static final String LUCENE = "LUCENE"; - private static final String ELASTICSEARCH = "ELASTICSEARCH"; + private static final String LUCENE = "lucene"; + private static final String ELASTICSEARCH = "elasticsearch"; private final String type; public IndexType(@Nullable String type) { - this.type = type == null ? getDefault() : type; + this.type = type == null ? getDefault() : type.toLowerCase(); } public static String getDefault() { @@ -92,11 +92,11 @@ public class IndexModule extends LifecycleModule { } public boolean isLucene() { - return type.equalsIgnoreCase(LUCENE); + return type.equals(LUCENE); } public boolean isElasticsearch() { - return type.equalsIgnoreCase(ELASTICSEARCH); + return type.equals(ELASTICSEARCH); } @Override diff --git a/javatests/com/google/gerrit/elasticsearch/ElasticTestUtils.java b/javatests/com/google/gerrit/elasticsearch/ElasticTestUtils.java index 7eb26bd97f..680287383b 100644 --- a/javatests/com/google/gerrit/elasticsearch/ElasticTestUtils.java +++ b/javatests/com/google/gerrit/elasticsearch/ElasticTestUtils.java @@ -32,7 +32,7 @@ public final class ElasticTestUtils { } public static void configure(Config config, int port, String prefix, ElasticVersion version) { - config.setString("index", null, "type", "ELASTICSEARCH"); + config.setString("index", null, "type", "elasticsearch"); config.setString("elasticsearch", null, "server", "http://localhost:" + port); config.setString("elasticsearch", null, "prefix", prefix); config.setInt("index", null, "maxLimit", 10000);